From 7394643d77895f94666881748af366864d5346d6 Mon Sep 17 00:00:00 2001 From: Masterofowls Date: Fri, 20 Sep 2024 13:25:46 +0300 Subject: [PATCH 1/3] Deplo2y website to gh-pages --- .idea/.gitignore | 5 +++++ .idea/3D_Game.iml | 12 ++++++++++++ .idea/material_theme_project_new.xml | 17 +++++++++++++++++ .idea/misc.xml | 7 +++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ 6 files changed, 55 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/3D_Game.iml create mode 100644 .idea/material_theme_project_new.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/3D_Game.iml b/.idea/3D_Game.iml new file mode 100644 index 0000000..24643cc --- /dev/null +++ b/.idea/3D_Game.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/material_theme_project_new.xml b/.idea/material_theme_project_new.xml new file mode 100644 index 0000000..f7fd3ba --- /dev/null +++ b/.idea/material_theme_project_new.xml @@ -0,0 +1,17 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..30bab2a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..1f5e32d --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 59359e10f575c99280d7f77bd7410106b9ac8024 Mon Sep 17 00:00:00 2001 From: Masterofowls Date: Fri, 20 Sep 2024 13:46:53 +0300 Subject: [PATCH 2/3] Deplo2y website to gh-pages --- package-lock.json | 7422 ----------------------------------------- package.json | 42 - src/WebGPURenderer.js | 1268 ------- 3 files changed, 8732 deletions(-) delete mode 100644 package-lock.json delete mode 100644 package.json delete mode 100644 src/WebGPURenderer.js diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index f31b3cf..0000000 --- a/package-lock.json +++ /dev/null @@ -1,7422 +0,0 @@ -{ - "name": "3d_game", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "3d_game", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "@webgpu/glslang": "^0.0.15", - "cannon-es": "^0.18.0", - "three": "^0.168.0" - }, - "devDependencies": { - "@babel/core": "^7.25.2", - "@babel/preset-env": "^7.25.4", - "assemblyscript": "^0.27.29", - "babel-loader": "^9.1.3", - "css-loader": "^7.1.2", - "gh-pages": "^6.1.1", - "html-loader": "^5.1.0", - "html-webpack-plugin": "^5.6.0", - "style-loader": "^4.0.0", - "webpack": "^5.94.0", - "webpack-cli": "^4.10.0", - "webpack-dev-server": "^4.15.2" - } - }, - "node_modules/@ampproject/remapping": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", - "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", - "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/highlight": "^7.24.7", - "picocolors": "^1.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.25.4", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.25.4.tgz", - "integrity": "sha512-+LGRog6RAsCJrrrg/IO6LGmpphNe5DiK30dGjCoxxeGv49B10/3XYGxPsAwrDlMFcFEvdAUavDT8r9k/hSyQqQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core": { - "version": "7.25.2", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.25.2.tgz", - "integrity": "sha512-BBt3opiCOxUr9euZ5/ro/Xv8/V7yJ5bjYMqG/C1YAo8MIKAnumZalCN+msbci3Pigy4lIQfPUpfMM27HMGaYEA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.24.7", - "@babel/generator": "^7.25.0", - "@babel/helper-compilation-targets": "^7.25.2", - "@babel/helper-module-transforms": "^7.25.2", - "@babel/helpers": "^7.25.0", - "@babel/parser": "^7.25.0", - "@babel/template": "^7.25.0", - "@babel/traverse": "^7.25.2", - "@babel/types": "^7.25.2", - "convert-source-map": "^2.0.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.3", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/generator": { - "version": "7.25.6", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.25.6.tgz", - "integrity": "sha512-VPC82gr1seXOpkjAAKoLhP50vx4vGNlF4msF64dSFq1P8RfB+QAuJWGHPXXPc8QyfVWwwB/TNNU4+ayZmHNbZw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.25.6", - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.25", - "jsesc": "^2.5.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-annotate-as-pure": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.24.7.tgz", - "integrity": "sha512-BaDeOonYvhdKw+JoMVkAixAAJzG2jVPIwWoKBPdYuY9b452e2rPuI9QPYh3KpofZ3pW2akOmwZLOiOsHMiqRAg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.24.7.tgz", - "integrity": "sha512-xZeCVVdwb4MsDBkkyZ64tReWYrLRHlMN72vP7Bdm3OUOuyFZExhsHUUnuWnm2/XOlAJzR0LfPpB56WXZn0X/lA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.25.2", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.2.tgz", - "integrity": "sha512-U2U5LsSaZ7TAt3cfaymQ8WHh0pxvdHoEk6HVpaexxixjyEquMh0L0YNJNM6CTGKMXV1iksi0iZkGw4AcFkPaaw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.25.2", - "@babel/helper-validator-option": "^7.24.8", - "browserslist": "^4.23.1", - "lru-cache": "^5.1.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.25.4", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.25.4.tgz", - "integrity": "sha512-ro/bFs3/84MDgDmMwbcHgDa8/E6J3QKNTk4xJJnVeFtGE+tL0K26E3pNxhYz2b67fJpt7Aphw5XcploKXuCvCQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.24.7", - "@babel/helper-member-expression-to-functions": "^7.24.8", - "@babel/helper-optimise-call-expression": "^7.24.7", - "@babel/helper-replace-supers": "^7.25.0", - "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", - "@babel/traverse": "^7.25.4", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-create-regexp-features-plugin": { - "version": "7.25.2", - "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.25.2.tgz", - "integrity": "sha512-+wqVGP+DFmqwFD3EH6TMTfUNeqDehV3E/dl+Sd54eaXqm17tEUNbEIn4sVivVowbvUpOtIGxdo3GoXyDH9N/9g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.24.7", - "regexpu-core": "^5.3.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-define-polyfill-provider": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.2.tgz", - "integrity": "sha512-LV76g+C502biUK6AyZ3LK10vDpDyCzZnhZFXkH1L75zHPj68+qc8Zfpx2th+gzwA2MzyK+1g/3EPl62yFnVttQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-compilation-targets": "^7.22.6", - "@babel/helper-plugin-utils": "^7.22.5", - "debug": "^4.1.1", - "lodash.debounce": "^4.0.8", - "resolve": "^1.14.2" - }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" - } - }, - "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.24.8.tgz", - "integrity": "sha512-LABppdt+Lp/RlBxqrh4qgf1oEH/WxdzQNDJIu5gC/W1GyvPVrOBiItmmM8wan2fm4oYqFuFfkXmlGpLQhPY8CA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/traverse": "^7.24.8", - "@babel/types": "^7.24.8" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz", - "integrity": "sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.25.2", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.25.2.tgz", - "integrity": "sha512-BjyRAbix6j/wv83ftcVJmBt72QtHI56C7JXZoG2xATiLpmoC7dpd8WnkikExHDVPpi/3qCmO6WY1EaXOluiecQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-imports": "^7.24.7", - "@babel/helper-simple-access": "^7.24.7", - "@babel/helper-validator-identifier": "^7.24.7", - "@babel/traverse": "^7.25.2" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.24.7.tgz", - "integrity": "sha512-jKiTsW2xmWwxT1ixIdfXUZp+P5yURx2suzLZr5Hi64rURpDYdMW0pv+Uf17EYk2Rd428Lx4tLsnjGJzYKDM/6A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.8.tgz", - "integrity": "sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-remap-async-to-generator": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.25.0.tgz", - "integrity": "sha512-NhavI2eWEIz/H9dbrG0TuOicDhNexze43i5z7lEqwYm0WEZVTwnPpA0EafUTP7+6/W79HWIP2cTe3Z5NiSTVpw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.24.7", - "@babel/helper-wrap-function": "^7.25.0", - "@babel/traverse": "^7.25.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-replace-supers": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.25.0.tgz", - "integrity": "sha512-q688zIvQVYtZu+i2PsdIu/uWGRpfxzr5WESsfpShfZECkO+d2o+WROWezCi/Q6kJ0tfPa5+pUGUlfx2HhrA3Bg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-member-expression-to-functions": "^7.24.8", - "@babel/helper-optimise-call-expression": "^7.24.7", - "@babel/traverse": "^7.25.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-simple-access": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz", - "integrity": "sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.24.7.tgz", - "integrity": "sha512-IO+DLT3LQUElMbpzlatRASEyQtfhSE0+m465v++3jyyXeBTBUjtVZg28/gHeV5mrTJqvEKhKroBGAvhW+qPHiQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-string-parser": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz", - "integrity": "sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", - "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz", - "integrity": "sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-wrap-function": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.25.0.tgz", - "integrity": "sha512-s6Q1ebqutSiZnEjaofc/UKDyC4SbzV5n5SrA2Gq8UawLycr3i04f1dX4OzoQVnexm6aOCh37SQNYlJ/8Ku+PMQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.25.0", - "@babel/traverse": "^7.25.0", - "@babel/types": "^7.25.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers": { - "version": "7.25.6", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.25.6.tgz", - "integrity": "sha512-Xg0tn4HcfTijTwfDwYlvVCl43V6h4KyVVX2aEm4qdO/PC6L2YvzLHFdmxhoeSA3eslcE6+ZVXHgWwopXYLNq4Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.25.0", - "@babel/types": "^7.25.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", - "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.24.7", - "chalk": "^2.4.2", - "js-tokens": "^4.0.0", - "picocolors": "^1.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.25.6", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.6.tgz", - "integrity": "sha512-trGdfBdbD0l1ZPmcJ83eNxB9rbEax4ALFTF7fN386TMYbeCQbyme5cOEXQhbGXKebwGaB/J52w1mrklMcbgy6Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.25.6" - }, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/plugin-bugfix-firefox-class-in-computed-class-key": { - "version": "7.25.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.25.3.tgz", - "integrity": "sha512-wUrcsxZg6rqBXG05HG1FPYgsP6EvwF4WpBbxIpWIIYnH8wG0gzx3yZY3dtEHas4sTAOGkbTsc9EGPxwff8lRoA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/traverse": "^7.25.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-bugfix-safari-class-field-initializer-scope": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.25.0.tgz", - "integrity": "sha512-Bm4bH2qsX880b/3ziJ8KD711LT7z4u8CFudmjqle65AZj/HNUFhEf90dqYv6O86buWvSBmeQDjv0Tn2aF/bIBA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.25.0.tgz", - "integrity": "sha512-lXwdNZtTmeVOOFtwM/WDe7yg1PL8sYhRk/XH0FzbR2HDQ0xC+EnQ/JHeoMYSavtU115tnUk0q9CDyq8si+LMAA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.24.7.tgz", - "integrity": "sha512-+izXIbke1T33mY4MSNnrqhPXDz01WYhEf3yF5NbnUtkiNnm+XBZJl3kNfoK6NKmYlz/D07+l2GWVK/QfDkNCuQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", - "@babel/plugin-transform-optional-chaining": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.13.0" - } - }, - "node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.25.0.tgz", - "integrity": "sha512-tggFrk1AIShG/RUQbEwt2Tr/E+ObkfwrPjR6BjbRvsx24+PSjK8zrq0GWPNCjo8qpRx4DuJzlcvWJqlm+0h3kw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/traverse": "^7.25.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-proposal-private-property-in-object": { - "version": "7.21.0-placeholder-for-preset-env.2", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", - "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", - "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", - "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.12.13" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-class-static-block": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", - "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", - "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-export-namespace-from": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", - "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.3" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-import-assertions": { - "version": "7.25.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.25.6.tgz", - "integrity": "sha512-aABl0jHw9bZ2karQ/uUD6XP4u0SG22SJrOHFoL6XB1R7dTovOP4TzTlsxOYC5yQ1pdscVK2JTUnF6QL3ARoAiQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-import-attributes": { - "version": "7.25.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.25.6.tgz", - "integrity": "sha512-sXaDXaJN9SNLymBdlWFA+bjzBhFD617ZaFiY13dGt7TVslVvVgA6fkZOP7Ki3IGElC45lwHdOTrCtKZGVAWeLQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-import-meta": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", - "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", - "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", - "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", - "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", - "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", - "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", - "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-private-property-in-object": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", - "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", - "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-unicode-sets-regex": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz", - "integrity": "sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-transform-arrow-functions": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.24.7.tgz", - "integrity": "sha512-Dt9LQs6iEY++gXUwY03DNFat5C2NbO48jj+j/bSAz6b3HgPs39qcPiYt77fDObIcFwj3/C2ICX9YMwGflUoSHQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-async-generator-functions": { - "version": "7.25.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.25.4.tgz", - "integrity": "sha512-jz8cV2XDDTqjKPwVPJBIjORVEmSGYhdRa8e5k5+vN+uwcjSrSxUaebBRa4ko1jqNF2uxyg8G6XYk30Jv285xzg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-remap-async-to-generator": "^7.25.0", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/traverse": "^7.25.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-async-to-generator": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.24.7.tgz", - "integrity": "sha512-SQY01PcJfmQ+4Ash7NE+rpbLFbmqA2GPIgqzxfFTL4t1FKRq4zTms/7htKpoCUI9OcFYgzqfmCdH53s6/jn5fA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-imports": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/helper-remap-async-to-generator": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-block-scoped-functions": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.24.7.tgz", - "integrity": "sha512-yO7RAz6EsVQDaBH18IDJcMB1HnrUn2FJ/Jslc/WtPPWcjhpUJXU/rjbwmluzp7v/ZzWcEhTMXELnnsz8djWDwQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-block-scoping": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.25.0.tgz", - "integrity": "sha512-yBQjYoOjXlFv9nlXb3f1casSHOZkWr29NX+zChVanLg5Nc157CrbEX9D7hxxtTpuFy7Q0YzmmWfJxzvps4kXrQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-class-properties": { - "version": "7.25.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.25.4.tgz", - "integrity": "sha512-nZeZHyCWPfjkdU5pA/uHiTaDAFUEqkpzf1YoQT2NeSynCGYq9rxfyI3XpQbfx/a0hSnFH6TGlEXvae5Vi7GD8g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.25.4", - "@babel/helper-plugin-utils": "^7.24.8" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-class-static-block": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.24.7.tgz", - "integrity": "sha512-HMXK3WbBPpZQufbMG4B46A90PkuuhN9vBCb5T8+VAHqvAqvcLi+2cKoukcpmUYkszLhScU3l1iudhrks3DggRQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-class-static-block": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.12.0" - } - }, - "node_modules/@babel/plugin-transform-classes": { - "version": "7.25.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.25.4.tgz", - "integrity": "sha512-oexUfaQle2pF/b6E0dwsxQtAol9TLSO88kQvym6HHBWFliV2lGdrPieX+WgMRLSJDVzdYywk7jXbLPuO2KLTLg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.24.7", - "@babel/helper-compilation-targets": "^7.25.2", - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-replace-supers": "^7.25.0", - "@babel/traverse": "^7.25.4", - "globals": "^11.1.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-computed-properties": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.24.7.tgz", - "integrity": "sha512-25cS7v+707Gu6Ds2oY6tCkUwsJ9YIDbggd9+cu9jzzDgiNq7hR/8dkzxWfKWnTic26vsI3EsCXNd4iEB6e8esQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/template": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-destructuring": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.24.8.tgz", - "integrity": "sha512-36e87mfY8TnRxc7yc6M9g9gOB7rKgSahqkIKwLpz4Ppk2+zC2Cy1is0uwtuSG6AE4zlTOUa+7JGz9jCJGLqQFQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-dotall-regex": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.24.7.tgz", - "integrity": "sha512-ZOA3W+1RRTSWvyqcMJDLqbchh7U4NRGqwRfFSVbOLS/ePIP4vHB5e8T8eXcuqyN1QkgKyj5wuW0lcS85v4CrSw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-duplicate-keys": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.24.7.tgz", - "integrity": "sha512-JdYfXyCRihAe46jUIliuL2/s0x0wObgwwiGxw/UbgJBr20gQBThrokO4nYKgWkD7uBaqM7+9x5TU7NkExZJyzw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-duplicate-named-capturing-groups-regex": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.25.0.tgz", - "integrity": "sha512-YLpb4LlYSc3sCUa35un84poXoraOiQucUTTu8X1j18JV+gNa8E0nyUf/CjZ171IRGr4jEguF+vzJU66QZhn29g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.25.0", - "@babel/helper-plugin-utils": "^7.24.8" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-transform-dynamic-import": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.24.7.tgz", - "integrity": "sha512-sc3X26PhZQDb3JhORmakcbvkeInvxz+A8oda99lj7J60QRuPZvNAk9wQlTBS1ZynelDrDmTU4pw1tyc5d5ZMUg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-dynamic-import": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-exponentiation-operator": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.24.7.tgz", - "integrity": "sha512-Rqe/vSc9OYgDajNIK35u7ot+KeCoetqQYFXM4Epf7M7ez3lWlOjrDjrwMei6caCVhfdw+mIKD4cgdGNy5JQotQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-export-namespace-from": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.24.7.tgz", - "integrity": "sha512-v0K9uNYsPL3oXZ/7F9NNIbAj2jv1whUEtyA6aujhekLs56R++JDQuzRcP2/z4WX5Vg/c5lE9uWZA0/iUoFhLTA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-for-of": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.24.7.tgz", - "integrity": "sha512-wo9ogrDG1ITTTBsy46oGiN1dS9A7MROBTcYsfS8DtsImMkHk9JXJ3EWQM6X2SUw4x80uGPlwj0o00Uoc6nEE3g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-function-name": { - "version": "7.25.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.25.1.tgz", - "integrity": "sha512-TVVJVdW9RKMNgJJlLtHsKDTydjZAbwIsn6ySBPQaEAUU5+gVvlJt/9nRmqVbsV/IBanRjzWoaAQKLoamWVOUuA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-compilation-targets": "^7.24.8", - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/traverse": "^7.25.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-json-strings": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.24.7.tgz", - "integrity": "sha512-2yFnBGDvRuxAaE/f0vfBKvtnvvqU8tGpMHqMNpTN2oWMKIR3NqFkjaAgGwawhqK/pIN2T3XdjGPdaG0vDhOBGw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-json-strings": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-literals": { - "version": "7.25.2", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.25.2.tgz", - "integrity": "sha512-HQI+HcTbm9ur3Z2DkO+jgESMAMcYLuN/A7NRw9juzxAezN9AvqvUTnpKP/9kkYANz6u7dFlAyOu44ejuGySlfw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-logical-assignment-operators": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.24.7.tgz", - "integrity": "sha512-4D2tpwlQ1odXmTEIFWy9ELJcZHqrStlzK/dAOWYyxX3zT0iXQB6banjgeOJQXzEc4S0E0a5A+hahxPaEFYftsw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-member-expression-literals": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.24.7.tgz", - "integrity": "sha512-T/hRC1uqrzXMKLQ6UCwMT85S3EvqaBXDGf0FaMf4446Qx9vKwlghvee0+uuZcDUCZU5RuNi4781UQ7R308zzBw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-amd": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.24.7.tgz", - "integrity": "sha512-9+pB1qxV3vs/8Hdmz/CulFB8w2tuu6EB94JZFsjdqxQokwGa9Unap7Bo2gGBGIvPmDIVvQrom7r5m/TCDMURhg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-transforms": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-commonjs": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.24.8.tgz", - "integrity": "sha512-WHsk9H8XxRs3JXKWFiqtQebdh9b/pTk4EgueygFzYlTKAg0Ud985mSevdNjdXdFBATSKVJGQXP1tv6aGbssLKA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-transforms": "^7.24.8", - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-simple-access": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-systemjs": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.25.0.tgz", - "integrity": "sha512-YPJfjQPDXxyQWg/0+jHKj1llnY5f/R6a0p/vP4lPymxLu7Lvl4k2WMitqi08yxwQcCVUUdG9LCUj4TNEgAp3Jw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-transforms": "^7.25.0", - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-validator-identifier": "^7.24.7", - "@babel/traverse": "^7.25.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-umd": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.24.7.tgz", - "integrity": "sha512-3aytQvqJ/h9z4g8AsKPLvD4Zqi2qT+L3j7XoFFu1XBlZWEl2/1kWnhmAbxpLgPrHSY0M6UA02jyTiwUVtiKR6A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-transforms": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.24.7.tgz", - "integrity": "sha512-/jr7h/EWeJtk1U/uz2jlsCioHkZk1JJZVcc8oQsJ1dUlaJD83f4/6Zeh2aHt9BIFokHIsSeDfhUmju0+1GPd6g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-transform-new-target": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.24.7.tgz", - "integrity": "sha512-RNKwfRIXg4Ls/8mMTza5oPF5RkOW8Wy/WgMAp1/F1yZ8mMbtwXW+HDoJiOsagWrAhI5f57Vncrmr9XeT4CVapA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-nullish-coalescing-operator": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.24.7.tgz", - "integrity": "sha512-Ts7xQVk1OEocqzm8rHMXHlxvsfZ0cEF2yomUqpKENHWMF4zKk175Y4q8H5knJes6PgYad50uuRmt3UJuhBw8pQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-numeric-separator": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.24.7.tgz", - "integrity": "sha512-e6q1TiVUzvH9KRvicuxdBTUj4AdKSRwzIyFFnfnezpCfP2/7Qmbb8qbU2j7GODbl4JMkblitCQjKYUaX/qkkwA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-object-rest-spread": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.24.7.tgz", - "integrity": "sha512-4QrHAr0aXQCEFni2q4DqKLD31n2DL+RxcwnNjDFkSG0eNQ/xCavnRkfCUjsyqGC2OviNJvZOF/mQqZBw7i2C5Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-compilation-targets": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-object-super": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.24.7.tgz", - "integrity": "sha512-A/vVLwN6lBrMFmMDmPPz0jnE6ZGx7Jq7d6sT/Ev4H65RER6pZ+kczlf1DthF5N0qaPHBsI7UXiE8Zy66nmAovg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/helper-replace-supers": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-optional-catch-binding": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.24.7.tgz", - "integrity": "sha512-uLEndKqP5BfBbC/5jTwPxLh9kqPWWgzN/f8w6UwAIirAEqiIVJWWY312X72Eub09g5KF9+Zn7+hT7sDxmhRuKA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-optional-chaining": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.24.8.tgz", - "integrity": "sha512-5cTOLSMs9eypEy8JUVvIKOu6NgvbJMnpG62VpIHrTmROdQ+L5mDAaI40g25k5vXti55JWNX5jCkq3HZxXBQANw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-parameters": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.24.7.tgz", - "integrity": "sha512-yGWW5Rr+sQOhK0Ot8hjDJuxU3XLRQGflvT4lhlSY0DFvdb3TwKaY26CJzHtYllU0vT9j58hc37ndFPsqT1SrzA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-private-methods": { - "version": "7.25.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.25.4.tgz", - "integrity": "sha512-ao8BG7E2b/URaUQGqN3Tlsg+M3KlHY6rJ1O1gXAEUnZoyNQnvKyH87Kfg+FoxSeyWUB8ISZZsC91C44ZuBFytw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.25.4", - "@babel/helper-plugin-utils": "^7.24.8" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-private-property-in-object": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.24.7.tgz", - "integrity": "sha512-9z76mxwnwFxMyxZWEgdgECQglF2Q7cFLm0kMf8pGwt+GSJsY0cONKj/UuO4bOH0w/uAel3ekS4ra5CEAyJRmDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.24.7", - "@babel/helper-create-class-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-property-literals": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.24.7.tgz", - "integrity": "sha512-EMi4MLQSHfd2nrCqQEWxFdha2gBCqU4ZcCng4WBGZ5CJL4bBRW0ptdqqDdeirGZcpALazVVNJqRmsO8/+oNCBA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-regenerator": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.24.7.tgz", - "integrity": "sha512-lq3fvXPdimDrlg6LWBoqj+r/DEWgONuwjuOuQCSYgRroXDH/IdM1C0IZf59fL5cHLpjEH/O6opIRBbqv7ELnuA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "regenerator-transform": "^0.15.2" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-reserved-words": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.24.7.tgz", - "integrity": "sha512-0DUq0pHcPKbjFZCfTss/pGkYMfy3vFWydkUBd9r0GHpIyfs2eCDENvqadMycRS9wZCXR41wucAfJHJmwA0UmoQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-shorthand-properties": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.24.7.tgz", - "integrity": "sha512-KsDsevZMDsigzbA09+vacnLpmPH4aWjcZjXdyFKGzpplxhbeB4wYtury3vglQkg6KM/xEPKt73eCjPPf1PgXBA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-spread": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.24.7.tgz", - "integrity": "sha512-x96oO0I09dgMDxJaANcRyD4ellXFLLiWhuwDxKZX5g2rWP1bTPkBSwCYv96VDXVT1bD9aPj8tppr5ITIh8hBng==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-sticky-regex": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.24.7.tgz", - "integrity": "sha512-kHPSIJc9v24zEml5geKg9Mjx5ULpfncj0wRpYtxbvKyTtHCYDkVE3aHQ03FrpEo4gEe2vrJJS1Y9CJTaThA52g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-template-literals": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.24.7.tgz", - "integrity": "sha512-AfDTQmClklHCOLxtGoP7HkeMw56k1/bTQjwsfhL6pppo/M4TOBSq+jjBUBLmV/4oeFg4GWMavIl44ZeCtmmZTw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-typeof-symbol": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.24.8.tgz", - "integrity": "sha512-adNTUpDCVnmAE58VEqKlAA6ZBlNkMnWD0ZcW76lyNFN3MJniyGFZfNwERVk8Ap56MCnXztmDr19T4mPTztcuaw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-unicode-escapes": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.24.7.tgz", - "integrity": "sha512-U3ap1gm5+4edc2Q/P+9VrBNhGkfnf+8ZqppY71Bo/pzZmXhhLdqgaUl6cuB07O1+AQJtCLfaOmswiNbSQ9ivhw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-unicode-property-regex": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.24.7.tgz", - "integrity": "sha512-uH2O4OV5M9FZYQrwc7NdVmMxQJOCCzFeYudlZSzUAHRFeOujQefa92E74TQDVskNHCzOXoigEuoyzHDhaEaK5w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-unicode-regex": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.24.7.tgz", - "integrity": "sha512-hlQ96MBZSAXUq7ltkjtu3FJCCSMx/j629ns3hA3pXnBXjanNP0LHi+JpPeA81zaWgVK1VGH95Xuy7u0RyQ8kMg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-unicode-sets-regex": { - "version": "7.25.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.25.4.tgz", - "integrity": "sha512-qesBxiWkgN1Q+31xUE9RcMk79eOXXDCv6tfyGMRSs4RGlioSg2WVyQAm07k726cSE56pa+Kb0y9epX2qaXzTvA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.25.2", - "@babel/helper-plugin-utils": "^7.24.8" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/preset-env": { - "version": "7.25.4", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.25.4.tgz", - "integrity": "sha512-W9Gyo+KmcxjGahtt3t9fb14vFRWvPpu5pT6GBlovAK6BTBcxgjfVMSQCfJl4oi35ODrxP6xx2Wr8LNST57Mraw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.25.4", - "@babel/helper-compilation-targets": "^7.25.2", - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-validator-option": "^7.24.8", - "@babel/plugin-bugfix-firefox-class-in-computed-class-key": "^7.25.3", - "@babel/plugin-bugfix-safari-class-field-initializer-scope": "^7.25.0", - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.25.0", - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.24.7", - "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.25.0", - "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/plugin-syntax-class-static-block": "^7.14.5", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-import-assertions": "^7.24.7", - "@babel/plugin-syntax-import-attributes": "^7.24.7", - "@babel/plugin-syntax-import-meta": "^7.10.4", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5", - "@babel/plugin-syntax-top-level-await": "^7.14.5", - "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", - "@babel/plugin-transform-arrow-functions": "^7.24.7", - "@babel/plugin-transform-async-generator-functions": "^7.25.4", - "@babel/plugin-transform-async-to-generator": "^7.24.7", - "@babel/plugin-transform-block-scoped-functions": "^7.24.7", - "@babel/plugin-transform-block-scoping": "^7.25.0", - "@babel/plugin-transform-class-properties": "^7.25.4", - "@babel/plugin-transform-class-static-block": "^7.24.7", - "@babel/plugin-transform-classes": "^7.25.4", - "@babel/plugin-transform-computed-properties": "^7.24.7", - "@babel/plugin-transform-destructuring": "^7.24.8", - "@babel/plugin-transform-dotall-regex": "^7.24.7", - "@babel/plugin-transform-duplicate-keys": "^7.24.7", - "@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.25.0", - "@babel/plugin-transform-dynamic-import": "^7.24.7", - "@babel/plugin-transform-exponentiation-operator": "^7.24.7", - "@babel/plugin-transform-export-namespace-from": "^7.24.7", - "@babel/plugin-transform-for-of": "^7.24.7", - "@babel/plugin-transform-function-name": "^7.25.1", - "@babel/plugin-transform-json-strings": "^7.24.7", - "@babel/plugin-transform-literals": "^7.25.2", - "@babel/plugin-transform-logical-assignment-operators": "^7.24.7", - "@babel/plugin-transform-member-expression-literals": "^7.24.7", - "@babel/plugin-transform-modules-amd": "^7.24.7", - "@babel/plugin-transform-modules-commonjs": "^7.24.8", - "@babel/plugin-transform-modules-systemjs": "^7.25.0", - "@babel/plugin-transform-modules-umd": "^7.24.7", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.24.7", - "@babel/plugin-transform-new-target": "^7.24.7", - "@babel/plugin-transform-nullish-coalescing-operator": "^7.24.7", - "@babel/plugin-transform-numeric-separator": "^7.24.7", - "@babel/plugin-transform-object-rest-spread": "^7.24.7", - "@babel/plugin-transform-object-super": "^7.24.7", - "@babel/plugin-transform-optional-catch-binding": "^7.24.7", - "@babel/plugin-transform-optional-chaining": "^7.24.8", - "@babel/plugin-transform-parameters": "^7.24.7", - "@babel/plugin-transform-private-methods": "^7.25.4", - "@babel/plugin-transform-private-property-in-object": "^7.24.7", - "@babel/plugin-transform-property-literals": "^7.24.7", - "@babel/plugin-transform-regenerator": "^7.24.7", - "@babel/plugin-transform-reserved-words": "^7.24.7", - "@babel/plugin-transform-shorthand-properties": "^7.24.7", - "@babel/plugin-transform-spread": "^7.24.7", - "@babel/plugin-transform-sticky-regex": "^7.24.7", - "@babel/plugin-transform-template-literals": "^7.24.7", - "@babel/plugin-transform-typeof-symbol": "^7.24.8", - "@babel/plugin-transform-unicode-escapes": "^7.24.7", - "@babel/plugin-transform-unicode-property-regex": "^7.24.7", - "@babel/plugin-transform-unicode-regex": "^7.24.7", - "@babel/plugin-transform-unicode-sets-regex": "^7.25.4", - "@babel/preset-modules": "0.1.6-no-external-plugins", - "babel-plugin-polyfill-corejs2": "^0.4.10", - "babel-plugin-polyfill-corejs3": "^0.10.6", - "babel-plugin-polyfill-regenerator": "^0.6.1", - "core-js-compat": "^3.37.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/preset-modules": { - "version": "0.1.6-no-external-plugins", - "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz", - "integrity": "sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/types": "^7.4.4", - "esutils": "^2.0.2" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" - } - }, - "node_modules/@babel/regjsgen": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz", - "integrity": "sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@babel/runtime": { - "version": "7.25.6", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.6.tgz", - "integrity": "sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "regenerator-runtime": "^0.14.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/template": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.0.tgz", - "integrity": "sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.24.7", - "@babel/parser": "^7.25.0", - "@babel/types": "^7.25.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.25.6", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.6.tgz", - "integrity": "sha512-9Vrcx5ZW6UwK5tvqsj0nGpp/XzqthkT0dqIc9g1AdtygFToNtTF67XzYS//dm+SAK9cp3B9R4ZO/46p63SCjlQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.24.7", - "@babel/generator": "^7.25.6", - "@babel/parser": "^7.25.6", - "@babel/template": "^7.25.0", - "@babel/types": "^7.25.6", - "debug": "^4.3.1", - "globals": "^11.1.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/types": { - "version": "7.25.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.6.tgz", - "integrity": "sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-string-parser": "^7.24.8", - "@babel/helper-validator-identifier": "^7.24.7", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@discoveryjs/json-ext": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", - "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", - "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/set-array": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", - "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/source-map": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", - "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.25" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", - "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.25", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", - "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@leichtgewicht/ip-codec": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz", - "integrity": "sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/body-parser": { - "version": "1.19.5", - "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", - "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/connect": "*", - "@types/node": "*" - } - }, - "node_modules/@types/bonjour": { - "version": "3.5.13", - "resolved": "https://registry.npmjs.org/@types/bonjour/-/bonjour-3.5.13.tgz", - "integrity": "sha512-z9fJ5Im06zvUL548KvYNecEVlA7cVDkGUi6kZusb04mpyEFKCIZJvloCcmpmLaIahDpOQGHaHmG6imtPMmPXGQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/connect": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", - "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/connect-history-api-fallback": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/@types/connect-history-api-fallback/-/connect-history-api-fallback-1.5.4.tgz", - "integrity": "sha512-n6Cr2xS1h4uAulPRdlw6Jl6s1oG8KrVilPN2yUITEs+K48EzMJJ3W1xy8K5eWuFvjp3R74AOIGSmp2UfBJ8HFw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/express-serve-static-core": "*", - "@types/node": "*" - } - }, - "node_modules/@types/estree": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", - "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/express": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", - "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/body-parser": "*", - "@types/express-serve-static-core": "^4.17.33", - "@types/qs": "*", - "@types/serve-static": "*" - } - }, - "node_modules/@types/express-serve-static-core": { - "version": "4.19.5", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.5.tgz", - "integrity": "sha512-y6W03tvrACO72aijJ5uF02FRq5cgDR9lUxddQ8vyF+GvmjJQqbzDcJngEjURc+ZsG31VI3hODNZJ2URj86pzmg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*", - "@types/send": "*" - } - }, - "node_modules/@types/html-minifier-terser": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz", - "integrity": "sha512-oh/6byDPnL1zeNXFrDXFLyZjkr1MsBG667IM792caf1L2UPOOMf65NFzjUH/ltyfwjAGfs1rsX1eftK0jC/KIg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/http-errors": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", - "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/http-proxy": { - "version": "1.17.15", - "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.15.tgz", - "integrity": "sha512-25g5atgiVNTIv0LBDTg1H74Hvayx0ajtJPLLcYE3whFv75J0pWNtOBzaXJQgDTmrX1bx5U9YC2w/n65BN1HwRQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/mime": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", - "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/node": { - "version": "22.5.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz", - "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~6.19.2" - } - }, - "node_modules/@types/node-forge": { - "version": "1.3.11", - "resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.11.tgz", - "integrity": "sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/qs": { - "version": "6.9.15", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.15.tgz", - "integrity": "sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/range-parser": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", - "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/retry": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", - "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/send": { - "version": "0.17.4", - "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", - "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/mime": "^1", - "@types/node": "*" - } - }, - "node_modules/@types/serve-index": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@types/serve-index/-/serve-index-1.9.4.tgz", - "integrity": "sha512-qLpGZ/c2fhSs5gnYsQxtDEq3Oy8SXPClIXkW5ghvAvsNuVSA8k+gCONcUCS/UjLEYvYps+e8uBtfgXgvhwfNug==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/express": "*" - } - }, - "node_modules/@types/serve-static": { - "version": "1.15.7", - "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", - "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/http-errors": "*", - "@types/node": "*", - "@types/send": "*" - } - }, - "node_modules/@types/sockjs": { - "version": "0.3.36", - "resolved": "https://registry.npmjs.org/@types/sockjs/-/sockjs-0.3.36.tgz", - "integrity": "sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/ws": { - "version": "8.5.12", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.12.tgz", - "integrity": "sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@webassemblyjs/ast": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.12.1.tgz", - "integrity": "sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/helper-numbers": "1.11.6", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6" - } - }, - "node_modules/@webassemblyjs/floating-point-hex-parser": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.6.tgz", - "integrity": "sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@webassemblyjs/helper-api-error": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz", - "integrity": "sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/@webassemblyjs/helper-buffer": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.12.1.tgz", - "integrity": "sha512-nzJwQw99DNDKr9BVCOZcLuJJUlqkJh+kVzVl6Fmq/tI5ZtEyWT1KZMyOXltXLZJmDtvLCDgwsyrkohEtopTXCw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@webassemblyjs/helper-numbers": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.6.tgz", - "integrity": "sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/floating-point-hex-parser": "1.11.6", - "@webassemblyjs/helper-api-error": "1.11.6", - "@xtuc/long": "4.2.2" - } - }, - "node_modules/@webassemblyjs/helper-wasm-bytecode": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz", - "integrity": "sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@webassemblyjs/helper-wasm-section": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.12.1.tgz", - "integrity": "sha512-Jif4vfB6FJlUlSbgEMHUyk1j234GTNG9dBJ4XJdOySoj518Xj0oGsNi59cUQF4RRMS9ouBUxDDdyBVfPTypa5g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-buffer": "1.12.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/wasm-gen": "1.12.1" - } - }, - "node_modules/@webassemblyjs/ieee754": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.6.tgz", - "integrity": "sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@xtuc/ieee754": "^1.2.0" - } - }, - "node_modules/@webassemblyjs/leb128": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.6.tgz", - "integrity": "sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@xtuc/long": "4.2.2" - } - }, - "node_modules/@webassemblyjs/utf8": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.6.tgz", - "integrity": "sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@webassemblyjs/wasm-edit": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.12.1.tgz", - "integrity": "sha512-1DuwbVvADvS5mGnXbE+c9NfA8QRcZ6iKquqjjmR10k6o+zzsRVesil54DKexiowcFCPdr/Q0qaMgB01+SQ1u6g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-buffer": "1.12.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/helper-wasm-section": "1.12.1", - "@webassemblyjs/wasm-gen": "1.12.1", - "@webassemblyjs/wasm-opt": "1.12.1", - "@webassemblyjs/wasm-parser": "1.12.1", - "@webassemblyjs/wast-printer": "1.12.1" - } - }, - "node_modules/@webassemblyjs/wasm-gen": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.12.1.tgz", - "integrity": "sha512-TDq4Ojh9fcohAw6OIMXqiIcTq5KUXTGRkVxbSo1hQnSy6lAM5GSdfwWeSxpAo0YzgsgF182E/U0mDNhuA0tW7w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/ieee754": "1.11.6", - "@webassemblyjs/leb128": "1.11.6", - "@webassemblyjs/utf8": "1.11.6" - } - }, - "node_modules/@webassemblyjs/wasm-opt": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.12.1.tgz", - "integrity": "sha512-Jg99j/2gG2iaz3hijw857AVYekZe2SAskcqlWIZXjji5WStnOpVoat3gQfT/Q5tb2djnCjBtMocY/Su1GfxPBg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-buffer": "1.12.1", - "@webassemblyjs/wasm-gen": "1.12.1", - "@webassemblyjs/wasm-parser": "1.12.1" - } - }, - "node_modules/@webassemblyjs/wasm-parser": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.12.1.tgz", - "integrity": "sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-api-error": "1.11.6", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/ieee754": "1.11.6", - "@webassemblyjs/leb128": "1.11.6", - "@webassemblyjs/utf8": "1.11.6" - } - }, - "node_modules/@webassemblyjs/wast-printer": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.12.1.tgz", - "integrity": "sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/ast": "1.12.1", - "@xtuc/long": "4.2.2" - } - }, - "node_modules/@webgpu/glslang": { - "version": "0.0.15", - "resolved": "https://registry.npmjs.org/@webgpu/glslang/-/glslang-0.0.15.tgz", - "integrity": "sha512-niT+Prh3Aff8Uf1MVBVUsaNjFj9rJAKDXuoHIKiQbB+6IUP/3J3JIhBNyZ7lDhytvXxw6ppgnwKZdDJ08UMj4Q==", - "license": "glslang/LICENSE.txt" - }, - "node_modules/@webpack-cli/configtest": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz", - "integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "webpack": "4.x.x || 5.x.x", - "webpack-cli": "4.x.x" - } - }, - "node_modules/@webpack-cli/info": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz", - "integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "envinfo": "^7.7.3" - }, - "peerDependencies": { - "webpack-cli": "4.x.x" - } - }, - "node_modules/@webpack-cli/serve": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz", - "integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "webpack-cli": "4.x.x" - }, - "peerDependenciesMeta": { - "webpack-dev-server": { - "optional": true - } - } - }, - "node_modules/@xtuc/ieee754": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", - "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/@xtuc/long": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", - "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/accepts": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", - "dev": true, - "license": "MIT", - "dependencies": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/acorn": { - "version": "8.12.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", - "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", - "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-import-attributes": { - "version": "1.9.5", - "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", - "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "acorn": "^8" - } - }, - "node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ajv-formats": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", - "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^8.0.0" - }, - "peerDependencies": { - "ajv": "^8.0.0" - }, - "peerDependenciesMeta": { - "ajv": { - "optional": true - } - } - }, - "node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3" - }, - "peerDependencies": { - "ajv": "^8.8.2" - } - }, - "node_modules/ansi-html-community": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/ansi-html-community/-/ansi-html-community-0.0.8.tgz", - "integrity": "sha512-1APHAyr3+PCamwNw3bXCPp4HFLONZt/yIH0sZp0/469KWNTEy+qN5jQ3GVX6DMZ1UXAi34yVwtTeaG/HpBuuzw==", - "dev": true, - "engines": [ - "node >= 0.8.0" - ], - "license": "Apache-2.0", - "bin": { - "ansi-html": "bin/ansi-html" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "license": "ISC", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", - "dev": true, - "license": "MIT" - }, - "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==", - "dev": true, - "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==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/assemblyscript": { - "version": "0.27.29", - "resolved": "https://registry.npmjs.org/assemblyscript/-/assemblyscript-0.27.29.tgz", - "integrity": "sha512-pH6udb7aE2F0t6cTh+0uCepmucykhMnAmm7k0kkAU3SY7LvpIngEBZWM6p5VCguu4EpmKGwEuZpZbEXzJ/frHQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "binaryen": "116.0.0-nightly.20240114", - "long": "^5.2.1" - }, - "bin": { - "asc": "bin/asc.js", - "asinit": "bin/asinit.js" - }, - "engines": { - "node": ">=16", - "npm": ">=7" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/assemblyscript" - } - }, - "node_modules/async": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", - "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", - "dev": true, - "license": "MIT" - }, - "node_modules/babel-loader": { - "version": "9.1.3", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.1.3.tgz", - "integrity": "sha512-xG3ST4DglodGf8qSwv0MdeWLhrDsw/32QMdTO5T1ZIp9gQur0HkCyFs7Awskr10JKXFXwpAhiCuYX5oGXnRGbw==", - "dev": true, - "license": "MIT", - "dependencies": { - "find-cache-dir": "^4.0.0", - "schema-utils": "^4.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "peerDependencies": { - "@babel/core": "^7.12.0", - "webpack": ">=5" - } - }, - "node_modules/babel-plugin-polyfill-corejs2": { - "version": "0.4.11", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.11.tgz", - "integrity": "sha512-sMEJ27L0gRHShOh5G54uAAPaiCOygY/5ratXuiyb2G46FmlSpc9eFCzYVyDiPxfNbwzA7mYahmjQc5q+CZQ09Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.22.6", - "@babel/helper-define-polyfill-provider": "^0.6.2", - "semver": "^6.3.1" - }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" - } - }, - "node_modules/babel-plugin-polyfill-corejs3": { - "version": "0.10.6", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.10.6.tgz", - "integrity": "sha512-b37+KR2i/khY5sKmWNVQAnitvquQbNdWy6lJdsr0kmquCKEEUgMKK4SboVM3HtfnZilfjr4MMQ7vY58FVWDtIA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.6.2", - "core-js-compat": "^3.38.0" - }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" - } - }, - "node_modules/babel-plugin-polyfill-regenerator": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.2.tgz", - "integrity": "sha512-2R25rQZWP63nGwaAswvDazbPXfrM3HwVoBXK6HcqeKrSrL/JqcC/rDcf95l4r7LXLyxDXc8uQDa064GubtCABg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.6.2" - }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" - } - }, - "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==", - "dev": true, - "license": "MIT" - }, - "node_modules/batch": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", - "integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==", - "dev": true, - "license": "MIT" - }, - "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/binaryen": { - "version": "116.0.0-nightly.20240114", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-116.0.0-nightly.20240114.tgz", - "integrity": "sha512-0GZrojJnuhoe+hiwji7QFaL3tBlJoA+KFUN7ouYSDGZLSo9CKM8swQX8n/UcbR0d1VuZKU+nhogNzv423JEu5A==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "wasm-opt": "bin/wasm-opt", - "wasm2js": "bin/wasm2js" - } - }, - "node_modules/body-parser": { - "version": "1.20.3", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", - "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", - "dev": true, - "license": "MIT", - "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.5", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.13.0", - "raw-body": "2.5.2", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/body-parser/node_modules/bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/body-parser/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/body-parser/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true, - "license": "MIT" - }, - "node_modules/body-parser/node_modules/qs": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", - "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "side-channel": "^1.0.6" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/bonjour-service": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.2.1.tgz", - "integrity": "sha512-oSzCS2zV14bh2kji6vNe7vrpJYCHGvcZnlffFQ1MEoX/WOeQ/teD8SYWKR942OI3INjq8OMNJlbPK5LLLUxFDw==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "multicast-dns": "^7.2.5" - } - }, - "node_modules/boolbase": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", - "dev": true, - "license": "ISC" - }, - "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==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, - "license": "MIT", - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/browserslist": { - "version": "4.23.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.3.tgz", - "integrity": "sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "caniuse-lite": "^1.0.30001646", - "electron-to-chromium": "^1.5.4", - "node-releases": "^2.0.18", - "update-browserslist-db": "^1.1.0" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, - "node_modules/buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "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==", - "dev": true, - "license": "MIT", - "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/camel-case": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", - "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", - "dev": true, - "license": "MIT", - "dependencies": { - "pascal-case": "^3.1.2", - "tslib": "^2.0.3" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001660", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001660.tgz", - "integrity": "sha512-GacvNTTuATm26qC74pt+ad1fW15mlQ/zuTzzY1ZoIzECTP8HURDfF43kNxPgf7H1jmelCBQTTbBNxdSXOA7Bqg==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "CC-BY-4.0" - }, - "node_modules/cannon-es": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/cannon-es/-/cannon-es-0.18.0.tgz", - "integrity": "sha512-GiQ1bd0etZsMVSnUhNc+p+FEh0R/cULpp8uRSAhEK4Kax+y/31Au03m6h1h1xdDivAMnFg8YDwevHgzLynOHlw==", - "license": "MIT" - }, - "node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "dev": true, - "license": "MIT", - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/chrome-trace-event": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz", - "integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0" - } - }, - "node_modules/clean-css": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.3.tgz", - "integrity": "sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==", - "dev": true, - "license": "MIT", - "dependencies": { - "source-map": "~0.6.0" - }, - "engines": { - "node": ">= 10.0" - } - }, - "node_modules/clone-deep": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", - "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4", - "kind-of": "^6.0.2", - "shallow-clone": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true, - "license": "MIT" - }, - "node_modules/colorette": { - "version": "2.0.20", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", - "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", - "dev": true, - "license": "MIT" - }, - "node_modules/commander": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", - "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=16" - } - }, - "node_modules/common-path-prefix": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz", - "integrity": "sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==", - "dev": true, - "license": "ISC" - }, - "node_modules/commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", - "dev": true, - "license": "MIT" - }, - "node_modules/compressible": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", - "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", - "dev": true, - "license": "MIT", - "dependencies": { - "mime-db": ">= 1.43.0 < 2" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/compression": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz", - "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "accepts": "~1.3.5", - "bytes": "3.0.0", - "compressible": "~2.0.16", - "debug": "2.6.9", - "on-headers": "~1.0.2", - "safe-buffer": "5.1.2", - "vary": "~1.1.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/compression/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/compression/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true, - "license": "MIT" - }, - "node_modules/compression/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true, - "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==", - "dev": true, - "license": "MIT" - }, - "node_modules/connect-history-api-fallback": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz", - "integrity": "sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8" - } - }, - "node_modules/content-disposition": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", - "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "5.2.1" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/content-type": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", - "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true, - "license": "MIT" - }, - "node_modules/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/core-js-compat": { - "version": "3.38.1", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.38.1.tgz", - "integrity": "sha512-JRH6gfXxGmrzF3tZ57lFx97YARxCXPaMzPo6jELZhv88pBH5VXpQ+y0znKGlFnzuaihqhLbefxSJxWJMPtfDzw==", - "dev": true, - "license": "MIT", - "dependencies": { - "browserslist": "^4.23.3" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" - } - }, - "node_modules/core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/css-loader": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-7.1.2.tgz", - "integrity": "sha512-6WvYYn7l/XEGN8Xu2vWFt9nVzrCn39vKyTEFf/ExEyoksJjjSZV/0/35XPlMbpnr6VGhZIUg5yJrL8tGfes/FA==", - "dev": true, - "license": "MIT", - "dependencies": { - "icss-utils": "^5.1.0", - "postcss": "^8.4.33", - "postcss-modules-extract-imports": "^3.1.0", - "postcss-modules-local-by-default": "^4.0.5", - "postcss-modules-scope": "^3.2.0", - "postcss-modules-values": "^4.0.0", - "postcss-value-parser": "^4.2.0", - "semver": "^7.5.4" - }, - "engines": { - "node": ">= 18.12.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "@rspack/core": "0.x || 1.x", - "webpack": "^5.27.0" - }, - "peerDependenciesMeta": { - "@rspack/core": { - "optional": true - }, - "webpack": { - "optional": true - } - } - }, - "node_modules/css-loader/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/css-select": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz", - "integrity": "sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "boolbase": "^1.0.0", - "css-what": "^6.0.1", - "domhandler": "^4.3.1", - "domutils": "^2.8.0", - "nth-check": "^2.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" - } - }, - "node_modules/css-what": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", - "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">= 6" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" - } - }, - "node_modules/cssesc": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", - "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", - "dev": true, - "license": "MIT", - "bin": { - "cssesc": "bin/cssesc" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/debug": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/default-gateway": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-6.0.3.tgz", - "integrity": "sha512-fwSOJsbbNzZ/CUFpqFBqYfYNLj1NbMPm8MMCIzHjC83iSJRBEGmDUxU+WP661BaBQImeC2yHwXtz+P/O9o+XEg==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "execa": "^5.0.0" - }, - "engines": { - "node": ">= 10" - } - }, - "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==", - "dev": true, - "license": "MIT", - "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/define-lazy-prop": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", - "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/detect-node": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", - "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", - "dev": true, - "license": "MIT" - }, - "node_modules/dns-packet": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.6.1.tgz", - "integrity": "sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@leichtgewicht/ip-codec": "^2.0.1" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/dom-converter": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz", - "integrity": "sha512-gd3ypIPfOMr9h5jIKq8E3sHOTCjeirnl0WK5ZdS1AW0Odt0b1PaWaHdJ4Qk4klv+YB9aJBS7mESXjFoDQPu6DA==", - "dev": true, - "license": "MIT", - "dependencies": { - "utila": "~0.4" - } - }, - "node_modules/dom-serializer": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz", - "integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==", - "dev": true, - "license": "MIT", - "dependencies": { - "domelementtype": "^2.0.1", - "domhandler": "^4.2.0", - "entities": "^2.0.0" - }, - "funding": { - "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" - } - }, - "node_modules/domelementtype": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", - "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ], - "license": "BSD-2-Clause" - }, - "node_modules/domhandler": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.1.tgz", - "integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "domelementtype": "^2.2.0" - }, - "engines": { - "node": ">= 4" - }, - "funding": { - "url": "https://github.com/fb55/domhandler?sponsor=1" - } - }, - "node_modules/domutils": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", - "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "dom-serializer": "^1.0.1", - "domelementtype": "^2.2.0", - "domhandler": "^4.2.0" - }, - "funding": { - "url": "https://github.com/fb55/domutils?sponsor=1" - } - }, - "node_modules/dot-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", - "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", - "dev": true, - "license": "MIT", - "dependencies": { - "no-case": "^3.0.4", - "tslib": "^2.0.3" - } - }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", - "dev": true, - "license": "MIT" - }, - "node_modules/electron-to-chromium": { - "version": "1.5.19", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.19.tgz", - "integrity": "sha512-kpLJJi3zxTR1U828P+LIUDZ5ohixyo68/IcYOHLqnbTPr/wdgn4i1ECvmALN9E16JPA6cvCG5UG79gVwVdEK5w==", - "dev": true, - "license": "ISC" - }, - "node_modules/email-addresses": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/email-addresses/-/email-addresses-5.0.0.tgz", - "integrity": "sha512-4OIPYlA6JXqtVn8zpHpGiI7vE6EQOAg16aGnDMIAlZVinnoZ8208tW1hAbjWydgN/4PLTT9q+O1K6AH/vALJGw==", - "dev": true, - "license": "MIT" - }, - "node_modules/encodeurl": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", - "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/enhanced-resolve": { - "version": "5.17.1", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", - "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.4", - "tapable": "^2.2.0" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/entities": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", - "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", - "dev": true, - "license": "BSD-2-Clause", - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "node_modules/envinfo": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.13.0.tgz", - "integrity": "sha512-cvcaMr7KqXVh4nyzGTVqTum+gAiL265x5jUWQIDLq//zOGbW+gSW/C+OWLleY/rs9Qole6AZLMXPbtIFQbqu+Q==", - "dev": true, - "license": "MIT", - "bin": { - "envinfo": "dist/cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "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==", - "dev": true, - "license": "MIT", - "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==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-module-lexer": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", - "integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", - "dev": true, - "license": "MIT" - }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", - "dev": true, - "license": "MIT" - }, - "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==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esrecurse/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/eventemitter3": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", - "dev": true, - "license": "MIT" - }, - "node_modules/events": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.x" - } - }, - "node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, - "license": "MIT", - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/express": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/express/-/express-4.20.0.tgz", - "integrity": "sha512-pLdae7I6QqShF5PnNTCVn4hI91Dx0Grkn2+IAsMTgMIKuQVte2dN9PeGSSAME2FR8anOhVA62QDIUaWVfEXVLw==", - "dev": true, - "license": "MIT", - "dependencies": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.3", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.6.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~2.0.0", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.3", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.10", - "proxy-addr": "~2.0.7", - "qs": "6.11.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.19.0", - "serve-static": "1.16.0", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/express/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/express/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-uri": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.1.tgz", - "integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==", - "dev": true, - "license": "MIT" - }, - "node_modules/fastest-levenshtein": { - "version": "1.0.16", - "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", - "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.9.1" - } - }, - "node_modules/faye-websocket": { - "version": "0.11.4", - "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.4.tgz", - "integrity": "sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "websocket-driver": ">=0.5.1" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "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==", - "dev": true, - "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==", - "dev": true, - "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/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dev": true, - "license": "MIT", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/finalhandler/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/finalhandler/node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/finalhandler/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true, - "license": "MIT" - }, - "node_modules/find-cache-dir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-4.0.0.tgz", - "integrity": "sha512-9ZonPT4ZAK4a+1pUPVPZJapbi7O5qbbJPdYw/NOQWZZbVLdDTYM3A4R9z/DpAM08IDaFGsvPgiGZ82WEwUDWjg==", - "dev": true, - "license": "MIT", - "dependencies": { - "common-path-prefix": "^3.0.0", - "pkg-dir": "^7.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/find-up": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", - "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^7.1.0", - "path-exists": "^5.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true, - "license": "BSD-3-Clause", - "bin": { - "flat": "cli.js" - } - }, - "node_modules/follow-redirects": { - "version": "1.15.9", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", - "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "license": "MIT", - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, - "node_modules/forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fs-extra": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", - "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=14.14" - } - }, - "node_modules/fs-monkey": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/fs-monkey/-/fs-monkey-1.0.6.tgz", - "integrity": "sha512-b1FMfwetIKymC0eioW7mTywihSQE4oLzQn1dB6rZB5fx/3NpNEdAWeCSMB+60/AeT0TCXsxzAlcYVEFCTAksWg==", - "dev": true, - "license": "Unlicense" - }, - "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==", - "dev": true, - "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==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "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==", - "dev": true, - "license": "MIT", - "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/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/gh-pages": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/gh-pages/-/gh-pages-6.1.1.tgz", - "integrity": "sha512-upnohfjBwN5hBP9w2dPE7HO5JJTHzSGMV1JrLrHvNuqmjoYHg6TBrCcnEoorjG/e0ejbuvnwyKMdTyM40PEByw==", - "dev": true, - "license": "MIT", - "dependencies": { - "async": "^3.2.4", - "commander": "^11.0.0", - "email-addresses": "^5.0.0", - "filenamify": "^4.3.0", - "find-cache-dir": "^3.3.1", - "fs-extra": "^11.1.1", - "globby": "^6.1.0" - }, - "bin": { - "gh-pages": "bin/gh-pages.js", - "gh-pages-clean": "bin/gh-pages-clean.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/gh-pages/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/avajs/find-cache-dir?sponsor=1" - } - }, - "node_modules/gh-pages/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/gh-pages/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/gh-pages/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/gh-pages/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/gh-pages/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==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/gh-pages/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "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", - "dev": true, - "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/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/glob-to-regexp": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", - "dev": true, - "license": "BSD-2-Clause" - }, - "node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "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==", - "dev": true, - "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==", - "dev": true, - "license": "MIT", - "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==", - "dev": true, - "license": "ISC" - }, - "node_modules/handle-thing": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", - "integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==", - "dev": true, - "license": "MIT" - }, - "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "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==", - "dev": true, - "license": "MIT", - "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==", - "dev": true, - "license": "MIT", - "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==", - "dev": true, - "license": "MIT", - "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==", - "dev": true, - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true, - "license": "MIT", - "bin": { - "he": "bin/he" - } - }, - "node_modules/hpack.js": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", - "integrity": "sha512-zJxVehUdMGIKsRaNt7apO2Gqp0BdqW5yaiGHXXmbpvxgBYVZnAql+BJb4RO5ad2MgpbZKn5G6nMnegrH1FcNYQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.1", - "obuf": "^1.0.0", - "readable-stream": "^2.0.1", - "wbuf": "^1.1.0" - } - }, - "node_modules/hpack.js/node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", - "dev": true, - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/hpack.js/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true, - "license": "MIT" - }, - "node_modules/hpack.js/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/html-entities": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.5.2.tgz", - "integrity": "sha512-K//PSRMQk4FZ78Kyau+mZurHn3FH0Vwr+H36eE0rPbeYkRRi9YxceYPhuN60UwWorxyKHhqoAJl2OFKa4BVtaA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/mdevils" - }, - { - "type": "patreon", - "url": "https://patreon.com/mdevils" - } - ], - "license": "MIT" - }, - "node_modules/html-loader": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/html-loader/-/html-loader-5.1.0.tgz", - "integrity": "sha512-Jb3xwDbsm0W3qlXrCZwcYqYGnYz55hb6aoKQTlzyZPXsPpi6tHXzAfqalecglMQgNvtEfxrCQPaKT90Irt5XDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "html-minifier-terser": "^7.2.0", - "parse5": "^7.1.2" - }, - "engines": { - "node": ">= 18.12.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^5.0.0" - } - }, - "node_modules/html-loader/node_modules/commander": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", - "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14" - } - }, - "node_modules/html-loader/node_modules/entities": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "node_modules/html-loader/node_modules/html-minifier-terser": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/html-minifier-terser/-/html-minifier-terser-7.2.0.tgz", - "integrity": "sha512-tXgn3QfqPIpGl9o+K5tpcj3/MN4SfLtsx2GWwBC3SSd0tXQGyF3gsSqad8loJgKZGM3ZxbYDd5yhiBIdWpmvLA==", - "dev": true, - "license": "MIT", - "dependencies": { - "camel-case": "^4.1.2", - "clean-css": "~5.3.2", - "commander": "^10.0.0", - "entities": "^4.4.0", - "param-case": "^3.0.4", - "relateurl": "^0.2.7", - "terser": "^5.15.1" - }, - "bin": { - "html-minifier-terser": "cli.js" - }, - "engines": { - "node": "^14.13.1 || >=16.0.0" - } - }, - "node_modules/html-minifier-terser": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz", - "integrity": "sha512-YXxSlJBZTP7RS3tWnQw74ooKa6L9b9i9QYXY21eUEvhZ3u9XLfv6OnFsQq6RxkhHygsaUMvYsZRV5rU/OVNZxw==", - "dev": true, - "license": "MIT", - "dependencies": { - "camel-case": "^4.1.2", - "clean-css": "^5.2.2", - "commander": "^8.3.0", - "he": "^1.2.0", - "param-case": "^3.0.4", - "relateurl": "^0.2.7", - "terser": "^5.10.0" - }, - "bin": { - "html-minifier-terser": "cli.js" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/html-minifier-terser/node_modules/commander": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", - "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 12" - } - }, - "node_modules/html-webpack-plugin": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-5.6.0.tgz", - "integrity": "sha512-iwaY4wzbe48AfKLZ/Cc8k0L+FKG6oSNRaZ8x5A/T/IVDGyXcbHncM9TdDa93wn0FsSm82FhTKW7f3vS61thXAw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/html-minifier-terser": "^6.0.0", - "html-minifier-terser": "^6.0.2", - "lodash": "^4.17.21", - "pretty-error": "^4.0.0", - "tapable": "^2.0.0" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/html-webpack-plugin" - }, - "peerDependencies": { - "@rspack/core": "0.x || 1.x", - "webpack": "^5.20.0" - }, - "peerDependenciesMeta": { - "@rspack/core": { - "optional": true - }, - "webpack": { - "optional": true - } - } - }, - "node_modules/htmlparser2": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", - "integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==", - "dev": true, - "funding": [ - "https://github.com/fb55/htmlparser2?sponsor=1", - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ], - "license": "MIT", - "dependencies": { - "domelementtype": "^2.0.1", - "domhandler": "^4.0.0", - "domutils": "^2.5.2", - "entities": "^2.0.0" - } - }, - "node_modules/http-deceiver": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", - "integrity": "sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw==", - "dev": true, - "license": "MIT" - }, - "node_modules/http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/http-parser-js": { - "version": "0.5.8", - "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.8.tgz", - "integrity": "sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/http-proxy": { - "version": "1.18.1", - "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", - "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "eventemitter3": "^4.0.0", - "follow-redirects": "^1.0.0", - "requires-port": "^1.0.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/http-proxy-middleware": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz", - "integrity": "sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/http-proxy": "^1.17.8", - "http-proxy": "^1.18.1", - "is-glob": "^4.0.1", - "is-plain-obj": "^3.0.0", - "micromatch": "^4.0.2" - }, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "@types/express": "^4.17.13" - }, - "peerDependenciesMeta": { - "@types/express": { - "optional": true - } - } - }, - "node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=10.17.0" - } - }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/icss-utils": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", - "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", - "dev": true, - "license": "ISC", - "engines": { - "node": "^10 || ^12 || >= 14" - }, - "peerDependencies": { - "postcss": "^8.1.0" - } - }, - "node_modules/import-local": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", - "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", - "dev": true, - "license": "MIT", - "dependencies": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - }, - "bin": { - "import-local-fixture": "fixtures/cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/import-local/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/import-local/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/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==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "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.", - "dev": true, - "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==", - "dev": true, - "license": "ISC" - }, - "node_modules/interpret": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", - "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/ipaddr.js": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.2.0.tgz", - "integrity": "sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 10" - } - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "license": "MIT", - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-core-module": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", - "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "hasown": "^2.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-docker": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", - "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", - "dev": true, - "license": "MIT", - "bin": { - "is-docker": "cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-plain-obj": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz", - "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dev": true, - "license": "MIT", - "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-wsl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", - "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-docker": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, - "license": "ISC" - }, - "node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/jest-worker": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", - "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/jest-worker/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true, - "license": "MIT", - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true, - "license": "MIT" - }, - "node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "license": "MIT" - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "license": "MIT", - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/launch-editor": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/launch-editor/-/launch-editor-2.9.1.tgz", - "integrity": "sha512-Gcnl4Bd+hRO9P9icCP/RVVT2o8SFlPXofuCxvA2SaZuH45whSvf5p8x5oih5ftLiVhEI4sp5xDY+R+b3zJBh5w==", - "dev": true, - "license": "MIT", - "dependencies": { - "picocolors": "^1.0.0", - "shell-quote": "^1.8.1" - } - }, - "node_modules/loader-runner": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", - "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.11.5" - } - }, - "node_modules/locate-path": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", - "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^6.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.debounce": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", - "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", - "dev": true, - "license": "MIT" - }, - "node_modules/long": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/lower-case": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", - "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", - "dev": true, - "license": "MIT", - "dependencies": { - "tslib": "^2.0.3" - } - }, - "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^3.0.2" - } - }, - "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==", - "dev": true, - "license": "MIT", - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/memfs": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/memfs/-/memfs-3.5.3.tgz", - "integrity": "sha512-UERzLsxzllchadvbPs5aolHh65ISpKpM+ccLbOJ8/vvpBKmAWf+la7dXFy7Mr0ySHbdHrFv5kGFCUHHe6GFEmw==", - "dev": true, - "license": "Unlicense", - "dependencies": { - "fs-monkey": "^1.0.4" - }, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/merge-descriptors": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", - "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true, - "license": "MIT" - }, - "node_modules/methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "dev": true, - "license": "MIT", - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "dev": true, - "license": "MIT", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, - "license": "MIT", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true, - "license": "ISC" - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, - "node_modules/multicast-dns": { - "version": "7.2.5", - "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.5.tgz", - "integrity": "sha512-2eznPJP8z2BFLX50tf0LuODrpINqP1RVIm/CObbTcBRITQgmC/TjcREF1NeTBzIcR5XO/ukWo+YHOjBbFwIupg==", - "dev": true, - "license": "MIT", - "dependencies": { - "dns-packet": "^5.2.2", - "thunky": "^1.0.2" - }, - "bin": { - "multicast-dns": "cli.js" - } - }, - "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true, - "license": "MIT" - }, - "node_modules/no-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", - "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", - "dev": true, - "license": "MIT", - "dependencies": { - "lower-case": "^2.0.2", - "tslib": "^2.0.3" - } - }, - "node_modules/node-forge": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", - "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", - "dev": true, - "license": "(BSD-3-Clause OR GPL-2.0)", - "engines": { - "node": ">= 6.13.0" - } - }, - "node_modules/node-releases": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", - "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", - "dev": true, - "license": "MIT" - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/nth-check": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", - "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "boolbase": "^1.0.0" - }, - "funding": { - "url": "https://github.com/fb55/nth-check?sponsor=1" - } - }, - "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==", - "dev": true, - "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==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/obuf": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", - "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", - "dev": true, - "license": "MIT" - }, - "node_modules/on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", - "dev": true, - "license": "MIT", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/on-headers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", - "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "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==", - "dev": true, - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/open": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz", - "integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "define-lazy-prop": "^2.0.0", - "is-docker": "^2.1.1", - "is-wsl": "^2.2.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "yocto-queue": "^1.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", - "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-retry": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.6.2.tgz", - "integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/retry": "0.12.0", - "retry": "^0.13.1" - }, - "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==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/param-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", - "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", - "dev": true, - "license": "MIT", - "dependencies": { - "dot-case": "^3.0.4", - "tslib": "^2.0.3" - } - }, - "node_modules/parse5": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", - "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", - "dev": true, - "license": "MIT", - "dependencies": { - "entities": "^4.4.0" - }, - "funding": { - "url": "https://github.com/inikulin/parse5?sponsor=1" - } - }, - "node_modules/parse5/node_modules/entities": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/pascal-case": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", - "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", - "dev": true, - "license": "MIT", - "dependencies": { - "no-case": "^3.0.4", - "tslib": "^2.0.3" - } - }, - "node_modules/path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, - "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==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true, - "license": "MIT" - }, - "node_modules/path-to-regexp": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", - "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==", - "dev": true, - "license": "MIT" - }, - "node_modules/picocolors": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", - "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==", - "dev": true, - "license": "ISC" - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", - "dev": true, - "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==", - "dev": true, - "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==", - "dev": true, - "license": "MIT", - "dependencies": { - "pinkie": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pkg-dir": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-7.0.0.tgz", - "integrity": "sha512-Ie9z/WINcxxLp27BKOCHGde4ITq9UklYKDzVo1nhk5sqGEXU3FpkwP5GM2voTGJkGd9B3Otl+Q4uwSOeSUtOBA==", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^6.3.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/postcss": { - "version": "8.4.45", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.45.tgz", - "integrity": "sha512-7KTLTdzdZZYscUc65XmjFiB73vBhBfbPztCYdUNvlaso9PrzjzcmjqBPR0lNGkcVlcO4BjiO5rK/qNz+XAen1Q==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "nanoid": "^3.3.7", - "picocolors": "^1.0.1", - "source-map-js": "^1.2.0" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/postcss-modules-extract-imports": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.1.0.tgz", - "integrity": "sha512-k3kNe0aNFQDAZGbin48pL2VNidTF0w4/eASDsxlyspobzU3wZQLOGj7L9gfRe0Jo9/4uud09DsjFNH7winGv8Q==", - "dev": true, - "license": "ISC", - "engines": { - "node": "^10 || ^12 || >= 14" - }, - "peerDependencies": { - "postcss": "^8.1.0" - } - }, - "node_modules/postcss-modules-local-by-default": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.5.tgz", - "integrity": "sha512-6MieY7sIfTK0hYfafw1OMEG+2bg8Q1ocHCpoWLqOKj3JXlKu4G7btkmM/B7lFubYkYWmRSPLZi5chid63ZaZYw==", - "dev": true, - "license": "MIT", - "dependencies": { - "icss-utils": "^5.0.0", - "postcss-selector-parser": "^6.0.2", - "postcss-value-parser": "^4.1.0" - }, - "engines": { - "node": "^10 || ^12 || >= 14" - }, - "peerDependencies": { - "postcss": "^8.1.0" - } - }, - "node_modules/postcss-modules-scope": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.2.0.tgz", - "integrity": "sha512-oq+g1ssrsZOsx9M96c5w8laRmvEu9C3adDSjI8oTcbfkrTE8hx/zfyobUoWIxaKPO8bt6S62kxpw5GqypEw1QQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "postcss-selector-parser": "^6.0.4" - }, - "engines": { - "node": "^10 || ^12 || >= 14" - }, - "peerDependencies": { - "postcss": "^8.1.0" - } - }, - "node_modules/postcss-modules-values": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-4.0.0.tgz", - "integrity": "sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "icss-utils": "^5.0.0" - }, - "engines": { - "node": "^10 || ^12 || >= 14" - }, - "peerDependencies": { - "postcss": "^8.1.0" - } - }, - "node_modules/postcss-selector-parser": { - "version": "6.1.2", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz", - "integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==", - "dev": true, - "license": "MIT", - "dependencies": { - "cssesc": "^3.0.0", - "util-deprecate": "^1.0.2" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/postcss-value-parser": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", - "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/pretty-error": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-4.0.0.tgz", - "integrity": "sha512-AoJ5YMAcXKYxKhuJGdcvse+Voc6v1RgnsR3nWcYU7q4t6z0Q6T86sv5Zq8VIRbOWWFpvdGE83LtdSMNd+6Y0xw==", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash": "^4.17.20", - "renderkid": "^3.0.0" - } - }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true, - "license": "MIT" - }, - "node_modules/proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", - "dev": true, - "license": "MIT", - "dependencies": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/proxy-addr/node_modules/ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/raw-body": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", - "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", - "dev": true, - "license": "MIT", - "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/raw-body/node_modules/bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "license": "MIT", - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/rechoir": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", - "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", - "dev": true, - "license": "MIT", - "dependencies": { - "resolve": "^1.9.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/regenerate": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", - "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", - "dev": true, - "license": "MIT" - }, - "node_modules/regenerate-unicode-properties": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.1.tgz", - "integrity": "sha512-X007RyZLsCJVVrjgEFVpLUTZwyOZk3oiL75ZcuYjlIWd6rNJtOjkBwQc5AsRrpbKVkxN6sklw/k/9m2jJYOf8Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "regenerate": "^1.4.2" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/regenerator-runtime": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", - "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", - "dev": true, - "license": "MIT" - }, - "node_modules/regenerator-transform": { - "version": "0.15.2", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.15.2.tgz", - "integrity": "sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.8.4" - } - }, - "node_modules/regexpu-core": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.3.2.tgz", - "integrity": "sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/regjsgen": "^0.8.0", - "regenerate": "^1.4.2", - "regenerate-unicode-properties": "^10.1.0", - "regjsparser": "^0.9.1", - "unicode-match-property-ecmascript": "^2.0.0", - "unicode-match-property-value-ecmascript": "^2.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/regjsparser": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.9.1.tgz", - "integrity": "sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "jsesc": "~0.5.0" - }, - "bin": { - "regjsparser": "bin/parser" - } - }, - "node_modules/regjsparser/node_modules/jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", - "dev": true, - "bin": { - "jsesc": "bin/jsesc" - } - }, - "node_modules/relateurl": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz", - "integrity": "sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/renderkid": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/renderkid/-/renderkid-3.0.0.tgz", - "integrity": "sha512-q/7VIQA8lmM1hF+jn+sFSPWGlMkSAeNYcPLmDQx2zzuiDfaLrOmumR8iaUKlenFgh0XRPIUeSPlH3A+AW3Z5pg==", - "dev": true, - "license": "MIT", - "dependencies": { - "css-select": "^4.1.3", - "dom-converter": "^0.2.0", - "htmlparser2": "^6.1.0", - "lodash": "^4.17.21", - "strip-ansi": "^6.0.1" - } - }, - "node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve-cwd": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", - "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "resolve-from": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/retry": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", - "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "deprecated": "Rimraf versions prior to v4 are no longer supported", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true, - "license": "MIT" - }, - "node_modules/schema-utils": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", - "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.1.0" - }, - "engines": { - "node": ">= 12.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, - "node_modules/select-hose": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", - "integrity": "sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==", - "dev": true, - "license": "MIT" - }, - "node_modules/selfsigned": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.4.1.tgz", - "integrity": "sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node-forge": "^1.3.0", - "node-forge": "^1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/send": { - "version": "0.19.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", - "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/send/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/send/node_modules/debug/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true, - "license": "MIT" - }, - "node_modules/send/node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/serialize-javascript": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", - "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "randombytes": "^2.1.0" - } - }, - "node_modules/serve-index": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", - "integrity": "sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw==", - "dev": true, - "license": "MIT", - "dependencies": { - "accepts": "~1.3.4", - "batch": "0.6.1", - "debug": "2.6.9", - "escape-html": "~1.0.3", - "http-errors": "~1.6.2", - "mime-types": "~2.1.17", - "parseurl": "~1.3.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/serve-index/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/serve-index/node_modules/depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/serve-index/node_modules/http-errors": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==", - "dev": true, - "license": "MIT", - "dependencies": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/serve-index/node_modules/inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==", - "dev": true, - "license": "ISC" - }, - "node_modules/serve-index/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true, - "license": "MIT" - }, - "node_modules/serve-index/node_modules/setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/serve-index/node_modules/statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/serve-static": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.0.tgz", - "integrity": "sha512-pDLK8zwl2eKaYrs8mrPZBJua4hMplRWJ1tIFksVC3FtBEBnl8dxgeHtsaMS8DhS9i4fLObaon6ABoc4/hQGdPA==", - "dev": true, - "license": "MIT", - "dependencies": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.18.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/serve-static/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/serve-static/node_modules/debug/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true, - "license": "MIT" - }, - "node_modules/serve-static/node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/serve-static/node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "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==", - "dev": true, - "license": "MIT", - "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/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", - "dev": true, - "license": "ISC" - }, - "node_modules/shallow-clone": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", - "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/shell-quote": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz", - "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "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==", - "dev": true, - "license": "MIT", - "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/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/sockjs": { - "version": "0.3.24", - "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.24.tgz", - "integrity": "sha512-GJgLTZ7vYb/JtPSSZ10hsOYIvEYsjbNU+zPdIHcUaWVNUEPivzxku31865sSSud0Da0W4lEeOPlmw93zLQchuQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "faye-websocket": "^0.11.3", - "uuid": "^8.3.2", - "websocket-driver": "^0.7.4" - } - }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-support": { - "version": "0.5.21", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", - "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", - "dev": true, - "license": "MIT", - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "node_modules/spdy": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", - "integrity": "sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "^4.1.0", - "handle-thing": "^2.0.0", - "http-deceiver": "^1.2.7", - "select-hose": "^2.0.0", - "spdy-transport": "^3.0.0" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/spdy-transport": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-3.0.0.tgz", - "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "^4.1.0", - "detect-node": "^2.0.4", - "hpack.js": "^2.1.6", - "obuf": "^1.1.2", - "readable-stream": "^3.0.6", - "wbuf": "^1.7.3" - } - }, - "node_modules/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "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==", - "dev": true, - "license": "MIT", - "dependencies": { - "escape-string-regexp": "^1.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/style-loader": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-4.0.0.tgz", - "integrity": "sha512-1V4WqhhZZgjVAVJyt7TdDPZoPBPNHbekX4fWnCJL1yQukhCeZhJySUL+gL9y6sNdN95uEOS83Y55SqHcP7MzLA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 18.12.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^5.27.0" - } - }, - "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/tapable": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", - "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/terser": { - "version": "5.32.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.32.0.tgz", - "integrity": "sha512-v3Gtw3IzpBJ0ugkxEX8U0W6+TnPKRRCWGh1jC/iM/e3Ki5+qvO1L1EAZ56bZasc64aXHwRHNIQEzm6//i5cemQ==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "@jridgewell/source-map": "^0.3.3", - "acorn": "^8.8.2", - "commander": "^2.20.0", - "source-map-support": "~0.5.20" - }, - "bin": { - "terser": "bin/terser" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/terser-webpack-plugin": { - "version": "5.3.10", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz", - "integrity": "sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.20", - "jest-worker": "^27.4.5", - "schema-utils": "^3.1.1", - "serialize-javascript": "^6.0.1", - "terser": "^5.26.0" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^5.1.0" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "esbuild": { - "optional": true - }, - "uglify-js": { - "optional": true - } - } - }, - "node_modules/terser-webpack-plugin/node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/terser-webpack-plugin/node_modules/ajv-keywords": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", - "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "ajv": "^6.9.1" - } - }, - "node_modules/terser-webpack-plugin/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true, - "license": "MIT" - }, - "node_modules/terser-webpack-plugin/node_modules/schema-utils": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", - "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, - "node_modules/terser/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==", - "dev": true, - "license": "MIT" - }, - "node_modules/three": { - "version": "0.168.0", - "resolved": "https://registry.npmjs.org/three/-/three-0.168.0.tgz", - "integrity": "sha512-6m6jXtDwMJEK/GGMbAOTSAmxNdzKvvBzgd7q8bE/7Tr6m7PaBh5kKLrN7faWtlglXbzj7sVba48Idwx+NRsZXw==", - "license": "MIT" - }, - "node_modules/thunky": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", - "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", - "dev": true, - "license": "MIT" - }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.6" - } - }, - "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==", - "dev": true, - "license": "MIT", - "dependencies": { - "escape-string-regexp": "^1.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/tslib": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", - "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", - "dev": true, - "license": "0BSD" - }, - "node_modules/type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "dev": true, - "license": "MIT", - "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", - "dev": true, - "license": "MIT" - }, - "node_modules/unicode-canonical-property-names-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", - "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-match-property-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", - "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "unicode-canonical-property-names-ecmascript": "^2.0.0", - "unicode-property-aliases-ecmascript": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-match-property-value-ecmascript": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.1.0.tgz", - "integrity": "sha512-qxkjQt6qjg/mYscYMC0XKRn3Rh0wFPlfxB0xkt9CfyTvpX1Ra0+rAmdX2QyAobptSEvuy4RtpPRui6XkV+8wjA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-property-aliases-ecmascript": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", - "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/universalify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/update-browserslist-db": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", - "integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "escalade": "^3.1.2", - "picocolors": "^1.0.1" - }, - "bin": { - "update-browserslist-db": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true, - "license": "MIT" - }, - "node_modules/utila": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz", - "integrity": "sha512-Z0DbgELS9/L/75wZbro8xAnT50pBVFQZ+hUEueGDU5FN51YSCYM+jdxsfCiHjwNP/4LCDD0i/graKpeBnOXKRA==", - "dev": true, - "license": "MIT" - }, - "node_modules/utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "dev": true, - "license": "MIT", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/watchpack": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz", - "integrity": "sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==", - "dev": true, - "license": "MIT", - "dependencies": { - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.1.2" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/wbuf": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", - "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "minimalistic-assert": "^1.0.0" - } - }, - "node_modules/webpack": { - "version": "5.94.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.94.0.tgz", - "integrity": "sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.5", - "@webassemblyjs/ast": "^1.12.1", - "@webassemblyjs/wasm-edit": "^1.12.1", - "@webassemblyjs/wasm-parser": "^1.12.1", - "acorn": "^8.7.1", - "acorn-import-attributes": "^1.9.5", - "browserslist": "^4.21.10", - "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.17.1", - "es-module-lexer": "^1.2.1", - "eslint-scope": "5.1.1", - "events": "^3.2.0", - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.2.11", - "json-parse-even-better-errors": "^2.3.1", - "loader-runner": "^4.2.0", - "mime-types": "^2.1.27", - "neo-async": "^2.6.2", - "schema-utils": "^3.2.0", - "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.3.10", - "watchpack": "^2.4.1", - "webpack-sources": "^3.2.3" - }, - "bin": { - "webpack": "bin/webpack.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependenciesMeta": { - "webpack-cli": { - "optional": true - } - } - }, - "node_modules/webpack-cli": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz", - "integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^1.2.0", - "@webpack-cli/info": "^1.5.0", - "@webpack-cli/serve": "^1.7.0", - "colorette": "^2.0.14", - "commander": "^7.0.0", - "cross-spawn": "^7.0.3", - "fastest-levenshtein": "^1.0.12", - "import-local": "^3.0.2", - "interpret": "^2.2.0", - "rechoir": "^0.7.0", - "webpack-merge": "^5.7.3" - }, - "bin": { - "webpack-cli": "bin/cli.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "4.x.x || 5.x.x" - }, - "peerDependenciesMeta": { - "@webpack-cli/generators": { - "optional": true - }, - "@webpack-cli/migrate": { - "optional": true - }, - "webpack-bundle-analyzer": { - "optional": true - }, - "webpack-dev-server": { - "optional": true - } - } - }, - "node_modules/webpack-cli/node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 10" - } - }, - "node_modules/webpack-dev-middleware": { - "version": "5.3.4", - "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.4.tgz", - "integrity": "sha512-BVdTqhhs+0IfoeAf7EoH5WE+exCmqGerHfDM0IL096Px60Tq2Mn9MAbnaGUe6HiMa41KMCYF19gyzZmBcq/o4Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "colorette": "^2.0.10", - "memfs": "^3.4.3", - "mime-types": "^2.1.31", - "range-parser": "^1.2.1", - "schema-utils": "^4.0.0" - }, - "engines": { - "node": ">= 12.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^4.0.0 || ^5.0.0" - } - }, - "node_modules/webpack-dev-server": { - "version": "4.15.2", - "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-4.15.2.tgz", - "integrity": "sha512-0XavAZbNJ5sDrCbkpWL8mia0o5WPOd2YGtxrEiZkBK9FjLppIUK2TgxK6qGD2P3hUXTJNNPVibrerKcx5WkR1g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/bonjour": "^3.5.9", - "@types/connect-history-api-fallback": "^1.3.5", - "@types/express": "^4.17.13", - "@types/serve-index": "^1.9.1", - "@types/serve-static": "^1.13.10", - "@types/sockjs": "^0.3.33", - "@types/ws": "^8.5.5", - "ansi-html-community": "^0.0.8", - "bonjour-service": "^1.0.11", - "chokidar": "^3.5.3", - "colorette": "^2.0.10", - "compression": "^1.7.4", - "connect-history-api-fallback": "^2.0.0", - "default-gateway": "^6.0.3", - "express": "^4.17.3", - "graceful-fs": "^4.2.6", - "html-entities": "^2.3.2", - "http-proxy-middleware": "^2.0.3", - "ipaddr.js": "^2.0.1", - "launch-editor": "^2.6.0", - "open": "^8.0.9", - "p-retry": "^4.5.0", - "rimraf": "^3.0.2", - "schema-utils": "^4.0.0", - "selfsigned": "^2.1.1", - "serve-index": "^1.9.1", - "sockjs": "^0.3.24", - "spdy": "^4.0.2", - "webpack-dev-middleware": "^5.3.4", - "ws": "^8.13.0" - }, - "bin": { - "webpack-dev-server": "bin/webpack-dev-server.js" - }, - "engines": { - "node": ">= 12.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^4.37.0 || ^5.0.0" - }, - "peerDependenciesMeta": { - "webpack": { - "optional": true - }, - "webpack-cli": { - "optional": true - } - } - }, - "node_modules/webpack-merge": { - "version": "5.10.0", - "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.10.0.tgz", - "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", - "dev": true, - "license": "MIT", - "dependencies": { - "clone-deep": "^4.0.1", - "flat": "^5.0.2", - "wildcard": "^2.0.0" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/webpack-sources": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", - "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/webpack/node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/webpack/node_modules/ajv-keywords": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", - "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "ajv": "^6.9.1" - } - }, - "node_modules/webpack/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true, - "license": "MIT" - }, - "node_modules/webpack/node_modules/schema-utils": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", - "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, - "node_modules/websocket-driver": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz", - "integrity": "sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "http-parser-js": ">=0.5.1", - "safe-buffer": ">=5.1.0", - "websocket-extensions": ">=0.1.1" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/websocket-extensions": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz", - "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wildcard": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", - "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", - "dev": true, - "license": "MIT" - }, - "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==", - "dev": true, - "license": "ISC" - }, - "node_modules/ws": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", - "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true, - "license": "ISC" - }, - "node_modules/yocto-queue": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.1.1.tgz", - "integrity": "sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index 39aff8e..0000000 --- a/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "3d_game", - "version": "1.0.0", - "description": "A WebGPU-based 3D game", - "main": "index.js", - "scripts": { - "start": "webpack serve --open", - "build": "webpack", - "asbuild:debug": "asc assembly/index.ts --target debug", - "asbuild:release": "asc assembly/index.ts --target release", - "asbuild": "npm run asbuild:debug && npm run asbuild:release", - "test": "node tests" - }, - "dependencies": { - "@webgpu/glslang": "^0.0.15", - "cannon-es": "^0.18.0", - "three": "^0.168.0" - }, - "devDependencies": { - "@babel/core": "^7.25.2", - "@babel/preset-env": "^7.25.4", - "assemblyscript": "^0.27.29", - "babel-loader": "^9.1.3", - "css-loader": "^7.1.2", - "gh-pages": "^6.1.1", - "html-loader": "^5.1.0", - "html-webpack-plugin": "^5.6.0", - "style-loader": "^4.0.0", - "webpack": "^5.94.0", - "webpack-cli": "^4.10.0", - "webpack-dev-server": "^4.15.2" - }, - "author": "Your Name", - "license": "ISC", - "type": "module", - "exports": { - ".": { - "import": "./build/release.js", - "types": "./build/release.d.ts" - } - } -} diff --git a/src/WebGPURenderer.js b/src/WebGPURenderer.js deleted file mode 100644 index 892ebe5..0000000 --- a/src/WebGPURenderer.js +++ /dev/null @@ -1,1268 +0,0 @@ -import { BufferAttribute, Matrix4, Vector3 } from 'three'; - - -const painterSort = (a, b) => { - return a.z - b.z; -}; - -const reversePainterSort = (a, b) => { - return b.z - a.z; -}; - -const defaultAttributeDefinitions = [{ - name: 'position', - format: 'float3' -}, { - name: 'normal', - format: 'float3' -}, { - name: 'uv', - format: 'float2' -}]; - -const defaultVertexUniformsDefinitions = [{ - name: 'modelMatrix', - format: 'matrix4' -}, { - name: 'viewMatrix', - format: 'matrix4' -}, { - name: 'projectionMatrix', - format: 'matrix4' -}, { - name: 'normalMatrix', - format: 'matrix3' -}]; - -const defaultFragmentUniformsDefinitions = [{ - name: 'diffuse', - format: 'color' -}, { - name: 'opacity', - format: 'float' -}]; - -const offsetTable = { - 'float': 4, - 'float2': 8, - 'float3': 12, - 'color': 12, - 'float4': 16, - 'matrix3': 12 * 4, - 'matrix4': 16 * 4 -}; - -const ShaderLibs = {}; - -// PBR shader code is based on https://github.com/KhronosGroup/glTF-Sample-Viewer/ -ShaderLibs.MeshStandardMaterial = { - vertexUniforms: [], - fragmentUniforms: [{ - name: 'emissive', - format: 'color' - }, { - name: 'roughness', - format: 'float' - }, { - name: 'metalness', - format: 'float' - }], - textures: [{ - name: 'map', - format: 'texture', - define: 'USE_MAP' - }, { - name: 'emissiveMap', - format: 'texture', - define: 'USE_EMISSIVEMAP' - }, { - name: 'normalMap', - format: 'texture', - define: 'USE_NORMALMAP' - }, { - name: 'roughnessMap', - format: 'texture', - define: 'USE_ROUGHNESSMAP' - }, { - name: 'metalnessMap', - format: 'texture', - define: 'USE_METALNESSMAP' - }, { - name: 'aoMap', - format: 'texture', - define: 'USE_AOMAP' - }], - vertexShaderCode: ` - layout(set=0, binding=0) uniform Uniforms { - mat4 modelMatrix; - mat4 viewMatrix; - mat4 projectionMatrix; - mat3 normalMatrix; - } uniforms; - - layout(location = 0) in vec3 position; - layout(location = 1) in vec3 normal; - layout(location = 2) in vec2 uv; - - layout(location = 0) out vec3 fragPosition; - layout(location = 1) out vec3 fragNormal; - layout(location = 2) out vec2 fragUv; - - void main() { - gl_Position = uniforms.projectionMatrix * uniforms.viewMatrix * uniforms.modelMatrix * vec4(position, 1.0); - fragPosition = position; - fragNormal = normalize((uniforms.modelMatrix * vec4(normal, 0.0)).xyz); - fragUv = uv; - }`, - fragmentShaderCode: ` - layout(set=0, binding=1) uniform Uniforms { - vec3 diffuse; - float opacity; - vec3 emissive; - float roughness; - float metalness; - } uniforms; - - // @TODO: Cut off the binding nums of the unused maps - - #ifdef USE_MAP - layout(set=0, binding=MAP_BINDING) uniform sampler mapSampler; - layout(set=0, binding=MAP_SAMPLER_BINDING) uniform texture2D map; - #endif - - #ifdef USE_EMISSIVEMAP - layout(set=0, binding=EMISSIVEMAP_BINDING) uniform sampler emissiveMapSampler; - layout(set=0, binding=EMISSIVEMAP_SAMPLER_BINDING) uniform texture2D emissiveMap; - #endif - - #ifdef USE_NORMALMAP - layout(set=0, binding=NORMALMAP_BINDING) uniform sampler normalMapSampler; - layout(set=0, binding=NORMALMAP_SAMPLER_BINDING) uniform texture2D normalMap; - #endif - - #ifdef USE_ROUGHNESSMAP - layout(set=0, binding=ROUGHNESSMAP_BINDING) uniform sampler roughnessMapSampler; - layout(set=0, binding=ROUGHNESSMAP_SAMPLER_BINDING) uniform texture2D roughnessMap; - #endif - - #ifdef USE_METALNESSMAP - layout(set=0, binding=METALNESSMAP_BINDING) uniform sampler metalnessMapSampler; - layout(set=0, binding=METALNESSMAP_SAMPLER_BINDING) uniform texture2D metalnessMap; - #endif - - #ifdef USE_AOMAP - layout(set=0, binding=AOMAP_BINDING) uniform sampler aoMapSampler; - layout(set=0, binding=AOMAP_SAMPLER_BINDING) uniform texture2D aoMap; - #endif - - layout(location = 0) in vec3 fragPosition; - layout(location = 1) in vec3 fragNormal; - layout(location = 2) in vec2 fragUv; - layout(location = 0) out vec4 outColor; - - const float M_PI = 3.141592653589793; - - struct PBRInfo { - float NdotL; - float NdotV; - float NdotH; - float LdotH; - float VdotH; - float roughness; - float metallic; - vec3 reflectance0; - vec3 reflectance90; - float alphaRoughness; - vec3 diffuseColor; - vec3 specularColor; - }; - - vec3 getNormal() { - #ifdef USE_NORMALMAP - vec3 pos_dx = dFdx(fragPosition); - vec3 pos_dy = dFdy(fragPosition); - vec3 tex_dx = dFdx(vec3(fragUv, 0.0)); - vec3 tex_dy = dFdy(vec3(fragUv, 0.0)); - vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t); - - vec3 ng = normalize(fragNormal); - t = normalize(t - ng * dot(ng, t)); - vec3 b = normalize(cross(ng, t)); - mat3 tbn = mat3(t, b, ng); - - vec3 n = texture(sampler2D(normalMap, normalMapSampler), fragUv).rgb; - - float normalScale = 1.0; - n = normalize(tbn * ((2.0 * n - 1.0) * vec3(normalScale, normalScale, 1.0))); - - return n; - #else - // @TODO: Check if this is correct - return normalize(fragNormal); - #endif - } - - vec3 specularReflection(PBRInfo pbrInputs) { - return pbrInputs.reflectance0 - + (pbrInputs.reflectance90 - pbrInputs.reflectance0) - * pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0); - } - - float geometricOcclusion(PBRInfo pbrInputs) { - float NdotL = pbrInputs.NdotL; - float NdotV = pbrInputs.NdotV; - float r = pbrInputs.alphaRoughness; - - float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL))); - float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV))); - return attenuationL * attenuationV; - } - - float microfacetDistribution(PBRInfo pbrInputs) { - float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness; - float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0; - return roughnessSq / (M_PI * f * f); - } - - vec3 diffuse(PBRInfo pbrInputs) { - return pbrInputs.diffuseColor / M_PI; - } - - vec4 sRGBToLinear(in vec4 value) { - return vec4(mix(pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), value.rgb * 0.0773993808, vec3(lessThanEqual(value.rgb, vec3(0.04045)))), value.a); - } - - vec4 LinearTosRGB(in vec4 value) { - return vec4(mix(pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), value.rgb * 12.92, vec3(lessThanEqual(value.rgb, vec3(0.0031308)))), value.a); - } - - void main() { - vec4 baseColor = vec4(uniforms.diffuse, uniforms.opacity); - #ifdef USE_MAP - vec4 texelColor = texture(sampler2D(map, mapSampler), fragUv); - texelColor = sRGBToLinear(texelColor); - baseColor *= texelColor; - #endif - float roughnessFactor = uniforms.roughness; - #ifdef USE_ROUGHNESSMAP - vec4 texelRoughness = texture(sampler2D(roughnessMap, roughnessMapSampler), fragUv); - roughnessFactor *= texelRoughness.g; - #endif - roughnessFactor = clamp(roughnessFactor, 0.04, 1.0); - float metalnessFactor = uniforms.metalness; - #ifdef USE_METALNESSMAP - vec4 texelMetalness = texture(sampler2D(metalnessMap, metalnessMapSampler), fragUv); - metalnessFactor *= texelMetalness.b; - #endif - metalnessFactor = clamp(metalnessFactor, 0.0, 1.0); - - float alphaRoughness = roughnessFactor * roughnessFactor; - - vec3 f0 = vec3(0.04); - vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0); - diffuseColor *= 1.0 - metalnessFactor; - vec3 specularColor = mix(f0, baseColor.rgb, metalnessFactor); - - float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b); - float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0); - vec3 specularEnvironmentR0 = specularColor.rgb; - vec3 specularEnvironmentR90 = vec3(1.0) * reflectance90; - - vec3 camera = vec3(0.0, 0.0, 2.0); // @TODO: Should be from Camera object - vec3 lightDirection = vec3(1.0, 2.0, 2.0); // @TODO: Should be from Light nodes - vec3 n = getNormal(); - vec3 v = normalize(camera - fragPosition); - vec3 l = normalize(lightDirection); - vec3 h = normalize(l + v); - vec3 reflection = -normalize(reflect(v, n)); - - float NdotL = clamp(dot(n, l), 0.001, 1.0); - float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0); - float NdotH = clamp(dot(n, h), 0.0, 1.0); - float LdotH = clamp(dot(l, h), 0.0, 1.0); - float VdotH = clamp(dot(v, h), 0.0, 1.0); - - PBRInfo pbrInputs = PBRInfo( - NdotL, - NdotV, - NdotH, - LdotH, - VdotH, - roughnessFactor, - metalnessFactor, - specularEnvironmentR0, - specularEnvironmentR90, - alphaRoughness, - diffuseColor, - specularColor - ); - - vec3 F = specularReflection(pbrInputs); - float G = geometricOcclusion(pbrInputs); - float D = microfacetDistribution(pbrInputs); - - vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs); - vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV); - - // @TODO: Should be configurable - float lightIntensity = 2.0; - vec3 lightColor = vec3(1.0) * lightIntensity; - vec3 color = NdotL * lightColor * (diffuseContrib + specContrib); - - #ifdef USE_AOMAP - float occlusionStrength = 1.0; - float ao = texture(sampler2D(aoMap, aoMapSampler), fragUv).r; - color = mix(color, color * ao, occlusionStrength); - #endif - - vec3 totalEmissiveRadiance = uniforms.emissive; - #ifdef USE_EMISSIVEMAP - vec4 emissiveColor = texture(sampler2D(emissiveMap, emissiveMapSampler), fragUv); - emissiveColor.rgb = sRGBToLinear(emissiveColor).rgb; - totalEmissiveRadiance *= emissiveColor.rgb; - #endif - color += totalEmissiveRadiance; - - outColor = vec4(color, baseColor.a); - outColor = LinearTosRGB(outColor); - }` -}; - -ShaderLibs.MeshBasicMaterial = { - vertexUniforms: [], - fragmentUniforms: [], - textures: [{ - name: 'map', - format: 'texture', - define: 'USE_MAP' - }], - vertexShaderCode: ` - layout(set=0, binding=0) uniform Uniforms { - mat4 modelMatrix; - mat4 viewMatrix; - mat4 projectionMatrix; - mat3 normalMatrix; - } uniforms; - - layout(location = 0) in vec3 position; - layout(location = 1) in vec3 normal; - layout(location = 2) in vec2 uv; - - layout(location = 0) out vec3 fragNormal; - layout(location = 1) out vec2 fragUv; - - void main() { - gl_Position = uniforms.projectionMatrix * uniforms.viewMatrix * uniforms.modelMatrix * vec4(position, 1.0); - fragUv = uv; - fragNormal = normal; - }`, - fragmentShaderCode: ` - layout(set=0, binding=1) uniform Uniforms { - vec3 diffuse; - float opacity; - } uniforms; - - #ifdef USE_MAP - layout(set=0, binding=MAP_BINDING) uniform sampler mapSampler; - layout(set=0, binding=MAP_SAMPLER_BINDING) uniform texture2D map; - #endif - - layout(location = 0) in vec3 fragNormal; - layout(location = 1) in vec2 fragUv; - layout(location = 0) out vec4 outColor; - - void main() { - outColor = vec4(uniforms.diffuse, uniforms.opacity); - #ifdef USE_MAP - outColor *= texture(sampler2D(map, mapSampler), fragUv); - #endif - }` -}; - -ShaderLibs.MeshNormalMaterial = { - vertexUniforms: [], - fragmentUniforms: [], - textures: [], - vertexShaderCode: ` - layout(set=0, binding=0) uniform Uniforms { - mat4 modelMatrix; - mat4 viewMatrix; - mat4 projectionMatrix; - mat3 normalMatrix; - } uniforms; - - layout(location = 0) in vec3 position; - layout(location = 1) in vec3 normal; - layout(location = 2) in vec2 uv; - - layout(location = 0) out vec3 fragNormal; - layout(location = 1) out vec2 fragUv; - - void main() { - gl_Position = uniforms.projectionMatrix * uniforms.viewMatrix * uniforms.modelMatrix * vec4(position, 1.0); - fragUv = uv; - fragNormal = normalize(uniforms.normalMatrix * normal); - }`, - fragmentShaderCode: ` - layout(set=0, binding=1) uniform Uniforms { - vec3 diffuse; - float opacity; - } uniforms; - - layout(location = 0) in vec3 fragNormal; - layout(location = 1) in vec2 fragUv; - layout(location = 0) out vec4 outColor; - - void main() { - // "+ (normalize(fragNormal) * 0.5 + 0.5)" is to check each surface - vec3 normal = normalize(fragNormal); - outColor = vec4((normal * 0.5 + 0.5), uniforms.opacity); - }` -}; - -export default class WebGPURenderer { - constructor(options={}) { - if (!options.device || !options.glslang) { - throw new Error('WebGPURenderer: the constructor must take device and glslang parameters.'); - } - - this.domElement = document.createElement('canvas'); - this.context = this.domElement.getContext('gpupresent'); - - this._device = options.device; - this._glslang = options.glslang; - - this._projScreenMatrix = new Matrix4(); - this._width = 640; - this._height = 480; - this._pixelRatio = 1.0; - - this._format = 'bgra8unorm'; - this._sampleCount = 4; - this._passEncoder = null; - this._commandEncoder = null; - this._colorAttachment = null; - this._depthStencilAttachment = null; - - this._cache = { - currentProgram: null - }; - - this._verticesManager = new WebGPUVerticesManager(); - this._indicesManager = new WebGPUIndicesManager(); - this._uniformsManager = new WebGPUUniformsManager(); - this._textureManager = new WebGPUTextureManager(); - this._programManager = new WebGPUProgramManager(this._glslang, this._textureManager); - this._swapChain = this.context.configureSwapChain({ - device: this._device, - format: this._format - }); - this._setSize(this._width, this._height, this._pixelRatio); - } - - setSize(width, height) { - this._setSize(width, height, this._pixelRatio); - } - - setPixelRatio(pixelRatio) { - this._setSize(this._width, this._height, pixelRatio); - } - - /** - * @param {Scene} scene - * @param {Camera} camera - */ - render(scene, camera) { - this._cache.currentProgram = null; - - scene.updateMatrixWorld(); - if (!camera.parent) { - camera.updateMatrixWorld(); - } - - this._projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); - - const renderList = []; - this._projectObject(scene, camera, renderList); - - const opaqueObjects = []; - const transparentObjects = []; - for (const element of renderList) { - if (element.object.material.transparent) { - transparentObjects.push(element); - } else { - opaqueObjects.push(element); - } - } - - transparentObjects.sort(painterSort); - opaqueObjects.sort(reversePainterSort); - - this._setup(); - this._renderObjects(opaqueObjects, camera); - this._renderObjects(transparentObjects, camera); - this._finalize(); - } - - _setSize(width, height, pixelRatio) { - this._width = width; - this._height = height; - this._pixelRatio = pixelRatio; - const canvas = this.domElement; - canvas.width = Math.floor(this._width * this._pixelRatio); - canvas.height = Math.floor(this._height * this._pixelRatio); - canvas.style.width = this._width + 'px'; - canvas.style.height = this._height + 'px'; - const colorTexture = this._device.createTexture({ - size: { - width: Math.floor(this._width * this._pixelRatio), - height: Math.floor(this._height * this._pixelRatio), - depth: 1 - }, - sampleCount: this._sampleCount, - format: this._format, - usage: GPUTextureUsage.OUTPUT_ATTACHMENT - }); - this._colorAttachment = colorTexture.createView(); - const depthStencilTexture = this._device.createTexture({ - size: { - width: Math.floor(this._width * this._pixelRatio), - height: Math.floor(this._height * this._pixelRatio), - depth: 1 - }, - sampleCount: this._sampleCount, - format: "depth24plus-stencil8", - usage: GPUTextureUsage.OUTPUT_ATTACHMENT - }); - this._depthStencilAttachment = depthStencilTexture.createView(); - - // I don't know why but seems necessary to render... @TODO: resolve - if (canvas.parentElement) { - canvas.parentElement.appendChild(canvas); - } - } - - _projectObject(object, camera, renderList) { - if (!object.visible) { - return; - } - if (object.isMesh) { - if (object.material.visible) { - const vector3 = new Vector3(); - vector3.setFromMatrixPosition(object.matrixWorld) - .applyMatrix4(this._projScreenMatrix); - renderList.push({ - object: object, - z: vector3.z - }); - } - } - for (const child of object.children) { - this._projectObject(child, camera, renderList); - } - } - - _setup() { - this._commandEncoder = this._device.createCommandEncoder({}); - - const renderPassDescriptor = { - colorAttachments: [{ - attachment: this._colorAttachment, - resolveTarget: this._swapChain.getCurrentTexture().createView(), - loadValue: {r: 1.0, g: 1.0, b: 1.0, a: 1.0} - }], - depthStencilAttachment: { - attachment: this._depthStencilAttachment, - depthLoadValue: 1.0, - depthStoreOp: 'store', - stencilLoadValue: 0, - stencilStoreOp: 'store', - } - }; - - this._passEncoder = this._commandEncoder.beginRenderPass(renderPassDescriptor); - } - - _renderObjects(objects, camera) { - for (const object of objects) { - this._renderObject(object.object, camera); - } - } - - _renderObject(object, camera) { - const program = this._programManager.get(object.material, this._device); - - if (this._cache.currentProgram !== program) { - this._passEncoder.setPipeline(program.pipeline); - this._cache.currentProgram = program; - } - - const vertices = this._verticesManager.get(object.geometry, program, this._device); - const uniforms = this._uniformsManager.get(object, camera, program, this._device); - const indexAttribute = object.geometry.getIndex(); - - this._passEncoder.setVertexBuffer(0, vertices.buffer); - this._passEncoder.setBindGroup(0, uniforms.bindGroup); - - if (indexAttribute) { - const indices = this._indicesManager.get(object.geometry, this._device); - this._passEncoder.setIndexBuffer(indices.buffer); - const indexCount = indexAttribute.array.length; - this._passEncoder.drawIndexed(indexCount, 1, 0, 0, 0); - } else { - const vertexCount = object.geometry.getAttribute('position').array.length; - this._passEncoder.draw(vertexCount, 1, 0, 0); - } - } - - _finalize() { - this._passEncoder.endPass(); - this._device.defaultQueue.submit([this._commandEncoder.finish()]); - } -} - -class WebGPUProgramManager { - constructor(glslang, textureManager) { - this.glslang = glslang; - this.textureManager = textureManager; - this.map = new Map(); // material -> program - this.map2 = new Map(); // material type key -> program - } - - get(material, device) { - if (!this.map.has(material)) { - // @TODO: Create key more properly - const key = material.type + ':' + [ - !!material.map, - !!material.emissiveMap, - !!material.normalMap, - !!material.roughnessMap, - !!material.metalnessMap, - !!material.aoMap - ].join(':'); - if (!this.map2.has(key)) { - this.map2.set(key, new WebGPUProgram( - this.glslang, - material, - this.textureManager, - device - )); - } - this.map.set(material, this.map2.get(key)); - } - return this.map.get(material); - } -} - -class WebGPUProgram { - constructor(glslang, material, textureManager, device) { - this.textureManager = textureManager; - const shader = ShaderLibs[material.type]; - - if (!shader) { - throw new Error('This type of material is not supported yet. ' + key); - } - - const entries = [{ - binding: 0, - visibility: GPUShaderStage.VERTEX, - type: 'uniform-buffer' - }, { - binding: 1, - visibility: GPUShaderStage.FRAGMENT, - type: 'uniform-buffer' - }]; - - let binding = 2; - const defines = []; - for (const definition of shader.textures) { - switch (definition.name) { - case 'map': - if (!material.map) { - continue; - } - break; - case 'emissiveMap': - if (!material.emissiveMap) { - continue; - } - break; - case 'normalMap': - if (!material.normalMap) { - continue; - } - break; - case 'roughnessMap': - if (!material.roughnessMap) { - continue; - } - break; - case 'metalnessMap': - if (!material.metalnessMap) { - continue; - } - break; - case 'aoMap': - if (!material.aoMap) { - continue; - } - break; - default: - console.error('Unknown texture ' + definition.name); - continue; - } - entries.push({ - binding: binding, - visibility: GPUShaderStage.FRAGMENT, - type: 'sampler' - }); - entries.push({ - binding: binding + 1, - visibility: GPUShaderStage.FRAGMENT, - type: 'sampled-texture' - }); - if (definition.define) { - defines.push('#define ' + definition.define); - defines.push('#define ' + definition.name.toUpperCase() + '_BINDING ' + binding); - defines.push('#define ' + definition.name.toUpperCase() + '_SAMPLER_BINDING ' + (binding + 1)); - } - binding += 2; - } - - const vertexShaderCode = '#version 450\n' + - defines.join('\n') + '\n' + - shader.vertexShaderCode; - - const fragmentShaderCode = '#version 450\n' + - defines.join('\n') + '\n' + - shader.fragmentShaderCode; - - this.uniformGroupLayout = device.createBindGroupLayout({ - entries: entries, - }); - - this.pipeline = device.createRenderPipeline({ - layout: device.createPipelineLayout({bindGroupLayouts: [this.uniformGroupLayout]}), - vertexStage: { - module: device.createShaderModule({ - code: glslang.compileGLSL(vertexShaderCode, 'vertex'), - source: vertexShaderCode, - transform: source => glslang.compileGLSL(source, 'vertex') - }), - entryPoint: 'main' - }, - fragmentStage: { - module: device.createShaderModule({ - code: glslang.compileGLSL(fragmentShaderCode, 'fragment'), - source: fragmentShaderCode, - transform: source => glslang.compileGLSL(source, 'fragment') - }), - entryPoint: 'main' - }, - primitiveTopology: 'triangle-list', - depthStencilState: { - depthWriteEnabled: true, - depthCompare: 'less', - format: 'depth24plus-stencil8' - }, - vertexState: this._createVertexState(), - colorStates: [{ - format: 'bgra8unorm', - colorBlend: { - srcFactor: 'src-alpha', - dstFactor: 'one-minus-src-alpha', - operation: 'add' - } - }], - sampleCount: 4 // @TODO: Should be configurable - }); - } - - _createVertexState() { - let offset = 0; - const attributes = []; - for (let i = 0; i < defaultAttributeDefinitions.length; i++) { - const definition = defaultAttributeDefinitions[i]; - attributes.push({ - shaderLocation: i, - offset: offset, - format: definition.format - }); - offset += offsetTable[definition.format]; - } - - return { - indexFormat: 'uint16', // @TODO: Should be configurable - vertexBuffers: [{ - arrayStride: offset, - attributes: attributes - }] - }; - } - - createVertices(geometry, device) { - let itemSize = 0; - for (const definition of defaultAttributeDefinitions) { - itemSize += offsetTable[definition.format]; - } - const position = geometry.getAttribute('position'); - return new WebGPUVertices(new Float32Array(itemSize * position.count), device); - } - - createUniforms(device, material) { - const buffers = this._createUniformBuffers(material, device); - const textures = this._createUniformTextures(material, device); - const bindGroup = this._createUniformBindGroup(buffers, textures, device); - return new WebGPUUniforms(buffers, bindGroup); - } - - _createUniformBuffers(material, device) { - const shader = ShaderLibs[material.type]; - - let vertexUniformsSize = 0; - for (const definition of defaultVertexUniformsDefinitions) { - vertexUniformsSize += offsetTable[definition.format]; - } - for (const definition of shader.vertexUniforms) { - vertexUniformsSize += offsetTable[definition.format]; - } - - let fragmentUniformsSize = 0; - for (const definition of defaultFragmentUniformsDefinitions) { - fragmentUniformsSize += offsetTable[definition.format]; - } - for (const definition of shader.fragmentUniforms) { - fragmentUniformsSize += offsetTable[definition.format]; - } - - const buffers = []; - buffers.push(new WebGPUUniformBuffer(vertexUniformsSize, device)); // vertex - buffers.push(new WebGPUUniformBuffer(fragmentUniformsSize, device)); // fragment - return buffers; - } - - _createUniformTextures(material, device) { - const textures = []; - for (const definition of ShaderLibs[material.type].textures) { - switch (definition.name) { - case 'map': - if (material.map) { - textures.push(this.textureManager.get(material.map, device)); - } - break; - case 'emissiveMap': - if (material.emissiveMap) { - textures.push(this.textureManager.get(material.emissiveMap, device)); - } - break; - case 'normalMap': - if (material.normalMap) { - textures.push(this.textureManager.get(material.normalMap, device)); - } - break; - case 'roughnessMap': - if (material.roughnessMap) { - textures.push(this.textureManager.get(material.roughnessMap, device)); - } - break; - case 'metalnessMap': - if (material.metalnessMap) { - textures.push(this.textureManager.get(material.metalnessMap, device)); - } - break; - case 'aoMap': - if (material.aoMap) { - textures.push(this.textureManager.get(material.aoMap, device)); - } - break; - default: - console.error('Unknown texture ' + definition.name); - continue; - } - } - return textures; - } - - _createUniformBindGroup(buffers, textures, device) { - const entries = []; - for (let i = 0; i < buffers.length; i++) { - const buffer = buffers[i]; - entries.push({ - binding: i, - resource: { - buffer: buffer.buffer, - size: buffer.byteLength - } - }); - } - for (let i = 0; i < textures.length; i++) { - entries.push({ - binding: entries.length, - resource: textures[i].sampler.sampler - }); - entries.push({ - binding: entries.length, - resource: textures[i].texture.createView() - }); - } - return device.createBindGroup({ - layout: this.uniformGroupLayout, - entries: entries - }); - } -} - -class WebGPUUniformsManager { - constructor() { - this.map = new Map(); - } - - get(object, camera, program, device) { - if (!this.map.has(object)) { - this.map.set(object, program.createUniforms(device, object.material)); - } - const uniforms = this.map.get(object); - uniforms.update(object, camera, device); - return uniforms; - } -} - -class WebGPUUniforms { - constructor(buffers, bindGroup) { - this.buffers = buffers; - this.bindGroup = bindGroup; - } - - update(object, camera, device) { - object.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, object.matrixWorld); - object.normalMatrix.getNormalMatrix(object.modelViewMatrix); - - const shader = ShaderLibs[object.material.type]; - - // for vertex shader - let offset = 0; - const vertexUniformsBuffer = this.buffers[0]; - for (const definition of defaultVertexUniformsDefinitions) { - let value; - switch (definition.name) { - case 'modelMatrix': - value = object.matrixWorld; - break; - case 'viewMatrix': - value = camera.matrixWorldInverse; - break; - case 'projectionMatrix': - value = camera.projectionMatrix; - break; - case 'normalMatrix': - value = object.normalMatrix; - break; - default: - console.error('Unknown uniform ' + definition.name); - continue; - } - if (value) { - this._updateData(vertexUniformsBuffer, definition.format, offset, value); - } - offset += offsetTable[definition.format]; - } - vertexUniformsBuffer.upload(device); - - // for fragment shader - offset = 0; - const fragmentUniformsBuffer = this.buffers[1]; - for (const definition of defaultFragmentUniformsDefinitions) { - let value; - switch (definition.name) { - case 'diffuse': - value = object.material.color; - break; - case 'opacity': - value = object.material.opacity; - break; - default: - console.error('Unknown uniform ' + definition.name); - continue; - } - if (value !== undefined && value !== null) { - this._updateData(fragmentUniformsBuffer, definition.format, offset, value); - } - offset += offsetTable[definition.format]; - } - - for (const definition of shader.fragmentUniforms) { - let value; - switch (definition.name) { - case 'emissive': - value = object.material.emissive; - break; - case 'roughness': - value = object.material.roughness; - break; - case 'metalness': - value = object.material.metalness; - break; - default: - console.error('Unknown uniform ' + definition.name); - continue; - } - if (value !== undefined && value !== null) { - this._updateData(fragmentUniformsBuffer, definition.format, offset, value); - } - offset += offsetTable[definition.format]; - } - fragmentUniformsBuffer.upload(device); - } - - _updateData(buffer, format, offset, value) { - switch (format) { - case 'float': - buffer.updateFloat(offset, value); - break; - case 'float3': - buffer.updateVector3(offset, value); - break; - case 'color': - buffer.updateColor(offset, value); - break; - case 'matrix3': - buffer.updateMatrix3(offset, value); - break; - case 'matrix4': - buffer.updateMatrix4(offset, value); - break; - default: - console.error('Unknown format ' + format); - break; - } - } -} - -class WebGPUUniformBuffer { - constructor(byteLength, device) { - this.buffer = device.createBuffer({ - size: byteLength, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST, - }); - this.byteLength = byteLength; - const arrayBuffer = new ArrayBuffer(byteLength); - this.float32Array = new Float32Array(arrayBuffer); - } - - upload(device) { - device.defaultQueue.writeBuffer(this.buffer, 0, this.float32Array.buffer); - } - - updateMatrix4(offset, matrix4) { - const index = offset / 4; - for (let i = 0; i < 16; i++) { - this.float32Array[index + i] = matrix4.elements[i]; - } - } - - updateMatrix3(offset, matrix3) { - const index = offset / 4; - this.float32Array[index + 0] = matrix3.elements[0]; - this.float32Array[index + 1] = matrix3.elements[1]; - this.float32Array[index + 2] = matrix3.elements[2]; - this.float32Array[index + 4] = matrix3.elements[3]; - this.float32Array[index + 5] = matrix3.elements[4]; - this.float32Array[index + 6] = matrix3.elements[5]; - this.float32Array[index + 8] = matrix3.elements[6]; - this.float32Array[index + 9] = matrix3.elements[7]; - this.float32Array[index + 10] = matrix3.elements[8]; - } - - updateVector3(offset, vec3) { - const index = offset / 4; - this.float32Array[index] = vec3.x; - this.float32Array[index + 1] = vec3.y; - this.float32Array[index + 2] = vec3.z; - } - - updateColor(offset, color) { - const index = offset / 4; - this.float32Array[index] = color.r; - this.float32Array[index + 1] = color.g; - this.float32Array[index + 2] = color.b; - } - - updateFloat(offset, value) { - this.float32Array[offset / 4] = value; - } -} - -class WebGPUUniformSampler { - constructor(device) { - // @TODO: Should be configurable - this.sampler = device.createSampler({ - addressModeU: 'repeat', - addressModeV: 'repeat', - magFilter: 'linear', - minFilter: 'linear' - }); - } -} - -class WebGPUTextureManager { - constructor() { - this.map = new Map(); - } - - get(texture, device) { - if (!this.map.has(texture)) { - const image = texture.image; - const webgpuTexture = new WebGPUTexture(image.width, image.height, device); - webgpuTexture.upload(image, device); - this.map.set(texture, webgpuTexture); - } - return this.map.get(texture); - } -} - -class WebGPUTexture { - constructor(width, height, device) { - this.width = width; - this.height = height; - this.sampler = new WebGPUUniformSampler(device); - - this.texture = device.createTexture({ - size: { - width: this.width, - height: this.height, - depth: 1 - }, - format: 'rgba8unorm', - usage: GPUTextureUsage.SAMPLED | GPUTextureUsage.COPY_DST - }); - - this.buffer = device.createBuffer({ - size: this.width * this.height * 4, - usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC - }); - } - - upload(image, device) { - const canvas = document.createElement('canvas'); - canvas.width = this.width; - canvas.height = this.height; - const context = canvas.getContext('2d'); - context.drawImage(image, 0, 0); - const imageData = context.getImageData(0, 0, this.width, this.height); - device.defaultQueue.writeBuffer(this.buffer, 0, imageData.data.buffer); - - const encoder = device.createCommandEncoder({}); - encoder.copyBufferToTexture({ - buffer: this.buffer, - bytesPerRow: this.width * 4, - rowsPerImage: 0 - }, { - texture: this.texture - }, { - width: this.width, - height: this.height, - depth: 1 - }); - - device.defaultQueue.submit([encoder.finish()]); - } -} - -class WebGPUVerticesManager { - constructor() { - this.map = new Map(); - } - - get(geometry, program, device) { - if (!this.map.has(geometry)) { - const vertices = program.createVertices(geometry, device); - vertices.update(geometry); - vertices.upload(device); - this.map.set(geometry, vertices); - } - return this.map.get(geometry); - } -} - -class WebGPUVertices { - constructor(array, device) { - this.array = array; - this.buffer = device.createBuffer({ - size: this.array.byteLength, - usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST - }); - } - - update(geometry) { - const position = geometry.getAttribute('position'); - - // @TODO: Remove this temporal workaround - if (!geometry.getAttribute('uv')) { - geometry.setAttribute('uv', new BufferAttribute(new Float32Array(position.count * 2), 2)); - } - const uv = geometry.getAttribute('uv'); - - let dataIndex = 0; - const indices = {}; - for (const definition of defaultAttributeDefinitions) { - indices[definition.name] = 0; - } - for (let i = 0; i < position.count; i++) { - for (const definition of defaultAttributeDefinitions) { - const attribute = geometry.getAttribute(definition.name); - for (let j = 0; j < attribute.itemSize; j++) { - this.array[dataIndex++] = attribute.array[indices[definition.name]++]; - } - } - } - } - - upload(device) { - device.defaultQueue.writeBuffer(this.buffer, 0, this.array.buffer); - } -} - -class WebGPUIndicesManager { - constructor() { - this.map = new Map(); - } - - get(geometry, device) { - if (!this.map.has(geometry)) { - const indices = new WebGPUIndices( - // Buffer subdata size must be a multiple of 4 bytes - new Uint16Array(Math.floor((geometry.getIndex().array.byteLength + 3) / 4) * 4), - device - ); - indices.update(geometry); - indices.upload(device); - this.map.set(geometry, indices); - } - return this.map.get(geometry); - } -} - -class WebGPUIndices { - constructor(array, device) { - this.array = array; - this.buffer = device.createBuffer({ - size: this.array.byteLength, - usage: GPUBufferUsage.INDEX | GPUBufferUsage.COPY_DST - }); - } - - update(geometry) { - const index = geometry.getIndex(); - for (let i = 0; i < index.array.length; i++) { - this.array[i] = index.array[i]; - } - } - - upload(device) { - device.defaultQueue.writeBuffer(this.buffer, 0, this.array.buffer); - } -} - - - -export { WebGPURenderer }; From 5c16486846a54643df6a91741fbea6a21174c703 Mon Sep 17 00:00:00 2001 From: Masterofowls Date: Fri, 20 Sep 2024 13:49:32 +0300 Subject: [PATCH 3/3] Initial commit --- dist/996e0c1b19b93e0bdcfb.js | 66 + dist/a708c87fa8616c003655.js | 2 + dist/a708c87fa8616c003655.js.LICENSE.txt | 19 + dist/bundle.js | 128 +- dist/bundle.js.LICENSE.txt | 5 + dist/index.html | 75 +- node_modules/.package-lock.json | 2232 ++--- node_modules/@types/estree/README.md | 2 +- node_modules/@types/estree/index.d.ts | 11 +- node_modules/@types/estree/package.json | 6 +- node_modules/@types/node/README.md | 2 +- node_modules/@types/node/package.json | 4 +- node_modules/@types/node/util.d.ts | 13 +- .../@webpack-cli/configtest/README.md | 4 + .../@webpack-cli/configtest/lib/index.d.ts | 2 +- .../@webpack-cli/configtest/lib/index.js | 18 +- .../@webpack-cli/configtest/package.json | 11 +- node_modules/@webpack-cli/info/README.md | 4 + node_modules/@webpack-cli/info/lib/index.d.ts | 2 +- node_modules/@webpack-cli/info/lib/index.js | 71 +- node_modules/@webpack-cli/info/package.json | 16 +- node_modules/@webpack-cli/serve/README.md | 4 +- .../@webpack-cli/serve/lib/index.d.ts | 2 +- node_modules/@webpack-cli/serve/lib/index.js | 200 +- node_modules/@webpack-cli/serve/package.json | 10 +- node_modules/ajv-keywords/README.md | 767 +- .../ajv-keywords/dist/definitions/_range.d.ts | 5 - .../ajv-keywords/dist/definitions/_range.js | 28 - .../dist/definitions/_range.js.map | 1 - .../dist/definitions/_required.d.ts | 5 - .../dist/definitions/_required.js | 23 - .../dist/definitions/_required.js.map | 1 - .../ajv-keywords/dist/definitions/_types.d.ts | 5 - .../ajv-keywords/dist/definitions/_types.js | 3 - .../dist/definitions/_types.js.map | 1 - .../ajv-keywords/dist/definitions/_util.d.ts | 4 - .../ajv-keywords/dist/definitions/_util.js | 19 - .../dist/definitions/_util.js.map | 1 - .../dist/definitions/allRequired.d.ts | 2 - .../dist/definitions/allRequired.js | 21 - .../dist/definitions/allRequired.js.map | 1 - .../dist/definitions/anyRequired.d.ts | 4 - .../dist/definitions/anyRequired.js | 10 - .../dist/definitions/anyRequired.js.map | 1 - .../dist/definitions/deepProperties.d.ts | 3 - .../dist/definitions/deepProperties.js | 54 - .../dist/definitions/deepProperties.js.map | 1 - .../dist/definitions/deepRequired.d.ts | 2 - .../dist/definitions/deepRequired.js | 33 - .../dist/definitions/deepRequired.js.map | 1 - .../dist/definitions/dynamicDefaults.d.ts | 7 - .../dist/definitions/dynamicDefaults.js | 84 - .../dist/definitions/dynamicDefaults.js.map | 1 - .../dist/definitions/exclusiveRange.d.ts | 4 - .../dist/definitions/exclusiveRange.js | 10 - .../dist/definitions/exclusiveRange.js.map | 1 - .../ajv-keywords/dist/definitions/index.d.ts | 6 - .../ajv-keywords/dist/definitions/index.js | 44 - .../dist/definitions/index.js.map | 1 - .../dist/definitions/instanceof.d.ts | 7 - .../dist/definitions/instanceof.js | 54 - .../dist/definitions/instanceof.js.map | 1 - .../dist/definitions/oneRequired.d.ts | 4 - .../dist/definitions/oneRequired.js | 10 - .../dist/definitions/oneRequired.js.map | 1 - .../dist/definitions/patternRequired.d.ts | 5 - .../dist/definitions/patternRequired.js | 42 - .../dist/definitions/patternRequired.js.map | 1 - .../dist/definitions/prohibited.d.ts | 2 - .../dist/definitions/prohibited.js | 23 - .../dist/definitions/prohibited.js.map | 1 - .../ajv-keywords/dist/definitions/range.d.ts | 4 - .../ajv-keywords/dist/definitions/range.js | 10 - .../dist/definitions/range.js.map | 1 - .../ajv-keywords/dist/definitions/regexp.d.ts | 2 - .../ajv-keywords/dist/definitions/regexp.js | 40 - .../dist/definitions/regexp.js.map | 1 - .../ajv-keywords/dist/definitions/select.d.ts | 7 - .../ajv-keywords/dist/definitions/select.js | 63 - .../dist/definitions/select.js.map | 1 - .../dist/definitions/transform.d.ts | 13 - .../dist/definitions/transform.js | 78 - .../dist/definitions/transform.js.map | 1 - .../ajv-keywords/dist/definitions/typeof.d.ts | 2 - .../ajv-keywords/dist/definitions/typeof.js | 25 - .../dist/definitions/typeof.js.map | 1 - .../definitions/uniqueItemProperties.d.ts | 2 - .../dist/definitions/uniqueItemProperties.js | 65 - .../definitions/uniqueItemProperties.js.map | 1 - node_modules/ajv-keywords/dist/index.d.ts | 4 - node_modules/ajv-keywords/dist/index.js | 32 - node_modules/ajv-keywords/dist/index.js.map | 1 - .../dist/keywords/allRequired.d.ts | 3 - .../ajv-keywords/dist/keywords/allRequired.js | 10 - .../dist/keywords/allRequired.js.map | 1 - .../dist/keywords/anyRequired.d.ts | 3 - .../ajv-keywords/dist/keywords/anyRequired.js | 10 - .../dist/keywords/anyRequired.js.map | 1 - .../dist/keywords/deepProperties.d.ts | 4 - .../dist/keywords/deepProperties.js | 10 - .../dist/keywords/deepProperties.js.map | 1 - .../dist/keywords/deepRequired.d.ts | 3 - .../dist/keywords/deepRequired.js | 10 - .../dist/keywords/deepRequired.js.map | 1 - .../dist/keywords/dynamicDefaults.d.ts | 3 - .../dist/keywords/dynamicDefaults.js | 10 - .../dist/keywords/dynamicDefaults.js.map | 1 - .../dist/keywords/exclusiveRange.d.ts | 3 - .../dist/keywords/exclusiveRange.js | 10 - .../dist/keywords/exclusiveRange.js.map | 1 - .../ajv-keywords/dist/keywords/index.d.ts | 3 - .../ajv-keywords/dist/keywords/index.js | 43 - .../ajv-keywords/dist/keywords/index.js.map | 1 - .../dist/keywords/instanceof.d.ts | 3 - .../ajv-keywords/dist/keywords/instanceof.js | 10 - .../dist/keywords/instanceof.js.map | 1 - .../dist/keywords/oneRequired.d.ts | 3 - .../ajv-keywords/dist/keywords/oneRequired.js | 10 - .../dist/keywords/oneRequired.js.map | 1 - .../dist/keywords/patternRequired.d.ts | 3 - .../dist/keywords/patternRequired.js | 10 - .../dist/keywords/patternRequired.js.map | 1 - .../dist/keywords/prohibited.d.ts | 3 - .../ajv-keywords/dist/keywords/prohibited.js | 10 - .../dist/keywords/prohibited.js.map | 1 - .../ajv-keywords/dist/keywords/range.d.ts | 3 - .../ajv-keywords/dist/keywords/range.js | 10 - .../ajv-keywords/dist/keywords/range.js.map | 1 - .../ajv-keywords/dist/keywords/regexp.d.ts | 3 - .../ajv-keywords/dist/keywords/regexp.js | 10 - .../ajv-keywords/dist/keywords/regexp.js.map | 1 - .../ajv-keywords/dist/keywords/select.d.ts | 4 - .../ajv-keywords/dist/keywords/select.js | 13 - .../ajv-keywords/dist/keywords/select.js.map | 1 - .../ajv-keywords/dist/keywords/transform.d.ts | 3 - .../ajv-keywords/dist/keywords/transform.js | 10 - .../dist/keywords/transform.js.map | 1 - .../ajv-keywords/dist/keywords/typeof.d.ts | 3 - .../ajv-keywords/dist/keywords/typeof.js | 10 - .../ajv-keywords/dist/keywords/typeof.js.map | 1 - .../dist/keywords/uniqueItemProperties.d.ts | 3 - .../dist/keywords/uniqueItemProperties.js | 10 - .../dist/keywords/uniqueItemProperties.js.map | 1 - node_modules/ajv-keywords/package.json | 65 +- .../ajv-keywords/src/definitions/_range.ts | 30 - .../ajv-keywords/src/definitions/_required.ts | 24 - .../ajv-keywords/src/definitions/_types.ts | 7 - .../ajv-keywords/src/definitions/_util.ts | 22 - .../src/definitions/allRequired.ts | 18 - .../src/definitions/anyRequired.ts | 8 - .../src/definitions/deepProperties.ts | 52 - .../src/definitions/deepRequired.ts | 35 - .../src/definitions/dynamicDefaults.ts | 98 - .../src/definitions/exclusiveRange.ts | 8 - .../ajv-keywords/src/definitions/index.ts | 61 - .../src/definitions/instanceof.ts | 61 - .../src/definitions/oneRequired.ts | 8 - .../src/definitions/patternRequired.ts | 46 - .../src/definitions/prohibited.ts | 20 - .../ajv-keywords/src/definitions/range.ts | 8 - .../ajv-keywords/src/definitions/regexp.ts | 45 - .../ajv-keywords/src/definitions/select.ts | 69 - .../ajv-keywords/src/definitions/transform.ts | 98 - .../ajv-keywords/src/definitions/typeof.ts | 27 - .../src/definitions/uniqueItemProperties.ts | 58 - node_modules/ajv-keywords/src/index.ts | 32 - .../ajv-keywords/src/keywords/allRequired.ts | 7 - .../ajv-keywords/src/keywords/anyRequired.ts | 7 - .../src/keywords/deepProperties.ts | 9 - .../ajv-keywords/src/keywords/deepRequired.ts | 7 - .../src/keywords/dynamicDefaults.ts | 7 - .../src/keywords/exclusiveRange.ts | 7 - .../ajv-keywords/src/keywords/index.ts | 40 - .../ajv-keywords/src/keywords/instanceof.ts | 7 - .../ajv-keywords/src/keywords/oneRequired.ts | 7 - .../src/keywords/patternRequired.ts | 7 - .../ajv-keywords/src/keywords/prohibited.ts | 7 - .../ajv-keywords/src/keywords/range.ts | 7 - .../ajv-keywords/src/keywords/regexp.ts | 7 - .../ajv-keywords/src/keywords/select.ts | 11 - .../ajv-keywords/src/keywords/transform.ts | 7 - .../ajv-keywords/src/keywords/typeof.ts | 7 - .../src/keywords/uniqueItemProperties.ts | 7 - node_modules/ajv/.runkit_example.js | 23 - node_modules/ajv/LICENSE | 2 +- node_modules/ajv/README.md | 1498 +++- node_modules/ajv/dist/2019.d.ts | 19 - node_modules/ajv/dist/2019.js | 61 - node_modules/ajv/dist/2019.js.map | 1 - node_modules/ajv/dist/2020.d.ts | 19 - node_modules/ajv/dist/2020.js | 55 - node_modules/ajv/dist/2020.js.map | 1 - node_modules/ajv/dist/ajv.d.ts | 18 - node_modules/ajv/dist/ajv.js | 50 - node_modules/ajv/dist/ajv.js.map | 1 - .../ajv/dist/compile/codegen/code.d.ts | 40 - node_modules/ajv/dist/compile/codegen/code.js | 156 - .../ajv/dist/compile/codegen/code.js.map | 1 - .../ajv/dist/compile/codegen/index.d.ts | 79 - .../ajv/dist/compile/codegen/index.js | 697 -- .../ajv/dist/compile/codegen/index.js.map | 1 - .../ajv/dist/compile/codegen/scope.d.ts | 79 - .../ajv/dist/compile/codegen/scope.js | 143 - .../ajv/dist/compile/codegen/scope.js.map | 1 - node_modules/ajv/dist/compile/errors.d.ts | 13 - node_modules/ajv/dist/compile/errors.js | 123 - node_modules/ajv/dist/compile/errors.js.map | 1 - node_modules/ajv/dist/compile/index.d.ts | 80 - node_modules/ajv/dist/compile/index.js | 242 - node_modules/ajv/dist/compile/index.js.map | 1 - node_modules/ajv/dist/compile/jtd/parse.d.ts | 4 - node_modules/ajv/dist/compile/jtd/parse.js | 350 - .../ajv/dist/compile/jtd/parse.js.map | 1 - .../ajv/dist/compile/jtd/serialize.d.ts | 4 - .../ajv/dist/compile/jtd/serialize.js | 229 - .../ajv/dist/compile/jtd/serialize.js.map | 1 - node_modules/ajv/dist/compile/jtd/types.d.ts | 6 - node_modules/ajv/dist/compile/jtd/types.js | 14 - .../ajv/dist/compile/jtd/types.js.map | 1 - node_modules/ajv/dist/compile/names.d.ts | 20 - node_modules/ajv/dist/compile/names.js | 28 - node_modules/ajv/dist/compile/names.js.map | 1 - node_modules/ajv/dist/compile/ref_error.d.ts | 6 - node_modules/ajv/dist/compile/ref_error.js | 12 - .../ajv/dist/compile/ref_error.js.map | 1 - node_modules/ajv/dist/compile/resolve.d.ts | 12 - node_modules/ajv/dist/compile/resolve.js | 155 - node_modules/ajv/dist/compile/resolve.js.map | 1 - node_modules/ajv/dist/compile/rules.d.ts | 28 - node_modules/ajv/dist/compile/rules.js | 26 - node_modules/ajv/dist/compile/rules.js.map | 1 - node_modules/ajv/dist/compile/util.d.ts | 40 - node_modules/ajv/dist/compile/util.js | 178 - node_modules/ajv/dist/compile/util.js.map | 1 - .../dist/compile/validate/applicability.d.ts | 6 - .../dist/compile/validate/applicability.js | 19 - .../compile/validate/applicability.js.map | 1 - .../ajv/dist/compile/validate/boolSchema.d.ts | 4 - .../ajv/dist/compile/validate/boolSchema.js | 50 - .../dist/compile/validate/boolSchema.js.map | 1 - .../ajv/dist/compile/validate/dataType.d.ts | 17 - .../ajv/dist/compile/validate/dataType.js | 203 - .../ajv/dist/compile/validate/dataType.js.map | 1 - .../ajv/dist/compile/validate/defaults.d.ts | 2 - .../ajv/dist/compile/validate/defaults.js | 35 - .../ajv/dist/compile/validate/defaults.js.map | 1 - .../ajv/dist/compile/validate/index.d.ts | 42 - .../ajv/dist/compile/validate/index.js | 520 -- .../ajv/dist/compile/validate/index.js.map | 1 - .../ajv/dist/compile/validate/keyword.d.ts | 8 - .../ajv/dist/compile/validate/keyword.js | 124 - .../ajv/dist/compile/validate/keyword.js.map | 1 - .../ajv/dist/compile/validate/subschema.d.ts | 47 - .../ajv/dist/compile/validate/subschema.js | 81 - .../dist/compile/validate/subschema.js.map | 1 - node_modules/ajv/dist/core.d.ts | 173 - node_modules/ajv/dist/core.js | 618 -- node_modules/ajv/dist/core.js.map | 1 - node_modules/ajv/dist/jtd.d.ts | 47 - node_modules/ajv/dist/jtd.js | 72 - node_modules/ajv/dist/jtd.js.map | 1 - node_modules/ajv/dist/refs/data.json | 13 - .../dist/refs/json-schema-2019-09/index.d.ts | 2 - .../dist/refs/json-schema-2019-09/index.js | 28 - .../refs/json-schema-2019-09/index.js.map | 1 - .../json-schema-2019-09/meta/applicator.json | 53 - .../json-schema-2019-09/meta/content.json | 17 - .../refs/json-schema-2019-09/meta/core.json | 57 - .../refs/json-schema-2019-09/meta/format.json | 14 - .../json-schema-2019-09/meta/meta-data.json | 37 - .../json-schema-2019-09/meta/validation.json | 90 - .../dist/refs/json-schema-2019-09/schema.json | 39 - .../dist/refs/json-schema-2020-12/index.d.ts | 2 - .../dist/refs/json-schema-2020-12/index.js | 30 - .../refs/json-schema-2020-12/index.js.map | 1 - .../json-schema-2020-12/meta/applicator.json | 48 - .../json-schema-2020-12/meta/content.json | 17 - .../refs/json-schema-2020-12/meta/core.json | 51 - .../meta/format-annotation.json | 14 - .../json-schema-2020-12/meta/meta-data.json | 37 - .../json-schema-2020-12/meta/unevaluated.json | 15 - .../json-schema-2020-12/meta/validation.json | 90 - .../dist/refs/json-schema-2020-12/schema.json | 55 - .../ajv/dist/refs/json-schema-draft-06.json | 137 - .../ajv/dist/refs/json-schema-draft-07.json | 151 - .../ajv/dist/refs/json-schema-secure.json | 88 - node_modules/ajv/dist/refs/jtd-schema.d.ts | 3 - node_modules/ajv/dist/refs/jtd-schema.js | 118 - node_modules/ajv/dist/refs/jtd-schema.js.map | 1 - node_modules/ajv/dist/runtime/equal.d.ts | 6 - node_modules/ajv/dist/runtime/equal.js | 7 - node_modules/ajv/dist/runtime/equal.js.map | 1 - node_modules/ajv/dist/runtime/parseJson.d.ts | 18 - node_modules/ajv/dist/runtime/parseJson.js | 185 - .../ajv/dist/runtime/parseJson.js.map | 1 - node_modules/ajv/dist/runtime/quote.d.ts | 5 - node_modules/ajv/dist/runtime/quote.js | 30 - node_modules/ajv/dist/runtime/quote.js.map | 1 - node_modules/ajv/dist/runtime/re2.d.ts | 6 - node_modules/ajv/dist/runtime/re2.js | 6 - node_modules/ajv/dist/runtime/re2.js.map | 1 - node_modules/ajv/dist/runtime/timestamp.d.ts | 5 - node_modules/ajv/dist/runtime/timestamp.js | 42 - .../ajv/dist/runtime/timestamp.js.map | 1 - node_modules/ajv/dist/runtime/ucs2length.d.ts | 5 - node_modules/ajv/dist/runtime/ucs2length.js | 24 - .../ajv/dist/runtime/ucs2length.js.map | 1 - node_modules/ajv/dist/runtime/uri.d.ts | 6 - node_modules/ajv/dist/runtime/uri.js | 6 - node_modules/ajv/dist/runtime/uri.js.map | 1 - .../ajv/dist/runtime/validation_error.d.ts | 7 - .../ajv/dist/runtime/validation_error.js | 11 - .../ajv/dist/runtime/validation_error.js.map | 1 - node_modules/ajv/dist/standalone/index.d.ts | 6 - node_modules/ajv/dist/standalone/index.js | 90 - node_modules/ajv/dist/standalone/index.js.map | 1 - .../ajv/dist/standalone/instance.d.ts | 12 - node_modules/ajv/dist/standalone/instance.js | 35 - .../ajv/dist/standalone/instance.js.map | 1 - node_modules/ajv/dist/types/index.d.ts | 183 - node_modules/ajv/dist/types/index.js | 3 - node_modules/ajv/dist/types/index.js.map | 1 - node_modules/ajv/dist/types/json-schema.d.ts | 125 - node_modules/ajv/dist/types/json-schema.js | 3 - .../ajv/dist/types/json-schema.js.map | 1 - node_modules/ajv/dist/types/jtd-schema.d.ts | 174 - node_modules/ajv/dist/types/jtd-schema.js | 3 - node_modules/ajv/dist/types/jtd-schema.js.map | 1 - .../applicator/additionalItems.d.ts | 8 - .../applicator/additionalItems.js | 49 - .../applicator/additionalItems.js.map | 1 - .../applicator/additionalProperties.d.ts | 6 - .../applicator/additionalProperties.js | 106 - .../applicator/additionalProperties.js.map | 1 - .../dist/vocabularies/applicator/allOf.d.ts | 3 - .../ajv/dist/vocabularies/applicator/allOf.js | 23 - .../dist/vocabularies/applicator/allOf.js.map | 1 - .../dist/vocabularies/applicator/anyOf.d.ts | 4 - .../ajv/dist/vocabularies/applicator/anyOf.js | 12 - .../dist/vocabularies/applicator/anyOf.js.map | 1 - .../vocabularies/applicator/contains.d.ts | 7 - .../dist/vocabularies/applicator/contains.js | 95 - .../vocabularies/applicator/contains.js.map | 1 - .../vocabularies/applicator/dependencies.d.ts | 21 - .../vocabularies/applicator/dependencies.js | 85 - .../applicator/dependencies.js.map | 1 - .../applicator/dependentSchemas.d.ts | 3 - .../applicator/dependentSchemas.js | 11 - .../applicator/dependentSchemas.js.map | 1 - .../ajv/dist/vocabularies/applicator/if.d.ts | 6 - .../ajv/dist/vocabularies/applicator/if.js | 66 - .../dist/vocabularies/applicator/if.js.map | 1 - .../dist/vocabularies/applicator/index.d.ts | 13 - .../ajv/dist/vocabularies/applicator/index.js | 44 - .../dist/vocabularies/applicator/index.js.map | 1 - .../dist/vocabularies/applicator/items.d.ts | 5 - .../ajv/dist/vocabularies/applicator/items.js | 52 - .../dist/vocabularies/applicator/items.js.map | 1 - .../vocabularies/applicator/items2020.d.ts | 6 - .../dist/vocabularies/applicator/items2020.js | 30 - .../vocabularies/applicator/items2020.js.map | 1 - .../ajv/dist/vocabularies/applicator/not.d.ts | 4 - .../ajv/dist/vocabularies/applicator/not.js | 26 - .../dist/vocabularies/applicator/not.js.map | 1 - .../dist/vocabularies/applicator/oneOf.d.ts | 6 - .../ajv/dist/vocabularies/applicator/oneOf.js | 60 - .../dist/vocabularies/applicator/oneOf.js.map | 1 - .../applicator/patternProperties.d.ts | 3 - .../applicator/patternProperties.js | 75 - .../applicator/patternProperties.js.map | 1 - .../vocabularies/applicator/prefixItems.d.ts | 3 - .../vocabularies/applicator/prefixItems.js | 12 - .../applicator/prefixItems.js.map | 1 - .../vocabularies/applicator/properties.d.ts | 3 - .../vocabularies/applicator/properties.js | 54 - .../vocabularies/applicator/properties.js.map | 1 - .../applicator/propertyNames.d.ts | 6 - .../vocabularies/applicator/propertyNames.js | 38 - .../applicator/propertyNames.js.map | 1 - .../vocabularies/applicator/thenElse.d.ts | 3 - .../dist/vocabularies/applicator/thenElse.js | 13 - .../vocabularies/applicator/thenElse.js.map | 1 - node_modules/ajv/dist/vocabularies/code.d.ts | 17 - node_modules/ajv/dist/vocabularies/code.js | 131 - .../ajv/dist/vocabularies/code.js.map | 1 - .../ajv/dist/vocabularies/core/id.d.ts | 3 - node_modules/ajv/dist/vocabularies/core/id.js | 10 - .../ajv/dist/vocabularies/core/id.js.map | 1 - .../ajv/dist/vocabularies/core/index.d.ts | 3 - .../ajv/dist/vocabularies/core/index.js | 16 - .../ajv/dist/vocabularies/core/index.js.map | 1 - .../ajv/dist/vocabularies/core/ref.d.ts | 8 - .../ajv/dist/vocabularies/core/ref.js | 122 - .../ajv/dist/vocabularies/core/ref.js.map | 1 - .../vocabularies/discriminator/index.d.ts | 5 - .../dist/vocabularies/discriminator/index.js | 104 - .../vocabularies/discriminator/index.js.map | 1 - .../vocabularies/discriminator/types.d.ts | 10 - .../dist/vocabularies/discriminator/types.js | 9 - .../vocabularies/discriminator/types.js.map | 1 - .../ajv/dist/vocabularies/draft2020.d.ts | 3 - .../ajv/dist/vocabularies/draft2020.js | 23 - .../ajv/dist/vocabularies/draft2020.js.map | 1 - .../ajv/dist/vocabularies/draft7.d.ts | 3 - node_modules/ajv/dist/vocabularies/draft7.js | 17 - .../ajv/dist/vocabularies/draft7.js.map | 1 - .../vocabularies/dynamic/dynamicAnchor.d.ts | 5 - .../vocabularies/dynamic/dynamicAnchor.js | 30 - .../vocabularies/dynamic/dynamicAnchor.js.map | 1 - .../dist/vocabularies/dynamic/dynamicRef.d.ts | 5 - .../dist/vocabularies/dynamic/dynamicRef.js | 51 - .../vocabularies/dynamic/dynamicRef.js.map | 1 - .../ajv/dist/vocabularies/dynamic/index.d.ts | 3 - .../ajv/dist/vocabularies/dynamic/index.js | 9 - .../dist/vocabularies/dynamic/index.js.map | 1 - .../vocabularies/dynamic/recursiveAnchor.d.ts | 3 - .../vocabularies/dynamic/recursiveAnchor.js | 16 - .../dynamic/recursiveAnchor.js.map | 1 - .../vocabularies/dynamic/recursiveRef.d.ts | 3 - .../dist/vocabularies/dynamic/recursiveRef.js | 10 - .../vocabularies/dynamic/recursiveRef.js.map | 1 - .../ajv/dist/vocabularies/errors.d.ts | 9 - node_modules/ajv/dist/vocabularies/errors.js | 3 - .../ajv/dist/vocabularies/errors.js.map | 1 - .../ajv/dist/vocabularies/format/format.d.ts | 8 - .../ajv/dist/vocabularies/format/format.js | 92 - .../dist/vocabularies/format/format.js.map | 1 - .../ajv/dist/vocabularies/format/index.d.ts | 3 - .../ajv/dist/vocabularies/format/index.js | 6 - .../ajv/dist/vocabularies/format/index.js.map | 1 - .../dist/vocabularies/jtd/discriminator.d.ts | 6 - .../dist/vocabularies/jtd/discriminator.js | 71 - .../vocabularies/jtd/discriminator.js.map | 1 - .../ajv/dist/vocabularies/jtd/elements.d.ts | 5 - .../ajv/dist/vocabularies/jtd/elements.js | 24 - .../ajv/dist/vocabularies/jtd/elements.js.map | 1 - .../ajv/dist/vocabularies/jtd/enum.d.ts | 6 - .../ajv/dist/vocabularies/jtd/enum.js | 43 - .../ajv/dist/vocabularies/jtd/enum.js.map | 1 - .../ajv/dist/vocabularies/jtd/error.d.ts | 9 - .../ajv/dist/vocabularies/jtd/error.js | 20 - .../ajv/dist/vocabularies/jtd/error.js.map | 1 - .../ajv/dist/vocabularies/jtd/index.d.ts | 10 - .../ajv/dist/vocabularies/jtd/index.js | 29 - .../ajv/dist/vocabularies/jtd/index.js.map | 1 - .../ajv/dist/vocabularies/jtd/metadata.d.ts | 5 - .../ajv/dist/vocabularies/jtd/metadata.js | 25 - .../ajv/dist/vocabularies/jtd/metadata.js.map | 1 - .../ajv/dist/vocabularies/jtd/nullable.d.ts | 4 - .../ajv/dist/vocabularies/jtd/nullable.js | 22 - .../ajv/dist/vocabularies/jtd/nullable.js.map | 1 - .../vocabularies/jtd/optionalProperties.d.ts | 3 - .../vocabularies/jtd/optionalProperties.js | 15 - .../jtd/optionalProperties.js.map | 1 - .../ajv/dist/vocabularies/jtd/properties.d.ts | 22 - .../ajv/dist/vocabularies/jtd/properties.js | 149 - .../dist/vocabularies/jtd/properties.js.map | 1 - .../ajv/dist/vocabularies/jtd/ref.d.ts | 4 - node_modules/ajv/dist/vocabularies/jtd/ref.js | 67 - .../ajv/dist/vocabularies/jtd/ref.js.map | 1 - .../ajv/dist/vocabularies/jtd/type.d.ts | 10 - .../ajv/dist/vocabularies/jtd/type.js | 69 - .../ajv/dist/vocabularies/jtd/type.js.map | 1 - .../ajv/dist/vocabularies/jtd/union.d.ts | 3 - .../ajv/dist/vocabularies/jtd/union.js | 12 - .../ajv/dist/vocabularies/jtd/union.js.map | 1 - .../ajv/dist/vocabularies/jtd/values.d.ts | 5 - .../ajv/dist/vocabularies/jtd/values.js | 51 - .../ajv/dist/vocabularies/jtd/values.js.map | 1 - .../ajv/dist/vocabularies/metadata.d.ts | 3 - .../ajv/dist/vocabularies/metadata.js | 18 - .../ajv/dist/vocabularies/metadata.js.map | 1 - node_modules/ajv/dist/vocabularies/next.d.ts | 3 - node_modules/ajv/dist/vocabularies/next.js | 8 - .../ajv/dist/vocabularies/next.js.map | 1 - .../dist/vocabularies/unevaluated/index.d.ts | 3 - .../dist/vocabularies/unevaluated/index.js | 7 - .../vocabularies/unevaluated/index.js.map | 1 - .../unevaluated/unevaluatedItems.d.ts | 6 - .../unevaluated/unevaluatedItems.js | 40 - .../unevaluated/unevaluatedItems.js.map | 1 - .../unevaluated/unevaluatedProperties.d.ts | 6 - .../unevaluated/unevaluatedProperties.js | 65 - .../unevaluated/unevaluatedProperties.js.map | 1 - .../dist/vocabularies/validation/const.d.ts | 6 - .../ajv/dist/vocabularies/validation/const.js | 25 - .../dist/vocabularies/validation/const.js.map | 1 - .../validation/dependentRequired.d.ts | 5 - .../validation/dependentRequired.js | 12 - .../validation/dependentRequired.js.map | 1 - .../dist/vocabularies/validation/enum.d.ts | 8 - .../ajv/dist/vocabularies/validation/enum.js | 48 - .../dist/vocabularies/validation/enum.js.map | 1 - .../dist/vocabularies/validation/index.d.ts | 16 - .../ajv/dist/vocabularies/validation/index.js | 33 - .../dist/vocabularies/validation/index.js.map | 1 - .../validation/limitContains.d.ts | 3 - .../vocabularies/validation/limitContains.js | 15 - .../validation/limitContains.js.map | 1 - .../vocabularies/validation/limitItems.d.ts | 3 - .../vocabularies/validation/limitItems.js | 24 - .../vocabularies/validation/limitItems.js.map | 1 - .../vocabularies/validation/limitLength.d.ts | 3 - .../vocabularies/validation/limitLength.js | 27 - .../validation/limitLength.js.map | 1 - .../vocabularies/validation/limitNumber.d.ts | 11 - .../vocabularies/validation/limitNumber.js | 27 - .../validation/limitNumber.js.map | 1 - .../validation/limitProperties.d.ts | 3 - .../validation/limitProperties.js | 24 - .../validation/limitProperties.js.map | 1 - .../vocabularies/validation/multipleOf.d.ts | 8 - .../vocabularies/validation/multipleOf.js | 26 - .../vocabularies/validation/multipleOf.js.map | 1 - .../dist/vocabularies/validation/pattern.d.ts | 8 - .../dist/vocabularies/validation/pattern.js | 24 - .../vocabularies/validation/pattern.js.map | 1 - .../vocabularies/validation/required.d.ts | 8 - .../dist/vocabularies/validation/required.js | 79 - .../vocabularies/validation/required.js.map | 1 - .../vocabularies/validation/uniqueItems.d.ts | 9 - .../vocabularies/validation/uniqueItems.js | 64 - .../validation/uniqueItems.js.map | 1 - node_modules/ajv/lib/2019.ts | 81 - node_modules/ajv/lib/2020.ts | 75 - node_modules/ajv/lib/ajv.ts | 70 - node_modules/ajv/lib/compile/codegen/code.ts | 169 - node_modules/ajv/lib/compile/codegen/index.ts | 852 -- node_modules/ajv/lib/compile/codegen/scope.ts | 215 - node_modules/ajv/lib/compile/errors.ts | 184 - node_modules/ajv/lib/compile/index.ts | 324 - node_modules/ajv/lib/compile/jtd/parse.ts | 411 - node_modules/ajv/lib/compile/jtd/serialize.ts | 266 - node_modules/ajv/lib/compile/jtd/types.ts | 16 - node_modules/ajv/lib/compile/names.ts | 27 - node_modules/ajv/lib/compile/ref_error.ts | 13 - node_modules/ajv/lib/compile/resolve.ts | 149 - node_modules/ajv/lib/compile/rules.ts | 50 - node_modules/ajv/lib/compile/util.ts | 213 - .../ajv/lib/compile/validate/applicability.ts | 22 - .../ajv/lib/compile/validate/boolSchema.ts | 47 - .../ajv/lib/compile/validate/dataType.ts | 230 - .../ajv/lib/compile/validate/defaults.ts | 32 - .../ajv/lib/compile/validate/index.ts | 582 -- .../ajv/lib/compile/validate/keyword.ts | 171 - .../ajv/lib/compile/validate/subschema.ts | 135 - node_modules/ajv/lib/core.ts | 891 -- node_modules/ajv/lib/jtd.ts | 132 - node_modules/ajv/lib/refs/data.json | 26 +- .../ajv/lib/refs/json-schema-2019-09/index.ts | 28 - .../json-schema-2019-09/meta/applicator.json | 53 - .../json-schema-2019-09/meta/content.json | 17 - .../refs/json-schema-2019-09/meta/core.json | 57 - .../refs/json-schema-2019-09/meta/format.json | 14 - .../json-schema-2019-09/meta/meta-data.json | 37 - .../json-schema-2019-09/meta/validation.json | 90 - .../lib/refs/json-schema-2019-09/schema.json | 39 - .../ajv/lib/refs/json-schema-2020-12/index.ts | 30 - .../json-schema-2020-12/meta/applicator.json | 48 - .../json-schema-2020-12/meta/content.json | 17 - .../refs/json-schema-2020-12/meta/core.json | 51 - .../meta/format-annotation.json | 14 - .../json-schema-2020-12/meta/meta-data.json | 37 - .../json-schema-2020-12/meta/unevaluated.json | 15 - .../json-schema-2020-12/meta/validation.json | 90 - .../lib/refs/json-schema-2020-12/schema.json | 55 - .../ajv/lib/refs/json-schema-draft-06.json | 281 +- .../ajv/lib/refs/json-schema-draft-07.json | 309 +- .../ajv/lib/refs/json-schema-secure.json | 12 +- node_modules/ajv/lib/refs/jtd-schema.ts | 130 - node_modules/ajv/lib/runtime/equal.ts | 7 - node_modules/ajv/lib/runtime/parseJson.ts | 177 - node_modules/ajv/lib/runtime/quote.ts | 31 - node_modules/ajv/lib/runtime/re2.ts | 6 - node_modules/ajv/lib/runtime/timestamp.ts | 46 - node_modules/ajv/lib/runtime/ucs2length.ts | 20 - node_modules/ajv/lib/runtime/uri.ts | 6 - .../ajv/lib/runtime/validation_error.ts | 13 - node_modules/ajv/lib/standalone/index.ts | 100 - node_modules/ajv/lib/standalone/instance.ts | 36 - node_modules/ajv/lib/types/index.ts | 244 - node_modules/ajv/lib/types/json-schema.ts | 187 - node_modules/ajv/lib/types/jtd-schema.ts | 273 - .../applicator/additionalItems.ts | 56 - .../applicator/additionalProperties.ts | 118 - .../ajv/lib/vocabularies/applicator/allOf.ts | 22 - .../ajv/lib/vocabularies/applicator/anyOf.ts | 14 - .../lib/vocabularies/applicator/contains.ts | 109 - .../vocabularies/applicator/dependencies.ts | 112 - .../applicator/dependentSchemas.ts | 11 - .../ajv/lib/vocabularies/applicator/if.ts | 80 - .../ajv/lib/vocabularies/applicator/index.ts | 53 - .../ajv/lib/vocabularies/applicator/items.ts | 59 - .../lib/vocabularies/applicator/items2020.ts | 36 - .../ajv/lib/vocabularies/applicator/not.ts | 38 - .../ajv/lib/vocabularies/applicator/oneOf.ts | 82 - .../applicator/patternProperties.ts | 91 - .../vocabularies/applicator/prefixItems.ts | 12 - .../lib/vocabularies/applicator/properties.ts | 57 - .../vocabularies/applicator/propertyNames.ts | 50 - .../lib/vocabularies/applicator/thenElse.ts | 13 - node_modules/ajv/lib/vocabularies/code.ts | 168 - node_modules/ajv/lib/vocabularies/core/id.ts | 10 - .../ajv/lib/vocabularies/core/index.ts | 16 - node_modules/ajv/lib/vocabularies/core/ref.ts | 129 - .../lib/vocabularies/discriminator/index.ts | 113 - .../lib/vocabularies/discriminator/types.ts | 12 - .../ajv/lib/vocabularies/draft2020.ts | 23 - node_modules/ajv/lib/vocabularies/draft7.ts | 17 - .../lib/vocabularies/dynamic/dynamicAnchor.ts | 31 - .../lib/vocabularies/dynamic/dynamicRef.ts | 51 - .../ajv/lib/vocabularies/dynamic/index.ts | 9 - .../vocabularies/dynamic/recursiveAnchor.ts | 14 - .../lib/vocabularies/dynamic/recursiveRef.ts | 10 - node_modules/ajv/lib/vocabularies/errors.ts | 18 - .../ajv/lib/vocabularies/format/format.ts | 120 - .../ajv/lib/vocabularies/format/index.ts | 6 - .../ajv/lib/vocabularies/jtd/discriminator.ts | 89 - .../ajv/lib/vocabularies/jtd/elements.ts | 32 - node_modules/ajv/lib/vocabularies/jtd/enum.ts | 45 - .../ajv/lib/vocabularies/jtd/error.ts | 23 - .../ajv/lib/vocabularies/jtd/index.ts | 37 - .../ajv/lib/vocabularies/jtd/metadata.ts | 24 - .../ajv/lib/vocabularies/jtd/nullable.ts | 21 - .../vocabularies/jtd/optionalProperties.ts | 15 - .../ajv/lib/vocabularies/jtd/properties.ts | 184 - node_modules/ajv/lib/vocabularies/jtd/ref.ts | 76 - node_modules/ajv/lib/vocabularies/jtd/type.ts | 75 - .../ajv/lib/vocabularies/jtd/union.ts | 12 - .../ajv/lib/vocabularies/jtd/values.ts | 58 - node_modules/ajv/lib/vocabularies/metadata.ts | 17 - node_modules/ajv/lib/vocabularies/next.ts | 8 - .../ajv/lib/vocabularies/unevaluated/index.ts | 7 - .../unevaluated/unevaluatedItems.ts | 47 - .../unevaluated/unevaluatedProperties.ts | 85 - .../ajv/lib/vocabularies/validation/const.ts | 28 - .../validation/dependentRequired.ts | 23 - .../ajv/lib/vocabularies/validation/enum.ts | 54 - .../ajv/lib/vocabularies/validation/index.ts | 49 - .../vocabularies/validation/limitContains.ts | 16 - .../lib/vocabularies/validation/limitItems.ts | 26 - .../vocabularies/validation/limitLength.ts | 30 - .../vocabularies/validation/limitNumber.ts | 42 - .../validation/limitProperties.ts | 26 - .../lib/vocabularies/validation/multipleOf.ts | 34 - .../lib/vocabularies/validation/pattern.ts | 28 - .../lib/vocabularies/validation/required.ts | 98 - .../vocabularies/validation/uniqueItems.ts | 79 - node_modules/ajv/package.json | 136 +- node_modules/babel-loader/README.md | 8 +- node_modules/babel-loader/lib/cache.js | 14 +- node_modules/babel-loader/lib/index.js | 27 +- node_modules/babel-loader/lib/injectCaller.js | 26 +- node_modules/babel-loader/package.json | 51 +- node_modules/cannon-es/dist/cannon-es.cjs.js | 1442 ++-- node_modules/cannon-es/dist/cannon-es.d.ts | 11 +- node_modules/cannon-es/dist/cannon-es.js | 1440 ++-- node_modules/cannon-es/package.json | 51 +- node_modules/cannon-es/readme.md | 1 + node_modules/envinfo/dist/cli.js | 2 +- node_modules/envinfo/dist/envinfo.js | 2 +- node_modules/envinfo/package.json | 2 +- node_modules/find-up/index.d.ts | 369 +- node_modules/find-up/index.js | 76 +- node_modules/find-up/license | 2 +- node_modules/find-up/package.json | 23 +- node_modules/find-up/readme.md | 102 +- node_modules/has-flag/index.js | 10 +- node_modules/has-flag/package.json | 86 +- node_modules/has-flag/readme.md | 19 + .../node_modules/find-up/index.d.ts | 137 - .../node_modules/find-up/index.js | 89 - .../import-local/node_modules/find-up/license | 9 - .../node_modules/find-up/package.json | 53 - .../node_modules/find-up/readme.md | 156 - .../node_modules/locate-path/index.d.ts | 83 - .../node_modules/locate-path/index.js | 65 - .../node_modules/locate-path/license | 9 - .../node_modules/locate-path/package.json | 45 - .../node_modules/locate-path/readme.md | 122 - .../node_modules/p-limit/index.d.ts | 38 - .../node_modules/p-limit/index.js | 57 - .../import-local/node_modules/p-limit/license | 9 - .../node_modules/p-limit/package.json | 52 - .../node_modules/p-limit/readme.md | 101 - .../node_modules/p-locate/index.d.ts | 64 - .../node_modules/p-locate/index.js | 52 - .../node_modules/p-locate/license | 9 - .../node_modules/p-locate/package.json | 53 - .../node_modules/p-locate/readme.md | 90 - .../node_modules/path-exists/index.d.ts | 28 - .../node_modules/path-exists/index.js | 23 - .../node_modules/path-exists/license | 9 - .../node_modules/path-exists/package.json | 39 - .../node_modules/path-exists/readme.md | 52 - .../node_modules/pkg-dir/index.d.ts | 44 - .../node_modules/pkg-dir/index.js | 17 - .../import-local/node_modules/pkg-dir/license | 9 - .../node_modules/pkg-dir/package.json | 56 - .../node_modules/pkg-dir/readme.md | 66 - .../json-schema-traverse/.eslintrc.yml | 2 +- .../json-schema-traverse/.github/FUNDING.yml | 2 - .../.github/workflows/build.yml | 28 - .../.github/workflows/publish.yml | 27 - node_modules/json-schema-traverse/README.md | 18 +- node_modules/json-schema-traverse/index.d.ts | 40 - node_modules/json-schema-traverse/index.js | 6 +- .../json-schema-traverse/package.json | 10 +- node_modules/locate-path/index.d.ts | 147 +- node_modules/locate-path/index.js | 92 +- node_modules/locate-path/license | 2 +- node_modules/locate-path/package.json | 17 +- node_modules/locate-path/readme.md | 61 +- node_modules/p-limit/index.d.ts | 26 +- node_modules/p-limit/index.js | 65 +- node_modules/p-limit/license | 2 +- node_modules/p-limit/package.json | 26 +- node_modules/p-limit/readme.md | 12 +- node_modules/p-locate/index.d.ts | 97 +- node_modules/p-locate/index.js | 38 +- node_modules/p-locate/license | 2 +- node_modules/p-locate/package.json | 23 +- node_modules/p-locate/readme.md | 45 +- node_modules/path-exists/index.d.ts | 47 +- node_modules/path-exists/index.js | 20 +- node_modules/path-exists/license | 2 +- node_modules/path-exists/package.json | 14 +- node_modules/path-exists/readme.md | 36 +- node_modules/pkg-dir/index.d.ts | 96 +- node_modules/pkg-dir/index.js | 19 +- node_modules/pkg-dir/license | 2 +- node_modules/pkg-dir/package.json | 21 +- node_modules/pkg-dir/readme.md | 53 +- .../Binary_Property/Alphabetic.js | 20 +- .../Binary_Property/Assigned.js | 24 +- .../Binary_Property/Bidi_Mirrored.js | 2 +- .../Binary_Property/Case_Ignorable.js | 10 +- .../Binary_Property/Cased.js | 6 +- .../Changes_When_Casefolded.js | 6 +- .../Changes_When_Casemapped.js | 8 +- .../Changes_When_Lowercased.js | 4 +- .../Changes_When_NFKC_Casefolded.js | 10 +- .../Changes_When_Titlecased.js | 6 +- .../Changes_When_Uppercased.js | 6 +- .../Binary_Property/Dash.js | 2 +- .../Binary_Property/Diacritic.js | 8 +- .../Binary_Property/Emoji.js | 2 +- .../Binary_Property/Emoji_Presentation.js | 2 +- .../Binary_Property/Extender.js | 4 +- .../Binary_Property/Grapheme_Base.js | 28 +- .../Binary_Property/Grapheme_Extend.js | 12 +- .../Binary_Property/ID_Continue.js | 21 +- .../Binary_Property/ID_Start.js | 16 +- .../Binary_Property/Ideographic.js | 2 +- .../Binary_Property/Lowercase.js | 6 +- .../Binary_Property/Math.js | 4 +- .../Binary_Property/Sentence_Terminal.js | 5 +- .../Binary_Property/Terminal_Punctuation.js | 6 +- .../Binary_Property/Uppercase.js | 5 +- .../Binary_Property/XID_Continue.js | 21 +- .../Binary_Property/XID_Start.js | 16 +- .../General_Category/Cased_Letter.js | 6 +- .../General_Category/Dash_Punctuation.js | 2 +- .../General_Category/Decimal_Number.js | 4 +- .../General_Category/Letter.js | 16 +- .../General_Category/Lowercase_Letter.js | 6 +- .../General_Category/Mark.js | 10 +- .../General_Category/Math_Symbol.js | 2 +- .../General_Category/Modifier_Letter.js | 4 +- .../General_Category/Nonspacing_Mark.js | 10 +- .../General_Category/Number.js | 4 +- .../General_Category/Other.js | 20 +- .../General_Category/Other_Letter.js | 11 +- .../General_Category/Other_Punctuation.js | 8 +- .../General_Category/Other_Symbol.js | 6 +- .../General_Category/Punctuation.js | 8 +- .../General_Category/Spacing_Mark.js | 6 +- .../General_Category/Symbol.js | 8 +- .../General_Category/Unassigned.js | 20 +- .../General_Category/Uppercase_Letter.js | 4 +- .../Property_of_Strings/Basic_Emoji.js | 2 +- .../Property_of_Strings/RGI_Emoji.js | 4 +- .../RGI_Emoji_Flag_Sequence.js | 2 +- .../Script/Arabic.js | 2 +- .../Script/Balinese.js | 2 +- .../Script/Common.js | 6 +- .../Script/Cyrillic.js | 2 +- .../Script/Egyptian_Hieroglyphs.js | 2 +- .../Script/Kawi.js | 2 +- .../Script/Khitan_Small_Script.js | 2 +- .../Script/Latin.js | 2 +- .../Script/Myanmar.js | 2 +- .../Script_Extensions/Adlam.js | 2 +- .../Script_Extensions/Arabic.js | 4 +- .../Script_Extensions/Armenian.js | 2 +- .../Script_Extensions/Avestan.js | 4 +- .../Script_Extensions/Balinese.js | 2 +- .../Script_Extensions/Bengali.js | 2 +- .../Script_Extensions/Bopomofo.js | 4 +- .../Script_Extensions/Carian.js | 2 +- .../Script_Extensions/Caucasian_Albanian.js | 2 +- .../Script_Extensions/Cherokee.js | 4 +- .../Script_Extensions/Common.js | 8 +- .../Script_Extensions/Coptic.js | 4 +- .../Script_Extensions/Cyrillic.js | 4 +- .../Script_Extensions/Devanagari.js | 2 +- .../Script_Extensions/Duployan.js | 4 +- .../Script_Extensions/Egyptian_Hieroglyphs.js | 2 +- .../Script_Extensions/Elbasan.js | 2 +- .../Script_Extensions/Ethiopic.js | 2 +- .../Script_Extensions/Georgian.js | 2 +- .../Script_Extensions/Glagolitic.js | 2 +- .../Script_Extensions/Gothic.js | 4 +- .../Script_Extensions/Greek.js | 4 +- .../Script_Extensions/Gunjala_Gondi.js | 2 +- .../Script_Extensions/Han.js | 4 +- .../Script_Extensions/Hebrew.js | 2 +- .../Script_Extensions/Inherited.js | 4 +- .../Script_Extensions/Kaithi.js | 2 +- .../Script_Extensions/Kannada.js | 4 +- .../Script_Extensions/Katakana.js | 2 +- .../Script_Extensions/Kawi.js | 2 +- .../Script_Extensions/Khitan_Small_Script.js | 2 +- .../Script_Extensions/Latin.js | 4 +- .../Script_Extensions/Lisu.js | 4 +- .../Script_Extensions/Lycian.js | 2 +- .../Script_Extensions/Lydian.js | 2 +- .../Script_Extensions/Mahajani.js | 2 +- .../Script_Extensions/Meroitic_Hieroglyphs.js | 2 +- .../Script_Extensions/Mongolian.js | 2 +- .../Script_Extensions/Myanmar.js | 2 +- .../Script_Extensions/Old_Hungarian.js | 2 +- .../Script_Extensions/Old_Permic.js | 4 +- .../Script_Extensions/Old_Turkic.js | 2 +- .../Script_Extensions/Osage.js | 2 +- .../Script_Extensions/Phags_Pa.js | 2 +- .../Script_Extensions/Runic.js | 2 +- .../Script_Extensions/Samaritan.js | 2 +- .../Script_Extensions/Shavian.js | 2 +- .../Script_Extensions/Syriac.js | 4 +- .../Script_Extensions/Tai_Le.js | 4 +- .../Script_Extensions/Tangut.js | 4 +- .../Script_Extensions/Thai.js | 2 +- .../Script_Extensions/Tibetan.js | 2 +- .../Script_Extensions/Tifinagh.js | 2 +- .../Script_Extensions/Toto.js | 2 +- .../regenerate-unicode-properties/index.js | 14 + .../package.json | 10 +- .../unicode-version.js | 2 +- node_modules/schema-utils/README.md | 39 +- .../declarations/keywords/absolutePath.d.ts | 5 +- .../keywords/undefinedAsNull.d.ts | 9 +- .../declarations/util/memorize.d.ts | 7 - .../schema-utils/declarations/validate.d.ts | 9 +- .../schema-utils/dist/ValidationError.js | 544 +- node_modules/schema-utils/dist/index.js | 1 + .../dist/keywords/absolutePath.js | 39 +- .../dist/keywords/undefinedAsNull.js | 86 +- node_modules/schema-utils/dist/util/Range.js | 52 +- node_modules/schema-utils/dist/util/hints.js | 28 +- .../schema-utils/dist/util/memorize.js | 30 - node_modules/schema-utils/dist/validate.js | 155 +- node_modules/schema-utils/package.json | 43 +- node_modules/supports-color/browser.js | 23 +- node_modules/supports-color/index.js | 91 +- node_modules/supports-color/license | 2 +- node_modules/supports-color/package.json | 19 +- node_modules/supports-color/readme.md | 29 +- .../node_modules/ajv-keywords/LICENSE | 21 - .../node_modules/ajv-keywords/README.md | 836 -- .../ajv-keywords/ajv-keywords.d.ts | 7 - .../node_modules/ajv-keywords/index.js | 35 - .../ajv-keywords/keywords/_formatLimit.js | 101 - .../ajv-keywords/keywords/_util.js | 15 - .../ajv-keywords/keywords/allRequired.js | 18 - .../ajv-keywords/keywords/anyRequired.js | 24 - .../ajv-keywords/keywords/deepProperties.js | 54 - .../ajv-keywords/keywords/deepRequired.js | 57 - .../keywords/dot/_formatLimit.jst | 116 - .../keywords/dot/patternRequired.jst | 33 - .../ajv-keywords/keywords/dot/switch.jst | 71 - .../ajv-keywords/keywords/dotjs/README.md | 3 - .../keywords/dotjs/_formatLimit.js | 178 - .../keywords/dotjs/patternRequired.js | 58 - .../ajv-keywords/keywords/dotjs/switch.js | 129 - .../ajv-keywords/keywords/dynamicDefaults.js | 72 - .../ajv-keywords/keywords/formatMaximum.js | 3 - .../ajv-keywords/keywords/formatMinimum.js | 3 - .../ajv-keywords/keywords/index.js | 22 - .../ajv-keywords/keywords/instanceof.js | 58 - .../ajv-keywords/keywords/oneRequired.js | 24 - .../ajv-keywords/keywords/patternRequired.js | 21 - .../ajv-keywords/keywords/prohibited.js | 24 - .../ajv-keywords/keywords/range.js | 36 - .../ajv-keywords/keywords/regexp.js | 36 - .../ajv-keywords/keywords/select.js | 79 - .../ajv-keywords/keywords/switch.js | 38 - .../ajv-keywords/keywords/transform.js | 80 - .../ajv-keywords/keywords/typeof.js | 32 - .../keywords/uniqueItemProperties.js | 59 - .../node_modules/ajv-keywords/package.json | 53 - .../node_modules/ajv/.tonic_example.js | 20 - .../node_modules/ajv/LICENSE | 22 - .../node_modules/ajv/README.md | 1497 ---- .../node_modules/ajv/dist/ajv.bundle.js | 7189 ----------------- .../node_modules/ajv/dist/ajv.min.js | 3 - .../node_modules/ajv/dist/ajv.min.js.map | 1 - .../node_modules/ajv/lib/ajv.d.ts | 397 - .../node_modules/ajv/lib/ajv.js | 506 -- .../node_modules/ajv/lib/cache.js | 26 - .../node_modules/ajv/lib/compile/async.js | 90 - .../node_modules/ajv/lib/compile/equal.js | 5 - .../ajv/lib/compile/error_classes.js | 34 - .../node_modules/ajv/lib/compile/formats.js | 142 - .../node_modules/ajv/lib/compile/index.js | 387 - .../node_modules/ajv/lib/compile/resolve.js | 270 - .../node_modules/ajv/lib/compile/rules.js | 66 - .../ajv/lib/compile/schema_obj.js | 9 - .../ajv/lib/compile/ucs2length.js | 20 - .../node_modules/ajv/lib/compile/util.js | 239 - .../node_modules/ajv/lib/data.js | 49 - .../node_modules/ajv/lib/definition_schema.js | 37 - .../node_modules/ajv/lib/dot/_limit.jst | 113 - .../node_modules/ajv/lib/dot/_limitItems.jst | 12 - .../node_modules/ajv/lib/dot/_limitLength.jst | 12 - .../ajv/lib/dot/_limitProperties.jst | 12 - .../node_modules/ajv/lib/dot/allOf.jst | 32 - .../node_modules/ajv/lib/dot/anyOf.jst | 46 - .../node_modules/ajv/lib/dot/coerce.def | 51 - .../node_modules/ajv/lib/dot/comment.jst | 9 - .../node_modules/ajv/lib/dot/const.jst | 11 - .../node_modules/ajv/lib/dot/contains.jst | 55 - .../node_modules/ajv/lib/dot/custom.jst | 191 - .../node_modules/ajv/lib/dot/defaults.def | 47 - .../node_modules/ajv/lib/dot/definitions.def | 203 - .../node_modules/ajv/lib/dot/dependencies.jst | 79 - .../node_modules/ajv/lib/dot/enum.jst | 30 - .../node_modules/ajv/lib/dot/errors.def | 194 - .../node_modules/ajv/lib/dot/format.jst | 106 - .../node_modules/ajv/lib/dot/if.jst | 73 - .../node_modules/ajv/lib/dot/items.jst | 98 - .../node_modules/ajv/lib/dot/missing.def | 39 - .../node_modules/ajv/lib/dot/multipleOf.jst | 22 - .../node_modules/ajv/lib/dot/not.jst | 43 - .../node_modules/ajv/lib/dot/oneOf.jst | 54 - .../node_modules/ajv/lib/dot/pattern.jst | 14 - .../node_modules/ajv/lib/dot/properties.jst | 245 - .../ajv/lib/dot/propertyNames.jst | 52 - .../node_modules/ajv/lib/dot/ref.jst | 85 - .../node_modules/ajv/lib/dot/required.jst | 108 - .../node_modules/ajv/lib/dot/uniqueItems.jst | 62 - .../node_modules/ajv/lib/dot/validate.jst | 276 - .../node_modules/ajv/lib/dotjs/README.md | 3 - .../node_modules/ajv/lib/dotjs/_limit.js | 163 - .../node_modules/ajv/lib/dotjs/_limitItems.js | 80 - .../ajv/lib/dotjs/_limitLength.js | 85 - .../ajv/lib/dotjs/_limitProperties.js | 80 - .../node_modules/ajv/lib/dotjs/allOf.js | 42 - .../node_modules/ajv/lib/dotjs/anyOf.js | 73 - .../node_modules/ajv/lib/dotjs/comment.js | 14 - .../node_modules/ajv/lib/dotjs/const.js | 56 - .../node_modules/ajv/lib/dotjs/contains.js | 81 - .../node_modules/ajv/lib/dotjs/custom.js | 228 - .../ajv/lib/dotjs/dependencies.js | 168 - .../node_modules/ajv/lib/dotjs/enum.js | 66 - .../node_modules/ajv/lib/dotjs/format.js | 150 - .../node_modules/ajv/lib/dotjs/if.js | 103 - .../node_modules/ajv/lib/dotjs/index.js | 33 - .../node_modules/ajv/lib/dotjs/items.js | 140 - .../node_modules/ajv/lib/dotjs/multipleOf.js | 80 - .../node_modules/ajv/lib/dotjs/not.js | 84 - .../node_modules/ajv/lib/dotjs/oneOf.js | 73 - .../node_modules/ajv/lib/dotjs/pattern.js | 75 - .../node_modules/ajv/lib/dotjs/properties.js | 335 - .../ajv/lib/dotjs/propertyNames.js | 81 - .../node_modules/ajv/lib/dotjs/ref.js | 124 - .../node_modules/ajv/lib/dotjs/required.js | 270 - .../node_modules/ajv/lib/dotjs/uniqueItems.js | 86 - .../node_modules/ajv/lib/dotjs/validate.js | 482 -- .../node_modules/ajv/lib/keyword.js | 146 - .../node_modules/ajv/lib/refs/data.json | 17 - .../ajv/lib/refs/json-schema-draft-04.json | 149 - .../ajv/lib/refs/json-schema-draft-06.json | 154 - .../ajv/lib/refs/json-schema-draft-07.json | 168 - .../ajv/lib/refs/json-schema-secure.json | 94 - .../node_modules/ajv/package.json | 106 - .../node_modules/ajv/scripts/.eslintrc.yml | 3 - .../node_modules/ajv/scripts/bundle.js | 61 - .../node_modules/ajv/scripts/compile-dots.js | 73 - .../node_modules/ajv/scripts/info | 10 - .../node_modules/ajv/scripts/prepare-tests | 12 - .../ajv/scripts/publish-built-version | 32 - .../node_modules/ajv/scripts/travis-gh-pages | 23 - .../json-schema-traverse/.eslintrc.yml | 27 - .../json-schema-traverse/.travis.yml | 8 - .../node_modules/json-schema-traverse/LICENSE | 21 - .../json-schema-traverse/README.md | 83 - .../json-schema-traverse/index.js | 89 - .../json-schema-traverse/package.json | 43 - .../json-schema-traverse/spec/.eslintrc.yml | 6 - .../spec/fixtures/schema.js | 125 - .../json-schema-traverse/spec/index.spec.js | 171 - .../node_modules/schema-utils/CHANGELOG.md | 340 - .../node_modules/schema-utils/LICENSE | 20 - .../node_modules/schema-utils/README.md | 290 - .../declarations/ValidationError.d.ts | 74 - .../schema-utils/declarations/index.d.ts | 12 - .../declarations/keywords/absolutePath.d.ts | 10 - .../keywords/undefinedAsNull.d.ts | 8 - .../schema-utils/declarations/util/Range.d.ts | 79 - .../schema-utils/declarations/util/hints.d.ts | 3 - .../schema-utils/declarations/validate.d.ts | 42 - .../schema-utils/dist/ValidationError.js | 1277 --- .../node_modules/schema-utils/dist/index.js | 17 - .../dist/keywords/absolutePath.js | 93 - .../dist/keywords/undefinedAsNull.js | 95 - .../schema-utils/dist/util/Range.js | 163 - .../schema-utils/dist/util/hints.js | 105 - .../schema-utils/dist/validate.js | 258 - .../node_modules/schema-utils/package.json | 78 - .../README.md | 2 +- .../package.json | 2 +- .../README.md | 2 +- .../data/mappings.js | 28 + .../package.json | 4 +- node_modules/webpack-cli/README.md | 64 +- node_modules/webpack-cli/lib/index.d.ts | 2 +- node_modules/webpack-cli/lib/index.js | 17 - node_modules/webpack-cli/lib/types.d.ts | 93 +- node_modules/webpack-cli/lib/webpack-cli.js | 873 +- .../node_modules/commander/Readme.md | 515 +- .../node_modules/commander/esm.mjs | 14 +- .../node_modules/commander/index.js | 2210 +---- .../node_modules/commander/package.json | 54 +- .../node_modules/commander/typings/index.d.ts | 1496 ++-- node_modules/webpack-cli/package.json | 27 +- .../webpack/node_modules/ajv-keywords/LICENSE | 21 - .../node_modules/ajv-keywords/README.md | 836 -- .../ajv-keywords/ajv-keywords.d.ts | 7 - .../node_modules/ajv-keywords/index.js | 35 - .../ajv-keywords/keywords/_formatLimit.js | 101 - .../ajv-keywords/keywords/_util.js | 15 - .../ajv-keywords/keywords/allRequired.js | 18 - .../ajv-keywords/keywords/anyRequired.js | 24 - .../ajv-keywords/keywords/deepProperties.js | 54 - .../ajv-keywords/keywords/deepRequired.js | 57 - .../keywords/dot/_formatLimit.jst | 116 - .../keywords/dot/patternRequired.jst | 33 - .../ajv-keywords/keywords/dot/switch.jst | 71 - .../ajv-keywords/keywords/dotjs/README.md | 3 - .../keywords/dotjs/_formatLimit.js | 178 - .../keywords/dotjs/patternRequired.js | 58 - .../ajv-keywords/keywords/dotjs/switch.js | 129 - .../ajv-keywords/keywords/dynamicDefaults.js | 72 - .../ajv-keywords/keywords/formatMaximum.js | 3 - .../ajv-keywords/keywords/formatMinimum.js | 3 - .../ajv-keywords/keywords/index.js | 22 - .../ajv-keywords/keywords/instanceof.js | 58 - .../ajv-keywords/keywords/oneRequired.js | 24 - .../ajv-keywords/keywords/patternRequired.js | 21 - .../ajv-keywords/keywords/prohibited.js | 24 - .../ajv-keywords/keywords/range.js | 36 - .../ajv-keywords/keywords/regexp.js | 36 - .../ajv-keywords/keywords/select.js | 79 - .../ajv-keywords/keywords/switch.js | 38 - .../ajv-keywords/keywords/transform.js | 80 - .../ajv-keywords/keywords/typeof.js | 32 - .../keywords/uniqueItemProperties.js | 59 - .../node_modules/ajv-keywords/package.json | 53 - .../node_modules/ajv/.tonic_example.js | 20 - node_modules/webpack/node_modules/ajv/LICENSE | 22 - .../webpack/node_modules/ajv/README.md | 1497 ---- .../node_modules/ajv/dist/ajv.bundle.js | 7189 ----------------- .../webpack/node_modules/ajv/dist/ajv.min.js | 3 - .../node_modules/ajv/dist/ajv.min.js.map | 1 - .../webpack/node_modules/ajv/lib/ajv.d.ts | 397 - .../webpack/node_modules/ajv/lib/ajv.js | 506 -- .../webpack/node_modules/ajv/lib/cache.js | 26 - .../node_modules/ajv/lib/compile/async.js | 90 - .../node_modules/ajv/lib/compile/equal.js | 5 - .../ajv/lib/compile/error_classes.js | 34 - .../node_modules/ajv/lib/compile/formats.js | 142 - .../node_modules/ajv/lib/compile/index.js | 387 - .../node_modules/ajv/lib/compile/resolve.js | 270 - .../node_modules/ajv/lib/compile/rules.js | 66 - .../ajv/lib/compile/schema_obj.js | 9 - .../ajv/lib/compile/ucs2length.js | 20 - .../node_modules/ajv/lib/compile/util.js | 239 - .../webpack/node_modules/ajv/lib/data.js | 49 - .../node_modules/ajv/lib/definition_schema.js | 37 - .../node_modules/ajv/lib/dot/_limit.jst | 113 - .../node_modules/ajv/lib/dot/_limitItems.jst | 12 - .../node_modules/ajv/lib/dot/_limitLength.jst | 12 - .../ajv/lib/dot/_limitProperties.jst | 12 - .../node_modules/ajv/lib/dot/allOf.jst | 32 - .../node_modules/ajv/lib/dot/anyOf.jst | 46 - .../node_modules/ajv/lib/dot/coerce.def | 51 - .../node_modules/ajv/lib/dot/comment.jst | 9 - .../node_modules/ajv/lib/dot/const.jst | 11 - .../node_modules/ajv/lib/dot/contains.jst | 55 - .../node_modules/ajv/lib/dot/custom.jst | 191 - .../node_modules/ajv/lib/dot/defaults.def | 47 - .../node_modules/ajv/lib/dot/definitions.def | 203 - .../node_modules/ajv/lib/dot/dependencies.jst | 79 - .../webpack/node_modules/ajv/lib/dot/enum.jst | 30 - .../node_modules/ajv/lib/dot/errors.def | 194 - .../node_modules/ajv/lib/dot/format.jst | 106 - .../webpack/node_modules/ajv/lib/dot/if.jst | 73 - .../node_modules/ajv/lib/dot/items.jst | 98 - .../node_modules/ajv/lib/dot/missing.def | 39 - .../node_modules/ajv/lib/dot/multipleOf.jst | 22 - .../webpack/node_modules/ajv/lib/dot/not.jst | 43 - .../node_modules/ajv/lib/dot/oneOf.jst | 54 - .../node_modules/ajv/lib/dot/pattern.jst | 14 - .../node_modules/ajv/lib/dot/properties.jst | 245 - .../ajv/lib/dot/propertyNames.jst | 52 - .../webpack/node_modules/ajv/lib/dot/ref.jst | 85 - .../node_modules/ajv/lib/dot/required.jst | 108 - .../node_modules/ajv/lib/dot/uniqueItems.jst | 62 - .../node_modules/ajv/lib/dot/validate.jst | 276 - .../node_modules/ajv/lib/dotjs/README.md | 3 - .../node_modules/ajv/lib/dotjs/_limit.js | 163 - .../node_modules/ajv/lib/dotjs/_limitItems.js | 80 - .../ajv/lib/dotjs/_limitLength.js | 85 - .../ajv/lib/dotjs/_limitProperties.js | 80 - .../node_modules/ajv/lib/dotjs/allOf.js | 42 - .../node_modules/ajv/lib/dotjs/anyOf.js | 73 - .../node_modules/ajv/lib/dotjs/comment.js | 14 - .../node_modules/ajv/lib/dotjs/const.js | 56 - .../node_modules/ajv/lib/dotjs/contains.js | 81 - .../node_modules/ajv/lib/dotjs/custom.js | 228 - .../ajv/lib/dotjs/dependencies.js | 168 - .../node_modules/ajv/lib/dotjs/enum.js | 66 - .../node_modules/ajv/lib/dotjs/format.js | 150 - .../webpack/node_modules/ajv/lib/dotjs/if.js | 103 - .../node_modules/ajv/lib/dotjs/index.js | 33 - .../node_modules/ajv/lib/dotjs/items.js | 140 - .../node_modules/ajv/lib/dotjs/multipleOf.js | 80 - .../webpack/node_modules/ajv/lib/dotjs/not.js | 84 - .../node_modules/ajv/lib/dotjs/oneOf.js | 73 - .../node_modules/ajv/lib/dotjs/pattern.js | 75 - .../node_modules/ajv/lib/dotjs/properties.js | 335 - .../ajv/lib/dotjs/propertyNames.js | 81 - .../webpack/node_modules/ajv/lib/dotjs/ref.js | 124 - .../node_modules/ajv/lib/dotjs/required.js | 270 - .../node_modules/ajv/lib/dotjs/uniqueItems.js | 86 - .../node_modules/ajv/lib/dotjs/validate.js | 482 -- .../webpack/node_modules/ajv/lib/keyword.js | 146 - .../node_modules/ajv/lib/refs/data.json | 17 - .../ajv/lib/refs/json-schema-draft-04.json | 149 - .../ajv/lib/refs/json-schema-draft-06.json | 154 - .../ajv/lib/refs/json-schema-draft-07.json | 168 - .../ajv/lib/refs/json-schema-secure.json | 94 - .../webpack/node_modules/ajv/package.json | 106 - .../node_modules/ajv/scripts/.eslintrc.yml | 3 - .../node_modules/ajv/scripts/bundle.js | 61 - .../node_modules/ajv/scripts/compile-dots.js | 73 - .../webpack/node_modules/ajv/scripts/info | 10 - .../node_modules/ajv/scripts/prepare-tests | 12 - .../ajv/scripts/publish-built-version | 32 - .../node_modules/ajv/scripts/travis-gh-pages | 23 - .../json-schema-traverse/.eslintrc.yml | 27 - .../json-schema-traverse/.travis.yml | 8 - .../node_modules/json-schema-traverse/LICENSE | 21 - .../json-schema-traverse/README.md | 83 - .../json-schema-traverse/index.js | 89 - .../json-schema-traverse/package.json | 43 - .../json-schema-traverse/spec/.eslintrc.yml | 6 - .../spec/fixtures/schema.js | 125 - .../json-schema-traverse/spec/index.spec.js | 171 - .../node_modules/schema-utils/CHANGELOG.md | 340 - .../webpack/node_modules/schema-utils/LICENSE | 20 - .../node_modules/schema-utils/README.md | 290 - .../declarations/ValidationError.d.ts | 74 - .../schema-utils/declarations/index.d.ts | 12 - .../declarations/keywords/absolutePath.d.ts | 10 - .../keywords/undefinedAsNull.d.ts | 8 - .../schema-utils/declarations/util/Range.d.ts | 79 - .../schema-utils/declarations/util/hints.d.ts | 3 - .../schema-utils/declarations/validate.d.ts | 42 - .../schema-utils/dist/ValidationError.js | 1277 --- .../node_modules/schema-utils/dist/index.js | 17 - .../dist/keywords/absolutePath.js | 93 - .../dist/keywords/undefinedAsNull.js | 95 - .../schema-utils/dist/util/Range.js | 163 - .../schema-utils/dist/util/hints.js | 105 - .../schema-utils/dist/validate.js | 258 - .../node_modules/schema-utils/package.json | 78 - package-lock.json | 6656 +++++++++++++++ package.json | 26 + webpack.config.js | 10 +- 1191 files changed, 15027 insertions(+), 81737 deletions(-) create mode 100644 dist/996e0c1b19b93e0bdcfb.js create mode 100644 dist/a708c87fa8616c003655.js create mode 100644 dist/a708c87fa8616c003655.js.LICENSE.txt create mode 100644 dist/bundle.js.LICENSE.txt delete mode 100644 node_modules/ajv-keywords/dist/definitions/_range.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/_range.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/_range.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/_required.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/_required.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/_required.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/_types.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/_types.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/_types.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/_util.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/_util.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/_util.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/allRequired.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/allRequired.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/allRequired.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/anyRequired.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/anyRequired.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/anyRequired.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/deepProperties.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/deepProperties.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/deepProperties.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/deepRequired.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/deepRequired.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/deepRequired.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/dynamicDefaults.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/dynamicDefaults.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/dynamicDefaults.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/exclusiveRange.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/exclusiveRange.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/exclusiveRange.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/index.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/index.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/index.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/instanceof.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/instanceof.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/instanceof.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/oneRequired.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/oneRequired.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/oneRequired.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/patternRequired.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/patternRequired.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/patternRequired.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/prohibited.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/prohibited.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/prohibited.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/range.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/range.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/range.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/regexp.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/regexp.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/regexp.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/select.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/select.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/select.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/transform.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/transform.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/transform.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/typeof.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/typeof.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/typeof.js.map delete mode 100644 node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.d.ts delete mode 100644 node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.js delete mode 100644 node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.js.map delete mode 100644 node_modules/ajv-keywords/dist/index.d.ts delete mode 100644 node_modules/ajv-keywords/dist/index.js delete mode 100644 node_modules/ajv-keywords/dist/index.js.map delete mode 100644 node_modules/ajv-keywords/dist/keywords/allRequired.d.ts delete mode 100644 node_modules/ajv-keywords/dist/keywords/allRequired.js delete mode 100644 node_modules/ajv-keywords/dist/keywords/allRequired.js.map delete mode 100644 node_modules/ajv-keywords/dist/keywords/anyRequired.d.ts delete mode 100644 node_modules/ajv-keywords/dist/keywords/anyRequired.js delete mode 100644 node_modules/ajv-keywords/dist/keywords/anyRequired.js.map delete mode 100644 node_modules/ajv-keywords/dist/keywords/deepProperties.d.ts delete mode 100644 node_modules/ajv-keywords/dist/keywords/deepProperties.js delete mode 100644 node_modules/ajv-keywords/dist/keywords/deepProperties.js.map delete mode 100644 node_modules/ajv-keywords/dist/keywords/deepRequired.d.ts delete mode 100644 node_modules/ajv-keywords/dist/keywords/deepRequired.js delete mode 100644 node_modules/ajv-keywords/dist/keywords/deepRequired.js.map delete mode 100644 node_modules/ajv-keywords/dist/keywords/dynamicDefaults.d.ts delete mode 100644 node_modules/ajv-keywords/dist/keywords/dynamicDefaults.js delete mode 100644 node_modules/ajv-keywords/dist/keywords/dynamicDefaults.js.map delete mode 100644 node_modules/ajv-keywords/dist/keywords/exclusiveRange.d.ts delete mode 100644 node_modules/ajv-keywords/dist/keywords/exclusiveRange.js delete mode 100644 node_modules/ajv-keywords/dist/keywords/exclusiveRange.js.map delete mode 100644 node_modules/ajv-keywords/dist/keywords/index.d.ts delete mode 100644 node_modules/ajv-keywords/dist/keywords/index.js delete mode 100644 node_modules/ajv-keywords/dist/keywords/index.js.map delete mode 100644 node_modules/ajv-keywords/dist/keywords/instanceof.d.ts delete mode 100644 node_modules/ajv-keywords/dist/keywords/instanceof.js delete mode 100644 node_modules/ajv-keywords/dist/keywords/instanceof.js.map delete mode 100644 node_modules/ajv-keywords/dist/keywords/oneRequired.d.ts delete mode 100644 node_modules/ajv-keywords/dist/keywords/oneRequired.js delete mode 100644 node_modules/ajv-keywords/dist/keywords/oneRequired.js.map delete mode 100644 node_modules/ajv-keywords/dist/keywords/patternRequired.d.ts delete mode 100644 node_modules/ajv-keywords/dist/keywords/patternRequired.js delete mode 100644 node_modules/ajv-keywords/dist/keywords/patternRequired.js.map delete mode 100644 node_modules/ajv-keywords/dist/keywords/prohibited.d.ts delete mode 100644 node_modules/ajv-keywords/dist/keywords/prohibited.js delete mode 100644 node_modules/ajv-keywords/dist/keywords/prohibited.js.map delete mode 100644 node_modules/ajv-keywords/dist/keywords/range.d.ts delete mode 100644 node_modules/ajv-keywords/dist/keywords/range.js delete mode 100644 node_modules/ajv-keywords/dist/keywords/range.js.map delete mode 100644 node_modules/ajv-keywords/dist/keywords/regexp.d.ts delete mode 100644 node_modules/ajv-keywords/dist/keywords/regexp.js delete mode 100644 node_modules/ajv-keywords/dist/keywords/regexp.js.map delete mode 100644 node_modules/ajv-keywords/dist/keywords/select.d.ts delete mode 100644 node_modules/ajv-keywords/dist/keywords/select.js delete mode 100644 node_modules/ajv-keywords/dist/keywords/select.js.map delete mode 100644 node_modules/ajv-keywords/dist/keywords/transform.d.ts delete mode 100644 node_modules/ajv-keywords/dist/keywords/transform.js delete mode 100644 node_modules/ajv-keywords/dist/keywords/transform.js.map delete mode 100644 node_modules/ajv-keywords/dist/keywords/typeof.d.ts delete mode 100644 node_modules/ajv-keywords/dist/keywords/typeof.js delete mode 100644 node_modules/ajv-keywords/dist/keywords/typeof.js.map delete mode 100644 node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.d.ts delete mode 100644 node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.js delete mode 100644 node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.js.map delete mode 100644 node_modules/ajv-keywords/src/definitions/_range.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/_required.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/_types.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/_util.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/allRequired.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/anyRequired.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/deepProperties.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/deepRequired.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/dynamicDefaults.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/exclusiveRange.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/index.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/instanceof.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/oneRequired.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/patternRequired.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/prohibited.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/range.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/regexp.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/select.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/transform.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/typeof.ts delete mode 100644 node_modules/ajv-keywords/src/definitions/uniqueItemProperties.ts delete mode 100644 node_modules/ajv-keywords/src/index.ts delete mode 100644 node_modules/ajv-keywords/src/keywords/allRequired.ts delete mode 100644 node_modules/ajv-keywords/src/keywords/anyRequired.ts delete mode 100644 node_modules/ajv-keywords/src/keywords/deepProperties.ts delete mode 100644 node_modules/ajv-keywords/src/keywords/deepRequired.ts delete mode 100644 node_modules/ajv-keywords/src/keywords/dynamicDefaults.ts delete mode 100644 node_modules/ajv-keywords/src/keywords/exclusiveRange.ts delete mode 100644 node_modules/ajv-keywords/src/keywords/index.ts delete mode 100644 node_modules/ajv-keywords/src/keywords/instanceof.ts delete mode 100644 node_modules/ajv-keywords/src/keywords/oneRequired.ts delete mode 100644 node_modules/ajv-keywords/src/keywords/patternRequired.ts delete mode 100644 node_modules/ajv-keywords/src/keywords/prohibited.ts delete mode 100644 node_modules/ajv-keywords/src/keywords/range.ts delete mode 100644 node_modules/ajv-keywords/src/keywords/regexp.ts delete mode 100644 node_modules/ajv-keywords/src/keywords/select.ts delete mode 100644 node_modules/ajv-keywords/src/keywords/transform.ts delete mode 100644 node_modules/ajv-keywords/src/keywords/typeof.ts delete mode 100644 node_modules/ajv-keywords/src/keywords/uniqueItemProperties.ts delete mode 100644 node_modules/ajv/.runkit_example.js delete mode 100644 node_modules/ajv/dist/2019.d.ts delete mode 100644 node_modules/ajv/dist/2019.js delete mode 100644 node_modules/ajv/dist/2019.js.map delete mode 100644 node_modules/ajv/dist/2020.d.ts delete mode 100644 node_modules/ajv/dist/2020.js delete mode 100644 node_modules/ajv/dist/2020.js.map delete mode 100644 node_modules/ajv/dist/ajv.d.ts delete mode 100644 node_modules/ajv/dist/ajv.js delete mode 100644 node_modules/ajv/dist/ajv.js.map delete mode 100644 node_modules/ajv/dist/compile/codegen/code.d.ts delete mode 100644 node_modules/ajv/dist/compile/codegen/code.js delete mode 100644 node_modules/ajv/dist/compile/codegen/code.js.map delete mode 100644 node_modules/ajv/dist/compile/codegen/index.d.ts delete mode 100644 node_modules/ajv/dist/compile/codegen/index.js delete mode 100644 node_modules/ajv/dist/compile/codegen/index.js.map delete mode 100644 node_modules/ajv/dist/compile/codegen/scope.d.ts delete mode 100644 node_modules/ajv/dist/compile/codegen/scope.js delete mode 100644 node_modules/ajv/dist/compile/codegen/scope.js.map delete mode 100644 node_modules/ajv/dist/compile/errors.d.ts delete mode 100644 node_modules/ajv/dist/compile/errors.js delete mode 100644 node_modules/ajv/dist/compile/errors.js.map delete mode 100644 node_modules/ajv/dist/compile/index.d.ts delete mode 100644 node_modules/ajv/dist/compile/index.js delete mode 100644 node_modules/ajv/dist/compile/index.js.map delete mode 100644 node_modules/ajv/dist/compile/jtd/parse.d.ts delete mode 100644 node_modules/ajv/dist/compile/jtd/parse.js delete mode 100644 node_modules/ajv/dist/compile/jtd/parse.js.map delete mode 100644 node_modules/ajv/dist/compile/jtd/serialize.d.ts delete mode 100644 node_modules/ajv/dist/compile/jtd/serialize.js delete mode 100644 node_modules/ajv/dist/compile/jtd/serialize.js.map delete mode 100644 node_modules/ajv/dist/compile/jtd/types.d.ts delete mode 100644 node_modules/ajv/dist/compile/jtd/types.js delete mode 100644 node_modules/ajv/dist/compile/jtd/types.js.map delete mode 100644 node_modules/ajv/dist/compile/names.d.ts delete mode 100644 node_modules/ajv/dist/compile/names.js delete mode 100644 node_modules/ajv/dist/compile/names.js.map delete mode 100644 node_modules/ajv/dist/compile/ref_error.d.ts delete mode 100644 node_modules/ajv/dist/compile/ref_error.js delete mode 100644 node_modules/ajv/dist/compile/ref_error.js.map delete mode 100644 node_modules/ajv/dist/compile/resolve.d.ts delete mode 100644 node_modules/ajv/dist/compile/resolve.js delete mode 100644 node_modules/ajv/dist/compile/resolve.js.map delete mode 100644 node_modules/ajv/dist/compile/rules.d.ts delete mode 100644 node_modules/ajv/dist/compile/rules.js delete mode 100644 node_modules/ajv/dist/compile/rules.js.map delete mode 100644 node_modules/ajv/dist/compile/util.d.ts delete mode 100644 node_modules/ajv/dist/compile/util.js delete mode 100644 node_modules/ajv/dist/compile/util.js.map delete mode 100644 node_modules/ajv/dist/compile/validate/applicability.d.ts delete mode 100644 node_modules/ajv/dist/compile/validate/applicability.js delete mode 100644 node_modules/ajv/dist/compile/validate/applicability.js.map delete mode 100644 node_modules/ajv/dist/compile/validate/boolSchema.d.ts delete mode 100644 node_modules/ajv/dist/compile/validate/boolSchema.js delete mode 100644 node_modules/ajv/dist/compile/validate/boolSchema.js.map delete mode 100644 node_modules/ajv/dist/compile/validate/dataType.d.ts delete mode 100644 node_modules/ajv/dist/compile/validate/dataType.js delete mode 100644 node_modules/ajv/dist/compile/validate/dataType.js.map delete mode 100644 node_modules/ajv/dist/compile/validate/defaults.d.ts delete mode 100644 node_modules/ajv/dist/compile/validate/defaults.js delete mode 100644 node_modules/ajv/dist/compile/validate/defaults.js.map delete mode 100644 node_modules/ajv/dist/compile/validate/index.d.ts delete mode 100644 node_modules/ajv/dist/compile/validate/index.js delete mode 100644 node_modules/ajv/dist/compile/validate/index.js.map delete mode 100644 node_modules/ajv/dist/compile/validate/keyword.d.ts delete mode 100644 node_modules/ajv/dist/compile/validate/keyword.js delete mode 100644 node_modules/ajv/dist/compile/validate/keyword.js.map delete mode 100644 node_modules/ajv/dist/compile/validate/subschema.d.ts delete mode 100644 node_modules/ajv/dist/compile/validate/subschema.js delete mode 100644 node_modules/ajv/dist/compile/validate/subschema.js.map delete mode 100644 node_modules/ajv/dist/core.d.ts delete mode 100644 node_modules/ajv/dist/core.js delete mode 100644 node_modules/ajv/dist/core.js.map delete mode 100644 node_modules/ajv/dist/jtd.d.ts delete mode 100644 node_modules/ajv/dist/jtd.js delete mode 100644 node_modules/ajv/dist/jtd.js.map delete mode 100644 node_modules/ajv/dist/refs/data.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts delete mode 100644 node_modules/ajv/dist/refs/json-schema-2019-09/index.js delete mode 100644 node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map delete mode 100644 node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-2019-09/schema.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts delete mode 100644 node_modules/ajv/dist/refs/json-schema-2020-12/index.js delete mode 100644 node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map delete mode 100644 node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-2020-12/schema.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-draft-06.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-draft-07.json delete mode 100644 node_modules/ajv/dist/refs/json-schema-secure.json delete mode 100644 node_modules/ajv/dist/refs/jtd-schema.d.ts delete mode 100644 node_modules/ajv/dist/refs/jtd-schema.js delete mode 100644 node_modules/ajv/dist/refs/jtd-schema.js.map delete mode 100644 node_modules/ajv/dist/runtime/equal.d.ts delete mode 100644 node_modules/ajv/dist/runtime/equal.js delete mode 100644 node_modules/ajv/dist/runtime/equal.js.map delete mode 100644 node_modules/ajv/dist/runtime/parseJson.d.ts delete mode 100644 node_modules/ajv/dist/runtime/parseJson.js delete mode 100644 node_modules/ajv/dist/runtime/parseJson.js.map delete mode 100644 node_modules/ajv/dist/runtime/quote.d.ts delete mode 100644 node_modules/ajv/dist/runtime/quote.js delete mode 100644 node_modules/ajv/dist/runtime/quote.js.map delete mode 100644 node_modules/ajv/dist/runtime/re2.d.ts delete mode 100644 node_modules/ajv/dist/runtime/re2.js delete mode 100644 node_modules/ajv/dist/runtime/re2.js.map delete mode 100644 node_modules/ajv/dist/runtime/timestamp.d.ts delete mode 100644 node_modules/ajv/dist/runtime/timestamp.js delete mode 100644 node_modules/ajv/dist/runtime/timestamp.js.map delete mode 100644 node_modules/ajv/dist/runtime/ucs2length.d.ts delete mode 100644 node_modules/ajv/dist/runtime/ucs2length.js delete mode 100644 node_modules/ajv/dist/runtime/ucs2length.js.map delete mode 100644 node_modules/ajv/dist/runtime/uri.d.ts delete mode 100644 node_modules/ajv/dist/runtime/uri.js delete mode 100644 node_modules/ajv/dist/runtime/uri.js.map delete mode 100644 node_modules/ajv/dist/runtime/validation_error.d.ts delete mode 100644 node_modules/ajv/dist/runtime/validation_error.js delete mode 100644 node_modules/ajv/dist/runtime/validation_error.js.map delete mode 100644 node_modules/ajv/dist/standalone/index.d.ts delete mode 100644 node_modules/ajv/dist/standalone/index.js delete mode 100644 node_modules/ajv/dist/standalone/index.js.map delete mode 100644 node_modules/ajv/dist/standalone/instance.d.ts delete mode 100644 node_modules/ajv/dist/standalone/instance.js delete mode 100644 node_modules/ajv/dist/standalone/instance.js.map delete mode 100644 node_modules/ajv/dist/types/index.d.ts delete mode 100644 node_modules/ajv/dist/types/index.js delete mode 100644 node_modules/ajv/dist/types/index.js.map delete mode 100644 node_modules/ajv/dist/types/json-schema.d.ts delete mode 100644 node_modules/ajv/dist/types/json-schema.js delete mode 100644 node_modules/ajv/dist/types/json-schema.js.map delete mode 100644 node_modules/ajv/dist/types/jtd-schema.d.ts delete mode 100644 node_modules/ajv/dist/types/jtd-schema.js delete mode 100644 node_modules/ajv/dist/types/jtd-schema.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/additionalItems.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/allOf.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/allOf.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/anyOf.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/contains.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/contains.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/contains.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/dependencies.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/if.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/if.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/if.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/index.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/index.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/index.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/items.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/items.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/items.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/items2020.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/items2020.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/not.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/not.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/not.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/oneOf.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/patternProperties.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/prefixItems.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/properties.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/properties.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/properties.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/propertyNames.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/thenElse.js delete mode 100644 node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/code.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/code.js delete mode 100644 node_modules/ajv/dist/vocabularies/code.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/core/id.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/core/id.js delete mode 100644 node_modules/ajv/dist/vocabularies/core/id.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/core/index.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/core/index.js delete mode 100644 node_modules/ajv/dist/vocabularies/core/index.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/core/ref.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/core/ref.js delete mode 100644 node_modules/ajv/dist/vocabularies/core/ref.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/discriminator/index.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/discriminator/index.js delete mode 100644 node_modules/ajv/dist/vocabularies/discriminator/index.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/discriminator/types.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/discriminator/types.js delete mode 100644 node_modules/ajv/dist/vocabularies/discriminator/types.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/draft2020.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/draft2020.js delete mode 100644 node_modules/ajv/dist/vocabularies/draft2020.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/draft7.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/draft7.js delete mode 100644 node_modules/ajv/dist/vocabularies/draft7.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js delete mode 100644 node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js delete mode 100644 node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/dynamic/index.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/dynamic/index.js delete mode 100644 node_modules/ajv/dist/vocabularies/dynamic/index.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js delete mode 100644 node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js delete mode 100644 node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/errors.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/errors.js delete mode 100644 node_modules/ajv/dist/vocabularies/errors.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/format/format.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/format/format.js delete mode 100644 node_modules/ajv/dist/vocabularies/format/format.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/format/index.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/format/index.js delete mode 100644 node_modules/ajv/dist/vocabularies/format/index.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/discriminator.js delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/elements.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/elements.js delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/elements.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/enum.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/enum.js delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/enum.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/error.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/error.js delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/error.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/index.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/index.js delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/index.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/metadata.js delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/metadata.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/nullable.js delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/nullable.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/properties.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/properties.js delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/properties.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/ref.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/ref.js delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/ref.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/type.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/type.js delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/type.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/union.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/union.js delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/union.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/values.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/values.js delete mode 100644 node_modules/ajv/dist/vocabularies/jtd/values.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/metadata.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/metadata.js delete mode 100644 node_modules/ajv/dist/vocabularies/metadata.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/next.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/next.js delete mode 100644 node_modules/ajv/dist/vocabularies/next.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/unevaluated/index.js delete mode 100644 node_modules/ajv/dist/vocabularies/unevaluated/index.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js delete mode 100644 node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js delete mode 100644 node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/validation/const.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/validation/const.js delete mode 100644 node_modules/ajv/dist/vocabularies/validation/const.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/validation/dependentRequired.js delete mode 100644 node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/validation/enum.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/validation/enum.js delete mode 100644 node_modules/ajv/dist/vocabularies/validation/enum.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/validation/index.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/validation/index.js delete mode 100644 node_modules/ajv/dist/vocabularies/validation/index.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/validation/limitContains.js delete mode 100644 node_modules/ajv/dist/vocabularies/validation/limitContains.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/validation/limitItems.js delete mode 100644 node_modules/ajv/dist/vocabularies/validation/limitItems.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/validation/limitLength.js delete mode 100644 node_modules/ajv/dist/vocabularies/validation/limitLength.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/validation/limitNumber.js delete mode 100644 node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/validation/limitProperties.js delete mode 100644 node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/validation/multipleOf.js delete mode 100644 node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/validation/pattern.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/validation/pattern.js delete mode 100644 node_modules/ajv/dist/vocabularies/validation/pattern.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/validation/required.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/validation/required.js delete mode 100644 node_modules/ajv/dist/vocabularies/validation/required.js.map delete mode 100644 node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts delete mode 100644 node_modules/ajv/dist/vocabularies/validation/uniqueItems.js delete mode 100644 node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map delete mode 100644 node_modules/ajv/lib/2019.ts delete mode 100644 node_modules/ajv/lib/2020.ts delete mode 100644 node_modules/ajv/lib/ajv.ts delete mode 100644 node_modules/ajv/lib/compile/codegen/code.ts delete mode 100644 node_modules/ajv/lib/compile/codegen/index.ts delete mode 100644 node_modules/ajv/lib/compile/codegen/scope.ts delete mode 100644 node_modules/ajv/lib/compile/errors.ts delete mode 100644 node_modules/ajv/lib/compile/index.ts delete mode 100644 node_modules/ajv/lib/compile/jtd/parse.ts delete mode 100644 node_modules/ajv/lib/compile/jtd/serialize.ts delete mode 100644 node_modules/ajv/lib/compile/jtd/types.ts delete mode 100644 node_modules/ajv/lib/compile/names.ts delete mode 100644 node_modules/ajv/lib/compile/ref_error.ts delete mode 100644 node_modules/ajv/lib/compile/resolve.ts delete mode 100644 node_modules/ajv/lib/compile/rules.ts delete mode 100644 node_modules/ajv/lib/compile/util.ts delete mode 100644 node_modules/ajv/lib/compile/validate/applicability.ts delete mode 100644 node_modules/ajv/lib/compile/validate/boolSchema.ts delete mode 100644 node_modules/ajv/lib/compile/validate/dataType.ts delete mode 100644 node_modules/ajv/lib/compile/validate/defaults.ts delete mode 100644 node_modules/ajv/lib/compile/validate/index.ts delete mode 100644 node_modules/ajv/lib/compile/validate/keyword.ts delete mode 100644 node_modules/ajv/lib/compile/validate/subschema.ts delete mode 100644 node_modules/ajv/lib/core.ts delete mode 100644 node_modules/ajv/lib/jtd.ts delete mode 100644 node_modules/ajv/lib/refs/json-schema-2019-09/index.ts delete mode 100644 node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-2019-09/schema.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-2020-12/index.ts delete mode 100644 node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-2020-12/schema.json delete mode 100644 node_modules/ajv/lib/refs/jtd-schema.ts delete mode 100644 node_modules/ajv/lib/runtime/equal.ts delete mode 100644 node_modules/ajv/lib/runtime/parseJson.ts delete mode 100644 node_modules/ajv/lib/runtime/quote.ts delete mode 100644 node_modules/ajv/lib/runtime/re2.ts delete mode 100644 node_modules/ajv/lib/runtime/timestamp.ts delete mode 100644 node_modules/ajv/lib/runtime/ucs2length.ts delete mode 100644 node_modules/ajv/lib/runtime/uri.ts delete mode 100644 node_modules/ajv/lib/runtime/validation_error.ts delete mode 100644 node_modules/ajv/lib/standalone/index.ts delete mode 100644 node_modules/ajv/lib/standalone/instance.ts delete mode 100644 node_modules/ajv/lib/types/index.ts delete mode 100644 node_modules/ajv/lib/types/json-schema.ts delete mode 100644 node_modules/ajv/lib/types/jtd-schema.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/allOf.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/anyOf.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/contains.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/dependencies.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/if.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/index.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/items.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/items2020.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/not.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/oneOf.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/properties.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts delete mode 100644 node_modules/ajv/lib/vocabularies/applicator/thenElse.ts delete mode 100644 node_modules/ajv/lib/vocabularies/code.ts delete mode 100644 node_modules/ajv/lib/vocabularies/core/id.ts delete mode 100644 node_modules/ajv/lib/vocabularies/core/index.ts delete mode 100644 node_modules/ajv/lib/vocabularies/core/ref.ts delete mode 100644 node_modules/ajv/lib/vocabularies/discriminator/index.ts delete mode 100644 node_modules/ajv/lib/vocabularies/discriminator/types.ts delete mode 100644 node_modules/ajv/lib/vocabularies/draft2020.ts delete mode 100644 node_modules/ajv/lib/vocabularies/draft7.ts delete mode 100644 node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts delete mode 100644 node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts delete mode 100644 node_modules/ajv/lib/vocabularies/dynamic/index.ts delete mode 100644 node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts delete mode 100644 node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts delete mode 100644 node_modules/ajv/lib/vocabularies/errors.ts delete mode 100644 node_modules/ajv/lib/vocabularies/format/format.ts delete mode 100644 node_modules/ajv/lib/vocabularies/format/index.ts delete mode 100644 node_modules/ajv/lib/vocabularies/jtd/discriminator.ts delete mode 100644 node_modules/ajv/lib/vocabularies/jtd/elements.ts delete mode 100644 node_modules/ajv/lib/vocabularies/jtd/enum.ts delete mode 100644 node_modules/ajv/lib/vocabularies/jtd/error.ts delete mode 100644 node_modules/ajv/lib/vocabularies/jtd/index.ts delete mode 100644 node_modules/ajv/lib/vocabularies/jtd/metadata.ts delete mode 100644 node_modules/ajv/lib/vocabularies/jtd/nullable.ts delete mode 100644 node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts delete mode 100644 node_modules/ajv/lib/vocabularies/jtd/properties.ts delete mode 100644 node_modules/ajv/lib/vocabularies/jtd/ref.ts delete mode 100644 node_modules/ajv/lib/vocabularies/jtd/type.ts delete mode 100644 node_modules/ajv/lib/vocabularies/jtd/union.ts delete mode 100644 node_modules/ajv/lib/vocabularies/jtd/values.ts delete mode 100644 node_modules/ajv/lib/vocabularies/metadata.ts delete mode 100644 node_modules/ajv/lib/vocabularies/next.ts delete mode 100644 node_modules/ajv/lib/vocabularies/unevaluated/index.ts delete mode 100644 node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts delete mode 100644 node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts delete mode 100644 node_modules/ajv/lib/vocabularies/validation/const.ts delete mode 100644 node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts delete mode 100644 node_modules/ajv/lib/vocabularies/validation/enum.ts delete mode 100644 node_modules/ajv/lib/vocabularies/validation/index.ts delete mode 100644 node_modules/ajv/lib/vocabularies/validation/limitContains.ts delete mode 100644 node_modules/ajv/lib/vocabularies/validation/limitItems.ts delete mode 100644 node_modules/ajv/lib/vocabularies/validation/limitLength.ts delete mode 100644 node_modules/ajv/lib/vocabularies/validation/limitNumber.ts delete mode 100644 node_modules/ajv/lib/vocabularies/validation/limitProperties.ts delete mode 100644 node_modules/ajv/lib/vocabularies/validation/multipleOf.ts delete mode 100644 node_modules/ajv/lib/vocabularies/validation/pattern.ts delete mode 100644 node_modules/ajv/lib/vocabularies/validation/required.ts delete mode 100644 node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts delete mode 100644 node_modules/import-local/node_modules/find-up/index.d.ts delete mode 100644 node_modules/import-local/node_modules/find-up/index.js delete mode 100644 node_modules/import-local/node_modules/find-up/license delete mode 100644 node_modules/import-local/node_modules/find-up/package.json delete mode 100644 node_modules/import-local/node_modules/find-up/readme.md delete mode 100644 node_modules/import-local/node_modules/locate-path/index.d.ts delete mode 100644 node_modules/import-local/node_modules/locate-path/index.js delete mode 100644 node_modules/import-local/node_modules/locate-path/license delete mode 100644 node_modules/import-local/node_modules/locate-path/package.json delete mode 100644 node_modules/import-local/node_modules/locate-path/readme.md delete mode 100644 node_modules/import-local/node_modules/p-limit/index.d.ts delete mode 100644 node_modules/import-local/node_modules/p-limit/index.js delete mode 100644 node_modules/import-local/node_modules/p-limit/license delete mode 100644 node_modules/import-local/node_modules/p-limit/package.json delete mode 100644 node_modules/import-local/node_modules/p-limit/readme.md delete mode 100644 node_modules/import-local/node_modules/p-locate/index.d.ts delete mode 100644 node_modules/import-local/node_modules/p-locate/index.js delete mode 100644 node_modules/import-local/node_modules/p-locate/license delete mode 100644 node_modules/import-local/node_modules/p-locate/package.json delete mode 100644 node_modules/import-local/node_modules/p-locate/readme.md delete mode 100644 node_modules/import-local/node_modules/path-exists/index.d.ts delete mode 100644 node_modules/import-local/node_modules/path-exists/index.js delete mode 100644 node_modules/import-local/node_modules/path-exists/license delete mode 100644 node_modules/import-local/node_modules/path-exists/package.json delete mode 100644 node_modules/import-local/node_modules/path-exists/readme.md delete mode 100644 node_modules/import-local/node_modules/pkg-dir/index.d.ts delete mode 100644 node_modules/import-local/node_modules/pkg-dir/index.js delete mode 100644 node_modules/import-local/node_modules/pkg-dir/license delete mode 100644 node_modules/import-local/node_modules/pkg-dir/package.json delete mode 100644 node_modules/import-local/node_modules/pkg-dir/readme.md delete mode 100644 node_modules/json-schema-traverse/.github/FUNDING.yml delete mode 100644 node_modules/json-schema-traverse/.github/workflows/build.yml delete mode 100644 node_modules/json-schema-traverse/.github/workflows/publish.yml delete mode 100644 node_modules/json-schema-traverse/index.d.ts delete mode 100644 node_modules/schema-utils/declarations/util/memorize.d.ts delete mode 100644 node_modules/schema-utils/dist/util/memorize.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/LICENSE delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/README.md delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/ajv-keywords.d.ts delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/index.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/_formatLimit.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/_util.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/allRequired.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/anyRequired.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/deepProperties.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/deepRequired.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/dot/_formatLimit.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/dot/patternRequired.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/dot/switch.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/dotjs/README.md delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/dotjs/_formatLimit.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/dotjs/patternRequired.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/dotjs/switch.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/dynamicDefaults.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/formatMaximum.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/formatMinimum.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/index.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/instanceof.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/oneRequired.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/patternRequired.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/prohibited.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/range.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/regexp.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/select.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/switch.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/transform.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/typeof.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/keywords/uniqueItemProperties.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv-keywords/package.json delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/.tonic_example.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/LICENSE delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/README.md delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/dist/ajv.bundle.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/dist/ajv.min.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/dist/ajv.min.js.map delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/ajv.d.ts delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/ajv.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/cache.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/compile/async.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/compile/equal.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/compile/error_classes.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/compile/formats.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/compile/index.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/compile/resolve.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/compile/rules.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/compile/schema_obj.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/compile/ucs2length.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/compile/util.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/data.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/definition_schema.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/_limit.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/_limitItems.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/_limitLength.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/_limitProperties.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/allOf.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/anyOf.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/coerce.def delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/comment.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/const.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/contains.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/custom.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/defaults.def delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/definitions.def delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/dependencies.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/enum.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/errors.def delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/format.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/if.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/items.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/missing.def delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/multipleOf.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/not.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/oneOf.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/pattern.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/properties.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/propertyNames.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/ref.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/required.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/uniqueItems.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/validate.jst delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/README.md delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/_limit.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/_limitItems.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/_limitLength.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/_limitProperties.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/allOf.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/anyOf.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/comment.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/const.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/contains.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/custom.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/dependencies.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/enum.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/format.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/if.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/index.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/items.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/multipleOf.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/not.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/oneOf.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/pattern.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/properties.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/propertyNames.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/ref.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/required.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/uniqueItems.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/validate.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/keyword.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/refs/data.json delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/refs/json-schema-draft-04.json delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/refs/json-schema-draft-06.json delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/refs/json-schema-draft-07.json delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/lib/refs/json-schema-secure.json delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/package.json delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/scripts/.eslintrc.yml delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/scripts/bundle.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/scripts/compile-dots.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/scripts/info delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/scripts/prepare-tests delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/scripts/publish-built-version delete mode 100644 node_modules/terser-webpack-plugin/node_modules/ajv/scripts/travis-gh-pages delete mode 100644 node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/.eslintrc.yml delete mode 100644 node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/.travis.yml delete mode 100644 node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/LICENSE delete mode 100644 node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/README.md delete mode 100644 node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/index.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/package.json delete mode 100644 node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/spec/.eslintrc.yml delete mode 100644 node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/spec/fixtures/schema.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/spec/index.spec.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/CHANGELOG.md delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/LICENSE delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/README.md delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/ValidationError.d.ts delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/index.d.ts delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/keywords/undefinedAsNull.d.ts delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/util/Range.d.ts delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/util/hints.d.ts delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/validate.d.ts delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/ValidationError.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/index.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/keywords/absolutePath.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/keywords/undefinedAsNull.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/util/Range.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/util/hints.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/validate.js delete mode 100644 node_modules/terser-webpack-plugin/node_modules/schema-utils/package.json delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/LICENSE delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/README.md delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/ajv-keywords.d.ts delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/index.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/_formatLimit.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/_util.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/allRequired.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/anyRequired.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/deepProperties.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/deepRequired.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/dot/_formatLimit.jst delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/dot/patternRequired.jst delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/dot/switch.jst delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/dotjs/README.md delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/dotjs/_formatLimit.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/dotjs/patternRequired.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/dotjs/switch.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/dynamicDefaults.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/formatMaximum.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/formatMinimum.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/index.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/instanceof.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/oneRequired.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/patternRequired.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/prohibited.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/range.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/regexp.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/select.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/switch.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/transform.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/typeof.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/keywords/uniqueItemProperties.js delete mode 100644 node_modules/webpack/node_modules/ajv-keywords/package.json delete mode 100644 node_modules/webpack/node_modules/ajv/.tonic_example.js delete mode 100644 node_modules/webpack/node_modules/ajv/LICENSE delete mode 100644 node_modules/webpack/node_modules/ajv/README.md delete mode 100644 node_modules/webpack/node_modules/ajv/dist/ajv.bundle.js delete mode 100644 node_modules/webpack/node_modules/ajv/dist/ajv.min.js delete mode 100644 node_modules/webpack/node_modules/ajv/dist/ajv.min.js.map delete mode 100644 node_modules/webpack/node_modules/ajv/lib/ajv.d.ts delete mode 100644 node_modules/webpack/node_modules/ajv/lib/ajv.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/cache.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/compile/async.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/compile/equal.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/compile/error_classes.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/compile/formats.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/compile/index.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/compile/resolve.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/compile/rules.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/compile/schema_obj.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/compile/ucs2length.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/compile/util.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/data.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/definition_schema.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/_limit.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/_limitItems.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/_limitLength.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/_limitProperties.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/allOf.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/anyOf.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/coerce.def delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/comment.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/const.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/contains.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/custom.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/defaults.def delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/definitions.def delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/dependencies.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/enum.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/errors.def delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/format.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/if.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/items.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/missing.def delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/multipleOf.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/not.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/oneOf.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/pattern.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/properties.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/propertyNames.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/ref.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/required.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/uniqueItems.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dot/validate.jst delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/README.md delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/_limit.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/_limitItems.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/_limitLength.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/_limitProperties.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/allOf.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/anyOf.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/comment.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/const.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/contains.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/custom.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/dependencies.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/enum.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/format.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/if.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/index.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/items.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/multipleOf.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/not.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/oneOf.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/pattern.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/properties.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/propertyNames.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/ref.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/required.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/uniqueItems.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/dotjs/validate.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/keyword.js delete mode 100644 node_modules/webpack/node_modules/ajv/lib/refs/data.json delete mode 100644 node_modules/webpack/node_modules/ajv/lib/refs/json-schema-draft-04.json delete mode 100644 node_modules/webpack/node_modules/ajv/lib/refs/json-schema-draft-06.json delete mode 100644 node_modules/webpack/node_modules/ajv/lib/refs/json-schema-draft-07.json delete mode 100644 node_modules/webpack/node_modules/ajv/lib/refs/json-schema-secure.json delete mode 100644 node_modules/webpack/node_modules/ajv/package.json delete mode 100644 node_modules/webpack/node_modules/ajv/scripts/.eslintrc.yml delete mode 100644 node_modules/webpack/node_modules/ajv/scripts/bundle.js delete mode 100644 node_modules/webpack/node_modules/ajv/scripts/compile-dots.js delete mode 100644 node_modules/webpack/node_modules/ajv/scripts/info delete mode 100644 node_modules/webpack/node_modules/ajv/scripts/prepare-tests delete mode 100644 node_modules/webpack/node_modules/ajv/scripts/publish-built-version delete mode 100644 node_modules/webpack/node_modules/ajv/scripts/travis-gh-pages delete mode 100644 node_modules/webpack/node_modules/json-schema-traverse/.eslintrc.yml delete mode 100644 node_modules/webpack/node_modules/json-schema-traverse/.travis.yml delete mode 100644 node_modules/webpack/node_modules/json-schema-traverse/LICENSE delete mode 100644 node_modules/webpack/node_modules/json-schema-traverse/README.md delete mode 100644 node_modules/webpack/node_modules/json-schema-traverse/index.js delete mode 100644 node_modules/webpack/node_modules/json-schema-traverse/package.json delete mode 100644 node_modules/webpack/node_modules/json-schema-traverse/spec/.eslintrc.yml delete mode 100644 node_modules/webpack/node_modules/json-schema-traverse/spec/fixtures/schema.js delete mode 100644 node_modules/webpack/node_modules/json-schema-traverse/spec/index.spec.js delete mode 100644 node_modules/webpack/node_modules/schema-utils/CHANGELOG.md delete mode 100644 node_modules/webpack/node_modules/schema-utils/LICENSE delete mode 100644 node_modules/webpack/node_modules/schema-utils/README.md delete mode 100644 node_modules/webpack/node_modules/schema-utils/declarations/ValidationError.d.ts delete mode 100644 node_modules/webpack/node_modules/schema-utils/declarations/index.d.ts delete mode 100644 node_modules/webpack/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts delete mode 100644 node_modules/webpack/node_modules/schema-utils/declarations/keywords/undefinedAsNull.d.ts delete mode 100644 node_modules/webpack/node_modules/schema-utils/declarations/util/Range.d.ts delete mode 100644 node_modules/webpack/node_modules/schema-utils/declarations/util/hints.d.ts delete mode 100644 node_modules/webpack/node_modules/schema-utils/declarations/validate.d.ts delete mode 100644 node_modules/webpack/node_modules/schema-utils/dist/ValidationError.js delete mode 100644 node_modules/webpack/node_modules/schema-utils/dist/index.js delete mode 100644 node_modules/webpack/node_modules/schema-utils/dist/keywords/absolutePath.js delete mode 100644 node_modules/webpack/node_modules/schema-utils/dist/keywords/undefinedAsNull.js delete mode 100644 node_modules/webpack/node_modules/schema-utils/dist/util/Range.js delete mode 100644 node_modules/webpack/node_modules/schema-utils/dist/util/hints.js delete mode 100644 node_modules/webpack/node_modules/schema-utils/dist/validate.js delete mode 100644 node_modules/webpack/node_modules/schema-utils/package.json create mode 100644 package-lock.json create mode 100644 package.json diff --git a/dist/996e0c1b19b93e0bdcfb.js b/dist/996e0c1b19b93e0bdcfb.js new file mode 100644 index 0000000..d5e49d5 --- /dev/null +++ b/dist/996e0c1b19b93e0bdcfb.js @@ -0,0 +1,66 @@ +/* + * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +/******/(function () { + // webpackBootstrap + /******/ + "use strict"; + + /******/ + var __webpack_modules__ = { + /***/"./src/index.js": ( + /*!**********************!*\ + !*** ./src/index.js ***! + \**********************/ + /***/ + function _src_indexJs(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + eval("__webpack_require__.r(__webpack_exports__);\nObject(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }());\nObject(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three/examples/jsm/controls/PointerLockControls.js'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }());\nObject(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }());\nObject(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three/examples/jsm/libs/stats.module.js'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }());\n\n\n\n\nvar isGameRunning = false; // Track if the game is running\nvar paused = false; // Track if the game is paused\n\ndocument.addEventListener('DOMContentLoaded', function () {\n var mainButton = document.getElementById('mainButton');\n if (mainButton) {\n mainButton.onclick = function () {\n if (isGameRunning) {\n resumeGame(); // Resume the game if already started and paused\n } else {\n startGame(); // Start the game for the first time\n }\n };\n } else {\n console.error(\"Main button not found!\");\n }\n});\nfunction startGame() {\n controls.lock(); // Lock the pointer for the first time\n isGameRunning = true;\n paused = false;\n document.getElementById('mainButton').innerText = 'Resume Game'; // Change button to 'Resume Game' after start\n document.getElementById('menu').style.display = 'none'; // Hide the menu\n animate(); // Start the game animation loop\n}\nfunction resumeGame() {\n controls.lock(); // Lock the pointer again to resume\n paused = false;\n document.getElementById('menu').style.display = 'none'; // Hide the menu\n animate(); // Resume the animation loop\n}\nfunction pauseGame() {\n paused = true;\n document.getElementById('menu').style.display = 'block'; // Show the menu when paused\n}\nvar scene = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();\nvar renderer = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())({\n antialias: true\n});\nrenderer.setSize(window.innerWidth, window.innerHeight);\nrenderer.shadowMap.enabled = true;\nrenderer.shadowMap.type = Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }());\ndocument.body.appendChild(renderer.domElement);\n\n// FPS Counter (Stats.js)\nvar stats = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three/examples/jsm/libs/stats.module.js'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();\ndocument.body.appendChild(stats.dom);\nvar camera = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(75, window.innerWidth / window.innerHeight, 0.1, 1000);\ncamera.position.set(0, 1.8, 5);\nvar controls = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three/examples/jsm/controls/PointerLockControls.js'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(camera, document.body);\ndocument.body.addEventListener('click', function () {\n if (!isGameRunning) return; // Prevent locking controls before the game starts\n controls.lock();\n});\ncontrols.addEventListener('lock', function () {\n if (!paused) document.getElementById('menu').style.display = 'none'; // Hide the menu when the pointer is locked\n});\ncontrols.addEventListener('unlock', function () {\n if (isGameRunning) pauseGame(); // Show the menu when the pointer is unlocked and the game is running\n});\nwindow.addEventListener('resize', function () {\n renderer.setSize(window.innerWidth, window.innerHeight);\n camera.aspect = window.innerWidth / window.innerHeight;\n camera.updateProjectionMatrix();\n});\n\n// Load Babylon.js online skybox textures using CubeTextureLoader\nvar skyboxLoader = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();\nvar skyboxTexture = skyboxLoader.load(['https://playground.babylonjs.com/textures/skybox_px.jpg', 'https://playground.babylonjs.com/textures/skybox_nx.jpg', 'https://playground.babylonjs.com/textures/skybox_py.jpg', 'https://playground.babylonjs.com/textures/skybox_ny.jpg', 'https://playground.babylonjs.com/textures/skybox_pz.jpg', 'https://playground.babylonjs.com/textures/skybox_nz.jpg']);\nscene.background = skyboxTexture;\n\n// Physics world\nvar world = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();\nworld.gravity.set(0, -9.82, 0);\nworld.broadphase = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();\nworld.solver.iterations = 10;\nvar fixedTimeStep = 1 / 120;\nvar maxSubSteps = 3;\n\n// Ground Physics\nvar groundBody = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())({\n type: Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }()).STATIC,\n shape: new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())()\n});\ngroundBody.quaternion.setFromEuler(-Math.PI / 2, 0, 0);\nworld.addBody(groundBody);\n\n// Ground Mesh\nvar textureLoader = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();\nvar groundTexture = textureLoader.load('https://threejsfundamentals.org/threejs/resources/images/checker.png');\ngroundTexture.wrapS = groundTexture.wrapT = Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }());\ngroundTexture.repeat.set(10, 10);\nvar groundMaterial = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())({\n map: groundTexture,\n metalness: 0.3,\n roughness: 0.7\n});\nvar ground = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(50, 50), groundMaterial);\nground.rotation.x = -Math.PI / 2;\nground.receiveShadow = true;\nscene.add(ground);\n\n// Wall texture\nvar wallTexture = textureLoader.load('https://dl.polyhaven.org/file/ph-assets/Textures/jpg/2k/brick_wall_006/brick_wall_006_diff_2k.jpg');\nvar wallMaterial = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())({\n map: wallTexture,\n metalness: 0.0,\n roughness: 0.8\n});\n\n// Create walls\nvar wall1 = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(10, 5, 1), wallMaterial);\nwall1.position.set(0, 2.5, -5);\nwall1.castShadow = true;\nwall1.receiveShadow = true;\nscene.add(wall1);\nvar wall1Body = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())({\n mass: 0,\n shape: new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(5, 2.5, 0.5))\n});\nwall1Body.position.set(0, 2.5, -5);\nworld.addBody(wall1Body);\nvar wall2 = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(10, 5, 1), wallMaterial);\nwall2.position.set(-5, 2.5, 0);\nwall2.rotation.y = Math.PI / 2;\nwall2.castShadow = true;\nwall2.receiveShadow = true;\nscene.add(wall2);\nvar wall2Body = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())({\n mass: 0,\n shape: new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(5, 2.5, 0.5))\n});\nwall2Body.position.set(-5, 2.5, 0);\nwall2Body.quaternion.setFromEuler(0, Math.PI / 2, 0);\nworld.addBody(wall2Body);\n\n// Light setup\nvar hemisphereLight = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(0xddeeff, 0x0f0e0d, 1);\nscene.add(hemisphereLight);\nvar directionalLight = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(0xffffff, 1.5);\ndirectionalLight.position.set(10, 20, 10);\ndirectionalLight.castShadow = true;\nscene.add(directionalLight);\n\n// Cube object with dynamic physics\nvar cubeMaterial = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())({\n color: 0xff0000\n});\nvar cube = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(1, 1, 1), cubeMaterial);\ncube.position.set(0, 1, 0);\ncube.castShadow = true;\nscene.add(cube);\nvar cubeBody = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())({\n mass: 2,\n shape: new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(0.5, 0.5, 0.5))\n});\ncubeBody.position.set(0, 1, 0);\nworld.addBody(cubeBody);\n\n// Sphere object with dynamic physics\nvar sphere = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(0.5, 32, 32), new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())({\n color: 0x00ff00\n}));\nsphere.position.set(3, 1, 0);\nsphere.castShadow = true;\nscene.add(sphere);\nvar sphereBody = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())({\n mass: 2,\n shape: new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(0.5)\n});\nsphereBody.position.set(3, 1, 0);\nworld.addBody(sphereBody);\n\n// Player Physics\nvar playerBody = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())({\n mass: 5,\n shape: new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(1)\n});\nplayerBody.position.set(0, 1, 10);\nworld.addBody(playerBody);\nvar moveForward = false,\n moveBackward = false,\n moveLeft = false,\n moveRight = false;\nvar canJump = false;\nvar isSprinting = false;\nvar baseMoveSpeed = 100;\nvar sprintMultiplier = 2;\nvar velocity = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();\nvar heldObject = null;\nvar holder = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();\nvar pickupDistance = 2.5;\n\n// Event listener for collisions to enable jumping\nplayerBody.addEventListener('collide', function (event) {\n if (event.body === groundBody) {\n canJump = true;\n }\n});\n\n// Input controls\ndocument.addEventListener('keydown', function (event) {\n switch (event.code) {\n case 'KeyW':\n moveForward = true;\n break;\n case 'KeyS':\n moveBackward = true;\n break;\n case 'KeyA':\n moveLeft = true;\n break;\n case 'KeyD':\n moveRight = true;\n break;\n case 'ControlLeft':\n isSprinting = true;\n break;\n case 'Space':\n if (canJump) {\n playerBody.velocity.y = 10;\n canJump = false;\n }\n break;\n case 'KeyE':\n if (heldObject) {\n releaseObject();\n } else {\n pickUpObject();\n }\n break;\n case 'KeyF':\n if (heldObject) {\n throwObject();\n }\n break;\n }\n});\ndocument.addEventListener('keyup', function (event) {\n switch (event.code) {\n case 'KeyW':\n moveForward = false;\n break;\n case 'KeyS':\n moveBackward = false;\n break;\n case 'KeyA':\n moveLeft = false;\n break;\n case 'KeyD':\n moveRight = false;\n break;\n case 'ControlLeft':\n isSprinting = false;\n break;\n }\n});\n\n// Picking up objects and making them kinematic\nfunction pickUpObject() {\n var raycaster = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();\n raycaster.setFromCamera(new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(0, 0), camera);\n var intersects = raycaster.intersectObjects([cube, sphere]);\n if (intersects.length > 0) {\n var intersectedObject = intersects[0].object;\n var body;\n if (intersectedObject === cube) {\n body = cubeBody;\n } else if (intersectedObject === sphere) {\n body = sphereBody;\n }\n var distance = playerBody.position.distanceTo(intersectedObject.position);\n if (distance <= pickupDistance) {\n heldObject = body;\n heldObject.angularVelocity.set(0, 0, 0);\n heldObject.angularDamping = 1;\n\n // Disable gravity and set kinematic so the object doesn't affect the player\n heldObject.type = Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }()).KINEMATIC;\n heldObject.allowSleep = false;\n heldObject.gravityScale = 0;\n\n // Adjust object position smoothly to prevent passing through walls\n heldObject.collisionResponse = false;\n }\n }\n}\n\n// Release held object and make it dynamic again\nfunction releaseObject() {\n if (heldObject) {\n heldObject.type = Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }()).DYNAMIC;\n heldObject.gravityScale = 1;\n heldObject.angularDamping = 0.1;\n heldObject.collisionResponse = true;\n heldObject = null;\n }\n}\n\n// Throw object with velocity\nfunction throwObject() {\n if (heldObject) {\n var throwVelocity = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'cannon-es'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();\n var cameraDirection = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();\n camera.getWorldDirection(cameraDirection);\n throwVelocity.set(cameraDirection.x * 20, cameraDirection.y * 20, cameraDirection.z * 20);\n heldObject.velocity.copy(throwVelocity);\n releaseObject();\n }\n}\n\n// Movement logic and restrictions\nfunction updatePlayerMovement(delta) {\n velocity.set(0, 0, 0);\n var moveSpeed = isSprinting ? baseMoveSpeed * sprintMultiplier : baseMoveSpeed;\n var forward = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();\n camera.getWorldDirection(forward);\n var right = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();\n right.crossVectors(forward, camera.up).normalize();\n if (moveForward) velocity.add(forward.multiplyScalar(moveSpeed * delta));\n if (moveBackward) velocity.add(forward.multiplyScalar(-moveSpeed * delta));\n if (moveLeft) velocity.add(right.multiplyScalar(-moveSpeed * delta));\n if (moveRight) velocity.add(right.multiplyScalar(moveSpeed * delta));\n playerBody.velocity.x = velocity.x;\n playerBody.velocity.z = velocity.z;\n camera.position.copy(playerBody.position);\n controls.object.position.copy(playerBody.position);\n\n // Move held object smoothly with the player\n if (heldObject) {\n var cameraDirection = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();\n camera.getWorldDirection(cameraDirection);\n cameraDirection.normalize();\n holder.copy(camera.position).add(cameraDirection.multiplyScalar(2));\n heldObject.position.set(holder.x, holder.y, holder.z);\n }\n}\n\n// Animation loop\nvar clock = new Object(function webpackMissingModule() { var e = new Error(\"Cannot find module 'three'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();\nfunction animate() {\n if (paused) return; // Stop the loop if paused\n\n var delta = clock.getDelta();\n world.step(fixedTimeStep, delta, maxSubSteps);\n updatePlayerMovement(delta);\n wall1.position.copy(wall1Body.position);\n wall1.quaternion.copy(wall1Body.quaternion);\n wall2.position.copy(wall2Body.position);\n wall2.quaternion.copy(wall2Body.quaternion);\n cube.position.copy(cubeBody.position);\n cube.quaternion.copy(cubeBody.quaternion);\n sphere.position.copy(sphereBody.position);\n sphere.quaternion.copy(sphereBody.quaternion);\n stats.update();\n renderer.render(scene, camera);\n requestAnimationFrame(animate);\n}\nanimate();\n\n//# sourceURL=webpack://3d_game/./src/index.js?"); + + /***/ + }) + + /******/ + }; + /************************************************************************/ + /******/ // The require scope + /******/ + var __webpack_require__ = {}; + /******/ + /************************************************************************/ + /******/ /* webpack/runtime/make namespace object */ + /******/ + (function () { + /******/ // define __esModule on exports + /******/__webpack_require__.r = function (exports) { + /******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { + /******/Object.defineProperty(exports, Symbol.toStringTag, { + value: 'Module' + }); + /******/ + } + /******/ + Object.defineProperty(exports, '__esModule', { + value: true + }); + /******/ + }; + /******/ + })(); + /******/ + /************************************************************************/ + /******/ + /******/ // startup + /******/ // Load entry module and return exports + /******/ // This entry module can't be inlined because the eval devtool is used. + /******/ + var __webpack_exports__ = {}; + /******/ + __webpack_modules__["./src/index.js"](0, __webpack_exports__, __webpack_require__); + /******/ + /******/ +})(); \ No newline at end of file diff --git a/dist/a708c87fa8616c003655.js b/dist/a708c87fa8616c003655.js new file mode 100644 index 0000000..e3a8907 --- /dev/null +++ b/dist/a708c87fa8616c003655.js @@ -0,0 +1,2 @@ +/*! For license information please see a708c87fa8616c003655.js.LICENSE.txt */ +(function(){"use strict";var __webpack_modules__={"./src/index.js":function _src_indexJs(__unused_webpack_module,__webpack_exports__,__webpack_require__){eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var three_examples_jsm_controls_PointerLockControls_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three/examples/jsm/controls/PointerLockControls.js */ \"./node_modules/three/examples/jsm/controls/PointerLockControls.js\");\n/* harmony import */ var cannon_es__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! cannon-es */ \"./node_modules/cannon-es/dist/cannon-es.js\");\n/* harmony import */ var three_examples_jsm_libs_stats_module_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three/examples/jsm/libs/stats.module.js */ \"./node_modules/three/examples/jsm/libs/stats.module.js\");\n\n\n\n\nvar isGameRunning = false; // Track if the game is running\nvar paused = false; // Track if the game is paused\n\ndocument.addEventListener('DOMContentLoaded', function () {\n var mainButton = document.getElementById('mainButton');\n if (mainButton) {\n mainButton.onclick = function () {\n if (isGameRunning) {\n resumeGame(); // Resume the game if already started and paused\n } else {\n startGame(); // Start the game for the first time\n }\n };\n } else {\n console.error(\"Main button not found!\");\n }\n});\nfunction startGame() {\n controls.lock(); // Lock the pointer for the first time\n isGameRunning = true;\n paused = false;\n document.getElementById('mainButton').innerText = 'Resume Game'; // Change button to 'Resume Game' after start\n document.getElementById('menu').style.display = 'none'; // Hide the menu\n animate(); // Start the game animation loop\n}\nfunction resumeGame() {\n controls.lock(); // Lock the pointer again to resume\n paused = false;\n document.getElementById('menu').style.display = 'none'; // Hide the menu\n animate(); // Resume the animation loop\n}\nfunction pauseGame() {\n paused = true;\n document.getElementById('menu').style.display = 'block'; // Show the menu when paused\n}\nvar scene = new three__WEBPACK_IMPORTED_MODULE_0__.Scene();\nvar renderer = new three__WEBPACK_IMPORTED_MODULE_0__.WebGLRenderer({\n antialias: true\n});\nrenderer.setSize(window.innerWidth, window.innerHeight);\nrenderer.shadowMap.enabled = true;\nrenderer.shadowMap.type = three__WEBPACK_IMPORTED_MODULE_0__.PCFSoftShadowMap;\ndocument.body.appendChild(renderer.domElement);\n\n// FPS Counter (Stats.js)\nvar stats = new three_examples_jsm_libs_stats_module_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\ndocument.body.appendChild(stats.dom);\nvar camera = new three__WEBPACK_IMPORTED_MODULE_0__.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);\ncamera.position.set(0, 1.8, 5);\nvar controls = new three_examples_jsm_controls_PointerLockControls_js__WEBPACK_IMPORTED_MODULE_2__.PointerLockControls(camera, document.body);\ndocument.body.addEventListener('click', function () {\n if (!isGameRunning) return; // Prevent locking controls before the game starts\n controls.lock();\n});\ncontrols.addEventListener('lock', function () {\n if (!paused) document.getElementById('menu').style.display = 'none'; // Hide the menu when the pointer is locked\n});\ncontrols.addEventListener('unlock', function () {\n if (isGameRunning) pauseGame(); // Show the menu when the pointer is unlocked and the game is running\n});\nwindow.addEventListener('resize', function () {\n renderer.setSize(window.innerWidth, window.innerHeight);\n camera.aspect = window.innerWidth / window.innerHeight;\n camera.updateProjectionMatrix();\n});\n\n// Load Babylon.js online skybox textures using CubeTextureLoader\nvar skyboxLoader = new three__WEBPACK_IMPORTED_MODULE_0__.CubeTextureLoader();\nvar skyboxTexture = skyboxLoader.load(['https://playground.babylonjs.com/textures/skybox_px.jpg', 'https://playground.babylonjs.com/textures/skybox_nx.jpg', 'https://playground.babylonjs.com/textures/skybox_py.jpg', 'https://playground.babylonjs.com/textures/skybox_ny.jpg', 'https://playground.babylonjs.com/textures/skybox_pz.jpg', 'https://playground.babylonjs.com/textures/skybox_nz.jpg']);\nscene.background = skyboxTexture;\n\n// Physics world\nvar world = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.World();\nworld.gravity.set(0, -9.82, 0);\nworld.broadphase = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.NaiveBroadphase();\nworld.solver.iterations = 10;\nvar fixedTimeStep = 1 / 120;\nvar maxSubSteps = 3;\n\n// Ground Physics\nvar groundBody = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({\n type: cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body.STATIC,\n shape: new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Plane()\n});\ngroundBody.quaternion.setFromEuler(-Math.PI / 2, 0, 0);\nworld.addBody(groundBody);\n\n// Ground Mesh\nvar textureLoader = new three__WEBPACK_IMPORTED_MODULE_0__.TextureLoader();\nvar groundTexture = textureLoader.load('https://threejsfundamentals.org/threejs/resources/images/checker.png');\ngroundTexture.wrapS = groundTexture.wrapT = three__WEBPACK_IMPORTED_MODULE_0__.RepeatWrapping;\ngroundTexture.repeat.set(10, 10);\nvar groundMaterial = new three__WEBPACK_IMPORTED_MODULE_0__.MeshStandardMaterial({\n map: groundTexture,\n metalness: 0.3,\n roughness: 0.7\n});\nvar ground = new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(new three__WEBPACK_IMPORTED_MODULE_0__.PlaneGeometry(50, 50), groundMaterial);\nground.rotation.x = -Math.PI / 2;\nground.receiveShadow = true;\nscene.add(ground);\n\n// Wall texture\nvar wallTexture = textureLoader.load('https://dl.polyhaven.org/file/ph-assets/Textures/jpg/2k/brick_wall_006/brick_wall_006_diff_2k.jpg');\nvar wallMaterial = new three__WEBPACK_IMPORTED_MODULE_0__.MeshStandardMaterial({\n map: wallTexture,\n metalness: 0.0,\n roughness: 0.8\n});\n\n// Create walls\nvar wall1 = new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(new three__WEBPACK_IMPORTED_MODULE_0__.BoxGeometry(10, 5, 1), wallMaterial);\nwall1.position.set(0, 2.5, -5);\nwall1.castShadow = true;\nwall1.receiveShadow = true;\nscene.add(wall1);\nvar wall1Body = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({\n mass: 0,\n shape: new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Box(new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Vec3(5, 2.5, 0.5))\n});\nwall1Body.position.set(0, 2.5, -5);\nworld.addBody(wall1Body);\nvar wall2 = new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(new three__WEBPACK_IMPORTED_MODULE_0__.BoxGeometry(10, 5, 1), wallMaterial);\nwall2.position.set(-5, 2.5, 0);\nwall2.rotation.y = Math.PI / 2;\nwall2.castShadow = true;\nwall2.receiveShadow = true;\nscene.add(wall2);\nvar wall2Body = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({\n mass: 0,\n shape: new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Box(new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Vec3(5, 2.5, 0.5))\n});\nwall2Body.position.set(-5, 2.5, 0);\nwall2Body.quaternion.setFromEuler(0, Math.PI / 2, 0);\nworld.addBody(wall2Body);\n\n// Light setup\nvar hemisphereLight = new three__WEBPACK_IMPORTED_MODULE_0__.HemisphereLight(0xddeeff, 0x0f0e0d, 1);\nscene.add(hemisphereLight);\nvar directionalLight = new three__WEBPACK_IMPORTED_MODULE_0__.DirectionalLight(0xffffff, 1.5);\ndirectionalLight.position.set(10, 20, 10);\ndirectionalLight.castShadow = true;\nscene.add(directionalLight);\n\n// Cube object with dynamic physics\nvar cubeMaterial = new three__WEBPACK_IMPORTED_MODULE_0__.MeshStandardMaterial({\n color: 0xff0000\n});\nvar cube = new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(new three__WEBPACK_IMPORTED_MODULE_0__.BoxGeometry(1, 1, 1), cubeMaterial);\ncube.position.set(0, 1, 0);\ncube.castShadow = true;\nscene.add(cube);\nvar cubeBody = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({\n mass: 2,\n shape: new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Box(new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Vec3(0.5, 0.5, 0.5))\n});\ncubeBody.position.set(0, 1, 0);\nworld.addBody(cubeBody);\n\n// Sphere object with dynamic physics\nvar sphere = new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(new three__WEBPACK_IMPORTED_MODULE_0__.SphereGeometry(0.5, 32, 32), new three__WEBPACK_IMPORTED_MODULE_0__.MeshStandardMaterial({\n color: 0x00ff00\n}));\nsphere.position.set(3, 1, 0);\nsphere.castShadow = true;\nscene.add(sphere);\nvar sphereBody = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({\n mass: 2,\n shape: new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Sphere(0.5)\n});\nsphereBody.position.set(3, 1, 0);\nworld.addBody(sphereBody);\n\n// Player Physics\nvar playerBody = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({\n mass: 5,\n shape: new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Sphere(1)\n});\nplayerBody.position.set(0, 1, 10);\nworld.addBody(playerBody);\nvar moveForward = false,\n moveBackward = false,\n moveLeft = false,\n moveRight = false;\nvar canJump = false;\nvar isSprinting = false;\nvar baseMoveSpeed = 100;\nvar sprintMultiplier = 2;\nvar velocity = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nvar heldObject = null;\nvar holder = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nvar pickupDistance = 2.5;\n\n// Event listener for collisions to enable jumping\nplayerBody.addEventListener('collide', function (event) {\n if (event.body === groundBody) {\n canJump = true;\n }\n});\n\n// Input controls\ndocument.addEventListener('keydown', function (event) {\n switch (event.code) {\n case 'KeyW':\n moveForward = true;\n break;\n case 'KeyS':\n moveBackward = true;\n break;\n case 'KeyA':\n moveLeft = true;\n break;\n case 'KeyD':\n moveRight = true;\n break;\n case 'ControlLeft':\n isSprinting = true;\n break;\n case 'Space':\n if (canJump) {\n playerBody.velocity.y = 10;\n canJump = false;\n }\n break;\n case 'KeyE':\n if (heldObject) {\n releaseObject();\n } else {\n pickUpObject();\n }\n break;\n case 'KeyF':\n if (heldObject) {\n throwObject();\n }\n break;\n }\n});\ndocument.addEventListener('keyup', function (event) {\n switch (event.code) {\n case 'KeyW':\n moveForward = false;\n break;\n case 'KeyS':\n moveBackward = false;\n break;\n case 'KeyA':\n moveLeft = false;\n break;\n case 'KeyD':\n moveRight = false;\n break;\n case 'ControlLeft':\n isSprinting = false;\n break;\n }\n});\n\n// Picking up objects and making them kinematic\nfunction pickUpObject() {\n var raycaster = new three__WEBPACK_IMPORTED_MODULE_0__.Raycaster();\n raycaster.setFromCamera(new three__WEBPACK_IMPORTED_MODULE_0__.Vector2(0, 0), camera);\n var intersects = raycaster.intersectObjects([cube, sphere]);\n if (intersects.length > 0) {\n var intersectedObject = intersects[0].object;\n var body;\n if (intersectedObject === cube) {\n body = cubeBody;\n } else if (intersectedObject === sphere) {\n body = sphereBody;\n }\n var distance = playerBody.position.distanceTo(intersectedObject.position);\n if (distance <= pickupDistance) {\n heldObject = body;\n heldObject.angularVelocity.set(0, 0, 0);\n heldObject.angularDamping = 1;\n\n // Disable gravity and set kinematic so the object doesn't affect the player\n heldObject.type = cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body.KINEMATIC;\n heldObject.allowSleep = false;\n heldObject.gravityScale = 0;\n\n // Adjust object position smoothly to prevent passing through walls\n heldObject.collisionResponse = false;\n }\n }\n}\n\n// Release held object and make it dynamic again\nfunction releaseObject() {\n if (heldObject) {\n heldObject.type = cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body.DYNAMIC;\n heldObject.gravityScale = 1;\n heldObject.angularDamping = 0.1;\n heldObject.collisionResponse = true;\n heldObject = null;\n }\n}\n\n// Throw object with velocity\nfunction throwObject() {\n if (heldObject) {\n var throwVelocity = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Vec3();\n var cameraDirection = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n camera.getWorldDirection(cameraDirection);\n throwVelocity.set(cameraDirection.x * 20, cameraDirection.y * 20, cameraDirection.z * 20);\n heldObject.velocity.copy(throwVelocity);\n releaseObject();\n }\n}\n\n// Movement logic and restrictions\nfunction updatePlayerMovement(delta) {\n velocity.set(0, 0, 0);\n var moveSpeed = isSprinting ? baseMoveSpeed * sprintMultiplier : baseMoveSpeed;\n var forward = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n camera.getWorldDirection(forward);\n var right = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n right.crossVectors(forward, camera.up).normalize();\n if (moveForward) velocity.add(forward.multiplyScalar(moveSpeed * delta));\n if (moveBackward) velocity.add(forward.multiplyScalar(-moveSpeed * delta));\n if (moveLeft) velocity.add(right.multiplyScalar(-moveSpeed * delta));\n if (moveRight) velocity.add(right.multiplyScalar(moveSpeed * delta));\n playerBody.velocity.x = velocity.x;\n playerBody.velocity.z = velocity.z;\n camera.position.copy(playerBody.position);\n controls.object.position.copy(playerBody.position);\n\n // Move held object smoothly with the player\n if (heldObject) {\n var cameraDirection = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n camera.getWorldDirection(cameraDirection);\n cameraDirection.normalize();\n holder.copy(camera.position).add(cameraDirection.multiplyScalar(2));\n heldObject.position.set(holder.x, holder.y, holder.z);\n }\n}\n\n// Animation loop\nvar clock = new three__WEBPACK_IMPORTED_MODULE_0__.Clock();\nfunction animate() {\n if (paused) return; // Stop the loop if paused\n\n var delta = clock.getDelta();\n world.step(fixedTimeStep, delta, maxSubSteps);\n updatePlayerMovement(delta);\n wall1.position.copy(wall1Body.position);\n wall1.quaternion.copy(wall1Body.quaternion);\n wall2.position.copy(wall2Body.position);\n wall2.quaternion.copy(wall2Body.quaternion);\n cube.position.copy(cubeBody.position);\n cube.quaternion.copy(cubeBody.quaternion);\n sphere.position.copy(sphereBody.position);\n sphere.quaternion.copy(sphereBody.quaternion);\n stats.update();\n renderer.render(scene, camera);\n requestAnimationFrame(animate);\n}\nanimate();\n\n//# sourceURL=webpack://3d_game/./src/index.js?")},"./node_modules/cannon-es/dist/cannon-es.js":function _node_modules_cannonEs_dist_cannonEsJs(__unused_webpack_module,__webpack_exports__,__webpack_require__){eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AABB: () => (/* binding */ AABB),\n/* harmony export */ ArrayCollisionMatrix: () => (/* binding */ ArrayCollisionMatrix),\n/* harmony export */ BODY_SLEEP_STATES: () => (/* binding */ BODY_SLEEP_STATES),\n/* harmony export */ BODY_TYPES: () => (/* binding */ BODY_TYPES),\n/* harmony export */ Body: () => (/* binding */ Body),\n/* harmony export */ Box: () => (/* binding */ Box),\n/* harmony export */ Broadphase: () => (/* binding */ Broadphase),\n/* harmony export */ COLLISION_TYPES: () => (/* binding */ COLLISION_TYPES),\n/* harmony export */ ConeTwistConstraint: () => (/* binding */ ConeTwistConstraint),\n/* harmony export */ Constraint: () => (/* binding */ Constraint),\n/* harmony export */ ContactEquation: () => (/* binding */ ContactEquation),\n/* harmony export */ ContactMaterial: () => (/* binding */ ContactMaterial),\n/* harmony export */ ConvexPolyhedron: () => (/* binding */ ConvexPolyhedron),\n/* harmony export */ Cylinder: () => (/* binding */ Cylinder),\n/* harmony export */ DistanceConstraint: () => (/* binding */ DistanceConstraint),\n/* harmony export */ Equation: () => (/* binding */ Equation),\n/* harmony export */ EventTarget: () => (/* binding */ EventTarget),\n/* harmony export */ FrictionEquation: () => (/* binding */ FrictionEquation),\n/* harmony export */ GSSolver: () => (/* binding */ GSSolver),\n/* harmony export */ GridBroadphase: () => (/* binding */ GridBroadphase),\n/* harmony export */ Heightfield: () => (/* binding */ Heightfield),\n/* harmony export */ HingeConstraint: () => (/* binding */ HingeConstraint),\n/* harmony export */ JacobianElement: () => (/* binding */ JacobianElement),\n/* harmony export */ LockConstraint: () => (/* binding */ LockConstraint),\n/* harmony export */ Mat3: () => (/* binding */ Mat3),\n/* harmony export */ Material: () => (/* binding */ Material),\n/* harmony export */ NaiveBroadphase: () => (/* binding */ NaiveBroadphase),\n/* harmony export */ Narrowphase: () => (/* binding */ Narrowphase),\n/* harmony export */ ObjectCollisionMatrix: () => (/* binding */ ObjectCollisionMatrix),\n/* harmony export */ Particle: () => (/* binding */ Particle),\n/* harmony export */ Plane: () => (/* binding */ Plane),\n/* harmony export */ PointToPointConstraint: () => (/* binding */ PointToPointConstraint),\n/* harmony export */ Pool: () => (/* binding */ Pool),\n/* harmony export */ Quaternion: () => (/* binding */ Quaternion),\n/* harmony export */ RAY_MODES: () => (/* binding */ RAY_MODES),\n/* harmony export */ Ray: () => (/* binding */ Ray),\n/* harmony export */ RaycastResult: () => (/* binding */ RaycastResult),\n/* harmony export */ RaycastVehicle: () => (/* binding */ RaycastVehicle),\n/* harmony export */ RigidVehicle: () => (/* binding */ RigidVehicle),\n/* harmony export */ RotationalEquation: () => (/* binding */ RotationalEquation),\n/* harmony export */ RotationalMotorEquation: () => (/* binding */ RotationalMotorEquation),\n/* harmony export */ SAPBroadphase: () => (/* binding */ SAPBroadphase),\n/* harmony export */ SHAPE_TYPES: () => (/* binding */ SHAPE_TYPES),\n/* harmony export */ SPHSystem: () => (/* binding */ SPHSystem),\n/* harmony export */ Shape: () => (/* binding */ Shape),\n/* harmony export */ Solver: () => (/* binding */ Solver),\n/* harmony export */ Sphere: () => (/* binding */ Sphere),\n/* harmony export */ SplitSolver: () => (/* binding */ SplitSolver),\n/* harmony export */ Spring: () => (/* binding */ Spring),\n/* harmony export */ Transform: () => (/* binding */ Transform),\n/* harmony export */ Trimesh: () => (/* binding */ Trimesh),\n/* harmony export */ Vec3: () => (/* binding */ Vec3),\n/* harmony export */ Vec3Pool: () => (/* binding */ Vec3Pool),\n/* harmony export */ WheelInfo: () => (/* binding */ WheelInfo),\n/* harmony export */ World: () => (/* binding */ World)\n/* harmony export */ });\n/**\n * Records what objects are colliding with each other\n */\nclass ObjectCollisionMatrix {\n /**\n * The matrix storage.\n */\n\n /**\n * @todo Remove useless constructor\n */\n constructor() {\n this.matrix = {};\n }\n /**\n * get\n */\n\n\n get(bi, bj) {\n let {\n id: i\n } = bi;\n let {\n id: j\n } = bj;\n\n if (j > i) {\n const temp = j;\n j = i;\n i = temp;\n }\n\n return `${i}-${j}` in this.matrix;\n }\n /**\n * set\n */\n\n\n set(bi, bj, value) {\n let {\n id: i\n } = bi;\n let {\n id: j\n } = bj;\n\n if (j > i) {\n const temp = j;\n j = i;\n i = temp;\n }\n\n if (value) {\n this.matrix[`${i}-${j}`] = true;\n } else {\n delete this.matrix[`${i}-${j}`];\n }\n }\n /**\n * Empty the matrix\n */\n\n\n reset() {\n this.matrix = {};\n }\n /**\n * Set max number of objects\n */\n\n\n setNumObjects(n) {}\n\n}\n\n/**\n * A 3x3 matrix.\n * Authored by {@link http://github.com/schteppe/ schteppe}\n */\nclass Mat3 {\n /**\n * A vector of length 9, containing all matrix elements.\n */\n\n /**\n * @param elements A vector of length 9, containing all matrix elements.\n */\n constructor(elements) {\n if (elements === void 0) {\n elements = [0, 0, 0, 0, 0, 0, 0, 0, 0];\n }\n\n this.elements = elements;\n }\n /**\n * Sets the matrix to identity\n * @todo Should perhaps be renamed to `setIdentity()` to be more clear.\n * @todo Create another function that immediately creates an identity matrix eg. `eye()`\n */\n\n\n identity() {\n const e = this.elements;\n e[0] = 1;\n e[1] = 0;\n e[2] = 0;\n e[3] = 0;\n e[4] = 1;\n e[5] = 0;\n e[6] = 0;\n e[7] = 0;\n e[8] = 1;\n }\n /**\n * Set all elements to zero\n */\n\n\n setZero() {\n const e = this.elements;\n e[0] = 0;\n e[1] = 0;\n e[2] = 0;\n e[3] = 0;\n e[4] = 0;\n e[5] = 0;\n e[6] = 0;\n e[7] = 0;\n e[8] = 0;\n }\n /**\n * Sets the matrix diagonal elements from a Vec3\n */\n\n\n setTrace(vector) {\n const e = this.elements;\n e[0] = vector.x;\n e[4] = vector.y;\n e[8] = vector.z;\n }\n /**\n * Gets the matrix diagonal elements\n */\n\n\n getTrace(target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n const e = this.elements;\n target.x = e[0];\n target.y = e[4];\n target.z = e[8];\n return target;\n }\n /**\n * Matrix-Vector multiplication\n * @param v The vector to multiply with\n * @param target Optional, target to save the result in.\n */\n\n\n vmult(v, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n const e = this.elements;\n const x = v.x;\n const y = v.y;\n const z = v.z;\n target.x = e[0] * x + e[1] * y + e[2] * z;\n target.y = e[3] * x + e[4] * y + e[5] * z;\n target.z = e[6] * x + e[7] * y + e[8] * z;\n return target;\n }\n /**\n * Matrix-scalar multiplication\n */\n\n\n smult(s) {\n for (let i = 0; i < this.elements.length; i++) {\n this.elements[i] *= s;\n }\n }\n /**\n * Matrix multiplication\n * @param matrix Matrix to multiply with from left side.\n */\n\n\n mmult(matrix, target) {\n if (target === void 0) {\n target = new Mat3();\n }\n\n const A = this.elements;\n const B = matrix.elements;\n const T = target.elements;\n const a11 = A[0],\n a12 = A[1],\n a13 = A[2],\n a21 = A[3],\n a22 = A[4],\n a23 = A[5],\n a31 = A[6],\n a32 = A[7],\n a33 = A[8];\n const b11 = B[0],\n b12 = B[1],\n b13 = B[2],\n b21 = B[3],\n b22 = B[4],\n b23 = B[5],\n b31 = B[6],\n b32 = B[7],\n b33 = B[8];\n T[0] = a11 * b11 + a12 * b21 + a13 * b31;\n T[1] = a11 * b12 + a12 * b22 + a13 * b32;\n T[2] = a11 * b13 + a12 * b23 + a13 * b33;\n T[3] = a21 * b11 + a22 * b21 + a23 * b31;\n T[4] = a21 * b12 + a22 * b22 + a23 * b32;\n T[5] = a21 * b13 + a22 * b23 + a23 * b33;\n T[6] = a31 * b11 + a32 * b21 + a33 * b31;\n T[7] = a31 * b12 + a32 * b22 + a33 * b32;\n T[8] = a31 * b13 + a32 * b23 + a33 * b33;\n return target;\n }\n /**\n * Scale each column of the matrix\n */\n\n\n scale(vector, target) {\n if (target === void 0) {\n target = new Mat3();\n }\n\n const e = this.elements;\n const t = target.elements;\n\n for (let i = 0; i !== 3; i++) {\n t[3 * i + 0] = vector.x * e[3 * i + 0];\n t[3 * i + 1] = vector.y * e[3 * i + 1];\n t[3 * i + 2] = vector.z * e[3 * i + 2];\n }\n\n return target;\n }\n /**\n * Solve Ax=b\n * @param b The right hand side\n * @param target Optional. Target vector to save in.\n * @return The solution x\n * @todo should reuse arrays\n */\n\n\n solve(b, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n // Construct equations\n const nr = 3; // num rows\n\n const nc = 4; // num cols\n\n const eqns = [];\n let i;\n let j;\n\n for (i = 0; i < nr * nc; i++) {\n eqns.push(0);\n }\n\n for (i = 0; i < 3; i++) {\n for (j = 0; j < 3; j++) {\n eqns[i + nc * j] = this.elements[i + 3 * j];\n }\n }\n\n eqns[3 + 4 * 0] = b.x;\n eqns[3 + 4 * 1] = b.y;\n eqns[3 + 4 * 2] = b.z; // Compute right upper triangular version of the matrix - Gauss elimination\n\n let n = 3;\n const k = n;\n let np;\n const kp = 4; // num rows\n\n let p;\n\n do {\n i = k - n;\n\n if (eqns[i + nc * i] === 0) {\n // the pivot is null, swap lines\n for (j = i + 1; j < k; j++) {\n if (eqns[i + nc * j] !== 0) {\n np = kp;\n\n do {\n // do ligne( i ) = ligne( i ) + ligne( k )\n p = kp - np;\n eqns[p + nc * i] += eqns[p + nc * j];\n } while (--np);\n\n break;\n }\n }\n }\n\n if (eqns[i + nc * i] !== 0) {\n for (j = i + 1; j < k; j++) {\n const multiplier = eqns[i + nc * j] / eqns[i + nc * i];\n np = kp;\n\n do {\n // do ligne( k ) = ligne( k ) - multiplier * ligne( i )\n p = kp - np;\n eqns[p + nc * j] = p <= i ? 0 : eqns[p + nc * j] - eqns[p + nc * i] * multiplier;\n } while (--np);\n }\n }\n } while (--n); // Get the solution\n\n\n target.z = eqns[2 * nc + 3] / eqns[2 * nc + 2];\n target.y = (eqns[1 * nc + 3] - eqns[1 * nc + 2] * target.z) / eqns[1 * nc + 1];\n target.x = (eqns[0 * nc + 3] - eqns[0 * nc + 2] * target.z - eqns[0 * nc + 1] * target.y) / eqns[0 * nc + 0];\n\n if (isNaN(target.x) || isNaN(target.y) || isNaN(target.z) || target.x === Infinity || target.y === Infinity || target.z === Infinity) {\n throw `Could not solve equation! Got x=[${target.toString()}], b=[${b.toString()}], A=[${this.toString()}]`;\n }\n\n return target;\n }\n /**\n * Get an element in the matrix by index. Index starts at 0, not 1!!!\n * @param value If provided, the matrix element will be set to this value.\n */\n\n\n e(row, column, value) {\n if (value === undefined) {\n return this.elements[column + 3 * row];\n } else {\n // Set value\n this.elements[column + 3 * row] = value;\n }\n }\n /**\n * Copy another matrix into this matrix object.\n */\n\n\n copy(matrix) {\n for (let i = 0; i < matrix.elements.length; i++) {\n this.elements[i] = matrix.elements[i];\n }\n\n return this;\n }\n /**\n * Returns a string representation of the matrix.\n */\n\n\n toString() {\n let r = '';\n const sep = ',';\n\n for (let i = 0; i < 9; i++) {\n r += this.elements[i] + sep;\n }\n\n return r;\n }\n /**\n * reverse the matrix\n * @param target Target matrix to save in.\n * @return The solution x\n */\n\n\n reverse(target) {\n if (target === void 0) {\n target = new Mat3();\n }\n\n // Construct equations\n const nr = 3; // num rows\n\n const nc = 6; // num cols\n\n const eqns = reverse_eqns;\n let i;\n let j;\n\n for (i = 0; i < 3; i++) {\n for (j = 0; j < 3; j++) {\n eqns[i + nc * j] = this.elements[i + 3 * j];\n }\n }\n\n eqns[3 + 6 * 0] = 1;\n eqns[3 + 6 * 1] = 0;\n eqns[3 + 6 * 2] = 0;\n eqns[4 + 6 * 0] = 0;\n eqns[4 + 6 * 1] = 1;\n eqns[4 + 6 * 2] = 0;\n eqns[5 + 6 * 0] = 0;\n eqns[5 + 6 * 1] = 0;\n eqns[5 + 6 * 2] = 1; // Compute right upper triangular version of the matrix - Gauss elimination\n\n let n = 3;\n const k = n;\n let np;\n const kp = nc; // num rows\n\n let p;\n\n do {\n i = k - n;\n\n if (eqns[i + nc * i] === 0) {\n // the pivot is null, swap lines\n for (j = i + 1; j < k; j++) {\n if (eqns[i + nc * j] !== 0) {\n np = kp;\n\n do {\n // do line( i ) = line( i ) + line( k )\n p = kp - np;\n eqns[p + nc * i] += eqns[p + nc * j];\n } while (--np);\n\n break;\n }\n }\n }\n\n if (eqns[i + nc * i] !== 0) {\n for (j = i + 1; j < k; j++) {\n const multiplier = eqns[i + nc * j] / eqns[i + nc * i];\n np = kp;\n\n do {\n // do line( k ) = line( k ) - multiplier * line( i )\n p = kp - np;\n eqns[p + nc * j] = p <= i ? 0 : eqns[p + nc * j] - eqns[p + nc * i] * multiplier;\n } while (--np);\n }\n }\n } while (--n); // eliminate the upper left triangle of the matrix\n\n\n i = 2;\n\n do {\n j = i - 1;\n\n do {\n const multiplier = eqns[i + nc * j] / eqns[i + nc * i];\n np = nc;\n\n do {\n p = nc - np;\n eqns[p + nc * j] = eqns[p + nc * j] - eqns[p + nc * i] * multiplier;\n } while (--np);\n } while (j--);\n } while (--i); // operations on the diagonal\n\n\n i = 2;\n\n do {\n const multiplier = 1 / eqns[i + nc * i];\n np = nc;\n\n do {\n p = nc - np;\n eqns[p + nc * i] = eqns[p + nc * i] * multiplier;\n } while (--np);\n } while (i--);\n\n i = 2;\n\n do {\n j = 2;\n\n do {\n p = eqns[nr + j + nc * i];\n\n if (isNaN(p) || p === Infinity) {\n throw `Could not reverse! A=[${this.toString()}]`;\n }\n\n target.e(i, j, p);\n } while (j--);\n } while (i--);\n\n return target;\n }\n /**\n * Set the matrix from a quaterion\n */\n\n\n setRotationFromQuaternion(q) {\n const x = q.x;\n const y = q.y;\n const z = q.z;\n const w = q.w;\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const xy = x * y2;\n const xz = x * z2;\n const yy = y * y2;\n const yz = y * z2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n const e = this.elements;\n e[3 * 0 + 0] = 1 - (yy + zz);\n e[3 * 0 + 1] = xy - wz;\n e[3 * 0 + 2] = xz + wy;\n e[3 * 1 + 0] = xy + wz;\n e[3 * 1 + 1] = 1 - (xx + zz);\n e[3 * 1 + 2] = yz - wx;\n e[3 * 2 + 0] = xz - wy;\n e[3 * 2 + 1] = yz + wx;\n e[3 * 2 + 2] = 1 - (xx + yy);\n return this;\n }\n /**\n * Transpose the matrix\n * @param target Optional. Where to store the result.\n * @return The target Mat3, or a new Mat3 if target was omitted.\n */\n\n\n transpose(target) {\n if (target === void 0) {\n target = new Mat3();\n }\n\n const M = this.elements;\n const T = target.elements;\n let tmp; //Set diagonals\n\n T[0] = M[0];\n T[4] = M[4];\n T[8] = M[8];\n tmp = M[1];\n T[1] = M[3];\n T[3] = tmp;\n tmp = M[2];\n T[2] = M[6];\n T[6] = tmp;\n tmp = M[5];\n T[5] = M[7];\n T[7] = tmp;\n return target;\n }\n\n}\nconst reverse_eqns = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n\n/**\n * 3-dimensional vector\n * @example\n * const v = new Vec3(1, 2, 3)\n * console.log('x=' + v.x) // x=1\n */\n\nclass Vec3 {\n constructor(x, y, z) {\n if (x === void 0) {\n x = 0.0;\n }\n\n if (y === void 0) {\n y = 0.0;\n }\n\n if (z === void 0) {\n z = 0.0;\n }\n\n this.x = x;\n this.y = y;\n this.z = z;\n }\n /**\n * Vector cross product\n * @param target Optional target to save in.\n */\n\n\n cross(vector, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n const vx = vector.x;\n const vy = vector.y;\n const vz = vector.z;\n const x = this.x;\n const y = this.y;\n const z = this.z;\n target.x = y * vz - z * vy;\n target.y = z * vx - x * vz;\n target.z = x * vy - y * vx;\n return target;\n }\n /**\n * Set the vectors' 3 elements\n */\n\n\n set(x, y, z) {\n this.x = x;\n this.y = y;\n this.z = z;\n return this;\n }\n /**\n * Set all components of the vector to zero.\n */\n\n\n setZero() {\n this.x = this.y = this.z = 0;\n }\n /**\n * Vector addition\n */\n\n\n vadd(vector, target) {\n if (target) {\n target.x = vector.x + this.x;\n target.y = vector.y + this.y;\n target.z = vector.z + this.z;\n } else {\n return new Vec3(this.x + vector.x, this.y + vector.y, this.z + vector.z);\n }\n }\n /**\n * Vector subtraction\n * @param target Optional target to save in.\n */\n\n\n vsub(vector, target) {\n if (target) {\n target.x = this.x - vector.x;\n target.y = this.y - vector.y;\n target.z = this.z - vector.z;\n } else {\n return new Vec3(this.x - vector.x, this.y - vector.y, this.z - vector.z);\n }\n }\n /**\n * Get the cross product matrix a_cross from a vector, such that a x b = a_cross * b = c\n *\n * See {@link https://www8.cs.umu.se/kurser/TDBD24/VT06/lectures/Lecture6.pdf Umeå University Lecture}\n */\n\n\n crossmat() {\n return new Mat3([0, -this.z, this.y, this.z, 0, -this.x, -this.y, this.x, 0]);\n }\n /**\n * Normalize the vector. Note that this changes the values in the vector.\n * @return Returns the norm of the vector\n */\n\n\n normalize() {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n const n = Math.sqrt(x * x + y * y + z * z);\n\n if (n > 0.0) {\n const invN = 1 / n;\n this.x *= invN;\n this.y *= invN;\n this.z *= invN;\n } else {\n // Make something up\n this.x = 0;\n this.y = 0;\n this.z = 0;\n }\n\n return n;\n }\n /**\n * Get the version of this vector that is of length 1.\n * @param target Optional target to save in\n * @return Returns the unit vector\n */\n\n\n unit(target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n const x = this.x;\n const y = this.y;\n const z = this.z;\n let ninv = Math.sqrt(x * x + y * y + z * z);\n\n if (ninv > 0.0) {\n ninv = 1.0 / ninv;\n target.x = x * ninv;\n target.y = y * ninv;\n target.z = z * ninv;\n } else {\n target.x = 1;\n target.y = 0;\n target.z = 0;\n }\n\n return target;\n }\n /**\n * Get the length of the vector\n */\n\n\n length() {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n return Math.sqrt(x * x + y * y + z * z);\n }\n /**\n * Get the squared length of the vector.\n */\n\n\n lengthSquared() {\n return this.dot(this);\n }\n /**\n * Get distance from this point to another point\n */\n\n\n distanceTo(p) {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n const px = p.x;\n const py = p.y;\n const pz = p.z;\n return Math.sqrt((px - x) * (px - x) + (py - y) * (py - y) + (pz - z) * (pz - z));\n }\n /**\n * Get squared distance from this point to another point\n */\n\n\n distanceSquared(p) {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n const px = p.x;\n const py = p.y;\n const pz = p.z;\n return (px - x) * (px - x) + (py - y) * (py - y) + (pz - z) * (pz - z);\n }\n /**\n * Multiply all the components of the vector with a scalar.\n * @param target The vector to save the result in.\n */\n\n\n scale(scalar, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n const x = this.x;\n const y = this.y;\n const z = this.z;\n target.x = scalar * x;\n target.y = scalar * y;\n target.z = scalar * z;\n return target;\n }\n /**\n * Multiply the vector with an other vector, component-wise.\n * @param target The vector to save the result in.\n */\n\n\n vmul(vector, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n target.x = vector.x * this.x;\n target.y = vector.y * this.y;\n target.z = vector.z * this.z;\n return target;\n }\n /**\n * Scale a vector and add it to this vector. Save the result in \"target\". (target = this + vector * scalar)\n * @param target The vector to save the result in.\n */\n\n\n addScaledVector(scalar, vector, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n target.x = this.x + scalar * vector.x;\n target.y = this.y + scalar * vector.y;\n target.z = this.z + scalar * vector.z;\n return target;\n }\n /**\n * Calculate dot product\n * @param vector\n */\n\n\n dot(vector) {\n return this.x * vector.x + this.y * vector.y + this.z * vector.z;\n }\n\n isZero() {\n return this.x === 0 && this.y === 0 && this.z === 0;\n }\n /**\n * Make the vector point in the opposite direction.\n * @param target Optional target to save in\n */\n\n\n negate(target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n target.x = -this.x;\n target.y = -this.y;\n target.z = -this.z;\n return target;\n }\n /**\n * Compute two artificial tangents to the vector\n * @param t1 Vector object to save the first tangent in\n * @param t2 Vector object to save the second tangent in\n */\n\n\n tangents(t1, t2) {\n const norm = this.length();\n\n if (norm > 0.0) {\n const n = Vec3_tangents_n;\n const inorm = 1 / norm;\n n.set(this.x * inorm, this.y * inorm, this.z * inorm);\n const randVec = Vec3_tangents_randVec;\n\n if (Math.abs(n.x) < 0.9) {\n randVec.set(1, 0, 0);\n n.cross(randVec, t1);\n } else {\n randVec.set(0, 1, 0);\n n.cross(randVec, t1);\n }\n\n n.cross(t1, t2);\n } else {\n // The normal length is zero, make something up\n t1.set(1, 0, 0);\n t2.set(0, 1, 0);\n }\n }\n /**\n * Converts to a more readable format\n */\n\n\n toString() {\n return `${this.x},${this.y},${this.z}`;\n }\n /**\n * Converts to an array\n */\n\n\n toArray() {\n return [this.x, this.y, this.z];\n }\n /**\n * Copies value of source to this vector.\n */\n\n\n copy(vector) {\n this.x = vector.x;\n this.y = vector.y;\n this.z = vector.z;\n return this;\n }\n /**\n * Do a linear interpolation between two vectors\n * @param t A number between 0 and 1. 0 will make this function return u, and 1 will make it return v. Numbers in between will generate a vector in between them.\n */\n\n\n lerp(vector, t, target) {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n target.x = x + (vector.x - x) * t;\n target.y = y + (vector.y - y) * t;\n target.z = z + (vector.z - z) * t;\n }\n /**\n * Check if a vector equals is almost equal to another one.\n */\n\n\n almostEquals(vector, precision) {\n if (precision === void 0) {\n precision = 1e-6;\n }\n\n if (Math.abs(this.x - vector.x) > precision || Math.abs(this.y - vector.y) > precision || Math.abs(this.z - vector.z) > precision) {\n return false;\n }\n\n return true;\n }\n /**\n * Check if a vector is almost zero\n */\n\n\n almostZero(precision) {\n if (precision === void 0) {\n precision = 1e-6;\n }\n\n if (Math.abs(this.x) > precision || Math.abs(this.y) > precision || Math.abs(this.z) > precision) {\n return false;\n }\n\n return true;\n }\n /**\n * Check if the vector is anti-parallel to another vector.\n * @param precision Set to zero for exact comparisons\n */\n\n\n isAntiparallelTo(vector, precision) {\n this.negate(antip_neg);\n return antip_neg.almostEquals(vector, precision);\n }\n /**\n * Clone the vector\n */\n\n\n clone() {\n return new Vec3(this.x, this.y, this.z);\n }\n\n}\nVec3.ZERO = new Vec3(0, 0, 0);\nVec3.UNIT_X = new Vec3(1, 0, 0);\nVec3.UNIT_Y = new Vec3(0, 1, 0);\nVec3.UNIT_Z = new Vec3(0, 0, 1);\nconst Vec3_tangents_n = new Vec3();\nconst Vec3_tangents_randVec = new Vec3();\nconst antip_neg = new Vec3();\n\n/**\n * Axis aligned bounding box class.\n */\nclass AABB {\n /**\n * The lower bound of the bounding box\n */\n\n /**\n * The upper bound of the bounding box\n */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n this.lowerBound = new Vec3();\n this.upperBound = new Vec3();\n\n if (options.lowerBound) {\n this.lowerBound.copy(options.lowerBound);\n }\n\n if (options.upperBound) {\n this.upperBound.copy(options.upperBound);\n }\n }\n /**\n * Set the AABB bounds from a set of points.\n * @param points An array of Vec3's.\n * @return The self object\n */\n\n\n setFromPoints(points, position, quaternion, skinSize) {\n const l = this.lowerBound;\n const u = this.upperBound;\n const q = quaternion; // Set to the first point\n\n l.copy(points[0]);\n\n if (q) {\n q.vmult(l, l);\n }\n\n u.copy(l);\n\n for (let i = 1; i < points.length; i++) {\n let p = points[i];\n\n if (q) {\n q.vmult(p, tmp$1);\n p = tmp$1;\n }\n\n if (p.x > u.x) {\n u.x = p.x;\n }\n\n if (p.x < l.x) {\n l.x = p.x;\n }\n\n if (p.y > u.y) {\n u.y = p.y;\n }\n\n if (p.y < l.y) {\n l.y = p.y;\n }\n\n if (p.z > u.z) {\n u.z = p.z;\n }\n\n if (p.z < l.z) {\n l.z = p.z;\n }\n } // Add offset\n\n\n if (position) {\n position.vadd(l, l);\n position.vadd(u, u);\n }\n\n if (skinSize) {\n l.x -= skinSize;\n l.y -= skinSize;\n l.z -= skinSize;\n u.x += skinSize;\n u.y += skinSize;\n u.z += skinSize;\n }\n\n return this;\n }\n /**\n * Copy bounds from an AABB to this AABB\n * @param aabb Source to copy from\n * @return The this object, for chainability\n */\n\n\n copy(aabb) {\n this.lowerBound.copy(aabb.lowerBound);\n this.upperBound.copy(aabb.upperBound);\n return this;\n }\n /**\n * Clone an AABB\n */\n\n\n clone() {\n return new AABB().copy(this);\n }\n /**\n * Extend this AABB so that it covers the given AABB too.\n */\n\n\n extend(aabb) {\n this.lowerBound.x = Math.min(this.lowerBound.x, aabb.lowerBound.x);\n this.upperBound.x = Math.max(this.upperBound.x, aabb.upperBound.x);\n this.lowerBound.y = Math.min(this.lowerBound.y, aabb.lowerBound.y);\n this.upperBound.y = Math.max(this.upperBound.y, aabb.upperBound.y);\n this.lowerBound.z = Math.min(this.lowerBound.z, aabb.lowerBound.z);\n this.upperBound.z = Math.max(this.upperBound.z, aabb.upperBound.z);\n }\n /**\n * Returns true if the given AABB overlaps this AABB.\n */\n\n\n overlaps(aabb) {\n const l1 = this.lowerBound;\n const u1 = this.upperBound;\n const l2 = aabb.lowerBound;\n const u2 = aabb.upperBound; // l2 u2\n // |---------|\n // |--------|\n // l1 u1\n\n const overlapsX = l2.x <= u1.x && u1.x <= u2.x || l1.x <= u2.x && u2.x <= u1.x;\n const overlapsY = l2.y <= u1.y && u1.y <= u2.y || l1.y <= u2.y && u2.y <= u1.y;\n const overlapsZ = l2.z <= u1.z && u1.z <= u2.z || l1.z <= u2.z && u2.z <= u1.z;\n return overlapsX && overlapsY && overlapsZ;\n } // Mostly for debugging\n\n\n volume() {\n const l = this.lowerBound;\n const u = this.upperBound;\n return (u.x - l.x) * (u.y - l.y) * (u.z - l.z);\n }\n /**\n * Returns true if the given AABB is fully contained in this AABB.\n */\n\n\n contains(aabb) {\n const l1 = this.lowerBound;\n const u1 = this.upperBound;\n const l2 = aabb.lowerBound;\n const u2 = aabb.upperBound; // l2 u2\n // |---------|\n // |---------------|\n // l1 u1\n\n return l1.x <= l2.x && u1.x >= u2.x && l1.y <= l2.y && u1.y >= u2.y && l1.z <= l2.z && u1.z >= u2.z;\n }\n\n getCorners(a, b, c, d, e, f, g, h) {\n const l = this.lowerBound;\n const u = this.upperBound;\n a.copy(l);\n b.set(u.x, l.y, l.z);\n c.set(u.x, u.y, l.z);\n d.set(l.x, u.y, u.z);\n e.set(u.x, l.y, u.z);\n f.set(l.x, u.y, l.z);\n g.set(l.x, l.y, u.z);\n h.copy(u);\n }\n /**\n * Get the representation of an AABB in another frame.\n * @return The \"target\" AABB object.\n */\n\n\n toLocalFrame(frame, target) {\n const corners = transformIntoFrame_corners;\n const a = corners[0];\n const b = corners[1];\n const c = corners[2];\n const d = corners[3];\n const e = corners[4];\n const f = corners[5];\n const g = corners[6];\n const h = corners[7]; // Get corners in current frame\n\n this.getCorners(a, b, c, d, e, f, g, h); // Transform them to new local frame\n\n for (let i = 0; i !== 8; i++) {\n const corner = corners[i];\n frame.pointToLocal(corner, corner);\n }\n\n return target.setFromPoints(corners);\n }\n /**\n * Get the representation of an AABB in the global frame.\n * @return The \"target\" AABB object.\n */\n\n\n toWorldFrame(frame, target) {\n const corners = transformIntoFrame_corners;\n const a = corners[0];\n const b = corners[1];\n const c = corners[2];\n const d = corners[3];\n const e = corners[4];\n const f = corners[5];\n const g = corners[6];\n const h = corners[7]; // Get corners in current frame\n\n this.getCorners(a, b, c, d, e, f, g, h); // Transform them to new local frame\n\n for (let i = 0; i !== 8; i++) {\n const corner = corners[i];\n frame.pointToWorld(corner, corner);\n }\n\n return target.setFromPoints(corners);\n }\n /**\n * Check if the AABB is hit by a ray.\n */\n\n\n overlapsRay(ray) {\n const {\n direction,\n from\n } = ray; // const t = 0\n // ray.direction is unit direction vector of ray\n\n const dirFracX = 1 / direction.x;\n const dirFracY = 1 / direction.y;\n const dirFracZ = 1 / direction.z; // this.lowerBound is the corner of AABB with minimal coordinates - left bottom, rt is maximal corner\n\n const t1 = (this.lowerBound.x - from.x) * dirFracX;\n const t2 = (this.upperBound.x - from.x) * dirFracX;\n const t3 = (this.lowerBound.y - from.y) * dirFracY;\n const t4 = (this.upperBound.y - from.y) * dirFracY;\n const t5 = (this.lowerBound.z - from.z) * dirFracZ;\n const t6 = (this.upperBound.z - from.z) * dirFracZ; // const tmin = Math.max(Math.max(Math.min(t1, t2), Math.min(t3, t4)));\n // const tmax = Math.min(Math.min(Math.max(t1, t2), Math.max(t3, t4)));\n\n const tmin = Math.max(Math.max(Math.min(t1, t2), Math.min(t3, t4)), Math.min(t5, t6));\n const tmax = Math.min(Math.min(Math.max(t1, t2), Math.max(t3, t4)), Math.max(t5, t6)); // if tmax < 0, ray (line) is intersecting AABB, but whole AABB is behing us\n\n if (tmax < 0) {\n //t = tmax;\n return false;\n } // if tmin > tmax, ray doesn't intersect AABB\n\n\n if (tmin > tmax) {\n //t = tmax;\n return false;\n }\n\n return true;\n }\n\n}\nconst tmp$1 = new Vec3();\nconst transformIntoFrame_corners = [new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3()];\n\n/**\n * Collision \"matrix\".\n * It's actually a triangular-shaped array of whether two bodies are touching this step, for reference next step\n */\nclass ArrayCollisionMatrix {\n /**\n * The matrix storage.\n */\n constructor() {\n this.matrix = [];\n }\n /**\n * Get an element\n */\n\n\n get(bi, bj) {\n let {\n index: i\n } = bi;\n let {\n index: j\n } = bj;\n\n if (j > i) {\n const temp = j;\n j = i;\n i = temp;\n }\n\n return this.matrix[(i * (i + 1) >> 1) + j - 1];\n }\n /**\n * Set an element\n */\n\n\n set(bi, bj, value) {\n let {\n index: i\n } = bi;\n let {\n index: j\n } = bj;\n\n if (j > i) {\n const temp = j;\n j = i;\n i = temp;\n }\n\n this.matrix[(i * (i + 1) >> 1) + j - 1] = value ? 1 : 0;\n }\n /**\n * Sets all elements to zero\n */\n\n\n reset() {\n for (let i = 0, l = this.matrix.length; i !== l; i++) {\n this.matrix[i] = 0;\n }\n }\n /**\n * Sets the max number of objects\n */\n\n\n setNumObjects(n) {\n this.matrix.length = n * (n - 1) >> 1;\n }\n\n}\n\n/**\n * Base class for objects that dispatches events.\n */\nclass EventTarget {\n /**\n * Add an event listener\n * @return The self object, for chainability.\n */\n addEventListener(type, listener) {\n if (this._listeners === undefined) {\n this._listeners = {};\n }\n\n const listeners = this._listeners;\n\n if (listeners[type] === undefined) {\n listeners[type] = [];\n }\n\n if (!listeners[type].includes(listener)) {\n listeners[type].push(listener);\n }\n\n return this;\n }\n /**\n * Check if an event listener is added\n */\n\n\n hasEventListener(type, listener) {\n if (this._listeners === undefined) {\n return false;\n }\n\n const listeners = this._listeners;\n\n if (listeners[type] !== undefined && listeners[type].includes(listener)) {\n return true;\n }\n\n return false;\n }\n /**\n * Check if any event listener of the given type is added\n */\n\n\n hasAnyEventListener(type) {\n if (this._listeners === undefined) {\n return false;\n }\n\n const listeners = this._listeners;\n return listeners[type] !== undefined;\n }\n /**\n * Remove an event listener\n * @return The self object, for chainability.\n */\n\n\n removeEventListener(type, listener) {\n if (this._listeners === undefined) {\n return this;\n }\n\n const listeners = this._listeners;\n\n if (listeners[type] === undefined) {\n return this;\n }\n\n const index = listeners[type].indexOf(listener);\n\n if (index !== -1) {\n listeners[type].splice(index, 1);\n }\n\n return this;\n }\n /**\n * Emit an event.\n * @return The self object, for chainability.\n */\n\n\n dispatchEvent(event) {\n if (this._listeners === undefined) {\n return this;\n }\n\n const listeners = this._listeners;\n const listenerArray = listeners[event.type];\n\n if (listenerArray !== undefined) {\n event.target = this;\n\n for (let i = 0, l = listenerArray.length; i < l; i++) {\n listenerArray[i].call(this, event);\n }\n }\n\n return this;\n }\n\n}\n\n/**\n * A Quaternion describes a rotation in 3D space. The Quaternion is mathematically defined as Q = x*i + y*j + z*k + w, where (i,j,k) are imaginary basis vectors. (x,y,z) can be seen as a vector related to the axis of rotation, while the real multiplier, w, is related to the amount of rotation.\n * @param x Multiplier of the imaginary basis vector i.\n * @param y Multiplier of the imaginary basis vector j.\n * @param z Multiplier of the imaginary basis vector k.\n * @param w Multiplier of the real part.\n * @see http://en.wikipedia.org/wiki/Quaternion\n */\n\nclass Quaternion {\n constructor(x, y, z, w) {\n if (x === void 0) {\n x = 0;\n }\n\n if (y === void 0) {\n y = 0;\n }\n\n if (z === void 0) {\n z = 0;\n }\n\n if (w === void 0) {\n w = 1;\n }\n\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n }\n /**\n * Set the value of the quaternion.\n */\n\n\n set(x, y, z, w) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n return this;\n }\n /**\n * Convert to a readable format\n * @return \"x,y,z,w\"\n */\n\n\n toString() {\n return `${this.x},${this.y},${this.z},${this.w}`;\n }\n /**\n * Convert to an Array\n * @return [x, y, z, w]\n */\n\n\n toArray() {\n return [this.x, this.y, this.z, this.w];\n }\n /**\n * Set the quaternion components given an axis and an angle in radians.\n */\n\n\n setFromAxisAngle(vector, angle) {\n const s = Math.sin(angle * 0.5);\n this.x = vector.x * s;\n this.y = vector.y * s;\n this.z = vector.z * s;\n this.w = Math.cos(angle * 0.5);\n return this;\n }\n /**\n * Converts the quaternion to [ axis, angle ] representation.\n * @param targetAxis A vector object to reuse for storing the axis.\n * @return An array, first element is the axis and the second is the angle in radians.\n */\n\n\n toAxisAngle(targetAxis) {\n if (targetAxis === void 0) {\n targetAxis = new Vec3();\n }\n\n this.normalize(); // if w>1 acos and sqrt will produce errors, this cant happen if quaternion is normalised\n\n const angle = 2 * Math.acos(this.w);\n const s = Math.sqrt(1 - this.w * this.w); // assuming quaternion normalised then w is less than 1, so term always positive.\n\n if (s < 0.001) {\n // test to avoid divide by zero, s is always positive due to sqrt\n // if s close to zero then direction of axis not important\n targetAxis.x = this.x; // if it is important that axis is normalised then replace with x=1; y=z=0;\n\n targetAxis.y = this.y;\n targetAxis.z = this.z;\n } else {\n targetAxis.x = this.x / s; // normalise axis\n\n targetAxis.y = this.y / s;\n targetAxis.z = this.z / s;\n }\n\n return [targetAxis, angle];\n }\n /**\n * Set the quaternion value given two vectors. The resulting rotation will be the needed rotation to rotate u to v.\n */\n\n\n setFromVectors(u, v) {\n if (u.isAntiparallelTo(v)) {\n const t1 = sfv_t1;\n const t2 = sfv_t2;\n u.tangents(t1, t2);\n this.setFromAxisAngle(t1, Math.PI);\n } else {\n const a = u.cross(v);\n this.x = a.x;\n this.y = a.y;\n this.z = a.z;\n this.w = Math.sqrt(u.length() ** 2 * v.length() ** 2) + u.dot(v);\n this.normalize();\n }\n\n return this;\n }\n /**\n * Multiply the quaternion with an other quaternion.\n */\n\n\n mult(quat, target) {\n if (target === void 0) {\n target = new Quaternion();\n }\n\n const ax = this.x;\n const ay = this.y;\n const az = this.z;\n const aw = this.w;\n const bx = quat.x;\n const by = quat.y;\n const bz = quat.z;\n const bw = quat.w;\n target.x = ax * bw + aw * bx + ay * bz - az * by;\n target.y = ay * bw + aw * by + az * bx - ax * bz;\n target.z = az * bw + aw * bz + ax * by - ay * bx;\n target.w = aw * bw - ax * bx - ay * by - az * bz;\n return target;\n }\n /**\n * Get the inverse quaternion rotation.\n */\n\n\n inverse(target) {\n if (target === void 0) {\n target = new Quaternion();\n }\n\n const x = this.x;\n const y = this.y;\n const z = this.z;\n const w = this.w;\n this.conjugate(target);\n const inorm2 = 1 / (x * x + y * y + z * z + w * w);\n target.x *= inorm2;\n target.y *= inorm2;\n target.z *= inorm2;\n target.w *= inorm2;\n return target;\n }\n /**\n * Get the quaternion conjugate\n */\n\n\n conjugate(target) {\n if (target === void 0) {\n target = new Quaternion();\n }\n\n target.x = -this.x;\n target.y = -this.y;\n target.z = -this.z;\n target.w = this.w;\n return target;\n }\n /**\n * Normalize the quaternion. Note that this changes the values of the quaternion.\n */\n\n\n normalize() {\n let l = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);\n\n if (l === 0) {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n this.w = 0;\n } else {\n l = 1 / l;\n this.x *= l;\n this.y *= l;\n this.z *= l;\n this.w *= l;\n }\n\n return this;\n }\n /**\n * Approximation of quaternion normalization. Works best when quat is already almost-normalized.\n * @author unphased, https://github.com/unphased\n */\n\n\n normalizeFast() {\n const f = (3.0 - (this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w)) / 2.0;\n\n if (f === 0) {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n this.w = 0;\n } else {\n this.x *= f;\n this.y *= f;\n this.z *= f;\n this.w *= f;\n }\n\n return this;\n }\n /**\n * Multiply the quaternion by a vector\n */\n\n\n vmult(v, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n const x = v.x;\n const y = v.y;\n const z = v.z;\n const qx = this.x;\n const qy = this.y;\n const qz = this.z;\n const qw = this.w; // q*v\n\n const ix = qw * x + qy * z - qz * y;\n const iy = qw * y + qz * x - qx * z;\n const iz = qw * z + qx * y - qy * x;\n const iw = -qx * x - qy * y - qz * z;\n target.x = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n target.y = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n target.z = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n return target;\n }\n /**\n * Copies value of source to this quaternion.\n * @return this\n */\n\n\n copy(quat) {\n this.x = quat.x;\n this.y = quat.y;\n this.z = quat.z;\n this.w = quat.w;\n return this;\n }\n /**\n * Convert the quaternion to euler angle representation. Order: YZX, as this page describes: https://www.euclideanspace.com/maths/standards/index.htm\n * @param order Three-character string, defaults to \"YZX\"\n */\n\n\n toEuler(target, order) {\n if (order === void 0) {\n order = 'YZX';\n }\n\n let heading;\n let attitude;\n let bank;\n const x = this.x;\n const y = this.y;\n const z = this.z;\n const w = this.w;\n\n switch (order) {\n case 'YZX':\n const test = x * y + z * w;\n\n if (test > 0.499) {\n // singularity at north pole\n heading = 2 * Math.atan2(x, w);\n attitude = Math.PI / 2;\n bank = 0;\n }\n\n if (test < -0.499) {\n // singularity at south pole\n heading = -2 * Math.atan2(x, w);\n attitude = -Math.PI / 2;\n bank = 0;\n }\n\n if (heading === undefined) {\n const sqx = x * x;\n const sqy = y * y;\n const sqz = z * z;\n heading = Math.atan2(2 * y * w - 2 * x * z, 1 - 2 * sqy - 2 * sqz); // Heading\n\n attitude = Math.asin(2 * test); // attitude\n\n bank = Math.atan2(2 * x * w - 2 * y * z, 1 - 2 * sqx - 2 * sqz); // bank\n }\n\n break;\n\n default:\n throw new Error(`Euler order ${order} not supported yet.`);\n }\n\n target.y = heading;\n target.z = attitude;\n target.x = bank;\n }\n /**\n * Set the quaternion components given Euler angle representation.\n *\n * @param order The order to apply angles: 'XYZ' or 'YXZ' or any other combination.\n *\n * See {@link https://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors MathWorks} reference\n */\n\n\n setFromEuler(x, y, z, order) {\n if (order === void 0) {\n order = 'XYZ';\n }\n\n const c1 = Math.cos(x / 2);\n const c2 = Math.cos(y / 2);\n const c3 = Math.cos(z / 2);\n const s1 = Math.sin(x / 2);\n const s2 = Math.sin(y / 2);\n const s3 = Math.sin(z / 2);\n\n if (order === 'XYZ') {\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 + s1 * s2 * c3;\n this.w = c1 * c2 * c3 - s1 * s2 * s3;\n } else if (order === 'YXZ') {\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 - s1 * s2 * c3;\n this.w = c1 * c2 * c3 + s1 * s2 * s3;\n } else if (order === 'ZXY') {\n this.x = s1 * c2 * c3 - c1 * s2 * s3;\n this.y = c1 * s2 * c3 + s1 * c2 * s3;\n this.z = c1 * c2 * s3 + s1 * s2 * c3;\n this.w = c1 * c2 * c3 - s1 * s2 * s3;\n } else if (order === 'ZYX') {\n this.x = s1 * c2 * c3 - c1 * s2 * s3;\n this.y = c1 * s2 * c3 + s1 * c2 * s3;\n this.z = c1 * c2 * s3 - s1 * s2 * c3;\n this.w = c1 * c2 * c3 + s1 * s2 * s3;\n } else if (order === 'YZX') {\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 + s1 * c2 * s3;\n this.z = c1 * c2 * s3 - s1 * s2 * c3;\n this.w = c1 * c2 * c3 - s1 * s2 * s3;\n } else if (order === 'XZY') {\n this.x = s1 * c2 * c3 - c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 + s1 * s2 * c3;\n this.w = c1 * c2 * c3 + s1 * s2 * s3;\n }\n\n return this;\n }\n\n clone() {\n return new Quaternion(this.x, this.y, this.z, this.w);\n }\n /**\n * Performs a spherical linear interpolation between two quat\n *\n * @param toQuat second operand\n * @param t interpolation amount between the self quaternion and toQuat\n * @param target A quaternion to store the result in. If not provided, a new one will be created.\n * @returns {Quaternion} The \"target\" object\n */\n\n\n slerp(toQuat, t, target) {\n if (target === void 0) {\n target = new Quaternion();\n }\n\n const ax = this.x;\n const ay = this.y;\n const az = this.z;\n const aw = this.w;\n let bx = toQuat.x;\n let by = toQuat.y;\n let bz = toQuat.z;\n let bw = toQuat.w;\n let omega;\n let cosom;\n let sinom;\n let scale0;\n let scale1; // calc cosine\n\n cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary)\n\n if (cosom < 0.0) {\n cosom = -cosom;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n } // calculate coefficients\n\n\n if (1.0 - cosom > 0.000001) {\n // standard case (slerp)\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else {\n // \"from\" and \"to\" quaternions are very close\n // ... so we can do a linear interpolation\n scale0 = 1.0 - t;\n scale1 = t;\n } // calculate final values\n\n\n target.x = scale0 * ax + scale1 * bx;\n target.y = scale0 * ay + scale1 * by;\n target.z = scale0 * az + scale1 * bz;\n target.w = scale0 * aw + scale1 * bw;\n return target;\n }\n /**\n * Rotate an absolute orientation quaternion given an angular velocity and a time step.\n */\n\n\n integrate(angularVelocity, dt, angularFactor, target) {\n if (target === void 0) {\n target = new Quaternion();\n }\n\n const ax = angularVelocity.x * angularFactor.x,\n ay = angularVelocity.y * angularFactor.y,\n az = angularVelocity.z * angularFactor.z,\n bx = this.x,\n by = this.y,\n bz = this.z,\n bw = this.w;\n const half_dt = dt * 0.5;\n target.x += half_dt * (ax * bw + ay * bz - az * by);\n target.y += half_dt * (ay * bw + az * bx - ax * bz);\n target.z += half_dt * (az * bw + ax * by - ay * bx);\n target.w += half_dt * (-ax * bx - ay * by - az * bz);\n return target;\n }\n\n}\nconst sfv_t1 = new Vec3();\nconst sfv_t2 = new Vec3();\n\n/**\n * The available shape types.\n */\nconst SHAPE_TYPES = {\n /** SPHERE */\n SPHERE: 1,\n\n /** PLANE */\n PLANE: 2,\n\n /** BOX */\n BOX: 4,\n\n /** COMPOUND */\n COMPOUND: 8,\n\n /** CONVEXPOLYHEDRON */\n CONVEXPOLYHEDRON: 16,\n\n /** HEIGHTFIELD */\n HEIGHTFIELD: 32,\n\n /** PARTICLE */\n PARTICLE: 64,\n\n /** CYLINDER */\n CYLINDER: 128,\n\n /** TRIMESH */\n TRIMESH: 256\n};\n/**\n * ShapeType\n */\n\n/**\n * Base class for shapes\n */\nclass Shape {\n /**\n * Identifier of the Shape.\n */\n\n /**\n * The type of this shape. Must be set to an int > 0 by subclasses.\n */\n\n /**\n * The local bounding sphere radius of this shape.\n */\n\n /**\n * Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled.\n * @default true\n */\n\n /**\n * @default 1\n */\n\n /**\n * @default -1\n */\n\n /**\n * Optional material of the shape that regulates contact properties.\n */\n\n /**\n * The body to which the shape is added to.\n */\n\n /**\n * All the Shape types.\n */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n this.id = Shape.idCounter++;\n this.type = options.type || 0;\n this.boundingSphereRadius = 0;\n this.collisionResponse = options.collisionResponse ? options.collisionResponse : true;\n this.collisionFilterGroup = options.collisionFilterGroup !== undefined ? options.collisionFilterGroup : 1;\n this.collisionFilterMask = options.collisionFilterMask !== undefined ? options.collisionFilterMask : -1;\n this.material = options.material ? options.material : null;\n this.body = null;\n }\n /**\n * Computes the bounding sphere radius.\n * The result is stored in the property `.boundingSphereRadius`\n */\n\n\n updateBoundingSphereRadius() {\n throw `computeBoundingSphereRadius() not implemented for shape type ${this.type}`;\n }\n /**\n * Get the volume of this shape\n */\n\n\n volume() {\n throw `volume() not implemented for shape type ${this.type}`;\n }\n /**\n * Calculates the inertia in the local frame for this shape.\n * @see http://en.wikipedia.org/wiki/List_of_moments_of_inertia\n */\n\n\n calculateLocalInertia(mass, target) {\n throw `calculateLocalInertia() not implemented for shape type ${this.type}`;\n }\n /**\n * @todo use abstract for these kind of methods\n */\n\n\n calculateWorldAABB(pos, quat, min, max) {\n throw `calculateWorldAABB() not implemented for shape type ${this.type}`;\n }\n\n}\nShape.idCounter = 0;\nShape.types = SHAPE_TYPES;\n\n/**\n * Transformation utilities.\n */\nclass Transform {\n /**\n * position\n */\n\n /**\n * quaternion\n */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n this.position = new Vec3();\n this.quaternion = new Quaternion();\n\n if (options.position) {\n this.position.copy(options.position);\n }\n\n if (options.quaternion) {\n this.quaternion.copy(options.quaternion);\n }\n }\n /**\n * Get a global point in local transform coordinates.\n */\n\n\n pointToLocal(worldPoint, result) {\n return Transform.pointToLocalFrame(this.position, this.quaternion, worldPoint, result);\n }\n /**\n * Get a local point in global transform coordinates.\n */\n\n\n pointToWorld(localPoint, result) {\n return Transform.pointToWorldFrame(this.position, this.quaternion, localPoint, result);\n }\n /**\n * vectorToWorldFrame\n */\n\n\n vectorToWorldFrame(localVector, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n this.quaternion.vmult(localVector, result);\n return result;\n }\n /**\n * pointToLocalFrame\n */\n\n\n static pointToLocalFrame(position, quaternion, worldPoint, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n worldPoint.vsub(position, result);\n quaternion.conjugate(tmpQuat$1);\n tmpQuat$1.vmult(result, result);\n return result;\n }\n /**\n * pointToWorldFrame\n */\n\n\n static pointToWorldFrame(position, quaternion, localPoint, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n quaternion.vmult(localPoint, result);\n result.vadd(position, result);\n return result;\n }\n /**\n * vectorToWorldFrame\n */\n\n\n static vectorToWorldFrame(quaternion, localVector, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n quaternion.vmult(localVector, result);\n return result;\n }\n /**\n * vectorToLocalFrame\n */\n\n\n static vectorToLocalFrame(position, quaternion, worldVector, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n quaternion.w *= -1;\n quaternion.vmult(worldVector, result);\n quaternion.w *= -1;\n return result;\n }\n\n}\nconst tmpQuat$1 = new Quaternion();\n\n/**\n * A set of polygons describing a convex shape.\n *\n * The shape MUST be convex for the code to work properly. No polygons may be coplanar (contained\n * in the same 3D plane), instead these should be merged into one polygon.\n *\n * @author qiao / https://github.com/qiao (original author, see https://github.com/qiao/three.js/commit/85026f0c769e4000148a67d45a9e9b9c5108836f)\n * @author schteppe / https://github.com/schteppe\n * @see https://www.altdevblogaday.com/2011/05/13/contact-generation-between-3d-convex-meshes/\n *\n * @todo Move the clipping functions to ContactGenerator?\n * @todo Automatically merge coplanar polygons in constructor.\n * @example\n * const convexShape = new CANNON.ConvexPolyhedron({ vertices, faces })\n * const convexBody = new CANNON.Body({ mass: 1, shape: convexShape })\n * world.addBody(convexBody)\n */\nclass ConvexPolyhedron extends Shape {\n /** vertices */\n\n /**\n * Array of integer arrays, indicating which vertices each face consists of\n */\n\n /** faceNormals */\n\n /** worldVertices */\n\n /** worldVerticesNeedsUpdate */\n\n /** worldFaceNormals */\n\n /** worldFaceNormalsNeedsUpdate */\n\n /**\n * If given, these locally defined, normalized axes are the only ones being checked when doing separating axis check.\n */\n\n /** uniqueEdges */\n\n /**\n * @param vertices An array of Vec3's\n * @param faces Array of integer arrays, describing which vertices that is included in each face.\n */\n constructor(props) {\n if (props === void 0) {\n props = {};\n }\n\n const {\n vertices = [],\n faces = [],\n normals = [],\n axes,\n boundingSphereRadius\n } = props;\n super({\n type: Shape.types.CONVEXPOLYHEDRON\n });\n this.vertices = vertices;\n this.faces = faces;\n this.faceNormals = normals;\n\n if (this.faceNormals.length === 0) {\n this.computeNormals();\n }\n\n if (!boundingSphereRadius) {\n this.updateBoundingSphereRadius();\n } else {\n this.boundingSphereRadius = boundingSphereRadius;\n }\n\n this.worldVertices = []; // World transformed version of .vertices\n\n this.worldVerticesNeedsUpdate = true;\n this.worldFaceNormals = []; // World transformed version of .faceNormals\n\n this.worldFaceNormalsNeedsUpdate = true;\n this.uniqueAxes = axes ? axes.slice() : null;\n this.uniqueEdges = [];\n this.computeEdges();\n }\n /**\n * Computes uniqueEdges\n */\n\n\n computeEdges() {\n const faces = this.faces;\n const vertices = this.vertices;\n const edges = this.uniqueEdges;\n edges.length = 0;\n const edge = new Vec3();\n\n for (let i = 0; i !== faces.length; i++) {\n const face = faces[i];\n const numVertices = face.length;\n\n for (let j = 0; j !== numVertices; j++) {\n const k = (j + 1) % numVertices;\n vertices[face[j]].vsub(vertices[face[k]], edge);\n edge.normalize();\n let found = false;\n\n for (let p = 0; p !== edges.length; p++) {\n if (edges[p].almostEquals(edge) || edges[p].almostEquals(edge)) {\n found = true;\n break;\n }\n }\n\n if (!found) {\n edges.push(edge.clone());\n }\n }\n }\n }\n /**\n * Compute the normals of the faces.\n * Will reuse existing Vec3 objects in the `faceNormals` array if they exist.\n */\n\n\n computeNormals() {\n this.faceNormals.length = this.faces.length; // Generate normals\n\n for (let i = 0; i < this.faces.length; i++) {\n // Check so all vertices exists for this face\n for (let j = 0; j < this.faces[i].length; j++) {\n if (!this.vertices[this.faces[i][j]]) {\n throw new Error(`Vertex ${this.faces[i][j]} not found!`);\n }\n }\n\n const n = this.faceNormals[i] || new Vec3();\n this.getFaceNormal(i, n);\n n.negate(n);\n this.faceNormals[i] = n;\n const vertex = this.vertices[this.faces[i][0]];\n\n if (n.dot(vertex) < 0) {\n console.error(`.faceNormals[${i}] = Vec3(${n.toString()}) looks like it points into the shape? The vertices follow. Make sure they are ordered CCW around the normal, using the right hand rule.`);\n\n for (let j = 0; j < this.faces[i].length; j++) {\n console.warn(`.vertices[${this.faces[i][j]}] = Vec3(${this.vertices[this.faces[i][j]].toString()})`);\n }\n }\n }\n }\n /**\n * Compute the normal of a face from its vertices\n */\n\n\n getFaceNormal(i, target) {\n const f = this.faces[i];\n const va = this.vertices[f[0]];\n const vb = this.vertices[f[1]];\n const vc = this.vertices[f[2]];\n ConvexPolyhedron.computeNormal(va, vb, vc, target);\n }\n /**\n * Get face normal given 3 vertices\n */\n\n\n static computeNormal(va, vb, vc, target) {\n const cb = new Vec3();\n const ab = new Vec3();\n vb.vsub(va, ab);\n vc.vsub(vb, cb);\n cb.cross(ab, target);\n\n if (!target.isZero()) {\n target.normalize();\n }\n }\n /**\n * @param minDist Clamp distance\n * @param result The an array of contact point objects, see clipFaceAgainstHull\n */\n\n\n clipAgainstHull(posA, quatA, hullB, posB, quatB, separatingNormal, minDist, maxDist, result) {\n const WorldNormal = new Vec3();\n let closestFaceB = -1;\n let dmax = -Number.MAX_VALUE;\n\n for (let face = 0; face < hullB.faces.length; face++) {\n WorldNormal.copy(hullB.faceNormals[face]);\n quatB.vmult(WorldNormal, WorldNormal);\n const d = WorldNormal.dot(separatingNormal);\n\n if (d > dmax) {\n dmax = d;\n closestFaceB = face;\n }\n }\n\n const worldVertsB1 = [];\n\n for (let i = 0; i < hullB.faces[closestFaceB].length; i++) {\n const b = hullB.vertices[hullB.faces[closestFaceB][i]];\n const worldb = new Vec3();\n worldb.copy(b);\n quatB.vmult(worldb, worldb);\n posB.vadd(worldb, worldb);\n worldVertsB1.push(worldb);\n }\n\n if (closestFaceB >= 0) {\n this.clipFaceAgainstHull(separatingNormal, posA, quatA, worldVertsB1, minDist, maxDist, result);\n }\n }\n /**\n * Find the separating axis between this hull and another\n * @param target The target vector to save the axis in\n * @return Returns false if a separation is found, else true\n */\n\n\n findSeparatingAxis(hullB, posA, quatA, posB, quatB, target, faceListA, faceListB) {\n const faceANormalWS3 = new Vec3();\n const Worldnormal1 = new Vec3();\n const deltaC = new Vec3();\n const worldEdge0 = new Vec3();\n const worldEdge1 = new Vec3();\n const Cross = new Vec3();\n let dmin = Number.MAX_VALUE;\n const hullA = this;\n\n if (!hullA.uniqueAxes) {\n const numFacesA = faceListA ? faceListA.length : hullA.faces.length; // Test face normals from hullA\n\n for (let i = 0; i < numFacesA; i++) {\n const fi = faceListA ? faceListA[i] : i; // Get world face normal\n\n faceANormalWS3.copy(hullA.faceNormals[fi]);\n quatA.vmult(faceANormalWS3, faceANormalWS3);\n const d = hullA.testSepAxis(faceANormalWS3, hullB, posA, quatA, posB, quatB);\n\n if (d === false) {\n return false;\n }\n\n if (d < dmin) {\n dmin = d;\n target.copy(faceANormalWS3);\n }\n }\n } else {\n // Test unique axes\n for (let i = 0; i !== hullA.uniqueAxes.length; i++) {\n // Get world axis\n quatA.vmult(hullA.uniqueAxes[i], faceANormalWS3);\n const d = hullA.testSepAxis(faceANormalWS3, hullB, posA, quatA, posB, quatB);\n\n if (d === false) {\n return false;\n }\n\n if (d < dmin) {\n dmin = d;\n target.copy(faceANormalWS3);\n }\n }\n }\n\n if (!hullB.uniqueAxes) {\n // Test face normals from hullB\n const numFacesB = faceListB ? faceListB.length : hullB.faces.length;\n\n for (let i = 0; i < numFacesB; i++) {\n const fi = faceListB ? faceListB[i] : i;\n Worldnormal1.copy(hullB.faceNormals[fi]);\n quatB.vmult(Worldnormal1, Worldnormal1);\n const d = hullA.testSepAxis(Worldnormal1, hullB, posA, quatA, posB, quatB);\n\n if (d === false) {\n return false;\n }\n\n if (d < dmin) {\n dmin = d;\n target.copy(Worldnormal1);\n }\n }\n } else {\n // Test unique axes in B\n for (let i = 0; i !== hullB.uniqueAxes.length; i++) {\n quatB.vmult(hullB.uniqueAxes[i], Worldnormal1);\n const d = hullA.testSepAxis(Worldnormal1, hullB, posA, quatA, posB, quatB);\n\n if (d === false) {\n return false;\n }\n\n if (d < dmin) {\n dmin = d;\n target.copy(Worldnormal1);\n }\n }\n } // Test edges\n\n\n for (let e0 = 0; e0 !== hullA.uniqueEdges.length; e0++) {\n // Get world edge\n quatA.vmult(hullA.uniqueEdges[e0], worldEdge0);\n\n for (let e1 = 0; e1 !== hullB.uniqueEdges.length; e1++) {\n // Get world edge 2\n quatB.vmult(hullB.uniqueEdges[e1], worldEdge1);\n worldEdge0.cross(worldEdge1, Cross);\n\n if (!Cross.almostZero()) {\n Cross.normalize();\n const dist = hullA.testSepAxis(Cross, hullB, posA, quatA, posB, quatB);\n\n if (dist === false) {\n return false;\n }\n\n if (dist < dmin) {\n dmin = dist;\n target.copy(Cross);\n }\n }\n }\n }\n\n posB.vsub(posA, deltaC);\n\n if (deltaC.dot(target) > 0.0) {\n target.negate(target);\n }\n\n return true;\n }\n /**\n * Test separating axis against two hulls. Both hulls are projected onto the axis and the overlap size is returned if there is one.\n * @return The overlap depth, or FALSE if no penetration.\n */\n\n\n testSepAxis(axis, hullB, posA, quatA, posB, quatB) {\n const hullA = this;\n ConvexPolyhedron.project(hullA, axis, posA, quatA, maxminA);\n ConvexPolyhedron.project(hullB, axis, posB, quatB, maxminB);\n const maxA = maxminA[0];\n const minA = maxminA[1];\n const maxB = maxminB[0];\n const minB = maxminB[1];\n\n if (maxA < minB || maxB < minA) {\n return false; // Separated\n }\n\n const d0 = maxA - minB;\n const d1 = maxB - minA;\n const depth = d0 < d1 ? d0 : d1;\n return depth;\n }\n /**\n * calculateLocalInertia\n */\n\n\n calculateLocalInertia(mass, target) {\n // Approximate with box inertia\n // Exact inertia calculation is overkill, but see http://geometrictools.com/Documentation/PolyhedralMassProperties.pdf for the correct way to do it\n const aabbmax = new Vec3();\n const aabbmin = new Vec3();\n this.computeLocalAABB(aabbmin, aabbmax);\n const x = aabbmax.x - aabbmin.x;\n const y = aabbmax.y - aabbmin.y;\n const z = aabbmax.z - aabbmin.z;\n target.x = 1.0 / 12.0 * mass * (2 * y * 2 * y + 2 * z * 2 * z);\n target.y = 1.0 / 12.0 * mass * (2 * x * 2 * x + 2 * z * 2 * z);\n target.z = 1.0 / 12.0 * mass * (2 * y * 2 * y + 2 * x * 2 * x);\n }\n /**\n * @param face_i Index of the face\n */\n\n\n getPlaneConstantOfFace(face_i) {\n const f = this.faces[face_i];\n const n = this.faceNormals[face_i];\n const v = this.vertices[f[0]];\n const c = -n.dot(v);\n return c;\n }\n /**\n * Clip a face against a hull.\n * @param worldVertsB1 An array of Vec3 with vertices in the world frame.\n * @param minDist Distance clamping\n * @param Array result Array to store resulting contact points in. Will be objects with properties: point, depth, normal. These are represented in world coordinates.\n */\n\n\n clipFaceAgainstHull(separatingNormal, posA, quatA, worldVertsB1, minDist, maxDist, result) {\n const faceANormalWS = new Vec3();\n const edge0 = new Vec3();\n const WorldEdge0 = new Vec3();\n const worldPlaneAnormal1 = new Vec3();\n const planeNormalWS1 = new Vec3();\n const worldA1 = new Vec3();\n const localPlaneNormal = new Vec3();\n const planeNormalWS = new Vec3();\n const hullA = this;\n const worldVertsB2 = [];\n const pVtxIn = worldVertsB1;\n const pVtxOut = worldVertsB2;\n let closestFaceA = -1;\n let dmin = Number.MAX_VALUE; // Find the face with normal closest to the separating axis\n\n for (let face = 0; face < hullA.faces.length; face++) {\n faceANormalWS.copy(hullA.faceNormals[face]);\n quatA.vmult(faceANormalWS, faceANormalWS);\n const d = faceANormalWS.dot(separatingNormal);\n\n if (d < dmin) {\n dmin = d;\n closestFaceA = face;\n }\n }\n\n if (closestFaceA < 0) {\n return;\n } // Get the face and construct connected faces\n\n\n const polyA = hullA.faces[closestFaceA];\n polyA.connectedFaces = [];\n\n for (let i = 0; i < hullA.faces.length; i++) {\n for (let j = 0; j < hullA.faces[i].length; j++) {\n if (\n /* Sharing a vertex*/\n polyA.indexOf(hullA.faces[i][j]) !== -1 &&\n /* Not the one we are looking for connections from */\n i !== closestFaceA &&\n /* Not already added */\n polyA.connectedFaces.indexOf(i) === -1) {\n polyA.connectedFaces.push(i);\n }\n }\n } // Clip the polygon to the back of the planes of all faces of hull A,\n // that are adjacent to the witness face\n\n\n const numVerticesA = polyA.length;\n\n for (let i = 0; i < numVerticesA; i++) {\n const a = hullA.vertices[polyA[i]];\n const b = hullA.vertices[polyA[(i + 1) % numVerticesA]];\n a.vsub(b, edge0);\n WorldEdge0.copy(edge0);\n quatA.vmult(WorldEdge0, WorldEdge0);\n posA.vadd(WorldEdge0, WorldEdge0);\n worldPlaneAnormal1.copy(this.faceNormals[closestFaceA]);\n quatA.vmult(worldPlaneAnormal1, worldPlaneAnormal1);\n posA.vadd(worldPlaneAnormal1, worldPlaneAnormal1);\n WorldEdge0.cross(worldPlaneAnormal1, planeNormalWS1);\n planeNormalWS1.negate(planeNormalWS1);\n worldA1.copy(a);\n quatA.vmult(worldA1, worldA1);\n posA.vadd(worldA1, worldA1);\n const otherFace = polyA.connectedFaces[i];\n localPlaneNormal.copy(this.faceNormals[otherFace]);\n const localPlaneEq = this.getPlaneConstantOfFace(otherFace);\n planeNormalWS.copy(localPlaneNormal);\n quatA.vmult(planeNormalWS, planeNormalWS);\n const planeEqWS = localPlaneEq - planeNormalWS.dot(posA); // Clip face against our constructed plane\n\n this.clipFaceAgainstPlane(pVtxIn, pVtxOut, planeNormalWS, planeEqWS); // Throw away all clipped points, but save the remaining until next clip\n\n while (pVtxIn.length) {\n pVtxIn.shift();\n }\n\n while (pVtxOut.length) {\n pVtxIn.push(pVtxOut.shift());\n }\n } // only keep contact points that are behind the witness face\n\n\n localPlaneNormal.copy(this.faceNormals[closestFaceA]);\n const localPlaneEq = this.getPlaneConstantOfFace(closestFaceA);\n planeNormalWS.copy(localPlaneNormal);\n quatA.vmult(planeNormalWS, planeNormalWS);\n const planeEqWS = localPlaneEq - planeNormalWS.dot(posA);\n\n for (let i = 0; i < pVtxIn.length; i++) {\n let depth = planeNormalWS.dot(pVtxIn[i]) + planeEqWS; // ???\n\n if (depth <= minDist) {\n console.log(`clamped: depth=${depth} to minDist=${minDist}`);\n depth = minDist;\n }\n\n if (depth <= maxDist) {\n const point = pVtxIn[i];\n\n if (depth <= 1e-6) {\n const p = {\n point,\n normal: planeNormalWS,\n depth\n };\n result.push(p);\n }\n }\n }\n }\n /**\n * Clip a face in a hull against the back of a plane.\n * @param planeConstant The constant in the mathematical plane equation\n */\n\n\n clipFaceAgainstPlane(inVertices, outVertices, planeNormal, planeConstant) {\n let n_dot_first;\n let n_dot_last;\n const numVerts = inVertices.length;\n\n if (numVerts < 2) {\n return outVertices;\n }\n\n let firstVertex = inVertices[inVertices.length - 1];\n let lastVertex = inVertices[0];\n n_dot_first = planeNormal.dot(firstVertex) + planeConstant;\n\n for (let vi = 0; vi < numVerts; vi++) {\n lastVertex = inVertices[vi];\n n_dot_last = planeNormal.dot(lastVertex) + planeConstant;\n\n if (n_dot_first < 0) {\n if (n_dot_last < 0) {\n // Start < 0, end < 0, so output lastVertex\n const newv = new Vec3();\n newv.copy(lastVertex);\n outVertices.push(newv);\n } else {\n // Start < 0, end >= 0, so output intersection\n const newv = new Vec3();\n firstVertex.lerp(lastVertex, n_dot_first / (n_dot_first - n_dot_last), newv);\n outVertices.push(newv);\n }\n } else {\n if (n_dot_last < 0) {\n // Start >= 0, end < 0 so output intersection and end\n const newv = new Vec3();\n firstVertex.lerp(lastVertex, n_dot_first / (n_dot_first - n_dot_last), newv);\n outVertices.push(newv);\n outVertices.push(lastVertex);\n }\n }\n\n firstVertex = lastVertex;\n n_dot_first = n_dot_last;\n }\n\n return outVertices;\n }\n /**\n * Updates `.worldVertices` and sets `.worldVerticesNeedsUpdate` to false.\n */\n\n\n computeWorldVertices(position, quat) {\n while (this.worldVertices.length < this.vertices.length) {\n this.worldVertices.push(new Vec3());\n }\n\n const verts = this.vertices;\n const worldVerts = this.worldVertices;\n\n for (let i = 0; i !== this.vertices.length; i++) {\n quat.vmult(verts[i], worldVerts[i]);\n position.vadd(worldVerts[i], worldVerts[i]);\n }\n\n this.worldVerticesNeedsUpdate = false;\n }\n\n computeLocalAABB(aabbmin, aabbmax) {\n const vertices = this.vertices;\n aabbmin.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n aabbmax.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\n\n for (let i = 0; i < this.vertices.length; i++) {\n const v = vertices[i];\n\n if (v.x < aabbmin.x) {\n aabbmin.x = v.x;\n } else if (v.x > aabbmax.x) {\n aabbmax.x = v.x;\n }\n\n if (v.y < aabbmin.y) {\n aabbmin.y = v.y;\n } else if (v.y > aabbmax.y) {\n aabbmax.y = v.y;\n }\n\n if (v.z < aabbmin.z) {\n aabbmin.z = v.z;\n } else if (v.z > aabbmax.z) {\n aabbmax.z = v.z;\n }\n }\n }\n /**\n * Updates `worldVertices` and sets `worldVerticesNeedsUpdate` to false.\n */\n\n\n computeWorldFaceNormals(quat) {\n const N = this.faceNormals.length;\n\n while (this.worldFaceNormals.length < N) {\n this.worldFaceNormals.push(new Vec3());\n }\n\n const normals = this.faceNormals;\n const worldNormals = this.worldFaceNormals;\n\n for (let i = 0; i !== N; i++) {\n quat.vmult(normals[i], worldNormals[i]);\n }\n\n this.worldFaceNormalsNeedsUpdate = false;\n }\n /**\n * updateBoundingSphereRadius\n */\n\n\n updateBoundingSphereRadius() {\n // Assume points are distributed with local (0,0,0) as center\n let max2 = 0;\n const verts = this.vertices;\n\n for (let i = 0; i !== verts.length; i++) {\n const norm2 = verts[i].lengthSquared();\n\n if (norm2 > max2) {\n max2 = norm2;\n }\n }\n\n this.boundingSphereRadius = Math.sqrt(max2);\n }\n /**\n * calculateWorldAABB\n */\n\n\n calculateWorldAABB(pos, quat, min, max) {\n const verts = this.vertices;\n let minx;\n let miny;\n let minz;\n let maxx;\n let maxy;\n let maxz;\n let tempWorldVertex = new Vec3();\n\n for (let i = 0; i < verts.length; i++) {\n tempWorldVertex.copy(verts[i]);\n quat.vmult(tempWorldVertex, tempWorldVertex);\n pos.vadd(tempWorldVertex, tempWorldVertex);\n const v = tempWorldVertex;\n\n if (minx === undefined || v.x < minx) {\n minx = v.x;\n }\n\n if (maxx === undefined || v.x > maxx) {\n maxx = v.x;\n }\n\n if (miny === undefined || v.y < miny) {\n miny = v.y;\n }\n\n if (maxy === undefined || v.y > maxy) {\n maxy = v.y;\n }\n\n if (minz === undefined || v.z < minz) {\n minz = v.z;\n }\n\n if (maxz === undefined || v.z > maxz) {\n maxz = v.z;\n }\n }\n\n min.set(minx, miny, minz);\n max.set(maxx, maxy, maxz);\n }\n /**\n * Get approximate convex volume\n */\n\n\n volume() {\n return 4.0 * Math.PI * this.boundingSphereRadius / 3.0;\n }\n /**\n * Get an average of all the vertices positions\n */\n\n\n getAveragePointLocal(target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n const verts = this.vertices;\n\n for (let i = 0; i < verts.length; i++) {\n target.vadd(verts[i], target);\n }\n\n target.scale(1 / verts.length, target);\n return target;\n }\n /**\n * Transform all local points. Will change the .vertices\n */\n\n\n transformAllPoints(offset, quat) {\n const n = this.vertices.length;\n const verts = this.vertices; // Apply rotation\n\n if (quat) {\n // Rotate vertices\n for (let i = 0; i < n; i++) {\n const v = verts[i];\n quat.vmult(v, v);\n } // Rotate face normals\n\n\n for (let i = 0; i < this.faceNormals.length; i++) {\n const v = this.faceNormals[i];\n quat.vmult(v, v);\n }\n /*\n // Rotate edges\n for(let i=0; i 0 || r1 > 0 && r2 < 0) {\n return false; // Encountered some other sign. Exit.\n }\n } // If we got here, all dot products were of the same sign.\n\n\n return positiveResult ? 1 : -1;\n }\n /**\n * Get max and min dot product of a convex hull at position (pos,quat) projected onto an axis.\n * Results are saved in the array maxmin.\n * @param result result[0] and result[1] will be set to maximum and minimum, respectively.\n */\n\n\n static project(shape, axis, pos, quat, result) {\n const n = shape.vertices.length;\n project_worldVertex;\n const localAxis = project_localAxis;\n let max = 0;\n let min = 0;\n const localOrigin = project_localOrigin;\n const vs = shape.vertices;\n localOrigin.setZero(); // Transform the axis to local\n\n Transform.vectorToLocalFrame(pos, quat, axis, localAxis);\n Transform.pointToLocalFrame(pos, quat, localOrigin, localOrigin);\n const add = localOrigin.dot(localAxis);\n min = max = vs[0].dot(localAxis);\n\n for (let i = 1; i < n; i++) {\n const val = vs[i].dot(localAxis);\n\n if (val > max) {\n max = val;\n }\n\n if (val < min) {\n min = val;\n }\n }\n\n min -= add;\n max -= add;\n\n if (min > max) {\n // Inconsistent - swap\n const temp = min;\n min = max;\n max = temp;\n } // Output\n\n\n result[0] = max;\n result[1] = min;\n }\n\n}\nconst maxminA = [];\nconst maxminB = [];\nconst project_worldVertex = new Vec3();\nconst project_localAxis = new Vec3();\nconst project_localOrigin = new Vec3();\n\n/**\n * A 3d box shape.\n * @example\n * const size = 1\n * const halfExtents = new CANNON.Vec3(size, size, size)\n * const boxShape = new CANNON.Box(halfExtents)\n * const boxBody = new CANNON.Body({ mass: 1, shape: boxShape })\n * world.addBody(boxBody)\n */\nclass Box extends Shape {\n /**\n * The half extents of the box.\n */\n\n /**\n * Used by the contact generator to make contacts with other convex polyhedra for example.\n */\n constructor(halfExtents) {\n super({\n type: Shape.types.BOX\n });\n this.halfExtents = halfExtents;\n this.convexPolyhedronRepresentation = null;\n this.updateConvexPolyhedronRepresentation();\n this.updateBoundingSphereRadius();\n }\n /**\n * Updates the local convex polyhedron representation used for some collisions.\n */\n\n\n updateConvexPolyhedronRepresentation() {\n const sx = this.halfExtents.x;\n const sy = this.halfExtents.y;\n const sz = this.halfExtents.z;\n const V = Vec3;\n const vertices = [new V(-sx, -sy, -sz), new V(sx, -sy, -sz), new V(sx, sy, -sz), new V(-sx, sy, -sz), new V(-sx, -sy, sz), new V(sx, -sy, sz), new V(sx, sy, sz), new V(-sx, sy, sz)];\n const faces = [[3, 2, 1, 0], // -z\n [4, 5, 6, 7], // +z\n [5, 4, 0, 1], // -y\n [2, 3, 7, 6], // +y\n [0, 4, 7, 3], // -x\n [1, 2, 6, 5] // +x\n ];\n const axes = [new V(0, 0, 1), new V(0, 1, 0), new V(1, 0, 0)];\n const h = new ConvexPolyhedron({\n vertices,\n faces,\n axes\n });\n this.convexPolyhedronRepresentation = h;\n h.material = this.material;\n }\n /**\n * Calculate the inertia of the box.\n */\n\n\n calculateLocalInertia(mass, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n Box.calculateInertia(this.halfExtents, mass, target);\n return target;\n }\n\n static calculateInertia(halfExtents, mass, target) {\n const e = halfExtents;\n target.x = 1.0 / 12.0 * mass * (2 * e.y * 2 * e.y + 2 * e.z * 2 * e.z);\n target.y = 1.0 / 12.0 * mass * (2 * e.x * 2 * e.x + 2 * e.z * 2 * e.z);\n target.z = 1.0 / 12.0 * mass * (2 * e.y * 2 * e.y + 2 * e.x * 2 * e.x);\n }\n /**\n * Get the box 6 side normals\n * @param sixTargetVectors An array of 6 vectors, to store the resulting side normals in.\n * @param quat Orientation to apply to the normal vectors. If not provided, the vectors will be in respect to the local frame.\n */\n\n\n getSideNormals(sixTargetVectors, quat) {\n const sides = sixTargetVectors;\n const ex = this.halfExtents;\n sides[0].set(ex.x, 0, 0);\n sides[1].set(0, ex.y, 0);\n sides[2].set(0, 0, ex.z);\n sides[3].set(-ex.x, 0, 0);\n sides[4].set(0, -ex.y, 0);\n sides[5].set(0, 0, -ex.z);\n\n if (quat !== undefined) {\n for (let i = 0; i !== sides.length; i++) {\n quat.vmult(sides[i], sides[i]);\n }\n }\n\n return sides;\n }\n /**\n * Returns the volume of the box.\n */\n\n\n volume() {\n return 8.0 * this.halfExtents.x * this.halfExtents.y * this.halfExtents.z;\n }\n /**\n * updateBoundingSphereRadius\n */\n\n\n updateBoundingSphereRadius() {\n this.boundingSphereRadius = this.halfExtents.length();\n }\n /**\n * forEachWorldCorner\n */\n\n\n forEachWorldCorner(pos, quat, callback) {\n const e = this.halfExtents;\n const corners = [[e.x, e.y, e.z], [-e.x, e.y, e.z], [-e.x, -e.y, e.z], [-e.x, -e.y, -e.z], [e.x, -e.y, -e.z], [e.x, e.y, -e.z], [-e.x, e.y, -e.z], [e.x, -e.y, e.z]];\n\n for (let i = 0; i < corners.length; i++) {\n worldCornerTempPos.set(corners[i][0], corners[i][1], corners[i][2]);\n quat.vmult(worldCornerTempPos, worldCornerTempPos);\n pos.vadd(worldCornerTempPos, worldCornerTempPos);\n callback(worldCornerTempPos.x, worldCornerTempPos.y, worldCornerTempPos.z);\n }\n }\n /**\n * calculateWorldAABB\n */\n\n\n calculateWorldAABB(pos, quat, min, max) {\n const e = this.halfExtents;\n worldCornersTemp[0].set(e.x, e.y, e.z);\n worldCornersTemp[1].set(-e.x, e.y, e.z);\n worldCornersTemp[2].set(-e.x, -e.y, e.z);\n worldCornersTemp[3].set(-e.x, -e.y, -e.z);\n worldCornersTemp[4].set(e.x, -e.y, -e.z);\n worldCornersTemp[5].set(e.x, e.y, -e.z);\n worldCornersTemp[6].set(-e.x, e.y, -e.z);\n worldCornersTemp[7].set(e.x, -e.y, e.z);\n const wc = worldCornersTemp[0];\n quat.vmult(wc, wc);\n pos.vadd(wc, wc);\n max.copy(wc);\n min.copy(wc);\n\n for (let i = 1; i < 8; i++) {\n const wc = worldCornersTemp[i];\n quat.vmult(wc, wc);\n pos.vadd(wc, wc);\n const x = wc.x;\n const y = wc.y;\n const z = wc.z;\n\n if (x > max.x) {\n max.x = x;\n }\n\n if (y > max.y) {\n max.y = y;\n }\n\n if (z > max.z) {\n max.z = z;\n }\n\n if (x < min.x) {\n min.x = x;\n }\n\n if (y < min.y) {\n min.y = y;\n }\n\n if (z < min.z) {\n min.z = z;\n }\n } // Get each axis max\n // min.set(Infinity,Infinity,Infinity);\n // max.set(-Infinity,-Infinity,-Infinity);\n // this.forEachWorldCorner(pos,quat,function(x,y,z){\n // if(x > max.x){\n // max.x = x;\n // }\n // if(y > max.y){\n // max.y = y;\n // }\n // if(z > max.z){\n // max.z = z;\n // }\n // if(x < min.x){\n // min.x = x;\n // }\n // if(y < min.y){\n // min.y = y;\n // }\n // if(z < min.z){\n // min.z = z;\n // }\n // });\n\n }\n\n}\nconst worldCornerTempPos = new Vec3();\nconst worldCornersTemp = [new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3()];\n\n/**\n * BODY_TYPES\n */\nconst BODY_TYPES = {\n /** DYNAMIC */\n DYNAMIC: 1,\n\n /** STATIC */\n STATIC: 2,\n\n /** KINEMATIC */\n KINEMATIC: 4\n};\n/**\n * BodyType\n */\n\n/**\n * BODY_SLEEP_STATES\n */\nconst BODY_SLEEP_STATES = {\n /** AWAKE */\n AWAKE: 0,\n\n /** SLEEPY */\n SLEEPY: 1,\n\n /** SLEEPING */\n SLEEPING: 2\n};\n/**\n * BodySleepState\n */\n\n/**\n * Base class for all body types.\n * @example\n * const shape = new CANNON.Sphere(1)\n * const body = new CANNON.Body({\n * mass: 1,\n * shape,\n * })\n * world.addBody(body)\n */\nclass Body extends EventTarget {\n /**\n * Dispatched after two bodies collide. This event is dispatched on each\n * of the two bodies involved in the collision.\n * @event collide\n * @param body The body that was involved in the collision.\n * @param contact The details of the collision.\n */\n\n /**\n * A dynamic body is fully simulated. Can be moved manually by the user, but normally they move according to forces. A dynamic body can collide with all body types. A dynamic body always has finite, non-zero mass.\n */\n\n /**\n * A static body does not move during simulation and behaves as if it has infinite mass. Static bodies can be moved manually by setting the position of the body. The velocity of a static body is always zero. Static bodies do not collide with other static or kinematic bodies.\n */\n\n /**\n * A kinematic body moves under simulation according to its velocity. They do not respond to forces. They can be moved manually, but normally a kinematic body is moved by setting its velocity. A kinematic body behaves as if it has infinite mass. Kinematic bodies do not collide with other static or kinematic bodies.\n */\n\n /**\n * AWAKE\n */\n\n /**\n * SLEEPY\n */\n\n /**\n * SLEEPING\n */\n\n /**\n * Dispatched after a sleeping body has woken up.\n * @event wakeup\n */\n\n /**\n * Dispatched after a body has gone in to the sleepy state.\n * @event sleepy\n */\n\n /**\n * Dispatched after a body has fallen asleep.\n * @event sleep\n */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n super();\n this.id = Body.idCounter++;\n this.index = -1;\n this.world = null;\n this.vlambda = new Vec3();\n this.collisionFilterGroup = typeof options.collisionFilterGroup === 'number' ? options.collisionFilterGroup : 1;\n this.collisionFilterMask = typeof options.collisionFilterMask === 'number' ? options.collisionFilterMask : -1;\n this.collisionResponse = typeof options.collisionResponse === 'boolean' ? options.collisionResponse : true;\n this.position = new Vec3();\n this.previousPosition = new Vec3();\n this.interpolatedPosition = new Vec3();\n this.initPosition = new Vec3();\n\n if (options.position) {\n this.position.copy(options.position);\n this.previousPosition.copy(options.position);\n this.interpolatedPosition.copy(options.position);\n this.initPosition.copy(options.position);\n }\n\n this.velocity = new Vec3();\n\n if (options.velocity) {\n this.velocity.copy(options.velocity);\n }\n\n this.initVelocity = new Vec3();\n this.force = new Vec3();\n const mass = typeof options.mass === 'number' ? options.mass : 0;\n this.mass = mass;\n this.invMass = mass > 0 ? 1.0 / mass : 0;\n this.material = options.material || null;\n this.linearDamping = typeof options.linearDamping === 'number' ? options.linearDamping : 0.01;\n this.type = mass <= 0.0 ? Body.STATIC : Body.DYNAMIC;\n\n if (typeof options.type === typeof Body.STATIC) {\n this.type = options.type;\n }\n\n this.allowSleep = typeof options.allowSleep !== 'undefined' ? options.allowSleep : true;\n this.sleepState = Body.AWAKE;\n this.sleepSpeedLimit = typeof options.sleepSpeedLimit !== 'undefined' ? options.sleepSpeedLimit : 0.1;\n this.sleepTimeLimit = typeof options.sleepTimeLimit !== 'undefined' ? options.sleepTimeLimit : 1;\n this.timeLastSleepy = 0;\n this.wakeUpAfterNarrowphase = false;\n this.torque = new Vec3();\n this.quaternion = new Quaternion();\n this.initQuaternion = new Quaternion();\n this.previousQuaternion = new Quaternion();\n this.interpolatedQuaternion = new Quaternion();\n\n if (options.quaternion) {\n this.quaternion.copy(options.quaternion);\n this.initQuaternion.copy(options.quaternion);\n this.previousQuaternion.copy(options.quaternion);\n this.interpolatedQuaternion.copy(options.quaternion);\n }\n\n this.angularVelocity = new Vec3();\n\n if (options.angularVelocity) {\n this.angularVelocity.copy(options.angularVelocity);\n }\n\n this.initAngularVelocity = new Vec3();\n this.shapes = [];\n this.shapeOffsets = [];\n this.shapeOrientations = [];\n this.inertia = new Vec3();\n this.invInertia = new Vec3();\n this.invInertiaWorld = new Mat3();\n this.invMassSolve = 0;\n this.invInertiaSolve = new Vec3();\n this.invInertiaWorldSolve = new Mat3();\n this.fixedRotation = typeof options.fixedRotation !== 'undefined' ? options.fixedRotation : false;\n this.angularDamping = typeof options.angularDamping !== 'undefined' ? options.angularDamping : 0.01;\n this.linearFactor = new Vec3(1, 1, 1);\n\n if (options.linearFactor) {\n this.linearFactor.copy(options.linearFactor);\n }\n\n this.angularFactor = new Vec3(1, 1, 1);\n\n if (options.angularFactor) {\n this.angularFactor.copy(options.angularFactor);\n }\n\n this.aabb = new AABB();\n this.aabbNeedsUpdate = true;\n this.boundingRadius = 0;\n this.wlambda = new Vec3();\n this.isTrigger = Boolean(options.isTrigger);\n\n if (options.shape) {\n this.addShape(options.shape);\n }\n\n this.updateMassProperties();\n }\n /**\n * Wake the body up.\n */\n\n\n wakeUp() {\n const prevState = this.sleepState;\n this.sleepState = Body.AWAKE;\n this.wakeUpAfterNarrowphase = false;\n\n if (prevState === Body.SLEEPING) {\n this.dispatchEvent(Body.wakeupEvent);\n }\n }\n /**\n * Force body sleep\n */\n\n\n sleep() {\n this.sleepState = Body.SLEEPING;\n this.velocity.set(0, 0, 0);\n this.angularVelocity.set(0, 0, 0);\n this.wakeUpAfterNarrowphase = false;\n }\n /**\n * Called every timestep to update internal sleep timer and change sleep state if needed.\n * @param time The world time in seconds\n */\n\n\n sleepTick(time) {\n if (this.allowSleep) {\n const sleepState = this.sleepState;\n const speedSquared = this.velocity.lengthSquared() + this.angularVelocity.lengthSquared();\n const speedLimitSquared = this.sleepSpeedLimit ** 2;\n\n if (sleepState === Body.AWAKE && speedSquared < speedLimitSquared) {\n this.sleepState = Body.SLEEPY; // Sleepy\n\n this.timeLastSleepy = time;\n this.dispatchEvent(Body.sleepyEvent);\n } else if (sleepState === Body.SLEEPY && speedSquared > speedLimitSquared) {\n this.wakeUp(); // Wake up\n } else if (sleepState === Body.SLEEPY && time - this.timeLastSleepy > this.sleepTimeLimit) {\n this.sleep(); // Sleeping\n\n this.dispatchEvent(Body.sleepEvent);\n }\n }\n }\n /**\n * If the body is sleeping, it should be immovable / have infinite mass during solve. We solve it by having a separate \"solve mass\".\n */\n\n\n updateSolveMassProperties() {\n if (this.sleepState === Body.SLEEPING || this.type === Body.KINEMATIC) {\n this.invMassSolve = 0;\n this.invInertiaSolve.setZero();\n this.invInertiaWorldSolve.setZero();\n } else {\n this.invMassSolve = this.invMass;\n this.invInertiaSolve.copy(this.invInertia);\n this.invInertiaWorldSolve.copy(this.invInertiaWorld);\n }\n }\n /**\n * Convert a world point to local body frame.\n */\n\n\n pointToLocalFrame(worldPoint, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n worldPoint.vsub(this.position, result);\n this.quaternion.conjugate().vmult(result, result);\n return result;\n }\n /**\n * Convert a world vector to local body frame.\n */\n\n\n vectorToLocalFrame(worldVector, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n this.quaternion.conjugate().vmult(worldVector, result);\n return result;\n }\n /**\n * Convert a local body point to world frame.\n */\n\n\n pointToWorldFrame(localPoint, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n this.quaternion.vmult(localPoint, result);\n result.vadd(this.position, result);\n return result;\n }\n /**\n * Convert a local body point to world frame.\n */\n\n\n vectorToWorldFrame(localVector, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n this.quaternion.vmult(localVector, result);\n return result;\n }\n /**\n * Add a shape to the body with a local offset and orientation.\n * @return The body object, for chainability.\n */\n\n\n addShape(shape, _offset, _orientation) {\n const offset = new Vec3();\n const orientation = new Quaternion();\n\n if (_offset) {\n offset.copy(_offset);\n }\n\n if (_orientation) {\n orientation.copy(_orientation);\n }\n\n this.shapes.push(shape);\n this.shapeOffsets.push(offset);\n this.shapeOrientations.push(orientation);\n this.updateMassProperties();\n this.updateBoundingRadius();\n this.aabbNeedsUpdate = true;\n shape.body = this;\n return this;\n }\n /**\n * Remove a shape from the body.\n * @return The body object, for chainability.\n */\n\n\n removeShape(shape) {\n const index = this.shapes.indexOf(shape);\n\n if (index === -1) {\n console.warn('Shape does not belong to the body');\n return this;\n }\n\n this.shapes.splice(index, 1);\n this.shapeOffsets.splice(index, 1);\n this.shapeOrientations.splice(index, 1);\n this.updateMassProperties();\n this.updateBoundingRadius();\n this.aabbNeedsUpdate = true;\n shape.body = null;\n return this;\n }\n /**\n * Update the bounding radius of the body. Should be done if any of the shapes are changed.\n */\n\n\n updateBoundingRadius() {\n const shapes = this.shapes;\n const shapeOffsets = this.shapeOffsets;\n const N = shapes.length;\n let radius = 0;\n\n for (let i = 0; i !== N; i++) {\n const shape = shapes[i];\n shape.updateBoundingSphereRadius();\n const offset = shapeOffsets[i].length();\n const r = shape.boundingSphereRadius;\n\n if (offset + r > radius) {\n radius = offset + r;\n }\n }\n\n this.boundingRadius = radius;\n }\n /**\n * Updates the .aabb\n */\n\n\n updateAABB() {\n const shapes = this.shapes;\n const shapeOffsets = this.shapeOffsets;\n const shapeOrientations = this.shapeOrientations;\n const N = shapes.length;\n const offset = tmpVec;\n const orientation = tmpQuat;\n const bodyQuat = this.quaternion;\n const aabb = this.aabb;\n const shapeAABB = updateAABB_shapeAABB;\n\n for (let i = 0; i !== N; i++) {\n const shape = shapes[i]; // Get shape world position\n\n bodyQuat.vmult(shapeOffsets[i], offset);\n offset.vadd(this.position, offset); // Get shape world quaternion\n\n bodyQuat.mult(shapeOrientations[i], orientation); // Get shape AABB\n\n shape.calculateWorldAABB(offset, orientation, shapeAABB.lowerBound, shapeAABB.upperBound);\n\n if (i === 0) {\n aabb.copy(shapeAABB);\n } else {\n aabb.extend(shapeAABB);\n }\n }\n\n this.aabbNeedsUpdate = false;\n }\n /**\n * Update `.inertiaWorld` and `.invInertiaWorld`\n */\n\n\n updateInertiaWorld(force) {\n const I = this.invInertia;\n\n if (I.x === I.y && I.y === I.z && !force) ; else {\n const m1 = uiw_m1;\n const m2 = uiw_m2;\n uiw_m3;\n m1.setRotationFromQuaternion(this.quaternion);\n m1.transpose(m2);\n m1.scale(I, m1);\n m1.mmult(m2, this.invInertiaWorld);\n }\n }\n /**\n * Apply force to a point of the body. This could for example be a point on the Body surface.\n * Applying force this way will add to Body.force and Body.torque.\n * @param force The amount of force to add.\n * @param relativePoint A point relative to the center of mass to apply the force on.\n */\n\n\n applyForce(force, relativePoint) {\n if (relativePoint === void 0) {\n relativePoint = new Vec3();\n }\n\n // Needed?\n if (this.type !== Body.DYNAMIC) {\n return;\n }\n\n if (this.sleepState === Body.SLEEPING) {\n this.wakeUp();\n } // Compute produced rotational force\n\n\n const rotForce = Body_applyForce_rotForce;\n relativePoint.cross(force, rotForce); // Add linear force\n\n this.force.vadd(force, this.force); // Add rotational force\n\n this.torque.vadd(rotForce, this.torque);\n }\n /**\n * Apply force to a local point in the body.\n * @param force The force vector to apply, defined locally in the body frame.\n * @param localPoint A local point in the body to apply the force on.\n */\n\n\n applyLocalForce(localForce, localPoint) {\n if (localPoint === void 0) {\n localPoint = new Vec3();\n }\n\n if (this.type !== Body.DYNAMIC) {\n return;\n }\n\n const worldForce = Body_applyLocalForce_worldForce;\n const relativePointWorld = Body_applyLocalForce_relativePointWorld; // Transform the force vector to world space\n\n this.vectorToWorldFrame(localForce, worldForce);\n this.vectorToWorldFrame(localPoint, relativePointWorld);\n this.applyForce(worldForce, relativePointWorld);\n }\n /**\n * Apply torque to the body.\n * @param torque The amount of torque to add.\n */\n\n\n applyTorque(torque) {\n if (this.type !== Body.DYNAMIC) {\n return;\n }\n\n if (this.sleepState === Body.SLEEPING) {\n this.wakeUp();\n } // Add rotational force\n\n\n this.torque.vadd(torque, this.torque);\n }\n /**\n * Apply impulse to a point of the body. This could for example be a point on the Body surface.\n * An impulse is a force added to a body during a short period of time (impulse = force * time).\n * Impulses will be added to Body.velocity and Body.angularVelocity.\n * @param impulse The amount of impulse to add.\n * @param relativePoint A point relative to the center of mass to apply the force on.\n */\n\n\n applyImpulse(impulse, relativePoint) {\n if (relativePoint === void 0) {\n relativePoint = new Vec3();\n }\n\n if (this.type !== Body.DYNAMIC) {\n return;\n }\n\n if (this.sleepState === Body.SLEEPING) {\n this.wakeUp();\n } // Compute point position relative to the body center\n\n\n const r = relativePoint; // Compute produced central impulse velocity\n\n const velo = Body_applyImpulse_velo;\n velo.copy(impulse);\n velo.scale(this.invMass, velo); // Add linear impulse\n\n this.velocity.vadd(velo, this.velocity); // Compute produced rotational impulse velocity\n\n const rotVelo = Body_applyImpulse_rotVelo;\n r.cross(impulse, rotVelo);\n /*\n rotVelo.x *= this.invInertia.x;\n rotVelo.y *= this.invInertia.y;\n rotVelo.z *= this.invInertia.z;\n */\n\n this.invInertiaWorld.vmult(rotVelo, rotVelo); // Add rotational Impulse\n\n this.angularVelocity.vadd(rotVelo, this.angularVelocity);\n }\n /**\n * Apply locally-defined impulse to a local point in the body.\n * @param force The force vector to apply, defined locally in the body frame.\n * @param localPoint A local point in the body to apply the force on.\n */\n\n\n applyLocalImpulse(localImpulse, localPoint) {\n if (localPoint === void 0) {\n localPoint = new Vec3();\n }\n\n if (this.type !== Body.DYNAMIC) {\n return;\n }\n\n const worldImpulse = Body_applyLocalImpulse_worldImpulse;\n const relativePointWorld = Body_applyLocalImpulse_relativePoint; // Transform the force vector to world space\n\n this.vectorToWorldFrame(localImpulse, worldImpulse);\n this.vectorToWorldFrame(localPoint, relativePointWorld);\n this.applyImpulse(worldImpulse, relativePointWorld);\n }\n /**\n * Should be called whenever you change the body shape or mass.\n */\n\n\n updateMassProperties() {\n const halfExtents = Body_updateMassProperties_halfExtents;\n this.invMass = this.mass > 0 ? 1.0 / this.mass : 0;\n const I = this.inertia;\n const fixed = this.fixedRotation; // Approximate with AABB box\n\n this.updateAABB();\n halfExtents.set((this.aabb.upperBound.x - this.aabb.lowerBound.x) / 2, (this.aabb.upperBound.y - this.aabb.lowerBound.y) / 2, (this.aabb.upperBound.z - this.aabb.lowerBound.z) / 2);\n Box.calculateInertia(halfExtents, this.mass, I);\n this.invInertia.set(I.x > 0 && !fixed ? 1.0 / I.x : 0, I.y > 0 && !fixed ? 1.0 / I.y : 0, I.z > 0 && !fixed ? 1.0 / I.z : 0);\n this.updateInertiaWorld(true);\n }\n /**\n * Get world velocity of a point in the body.\n * @param worldPoint\n * @param result\n * @return The result vector.\n */\n\n\n getVelocityAtWorldPoint(worldPoint, result) {\n const r = new Vec3();\n worldPoint.vsub(this.position, r);\n this.angularVelocity.cross(r, result);\n this.velocity.vadd(result, result);\n return result;\n }\n /**\n * Move the body forward in time.\n * @param dt Time step\n * @param quatNormalize Set to true to normalize the body quaternion\n * @param quatNormalizeFast If the quaternion should be normalized using \"fast\" quaternion normalization\n */\n\n\n integrate(dt, quatNormalize, quatNormalizeFast) {\n // Save previous position\n this.previousPosition.copy(this.position);\n this.previousQuaternion.copy(this.quaternion);\n\n if (!(this.type === Body.DYNAMIC || this.type === Body.KINEMATIC) || this.sleepState === Body.SLEEPING) {\n // Only for dynamic\n return;\n }\n\n const velo = this.velocity;\n const angularVelo = this.angularVelocity;\n const pos = this.position;\n const force = this.force;\n const torque = this.torque;\n const quat = this.quaternion;\n const invMass = this.invMass;\n const invInertia = this.invInertiaWorld;\n const linearFactor = this.linearFactor;\n const iMdt = invMass * dt;\n velo.x += force.x * iMdt * linearFactor.x;\n velo.y += force.y * iMdt * linearFactor.y;\n velo.z += force.z * iMdt * linearFactor.z;\n const e = invInertia.elements;\n const angularFactor = this.angularFactor;\n const tx = torque.x * angularFactor.x;\n const ty = torque.y * angularFactor.y;\n const tz = torque.z * angularFactor.z;\n angularVelo.x += dt * (e[0] * tx + e[1] * ty + e[2] * tz);\n angularVelo.y += dt * (e[3] * tx + e[4] * ty + e[5] * tz);\n angularVelo.z += dt * (e[6] * tx + e[7] * ty + e[8] * tz); // Use new velocity - leap frog\n\n pos.x += velo.x * dt;\n pos.y += velo.y * dt;\n pos.z += velo.z * dt;\n quat.integrate(this.angularVelocity, dt, this.angularFactor, quat);\n\n if (quatNormalize) {\n if (quatNormalizeFast) {\n quat.normalizeFast();\n } else {\n quat.normalize();\n }\n }\n\n this.aabbNeedsUpdate = true; // Update world inertia\n\n this.updateInertiaWorld();\n }\n\n}\nBody.idCounter = 0;\nBody.COLLIDE_EVENT_NAME = 'collide';\nBody.DYNAMIC = BODY_TYPES.DYNAMIC;\nBody.STATIC = BODY_TYPES.STATIC;\nBody.KINEMATIC = BODY_TYPES.KINEMATIC;\nBody.AWAKE = BODY_SLEEP_STATES.AWAKE;\nBody.SLEEPY = BODY_SLEEP_STATES.SLEEPY;\nBody.SLEEPING = BODY_SLEEP_STATES.SLEEPING;\nBody.wakeupEvent = {\n type: 'wakeup'\n};\nBody.sleepyEvent = {\n type: 'sleepy'\n};\nBody.sleepEvent = {\n type: 'sleep'\n};\nconst tmpVec = new Vec3();\nconst tmpQuat = new Quaternion();\nconst updateAABB_shapeAABB = new AABB();\nconst uiw_m1 = new Mat3();\nconst uiw_m2 = new Mat3();\nconst uiw_m3 = new Mat3();\nconst Body_applyForce_rotForce = new Vec3();\nconst Body_applyLocalForce_worldForce = new Vec3();\nconst Body_applyLocalForce_relativePointWorld = new Vec3();\nconst Body_applyImpulse_velo = new Vec3();\nconst Body_applyImpulse_rotVelo = new Vec3();\nconst Body_applyLocalImpulse_worldImpulse = new Vec3();\nconst Body_applyLocalImpulse_relativePoint = new Vec3();\nconst Body_updateMassProperties_halfExtents = new Vec3();\n\n/**\n * Base class for broadphase implementations\n * @author schteppe\n */\nclass Broadphase {\n /**\n * The world to search for collisions in.\n */\n\n /**\n * If set to true, the broadphase uses bounding boxes for intersection tests, else it uses bounding spheres.\n */\n\n /**\n * Set to true if the objects in the world moved.\n */\n constructor() {\n this.world = null;\n this.useBoundingBoxes = false;\n this.dirty = true;\n }\n /**\n * Get the collision pairs from the world\n * @param world The world to search in\n * @param p1 Empty array to be filled with body objects\n * @param p2 Empty array to be filled with body objects\n */\n\n\n collisionPairs(world, p1, p2) {\n throw new Error('collisionPairs not implemented for this BroadPhase class!');\n }\n /**\n * Check if a body pair needs to be intersection tested at all.\n */\n\n\n needBroadphaseCollision(bodyA, bodyB) {\n // Check collision filter masks\n if ((bodyA.collisionFilterGroup & bodyB.collisionFilterMask) === 0 || (bodyB.collisionFilterGroup & bodyA.collisionFilterMask) === 0) {\n return false;\n } // Check types\n\n\n if (((bodyA.type & Body.STATIC) !== 0 || bodyA.sleepState === Body.SLEEPING) && ((bodyB.type & Body.STATIC) !== 0 || bodyB.sleepState === Body.SLEEPING)) {\n // Both bodies are static or sleeping. Skip.\n return false;\n }\n\n return true;\n }\n /**\n * Check if the bounding volumes of two bodies intersect.\n */\n\n\n intersectionTest(bodyA, bodyB, pairs1, pairs2) {\n if (this.useBoundingBoxes) {\n this.doBoundingBoxBroadphase(bodyA, bodyB, pairs1, pairs2);\n } else {\n this.doBoundingSphereBroadphase(bodyA, bodyB, pairs1, pairs2);\n }\n }\n /**\n * Check if the bounding spheres of two bodies are intersecting.\n * @param pairs1 bodyA is appended to this array if intersection\n * @param pairs2 bodyB is appended to this array if intersection\n */\n\n\n doBoundingSphereBroadphase(bodyA, bodyB, pairs1, pairs2) {\n const r = Broadphase_collisionPairs_r;\n bodyB.position.vsub(bodyA.position, r);\n const boundingRadiusSum2 = (bodyA.boundingRadius + bodyB.boundingRadius) ** 2;\n const norm2 = r.lengthSquared();\n\n if (norm2 < boundingRadiusSum2) {\n pairs1.push(bodyA);\n pairs2.push(bodyB);\n }\n }\n /**\n * Check if the bounding boxes of two bodies are intersecting.\n */\n\n\n doBoundingBoxBroadphase(bodyA, bodyB, pairs1, pairs2) {\n if (bodyA.aabbNeedsUpdate) {\n bodyA.updateAABB();\n }\n\n if (bodyB.aabbNeedsUpdate) {\n bodyB.updateAABB();\n } // Check AABB / AABB\n\n\n if (bodyA.aabb.overlaps(bodyB.aabb)) {\n pairs1.push(bodyA);\n pairs2.push(bodyB);\n }\n }\n /**\n * Removes duplicate pairs from the pair arrays.\n */\n\n\n makePairsUnique(pairs1, pairs2) {\n const t = Broadphase_makePairsUnique_temp;\n const p1 = Broadphase_makePairsUnique_p1;\n const p2 = Broadphase_makePairsUnique_p2;\n const N = pairs1.length;\n\n for (let i = 0; i !== N; i++) {\n p1[i] = pairs1[i];\n p2[i] = pairs2[i];\n }\n\n pairs1.length = 0;\n pairs2.length = 0;\n\n for (let i = 0; i !== N; i++) {\n const id1 = p1[i].id;\n const id2 = p2[i].id;\n const key = id1 < id2 ? `${id1},${id2}` : `${id2},${id1}`;\n t[key] = i;\n t.keys.push(key);\n }\n\n for (let i = 0; i !== t.keys.length; i++) {\n const key = t.keys.pop();\n const pairIndex = t[key];\n pairs1.push(p1[pairIndex]);\n pairs2.push(p2[pairIndex]);\n delete t[key];\n }\n }\n /**\n * To be implemented by subcasses\n */\n\n\n setWorld(world) {}\n /**\n * Check if the bounding spheres of two bodies overlap.\n */\n\n\n static boundingSphereCheck(bodyA, bodyB) {\n const dist = new Vec3(); // bsc_dist;\n\n bodyA.position.vsub(bodyB.position, dist);\n const sa = bodyA.shapes[0];\n const sb = bodyB.shapes[0];\n return Math.pow(sa.boundingSphereRadius + sb.boundingSphereRadius, 2) > dist.lengthSquared();\n }\n /**\n * Returns all the bodies within the AABB.\n */\n\n\n aabbQuery(world, aabb, result) {\n console.warn('.aabbQuery is not implemented in this Broadphase subclass.');\n return [];\n }\n\n} // Temp objects\n\nconst Broadphase_collisionPairs_r = new Vec3();\nnew Vec3();\nnew Quaternion();\nnew Vec3();\nconst Broadphase_makePairsUnique_temp = {\n keys: []\n};\nconst Broadphase_makePairsUnique_p1 = [];\nconst Broadphase_makePairsUnique_p2 = [];\nnew Vec3();\n\n/**\n * Axis aligned uniform grid broadphase.\n * @todo Needs support for more than just planes and spheres.\n */\nclass GridBroadphase extends Broadphase {\n /**\n * Number of boxes along x\n */\n\n /**\n * Number of boxes along y\n */\n\n /**\n * Number of boxes along z\n */\n\n /**\n * aabbMin\n */\n\n /**\n * aabbMax\n */\n\n /**\n * bins\n */\n\n /**\n * binLengths\n */\n\n /**\n * @param nx Number of boxes along x.\n * @param ny Number of boxes along y.\n * @param nz Number of boxes along z.\n */\n constructor(aabbMin, aabbMax, nx, ny, nz) {\n if (aabbMin === void 0) {\n aabbMin = new Vec3(100, 100, 100);\n }\n\n if (aabbMax === void 0) {\n aabbMax = new Vec3(-100, -100, -100);\n }\n\n if (nx === void 0) {\n nx = 10;\n }\n\n if (ny === void 0) {\n ny = 10;\n }\n\n if (nz === void 0) {\n nz = 10;\n }\n\n super();\n this.nx = nx;\n this.ny = ny;\n this.nz = nz;\n this.aabbMin = aabbMin;\n this.aabbMax = aabbMax;\n const nbins = this.nx * this.ny * this.nz;\n\n if (nbins <= 0) {\n throw \"GridBroadphase: Each dimension's n must be >0\";\n }\n\n this.bins = [];\n this.binLengths = []; // Rather than continually resizing arrays (thrashing the memory), just record length and allow them to grow\n\n this.bins.length = nbins;\n this.binLengths.length = nbins;\n\n for (let i = 0; i < nbins; i++) {\n this.bins[i] = [];\n this.binLengths[i] = 0;\n }\n }\n /**\n * Get all the collision pairs in the physics world\n */\n\n\n collisionPairs(world, pairs1, pairs2) {\n const N = world.bodies.length;\n const bodies = world.bodies;\n const max = this.aabbMax;\n const min = this.aabbMin;\n const nx = this.nx;\n const ny = this.ny;\n const nz = this.nz;\n const xstep = ny * nz;\n const ystep = nz;\n const zstep = 1;\n const xmax = max.x;\n const ymax = max.y;\n const zmax = max.z;\n const xmin = min.x;\n const ymin = min.y;\n const zmin = min.z;\n const xmult = nx / (xmax - xmin);\n const ymult = ny / (ymax - ymin);\n const zmult = nz / (zmax - zmin);\n const binsizeX = (xmax - xmin) / nx;\n const binsizeY = (ymax - ymin) / ny;\n const binsizeZ = (zmax - zmin) / nz;\n const binRadius = Math.sqrt(binsizeX * binsizeX + binsizeY * binsizeY + binsizeZ * binsizeZ) * 0.5;\n const types = Shape.types;\n const SPHERE = types.SPHERE;\n const PLANE = types.PLANE;\n types.BOX;\n types.COMPOUND;\n types.CONVEXPOLYHEDRON;\n const bins = this.bins;\n const binLengths = this.binLengths;\n const Nbins = this.bins.length; // Reset bins\n\n for (let i = 0; i !== Nbins; i++) {\n binLengths[i] = 0;\n }\n\n const ceil = Math.ceil;\n\n function addBoxToBins(x0, y0, z0, x1, y1, z1, bi) {\n let xoff0 = (x0 - xmin) * xmult | 0;\n let yoff0 = (y0 - ymin) * ymult | 0;\n let zoff0 = (z0 - zmin) * zmult | 0;\n let xoff1 = ceil((x1 - xmin) * xmult);\n let yoff1 = ceil((y1 - ymin) * ymult);\n let zoff1 = ceil((z1 - zmin) * zmult);\n\n if (xoff0 < 0) {\n xoff0 = 0;\n } else if (xoff0 >= nx) {\n xoff0 = nx - 1;\n }\n\n if (yoff0 < 0) {\n yoff0 = 0;\n } else if (yoff0 >= ny) {\n yoff0 = ny - 1;\n }\n\n if (zoff0 < 0) {\n zoff0 = 0;\n } else if (zoff0 >= nz) {\n zoff0 = nz - 1;\n }\n\n if (xoff1 < 0) {\n xoff1 = 0;\n } else if (xoff1 >= nx) {\n xoff1 = nx - 1;\n }\n\n if (yoff1 < 0) {\n yoff1 = 0;\n } else if (yoff1 >= ny) {\n yoff1 = ny - 1;\n }\n\n if (zoff1 < 0) {\n zoff1 = 0;\n } else if (zoff1 >= nz) {\n zoff1 = nz - 1;\n }\n\n xoff0 *= xstep;\n yoff0 *= ystep;\n zoff0 *= zstep;\n xoff1 *= xstep;\n yoff1 *= ystep;\n zoff1 *= zstep;\n\n for (let xoff = xoff0; xoff <= xoff1; xoff += xstep) {\n for (let yoff = yoff0; yoff <= yoff1; yoff += ystep) {\n for (let zoff = zoff0; zoff <= zoff1; zoff += zstep) {\n const idx = xoff + yoff + zoff;\n bins[idx][binLengths[idx]++] = bi;\n }\n }\n }\n } // Put all bodies into the bins\n\n\n for (let i = 0; i !== N; i++) {\n const bi = bodies[i];\n const si = bi.shapes[0];\n\n switch (si.type) {\n case SPHERE:\n {\n const shape = si; // Put in bin\n // check if overlap with other bins\n\n const x = bi.position.x;\n const y = bi.position.y;\n const z = bi.position.z;\n const r = shape.radius;\n addBoxToBins(x - r, y - r, z - r, x + r, y + r, z + r, bi);\n break;\n }\n\n case PLANE:\n {\n const shape = si;\n\n if (shape.worldNormalNeedsUpdate) {\n shape.computeWorldNormal(bi.quaternion);\n }\n\n const planeNormal = shape.worldNormal; //Relative position from origin of plane object to the first bin\n //Incremented as we iterate through the bins\n\n const xreset = xmin + binsizeX * 0.5 - bi.position.x;\n const yreset = ymin + binsizeY * 0.5 - bi.position.y;\n const zreset = zmin + binsizeZ * 0.5 - bi.position.z;\n const d = GridBroadphase_collisionPairs_d;\n d.set(xreset, yreset, zreset);\n\n for (let xi = 0, xoff = 0; xi !== nx; xi++, xoff += xstep, d.y = yreset, d.x += binsizeX) {\n for (let yi = 0, yoff = 0; yi !== ny; yi++, yoff += ystep, d.z = zreset, d.y += binsizeY) {\n for (let zi = 0, zoff = 0; zi !== nz; zi++, zoff += zstep, d.z += binsizeZ) {\n if (d.dot(planeNormal) < binRadius) {\n const idx = xoff + yoff + zoff;\n bins[idx][binLengths[idx]++] = bi;\n }\n }\n }\n }\n\n break;\n }\n\n default:\n {\n if (bi.aabbNeedsUpdate) {\n bi.updateAABB();\n }\n\n addBoxToBins(bi.aabb.lowerBound.x, bi.aabb.lowerBound.y, bi.aabb.lowerBound.z, bi.aabb.upperBound.x, bi.aabb.upperBound.y, bi.aabb.upperBound.z, bi);\n break;\n }\n }\n } // Check each bin\n\n\n for (let i = 0; i !== Nbins; i++) {\n const binLength = binLengths[i]; //Skip bins with no potential collisions\n\n if (binLength > 1) {\n const bin = bins[i]; // Do N^2 broadphase inside\n\n for (let xi = 0; xi !== binLength; xi++) {\n const bi = bin[xi];\n\n for (let yi = 0; yi !== xi; yi++) {\n const bj = bin[yi];\n\n if (this.needBroadphaseCollision(bi, bj)) {\n this.intersectionTest(bi, bj, pairs1, pairs2);\n }\n }\n }\n }\n } //\tfor (let zi = 0, zoff=0; zi < nz; zi++, zoff+= zstep) {\n //\t\tconsole.log(\"layer \"+zi);\n //\t\tfor (let yi = 0, yoff=0; yi < ny; yi++, yoff += ystep) {\n //\t\t\tconst row = '';\n //\t\t\tfor (let xi = 0, xoff=0; xi < nx; xi++, xoff += xstep) {\n //\t\t\t\tconst idx = xoff + yoff + zoff;\n //\t\t\t\trow += ' ' + binLengths[idx];\n //\t\t\t}\n //\t\t\tconsole.log(row);\n //\t\t}\n //\t}\n\n\n this.makePairsUnique(pairs1, pairs2);\n }\n\n}\nconst GridBroadphase_collisionPairs_d = new Vec3();\nnew Vec3();\n\n/**\n * Naive broadphase implementation, used in lack of better ones.\n *\n * The naive broadphase looks at all possible pairs without restriction, therefore it has complexity N^2 _(which is bad)_\n */\nclass NaiveBroadphase extends Broadphase {\n /**\n * @todo Remove useless constructor\n */\n constructor() {\n super();\n }\n /**\n * Get all the collision pairs in the physics world\n */\n\n\n collisionPairs(world, pairs1, pairs2) {\n const bodies = world.bodies;\n const n = bodies.length;\n let bi;\n let bj; // Naive N^2 ftw!\n\n for (let i = 0; i !== n; i++) {\n for (let j = 0; j !== i; j++) {\n bi = bodies[i];\n bj = bodies[j];\n\n if (!this.needBroadphaseCollision(bi, bj)) {\n continue;\n }\n\n this.intersectionTest(bi, bj, pairs1, pairs2);\n }\n }\n }\n /**\n * Returns all the bodies within an AABB.\n * @param result An array to store resulting bodies in.\n */\n\n\n aabbQuery(world, aabb, result) {\n if (result === void 0) {\n result = [];\n }\n\n for (let i = 0; i < world.bodies.length; i++) {\n const b = world.bodies[i];\n\n if (b.aabbNeedsUpdate) {\n b.updateAABB();\n } // Ugly hack until Body gets aabb\n\n\n if (b.aabb.overlaps(aabb)) {\n result.push(b);\n }\n }\n\n return result;\n }\n\n}\n\n/**\n * Storage for Ray casting data\n */\nclass RaycastResult {\n /**\n * rayFromWorld\n */\n\n /**\n * rayToWorld\n */\n\n /**\n * hitNormalWorld\n */\n\n /**\n * hitPointWorld\n */\n\n /**\n * hasHit\n */\n\n /**\n * shape\n */\n\n /**\n * body\n */\n\n /**\n * The index of the hit triangle, if the hit shape was a trimesh\n */\n\n /**\n * Distance to the hit. Will be set to -1 if there was no hit\n */\n\n /**\n * If the ray should stop traversing the bodies\n */\n constructor() {\n this.rayFromWorld = new Vec3();\n this.rayToWorld = new Vec3();\n this.hitNormalWorld = new Vec3();\n this.hitPointWorld = new Vec3();\n this.hasHit = false;\n this.shape = null;\n this.body = null;\n this.hitFaceIndex = -1;\n this.distance = -1;\n this.shouldStop = false;\n }\n /**\n * Reset all result data.\n */\n\n\n reset() {\n this.rayFromWorld.setZero();\n this.rayToWorld.setZero();\n this.hitNormalWorld.setZero();\n this.hitPointWorld.setZero();\n this.hasHit = false;\n this.shape = null;\n this.body = null;\n this.hitFaceIndex = -1;\n this.distance = -1;\n this.shouldStop = false;\n }\n /**\n * abort\n */\n\n\n abort() {\n this.shouldStop = true;\n }\n /**\n * Set result data.\n */\n\n\n set(rayFromWorld, rayToWorld, hitNormalWorld, hitPointWorld, shape, body, distance) {\n this.rayFromWorld.copy(rayFromWorld);\n this.rayToWorld.copy(rayToWorld);\n this.hitNormalWorld.copy(hitNormalWorld);\n this.hitPointWorld.copy(hitPointWorld);\n this.shape = shape;\n this.body = body;\n this.distance = distance;\n }\n\n}\n\nlet _Shape$types$SPHERE, _Shape$types$PLANE, _Shape$types$BOX, _Shape$types$CYLINDER, _Shape$types$CONVEXPO, _Shape$types$HEIGHTFI, _Shape$types$TRIMESH;\n\n/**\n * RAY_MODES\n */\nconst RAY_MODES = {\n /** CLOSEST */\n CLOSEST: 1,\n\n /** ANY */\n ANY: 2,\n\n /** ALL */\n ALL: 4\n};\n/**\n * RayMode\n */\n\n_Shape$types$SPHERE = Shape.types.SPHERE;\n_Shape$types$PLANE = Shape.types.PLANE;\n_Shape$types$BOX = Shape.types.BOX;\n_Shape$types$CYLINDER = Shape.types.CYLINDER;\n_Shape$types$CONVEXPO = Shape.types.CONVEXPOLYHEDRON;\n_Shape$types$HEIGHTFI = Shape.types.HEIGHTFIELD;\n_Shape$types$TRIMESH = Shape.types.TRIMESH;\n\n/**\n * A line in 3D space that intersects bodies and return points.\n */\nclass Ray {\n /**\n * from\n */\n\n /**\n * to\n */\n\n /**\n * direction\n */\n\n /**\n * The precision of the ray. Used when checking parallelity etc.\n * @default 0.0001\n */\n\n /**\n * Set to `false` if you don't want the Ray to take `collisionResponse` flags into account on bodies and shapes.\n * @default true\n */\n\n /**\n * If set to `true`, the ray skips any hits with normal.dot(rayDirection) < 0.\n * @default false\n */\n\n /**\n * collisionFilterMask\n * @default -1\n */\n\n /**\n * collisionFilterGroup\n * @default -1\n */\n\n /**\n * The intersection mode. Should be Ray.ANY, Ray.ALL or Ray.CLOSEST.\n * @default RAY.ANY\n */\n\n /**\n * Current result object.\n */\n\n /**\n * Will be set to `true` during intersectWorld() if the ray hit anything.\n */\n\n /**\n * User-provided result callback. Will be used if mode is Ray.ALL.\n */\n\n /**\n * CLOSEST\n */\n\n /**\n * ANY\n */\n\n /**\n * ALL\n */\n get [_Shape$types$SPHERE]() {\n return this._intersectSphere;\n }\n\n get [_Shape$types$PLANE]() {\n return this._intersectPlane;\n }\n\n get [_Shape$types$BOX]() {\n return this._intersectBox;\n }\n\n get [_Shape$types$CYLINDER]() {\n return this._intersectConvex;\n }\n\n get [_Shape$types$CONVEXPO]() {\n return this._intersectConvex;\n }\n\n get [_Shape$types$HEIGHTFI]() {\n return this._intersectHeightfield;\n }\n\n get [_Shape$types$TRIMESH]() {\n return this._intersectTrimesh;\n }\n\n constructor(from, to) {\n if (from === void 0) {\n from = new Vec3();\n }\n\n if (to === void 0) {\n to = new Vec3();\n }\n\n this.from = from.clone();\n this.to = to.clone();\n this.direction = new Vec3();\n this.precision = 0.0001;\n this.checkCollisionResponse = true;\n this.skipBackfaces = false;\n this.collisionFilterMask = -1;\n this.collisionFilterGroup = -1;\n this.mode = Ray.ANY;\n this.result = new RaycastResult();\n this.hasHit = false;\n\n this.callback = result => {};\n }\n /**\n * Do itersection against all bodies in the given World.\n * @return True if the ray hit anything, otherwise false.\n */\n\n\n intersectWorld(world, options) {\n this.mode = options.mode || Ray.ANY;\n this.result = options.result || new RaycastResult();\n this.skipBackfaces = !!options.skipBackfaces;\n this.collisionFilterMask = typeof options.collisionFilterMask !== 'undefined' ? options.collisionFilterMask : -1;\n this.collisionFilterGroup = typeof options.collisionFilterGroup !== 'undefined' ? options.collisionFilterGroup : -1;\n this.checkCollisionResponse = typeof options.checkCollisionResponse !== 'undefined' ? options.checkCollisionResponse : true;\n\n if (options.from) {\n this.from.copy(options.from);\n }\n\n if (options.to) {\n this.to.copy(options.to);\n }\n\n this.callback = options.callback || (() => {});\n\n this.hasHit = false;\n this.result.reset();\n this.updateDirection();\n this.getAABB(tmpAABB$1);\n tmpArray.length = 0;\n world.broadphase.aabbQuery(world, tmpAABB$1, tmpArray);\n this.intersectBodies(tmpArray);\n return this.hasHit;\n }\n /**\n * Shoot a ray at a body, get back information about the hit.\n * @deprecated @param result set the result property of the Ray instead.\n */\n\n\n intersectBody(body, result) {\n if (result) {\n this.result = result;\n this.updateDirection();\n }\n\n const checkCollisionResponse = this.checkCollisionResponse;\n\n if (checkCollisionResponse && !body.collisionResponse) {\n return;\n }\n\n if ((this.collisionFilterGroup & body.collisionFilterMask) === 0 || (body.collisionFilterGroup & this.collisionFilterMask) === 0) {\n return;\n }\n\n const xi = intersectBody_xi;\n const qi = intersectBody_qi;\n\n for (let i = 0, N = body.shapes.length; i < N; i++) {\n const shape = body.shapes[i];\n\n if (checkCollisionResponse && !shape.collisionResponse) {\n continue; // Skip\n }\n\n body.quaternion.mult(body.shapeOrientations[i], qi);\n body.quaternion.vmult(body.shapeOffsets[i], xi);\n xi.vadd(body.position, xi);\n this.intersectShape(shape, qi, xi, body);\n\n if (this.result.shouldStop) {\n break;\n }\n }\n }\n /**\n * Shoot a ray at an array bodies, get back information about the hit.\n * @param bodies An array of Body objects.\n * @deprecated @param result set the result property of the Ray instead.\n *\n */\n\n\n intersectBodies(bodies, result) {\n if (result) {\n this.result = result;\n this.updateDirection();\n }\n\n for (let i = 0, l = bodies.length; !this.result.shouldStop && i < l; i++) {\n this.intersectBody(bodies[i]);\n }\n }\n /**\n * Updates the direction vector.\n */\n\n\n updateDirection() {\n this.to.vsub(this.from, this.direction);\n this.direction.normalize();\n }\n\n intersectShape(shape, quat, position, body) {\n const from = this.from; // Checking boundingSphere\n\n const distance = distanceFromIntersection(from, this.direction, position);\n\n if (distance > shape.boundingSphereRadius) {\n return;\n }\n\n const intersectMethod = this[shape.type];\n\n if (intersectMethod) {\n intersectMethod.call(this, shape, quat, position, body, shape);\n }\n }\n\n _intersectBox(box, quat, position, body, reportedShape) {\n return this._intersectConvex(box.convexPolyhedronRepresentation, quat, position, body, reportedShape);\n }\n\n _intersectPlane(shape, quat, position, body, reportedShape) {\n const from = this.from;\n const to = this.to;\n const direction = this.direction; // Get plane normal\n\n const worldNormal = new Vec3(0, 0, 1);\n quat.vmult(worldNormal, worldNormal);\n const len = new Vec3();\n from.vsub(position, len);\n const planeToFrom = len.dot(worldNormal);\n to.vsub(position, len);\n const planeToTo = len.dot(worldNormal);\n\n if (planeToFrom * planeToTo > 0) {\n // \"from\" and \"to\" are on the same side of the plane... bail out\n return;\n }\n\n if (from.distanceTo(to) < planeToFrom) {\n return;\n }\n\n const n_dot_dir = worldNormal.dot(direction);\n\n if (Math.abs(n_dot_dir) < this.precision) {\n // No intersection\n return;\n }\n\n const planePointToFrom = new Vec3();\n const dir_scaled_with_t = new Vec3();\n const hitPointWorld = new Vec3();\n from.vsub(position, planePointToFrom);\n const t = -worldNormal.dot(planePointToFrom) / n_dot_dir;\n direction.scale(t, dir_scaled_with_t);\n from.vadd(dir_scaled_with_t, hitPointWorld);\n this.reportIntersection(worldNormal, hitPointWorld, reportedShape, body, -1);\n }\n /**\n * Get the world AABB of the ray.\n */\n\n\n getAABB(aabb) {\n const {\n lowerBound,\n upperBound\n } = aabb;\n const to = this.to;\n const from = this.from;\n lowerBound.x = Math.min(to.x, from.x);\n lowerBound.y = Math.min(to.y, from.y);\n lowerBound.z = Math.min(to.z, from.z);\n upperBound.x = Math.max(to.x, from.x);\n upperBound.y = Math.max(to.y, from.y);\n upperBound.z = Math.max(to.z, from.z);\n }\n\n _intersectHeightfield(shape, quat, position, body, reportedShape) {\n shape.data;\n shape.elementSize; // Convert the ray to local heightfield coordinates\n\n const localRay = intersectHeightfield_localRay; //new Ray(this.from, this.to);\n\n localRay.from.copy(this.from);\n localRay.to.copy(this.to);\n Transform.pointToLocalFrame(position, quat, localRay.from, localRay.from);\n Transform.pointToLocalFrame(position, quat, localRay.to, localRay.to);\n localRay.updateDirection(); // Get the index of the data points to test against\n\n const index = intersectHeightfield_index;\n let iMinX;\n let iMinY;\n let iMaxX;\n let iMaxY; // Set to max\n\n iMinX = iMinY = 0;\n iMaxX = iMaxY = shape.data.length - 1;\n const aabb = new AABB();\n localRay.getAABB(aabb);\n shape.getIndexOfPosition(aabb.lowerBound.x, aabb.lowerBound.y, index, true);\n iMinX = Math.max(iMinX, index[0]);\n iMinY = Math.max(iMinY, index[1]);\n shape.getIndexOfPosition(aabb.upperBound.x, aabb.upperBound.y, index, true);\n iMaxX = Math.min(iMaxX, index[0] + 1);\n iMaxY = Math.min(iMaxY, index[1] + 1);\n\n for (let i = iMinX; i < iMaxX; i++) {\n for (let j = iMinY; j < iMaxY; j++) {\n if (this.result.shouldStop) {\n return;\n }\n\n shape.getAabbAtIndex(i, j, aabb);\n\n if (!aabb.overlapsRay(localRay)) {\n continue;\n } // Lower triangle\n\n\n shape.getConvexTrianglePillar(i, j, false);\n Transform.pointToWorldFrame(position, quat, shape.pillarOffset, worldPillarOffset);\n\n this._intersectConvex(shape.pillarConvex, quat, worldPillarOffset, body, reportedShape, intersectConvexOptions);\n\n if (this.result.shouldStop) {\n return;\n } // Upper triangle\n\n\n shape.getConvexTrianglePillar(i, j, true);\n Transform.pointToWorldFrame(position, quat, shape.pillarOffset, worldPillarOffset);\n\n this._intersectConvex(shape.pillarConvex, quat, worldPillarOffset, body, reportedShape, intersectConvexOptions);\n }\n }\n }\n\n _intersectSphere(sphere, quat, position, body, reportedShape) {\n const from = this.from;\n const to = this.to;\n const r = sphere.radius;\n const a = (to.x - from.x) ** 2 + (to.y - from.y) ** 2 + (to.z - from.z) ** 2;\n const b = 2 * ((to.x - from.x) * (from.x - position.x) + (to.y - from.y) * (from.y - position.y) + (to.z - from.z) * (from.z - position.z));\n const c = (from.x - position.x) ** 2 + (from.y - position.y) ** 2 + (from.z - position.z) ** 2 - r ** 2;\n const delta = b ** 2 - 4 * a * c;\n const intersectionPoint = Ray_intersectSphere_intersectionPoint;\n const normal = Ray_intersectSphere_normal;\n\n if (delta < 0) {\n // No intersection\n return;\n } else if (delta === 0) {\n // single intersection point\n from.lerp(to, delta, intersectionPoint);\n intersectionPoint.vsub(position, normal);\n normal.normalize();\n this.reportIntersection(normal, intersectionPoint, reportedShape, body, -1);\n } else {\n const d1 = (-b - Math.sqrt(delta)) / (2 * a);\n const d2 = (-b + Math.sqrt(delta)) / (2 * a);\n\n if (d1 >= 0 && d1 <= 1) {\n from.lerp(to, d1, intersectionPoint);\n intersectionPoint.vsub(position, normal);\n normal.normalize();\n this.reportIntersection(normal, intersectionPoint, reportedShape, body, -1);\n }\n\n if (this.result.shouldStop) {\n return;\n }\n\n if (d2 >= 0 && d2 <= 1) {\n from.lerp(to, d2, intersectionPoint);\n intersectionPoint.vsub(position, normal);\n normal.normalize();\n this.reportIntersection(normal, intersectionPoint, reportedShape, body, -1);\n }\n }\n }\n\n _intersectConvex(shape, quat, position, body, reportedShape, options) {\n intersectConvex_minDistNormal;\n const normal = intersectConvex_normal;\n const vector = intersectConvex_vector;\n intersectConvex_minDistIntersect;\n const faceList = options && options.faceList || null; // Checking faces\n\n const faces = shape.faces;\n const vertices = shape.vertices;\n const normals = shape.faceNormals;\n const direction = this.direction;\n const from = this.from;\n const to = this.to;\n const fromToDistance = from.distanceTo(to);\n const Nfaces = faceList ? faceList.length : faces.length;\n const result = this.result;\n\n for (let j = 0; !result.shouldStop && j < Nfaces; j++) {\n const fi = faceList ? faceList[j] : j;\n const face = faces[fi];\n const faceNormal = normals[fi];\n const q = quat;\n const x = position; // determine if ray intersects the plane of the face\n // note: this works regardless of the direction of the face normal\n // Get plane point in world coordinates...\n\n vector.copy(vertices[face[0]]);\n q.vmult(vector, vector);\n vector.vadd(x, vector); // ...but make it relative to the ray from. We'll fix this later.\n\n vector.vsub(from, vector); // Get plane normal\n\n q.vmult(faceNormal, normal); // If this dot product is negative, we have something interesting\n\n const dot = direction.dot(normal); // Bail out if ray and plane are parallel\n\n if (Math.abs(dot) < this.precision) {\n continue;\n } // calc distance to plane\n\n\n const scalar = normal.dot(vector) / dot; // if negative distance, then plane is behind ray\n\n if (scalar < 0) {\n continue;\n } // if (dot < 0) {\n // Intersection point is from + direction * scalar\n\n\n direction.scale(scalar, intersectPoint);\n intersectPoint.vadd(from, intersectPoint); // a is the point we compare points b and c with.\n\n a.copy(vertices[face[0]]);\n q.vmult(a, a);\n x.vadd(a, a);\n\n for (let i = 1; !result.shouldStop && i < face.length - 1; i++) {\n // Transform 3 vertices to world coords\n b.copy(vertices[face[i]]);\n c.copy(vertices[face[i + 1]]);\n q.vmult(b, b);\n q.vmult(c, c);\n x.vadd(b, b);\n x.vadd(c, c);\n const distance = intersectPoint.distanceTo(from);\n\n if (!(Ray.pointInTriangle(intersectPoint, a, b, c) || Ray.pointInTriangle(intersectPoint, b, a, c)) || distance > fromToDistance) {\n continue;\n }\n\n this.reportIntersection(normal, intersectPoint, reportedShape, body, fi);\n } // }\n\n }\n }\n /**\n * @todo Optimize by transforming the world to local space first.\n * @todo Use Octree lookup\n */\n\n\n _intersectTrimesh(mesh, quat, position, body, reportedShape, options) {\n const normal = intersectTrimesh_normal;\n const triangles = intersectTrimesh_triangles;\n const treeTransform = intersectTrimesh_treeTransform;\n const vector = intersectConvex_vector;\n const localDirection = intersectTrimesh_localDirection;\n const localFrom = intersectTrimesh_localFrom;\n const localTo = intersectTrimesh_localTo;\n const worldIntersectPoint = intersectTrimesh_worldIntersectPoint;\n const worldNormal = intersectTrimesh_worldNormal; // Checking faces\n\n const indices = mesh.indices;\n mesh.vertices; // const normals = mesh.faceNormals\n\n const from = this.from;\n const to = this.to;\n const direction = this.direction;\n treeTransform.position.copy(position);\n treeTransform.quaternion.copy(quat); // Transform ray to local space!\n\n Transform.vectorToLocalFrame(position, quat, direction, localDirection);\n Transform.pointToLocalFrame(position, quat, from, localFrom);\n Transform.pointToLocalFrame(position, quat, to, localTo);\n localTo.x *= mesh.scale.x;\n localTo.y *= mesh.scale.y;\n localTo.z *= mesh.scale.z;\n localFrom.x *= mesh.scale.x;\n localFrom.y *= mesh.scale.y;\n localFrom.z *= mesh.scale.z;\n localTo.vsub(localFrom, localDirection);\n localDirection.normalize();\n const fromToDistanceSquared = localFrom.distanceSquared(localTo);\n mesh.tree.rayQuery(this, treeTransform, triangles);\n\n for (let i = 0, N = triangles.length; !this.result.shouldStop && i !== N; i++) {\n const trianglesIndex = triangles[i];\n mesh.getNormal(trianglesIndex, normal); // determine if ray intersects the plane of the face\n // note: this works regardless of the direction of the face normal\n // Get plane point in world coordinates...\n\n mesh.getVertex(indices[trianglesIndex * 3], a); // ...but make it relative to the ray from. We'll fix this later.\n\n a.vsub(localFrom, vector); // If this dot product is negative, we have something interesting\n\n const dot = localDirection.dot(normal); // Bail out if ray and plane are parallel\n // if (Math.abs( dot ) < this.precision){\n // continue;\n // }\n // calc distance to plane\n\n const scalar = normal.dot(vector) / dot; // if negative distance, then plane is behind ray\n\n if (scalar < 0) {\n continue;\n } // Intersection point is from + direction * scalar\n\n\n localDirection.scale(scalar, intersectPoint);\n intersectPoint.vadd(localFrom, intersectPoint); // Get triangle vertices\n\n mesh.getVertex(indices[trianglesIndex * 3 + 1], b);\n mesh.getVertex(indices[trianglesIndex * 3 + 2], c);\n const squaredDistance = intersectPoint.distanceSquared(localFrom);\n\n if (!(Ray.pointInTriangle(intersectPoint, b, a, c) || Ray.pointInTriangle(intersectPoint, a, b, c)) || squaredDistance > fromToDistanceSquared) {\n continue;\n } // transform intersectpoint and normal to world\n\n\n Transform.vectorToWorldFrame(quat, normal, worldNormal);\n Transform.pointToWorldFrame(position, quat, intersectPoint, worldIntersectPoint);\n this.reportIntersection(worldNormal, worldIntersectPoint, reportedShape, body, trianglesIndex);\n }\n\n triangles.length = 0;\n }\n /**\n * @return True if the intersections should continue\n */\n\n\n reportIntersection(normal, hitPointWorld, shape, body, hitFaceIndex) {\n const from = this.from;\n const to = this.to;\n const distance = from.distanceTo(hitPointWorld);\n const result = this.result; // Skip back faces?\n\n if (this.skipBackfaces && normal.dot(this.direction) > 0) {\n return;\n }\n\n result.hitFaceIndex = typeof hitFaceIndex !== 'undefined' ? hitFaceIndex : -1;\n\n switch (this.mode) {\n case Ray.ALL:\n this.hasHit = true;\n result.set(from, to, normal, hitPointWorld, shape, body, distance);\n result.hasHit = true;\n this.callback(result);\n break;\n\n case Ray.CLOSEST:\n // Store if closer than current closest\n if (distance < result.distance || !result.hasHit) {\n this.hasHit = true;\n result.hasHit = true;\n result.set(from, to, normal, hitPointWorld, shape, body, distance);\n }\n\n break;\n\n case Ray.ANY:\n // Report and stop.\n this.hasHit = true;\n result.hasHit = true;\n result.set(from, to, normal, hitPointWorld, shape, body, distance);\n result.shouldStop = true;\n break;\n }\n }\n /**\n * As per \"Barycentric Technique\" as named\n * {@link https://www.blackpawn.com/texts/pointinpoly/default.html here} but without the division\n */\n\n\n static pointInTriangle(p, a, b, c) {\n c.vsub(a, v0);\n b.vsub(a, v1);\n p.vsub(a, v2);\n const dot00 = v0.dot(v0);\n const dot01 = v0.dot(v1);\n const dot02 = v0.dot(v2);\n const dot11 = v1.dot(v1);\n const dot12 = v1.dot(v2);\n let u;\n let v;\n return (u = dot11 * dot02 - dot01 * dot12) >= 0 && (v = dot00 * dot12 - dot01 * dot02) >= 0 && u + v < dot00 * dot11 - dot01 * dot01;\n }\n\n}\nRay.CLOSEST = RAY_MODES.CLOSEST;\nRay.ANY = RAY_MODES.ANY;\nRay.ALL = RAY_MODES.ALL;\nconst tmpAABB$1 = new AABB();\nconst tmpArray = [];\nconst v1 = new Vec3();\nconst v2 = new Vec3();\nconst intersectBody_xi = new Vec3();\nconst intersectBody_qi = new Quaternion();\nconst intersectPoint = new Vec3();\nconst a = new Vec3();\nconst b = new Vec3();\nconst c = new Vec3();\nnew Vec3();\nnew RaycastResult();\nconst intersectConvexOptions = {\n faceList: [0]\n};\nconst worldPillarOffset = new Vec3();\nconst intersectHeightfield_localRay = new Ray();\nconst intersectHeightfield_index = [];\nconst Ray_intersectSphere_intersectionPoint = new Vec3();\nconst Ray_intersectSphere_normal = new Vec3();\nconst intersectConvex_normal = new Vec3();\nconst intersectConvex_minDistNormal = new Vec3();\nconst intersectConvex_minDistIntersect = new Vec3();\nconst intersectConvex_vector = new Vec3();\nconst intersectTrimesh_normal = new Vec3();\nconst intersectTrimesh_localDirection = new Vec3();\nconst intersectTrimesh_localFrom = new Vec3();\nconst intersectTrimesh_localTo = new Vec3();\nconst intersectTrimesh_worldNormal = new Vec3();\nconst intersectTrimesh_worldIntersectPoint = new Vec3();\nnew AABB();\nconst intersectTrimesh_triangles = [];\nconst intersectTrimesh_treeTransform = new Transform();\nconst v0 = new Vec3();\nconst intersect = new Vec3();\n\nfunction distanceFromIntersection(from, direction, position) {\n // v0 is vector from from to position\n position.vsub(from, v0);\n const dot = v0.dot(direction); // intersect = direction*dot + from\n\n direction.scale(dot, intersect);\n intersect.vadd(from, intersect);\n const distance = position.distanceTo(intersect);\n return distance;\n}\n\n/**\n * Sweep and prune broadphase along one axis.\n */\nclass SAPBroadphase extends Broadphase {\n /**\n * List of bodies currently in the broadphase.\n */\n\n /**\n * The world to search in.\n */\n\n /**\n * Axis to sort the bodies along.\n * Set to 0 for x axis, and 1 for y axis.\n * For best performance, pick the axis where bodies are most distributed.\n */\n\n /**\n * Check if the bounds of two bodies overlap, along the given SAP axis.\n */\n static checkBounds(bi, bj, axisIndex) {\n let biPos;\n let bjPos;\n\n if (axisIndex === 0) {\n biPos = bi.position.x;\n bjPos = bj.position.x;\n } else if (axisIndex === 1) {\n biPos = bi.position.y;\n bjPos = bj.position.y;\n } else if (axisIndex === 2) {\n biPos = bi.position.z;\n bjPos = bj.position.z;\n }\n\n const ri = bi.boundingRadius,\n rj = bj.boundingRadius,\n boundA2 = biPos + ri,\n boundB1 = bjPos - rj;\n return boundB1 < boundA2;\n } // Note: these are identical, save for x/y/z lowerbound\n\n /**\n * insertionSortX\n */\n\n\n static insertionSortX(a) {\n for (let i = 1, l = a.length; i < l; i++) {\n const v = a[i];\n let j;\n\n for (j = i - 1; j >= 0; j--) {\n if (a[j].aabb.lowerBound.x <= v.aabb.lowerBound.x) {\n break;\n }\n\n a[j + 1] = a[j];\n }\n\n a[j + 1] = v;\n }\n\n return a;\n }\n /**\n * insertionSortY\n */\n\n\n static insertionSortY(a) {\n for (let i = 1, l = a.length; i < l; i++) {\n const v = a[i];\n let j;\n\n for (j = i - 1; j >= 0; j--) {\n if (a[j].aabb.lowerBound.y <= v.aabb.lowerBound.y) {\n break;\n }\n\n a[j + 1] = a[j];\n }\n\n a[j + 1] = v;\n }\n\n return a;\n }\n /**\n * insertionSortZ\n */\n\n\n static insertionSortZ(a) {\n for (let i = 1, l = a.length; i < l; i++) {\n const v = a[i];\n let j;\n\n for (j = i - 1; j >= 0; j--) {\n if (a[j].aabb.lowerBound.z <= v.aabb.lowerBound.z) {\n break;\n }\n\n a[j + 1] = a[j];\n }\n\n a[j + 1] = v;\n }\n\n return a;\n }\n\n constructor(world) {\n super();\n this.axisList = [];\n this.world = null;\n this.axisIndex = 0;\n const axisList = this.axisList;\n\n this._addBodyHandler = event => {\n axisList.push(event.body);\n };\n\n this._removeBodyHandler = event => {\n const idx = axisList.indexOf(event.body);\n\n if (idx !== -1) {\n axisList.splice(idx, 1);\n }\n };\n\n if (world) {\n this.setWorld(world);\n }\n }\n /**\n * Change the world\n */\n\n\n setWorld(world) {\n // Clear the old axis array\n this.axisList.length = 0; // Add all bodies from the new world\n\n for (let i = 0; i < world.bodies.length; i++) {\n this.axisList.push(world.bodies[i]);\n } // Remove old handlers, if any\n\n\n world.removeEventListener('addBody', this._addBodyHandler);\n world.removeEventListener('removeBody', this._removeBodyHandler); // Add handlers to update the list of bodies.\n\n world.addEventListener('addBody', this._addBodyHandler);\n world.addEventListener('removeBody', this._removeBodyHandler);\n this.world = world;\n this.dirty = true;\n }\n /**\n * Collect all collision pairs\n */\n\n\n collisionPairs(world, p1, p2) {\n const bodies = this.axisList;\n const N = bodies.length;\n const axisIndex = this.axisIndex;\n let i;\n let j;\n\n if (this.dirty) {\n this.sortList();\n this.dirty = false;\n } // Look through the list\n\n\n for (i = 0; i !== N; i++) {\n const bi = bodies[i];\n\n for (j = i + 1; j < N; j++) {\n const bj = bodies[j];\n\n if (!this.needBroadphaseCollision(bi, bj)) {\n continue;\n }\n\n if (!SAPBroadphase.checkBounds(bi, bj, axisIndex)) {\n break;\n }\n\n this.intersectionTest(bi, bj, p1, p2);\n }\n }\n }\n\n sortList() {\n const axisList = this.axisList;\n const axisIndex = this.axisIndex;\n const N = axisList.length; // Update AABBs\n\n for (let i = 0; i !== N; i++) {\n const bi = axisList[i];\n\n if (bi.aabbNeedsUpdate) {\n bi.updateAABB();\n }\n } // Sort the list\n\n\n if (axisIndex === 0) {\n SAPBroadphase.insertionSortX(axisList);\n } else if (axisIndex === 1) {\n SAPBroadphase.insertionSortY(axisList);\n } else if (axisIndex === 2) {\n SAPBroadphase.insertionSortZ(axisList);\n }\n }\n /**\n * Computes the variance of the body positions and estimates the best axis to use.\n * Will automatically set property `axisIndex`.\n */\n\n\n autoDetectAxis() {\n let sumX = 0;\n let sumX2 = 0;\n let sumY = 0;\n let sumY2 = 0;\n let sumZ = 0;\n let sumZ2 = 0;\n const bodies = this.axisList;\n const N = bodies.length;\n const invN = 1 / N;\n\n for (let i = 0; i !== N; i++) {\n const b = bodies[i];\n const centerX = b.position.x;\n sumX += centerX;\n sumX2 += centerX * centerX;\n const centerY = b.position.y;\n sumY += centerY;\n sumY2 += centerY * centerY;\n const centerZ = b.position.z;\n sumZ += centerZ;\n sumZ2 += centerZ * centerZ;\n }\n\n const varianceX = sumX2 - sumX * sumX * invN;\n const varianceY = sumY2 - sumY * sumY * invN;\n const varianceZ = sumZ2 - sumZ * sumZ * invN;\n\n if (varianceX > varianceY) {\n if (varianceX > varianceZ) {\n this.axisIndex = 0;\n } else {\n this.axisIndex = 2;\n }\n } else if (varianceY > varianceZ) {\n this.axisIndex = 1;\n } else {\n this.axisIndex = 2;\n }\n }\n /**\n * Returns all the bodies within an AABB.\n * @param result An array to store resulting bodies in.\n */\n\n\n aabbQuery(world, aabb, result) {\n if (result === void 0) {\n result = [];\n }\n\n if (this.dirty) {\n this.sortList();\n this.dirty = false;\n }\n\n const axisIndex = this.axisIndex;\n let axis = 'x';\n\n if (axisIndex === 1) {\n axis = 'y';\n }\n\n if (axisIndex === 2) {\n axis = 'z';\n }\n\n const axisList = this.axisList;\n aabb.lowerBound[axis];\n aabb.upperBound[axis];\n\n for (let i = 0; i < axisList.length; i++) {\n const b = axisList[i];\n\n if (b.aabbNeedsUpdate) {\n b.updateAABB();\n }\n\n if (b.aabb.overlaps(aabb)) {\n result.push(b);\n }\n }\n\n return result;\n }\n\n}\n\nclass Utils {\n /**\n * Extend an options object with default values.\n * @param options The options object. May be falsy: in this case, a new object is created and returned.\n * @param defaults An object containing default values.\n * @return The modified options object.\n */\n static defaults(options, defaults) {\n if (options === void 0) {\n options = {};\n }\n\n for (let key in defaults) {\n if (!(key in options)) {\n options[key] = defaults[key];\n }\n }\n\n return options;\n }\n\n}\n\n/**\n * Constraint base class\n */\nclass Constraint {\n /**\n * Equations to be solved in this constraint.\n */\n\n /**\n * Body A.\n */\n\n /**\n * Body B.\n */\n\n /**\n * Set to false if you don't want the bodies to collide when they are connected.\n */\n constructor(bodyA, bodyB, options) {\n if (options === void 0) {\n options = {};\n }\n\n options = Utils.defaults(options, {\n collideConnected: true,\n wakeUpBodies: true\n });\n this.equations = [];\n this.bodyA = bodyA;\n this.bodyB = bodyB;\n this.id = Constraint.idCounter++;\n this.collideConnected = options.collideConnected;\n\n if (options.wakeUpBodies) {\n if (bodyA) {\n bodyA.wakeUp();\n }\n\n if (bodyB) {\n bodyB.wakeUp();\n }\n }\n }\n /**\n * Update all the equations with data.\n */\n\n\n update() {\n throw new Error('method update() not implmemented in this Constraint subclass!');\n }\n /**\n * Enables all equations in the constraint.\n */\n\n\n enable() {\n const eqs = this.equations;\n\n for (let i = 0; i < eqs.length; i++) {\n eqs[i].enabled = true;\n }\n }\n /**\n * Disables all equations in the constraint.\n */\n\n\n disable() {\n const eqs = this.equations;\n\n for (let i = 0; i < eqs.length; i++) {\n eqs[i].enabled = false;\n }\n }\n\n}\nConstraint.idCounter = 0;\n\n/**\n * An element containing 6 entries, 3 spatial and 3 rotational degrees of freedom.\n */\n\nclass JacobianElement {\n /**\n * spatial\n */\n\n /**\n * rotational\n */\n constructor() {\n this.spatial = new Vec3();\n this.rotational = new Vec3();\n }\n /**\n * Multiply with other JacobianElement\n */\n\n\n multiplyElement(element) {\n return element.spatial.dot(this.spatial) + element.rotational.dot(this.rotational);\n }\n /**\n * Multiply with two vectors\n */\n\n\n multiplyVectors(spatial, rotational) {\n return spatial.dot(this.spatial) + rotational.dot(this.rotational);\n }\n\n}\n\n/**\n * Equation base class.\n *\n * `a`, `b` and `eps` are {@link https://www8.cs.umu.se/kurser/5DV058/VT15/lectures/SPOOKlabnotes.pdf SPOOK} parameters that default to `0.0`. See {@link https://github.com/schteppe/cannon.js/issues/238#issuecomment-147172327 this exchange} for more details on Cannon's physics implementation.\n */\nclass Equation {\n /**\n * Minimum (read: negative max) force to be applied by the constraint.\n */\n\n /**\n * Maximum (read: positive max) force to be applied by the constraint.\n */\n\n /**\n * SPOOK parameter\n */\n\n /**\n * SPOOK parameter\n */\n\n /**\n * SPOOK parameter\n */\n\n /**\n * A number, proportional to the force added to the bodies.\n */\n constructor(bi, bj, minForce, maxForce) {\n if (minForce === void 0) {\n minForce = -1e6;\n }\n\n if (maxForce === void 0) {\n maxForce = 1e6;\n }\n\n this.id = Equation.idCounter++;\n this.minForce = minForce;\n this.maxForce = maxForce;\n this.bi = bi;\n this.bj = bj;\n this.a = 0.0; // SPOOK parameter\n\n this.b = 0.0; // SPOOK parameter\n\n this.eps = 0.0; // SPOOK parameter\n\n this.jacobianElementA = new JacobianElement();\n this.jacobianElementB = new JacobianElement();\n this.enabled = true;\n this.multiplier = 0;\n this.setSpookParams(1e7, 4, 1 / 60); // Set typical spook params\n }\n /**\n * Recalculates a, b, and eps.\n *\n * The Equation constructor sets typical SPOOK parameters as such:\n * * `stiffness` = 1e7\n * * `relaxation` = 4\n * * `timeStep`= 1 / 60, _note the hardcoded refresh rate._\n */\n\n\n setSpookParams(stiffness, relaxation, timeStep) {\n const d = relaxation;\n const k = stiffness;\n const h = timeStep;\n this.a = 4.0 / (h * (1 + 4 * d));\n this.b = 4.0 * d / (1 + 4 * d);\n this.eps = 4.0 / (h * h * k * (1 + 4 * d));\n }\n /**\n * Computes the right hand side of the SPOOK equation\n */\n\n\n computeB(a, b, h) {\n const GW = this.computeGW();\n const Gq = this.computeGq();\n const GiMf = this.computeGiMf();\n return -Gq * a - GW * b - GiMf * h;\n }\n /**\n * Computes G*q, where q are the generalized body coordinates\n */\n\n\n computeGq() {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const xi = bi.position;\n const xj = bj.position;\n return GA.spatial.dot(xi) + GB.spatial.dot(xj);\n }\n /**\n * Computes G*W, where W are the body velocities\n */\n\n\n computeGW() {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const vi = bi.velocity;\n const vj = bj.velocity;\n const wi = bi.angularVelocity;\n const wj = bj.angularVelocity;\n return GA.multiplyVectors(vi, wi) + GB.multiplyVectors(vj, wj);\n }\n /**\n * Computes G*Wlambda, where W are the body velocities\n */\n\n\n computeGWlambda() {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const vi = bi.vlambda;\n const vj = bj.vlambda;\n const wi = bi.wlambda;\n const wj = bj.wlambda;\n return GA.multiplyVectors(vi, wi) + GB.multiplyVectors(vj, wj);\n }\n /**\n * Computes G*inv(M)*f, where M is the mass matrix with diagonal blocks for each body, and f are the forces on the bodies.\n */\n\n\n computeGiMf() {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const fi = bi.force;\n const ti = bi.torque;\n const fj = bj.force;\n const tj = bj.torque;\n const invMassi = bi.invMassSolve;\n const invMassj = bj.invMassSolve;\n fi.scale(invMassi, iMfi);\n fj.scale(invMassj, iMfj);\n bi.invInertiaWorldSolve.vmult(ti, invIi_vmult_taui);\n bj.invInertiaWorldSolve.vmult(tj, invIj_vmult_tauj);\n return GA.multiplyVectors(iMfi, invIi_vmult_taui) + GB.multiplyVectors(iMfj, invIj_vmult_tauj);\n }\n /**\n * Computes G*inv(M)*G'\n */\n\n\n computeGiMGt() {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const invMassi = bi.invMassSolve;\n const invMassj = bj.invMassSolve;\n const invIi = bi.invInertiaWorldSolve;\n const invIj = bj.invInertiaWorldSolve;\n let result = invMassi + invMassj;\n invIi.vmult(GA.rotational, tmp);\n result += tmp.dot(GA.rotational);\n invIj.vmult(GB.rotational, tmp);\n result += tmp.dot(GB.rotational);\n return result;\n }\n /**\n * Add constraint velocity to the bodies.\n */\n\n\n addToWlambda(deltalambda) {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const temp = addToWlambda_temp; // Add to linear velocity\n // v_lambda += inv(M) * delta_lamba * G\n\n bi.vlambda.addScaledVector(bi.invMassSolve * deltalambda, GA.spatial, bi.vlambda);\n bj.vlambda.addScaledVector(bj.invMassSolve * deltalambda, GB.spatial, bj.vlambda); // Add to angular velocity\n\n bi.invInertiaWorldSolve.vmult(GA.rotational, temp);\n bi.wlambda.addScaledVector(deltalambda, temp, bi.wlambda);\n bj.invInertiaWorldSolve.vmult(GB.rotational, temp);\n bj.wlambda.addScaledVector(deltalambda, temp, bj.wlambda);\n }\n /**\n * Compute the denominator part of the SPOOK equation: C = G*inv(M)*G' + eps\n */\n\n\n computeC() {\n return this.computeGiMGt() + this.eps;\n }\n\n}\nEquation.idCounter = 0;\nconst iMfi = new Vec3();\nconst iMfj = new Vec3();\nconst invIi_vmult_taui = new Vec3();\nconst invIj_vmult_tauj = new Vec3();\nconst tmp = new Vec3();\nconst addToWlambda_temp = new Vec3();\n\n/**\n * Contact/non-penetration constraint equation\n */\nclass ContactEquation extends Equation {\n /**\n * \"bounciness\": u1 = -e*u0\n */\n\n /**\n * World-oriented vector that goes from the center of bi to the contact point.\n */\n\n /**\n * World-oriented vector that starts in body j position and goes to the contact point.\n */\n\n /**\n * Contact normal, pointing out of body i.\n */\n constructor(bodyA, bodyB, maxForce) {\n if (maxForce === void 0) {\n maxForce = 1e6;\n }\n\n super(bodyA, bodyB, 0, maxForce);\n this.restitution = 0.0;\n this.ri = new Vec3();\n this.rj = new Vec3();\n this.ni = new Vec3();\n }\n\n computeB(h) {\n const a = this.a;\n const b = this.b;\n const bi = this.bi;\n const bj = this.bj;\n const ri = this.ri;\n const rj = this.rj;\n const rixn = ContactEquation_computeB_temp1;\n const rjxn = ContactEquation_computeB_temp2;\n const vi = bi.velocity;\n const wi = bi.angularVelocity;\n bi.force;\n bi.torque;\n const vj = bj.velocity;\n const wj = bj.angularVelocity;\n bj.force;\n bj.torque;\n const penetrationVec = ContactEquation_computeB_temp3;\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const n = this.ni; // Caluclate cross products\n\n ri.cross(n, rixn);\n rj.cross(n, rjxn); // g = xj+rj -(xi+ri)\n // G = [ -ni -rixn ni rjxn ]\n\n n.negate(GA.spatial);\n rixn.negate(GA.rotational);\n GB.spatial.copy(n);\n GB.rotational.copy(rjxn); // Calculate the penetration vector\n\n penetrationVec.copy(bj.position);\n penetrationVec.vadd(rj, penetrationVec);\n penetrationVec.vsub(bi.position, penetrationVec);\n penetrationVec.vsub(ri, penetrationVec);\n const g = n.dot(penetrationVec); // Compute iteration\n\n const ePlusOne = this.restitution + 1;\n const GW = ePlusOne * vj.dot(n) - ePlusOne * vi.dot(n) + wj.dot(rjxn) - wi.dot(rixn);\n const GiMf = this.computeGiMf();\n const B = -g * a - GW * b - h * GiMf;\n return B;\n }\n /**\n * Get the current relative velocity in the contact point.\n */\n\n\n getImpactVelocityAlongNormal() {\n const vi = ContactEquation_getImpactVelocityAlongNormal_vi;\n const vj = ContactEquation_getImpactVelocityAlongNormal_vj;\n const xi = ContactEquation_getImpactVelocityAlongNormal_xi;\n const xj = ContactEquation_getImpactVelocityAlongNormal_xj;\n const relVel = ContactEquation_getImpactVelocityAlongNormal_relVel;\n this.bi.position.vadd(this.ri, xi);\n this.bj.position.vadd(this.rj, xj);\n this.bi.getVelocityAtWorldPoint(xi, vi);\n this.bj.getVelocityAtWorldPoint(xj, vj);\n vi.vsub(vj, relVel);\n return this.ni.dot(relVel);\n }\n\n}\nconst ContactEquation_computeB_temp1 = new Vec3(); // Temp vectors\n\nconst ContactEquation_computeB_temp2 = new Vec3();\nconst ContactEquation_computeB_temp3 = new Vec3();\nconst ContactEquation_getImpactVelocityAlongNormal_vi = new Vec3();\nconst ContactEquation_getImpactVelocityAlongNormal_vj = new Vec3();\nconst ContactEquation_getImpactVelocityAlongNormal_xi = new Vec3();\nconst ContactEquation_getImpactVelocityAlongNormal_xj = new Vec3();\nconst ContactEquation_getImpactVelocityAlongNormal_relVel = new Vec3();\n\n/**\n * Connects two bodies at given offset points.\n * @example\n * const bodyA = new Body({ mass: 1 })\n * const bodyB = new Body({ mass: 1 })\n * bodyA.position.set(-1, 0, 0)\n * bodyB.position.set(1, 0, 0)\n * bodyA.addShape(shapeA)\n * bodyB.addShape(shapeB)\n * world.addBody(bodyA)\n * world.addBody(bodyB)\n * const localPivotA = new Vec3(1, 0, 0)\n * const localPivotB = new Vec3(-1, 0, 0)\n * const constraint = new PointToPointConstraint(bodyA, localPivotA, bodyB, localPivotB)\n * world.addConstraint(constraint)\n */\nclass PointToPointConstraint extends Constraint {\n /**\n * Pivot, defined locally in bodyA.\n */\n\n /**\n * Pivot, defined locally in bodyB.\n */\n\n /**\n * @param pivotA The point relative to the center of mass of bodyA which bodyA is constrained to.\n * @param bodyB Body that will be constrained in a similar way to the same point as bodyA. We will therefore get a link between bodyA and bodyB. If not specified, bodyA will be constrained to a static point.\n * @param pivotB The point relative to the center of mass of bodyB which bodyB is constrained to.\n * @param maxForce The maximum force that should be applied to constrain the bodies.\n */\n constructor(bodyA, pivotA, bodyB, pivotB, maxForce) {\n if (pivotA === void 0) {\n pivotA = new Vec3();\n }\n\n if (pivotB === void 0) {\n pivotB = new Vec3();\n }\n\n if (maxForce === void 0) {\n maxForce = 1e6;\n }\n\n super(bodyA, bodyB);\n this.pivotA = pivotA.clone();\n this.pivotB = pivotB.clone();\n const x = this.equationX = new ContactEquation(bodyA, bodyB);\n const y = this.equationY = new ContactEquation(bodyA, bodyB);\n const z = this.equationZ = new ContactEquation(bodyA, bodyB); // Equations to be fed to the solver\n\n this.equations.push(x, y, z); // Make the equations bidirectional\n\n x.minForce = y.minForce = z.minForce = -maxForce;\n x.maxForce = y.maxForce = z.maxForce = maxForce;\n x.ni.set(1, 0, 0);\n y.ni.set(0, 1, 0);\n z.ni.set(0, 0, 1);\n }\n\n update() {\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n const x = this.equationX;\n const y = this.equationY;\n const z = this.equationZ; // Rotate the pivots to world space\n\n bodyA.quaternion.vmult(this.pivotA, x.ri);\n bodyB.quaternion.vmult(this.pivotB, x.rj);\n y.ri.copy(x.ri);\n y.rj.copy(x.rj);\n z.ri.copy(x.ri);\n z.rj.copy(x.rj);\n }\n\n}\n\n/**\n * Cone equation. Works to keep the given body world vectors aligned, or tilted within a given angle from each other.\n */\nclass ConeEquation extends Equation {\n /**\n * Local axis in A\n */\n\n /**\n * Local axis in B\n */\n\n /**\n * The \"cone angle\" to keep\n */\n constructor(bodyA, bodyB, options) {\n if (options === void 0) {\n options = {};\n }\n\n const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6;\n super(bodyA, bodyB, -maxForce, maxForce);\n this.axisA = options.axisA ? options.axisA.clone() : new Vec3(1, 0, 0);\n this.axisB = options.axisB ? options.axisB.clone() : new Vec3(0, 1, 0);\n this.angle = typeof options.angle !== 'undefined' ? options.angle : 0;\n }\n\n computeB(h) {\n const a = this.a;\n const b = this.b;\n const ni = this.axisA;\n const nj = this.axisB;\n const nixnj = tmpVec1$2;\n const njxni = tmpVec2$2;\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB; // Caluclate cross products\n\n ni.cross(nj, nixnj);\n nj.cross(ni, njxni); // The angle between two vector is:\n // cos(theta) = a * b / (length(a) * length(b) = { len(a) = len(b) = 1 } = a * b\n // g = a * b\n // gdot = (b x a) * wi + (a x b) * wj\n // G = [0 bxa 0 axb]\n // W = [vi wi vj wj]\n\n GA.rotational.copy(njxni);\n GB.rotational.copy(nixnj);\n const g = Math.cos(this.angle) - ni.dot(nj);\n const GW = this.computeGW();\n const GiMf = this.computeGiMf();\n const B = -g * a - GW * b - h * GiMf;\n return B;\n }\n\n}\nconst tmpVec1$2 = new Vec3();\nconst tmpVec2$2 = new Vec3();\n\n/**\n * Rotational constraint. Works to keep the local vectors orthogonal to each other in world space.\n */\nclass RotationalEquation extends Equation {\n /**\n * World oriented rotational axis.\n */\n\n /**\n * World oriented rotational axis.\n */\n\n /**\n * maxAngle\n */\n constructor(bodyA, bodyB, options) {\n if (options === void 0) {\n options = {};\n }\n\n const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6;\n super(bodyA, bodyB, -maxForce, maxForce);\n this.axisA = options.axisA ? options.axisA.clone() : new Vec3(1, 0, 0);\n this.axisB = options.axisB ? options.axisB.clone() : new Vec3(0, 1, 0);\n this.maxAngle = Math.PI / 2;\n }\n\n computeB(h) {\n const a = this.a;\n const b = this.b;\n const ni = this.axisA;\n const nj = this.axisB;\n const nixnj = tmpVec1$1;\n const njxni = tmpVec2$1;\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB; // Caluclate cross products\n\n ni.cross(nj, nixnj);\n nj.cross(ni, njxni); // g = ni * nj\n // gdot = (nj x ni) * wi + (ni x nj) * wj\n // G = [0 njxni 0 nixnj]\n // W = [vi wi vj wj]\n\n GA.rotational.copy(njxni);\n GB.rotational.copy(nixnj);\n const g = Math.cos(this.maxAngle) - ni.dot(nj);\n const GW = this.computeGW();\n const GiMf = this.computeGiMf();\n const B = -g * a - GW * b - h * GiMf;\n return B;\n }\n\n}\nconst tmpVec1$1 = new Vec3();\nconst tmpVec2$1 = new Vec3();\n\n/**\n * A Cone Twist constraint, useful for ragdolls.\n */\nclass ConeTwistConstraint extends PointToPointConstraint {\n /**\n * The axis direction for the constraint of the body A.\n */\n\n /**\n * The axis direction for the constraint of the body B.\n */\n\n /**\n * The aperture angle of the cone.\n */\n\n /**\n * The twist angle of the joint.\n */\n constructor(bodyA, bodyB, options) {\n if (options === void 0) {\n options = {};\n }\n\n const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6; // Set pivot point in between\n\n const pivotA = options.pivotA ? options.pivotA.clone() : new Vec3();\n const pivotB = options.pivotB ? options.pivotB.clone() : new Vec3();\n super(bodyA, pivotA, bodyB, pivotB, maxForce);\n this.axisA = options.axisA ? options.axisA.clone() : new Vec3();\n this.axisB = options.axisB ? options.axisB.clone() : new Vec3();\n this.collideConnected = !!options.collideConnected;\n this.angle = typeof options.angle !== 'undefined' ? options.angle : 0;\n const c = this.coneEquation = new ConeEquation(bodyA, bodyB, options);\n const t = this.twistEquation = new RotationalEquation(bodyA, bodyB, options);\n this.twistAngle = typeof options.twistAngle !== 'undefined' ? options.twistAngle : 0; // Make the cone equation push the bodies toward the cone axis, not outward\n\n c.maxForce = 0;\n c.minForce = -maxForce; // Make the twist equation add torque toward the initial position\n\n t.maxForce = 0;\n t.minForce = -maxForce;\n this.equations.push(c, t);\n }\n\n update() {\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n const cone = this.coneEquation;\n const twist = this.twistEquation;\n super.update(); // Update the axes to the cone constraint\n\n bodyA.vectorToWorldFrame(this.axisA, cone.axisA);\n bodyB.vectorToWorldFrame(this.axisB, cone.axisB); // Update the world axes in the twist constraint\n\n this.axisA.tangents(twist.axisA, twist.axisA);\n bodyA.vectorToWorldFrame(twist.axisA, twist.axisA);\n this.axisB.tangents(twist.axisB, twist.axisB);\n bodyB.vectorToWorldFrame(twist.axisB, twist.axisB);\n cone.angle = this.angle;\n twist.maxAngle = this.twistAngle;\n }\n\n}\nnew Vec3();\nnew Vec3();\n\n/**\n * Constrains two bodies to be at a constant distance from each others center of mass.\n */\nclass DistanceConstraint extends Constraint {\n /**\n * The distance to keep. If undefined, it will be set to the current distance between bodyA and bodyB\n */\n\n /**\n * @param distance The distance to keep. If undefined, it will be set to the current distance between bodyA and bodyB.\n * @param maxForce The maximum force that should be applied to constrain the bodies.\n */\n constructor(bodyA, bodyB, distance, maxForce) {\n if (maxForce === void 0) {\n maxForce = 1e6;\n }\n\n super(bodyA, bodyB);\n\n if (typeof distance === 'undefined') {\n distance = bodyA.position.distanceTo(bodyB.position);\n }\n\n this.distance = distance;\n const eq = this.distanceEquation = new ContactEquation(bodyA, bodyB);\n this.equations.push(eq); // Make it bidirectional\n\n eq.minForce = -maxForce;\n eq.maxForce = maxForce;\n }\n /**\n * update\n */\n\n\n update() {\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n const eq = this.distanceEquation;\n const halfDist = this.distance * 0.5;\n const normal = eq.ni;\n bodyB.position.vsub(bodyA.position, normal);\n normal.normalize();\n normal.scale(halfDist, eq.ri);\n normal.scale(-halfDist, eq.rj);\n }\n\n}\n\n/**\n * Lock constraint. Will remove all degrees of freedom between the bodies.\n */\nclass LockConstraint extends PointToPointConstraint {\n constructor(bodyA, bodyB, options) {\n if (options === void 0) {\n options = {};\n }\n\n const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6; // Set pivot point in between\n\n const pivotA = new Vec3();\n const pivotB = new Vec3();\n const halfWay = new Vec3();\n bodyA.position.vadd(bodyB.position, halfWay);\n halfWay.scale(0.5, halfWay);\n bodyB.pointToLocalFrame(halfWay, pivotB);\n bodyA.pointToLocalFrame(halfWay, pivotA); // The point-to-point constraint will keep a point shared between the bodies\n\n super(bodyA, pivotA, bodyB, pivotB, maxForce); // Store initial rotation of the bodies as unit vectors in the local body spaces\n\n this.xA = bodyA.vectorToLocalFrame(Vec3.UNIT_X);\n this.xB = bodyB.vectorToLocalFrame(Vec3.UNIT_X);\n this.yA = bodyA.vectorToLocalFrame(Vec3.UNIT_Y);\n this.yB = bodyB.vectorToLocalFrame(Vec3.UNIT_Y);\n this.zA = bodyA.vectorToLocalFrame(Vec3.UNIT_Z);\n this.zB = bodyB.vectorToLocalFrame(Vec3.UNIT_Z); // ...and the following rotational equations will keep all rotational DOF's in place\n\n const r1 = this.rotationalEquation1 = new RotationalEquation(bodyA, bodyB, options);\n const r2 = this.rotationalEquation2 = new RotationalEquation(bodyA, bodyB, options);\n const r3 = this.rotationalEquation3 = new RotationalEquation(bodyA, bodyB, options);\n this.equations.push(r1, r2, r3);\n }\n /**\n * update\n */\n\n\n update() {\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n this.motorEquation;\n const r1 = this.rotationalEquation1;\n const r2 = this.rotationalEquation2;\n const r3 = this.rotationalEquation3;\n LockConstraint_update_tmpVec1;\n LockConstraint_update_tmpVec2;\n super.update(); // These vector pairs must be orthogonal\n\n bodyA.vectorToWorldFrame(this.xA, r1.axisA);\n bodyB.vectorToWorldFrame(this.yB, r1.axisB);\n bodyA.vectorToWorldFrame(this.yA, r2.axisA);\n bodyB.vectorToWorldFrame(this.zB, r2.axisB);\n bodyA.vectorToWorldFrame(this.zA, r3.axisA);\n bodyB.vectorToWorldFrame(this.xB, r3.axisB);\n }\n\n}\nconst LockConstraint_update_tmpVec1 = new Vec3();\nconst LockConstraint_update_tmpVec2 = new Vec3();\n\n/**\n * Rotational motor constraint. Tries to keep the relative angular velocity of the bodies to a given value.\n */\nclass RotationalMotorEquation extends Equation {\n /**\n * World oriented rotational axis.\n */\n\n /**\n * World oriented rotational axis.\n */\n\n /**\n * Motor velocity.\n */\n constructor(bodyA, bodyB, maxForce) {\n if (maxForce === void 0) {\n maxForce = 1e6;\n }\n\n super(bodyA, bodyB, -maxForce, maxForce);\n this.axisA = new Vec3();\n this.axisB = new Vec3();\n this.targetVelocity = 0;\n }\n\n computeB(h) {\n this.a;\n const b = this.b;\n this.bi;\n this.bj;\n const axisA = this.axisA;\n const axisB = this.axisB;\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB; // g = 0\n // gdot = axisA * wi - axisB * wj\n // gdot = G * W = G * [vi wi vj wj]\n // =>\n // G = [0 axisA 0 -axisB]\n\n GA.rotational.copy(axisA);\n axisB.negate(GB.rotational);\n const GW = this.computeGW() - this.targetVelocity;\n const GiMf = this.computeGiMf();\n const B = -GW * b - h * GiMf;\n return B;\n }\n\n}\n\n/**\n * Hinge constraint. Think of it as a door hinge. It tries to keep the door in the correct place and with the correct orientation.\n */\nclass HingeConstraint extends PointToPointConstraint {\n /**\n * Rotation axis, defined locally in bodyA.\n */\n\n /**\n * Rotation axis, defined locally in bodyB.\n */\n constructor(bodyA, bodyB, options) {\n if (options === void 0) {\n options = {};\n }\n\n const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6;\n const pivotA = options.pivotA ? options.pivotA.clone() : new Vec3();\n const pivotB = options.pivotB ? options.pivotB.clone() : new Vec3();\n super(bodyA, pivotA, bodyB, pivotB, maxForce);\n const axisA = this.axisA = options.axisA ? options.axisA.clone() : new Vec3(1, 0, 0);\n axisA.normalize();\n const axisB = this.axisB = options.axisB ? options.axisB.clone() : new Vec3(1, 0, 0);\n axisB.normalize();\n this.collideConnected = !!options.collideConnected;\n const rotational1 = this.rotationalEquation1 = new RotationalEquation(bodyA, bodyB, options);\n const rotational2 = this.rotationalEquation2 = new RotationalEquation(bodyA, bodyB, options);\n const motor = this.motorEquation = new RotationalMotorEquation(bodyA, bodyB, maxForce);\n motor.enabled = false; // Not enabled by default\n // Equations to be fed to the solver\n\n this.equations.push(rotational1, rotational2, motor);\n }\n /**\n * enableMotor\n */\n\n\n enableMotor() {\n this.motorEquation.enabled = true;\n }\n /**\n * disableMotor\n */\n\n\n disableMotor() {\n this.motorEquation.enabled = false;\n }\n /**\n * setMotorSpeed\n */\n\n\n setMotorSpeed(speed) {\n this.motorEquation.targetVelocity = speed;\n }\n /**\n * setMotorMaxForce\n */\n\n\n setMotorMaxForce(maxForce) {\n this.motorEquation.maxForce = maxForce;\n this.motorEquation.minForce = -maxForce;\n }\n /**\n * update\n */\n\n\n update() {\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n const motor = this.motorEquation;\n const r1 = this.rotationalEquation1;\n const r2 = this.rotationalEquation2;\n const worldAxisA = HingeConstraint_update_tmpVec1;\n const worldAxisB = HingeConstraint_update_tmpVec2;\n const axisA = this.axisA;\n const axisB = this.axisB;\n super.update(); // Get world axes\n\n bodyA.quaternion.vmult(axisA, worldAxisA);\n bodyB.quaternion.vmult(axisB, worldAxisB);\n worldAxisA.tangents(r1.axisA, r2.axisA);\n r1.axisB.copy(worldAxisB);\n r2.axisB.copy(worldAxisB);\n\n if (this.motorEquation.enabled) {\n bodyA.quaternion.vmult(this.axisA, motor.axisA);\n bodyB.quaternion.vmult(this.axisB, motor.axisB);\n }\n }\n\n}\nconst HingeConstraint_update_tmpVec1 = new Vec3();\nconst HingeConstraint_update_tmpVec2 = new Vec3();\n\n/**\n * Constrains the slipping in a contact along a tangent\n */\nclass FrictionEquation extends Equation {\n // Tangent\n\n /**\n * @param slipForce should be +-F_friction = +-mu * F_normal = +-mu * m * g\n */\n constructor(bodyA, bodyB, slipForce) {\n super(bodyA, bodyB, -slipForce, slipForce);\n this.ri = new Vec3();\n this.rj = new Vec3();\n this.t = new Vec3();\n }\n\n computeB(h) {\n this.a;\n const b = this.b;\n this.bi;\n this.bj;\n const ri = this.ri;\n const rj = this.rj;\n const rixt = FrictionEquation_computeB_temp1;\n const rjxt = FrictionEquation_computeB_temp2;\n const t = this.t; // Caluclate cross products\n\n ri.cross(t, rixt);\n rj.cross(t, rjxt); // G = [-t -rixt t rjxt]\n // And remember, this is a pure velocity constraint, g is always zero!\n\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n t.negate(GA.spatial);\n rixt.negate(GA.rotational);\n GB.spatial.copy(t);\n GB.rotational.copy(rjxt);\n const GW = this.computeGW();\n const GiMf = this.computeGiMf();\n const B = -GW * b - h * GiMf;\n return B;\n }\n\n}\nconst FrictionEquation_computeB_temp1 = new Vec3();\nconst FrictionEquation_computeB_temp2 = new Vec3();\n\n/**\n * Defines what happens when two materials meet.\n * @todo Refactor materials to materialA and materialB\n */\nclass ContactMaterial {\n /**\n * Identifier of this material.\n */\n\n /**\n * Participating materials.\n */\n\n /**\n * Friction coefficient.\n * @default 0.3\n */\n\n /**\n * Restitution coefficient.\n * @default 0.3\n */\n\n /**\n * Stiffness of the produced contact equations.\n * @default 1e7\n */\n\n /**\n * Relaxation time of the produced contact equations.\n * @default 3\n */\n\n /**\n * Stiffness of the produced friction equations.\n * @default 1e7\n */\n\n /**\n * Relaxation time of the produced friction equations\n * @default 3\n */\n constructor(m1, m2, options) {\n options = Utils.defaults(options, {\n friction: 0.3,\n restitution: 0.3,\n contactEquationStiffness: 1e7,\n contactEquationRelaxation: 3,\n frictionEquationStiffness: 1e7,\n frictionEquationRelaxation: 3\n });\n this.id = ContactMaterial.idCounter++;\n this.materials = [m1, m2];\n this.friction = options.friction;\n this.restitution = options.restitution;\n this.contactEquationStiffness = options.contactEquationStiffness;\n this.contactEquationRelaxation = options.contactEquationRelaxation;\n this.frictionEquationStiffness = options.frictionEquationStiffness;\n this.frictionEquationRelaxation = options.frictionEquationRelaxation;\n }\n\n}\nContactMaterial.idCounter = 0;\n\n/**\n * Defines a physics material.\n */\nclass Material {\n /**\n * Material name.\n * If options is a string, name will be set to that string.\n * @todo Deprecate this\n */\n\n /** Material id. */\n\n /**\n * Friction for this material.\n * If non-negative, it will be used instead of the friction given by ContactMaterials. If there's no matching ContactMaterial, the value from `defaultContactMaterial` in the World will be used.\n */\n\n /**\n * Restitution for this material.\n * If non-negative, it will be used instead of the restitution given by ContactMaterials. If there's no matching ContactMaterial, the value from `defaultContactMaterial` in the World will be used.\n */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n let name = ''; // Backwards compatibility fix\n\n if (typeof options === 'string') {\n //console.warn(`Passing a string to MaterialOptions is deprecated, and has no effect`)\n name = options;\n options = {};\n }\n\n this.name = name;\n this.id = Material.idCounter++;\n this.friction = typeof options.friction !== 'undefined' ? options.friction : -1;\n this.restitution = typeof options.restitution !== 'undefined' ? options.restitution : -1;\n }\n\n}\nMaterial.idCounter = 0;\n\n/**\n * A spring, connecting two bodies.\n * @example\n * const spring = new Spring(boxBody, sphereBody, {\n * restLength: 0,\n * stiffness: 50,\n * damping: 1,\n * })\n *\n * // Compute the force after each step\n * world.addEventListener('postStep', (event) => {\n * spring.applyForce()\n * })\n */\nclass Spring {\n /**\n * Rest length of the spring. A number > 0.\n * @default 1\n */\n\n /**\n * Stiffness of the spring. A number >= 0.\n * @default 100\n */\n\n /**\n * Damping of the spring. A number >= 0.\n * @default 1\n */\n\n /**\n * First connected body.\n */\n\n /**\n * Second connected body.\n */\n\n /**\n * Anchor for bodyA in local bodyA coordinates.\n * Where to hook the spring to body A, in local body coordinates.\n * @default new Vec3()\n */\n\n /**\n * Anchor for bodyB in local bodyB coordinates.\n * Where to hook the spring to body B, in local body coordinates.\n * @default new Vec3()\n */\n constructor(bodyA, bodyB, options) {\n if (options === void 0) {\n options = {};\n }\n\n this.restLength = typeof options.restLength === 'number' ? options.restLength : 1;\n this.stiffness = options.stiffness || 100;\n this.damping = options.damping || 1;\n this.bodyA = bodyA;\n this.bodyB = bodyB;\n this.localAnchorA = new Vec3();\n this.localAnchorB = new Vec3();\n\n if (options.localAnchorA) {\n this.localAnchorA.copy(options.localAnchorA);\n }\n\n if (options.localAnchorB) {\n this.localAnchorB.copy(options.localAnchorB);\n }\n\n if (options.worldAnchorA) {\n this.setWorldAnchorA(options.worldAnchorA);\n }\n\n if (options.worldAnchorB) {\n this.setWorldAnchorB(options.worldAnchorB);\n }\n }\n /**\n * Set the anchor point on body A, using world coordinates.\n */\n\n\n setWorldAnchorA(worldAnchorA) {\n this.bodyA.pointToLocalFrame(worldAnchorA, this.localAnchorA);\n }\n /**\n * Set the anchor point on body B, using world coordinates.\n */\n\n\n setWorldAnchorB(worldAnchorB) {\n this.bodyB.pointToLocalFrame(worldAnchorB, this.localAnchorB);\n }\n /**\n * Get the anchor point on body A, in world coordinates.\n * @param result The vector to store the result in.\n */\n\n\n getWorldAnchorA(result) {\n this.bodyA.pointToWorldFrame(this.localAnchorA, result);\n }\n /**\n * Get the anchor point on body B, in world coordinates.\n * @param result The vector to store the result in.\n */\n\n\n getWorldAnchorB(result) {\n this.bodyB.pointToWorldFrame(this.localAnchorB, result);\n }\n /**\n * Apply the spring force to the connected bodies.\n */\n\n\n applyForce() {\n const k = this.stiffness;\n const d = this.damping;\n const l = this.restLength;\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n const r = applyForce_r;\n const r_unit = applyForce_r_unit;\n const u = applyForce_u;\n const f = applyForce_f;\n const tmp = applyForce_tmp;\n const worldAnchorA = applyForce_worldAnchorA;\n const worldAnchorB = applyForce_worldAnchorB;\n const ri = applyForce_ri;\n const rj = applyForce_rj;\n const ri_x_f = applyForce_ri_x_f;\n const rj_x_f = applyForce_rj_x_f; // Get world anchors\n\n this.getWorldAnchorA(worldAnchorA);\n this.getWorldAnchorB(worldAnchorB); // Get offset points\n\n worldAnchorA.vsub(bodyA.position, ri);\n worldAnchorB.vsub(bodyB.position, rj); // Compute distance vector between world anchor points\n\n worldAnchorB.vsub(worldAnchorA, r);\n const rlen = r.length();\n r_unit.copy(r);\n r_unit.normalize(); // Compute relative velocity of the anchor points, u\n\n bodyB.velocity.vsub(bodyA.velocity, u); // Add rotational velocity\n\n bodyB.angularVelocity.cross(rj, tmp);\n u.vadd(tmp, u);\n bodyA.angularVelocity.cross(ri, tmp);\n u.vsub(tmp, u); // F = - k * ( x - L ) - D * ( u )\n\n r_unit.scale(-k * (rlen - l) - d * u.dot(r_unit), f); // Add forces to bodies\n\n bodyA.force.vsub(f, bodyA.force);\n bodyB.force.vadd(f, bodyB.force); // Angular force\n\n ri.cross(f, ri_x_f);\n rj.cross(f, rj_x_f);\n bodyA.torque.vsub(ri_x_f, bodyA.torque);\n bodyB.torque.vadd(rj_x_f, bodyB.torque);\n }\n\n}\nconst applyForce_r = new Vec3();\nconst applyForce_r_unit = new Vec3();\nconst applyForce_u = new Vec3();\nconst applyForce_f = new Vec3();\nconst applyForce_worldAnchorA = new Vec3();\nconst applyForce_worldAnchorB = new Vec3();\nconst applyForce_ri = new Vec3();\nconst applyForce_rj = new Vec3();\nconst applyForce_ri_x_f = new Vec3();\nconst applyForce_rj_x_f = new Vec3();\nconst applyForce_tmp = new Vec3();\n\n/**\n * WheelInfo\n */\nclass WheelInfo {\n /**\n * Max travel distance of the suspension, in meters.\n * @default 1\n */\n\n /**\n * Speed to apply to the wheel rotation when the wheel is sliding.\n * @default -0.1\n */\n\n /**\n * If the customSlidingRotationalSpeed should be used.\n * @default false\n */\n\n /**\n * sliding\n */\n\n /**\n * Connection point, defined locally in the chassis body frame.\n */\n\n /**\n * chassisConnectionPointWorld\n */\n\n /**\n * directionLocal\n */\n\n /**\n * directionWorld\n */\n\n /**\n * axleLocal\n */\n\n /**\n * axleWorld\n */\n\n /**\n * suspensionRestLength\n * @default 1\n */\n\n /**\n * suspensionMaxLength\n * @default 2\n */\n\n /**\n * radius\n * @default 1\n */\n\n /**\n * suspensionStiffness\n * @default 100\n */\n\n /**\n * dampingCompression\n * @default 10\n */\n\n /**\n * dampingRelaxation\n * @default 10\n */\n\n /**\n * frictionSlip\n * @default 10.5\n */\n\n /** forwardAcceleration */\n\n /** sideAcceleration */\n\n /**\n * steering\n * @default 0\n */\n\n /**\n * Rotation value, in radians.\n * @default 0\n */\n\n /**\n * deltaRotation\n * @default 0\n */\n\n /**\n * rollInfluence\n * @default 0.01\n */\n\n /**\n * maxSuspensionForce\n */\n\n /**\n * engineForce\n */\n\n /**\n * brake\n */\n\n /**\n * isFrontWheel\n * @default true\n */\n\n /**\n * clippedInvContactDotSuspension\n * @default 1\n */\n\n /**\n * suspensionRelativeVelocity\n * @default 0\n */\n\n /**\n * suspensionForce\n * @default 0\n */\n\n /**\n * slipInfo\n */\n\n /**\n * skidInfo\n * @default 0\n */\n\n /**\n * suspensionLength\n * @default 0\n */\n\n /**\n * sideImpulse\n */\n\n /**\n * forwardImpulse\n */\n\n /**\n * The result from raycasting.\n */\n\n /**\n * Wheel world transform.\n */\n\n /**\n * isInContact\n */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n options = Utils.defaults(options, {\n chassisConnectionPointLocal: new Vec3(),\n chassisConnectionPointWorld: new Vec3(),\n directionLocal: new Vec3(),\n directionWorld: new Vec3(),\n axleLocal: new Vec3(),\n axleWorld: new Vec3(),\n suspensionRestLength: 1,\n suspensionMaxLength: 2,\n radius: 1,\n suspensionStiffness: 100,\n dampingCompression: 10,\n dampingRelaxation: 10,\n frictionSlip: 10.5,\n forwardAcceleration: 1,\n sideAcceleration: 1,\n steering: 0,\n rotation: 0,\n deltaRotation: 0,\n rollInfluence: 0.01,\n maxSuspensionForce: Number.MAX_VALUE,\n isFrontWheel: true,\n clippedInvContactDotSuspension: 1,\n suspensionRelativeVelocity: 0,\n suspensionForce: 0,\n slipInfo: 0,\n skidInfo: 0,\n suspensionLength: 0,\n maxSuspensionTravel: 1,\n useCustomSlidingRotationalSpeed: false,\n customSlidingRotationalSpeed: -0.1\n });\n this.maxSuspensionTravel = options.maxSuspensionTravel;\n this.customSlidingRotationalSpeed = options.customSlidingRotationalSpeed;\n this.useCustomSlidingRotationalSpeed = options.useCustomSlidingRotationalSpeed;\n this.sliding = false;\n this.chassisConnectionPointLocal = options.chassisConnectionPointLocal.clone();\n this.chassisConnectionPointWorld = options.chassisConnectionPointWorld.clone();\n this.directionLocal = options.directionLocal.clone();\n this.directionWorld = options.directionWorld.clone();\n this.axleLocal = options.axleLocal.clone();\n this.axleWorld = options.axleWorld.clone();\n this.suspensionRestLength = options.suspensionRestLength;\n this.suspensionMaxLength = options.suspensionMaxLength;\n this.radius = options.radius;\n this.suspensionStiffness = options.suspensionStiffness;\n this.dampingCompression = options.dampingCompression;\n this.dampingRelaxation = options.dampingRelaxation;\n this.frictionSlip = options.frictionSlip;\n this.forwardAcceleration = options.forwardAcceleration;\n this.sideAcceleration = options.sideAcceleration;\n this.steering = 0;\n this.rotation = 0;\n this.deltaRotation = 0;\n this.rollInfluence = options.rollInfluence;\n this.maxSuspensionForce = options.maxSuspensionForce;\n this.engineForce = 0;\n this.brake = 0;\n this.isFrontWheel = options.isFrontWheel;\n this.clippedInvContactDotSuspension = 1;\n this.suspensionRelativeVelocity = 0;\n this.suspensionForce = 0;\n this.slipInfo = 0;\n this.skidInfo = 0;\n this.suspensionLength = 0;\n this.sideImpulse = 0;\n this.forwardImpulse = 0;\n this.raycastResult = new RaycastResult();\n this.worldTransform = new Transform();\n this.isInContact = false;\n }\n\n updateWheel(chassis) {\n const raycastResult = this.raycastResult;\n\n if (this.isInContact) {\n const project = raycastResult.hitNormalWorld.dot(raycastResult.directionWorld);\n raycastResult.hitPointWorld.vsub(chassis.position, relpos);\n chassis.getVelocityAtWorldPoint(relpos, chassis_velocity_at_contactPoint);\n const projVel = raycastResult.hitNormalWorld.dot(chassis_velocity_at_contactPoint);\n\n if (project >= -0.1) {\n this.suspensionRelativeVelocity = 0.0;\n this.clippedInvContactDotSuspension = 1.0 / 0.1;\n } else {\n const inv = -1 / project;\n this.suspensionRelativeVelocity = projVel * inv;\n this.clippedInvContactDotSuspension = inv;\n }\n } else {\n // Not in contact : position wheel in a nice (rest length) position\n raycastResult.suspensionLength = this.suspensionRestLength;\n this.suspensionRelativeVelocity = 0.0;\n raycastResult.directionWorld.scale(-1, raycastResult.hitNormalWorld);\n this.clippedInvContactDotSuspension = 1.0;\n }\n }\n\n}\nconst chassis_velocity_at_contactPoint = new Vec3();\nconst relpos = new Vec3();\n\n/**\n * Vehicle helper class that casts rays from the wheel positions towards the ground and applies forces.\n */\nclass RaycastVehicle {\n /** The car chassis body. */\n\n /** The wheels. */\n\n /** Will be set to true if the car is sliding. */\n\n /** Index of the right axis. x=0, y=1, z=2 */\n\n /** Index of the forward axis. x=0, y=1, z=2 */\n\n /** Index of the up axis. x=0, y=1, z=2 */\n\n /** The constraints. */\n\n /** Optional pre-step callback. */\n\n /** Number of wheels on the ground. */\n constructor(options) {\n this.chassisBody = options.chassisBody;\n this.wheelInfos = [];\n this.sliding = false;\n this.world = null;\n this.indexRightAxis = typeof options.indexRightAxis !== 'undefined' ? options.indexRightAxis : 2;\n this.indexForwardAxis = typeof options.indexForwardAxis !== 'undefined' ? options.indexForwardAxis : 0;\n this.indexUpAxis = typeof options.indexUpAxis !== 'undefined' ? options.indexUpAxis : 1;\n this.constraints = [];\n\n this.preStepCallback = () => {};\n\n this.currentVehicleSpeedKmHour = 0;\n this.numWheelsOnGround = 0;\n }\n /**\n * Add a wheel. For information about the options, see `WheelInfo`.\n */\n\n\n addWheel(options) {\n if (options === void 0) {\n options = {};\n }\n\n const info = new WheelInfo(options);\n const index = this.wheelInfos.length;\n this.wheelInfos.push(info);\n return index;\n }\n /**\n * Set the steering value of a wheel.\n */\n\n\n setSteeringValue(value, wheelIndex) {\n const wheel = this.wheelInfos[wheelIndex];\n wheel.steering = value;\n }\n /**\n * Set the wheel force to apply on one of the wheels each time step\n */\n\n\n applyEngineForce(value, wheelIndex) {\n this.wheelInfos[wheelIndex].engineForce = value;\n }\n /**\n * Set the braking force of a wheel\n */\n\n\n setBrake(brake, wheelIndex) {\n this.wheelInfos[wheelIndex].brake = brake;\n }\n /**\n * Add the vehicle including its constraints to the world.\n */\n\n\n addToWorld(world) {\n world.addBody(this.chassisBody);\n const that = this;\n\n this.preStepCallback = () => {\n that.updateVehicle(world.dt);\n };\n\n world.addEventListener('preStep', this.preStepCallback);\n this.world = world;\n }\n /**\n * Get one of the wheel axles, world-oriented.\n */\n\n\n getVehicleAxisWorld(axisIndex, result) {\n result.set(axisIndex === 0 ? 1 : 0, axisIndex === 1 ? 1 : 0, axisIndex === 2 ? 1 : 0);\n this.chassisBody.vectorToWorldFrame(result, result);\n }\n\n updateVehicle(timeStep) {\n const wheelInfos = this.wheelInfos;\n const numWheels = wheelInfos.length;\n const chassisBody = this.chassisBody;\n\n for (let i = 0; i < numWheels; i++) {\n this.updateWheelTransform(i);\n }\n\n this.currentVehicleSpeedKmHour = 3.6 * chassisBody.velocity.length();\n const forwardWorld = new Vec3();\n this.getVehicleAxisWorld(this.indexForwardAxis, forwardWorld);\n\n if (forwardWorld.dot(chassisBody.velocity) < 0) {\n this.currentVehicleSpeedKmHour *= -1;\n } // simulate suspension\n\n\n for (let i = 0; i < numWheels; i++) {\n this.castRay(wheelInfos[i]);\n }\n\n this.updateSuspension(timeStep);\n const impulse = new Vec3();\n const relpos = new Vec3();\n\n for (let i = 0; i < numWheels; i++) {\n //apply suspension force\n const wheel = wheelInfos[i];\n let suspensionForce = wheel.suspensionForce;\n\n if (suspensionForce > wheel.maxSuspensionForce) {\n suspensionForce = wheel.maxSuspensionForce;\n }\n\n wheel.raycastResult.hitNormalWorld.scale(suspensionForce * timeStep, impulse);\n wheel.raycastResult.hitPointWorld.vsub(chassisBody.position, relpos);\n chassisBody.applyImpulse(impulse, relpos);\n }\n\n this.updateFriction(timeStep);\n const hitNormalWorldScaledWithProj = new Vec3();\n const fwd = new Vec3();\n const vel = new Vec3();\n\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i]; //const relpos = new Vec3();\n //wheel.chassisConnectionPointWorld.vsub(chassisBody.position, relpos);\n\n chassisBody.getVelocityAtWorldPoint(wheel.chassisConnectionPointWorld, vel); // Hack to get the rotation in the correct direction\n\n let m = 1;\n\n switch (this.indexUpAxis) {\n case 1:\n m = -1;\n break;\n }\n\n if (wheel.isInContact) {\n this.getVehicleAxisWorld(this.indexForwardAxis, fwd);\n const proj = fwd.dot(wheel.raycastResult.hitNormalWorld);\n wheel.raycastResult.hitNormalWorld.scale(proj, hitNormalWorldScaledWithProj);\n fwd.vsub(hitNormalWorldScaledWithProj, fwd);\n const proj2 = fwd.dot(vel);\n wheel.deltaRotation = m * proj2 * timeStep / wheel.radius;\n }\n\n if ((wheel.sliding || !wheel.isInContact) && wheel.engineForce !== 0 && wheel.useCustomSlidingRotationalSpeed) {\n // Apply custom rotation when accelerating and sliding\n wheel.deltaRotation = (wheel.engineForce > 0 ? 1 : -1) * wheel.customSlidingRotationalSpeed * timeStep;\n } // Lock wheels\n\n\n if (Math.abs(wheel.brake) > Math.abs(wheel.engineForce)) {\n wheel.deltaRotation = 0;\n }\n\n wheel.rotation += wheel.deltaRotation; // Use the old value\n\n wheel.deltaRotation *= 0.99; // damping of rotation when not in contact\n }\n }\n\n updateSuspension(deltaTime) {\n const chassisBody = this.chassisBody;\n const chassisMass = chassisBody.mass;\n const wheelInfos = this.wheelInfos;\n const numWheels = wheelInfos.length;\n\n for (let w_it = 0; w_it < numWheels; w_it++) {\n const wheel = wheelInfos[w_it];\n\n if (wheel.isInContact) {\n let force; // Spring\n\n const susp_length = wheel.suspensionRestLength;\n const current_length = wheel.suspensionLength;\n const length_diff = susp_length - current_length;\n force = wheel.suspensionStiffness * length_diff * wheel.clippedInvContactDotSuspension; // Damper\n\n const projected_rel_vel = wheel.suspensionRelativeVelocity;\n let susp_damping;\n\n if (projected_rel_vel < 0) {\n susp_damping = wheel.dampingCompression;\n } else {\n susp_damping = wheel.dampingRelaxation;\n }\n\n force -= susp_damping * projected_rel_vel;\n wheel.suspensionForce = force * chassisMass;\n\n if (wheel.suspensionForce < 0) {\n wheel.suspensionForce = 0;\n }\n } else {\n wheel.suspensionForce = 0;\n }\n }\n }\n /**\n * Remove the vehicle including its constraints from the world.\n */\n\n\n removeFromWorld(world) {\n this.constraints;\n world.removeBody(this.chassisBody);\n world.removeEventListener('preStep', this.preStepCallback);\n this.world = null;\n }\n\n castRay(wheel) {\n const rayvector = castRay_rayvector;\n const target = castRay_target;\n this.updateWheelTransformWorld(wheel);\n const chassisBody = this.chassisBody;\n let depth = -1;\n const raylen = wheel.suspensionRestLength + wheel.radius;\n wheel.directionWorld.scale(raylen, rayvector);\n const source = wheel.chassisConnectionPointWorld;\n source.vadd(rayvector, target);\n const raycastResult = wheel.raycastResult;\n raycastResult.reset(); // Turn off ray collision with the chassis temporarily\n\n const oldState = chassisBody.collisionResponse;\n chassisBody.collisionResponse = false; // Cast ray against world\n\n this.world.rayTest(source, target, raycastResult);\n chassisBody.collisionResponse = oldState;\n const object = raycastResult.body;\n wheel.raycastResult.groundObject = 0;\n\n if (object) {\n depth = raycastResult.distance;\n wheel.raycastResult.hitNormalWorld = raycastResult.hitNormalWorld;\n wheel.isInContact = true;\n const hitDistance = raycastResult.distance;\n wheel.suspensionLength = hitDistance - wheel.radius; // clamp on max suspension travel\n\n const minSuspensionLength = wheel.suspensionRestLength - wheel.maxSuspensionTravel;\n const maxSuspensionLength = wheel.suspensionRestLength + wheel.maxSuspensionTravel;\n\n if (wheel.suspensionLength < minSuspensionLength) {\n wheel.suspensionLength = minSuspensionLength;\n }\n\n if (wheel.suspensionLength > maxSuspensionLength) {\n wheel.suspensionLength = maxSuspensionLength;\n wheel.raycastResult.reset();\n }\n\n const denominator = wheel.raycastResult.hitNormalWorld.dot(wheel.directionWorld);\n const chassis_velocity_at_contactPoint = new Vec3();\n chassisBody.getVelocityAtWorldPoint(wheel.raycastResult.hitPointWorld, chassis_velocity_at_contactPoint);\n const projVel = wheel.raycastResult.hitNormalWorld.dot(chassis_velocity_at_contactPoint);\n\n if (denominator >= -0.1) {\n wheel.suspensionRelativeVelocity = 0;\n wheel.clippedInvContactDotSuspension = 1 / 0.1;\n } else {\n const inv = -1 / denominator;\n wheel.suspensionRelativeVelocity = projVel * inv;\n wheel.clippedInvContactDotSuspension = inv;\n }\n } else {\n //put wheel info as in rest position\n wheel.suspensionLength = wheel.suspensionRestLength + 0 * wheel.maxSuspensionTravel;\n wheel.suspensionRelativeVelocity = 0.0;\n wheel.directionWorld.scale(-1, wheel.raycastResult.hitNormalWorld);\n wheel.clippedInvContactDotSuspension = 1.0;\n }\n\n return depth;\n }\n\n updateWheelTransformWorld(wheel) {\n wheel.isInContact = false;\n const chassisBody = this.chassisBody;\n chassisBody.pointToWorldFrame(wheel.chassisConnectionPointLocal, wheel.chassisConnectionPointWorld);\n chassisBody.vectorToWorldFrame(wheel.directionLocal, wheel.directionWorld);\n chassisBody.vectorToWorldFrame(wheel.axleLocal, wheel.axleWorld);\n }\n /**\n * Update one of the wheel transform.\n * Note when rendering wheels: during each step, wheel transforms are updated BEFORE the chassis; ie. their position becomes invalid after the step. Thus when you render wheels, you must update wheel transforms before rendering them. See raycastVehicle demo for an example.\n * @param wheelIndex The wheel index to update.\n */\n\n\n updateWheelTransform(wheelIndex) {\n const up = tmpVec4;\n const right = tmpVec5;\n const fwd = tmpVec6;\n const wheel = this.wheelInfos[wheelIndex];\n this.updateWheelTransformWorld(wheel);\n wheel.directionLocal.scale(-1, up);\n right.copy(wheel.axleLocal);\n up.cross(right, fwd);\n fwd.normalize();\n right.normalize(); // Rotate around steering over the wheelAxle\n\n const steering = wheel.steering;\n const steeringOrn = new Quaternion();\n steeringOrn.setFromAxisAngle(up, steering);\n const rotatingOrn = new Quaternion();\n rotatingOrn.setFromAxisAngle(right, wheel.rotation); // World rotation of the wheel\n\n const q = wheel.worldTransform.quaternion;\n this.chassisBody.quaternion.mult(steeringOrn, q);\n q.mult(rotatingOrn, q);\n q.normalize(); // world position of the wheel\n\n const p = wheel.worldTransform.position;\n p.copy(wheel.directionWorld);\n p.scale(wheel.suspensionLength, p);\n p.vadd(wheel.chassisConnectionPointWorld, p);\n }\n /**\n * Get the world transform of one of the wheels\n */\n\n\n getWheelTransformWorld(wheelIndex) {\n return this.wheelInfos[wheelIndex].worldTransform;\n }\n\n updateFriction(timeStep) {\n const surfNormalWS_scaled_proj = updateFriction_surfNormalWS_scaled_proj; //calculate the impulse, so that the wheels don't move sidewards\n\n const wheelInfos = this.wheelInfos;\n const numWheels = wheelInfos.length;\n const chassisBody = this.chassisBody;\n const forwardWS = updateFriction_forwardWS;\n const axle = updateFriction_axle;\n this.numWheelsOnGround = 0;\n\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i];\n const groundObject = wheel.raycastResult.body;\n\n if (groundObject) {\n this.numWheelsOnGround++;\n }\n\n wheel.sideImpulse = 0;\n wheel.forwardImpulse = 0;\n\n if (!forwardWS[i]) {\n forwardWS[i] = new Vec3();\n }\n\n if (!axle[i]) {\n axle[i] = new Vec3();\n }\n }\n\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i];\n const groundObject = wheel.raycastResult.body;\n\n if (groundObject) {\n const axlei = axle[i];\n const wheelTrans = this.getWheelTransformWorld(i); // Get world axle\n\n wheelTrans.vectorToWorldFrame(directions[this.indexRightAxis], axlei);\n const surfNormalWS = wheel.raycastResult.hitNormalWorld;\n const proj = axlei.dot(surfNormalWS);\n surfNormalWS.scale(proj, surfNormalWS_scaled_proj);\n axlei.vsub(surfNormalWS_scaled_proj, axlei);\n axlei.normalize();\n surfNormalWS.cross(axlei, forwardWS[i]);\n forwardWS[i].normalize();\n wheel.sideImpulse = resolveSingleBilateral(chassisBody, wheel.raycastResult.hitPointWorld, groundObject, wheel.raycastResult.hitPointWorld, axlei);\n wheel.sideImpulse *= sideFrictionStiffness2;\n }\n }\n\n const sideFactor = 1;\n const fwdFactor = 0.5;\n this.sliding = false;\n\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i];\n const groundObject = wheel.raycastResult.body;\n let rollingFriction = 0;\n wheel.slipInfo = 1;\n\n if (groundObject) {\n const defaultRollingFrictionImpulse = 0;\n const maxImpulse = wheel.brake ? wheel.brake : defaultRollingFrictionImpulse; // btWheelContactPoint contactPt(chassisBody,groundObject,wheelInfraycastInfo.hitPointWorld,forwardWS[wheel],maxImpulse);\n // rollingFriction = calcRollingFriction(contactPt);\n\n rollingFriction = calcRollingFriction(chassisBody, groundObject, wheel.raycastResult.hitPointWorld, forwardWS[i], maxImpulse);\n rollingFriction += wheel.engineForce * timeStep; // rollingFriction = 0;\n\n const factor = maxImpulse / rollingFriction;\n wheel.slipInfo *= factor;\n } //switch between active rolling (throttle), braking and non-active rolling friction (nthrottle/break)\n\n\n wheel.forwardImpulse = 0;\n wheel.skidInfo = 1;\n\n if (groundObject) {\n wheel.skidInfo = 1;\n const maximp = wheel.suspensionForce * timeStep * wheel.frictionSlip;\n const maximpSide = maximp;\n const maximpSquared = maximp * maximpSide;\n wheel.forwardImpulse = rollingFriction; //wheelInfo.engineForce* timeStep;\n\n const x = wheel.forwardImpulse * fwdFactor / wheel.forwardAcceleration;\n const y = wheel.sideImpulse * sideFactor / wheel.sideAcceleration;\n const impulseSquared = x * x + y * y;\n wheel.sliding = false;\n\n if (impulseSquared > maximpSquared) {\n this.sliding = true;\n wheel.sliding = true;\n const factor = maximp / Math.sqrt(impulseSquared);\n wheel.skidInfo *= factor;\n }\n }\n }\n\n if (this.sliding) {\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i];\n\n if (wheel.sideImpulse !== 0) {\n if (wheel.skidInfo < 1) {\n wheel.forwardImpulse *= wheel.skidInfo;\n wheel.sideImpulse *= wheel.skidInfo;\n }\n }\n }\n } // apply the impulses\n\n\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i];\n const rel_pos = new Vec3();\n wheel.raycastResult.hitPointWorld.vsub(chassisBody.position, rel_pos); // cannons applyimpulse is using world coord for the position\n //rel_pos.copy(wheel.raycastResult.hitPointWorld);\n\n if (wheel.forwardImpulse !== 0) {\n const impulse = new Vec3();\n forwardWS[i].scale(wheel.forwardImpulse, impulse);\n chassisBody.applyImpulse(impulse, rel_pos);\n }\n\n if (wheel.sideImpulse !== 0) {\n const groundObject = wheel.raycastResult.body;\n const rel_pos2 = new Vec3();\n wheel.raycastResult.hitPointWorld.vsub(groundObject.position, rel_pos2); //rel_pos2.copy(wheel.raycastResult.hitPointWorld);\n\n const sideImp = new Vec3();\n axle[i].scale(wheel.sideImpulse, sideImp); // Scale the relative position in the up direction with rollInfluence.\n // If rollInfluence is 1, the impulse will be applied on the hitPoint (easy to roll over), if it is zero it will be applied in the same plane as the center of mass (not easy to roll over).\n\n chassisBody.vectorToLocalFrame(rel_pos, rel_pos);\n rel_pos['xyz'[this.indexUpAxis]] *= wheel.rollInfluence;\n chassisBody.vectorToWorldFrame(rel_pos, rel_pos);\n chassisBody.applyImpulse(sideImp, rel_pos); //apply friction impulse on the ground\n\n sideImp.scale(-1, sideImp);\n groundObject.applyImpulse(sideImp, rel_pos2);\n }\n }\n }\n\n}\nnew Vec3();\nnew Vec3();\nnew Vec3();\nconst tmpVec4 = new Vec3();\nconst tmpVec5 = new Vec3();\nconst tmpVec6 = new Vec3();\nnew Ray();\nnew Vec3();\nconst castRay_rayvector = new Vec3();\nconst castRay_target = new Vec3();\nconst directions = [new Vec3(1, 0, 0), new Vec3(0, 1, 0), new Vec3(0, 0, 1)];\nconst updateFriction_surfNormalWS_scaled_proj = new Vec3();\nconst updateFriction_axle = [];\nconst updateFriction_forwardWS = [];\nconst sideFrictionStiffness2 = 1;\nconst calcRollingFriction_vel1 = new Vec3();\nconst calcRollingFriction_vel2 = new Vec3();\nconst calcRollingFriction_vel = new Vec3();\n\nfunction calcRollingFriction(body0, body1, frictionPosWorld, frictionDirectionWorld, maxImpulse) {\n let j1 = 0;\n const contactPosWorld = frictionPosWorld; // const rel_pos1 = new Vec3();\n // const rel_pos2 = new Vec3();\n\n const vel1 = calcRollingFriction_vel1;\n const vel2 = calcRollingFriction_vel2;\n const vel = calcRollingFriction_vel; // contactPosWorld.vsub(body0.position, rel_pos1);\n // contactPosWorld.vsub(body1.position, rel_pos2);\n\n body0.getVelocityAtWorldPoint(contactPosWorld, vel1);\n body1.getVelocityAtWorldPoint(contactPosWorld, vel2);\n vel1.vsub(vel2, vel);\n const vrel = frictionDirectionWorld.dot(vel);\n const denom0 = computeImpulseDenominator(body0, frictionPosWorld, frictionDirectionWorld);\n const denom1 = computeImpulseDenominator(body1, frictionPosWorld, frictionDirectionWorld);\n const relaxation = 1;\n const jacDiagABInv = relaxation / (denom0 + denom1); // calculate j that moves us to zero relative velocity\n\n j1 = -vrel * jacDiagABInv;\n\n if (maxImpulse < j1) {\n j1 = maxImpulse;\n }\n\n if (j1 < -maxImpulse) {\n j1 = -maxImpulse;\n }\n\n return j1;\n}\n\nconst computeImpulseDenominator_r0 = new Vec3();\nconst computeImpulseDenominator_c0 = new Vec3();\nconst computeImpulseDenominator_vec = new Vec3();\nconst computeImpulseDenominator_m = new Vec3();\n\nfunction computeImpulseDenominator(body, pos, normal) {\n const r0 = computeImpulseDenominator_r0;\n const c0 = computeImpulseDenominator_c0;\n const vec = computeImpulseDenominator_vec;\n const m = computeImpulseDenominator_m;\n pos.vsub(body.position, r0);\n r0.cross(normal, c0);\n body.invInertiaWorld.vmult(c0, m);\n m.cross(r0, vec);\n return body.invMass + normal.dot(vec);\n}\n\nconst resolveSingleBilateral_vel1 = new Vec3();\nconst resolveSingleBilateral_vel2 = new Vec3();\nconst resolveSingleBilateral_vel = new Vec3(); // bilateral constraint between two dynamic objects\n\nfunction resolveSingleBilateral(body1, pos1, body2, pos2, normal) {\n const normalLenSqr = normal.lengthSquared();\n\n if (normalLenSqr > 1.1) {\n return 0; // no impulse\n } // const rel_pos1 = new Vec3();\n // const rel_pos2 = new Vec3();\n // pos1.vsub(body1.position, rel_pos1);\n // pos2.vsub(body2.position, rel_pos2);\n\n\n const vel1 = resolveSingleBilateral_vel1;\n const vel2 = resolveSingleBilateral_vel2;\n const vel = resolveSingleBilateral_vel;\n body1.getVelocityAtWorldPoint(pos1, vel1);\n body2.getVelocityAtWorldPoint(pos2, vel2);\n vel1.vsub(vel2, vel);\n const rel_vel = normal.dot(vel);\n const contactDamping = 0.2;\n const massTerm = 1 / (body1.invMass + body2.invMass);\n const impulse = -contactDamping * rel_vel * massTerm;\n return impulse;\n}\n\n/**\n * Spherical shape\n * @example\n * const radius = 1\n * const sphereShape = new CANNON.Sphere(radius)\n * const sphereBody = new CANNON.Body({ mass: 1, shape: sphereShape })\n * world.addBody(sphereBody)\n */\nclass Sphere extends Shape {\n /**\n * The radius of the sphere.\n */\n\n /**\n *\n * @param radius The radius of the sphere, a non-negative number.\n */\n constructor(radius) {\n super({\n type: Shape.types.SPHERE\n });\n this.radius = radius !== undefined ? radius : 1.0;\n\n if (this.radius < 0) {\n throw new Error('The sphere radius cannot be negative.');\n }\n\n this.updateBoundingSphereRadius();\n }\n /** calculateLocalInertia */\n\n\n calculateLocalInertia(mass, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n const I = 2.0 * mass * this.radius * this.radius / 5.0;\n target.x = I;\n target.y = I;\n target.z = I;\n return target;\n }\n /** volume */\n\n\n volume() {\n return 4.0 * Math.PI * Math.pow(this.radius, 3) / 3.0;\n }\n\n updateBoundingSphereRadius() {\n this.boundingSphereRadius = this.radius;\n }\n\n calculateWorldAABB(pos, quat, min, max) {\n const r = this.radius;\n const axes = ['x', 'y', 'z'];\n\n for (let i = 0; i < axes.length; i++) {\n const ax = axes[i];\n min[ax] = pos[ax] - r;\n max[ax] = pos[ax] + r;\n }\n }\n\n}\n\n/**\n * Simple vehicle helper class with spherical rigid body wheels.\n */\nclass RigidVehicle {\n /**\n * The bodies of the wheels.\n */\n\n /**\n * The chassis body.\n */\n\n /**\n * The constraints.\n */\n\n /**\n * The wheel axes.\n */\n\n /**\n * The wheel forces.\n */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n this.wheelBodies = [];\n this.coordinateSystem = typeof options.coordinateSystem !== 'undefined' ? options.coordinateSystem.clone() : new Vec3(1, 2, 3);\n\n if (options.chassisBody) {\n this.chassisBody = options.chassisBody;\n } else {\n // No chassis body given. Create it!\n this.chassisBody = new Body({\n mass: 1,\n shape: new Box(new Vec3(5, 0.5, 2))\n });\n }\n\n this.constraints = [];\n this.wheelAxes = [];\n this.wheelForces = [];\n }\n /**\n * Add a wheel\n */\n\n\n addWheel(options) {\n if (options === void 0) {\n options = {};\n }\n\n let wheelBody;\n\n if (options.body) {\n wheelBody = options.body;\n } else {\n // No wheel body given. Create it!\n wheelBody = new Body({\n mass: 1,\n shape: new Sphere(1.2)\n });\n }\n\n this.wheelBodies.push(wheelBody);\n this.wheelForces.push(0); // Position constrain wheels\n\n const position = typeof options.position !== 'undefined' ? options.position.clone() : new Vec3(); // Set position locally to the chassis\n\n const worldPosition = new Vec3();\n this.chassisBody.pointToWorldFrame(position, worldPosition);\n wheelBody.position.set(worldPosition.x, worldPosition.y, worldPosition.z); // Constrain wheel\n\n const axis = typeof options.axis !== 'undefined' ? options.axis.clone() : new Vec3(0, 0, 1);\n this.wheelAxes.push(axis);\n const hingeConstraint = new HingeConstraint(this.chassisBody, wheelBody, {\n pivotA: position,\n axisA: axis,\n pivotB: Vec3.ZERO,\n axisB: axis,\n collideConnected: false\n });\n this.constraints.push(hingeConstraint);\n return this.wheelBodies.length - 1;\n }\n /**\n * Set the steering value of a wheel.\n * @todo check coordinateSystem\n */\n\n\n setSteeringValue(value, wheelIndex) {\n // Set angle of the hinge axis\n const axis = this.wheelAxes[wheelIndex];\n const c = Math.cos(value);\n const s = Math.sin(value);\n const x = axis.x;\n const z = axis.z;\n this.constraints[wheelIndex].axisA.set(-c * x + s * z, 0, s * x + c * z);\n }\n /**\n * Set the target rotational speed of the hinge constraint.\n */\n\n\n setMotorSpeed(value, wheelIndex) {\n const hingeConstraint = this.constraints[wheelIndex];\n hingeConstraint.enableMotor();\n hingeConstraint.motorTargetVelocity = value;\n }\n /**\n * Set the target rotational speed of the hinge constraint.\n */\n\n\n disableMotor(wheelIndex) {\n const hingeConstraint = this.constraints[wheelIndex];\n hingeConstraint.disableMotor();\n }\n /**\n * Set the wheel force to apply on one of the wheels each time step\n */\n\n\n setWheelForce(value, wheelIndex) {\n this.wheelForces[wheelIndex] = value;\n }\n /**\n * Apply a torque on one of the wheels.\n */\n\n\n applyWheelForce(value, wheelIndex) {\n const axis = this.wheelAxes[wheelIndex];\n const wheelBody = this.wheelBodies[wheelIndex];\n const bodyTorque = wheelBody.torque;\n axis.scale(value, torque);\n wheelBody.vectorToWorldFrame(torque, torque);\n bodyTorque.vadd(torque, bodyTorque);\n }\n /**\n * Add the vehicle including its constraints to the world.\n */\n\n\n addToWorld(world) {\n const constraints = this.constraints;\n const bodies = this.wheelBodies.concat([this.chassisBody]);\n\n for (let i = 0; i < bodies.length; i++) {\n world.addBody(bodies[i]);\n }\n\n for (let i = 0; i < constraints.length; i++) {\n world.addConstraint(constraints[i]);\n }\n\n world.addEventListener('preStep', this._update.bind(this));\n }\n\n _update() {\n const wheelForces = this.wheelForces;\n\n for (let i = 0; i < wheelForces.length; i++) {\n this.applyWheelForce(wheelForces[i], i);\n }\n }\n /**\n * Remove the vehicle including its constraints from the world.\n */\n\n\n removeFromWorld(world) {\n const constraints = this.constraints;\n const bodies = this.wheelBodies.concat([this.chassisBody]);\n\n for (let i = 0; i < bodies.length; i++) {\n world.removeBody(bodies[i]);\n }\n\n for (let i = 0; i < constraints.length; i++) {\n world.removeConstraint(constraints[i]);\n }\n }\n /**\n * Get current rotational velocity of a wheel\n */\n\n\n getWheelSpeed(wheelIndex) {\n const axis = this.wheelAxes[wheelIndex];\n const wheelBody = this.wheelBodies[wheelIndex];\n const w = wheelBody.angularVelocity;\n this.chassisBody.vectorToWorldFrame(axis, worldAxis);\n return w.dot(worldAxis);\n }\n\n}\nconst torque = new Vec3();\nconst worldAxis = new Vec3();\n\n/**\n * Smoothed-particle hydrodynamics system\n * @todo Make parameters customizable in the constructor\n */\nclass SPHSystem {\n /**\n * The particles array.\n */\n\n /**\n * Density of the system (kg/m3).\n * @default 1\n */\n\n /**\n * Distance below which two particles are considered to be neighbors.\n * It should be adjusted so there are about 15-20 neighbor particles within this radius.\n * @default 1\n */\n\n /**\n * @default 1\n */\n\n /**\n * Viscosity of the system.\n * @default 0.01\n */\n\n /**\n * @default 0.000001\n */\n constructor() {\n this.particles = [];\n this.density = 1;\n this.smoothingRadius = 1;\n this.speedOfSound = 1;\n this.viscosity = 0.01;\n this.eps = 0.000001; // Stuff Computed per particle\n\n this.pressures = [];\n this.densities = [];\n this.neighbors = [];\n }\n /**\n * Add a particle to the system.\n */\n\n\n add(particle) {\n this.particles.push(particle);\n\n if (this.neighbors.length < this.particles.length) {\n this.neighbors.push([]);\n }\n }\n /**\n * Remove a particle from the system.\n */\n\n\n remove(particle) {\n const idx = this.particles.indexOf(particle);\n\n if (idx !== -1) {\n this.particles.splice(idx, 1);\n\n if (this.neighbors.length > this.particles.length) {\n this.neighbors.pop();\n }\n }\n }\n /**\n * Get neighbors within smoothing volume, save in the array neighbors\n */\n\n\n getNeighbors(particle, neighbors) {\n const N = this.particles.length;\n const id = particle.id;\n const R2 = this.smoothingRadius * this.smoothingRadius;\n const dist = SPHSystem_getNeighbors_dist;\n\n for (let i = 0; i !== N; i++) {\n const p = this.particles[i];\n p.position.vsub(particle.position, dist);\n\n if (id !== p.id && dist.lengthSquared() < R2) {\n neighbors.push(p);\n }\n }\n }\n\n update() {\n const N = this.particles.length;\n const dist = SPHSystem_update_dist;\n const cs = this.speedOfSound;\n const eps = this.eps;\n\n for (let i = 0; i !== N; i++) {\n const p = this.particles[i]; // Current particle\n\n const neighbors = this.neighbors[i]; // Get neighbors\n\n neighbors.length = 0;\n this.getNeighbors(p, neighbors);\n neighbors.push(this.particles[i]); // Add current too\n\n const numNeighbors = neighbors.length; // Accumulate density for the particle\n\n let sum = 0.0;\n\n for (let j = 0; j !== numNeighbors; j++) {\n //printf(\"Current particle has position %f %f %f\\n\",objects[id].pos.x(),objects[id].pos.y(),objects[id].pos.z());\n p.position.vsub(neighbors[j].position, dist);\n const len = dist.length();\n const weight = this.w(len);\n sum += neighbors[j].mass * weight;\n } // Save\n\n\n this.densities[i] = sum;\n this.pressures[i] = cs * cs * (this.densities[i] - this.density);\n } // Add forces\n // Sum to these accelerations\n\n\n const a_pressure = SPHSystem_update_a_pressure;\n const a_visc = SPHSystem_update_a_visc;\n const gradW = SPHSystem_update_gradW;\n const r_vec = SPHSystem_update_r_vec;\n const u = SPHSystem_update_u;\n\n for (let i = 0; i !== N; i++) {\n const particle = this.particles[i];\n a_pressure.set(0, 0, 0);\n a_visc.set(0, 0, 0); // Init vars\n\n let Pij;\n let nabla;\n\n const neighbors = this.neighbors[i];\n const numNeighbors = neighbors.length; //printf(\"Neighbors: \");\n\n for (let j = 0; j !== numNeighbors; j++) {\n const neighbor = neighbors[j]; //printf(\"%d \",nj);\n // Get r once for all..\n\n particle.position.vsub(neighbor.position, r_vec);\n const r = r_vec.length(); // Pressure contribution\n\n Pij = -neighbor.mass * (this.pressures[i] / (this.densities[i] * this.densities[i] + eps) + this.pressures[j] / (this.densities[j] * this.densities[j] + eps));\n this.gradw(r_vec, gradW); // Add to pressure acceleration\n\n gradW.scale(Pij, gradW);\n a_pressure.vadd(gradW, a_pressure); // Viscosity contribution\n\n neighbor.velocity.vsub(particle.velocity, u);\n u.scale(1.0 / (0.0001 + this.densities[i] * this.densities[j]) * this.viscosity * neighbor.mass, u);\n nabla = this.nablaw(r);\n u.scale(nabla, u); // Add to viscosity acceleration\n\n a_visc.vadd(u, a_visc);\n } // Calculate force\n\n\n a_visc.scale(particle.mass, a_visc);\n a_pressure.scale(particle.mass, a_pressure); // Add force to particles\n\n particle.force.vadd(a_visc, particle.force);\n particle.force.vadd(a_pressure, particle.force);\n }\n } // Calculate the weight using the W(r) weightfunction\n\n\n w(r) {\n // 315\n const h = this.smoothingRadius;\n return 315.0 / (64.0 * Math.PI * h ** 9) * (h * h - r * r) ** 3;\n } // calculate gradient of the weight function\n\n\n gradw(rVec, resultVec) {\n const r = rVec.length();\n const h = this.smoothingRadius;\n rVec.scale(945.0 / (32.0 * Math.PI * h ** 9) * (h * h - r * r) ** 2, resultVec);\n } // Calculate nabla(W)\n\n\n nablaw(r) {\n const h = this.smoothingRadius;\n const nabla = 945.0 / (32.0 * Math.PI * h ** 9) * (h * h - r * r) * (7 * r * r - 3 * h * h);\n return nabla;\n }\n\n}\nconst SPHSystem_getNeighbors_dist = new Vec3(); // Temp vectors for calculation\n\nconst SPHSystem_update_dist = new Vec3(); // Relative velocity\n\nconst SPHSystem_update_a_pressure = new Vec3();\nconst SPHSystem_update_a_visc = new Vec3();\nconst SPHSystem_update_gradW = new Vec3();\nconst SPHSystem_update_r_vec = new Vec3();\nconst SPHSystem_update_u = new Vec3();\n\n/**\n * Cylinder class.\n * @example\n * const radiusTop = 0.5\n * const radiusBottom = 0.5\n * const height = 2\n * const numSegments = 12\n * const cylinderShape = new CANNON.Cylinder(radiusTop, radiusBottom, height, numSegments)\n * const cylinderBody = new CANNON.Body({ mass: 1, shape: cylinderShape })\n * world.addBody(cylinderBody)\n */\n\nclass Cylinder extends ConvexPolyhedron {\n /** The radius of the top of the Cylinder. */\n\n /** The radius of the bottom of the Cylinder. */\n\n /** The height of the Cylinder. */\n\n /** The number of segments to build the cylinder out of. */\n\n /**\n * @param radiusTop The radius of the top of the Cylinder.\n * @param radiusBottom The radius of the bottom of the Cylinder.\n * @param height The height of the Cylinder.\n * @param numSegments The number of segments to build the cylinder out of.\n */\n constructor(radiusTop, radiusBottom, height, numSegments) {\n if (radiusTop === void 0) {\n radiusTop = 1;\n }\n\n if (radiusBottom === void 0) {\n radiusBottom = 1;\n }\n\n if (height === void 0) {\n height = 1;\n }\n\n if (numSegments === void 0) {\n numSegments = 8;\n }\n\n if (radiusTop < 0) {\n throw new Error('The cylinder radiusTop cannot be negative.');\n }\n\n if (radiusBottom < 0) {\n throw new Error('The cylinder radiusBottom cannot be negative.');\n }\n\n const N = numSegments;\n const vertices = [];\n const axes = [];\n const faces = [];\n const bottomface = [];\n const topface = [];\n const cos = Math.cos;\n const sin = Math.sin; // First bottom point\n\n vertices.push(new Vec3(-radiusBottom * sin(0), -height * 0.5, radiusBottom * cos(0)));\n bottomface.push(0); // First top point\n\n vertices.push(new Vec3(-radiusTop * sin(0), height * 0.5, radiusTop * cos(0)));\n topface.push(1);\n\n for (let i = 0; i < N; i++) {\n const theta = 2 * Math.PI / N * (i + 1);\n const thetaN = 2 * Math.PI / N * (i + 0.5);\n\n if (i < N - 1) {\n // Bottom\n vertices.push(new Vec3(-radiusBottom * sin(theta), -height * 0.5, radiusBottom * cos(theta)));\n bottomface.push(2 * i + 2); // Top\n\n vertices.push(new Vec3(-radiusTop * sin(theta), height * 0.5, radiusTop * cos(theta)));\n topface.push(2 * i + 3); // Face\n\n faces.push([2 * i, 2 * i + 1, 2 * i + 3, 2 * i + 2]);\n } else {\n faces.push([2 * i, 2 * i + 1, 1, 0]); // Connect\n } // Axis: we can cut off half of them if we have even number of segments\n\n\n if (N % 2 === 1 || i < N / 2) {\n axes.push(new Vec3(-sin(thetaN), 0, cos(thetaN)));\n }\n }\n\n faces.push(bottomface);\n axes.push(new Vec3(0, 1, 0)); // Reorder top face\n\n const temp = [];\n\n for (let i = 0; i < topface.length; i++) {\n temp.push(topface[topface.length - i - 1]);\n }\n\n faces.push(temp);\n super({\n vertices,\n faces,\n axes\n });\n this.type = Shape.types.CYLINDER;\n this.radiusTop = radiusTop;\n this.radiusBottom = radiusBottom;\n this.height = height;\n this.numSegments = numSegments;\n }\n\n}\n\n/**\n * Particle shape.\n * @example\n * const particleShape = new CANNON.Particle()\n * const particleBody = new CANNON.Body({ mass: 1, shape: particleShape })\n * world.addBody(particleBody)\n */\nclass Particle extends Shape {\n constructor() {\n super({\n type: Shape.types.PARTICLE\n });\n }\n /**\n * calculateLocalInertia\n */\n\n\n calculateLocalInertia(mass, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n target.set(0, 0, 0);\n return target;\n }\n\n volume() {\n return 0;\n }\n\n updateBoundingSphereRadius() {\n this.boundingSphereRadius = 0;\n }\n\n calculateWorldAABB(pos, quat, min, max) {\n // Get each axis max\n min.copy(pos);\n max.copy(pos);\n }\n\n}\n\n/**\n * A plane, facing in the Z direction. The plane has its surface at z=0 and everything below z=0 is assumed to be solid plane. To make the plane face in some other direction than z, you must put it inside a Body and rotate that body. See the demos.\n * @example\n * const planeShape = new CANNON.Plane()\n * const planeBody = new CANNON.Body({ mass: 0, shape: planeShape })\n * planeBody.quaternion.setFromEuler(-Math.PI / 2, 0, 0) // make it face up\n * world.addBody(planeBody)\n */\nclass Plane extends Shape {\n /** worldNormal */\n\n /** worldNormalNeedsUpdate */\n constructor() {\n super({\n type: Shape.types.PLANE\n }); // World oriented normal\n\n this.worldNormal = new Vec3();\n this.worldNormalNeedsUpdate = true;\n this.boundingSphereRadius = Number.MAX_VALUE;\n }\n /** computeWorldNormal */\n\n\n computeWorldNormal(quat) {\n const n = this.worldNormal;\n n.set(0, 0, 1);\n quat.vmult(n, n);\n this.worldNormalNeedsUpdate = false;\n }\n\n calculateLocalInertia(mass, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n return target;\n }\n\n volume() {\n return (// The plane is infinite...\n Number.MAX_VALUE\n );\n }\n\n calculateWorldAABB(pos, quat, min, max) {\n // The plane AABB is infinite, except if the normal is pointing along any axis\n tempNormal.set(0, 0, 1); // Default plane normal is z\n\n quat.vmult(tempNormal, tempNormal);\n const maxVal = Number.MAX_VALUE;\n min.set(-maxVal, -maxVal, -maxVal);\n max.set(maxVal, maxVal, maxVal);\n\n if (tempNormal.x === 1) {\n max.x = pos.x;\n } else if (tempNormal.x === -1) {\n min.x = pos.x;\n }\n\n if (tempNormal.y === 1) {\n max.y = pos.y;\n } else if (tempNormal.y === -1) {\n min.y = pos.y;\n }\n\n if (tempNormal.z === 1) {\n max.z = pos.z;\n } else if (tempNormal.z === -1) {\n min.z = pos.z;\n }\n }\n\n updateBoundingSphereRadius() {\n this.boundingSphereRadius = Number.MAX_VALUE;\n }\n\n}\nconst tempNormal = new Vec3();\n\n/**\n * Heightfield shape class. Height data is given as an array. These data points are spread out evenly with a given distance.\n * @todo Should be possible to use along all axes, not just y\n * @todo should be possible to scale along all axes\n * @todo Refactor elementSize to elementSizeX and elementSizeY\n *\n * @example\n * // Generate some height data (y-values).\n * const data = []\n * for (let i = 0; i < 1000; i++) {\n * const y = 0.5 * Math.cos(0.2 * i)\n * data.push(y)\n * }\n *\n * // Create the heightfield shape\n * const heightfieldShape = new CANNON.Heightfield(data, {\n * elementSize: 1 // Distance between the data points in X and Y directions\n * })\n * const heightfieldBody = new CANNON.Body({ shape: heightfieldShape })\n * world.addBody(heightfieldBody)\n */\nclass Heightfield extends Shape {\n /**\n * An array of numbers, or height values, that are spread out along the x axis.\n */\n\n /**\n * Max value of the data points in the data array.\n */\n\n /**\n * Minimum value of the data points in the data array.\n */\n\n /**\n * World spacing between the data points in X and Y direction.\n * @todo elementSizeX and Y\n * @default 1\n */\n\n /**\n * @default true\n */\n\n /**\n * @param data An array of numbers, or height values, that are spread out along the x axis.\n */\n constructor(data, options) {\n if (options === void 0) {\n options = {};\n }\n\n options = Utils.defaults(options, {\n maxValue: null,\n minValue: null,\n elementSize: 1\n });\n super({\n type: Shape.types.HEIGHTFIELD\n });\n this.data = data;\n this.maxValue = options.maxValue;\n this.minValue = options.minValue;\n this.elementSize = options.elementSize;\n\n if (options.minValue === null) {\n this.updateMinValue();\n }\n\n if (options.maxValue === null) {\n this.updateMaxValue();\n }\n\n this.cacheEnabled = true;\n this.pillarConvex = new ConvexPolyhedron();\n this.pillarOffset = new Vec3();\n this.updateBoundingSphereRadius(); // \"i_j_isUpper\" => { convex: ..., offset: ... }\n // for example:\n // _cachedPillars[\"0_2_1\"]\n\n this._cachedPillars = {};\n }\n /**\n * Call whenever you change the data array.\n */\n\n\n update() {\n this._cachedPillars = {};\n }\n /**\n * Update the `minValue` property\n */\n\n\n updateMinValue() {\n const data = this.data;\n let minValue = data[0][0];\n\n for (let i = 0; i !== data.length; i++) {\n for (let j = 0; j !== data[i].length; j++) {\n const v = data[i][j];\n\n if (v < minValue) {\n minValue = v;\n }\n }\n }\n\n this.minValue = minValue;\n }\n /**\n * Update the `maxValue` property\n */\n\n\n updateMaxValue() {\n const data = this.data;\n let maxValue = data[0][0];\n\n for (let i = 0; i !== data.length; i++) {\n for (let j = 0; j !== data[i].length; j++) {\n const v = data[i][j];\n\n if (v > maxValue) {\n maxValue = v;\n }\n }\n }\n\n this.maxValue = maxValue;\n }\n /**\n * Set the height value at an index. Don't forget to update maxValue and minValue after you're done.\n */\n\n\n setHeightValueAtIndex(xi, yi, value) {\n const data = this.data;\n data[xi][yi] = value; // Invalidate cache\n\n this.clearCachedConvexTrianglePillar(xi, yi, false);\n\n if (xi > 0) {\n this.clearCachedConvexTrianglePillar(xi - 1, yi, true);\n this.clearCachedConvexTrianglePillar(xi - 1, yi, false);\n }\n\n if (yi > 0) {\n this.clearCachedConvexTrianglePillar(xi, yi - 1, true);\n this.clearCachedConvexTrianglePillar(xi, yi - 1, false);\n }\n\n if (yi > 0 && xi > 0) {\n this.clearCachedConvexTrianglePillar(xi - 1, yi - 1, true);\n }\n }\n /**\n * Get max/min in a rectangle in the matrix data\n * @param result An array to store the results in.\n * @return The result array, if it was passed in. Minimum will be at position 0 and max at 1.\n */\n\n\n getRectMinMax(iMinX, iMinY, iMaxX, iMaxY, result) {\n if (result === void 0) {\n result = [];\n }\n\n // Get max and min of the data\n const data = this.data; // Set first value\n\n let max = this.minValue;\n\n for (let i = iMinX; i <= iMaxX; i++) {\n for (let j = iMinY; j <= iMaxY; j++) {\n const height = data[i][j];\n\n if (height > max) {\n max = height;\n }\n }\n }\n\n result[0] = this.minValue;\n result[1] = max;\n }\n /**\n * Get the index of a local position on the heightfield. The indexes indicate the rectangles, so if your terrain is made of N x N height data points, you will have rectangle indexes ranging from 0 to N-1.\n * @param result Two-element array\n * @param clamp If the position should be clamped to the heightfield edge.\n */\n\n\n getIndexOfPosition(x, y, result, clamp) {\n // Get the index of the data points to test against\n const w = this.elementSize;\n const data = this.data;\n let xi = Math.floor(x / w);\n let yi = Math.floor(y / w);\n result[0] = xi;\n result[1] = yi;\n\n if (clamp) {\n // Clamp index to edges\n if (xi < 0) {\n xi = 0;\n }\n\n if (yi < 0) {\n yi = 0;\n }\n\n if (xi >= data.length - 1) {\n xi = data.length - 1;\n }\n\n if (yi >= data[0].length - 1) {\n yi = data[0].length - 1;\n }\n } // Bail out if we are out of the terrain\n\n\n if (xi < 0 || yi < 0 || xi >= data.length - 1 || yi >= data[0].length - 1) {\n return false;\n }\n\n return true;\n }\n\n getTriangleAt(x, y, edgeClamp, a, b, c) {\n const idx = getHeightAt_idx;\n this.getIndexOfPosition(x, y, idx, edgeClamp);\n let xi = idx[0];\n let yi = idx[1];\n const data = this.data;\n\n if (edgeClamp) {\n xi = Math.min(data.length - 2, Math.max(0, xi));\n yi = Math.min(data[0].length - 2, Math.max(0, yi));\n }\n\n const elementSize = this.elementSize;\n const lowerDist2 = (x / elementSize - xi) ** 2 + (y / elementSize - yi) ** 2;\n const upperDist2 = (x / elementSize - (xi + 1)) ** 2 + (y / elementSize - (yi + 1)) ** 2;\n const upper = lowerDist2 > upperDist2;\n this.getTriangle(xi, yi, upper, a, b, c);\n return upper;\n }\n\n getNormalAt(x, y, edgeClamp, result) {\n const a = getNormalAt_a;\n const b = getNormalAt_b;\n const c = getNormalAt_c;\n const e0 = getNormalAt_e0;\n const e1 = getNormalAt_e1;\n this.getTriangleAt(x, y, edgeClamp, a, b, c);\n b.vsub(a, e0);\n c.vsub(a, e1);\n e0.cross(e1, result);\n result.normalize();\n }\n /**\n * Get an AABB of a square in the heightfield\n * @param xi\n * @param yi\n * @param result\n */\n\n\n getAabbAtIndex(xi, yi, _ref) {\n let {\n lowerBound,\n upperBound\n } = _ref;\n const data = this.data;\n const elementSize = this.elementSize;\n lowerBound.set(xi * elementSize, yi * elementSize, data[xi][yi]);\n upperBound.set((xi + 1) * elementSize, (yi + 1) * elementSize, data[xi + 1][yi + 1]);\n }\n /**\n * Get the height in the heightfield at a given position\n */\n\n\n getHeightAt(x, y, edgeClamp) {\n const data = this.data;\n const a = getHeightAt_a;\n const b = getHeightAt_b;\n const c = getHeightAt_c;\n const idx = getHeightAt_idx;\n this.getIndexOfPosition(x, y, idx, edgeClamp);\n let xi = idx[0];\n let yi = idx[1];\n\n if (edgeClamp) {\n xi = Math.min(data.length - 2, Math.max(0, xi));\n yi = Math.min(data[0].length - 2, Math.max(0, yi));\n }\n\n const upper = this.getTriangleAt(x, y, edgeClamp, a, b, c);\n barycentricWeights(x, y, a.x, a.y, b.x, b.y, c.x, c.y, getHeightAt_weights);\n const w = getHeightAt_weights;\n\n if (upper) {\n // Top triangle verts\n return data[xi + 1][yi + 1] * w.x + data[xi][yi + 1] * w.y + data[xi + 1][yi] * w.z;\n } else {\n // Top triangle verts\n return data[xi][yi] * w.x + data[xi + 1][yi] * w.y + data[xi][yi + 1] * w.z;\n }\n }\n\n getCacheConvexTrianglePillarKey(xi, yi, getUpperTriangle) {\n return `${xi}_${yi}_${getUpperTriangle ? 1 : 0}`;\n }\n\n getCachedConvexTrianglePillar(xi, yi, getUpperTriangle) {\n return this._cachedPillars[this.getCacheConvexTrianglePillarKey(xi, yi, getUpperTriangle)];\n }\n\n setCachedConvexTrianglePillar(xi, yi, getUpperTriangle, convex, offset) {\n this._cachedPillars[this.getCacheConvexTrianglePillarKey(xi, yi, getUpperTriangle)] = {\n convex,\n offset\n };\n }\n\n clearCachedConvexTrianglePillar(xi, yi, getUpperTriangle) {\n delete this._cachedPillars[this.getCacheConvexTrianglePillarKey(xi, yi, getUpperTriangle)];\n }\n /**\n * Get a triangle from the heightfield\n */\n\n\n getTriangle(xi, yi, upper, a, b, c) {\n const data = this.data;\n const elementSize = this.elementSize;\n\n if (upper) {\n // Top triangle verts\n a.set((xi + 1) * elementSize, (yi + 1) * elementSize, data[xi + 1][yi + 1]);\n b.set(xi * elementSize, (yi + 1) * elementSize, data[xi][yi + 1]);\n c.set((xi + 1) * elementSize, yi * elementSize, data[xi + 1][yi]);\n } else {\n // Top triangle verts\n a.set(xi * elementSize, yi * elementSize, data[xi][yi]);\n b.set((xi + 1) * elementSize, yi * elementSize, data[xi + 1][yi]);\n c.set(xi * elementSize, (yi + 1) * elementSize, data[xi][yi + 1]);\n }\n }\n /**\n * Get a triangle in the terrain in the form of a triangular convex shape.\n */\n\n\n getConvexTrianglePillar(xi, yi, getUpperTriangle) {\n let result = this.pillarConvex;\n let offsetResult = this.pillarOffset;\n\n if (this.cacheEnabled) {\n const data = this.getCachedConvexTrianglePillar(xi, yi, getUpperTriangle);\n\n if (data) {\n this.pillarConvex = data.convex;\n this.pillarOffset = data.offset;\n return;\n }\n\n result = new ConvexPolyhedron();\n offsetResult = new Vec3();\n this.pillarConvex = result;\n this.pillarOffset = offsetResult;\n }\n\n const data = this.data;\n const elementSize = this.elementSize;\n const faces = result.faces; // Reuse verts if possible\n\n result.vertices.length = 6;\n\n for (let i = 0; i < 6; i++) {\n if (!result.vertices[i]) {\n result.vertices[i] = new Vec3();\n }\n } // Reuse faces if possible\n\n\n faces.length = 5;\n\n for (let i = 0; i < 5; i++) {\n if (!faces[i]) {\n faces[i] = [];\n }\n }\n\n const verts = result.vertices;\n const h = (Math.min(data[xi][yi], data[xi + 1][yi], data[xi][yi + 1], data[xi + 1][yi + 1]) - this.minValue) / 2 + this.minValue;\n\n if (!getUpperTriangle) {\n // Center of the triangle pillar - all polygons are given relative to this one\n offsetResult.set((xi + 0.25) * elementSize, // sort of center of a triangle\n (yi + 0.25) * elementSize, h // vertical center\n ); // Top triangle verts\n\n verts[0].set(-0.25 * elementSize, -0.25 * elementSize, data[xi][yi] - h);\n verts[1].set(0.75 * elementSize, -0.25 * elementSize, data[xi + 1][yi] - h);\n verts[2].set(-0.25 * elementSize, 0.75 * elementSize, data[xi][yi + 1] - h); // bottom triangle verts\n\n verts[3].set(-0.25 * elementSize, -0.25 * elementSize, -Math.abs(h) - 1);\n verts[4].set(0.75 * elementSize, -0.25 * elementSize, -Math.abs(h) - 1);\n verts[5].set(-0.25 * elementSize, 0.75 * elementSize, -Math.abs(h) - 1); // top triangle\n\n faces[0][0] = 0;\n faces[0][1] = 1;\n faces[0][2] = 2; // bottom triangle\n\n faces[1][0] = 5;\n faces[1][1] = 4;\n faces[1][2] = 3; // -x facing quad\n\n faces[2][0] = 0;\n faces[2][1] = 2;\n faces[2][2] = 5;\n faces[2][3] = 3; // -y facing quad\n\n faces[3][0] = 1;\n faces[3][1] = 0;\n faces[3][2] = 3;\n faces[3][3] = 4; // +xy facing quad\n\n faces[4][0] = 4;\n faces[4][1] = 5;\n faces[4][2] = 2;\n faces[4][3] = 1;\n } else {\n // Center of the triangle pillar - all polygons are given relative to this one\n offsetResult.set((xi + 0.75) * elementSize, // sort of center of a triangle\n (yi + 0.75) * elementSize, h // vertical center\n ); // Top triangle verts\n\n verts[0].set(0.25 * elementSize, 0.25 * elementSize, data[xi + 1][yi + 1] - h);\n verts[1].set(-0.75 * elementSize, 0.25 * elementSize, data[xi][yi + 1] - h);\n verts[2].set(0.25 * elementSize, -0.75 * elementSize, data[xi + 1][yi] - h); // bottom triangle verts\n\n verts[3].set(0.25 * elementSize, 0.25 * elementSize, -Math.abs(h) - 1);\n verts[4].set(-0.75 * elementSize, 0.25 * elementSize, -Math.abs(h) - 1);\n verts[5].set(0.25 * elementSize, -0.75 * elementSize, -Math.abs(h) - 1); // Top triangle\n\n faces[0][0] = 0;\n faces[0][1] = 1;\n faces[0][2] = 2; // bottom triangle\n\n faces[1][0] = 5;\n faces[1][1] = 4;\n faces[1][2] = 3; // +x facing quad\n\n faces[2][0] = 2;\n faces[2][1] = 5;\n faces[2][2] = 3;\n faces[2][3] = 0; // +y facing quad\n\n faces[3][0] = 3;\n faces[3][1] = 4;\n faces[3][2] = 1;\n faces[3][3] = 0; // -xy facing quad\n\n faces[4][0] = 1;\n faces[4][1] = 4;\n faces[4][2] = 5;\n faces[4][3] = 2;\n }\n\n result.computeNormals();\n result.computeEdges();\n result.updateBoundingSphereRadius();\n this.setCachedConvexTrianglePillar(xi, yi, getUpperTriangle, result, offsetResult);\n }\n\n calculateLocalInertia(mass, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n target.set(0, 0, 0);\n return target;\n }\n\n volume() {\n return (// The terrain is infinite\n Number.MAX_VALUE\n );\n }\n\n calculateWorldAABB(pos, quat, min, max) {\n /** @TODO do it properly */\n min.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\n max.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n }\n\n updateBoundingSphereRadius() {\n // Use the bounding box of the min/max values\n const data = this.data;\n const s = this.elementSize;\n this.boundingSphereRadius = new Vec3(data.length * s, data[0].length * s, Math.max(Math.abs(this.maxValue), Math.abs(this.minValue))).length();\n }\n /**\n * Sets the height values from an image. Currently only supported in browser.\n */\n\n\n setHeightsFromImage(image, scale) {\n const {\n x,\n z,\n y\n } = scale;\n const canvas = document.createElement('canvas');\n canvas.width = image.width;\n canvas.height = image.height;\n const context = canvas.getContext('2d');\n context.drawImage(image, 0, 0);\n const imageData = context.getImageData(0, 0, image.width, image.height);\n const matrix = this.data;\n matrix.length = 0;\n this.elementSize = Math.abs(x) / imageData.width;\n\n for (let i = 0; i < imageData.height; i++) {\n const row = [];\n\n for (let j = 0; j < imageData.width; j++) {\n const a = imageData.data[(i * imageData.height + j) * 4];\n const b = imageData.data[(i * imageData.height + j) * 4 + 1];\n const c = imageData.data[(i * imageData.height + j) * 4 + 2];\n const height = (a + b + c) / 4 / 255 * z;\n\n if (x < 0) {\n row.push(height);\n } else {\n row.unshift(height);\n }\n }\n\n if (y < 0) {\n matrix.unshift(row);\n } else {\n matrix.push(row);\n }\n }\n\n this.updateMaxValue();\n this.updateMinValue();\n this.update();\n }\n\n}\nconst getHeightAt_idx = [];\nconst getHeightAt_weights = new Vec3();\nconst getHeightAt_a = new Vec3();\nconst getHeightAt_b = new Vec3();\nconst getHeightAt_c = new Vec3();\nconst getNormalAt_a = new Vec3();\nconst getNormalAt_b = new Vec3();\nconst getNormalAt_c = new Vec3();\nconst getNormalAt_e0 = new Vec3();\nconst getNormalAt_e1 = new Vec3(); // from https://en.wikipedia.org/wiki/Barycentric_coordinate_system\n\nfunction barycentricWeights(x, y, ax, ay, bx, by, cx, cy, result) {\n result.x = ((by - cy) * (x - cx) + (cx - bx) * (y - cy)) / ((by - cy) * (ax - cx) + (cx - bx) * (ay - cy));\n result.y = ((cy - ay) * (x - cx) + (ax - cx) * (y - cy)) / ((by - cy) * (ax - cx) + (cx - bx) * (ay - cy));\n result.z = 1 - result.x - result.y;\n}\n\n/**\n * OctreeNode\n */\nclass OctreeNode {\n /** The root node */\n\n /** Boundary of this node */\n\n /** Contained data at the current node level */\n\n /** Children to this node */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n this.root = options.root || null;\n this.aabb = options.aabb ? options.aabb.clone() : new AABB();\n this.data = [];\n this.children = [];\n }\n /**\n * reset\n */\n\n\n reset() {\n this.children.length = this.data.length = 0;\n }\n /**\n * Insert data into this node\n * @return True if successful, otherwise false\n */\n\n\n insert(aabb, elementData, level) {\n if (level === void 0) {\n level = 0;\n }\n\n const nodeData = this.data; // Ignore objects that do not belong in this node\n\n if (!this.aabb.contains(aabb)) {\n return false; // object cannot be added\n }\n\n const children = this.children;\n const maxDepth = this.maxDepth || this.root.maxDepth;\n\n if (level < maxDepth) {\n // Subdivide if there are no children yet\n let subdivided = false;\n\n if (!children.length) {\n this.subdivide();\n subdivided = true;\n } // add to whichever node will accept it\n\n\n for (let i = 0; i !== 8; i++) {\n if (children[i].insert(aabb, elementData, level + 1)) {\n return true;\n }\n }\n\n if (subdivided) {\n // No children accepted! Might as well just remove em since they contain none\n children.length = 0;\n }\n } // Too deep, or children didnt want it. add it in current node\n\n\n nodeData.push(elementData);\n return true;\n }\n /**\n * Create 8 equally sized children nodes and put them in the `children` array.\n */\n\n\n subdivide() {\n const aabb = this.aabb;\n const l = aabb.lowerBound;\n const u = aabb.upperBound;\n const children = this.children;\n children.push(new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(0, 0, 0)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(1, 0, 0)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(1, 1, 0)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(1, 1, 1)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(0, 1, 1)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(0, 0, 1)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(1, 0, 1)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(0, 1, 0)\n })\n }));\n u.vsub(l, halfDiagonal);\n halfDiagonal.scale(0.5, halfDiagonal);\n const root = this.root || this;\n\n for (let i = 0; i !== 8; i++) {\n const child = children[i]; // Set current node as root\n\n child.root = root; // Compute bounds\n\n const lowerBound = child.aabb.lowerBound;\n lowerBound.x *= halfDiagonal.x;\n lowerBound.y *= halfDiagonal.y;\n lowerBound.z *= halfDiagonal.z;\n lowerBound.vadd(l, lowerBound); // Upper bound is always lower bound + halfDiagonal\n\n lowerBound.vadd(halfDiagonal, child.aabb.upperBound);\n }\n }\n /**\n * Get all data, potentially within an AABB\n * @return The \"result\" object\n */\n\n\n aabbQuery(aabb, result) {\n this.data; // abort if the range does not intersect this node\n // if (!this.aabb.overlaps(aabb)){\n // return result;\n // }\n // Add objects at this level\n // Array.prototype.push.apply(result, nodeData);\n // Add child data\n // @todo unwrap recursion into a queue / loop, that's faster in JS\n\n this.children; // for (let i = 0, N = this.children.length; i !== N; i++) {\n // children[i].aabbQuery(aabb, result);\n // }\n\n const queue = [this];\n\n while (queue.length) {\n const node = queue.pop();\n\n if (node.aabb.overlaps(aabb)) {\n Array.prototype.push.apply(result, node.data);\n }\n\n Array.prototype.push.apply(queue, node.children);\n }\n\n return result;\n }\n /**\n * Get all data, potentially intersected by a ray.\n * @return The \"result\" object\n */\n\n\n rayQuery(ray, treeTransform, result) {\n // Use aabb query for now.\n\n /** @todo implement real ray query which needs less lookups */\n ray.getAABB(tmpAABB);\n tmpAABB.toLocalFrame(treeTransform, tmpAABB);\n this.aabbQuery(tmpAABB, result);\n return result;\n }\n /**\n * removeEmptyNodes\n */\n\n\n removeEmptyNodes() {\n for (let i = this.children.length - 1; i >= 0; i--) {\n this.children[i].removeEmptyNodes();\n\n if (!this.children[i].children.length && !this.children[i].data.length) {\n this.children.splice(i, 1);\n }\n }\n }\n\n}\n/**\n * Octree\n */\n\n\nclass Octree extends OctreeNode {\n /**\n * Maximum subdivision depth\n * @default 8\n */\n\n /**\n * @param aabb The total AABB of the tree\n */\n constructor(aabb, options) {\n if (options === void 0) {\n options = {};\n }\n\n super({\n root: null,\n aabb\n });\n this.maxDepth = typeof options.maxDepth !== 'undefined' ? options.maxDepth : 8;\n }\n\n}\nconst halfDiagonal = new Vec3();\nconst tmpAABB = new AABB();\n\n/**\n * Trimesh.\n * @example\n * // How to make a mesh with a single triangle\n * const vertices = [\n * 0, 0, 0, // vertex 0\n * 1, 0, 0, // vertex 1\n * 0, 1, 0 // vertex 2\n * ]\n * const indices = [\n * 0, 1, 2 // triangle 0\n * ]\n * const trimeshShape = new CANNON.Trimesh(vertices, indices)\n */\nclass Trimesh extends Shape {\n /**\n * vertices\n */\n\n /**\n * Array of integers, indicating which vertices each triangle consists of. The length of this array is thus 3 times the number of triangles.\n */\n\n /**\n * The normals data.\n */\n\n /**\n * The local AABB of the mesh.\n */\n\n /**\n * References to vertex pairs, making up all unique edges in the trimesh.\n */\n\n /**\n * Local scaling of the mesh. Use .setScale() to set it.\n */\n\n /**\n * The indexed triangles. Use .updateTree() to update it.\n */\n constructor(vertices, indices) {\n super({\n type: Shape.types.TRIMESH\n });\n this.vertices = new Float32Array(vertices);\n this.indices = new Int16Array(indices);\n this.normals = new Float32Array(indices.length);\n this.aabb = new AABB();\n this.edges = null;\n this.scale = new Vec3(1, 1, 1);\n this.tree = new Octree();\n this.updateEdges();\n this.updateNormals();\n this.updateAABB();\n this.updateBoundingSphereRadius();\n this.updateTree();\n }\n /**\n * updateTree\n */\n\n\n updateTree() {\n const tree = this.tree;\n tree.reset();\n tree.aabb.copy(this.aabb);\n const scale = this.scale; // The local mesh AABB is scaled, but the octree AABB should be unscaled\n\n tree.aabb.lowerBound.x *= 1 / scale.x;\n tree.aabb.lowerBound.y *= 1 / scale.y;\n tree.aabb.lowerBound.z *= 1 / scale.z;\n tree.aabb.upperBound.x *= 1 / scale.x;\n tree.aabb.upperBound.y *= 1 / scale.y;\n tree.aabb.upperBound.z *= 1 / scale.z; // Insert all triangles\n\n const triangleAABB = new AABB();\n const a = new Vec3();\n const b = new Vec3();\n const c = new Vec3();\n const points = [a, b, c];\n\n for (let i = 0; i < this.indices.length / 3; i++) {\n //this.getTriangleVertices(i, a, b, c);\n // Get unscaled triangle verts\n const i3 = i * 3;\n\n this._getUnscaledVertex(this.indices[i3], a);\n\n this._getUnscaledVertex(this.indices[i3 + 1], b);\n\n this._getUnscaledVertex(this.indices[i3 + 2], c);\n\n triangleAABB.setFromPoints(points);\n tree.insert(triangleAABB, i);\n }\n\n tree.removeEmptyNodes();\n }\n /**\n * Get triangles in a local AABB from the trimesh.\n * @param result An array of integers, referencing the queried triangles.\n */\n\n\n getTrianglesInAABB(aabb, result) {\n unscaledAABB.copy(aabb); // Scale it to local\n\n const scale = this.scale;\n const isx = scale.x;\n const isy = scale.y;\n const isz = scale.z;\n const l = unscaledAABB.lowerBound;\n const u = unscaledAABB.upperBound;\n l.x /= isx;\n l.y /= isy;\n l.z /= isz;\n u.x /= isx;\n u.y /= isy;\n u.z /= isz;\n return this.tree.aabbQuery(unscaledAABB, result);\n }\n /**\n * setScale\n */\n\n\n setScale(scale) {\n const wasUniform = this.scale.x === this.scale.y && this.scale.y === this.scale.z;\n const isUniform = scale.x === scale.y && scale.y === scale.z;\n\n if (!(wasUniform && isUniform)) {\n // Non-uniform scaling. Need to update normals.\n this.updateNormals();\n }\n\n this.scale.copy(scale);\n this.updateAABB();\n this.updateBoundingSphereRadius();\n }\n /**\n * Compute the normals of the faces. Will save in the `.normals` array.\n */\n\n\n updateNormals() {\n const n = computeNormals_n; // Generate normals\n\n const normals = this.normals;\n\n for (let i = 0; i < this.indices.length / 3; i++) {\n const i3 = i * 3;\n const a = this.indices[i3];\n const b = this.indices[i3 + 1];\n const c = this.indices[i3 + 2];\n this.getVertex(a, va);\n this.getVertex(b, vb);\n this.getVertex(c, vc);\n Trimesh.computeNormal(vb, va, vc, n);\n normals[i3] = n.x;\n normals[i3 + 1] = n.y;\n normals[i3 + 2] = n.z;\n }\n }\n /**\n * Update the `.edges` property\n */\n\n\n updateEdges() {\n const edges = {};\n\n const add = (a, b) => {\n const key = a < b ? `${a}_${b}` : `${b}_${a}`;\n edges[key] = true;\n };\n\n for (let i = 0; i < this.indices.length / 3; i++) {\n const i3 = i * 3;\n const a = this.indices[i3];\n const b = this.indices[i3 + 1];\n const c = this.indices[i3 + 2];\n add(a, b);\n add(b, c);\n add(c, a);\n }\n\n const keys = Object.keys(edges);\n this.edges = new Int16Array(keys.length * 2);\n\n for (let i = 0; i < keys.length; i++) {\n const indices = keys[i].split('_');\n this.edges[2 * i] = parseInt(indices[0], 10);\n this.edges[2 * i + 1] = parseInt(indices[1], 10);\n }\n }\n /**\n * Get an edge vertex\n * @param firstOrSecond 0 or 1, depending on which one of the vertices you need.\n * @param vertexStore Where to store the result\n */\n\n\n getEdgeVertex(edgeIndex, firstOrSecond, vertexStore) {\n const vertexIndex = this.edges[edgeIndex * 2 + (firstOrSecond ? 1 : 0)];\n this.getVertex(vertexIndex, vertexStore);\n }\n /**\n * Get a vector along an edge.\n */\n\n\n getEdgeVector(edgeIndex, vectorStore) {\n const va = getEdgeVector_va;\n const vb = getEdgeVector_vb;\n this.getEdgeVertex(edgeIndex, 0, va);\n this.getEdgeVertex(edgeIndex, 1, vb);\n vb.vsub(va, vectorStore);\n }\n /**\n * Get face normal given 3 vertices\n */\n\n\n static computeNormal(va, vb, vc, target) {\n vb.vsub(va, ab);\n vc.vsub(vb, cb);\n cb.cross(ab, target);\n\n if (!target.isZero()) {\n target.normalize();\n }\n }\n /**\n * Get vertex i.\n * @return The \"out\" vector object\n */\n\n\n getVertex(i, out) {\n const scale = this.scale;\n\n this._getUnscaledVertex(i, out);\n\n out.x *= scale.x;\n out.y *= scale.y;\n out.z *= scale.z;\n return out;\n }\n /**\n * Get raw vertex i\n * @return The \"out\" vector object\n */\n\n\n _getUnscaledVertex(i, out) {\n const i3 = i * 3;\n const vertices = this.vertices;\n return out.set(vertices[i3], vertices[i3 + 1], vertices[i3 + 2]);\n }\n /**\n * Get a vertex from the trimesh,transformed by the given position and quaternion.\n * @return The \"out\" vector object\n */\n\n\n getWorldVertex(i, pos, quat, out) {\n this.getVertex(i, out);\n Transform.pointToWorldFrame(pos, quat, out, out);\n return out;\n }\n /**\n * Get the three vertices for triangle i.\n */\n\n\n getTriangleVertices(i, a, b, c) {\n const i3 = i * 3;\n this.getVertex(this.indices[i3], a);\n this.getVertex(this.indices[i3 + 1], b);\n this.getVertex(this.indices[i3 + 2], c);\n }\n /**\n * Compute the normal of triangle i.\n * @return The \"target\" vector object\n */\n\n\n getNormal(i, target) {\n const i3 = i * 3;\n return target.set(this.normals[i3], this.normals[i3 + 1], this.normals[i3 + 2]);\n }\n /**\n * @return The \"target\" vector object\n */\n\n\n calculateLocalInertia(mass, target) {\n // Approximate with box inertia\n // Exact inertia calculation is overkill, but see http://geometrictools.com/Documentation/PolyhedralMassProperties.pdf for the correct way to do it\n this.computeLocalAABB(cli_aabb);\n const x = cli_aabb.upperBound.x - cli_aabb.lowerBound.x;\n const y = cli_aabb.upperBound.y - cli_aabb.lowerBound.y;\n const z = cli_aabb.upperBound.z - cli_aabb.lowerBound.z;\n return target.set(1.0 / 12.0 * mass * (2 * y * 2 * y + 2 * z * 2 * z), 1.0 / 12.0 * mass * (2 * x * 2 * x + 2 * z * 2 * z), 1.0 / 12.0 * mass * (2 * y * 2 * y + 2 * x * 2 * x));\n }\n /**\n * Compute the local AABB for the trimesh\n */\n\n\n computeLocalAABB(aabb) {\n const l = aabb.lowerBound;\n const u = aabb.upperBound;\n const n = this.vertices.length;\n this.vertices;\n const v = computeLocalAABB_worldVert;\n this.getVertex(0, v);\n l.copy(v);\n u.copy(v);\n\n for (let i = 0; i !== n; i++) {\n this.getVertex(i, v);\n\n if (v.x < l.x) {\n l.x = v.x;\n } else if (v.x > u.x) {\n u.x = v.x;\n }\n\n if (v.y < l.y) {\n l.y = v.y;\n } else if (v.y > u.y) {\n u.y = v.y;\n }\n\n if (v.z < l.z) {\n l.z = v.z;\n } else if (v.z > u.z) {\n u.z = v.z;\n }\n }\n }\n /**\n * Update the `.aabb` property\n */\n\n\n updateAABB() {\n this.computeLocalAABB(this.aabb);\n }\n /**\n * Will update the `.boundingSphereRadius` property\n */\n\n\n updateBoundingSphereRadius() {\n // Assume points are distributed with local (0,0,0) as center\n let max2 = 0;\n const vertices = this.vertices;\n const v = new Vec3();\n\n for (let i = 0, N = vertices.length / 3; i !== N; i++) {\n this.getVertex(i, v);\n const norm2 = v.lengthSquared();\n\n if (norm2 > max2) {\n max2 = norm2;\n }\n }\n\n this.boundingSphereRadius = Math.sqrt(max2);\n }\n /**\n * calculateWorldAABB\n */\n\n\n calculateWorldAABB(pos, quat, min, max) {\n /*\n const n = this.vertices.length / 3,\n verts = this.vertices;\n const minx,miny,minz,maxx,maxy,maxz;\n const v = tempWorldVertex;\n for(let i=0; i maxx || maxx===undefined){\n maxx = v.x;\n }\n if (v.y < miny || miny===undefined){\n miny = v.y;\n } else if(v.y > maxy || maxy===undefined){\n maxy = v.y;\n }\n if (v.z < minz || minz===undefined){\n minz = v.z;\n } else if(v.z > maxz || maxz===undefined){\n maxz = v.z;\n }\n }\n min.set(minx,miny,minz);\n max.set(maxx,maxy,maxz);\n */\n // Faster approximation using local AABB\n const frame = calculateWorldAABB_frame;\n const result = calculateWorldAABB_aabb;\n frame.position = pos;\n frame.quaternion = quat;\n this.aabb.toWorldFrame(frame, result);\n min.copy(result.lowerBound);\n max.copy(result.upperBound);\n }\n /**\n * Get approximate volume\n */\n\n\n volume() {\n return 4.0 * Math.PI * this.boundingSphereRadius / 3.0;\n }\n /**\n * Create a Trimesh instance, shaped as a torus.\n */\n\n\n static createTorus(radius, tube, radialSegments, tubularSegments, arc) {\n if (radius === void 0) {\n radius = 1;\n }\n\n if (tube === void 0) {\n tube = 0.5;\n }\n\n if (radialSegments === void 0) {\n radialSegments = 8;\n }\n\n if (tubularSegments === void 0) {\n tubularSegments = 6;\n }\n\n if (arc === void 0) {\n arc = Math.PI * 2;\n }\n\n const vertices = [];\n const indices = [];\n\n for (let j = 0; j <= radialSegments; j++) {\n for (let i = 0; i <= tubularSegments; i++) {\n const u = i / tubularSegments * arc;\n const v = j / radialSegments * Math.PI * 2;\n const x = (radius + tube * Math.cos(v)) * Math.cos(u);\n const y = (radius + tube * Math.cos(v)) * Math.sin(u);\n const z = tube * Math.sin(v);\n vertices.push(x, y, z);\n }\n }\n\n for (let j = 1; j <= radialSegments; j++) {\n for (let i = 1; i <= tubularSegments; i++) {\n const a = (tubularSegments + 1) * j + i - 1;\n const b = (tubularSegments + 1) * (j - 1) + i - 1;\n const c = (tubularSegments + 1) * (j - 1) + i;\n const d = (tubularSegments + 1) * j + i;\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n }\n\n return new Trimesh(vertices, indices);\n }\n\n}\nconst computeNormals_n = new Vec3();\nconst unscaledAABB = new AABB();\nconst getEdgeVector_va = new Vec3();\nconst getEdgeVector_vb = new Vec3();\nconst cb = new Vec3();\nconst ab = new Vec3();\nconst va = new Vec3();\nconst vb = new Vec3();\nconst vc = new Vec3();\nconst cli_aabb = new AABB();\nconst computeLocalAABB_worldVert = new Vec3();\nconst calculateWorldAABB_frame = new Transform();\nconst calculateWorldAABB_aabb = new AABB();\n\n/**\n * Constraint equation solver base class.\n */\nclass Solver {\n /**\n * All equations to be solved\n */\n\n /**\n * @todo remove useless constructor\n */\n constructor() {\n this.equations = [];\n }\n /**\n * Should be implemented in subclasses!\n * @todo use abstract\n * @return number of iterations performed\n */\n\n\n solve(dt, world) {\n return (// Should return the number of iterations done!\n 0\n );\n }\n /**\n * Add an equation\n */\n\n\n addEquation(eq) {\n if (eq.enabled && !eq.bi.isTrigger && !eq.bj.isTrigger) {\n this.equations.push(eq);\n }\n }\n /**\n * Remove an equation\n */\n\n\n removeEquation(eq) {\n const eqs = this.equations;\n const i = eqs.indexOf(eq);\n\n if (i !== -1) {\n eqs.splice(i, 1);\n }\n }\n /**\n * Add all equations\n */\n\n\n removeAllEquations() {\n this.equations.length = 0;\n }\n\n}\n\n/**\n * Constraint equation Gauss-Seidel solver.\n * @todo The spook parameters should be specified for each constraint, not globally.\n * @see https://www8.cs.umu.se/kurser/5DV058/VT09/lectures/spooknotes.pdf\n */\nclass GSSolver extends Solver {\n /**\n * The number of solver iterations determines quality of the constraints in the world.\n * The more iterations, the more correct simulation. More iterations need more computations though. If you have a large gravity force in your world, you will need more iterations.\n */\n\n /**\n * When tolerance is reached, the system is assumed to be converged.\n */\n\n /**\n * @todo remove useless constructor\n */\n constructor() {\n super();\n this.iterations = 10;\n this.tolerance = 1e-7;\n }\n /**\n * Solve\n * @return number of iterations performed\n */\n\n\n solve(dt, world) {\n let iter = 0;\n const maxIter = this.iterations;\n const tolSquared = this.tolerance * this.tolerance;\n const equations = this.equations;\n const Neq = equations.length;\n const bodies = world.bodies;\n const Nbodies = bodies.length;\n const h = dt;\n let B;\n let invC;\n let deltalambda;\n let deltalambdaTot;\n let GWlambda;\n let lambdaj; // Update solve mass\n\n if (Neq !== 0) {\n for (let i = 0; i !== Nbodies; i++) {\n bodies[i].updateSolveMassProperties();\n }\n } // Things that do not change during iteration can be computed once\n\n\n const invCs = GSSolver_solve_invCs;\n const Bs = GSSolver_solve_Bs;\n const lambda = GSSolver_solve_lambda;\n invCs.length = Neq;\n Bs.length = Neq;\n lambda.length = Neq;\n\n for (let i = 0; i !== Neq; i++) {\n const c = equations[i];\n lambda[i] = 0.0;\n Bs[i] = c.computeB(h);\n invCs[i] = 1.0 / c.computeC();\n }\n\n if (Neq !== 0) {\n // Reset vlambda\n for (let i = 0; i !== Nbodies; i++) {\n const b = bodies[i];\n const vlambda = b.vlambda;\n const wlambda = b.wlambda;\n vlambda.set(0, 0, 0);\n wlambda.set(0, 0, 0);\n } // Iterate over equations\n\n\n for (iter = 0; iter !== maxIter; iter++) {\n // Accumulate the total error for each iteration.\n deltalambdaTot = 0.0;\n\n for (let j = 0; j !== Neq; j++) {\n const c = equations[j]; // Compute iteration\n\n B = Bs[j];\n invC = invCs[j];\n lambdaj = lambda[j];\n GWlambda = c.computeGWlambda();\n deltalambda = invC * (B - GWlambda - c.eps * lambdaj); // Clamp if we are not within the min/max interval\n\n if (lambdaj + deltalambda < c.minForce) {\n deltalambda = c.minForce - lambdaj;\n } else if (lambdaj + deltalambda > c.maxForce) {\n deltalambda = c.maxForce - lambdaj;\n }\n\n lambda[j] += deltalambda;\n deltalambdaTot += deltalambda > 0.0 ? deltalambda : -deltalambda; // abs(deltalambda)\n\n c.addToWlambda(deltalambda);\n } // If the total error is small enough - stop iterate\n\n\n if (deltalambdaTot * deltalambdaTot < tolSquared) {\n break;\n }\n } // Add result to velocity\n\n\n for (let i = 0; i !== Nbodies; i++) {\n const b = bodies[i];\n const v = b.velocity;\n const w = b.angularVelocity;\n b.vlambda.vmul(b.linearFactor, b.vlambda);\n v.vadd(b.vlambda, v);\n b.wlambda.vmul(b.angularFactor, b.wlambda);\n w.vadd(b.wlambda, w);\n } // Set the `.multiplier` property of each equation\n\n\n let l = equations.length;\n const invDt = 1 / h;\n\n while (l--) {\n equations[l].multiplier = lambda[l] * invDt;\n }\n }\n\n return iter;\n }\n\n} // Just temporary number holders that we want to reuse each iteration.\n\nconst GSSolver_solve_lambda = [];\nconst GSSolver_solve_invCs = [];\nconst GSSolver_solve_Bs = [];\n\n/**\n * Splits the equations into islands and solves them independently. Can improve performance.\n */\nclass SplitSolver extends Solver {\n /**\n * The number of solver iterations determines quality of the constraints in the world. The more iterations, the more correct simulation. More iterations need more computations though. If you have a large gravity force in your world, you will need more iterations.\n */\n\n /**\n * When tolerance is reached, the system is assumed to be converged.\n */\n\n /** subsolver */\n constructor(subsolver) {\n super();\n this.iterations = 10;\n this.tolerance = 1e-7;\n this.subsolver = subsolver;\n this.nodes = [];\n this.nodePool = []; // Create needed nodes, reuse if possible\n\n while (this.nodePool.length < 128) {\n this.nodePool.push(this.createNode());\n }\n }\n /**\n * createNode\n */\n\n\n createNode() {\n return {\n body: null,\n children: [],\n eqs: [],\n visited: false\n };\n }\n /**\n * Solve the subsystems\n * @return number of iterations performed\n */\n\n\n solve(dt, world) {\n const nodes = SplitSolver_solve_nodes;\n const nodePool = this.nodePool;\n const bodies = world.bodies;\n const equations = this.equations;\n const Neq = equations.length;\n const Nbodies = bodies.length;\n const subsolver = this.subsolver; // Create needed nodes, reuse if possible\n\n while (nodePool.length < Nbodies) {\n nodePool.push(this.createNode());\n }\n\n nodes.length = Nbodies;\n\n for (let i = 0; i < Nbodies; i++) {\n nodes[i] = nodePool[i];\n } // Reset node values\n\n\n for (let i = 0; i !== Nbodies; i++) {\n const node = nodes[i];\n node.body = bodies[i];\n node.children.length = 0;\n node.eqs.length = 0;\n node.visited = false;\n }\n\n for (let k = 0; k !== Neq; k++) {\n const eq = equations[k];\n const i = bodies.indexOf(eq.bi);\n const j = bodies.indexOf(eq.bj);\n const ni = nodes[i];\n const nj = nodes[j];\n ni.children.push(nj);\n ni.eqs.push(eq);\n nj.children.push(ni);\n nj.eqs.push(eq);\n }\n\n let child;\n let n = 0;\n let eqs = SplitSolver_solve_eqs;\n subsolver.tolerance = this.tolerance;\n subsolver.iterations = this.iterations;\n const dummyWorld = SplitSolver_solve_dummyWorld;\n\n while (child = getUnvisitedNode(nodes)) {\n eqs.length = 0;\n dummyWorld.bodies.length = 0;\n bfs(child, visitFunc, dummyWorld.bodies, eqs);\n const Neqs = eqs.length;\n eqs = eqs.sort(sortById);\n\n for (let i = 0; i !== Neqs; i++) {\n subsolver.addEquation(eqs[i]);\n }\n\n subsolver.solve(dt, dummyWorld);\n subsolver.removeAllEquations();\n n++;\n }\n\n return n;\n }\n\n} // Returns the number of subsystems\n\nconst SplitSolver_solve_nodes = []; // All allocated node objects\n\nconst SplitSolver_solve_eqs = []; // Temp array\n\nconst SplitSolver_solve_dummyWorld = {\n bodies: []\n}; // Temp object\n\nconst STATIC = Body.STATIC;\n\nfunction getUnvisitedNode(nodes) {\n const Nnodes = nodes.length;\n\n for (let i = 0; i !== Nnodes; i++) {\n const node = nodes[i];\n\n if (!node.visited && !(node.body.type & STATIC)) {\n return node;\n }\n }\n\n return false;\n}\n\nconst queue = [];\n\nfunction bfs(root, visitFunc, bds, eqs) {\n queue.push(root);\n root.visited = true;\n visitFunc(root, bds, eqs);\n\n while (queue.length) {\n const node = queue.pop(); // Loop over unvisited child nodes\n\n let child;\n\n while (child = getUnvisitedNode(node.children)) {\n child.visited = true;\n visitFunc(child, bds, eqs);\n queue.push(child);\n }\n }\n}\n\nfunction visitFunc(node, bds, eqs) {\n bds.push(node.body);\n const Neqs = node.eqs.length;\n\n for (let i = 0; i !== Neqs; i++) {\n const eq = node.eqs[i];\n\n if (!eqs.includes(eq)) {\n eqs.push(eq);\n }\n }\n}\n\nfunction sortById(a, b) {\n return b.id - a.id;\n}\n\n/**\n * For pooling objects that can be reused.\n */\nclass Pool {\n constructor() {\n this.objects = [];\n this.type = Object;\n }\n\n /**\n * Release an object after use\n */\n release() {\n const Nargs = arguments.length;\n\n for (let i = 0; i !== Nargs; i++) {\n this.objects.push(i < 0 || arguments.length <= i ? undefined : arguments[i]);\n }\n\n return this;\n }\n /**\n * Get an object\n */\n\n\n get() {\n if (this.objects.length === 0) {\n return this.constructObject();\n } else {\n return this.objects.pop();\n }\n }\n /**\n * Construct an object. Should be implemented in each subclass.\n */\n\n\n constructObject() {\n throw new Error('constructObject() not implemented in this Pool subclass yet!');\n }\n /**\n * @return Self, for chaining\n */\n\n\n resize(size) {\n const objects = this.objects;\n\n while (objects.length > size) {\n objects.pop();\n }\n\n while (objects.length < size) {\n objects.push(this.constructObject());\n }\n\n return this;\n }\n\n}\n\n/**\n * Vec3Pool\n */\n\nclass Vec3Pool extends Pool {\n constructor() {\n super(...arguments);\n this.type = Vec3;\n }\n\n /**\n * Construct a vector\n */\n constructObject() {\n return new Vec3();\n }\n\n}\n\n// Naming rule: based of the order in SHAPE_TYPES,\n// the first part of the method is formed by the\n// shape type that comes before, in the second part\n// there is the shape type that comes after in the SHAPE_TYPES list\nconst COLLISION_TYPES = {\n sphereSphere: Shape.types.SPHERE,\n spherePlane: Shape.types.SPHERE | Shape.types.PLANE,\n boxBox: Shape.types.BOX | Shape.types.BOX,\n sphereBox: Shape.types.SPHERE | Shape.types.BOX,\n planeBox: Shape.types.PLANE | Shape.types.BOX,\n convexConvex: Shape.types.CONVEXPOLYHEDRON,\n sphereConvex: Shape.types.SPHERE | Shape.types.CONVEXPOLYHEDRON,\n planeConvex: Shape.types.PLANE | Shape.types.CONVEXPOLYHEDRON,\n boxConvex: Shape.types.BOX | Shape.types.CONVEXPOLYHEDRON,\n sphereHeightfield: Shape.types.SPHERE | Shape.types.HEIGHTFIELD,\n boxHeightfield: Shape.types.BOX | Shape.types.HEIGHTFIELD,\n convexHeightfield: Shape.types.CONVEXPOLYHEDRON | Shape.types.HEIGHTFIELD,\n sphereParticle: Shape.types.PARTICLE | Shape.types.SPHERE,\n planeParticle: Shape.types.PLANE | Shape.types.PARTICLE,\n boxParticle: Shape.types.BOX | Shape.types.PARTICLE,\n convexParticle: Shape.types.PARTICLE | Shape.types.CONVEXPOLYHEDRON,\n cylinderCylinder: Shape.types.CYLINDER,\n sphereCylinder: Shape.types.SPHERE | Shape.types.CYLINDER,\n planeCylinder: Shape.types.PLANE | Shape.types.CYLINDER,\n boxCylinder: Shape.types.BOX | Shape.types.CYLINDER,\n convexCylinder: Shape.types.CONVEXPOLYHEDRON | Shape.types.CYLINDER,\n heightfieldCylinder: Shape.types.HEIGHTFIELD | Shape.types.CYLINDER,\n particleCylinder: Shape.types.PARTICLE | Shape.types.CYLINDER,\n sphereTrimesh: Shape.types.SPHERE | Shape.types.TRIMESH,\n planeTrimesh: Shape.types.PLANE | Shape.types.TRIMESH\n};\n\n/**\n * Helper class for the World. Generates ContactEquations.\n * @todo Sphere-ConvexPolyhedron contacts\n * @todo Contact reduction\n * @todo should move methods to prototype\n */\nclass Narrowphase {\n /**\n * Internal storage of pooled contact points.\n */\n\n /**\n * Pooled vectors.\n */\n get [COLLISION_TYPES.sphereSphere]() {\n return this.sphereSphere;\n }\n\n get [COLLISION_TYPES.spherePlane]() {\n return this.spherePlane;\n }\n\n get [COLLISION_TYPES.boxBox]() {\n return this.boxBox;\n }\n\n get [COLLISION_TYPES.sphereBox]() {\n return this.sphereBox;\n }\n\n get [COLLISION_TYPES.planeBox]() {\n return this.planeBox;\n }\n\n get [COLLISION_TYPES.convexConvex]() {\n return this.convexConvex;\n }\n\n get [COLLISION_TYPES.sphereConvex]() {\n return this.sphereConvex;\n }\n\n get [COLLISION_TYPES.planeConvex]() {\n return this.planeConvex;\n }\n\n get [COLLISION_TYPES.boxConvex]() {\n return this.boxConvex;\n }\n\n get [COLLISION_TYPES.sphereHeightfield]() {\n return this.sphereHeightfield;\n }\n\n get [COLLISION_TYPES.boxHeightfield]() {\n return this.boxHeightfield;\n }\n\n get [COLLISION_TYPES.convexHeightfield]() {\n return this.convexHeightfield;\n }\n\n get [COLLISION_TYPES.sphereParticle]() {\n return this.sphereParticle;\n }\n\n get [COLLISION_TYPES.planeParticle]() {\n return this.planeParticle;\n }\n\n get [COLLISION_TYPES.boxParticle]() {\n return this.boxParticle;\n }\n\n get [COLLISION_TYPES.convexParticle]() {\n return this.convexParticle;\n }\n\n get [COLLISION_TYPES.cylinderCylinder]() {\n return this.convexConvex;\n }\n\n get [COLLISION_TYPES.sphereCylinder]() {\n return this.sphereConvex;\n }\n\n get [COLLISION_TYPES.planeCylinder]() {\n return this.planeConvex;\n }\n\n get [COLLISION_TYPES.boxCylinder]() {\n return this.boxConvex;\n }\n\n get [COLLISION_TYPES.convexCylinder]() {\n return this.convexConvex;\n }\n\n get [COLLISION_TYPES.heightfieldCylinder]() {\n return this.heightfieldCylinder;\n }\n\n get [COLLISION_TYPES.particleCylinder]() {\n return this.particleCylinder;\n }\n\n get [COLLISION_TYPES.sphereTrimesh]() {\n return this.sphereTrimesh;\n }\n\n get [COLLISION_TYPES.planeTrimesh]() {\n return this.planeTrimesh;\n } // get [COLLISION_TYPES.convexTrimesh]() {\n // return this.convexTrimesh\n // }\n\n\n constructor(world) {\n this.contactPointPool = [];\n this.frictionEquationPool = [];\n this.result = [];\n this.frictionResult = [];\n this.v3pool = new Vec3Pool();\n this.world = world;\n this.currentContactMaterial = world.defaultContactMaterial;\n this.enableFrictionReduction = false;\n }\n /**\n * Make a contact object, by using the internal pool or creating a new one.\n */\n\n\n createContactEquation(bi, bj, si, sj, overrideShapeA, overrideShapeB) {\n let c;\n\n if (this.contactPointPool.length) {\n c = this.contactPointPool.pop();\n c.bi = bi;\n c.bj = bj;\n } else {\n c = new ContactEquation(bi, bj);\n }\n\n c.enabled = bi.collisionResponse && bj.collisionResponse && si.collisionResponse && sj.collisionResponse;\n const cm = this.currentContactMaterial;\n c.restitution = cm.restitution;\n c.setSpookParams(cm.contactEquationStiffness, cm.contactEquationRelaxation, this.world.dt);\n const matA = si.material || bi.material;\n const matB = sj.material || bj.material;\n\n if (matA && matB && matA.restitution >= 0 && matB.restitution >= 0) {\n c.restitution = matA.restitution * matB.restitution;\n }\n\n c.si = overrideShapeA || si;\n c.sj = overrideShapeB || sj;\n return c;\n }\n\n createFrictionEquationsFromContact(contactEquation, outArray) {\n const bodyA = contactEquation.bi;\n const bodyB = contactEquation.bj;\n const shapeA = contactEquation.si;\n const shapeB = contactEquation.sj;\n const world = this.world;\n const cm = this.currentContactMaterial; // If friction or restitution were specified in the material, use them\n\n let friction = cm.friction;\n const matA = shapeA.material || bodyA.material;\n const matB = shapeB.material || bodyB.material;\n\n if (matA && matB && matA.friction >= 0 && matB.friction >= 0) {\n friction = matA.friction * matB.friction;\n }\n\n if (friction > 0) {\n // Create 2 tangent equations\n // Users may provide a force different from global gravity to use when computing contact friction.\n const mug = friction * (world.frictionGravity || world.gravity).length();\n let reducedMass = bodyA.invMass + bodyB.invMass;\n\n if (reducedMass > 0) {\n reducedMass = 1 / reducedMass;\n }\n\n const pool = this.frictionEquationPool;\n const c1 = pool.length ? pool.pop() : new FrictionEquation(bodyA, bodyB, mug * reducedMass);\n const c2 = pool.length ? pool.pop() : new FrictionEquation(bodyA, bodyB, mug * reducedMass);\n c1.bi = c2.bi = bodyA;\n c1.bj = c2.bj = bodyB;\n c1.minForce = c2.minForce = -mug * reducedMass;\n c1.maxForce = c2.maxForce = mug * reducedMass; // Copy over the relative vectors\n\n c1.ri.copy(contactEquation.ri);\n c1.rj.copy(contactEquation.rj);\n c2.ri.copy(contactEquation.ri);\n c2.rj.copy(contactEquation.rj); // Construct tangents\n\n contactEquation.ni.tangents(c1.t, c2.t); // Set spook params\n\n c1.setSpookParams(cm.frictionEquationStiffness, cm.frictionEquationRelaxation, world.dt);\n c2.setSpookParams(cm.frictionEquationStiffness, cm.frictionEquationRelaxation, world.dt);\n c1.enabled = c2.enabled = contactEquation.enabled;\n outArray.push(c1, c2);\n return true;\n }\n\n return false;\n }\n /**\n * Take the average N latest contact point on the plane.\n */\n\n\n createFrictionFromAverage(numContacts) {\n // The last contactEquation\n let c = this.result[this.result.length - 1]; // Create the result: two \"average\" friction equations\n\n if (!this.createFrictionEquationsFromContact(c, this.frictionResult) || numContacts === 1) {\n return;\n }\n\n const f1 = this.frictionResult[this.frictionResult.length - 2];\n const f2 = this.frictionResult[this.frictionResult.length - 1];\n averageNormal.setZero();\n averageContactPointA.setZero();\n averageContactPointB.setZero();\n const bodyA = c.bi;\n c.bj;\n\n for (let i = 0; i !== numContacts; i++) {\n c = this.result[this.result.length - 1 - i];\n\n if (c.bi !== bodyA) {\n averageNormal.vadd(c.ni, averageNormal);\n averageContactPointA.vadd(c.ri, averageContactPointA);\n averageContactPointB.vadd(c.rj, averageContactPointB);\n } else {\n averageNormal.vsub(c.ni, averageNormal);\n averageContactPointA.vadd(c.rj, averageContactPointA);\n averageContactPointB.vadd(c.ri, averageContactPointB);\n }\n }\n\n const invNumContacts = 1 / numContacts;\n averageContactPointA.scale(invNumContacts, f1.ri);\n averageContactPointB.scale(invNumContacts, f1.rj);\n f2.ri.copy(f1.ri); // Should be the same\n\n f2.rj.copy(f1.rj);\n averageNormal.normalize();\n averageNormal.tangents(f1.t, f2.t); // return eq;\n }\n /**\n * Generate all contacts between a list of body pairs\n * @param p1 Array of body indices\n * @param p2 Array of body indices\n * @param result Array to store generated contacts\n * @param oldcontacts Optional. Array of reusable contact objects\n */\n\n\n getContacts(p1, p2, world, result, oldcontacts, frictionResult, frictionPool) {\n // Save old contact objects\n this.contactPointPool = oldcontacts;\n this.frictionEquationPool = frictionPool;\n this.result = result;\n this.frictionResult = frictionResult;\n const qi = tmpQuat1;\n const qj = tmpQuat2;\n const xi = tmpVec1;\n const xj = tmpVec2;\n\n for (let k = 0, N = p1.length; k !== N; k++) {\n // Get current collision bodies\n const bi = p1[k];\n const bj = p2[k]; // Get contact material\n\n let bodyContactMaterial = null;\n\n if (bi.material && bj.material) {\n bodyContactMaterial = world.getContactMaterial(bi.material, bj.material) || null;\n }\n\n const justTest = bi.type & Body.KINEMATIC && bj.type & Body.STATIC || bi.type & Body.STATIC && bj.type & Body.KINEMATIC || bi.type & Body.KINEMATIC && bj.type & Body.KINEMATIC;\n\n for (let i = 0; i < bi.shapes.length; i++) {\n bi.quaternion.mult(bi.shapeOrientations[i], qi);\n bi.quaternion.vmult(bi.shapeOffsets[i], xi);\n xi.vadd(bi.position, xi);\n const si = bi.shapes[i];\n\n for (let j = 0; j < bj.shapes.length; j++) {\n // Compute world transform of shapes\n bj.quaternion.mult(bj.shapeOrientations[j], qj);\n bj.quaternion.vmult(bj.shapeOffsets[j], xj);\n xj.vadd(bj.position, xj);\n const sj = bj.shapes[j];\n\n if (!(si.collisionFilterMask & sj.collisionFilterGroup && sj.collisionFilterMask & si.collisionFilterGroup)) {\n continue;\n }\n\n if (xi.distanceTo(xj) > si.boundingSphereRadius + sj.boundingSphereRadius) {\n continue;\n } // Get collision material\n\n\n let shapeContactMaterial = null;\n\n if (si.material && sj.material) {\n shapeContactMaterial = world.getContactMaterial(si.material, sj.material) || null;\n }\n\n this.currentContactMaterial = shapeContactMaterial || bodyContactMaterial || world.defaultContactMaterial; // Get contacts\n\n const resolverIndex = si.type | sj.type;\n const resolver = this[resolverIndex];\n\n if (resolver) {\n let retval = false; // TO DO: investigate why sphereParticle and convexParticle\n // resolvers expect si and sj shapes to be in reverse order\n // (i.e. larger integer value type first instead of smaller first)\n\n if (si.type < sj.type) {\n retval = resolver.call(this, si, sj, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n } else {\n retval = resolver.call(this, sj, si, xj, xi, qj, qi, bj, bi, si, sj, justTest);\n }\n\n if (retval && justTest) {\n // Register overlap\n world.shapeOverlapKeeper.set(si.id, sj.id);\n world.bodyOverlapKeeper.set(bi.id, bj.id);\n }\n }\n }\n }\n }\n }\n\n sphereSphere(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n if (justTest) {\n return xi.distanceSquared(xj) < (si.radius + sj.radius) ** 2;\n } // We will have only one contact in this case\n\n\n const contactEq = this.createContactEquation(bi, bj, si, sj, rsi, rsj); // Contact normal\n\n xj.vsub(xi, contactEq.ni);\n contactEq.ni.normalize(); // Contact point locations\n\n contactEq.ri.copy(contactEq.ni);\n contactEq.rj.copy(contactEq.ni);\n contactEq.ri.scale(si.radius, contactEq.ri);\n contactEq.rj.scale(-sj.radius, contactEq.rj);\n contactEq.ri.vadd(xi, contactEq.ri);\n contactEq.ri.vsub(bi.position, contactEq.ri);\n contactEq.rj.vadd(xj, contactEq.rj);\n contactEq.rj.vsub(bj.position, contactEq.rj);\n this.result.push(contactEq);\n this.createFrictionEquationsFromContact(contactEq, this.frictionResult);\n }\n\n spherePlane(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n // We will have one contact in this case\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj); // Contact normal\n\n r.ni.set(0, 0, 1);\n qj.vmult(r.ni, r.ni);\n r.ni.negate(r.ni); // body i is the sphere, flip normal\n\n r.ni.normalize(); // Needed?\n // Vector from sphere center to contact point\n\n r.ni.scale(si.radius, r.ri); // Project down sphere on plane\n\n xi.vsub(xj, point_on_plane_to_sphere);\n r.ni.scale(r.ni.dot(point_on_plane_to_sphere), plane_to_sphere_ortho);\n point_on_plane_to_sphere.vsub(plane_to_sphere_ortho, r.rj); // The sphere position projected to plane\n\n if (-point_on_plane_to_sphere.dot(r.ni) <= si.radius) {\n if (justTest) {\n return true;\n } // Make it relative to the body\n\n\n const ri = r.ri;\n const rj = r.rj;\n ri.vadd(xi, ri);\n ri.vsub(bi.position, ri);\n rj.vadd(xj, rj);\n rj.vsub(bj.position, rj);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n\n boxBox(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n si.convexPolyhedronRepresentation.material = si.material;\n sj.convexPolyhedronRepresentation.material = sj.material;\n si.convexPolyhedronRepresentation.collisionResponse = si.collisionResponse;\n sj.convexPolyhedronRepresentation.collisionResponse = sj.collisionResponse;\n return this.convexConvex(si.convexPolyhedronRepresentation, sj.convexPolyhedronRepresentation, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n }\n\n sphereBox(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n const v3pool = this.v3pool; // we refer to the box as body j\n\n const sides = sphereBox_sides;\n xi.vsub(xj, box_to_sphere);\n sj.getSideNormals(sides, qj);\n const R = si.radius;\n\n let found = false; // Store the resulting side penetration info\n\n const side_ns = sphereBox_side_ns;\n const side_ns1 = sphereBox_side_ns1;\n const side_ns2 = sphereBox_side_ns2;\n let side_h = null;\n let side_penetrations = 0;\n let side_dot1 = 0;\n let side_dot2 = 0;\n let side_distance = null;\n\n for (let idx = 0, nsides = sides.length; idx !== nsides && found === false; idx++) {\n // Get the plane side normal (ns)\n const ns = sphereBox_ns;\n ns.copy(sides[idx]);\n const h = ns.length();\n ns.normalize(); // The normal/distance dot product tells which side of the plane we are\n\n const dot = box_to_sphere.dot(ns);\n\n if (dot < h + R && dot > 0) {\n // Intersects plane. Now check the other two dimensions\n const ns1 = sphereBox_ns1;\n const ns2 = sphereBox_ns2;\n ns1.copy(sides[(idx + 1) % 3]);\n ns2.copy(sides[(idx + 2) % 3]);\n const h1 = ns1.length();\n const h2 = ns2.length();\n ns1.normalize();\n ns2.normalize();\n const dot1 = box_to_sphere.dot(ns1);\n const dot2 = box_to_sphere.dot(ns2);\n\n if (dot1 < h1 && dot1 > -h1 && dot2 < h2 && dot2 > -h2) {\n const dist = Math.abs(dot - h - R);\n\n if (side_distance === null || dist < side_distance) {\n side_distance = dist;\n side_dot1 = dot1;\n side_dot2 = dot2;\n side_h = h;\n side_ns.copy(ns);\n side_ns1.copy(ns1);\n side_ns2.copy(ns2);\n side_penetrations++;\n\n if (justTest) {\n return true;\n }\n }\n }\n }\n }\n\n if (side_penetrations) {\n found = true;\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n side_ns.scale(-R, r.ri); // Sphere r\n\n r.ni.copy(side_ns);\n r.ni.negate(r.ni); // Normal should be out of sphere\n\n side_ns.scale(side_h, side_ns);\n side_ns1.scale(side_dot1, side_ns1);\n side_ns.vadd(side_ns1, side_ns);\n side_ns2.scale(side_dot2, side_ns2);\n side_ns.vadd(side_ns2, r.rj); // Make relative to bodies\n\n r.ri.vadd(xi, r.ri);\n r.ri.vsub(bi.position, r.ri);\n r.rj.vadd(xj, r.rj);\n r.rj.vsub(bj.position, r.rj);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n } // Check corners\n\n\n let rj = v3pool.get();\n const sphere_to_corner = sphereBox_sphere_to_corner;\n\n for (let j = 0; j !== 2 && !found; j++) {\n for (let k = 0; k !== 2 && !found; k++) {\n for (let l = 0; l !== 2 && !found; l++) {\n rj.set(0, 0, 0);\n\n if (j) {\n rj.vadd(sides[0], rj);\n } else {\n rj.vsub(sides[0], rj);\n }\n\n if (k) {\n rj.vadd(sides[1], rj);\n } else {\n rj.vsub(sides[1], rj);\n }\n\n if (l) {\n rj.vadd(sides[2], rj);\n } else {\n rj.vsub(sides[2], rj);\n } // World position of corner\n\n\n xj.vadd(rj, sphere_to_corner);\n sphere_to_corner.vsub(xi, sphere_to_corner);\n\n if (sphere_to_corner.lengthSquared() < R * R) {\n if (justTest) {\n return true;\n }\n\n found = true;\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n r.ri.copy(sphere_to_corner);\n r.ri.normalize();\n r.ni.copy(r.ri);\n r.ri.scale(R, r.ri);\n r.rj.copy(rj); // Make relative to bodies\n\n r.ri.vadd(xi, r.ri);\n r.ri.vsub(bi.position, r.ri);\n r.rj.vadd(xj, r.rj);\n r.rj.vsub(bj.position, r.rj);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n }\n }\n\n v3pool.release(rj);\n rj = null; // Check edges\n\n const edgeTangent = v3pool.get();\n const edgeCenter = v3pool.get();\n const r = v3pool.get(); // r = edge center to sphere center\n\n const orthogonal = v3pool.get();\n const dist = v3pool.get();\n const Nsides = sides.length;\n\n for (let j = 0; j !== Nsides && !found; j++) {\n for (let k = 0; k !== Nsides && !found; k++) {\n if (j % 3 !== k % 3) {\n // Get edge tangent\n sides[k].cross(sides[j], edgeTangent);\n edgeTangent.normalize();\n sides[j].vadd(sides[k], edgeCenter);\n r.copy(xi);\n r.vsub(edgeCenter, r);\n r.vsub(xj, r);\n const orthonorm = r.dot(edgeTangent); // distance from edge center to sphere center in the tangent direction\n\n edgeTangent.scale(orthonorm, orthogonal); // Vector from edge center to sphere center in the tangent direction\n // Find the third side orthogonal to this one\n\n let l = 0;\n\n while (l === j % 3 || l === k % 3) {\n l++;\n } // vec from edge center to sphere projected to the plane orthogonal to the edge tangent\n\n\n dist.copy(xi);\n dist.vsub(orthogonal, dist);\n dist.vsub(edgeCenter, dist);\n dist.vsub(xj, dist); // Distances in tangent direction and distance in the plane orthogonal to it\n\n const tdist = Math.abs(orthonorm);\n const ndist = dist.length();\n\n if (tdist < sides[l].length() && ndist < R) {\n if (justTest) {\n return true;\n }\n\n found = true;\n const res = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n edgeCenter.vadd(orthogonal, res.rj); // box rj\n\n res.rj.copy(res.rj);\n dist.negate(res.ni);\n res.ni.normalize();\n res.ri.copy(res.rj);\n res.ri.vadd(xj, res.ri);\n res.ri.vsub(xi, res.ri);\n res.ri.normalize();\n res.ri.scale(R, res.ri); // Make relative to bodies\n\n res.ri.vadd(xi, res.ri);\n res.ri.vsub(bi.position, res.ri);\n res.rj.vadd(xj, res.rj);\n res.rj.vsub(bj.position, res.rj);\n this.result.push(res);\n this.createFrictionEquationsFromContact(res, this.frictionResult);\n }\n }\n }\n }\n\n v3pool.release(edgeTangent, edgeCenter, r, orthogonal, dist);\n }\n\n planeBox(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n sj.convexPolyhedronRepresentation.material = sj.material;\n sj.convexPolyhedronRepresentation.collisionResponse = sj.collisionResponse;\n sj.convexPolyhedronRepresentation.id = sj.id;\n return this.planeConvex(si, sj.convexPolyhedronRepresentation, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n }\n\n convexConvex(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest, faceListA, faceListB) {\n const sepAxis = convexConvex_sepAxis;\n\n if (xi.distanceTo(xj) > si.boundingSphereRadius + sj.boundingSphereRadius) {\n return;\n }\n\n if (si.findSeparatingAxis(sj, xi, qi, xj, qj, sepAxis, faceListA, faceListB)) {\n const res = [];\n const q = convexConvex_q;\n si.clipAgainstHull(xi, qi, sj, xj, qj, sepAxis, -100, 100, res);\n let numContacts = 0;\n\n for (let j = 0; j !== res.length; j++) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n const ri = r.ri;\n const rj = r.rj;\n sepAxis.negate(r.ni);\n res[j].normal.negate(q);\n q.scale(res[j].depth, q);\n res[j].point.vadd(q, ri);\n rj.copy(res[j].point); // Contact points are in world coordinates. Transform back to relative\n\n ri.vsub(xi, ri);\n rj.vsub(xj, rj); // Make relative to bodies\n\n ri.vadd(xi, ri);\n ri.vsub(bi.position, ri);\n rj.vadd(xj, rj);\n rj.vsub(bj.position, rj);\n this.result.push(r);\n numContacts++;\n\n if (!this.enableFrictionReduction) {\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n\n if (this.enableFrictionReduction && numContacts) {\n this.createFrictionFromAverage(numContacts);\n }\n }\n }\n\n sphereConvex(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n const v3pool = this.v3pool;\n xi.vsub(xj, convex_to_sphere);\n const normals = sj.faceNormals;\n const faces = sj.faces;\n const verts = sj.vertices;\n const R = si.radius;\n // return;\n // }\n\n let found = false; // Check corners\n\n for (let i = 0; i !== verts.length; i++) {\n const v = verts[i]; // World position of corner\n\n const worldCorner = sphereConvex_worldCorner;\n qj.vmult(v, worldCorner);\n xj.vadd(worldCorner, worldCorner);\n const sphere_to_corner = sphereConvex_sphereToCorner;\n worldCorner.vsub(xi, sphere_to_corner);\n\n if (sphere_to_corner.lengthSquared() < R * R) {\n if (justTest) {\n return true;\n }\n\n found = true;\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n r.ri.copy(sphere_to_corner);\n r.ri.normalize();\n r.ni.copy(r.ri);\n r.ri.scale(R, r.ri);\n worldCorner.vsub(xj, r.rj); // Should be relative to the body.\n\n r.ri.vadd(xi, r.ri);\n r.ri.vsub(bi.position, r.ri); // Should be relative to the body.\n\n r.rj.vadd(xj, r.rj);\n r.rj.vsub(bj.position, r.rj);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n return;\n }\n } // Check side (plane) intersections\n\n\n for (let i = 0, nfaces = faces.length; i !== nfaces && found === false; i++) {\n const normal = normals[i];\n const face = faces[i]; // Get world-transformed normal of the face\n\n const worldNormal = sphereConvex_worldNormal;\n qj.vmult(normal, worldNormal); // Get a world vertex from the face\n\n const worldPoint = sphereConvex_worldPoint;\n qj.vmult(verts[face[0]], worldPoint);\n worldPoint.vadd(xj, worldPoint); // Get a point on the sphere, closest to the face normal\n\n const worldSpherePointClosestToPlane = sphereConvex_worldSpherePointClosestToPlane;\n worldNormal.scale(-R, worldSpherePointClosestToPlane);\n xi.vadd(worldSpherePointClosestToPlane, worldSpherePointClosestToPlane); // Vector from a face point to the closest point on the sphere\n\n const penetrationVec = sphereConvex_penetrationVec;\n worldSpherePointClosestToPlane.vsub(worldPoint, penetrationVec); // The penetration. Negative value means overlap.\n\n const penetration = penetrationVec.dot(worldNormal);\n const worldPointToSphere = sphereConvex_sphereToWorldPoint;\n xi.vsub(worldPoint, worldPointToSphere);\n\n if (penetration < 0 && worldPointToSphere.dot(worldNormal) > 0) {\n // Intersects plane. Now check if the sphere is inside the face polygon\n const faceVerts = []; // Face vertices, in world coords\n\n for (let j = 0, Nverts = face.length; j !== Nverts; j++) {\n const worldVertex = v3pool.get();\n qj.vmult(verts[face[j]], worldVertex);\n xj.vadd(worldVertex, worldVertex);\n faceVerts.push(worldVertex);\n }\n\n if (pointInPolygon(faceVerts, worldNormal, xi)) {\n // Is the sphere center in the face polygon?\n if (justTest) {\n return true;\n }\n\n found = true;\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n worldNormal.scale(-R, r.ri); // Contact offset, from sphere center to contact\n\n worldNormal.negate(r.ni); // Normal pointing out of sphere\n\n const penetrationVec2 = v3pool.get();\n worldNormal.scale(-penetration, penetrationVec2);\n const penetrationSpherePoint = v3pool.get();\n worldNormal.scale(-R, penetrationSpherePoint); //xi.vsub(xj).vadd(penetrationSpherePoint).vadd(penetrationVec2 , r.rj);\n\n xi.vsub(xj, r.rj);\n r.rj.vadd(penetrationSpherePoint, r.rj);\n r.rj.vadd(penetrationVec2, r.rj); // Should be relative to the body.\n\n r.rj.vadd(xj, r.rj);\n r.rj.vsub(bj.position, r.rj); // Should be relative to the body.\n\n r.ri.vadd(xi, r.ri);\n r.ri.vsub(bi.position, r.ri);\n v3pool.release(penetrationVec2);\n v3pool.release(penetrationSpherePoint);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult); // Release world vertices\n\n for (let j = 0, Nfaceverts = faceVerts.length; j !== Nfaceverts; j++) {\n v3pool.release(faceVerts[j]);\n }\n\n return; // We only expect *one* face contact\n } else {\n // Edge?\n for (let j = 0; j !== face.length; j++) {\n // Get two world transformed vertices\n const v1 = v3pool.get();\n const v2 = v3pool.get();\n qj.vmult(verts[face[(j + 1) % face.length]], v1);\n qj.vmult(verts[face[(j + 2) % face.length]], v2);\n xj.vadd(v1, v1);\n xj.vadd(v2, v2); // Construct edge vector\n\n const edge = sphereConvex_edge;\n v2.vsub(v1, edge); // Construct the same vector, but normalized\n\n const edgeUnit = sphereConvex_edgeUnit;\n edge.unit(edgeUnit); // p is xi projected onto the edge\n\n const p = v3pool.get();\n const v1_to_xi = v3pool.get();\n xi.vsub(v1, v1_to_xi);\n const dot = v1_to_xi.dot(edgeUnit);\n edgeUnit.scale(dot, p);\n p.vadd(v1, p); // Compute a vector from p to the center of the sphere\n\n const xi_to_p = v3pool.get();\n p.vsub(xi, xi_to_p); // Collision if the edge-sphere distance is less than the radius\n // AND if p is in between v1 and v2\n\n if (dot > 0 && dot * dot < edge.lengthSquared() && xi_to_p.lengthSquared() < R * R) {\n // Collision if the edge-sphere distance is less than the radius\n // Edge contact!\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n p.vsub(xj, r.rj);\n p.vsub(xi, r.ni);\n r.ni.normalize();\n r.ni.scale(R, r.ri); // Should be relative to the body.\n\n r.rj.vadd(xj, r.rj);\n r.rj.vsub(bj.position, r.rj); // Should be relative to the body.\n\n r.ri.vadd(xi, r.ri);\n r.ri.vsub(bi.position, r.ri);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult); // Release world vertices\n\n for (let j = 0, Nfaceverts = faceVerts.length; j !== Nfaceverts; j++) {\n v3pool.release(faceVerts[j]);\n }\n\n v3pool.release(v1);\n v3pool.release(v2);\n v3pool.release(p);\n v3pool.release(xi_to_p);\n v3pool.release(v1_to_xi);\n return;\n }\n\n v3pool.release(v1);\n v3pool.release(v2);\n v3pool.release(p);\n v3pool.release(xi_to_p);\n v3pool.release(v1_to_xi);\n }\n } // Release world vertices\n\n\n for (let j = 0, Nfaceverts = faceVerts.length; j !== Nfaceverts; j++) {\n v3pool.release(faceVerts[j]);\n }\n }\n }\n }\n\n planeConvex(planeShape, convexShape, planePosition, convexPosition, planeQuat, convexQuat, planeBody, convexBody, si, sj, justTest) {\n // Simply return the points behind the plane.\n const worldVertex = planeConvex_v;\n const worldNormal = planeConvex_normal;\n worldNormal.set(0, 0, 1);\n planeQuat.vmult(worldNormal, worldNormal); // Turn normal according to plane orientation\n\n let numContacts = 0;\n const relpos = planeConvex_relpos;\n\n for (let i = 0; i !== convexShape.vertices.length; i++) {\n // Get world convex vertex\n worldVertex.copy(convexShape.vertices[i]);\n convexQuat.vmult(worldVertex, worldVertex);\n convexPosition.vadd(worldVertex, worldVertex);\n worldVertex.vsub(planePosition, relpos);\n const dot = worldNormal.dot(relpos);\n\n if (dot <= 0.0) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(planeBody, convexBody, planeShape, convexShape, si, sj); // Get vertex position projected on plane\n\n const projected = planeConvex_projected;\n worldNormal.scale(worldNormal.dot(relpos), projected);\n worldVertex.vsub(projected, projected);\n projected.vsub(planePosition, r.ri); // From plane to vertex projected on plane\n\n r.ni.copy(worldNormal); // Contact normal is the plane normal out from plane\n // rj is now just the vector from the convex center to the vertex\n\n worldVertex.vsub(convexPosition, r.rj); // Make it relative to the body\n\n r.ri.vadd(planePosition, r.ri);\n r.ri.vsub(planeBody.position, r.ri);\n r.rj.vadd(convexPosition, r.rj);\n r.rj.vsub(convexBody.position, r.rj);\n this.result.push(r);\n numContacts++;\n\n if (!this.enableFrictionReduction) {\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n }\n\n if (this.enableFrictionReduction && numContacts) {\n this.createFrictionFromAverage(numContacts);\n }\n }\n\n boxConvex(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n si.convexPolyhedronRepresentation.material = si.material;\n si.convexPolyhedronRepresentation.collisionResponse = si.collisionResponse;\n return this.convexConvex(si.convexPolyhedronRepresentation, sj, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n }\n\n sphereHeightfield(sphereShape, hfShape, spherePos, hfPos, sphereQuat, hfQuat, sphereBody, hfBody, rsi, rsj, justTest) {\n const data = hfShape.data;\n const radius = sphereShape.radius;\n const w = hfShape.elementSize;\n const worldPillarOffset = sphereHeightfield_tmp2; // Get sphere position to heightfield local!\n\n const localSpherePos = sphereHeightfield_tmp1;\n Transform.pointToLocalFrame(hfPos, hfQuat, spherePos, localSpherePos); // Get the index of the data points to test against\n\n let iMinX = Math.floor((localSpherePos.x - radius) / w) - 1;\n let iMaxX = Math.ceil((localSpherePos.x + radius) / w) + 1;\n let iMinY = Math.floor((localSpherePos.y - radius) / w) - 1;\n let iMaxY = Math.ceil((localSpherePos.y + radius) / w) + 1; // Bail out if we are out of the terrain\n\n if (iMaxX < 0 || iMaxY < 0 || iMinX > data.length || iMinY > data[0].length) {\n return;\n } // Clamp index to edges\n\n\n if (iMinX < 0) {\n iMinX = 0;\n }\n\n if (iMaxX < 0) {\n iMaxX = 0;\n }\n\n if (iMinY < 0) {\n iMinY = 0;\n }\n\n if (iMaxY < 0) {\n iMaxY = 0;\n }\n\n if (iMinX >= data.length) {\n iMinX = data.length - 1;\n }\n\n if (iMaxX >= data.length) {\n iMaxX = data.length - 1;\n }\n\n if (iMaxY >= data[0].length) {\n iMaxY = data[0].length - 1;\n }\n\n if (iMinY >= data[0].length) {\n iMinY = data[0].length - 1;\n }\n\n const minMax = [];\n hfShape.getRectMinMax(iMinX, iMinY, iMaxX, iMaxY, minMax);\n const min = minMax[0];\n const max = minMax[1]; // Bail out if we can't touch the bounding height box\n\n if (localSpherePos.z - radius > max || localSpherePos.z + radius < min) {\n return;\n }\n\n const result = this.result;\n\n for (let i = iMinX; i < iMaxX; i++) {\n for (let j = iMinY; j < iMaxY; j++) {\n const numContactsBefore = result.length;\n let intersecting = false; // Lower triangle\n\n hfShape.getConvexTrianglePillar(i, j, false);\n Transform.pointToWorldFrame(hfPos, hfQuat, hfShape.pillarOffset, worldPillarOffset);\n\n if (spherePos.distanceTo(worldPillarOffset) < hfShape.pillarConvex.boundingSphereRadius + sphereShape.boundingSphereRadius) {\n intersecting = this.sphereConvex(sphereShape, hfShape.pillarConvex, spherePos, worldPillarOffset, sphereQuat, hfQuat, sphereBody, hfBody, sphereShape, hfShape, justTest);\n }\n\n if (justTest && intersecting) {\n return true;\n } // Upper triangle\n\n\n hfShape.getConvexTrianglePillar(i, j, true);\n Transform.pointToWorldFrame(hfPos, hfQuat, hfShape.pillarOffset, worldPillarOffset);\n\n if (spherePos.distanceTo(worldPillarOffset) < hfShape.pillarConvex.boundingSphereRadius + sphereShape.boundingSphereRadius) {\n intersecting = this.sphereConvex(sphereShape, hfShape.pillarConvex, spherePos, worldPillarOffset, sphereQuat, hfQuat, sphereBody, hfBody, sphereShape, hfShape, justTest);\n }\n\n if (justTest && intersecting) {\n return true;\n }\n\n const numContacts = result.length - numContactsBefore;\n\n if (numContacts > 2) {\n return;\n }\n /*\n // Skip all but 1\n for (let k = 0; k < numContacts - 1; k++) {\n result.pop();\n }\n */\n\n }\n }\n }\n\n boxHeightfield(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n si.convexPolyhedronRepresentation.material = si.material;\n si.convexPolyhedronRepresentation.collisionResponse = si.collisionResponse;\n return this.convexHeightfield(si.convexPolyhedronRepresentation, sj, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n }\n\n convexHeightfield(convexShape, hfShape, convexPos, hfPos, convexQuat, hfQuat, convexBody, hfBody, rsi, rsj, justTest) {\n const data = hfShape.data;\n const w = hfShape.elementSize;\n const radius = convexShape.boundingSphereRadius;\n const worldPillarOffset = convexHeightfield_tmp2;\n const faceList = convexHeightfield_faceList; // Get sphere position to heightfield local!\n\n const localConvexPos = convexHeightfield_tmp1;\n Transform.pointToLocalFrame(hfPos, hfQuat, convexPos, localConvexPos); // Get the index of the data points to test against\n\n let iMinX = Math.floor((localConvexPos.x - radius) / w) - 1;\n let iMaxX = Math.ceil((localConvexPos.x + radius) / w) + 1;\n let iMinY = Math.floor((localConvexPos.y - radius) / w) - 1;\n let iMaxY = Math.ceil((localConvexPos.y + radius) / w) + 1; // Bail out if we are out of the terrain\n\n if (iMaxX < 0 || iMaxY < 0 || iMinX > data.length || iMinY > data[0].length) {\n return;\n } // Clamp index to edges\n\n\n if (iMinX < 0) {\n iMinX = 0;\n }\n\n if (iMaxX < 0) {\n iMaxX = 0;\n }\n\n if (iMinY < 0) {\n iMinY = 0;\n }\n\n if (iMaxY < 0) {\n iMaxY = 0;\n }\n\n if (iMinX >= data.length) {\n iMinX = data.length - 1;\n }\n\n if (iMaxX >= data.length) {\n iMaxX = data.length - 1;\n }\n\n if (iMaxY >= data[0].length) {\n iMaxY = data[0].length - 1;\n }\n\n if (iMinY >= data[0].length) {\n iMinY = data[0].length - 1;\n }\n\n const minMax = [];\n hfShape.getRectMinMax(iMinX, iMinY, iMaxX, iMaxY, minMax);\n const min = minMax[0];\n const max = minMax[1]; // Bail out if we're cant touch the bounding height box\n\n if (localConvexPos.z - radius > max || localConvexPos.z + radius < min) {\n return;\n }\n\n for (let i = iMinX; i < iMaxX; i++) {\n for (let j = iMinY; j < iMaxY; j++) {\n let intersecting = false; // Lower triangle\n\n hfShape.getConvexTrianglePillar(i, j, false);\n Transform.pointToWorldFrame(hfPos, hfQuat, hfShape.pillarOffset, worldPillarOffset);\n\n if (convexPos.distanceTo(worldPillarOffset) < hfShape.pillarConvex.boundingSphereRadius + convexShape.boundingSphereRadius) {\n intersecting = this.convexConvex(convexShape, hfShape.pillarConvex, convexPos, worldPillarOffset, convexQuat, hfQuat, convexBody, hfBody, null, null, justTest, faceList, null);\n }\n\n if (justTest && intersecting) {\n return true;\n } // Upper triangle\n\n\n hfShape.getConvexTrianglePillar(i, j, true);\n Transform.pointToWorldFrame(hfPos, hfQuat, hfShape.pillarOffset, worldPillarOffset);\n\n if (convexPos.distanceTo(worldPillarOffset) < hfShape.pillarConvex.boundingSphereRadius + convexShape.boundingSphereRadius) {\n intersecting = this.convexConvex(convexShape, hfShape.pillarConvex, convexPos, worldPillarOffset, convexQuat, hfQuat, convexBody, hfBody, null, null, justTest, faceList, null);\n }\n\n if (justTest && intersecting) {\n return true;\n }\n }\n }\n }\n\n sphereParticle(sj, si, xj, xi, qj, qi, bj, bi, rsi, rsj, justTest) {\n // The normal is the unit vector from sphere center to particle center\n const normal = particleSphere_normal;\n normal.set(0, 0, 1);\n xi.vsub(xj, normal);\n const lengthSquared = normal.lengthSquared();\n\n if (lengthSquared <= sj.radius * sj.radius) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n normal.normalize();\n r.rj.copy(normal);\n r.rj.scale(sj.radius, r.rj);\n r.ni.copy(normal); // Contact normal\n\n r.ni.negate(r.ni);\n r.ri.set(0, 0, 0); // Center of particle\n\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n\n planeParticle(sj, si, xj, xi, qj, qi, bj, bi, rsi, rsj, justTest) {\n const normal = particlePlane_normal;\n normal.set(0, 0, 1);\n bj.quaternion.vmult(normal, normal); // Turn normal according to plane orientation\n\n const relpos = particlePlane_relpos;\n xi.vsub(bj.position, relpos);\n const dot = normal.dot(relpos);\n\n if (dot <= 0.0) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n r.ni.copy(normal); // Contact normal is the plane normal\n\n r.ni.negate(r.ni);\n r.ri.set(0, 0, 0); // Center of particle\n // Get particle position projected on plane\n\n const projected = particlePlane_projected;\n normal.scale(normal.dot(xi), projected);\n xi.vsub(projected, projected); //projected.vadd(bj.position,projected);\n // rj is now the projected world position minus plane position\n\n r.rj.copy(projected);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n\n boxParticle(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n si.convexPolyhedronRepresentation.material = si.material;\n si.convexPolyhedronRepresentation.collisionResponse = si.collisionResponse;\n return this.convexParticle(si.convexPolyhedronRepresentation, sj, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n }\n\n convexParticle(sj, si, xj, xi, qj, qi, bj, bi, rsi, rsj, justTest) {\n let penetratedFaceIndex = -1;\n const penetratedFaceNormal = convexParticle_penetratedFaceNormal;\n const worldPenetrationVec = convexParticle_worldPenetrationVec;\n let minPenetration = null;\n\n const local = convexParticle_local;\n local.copy(xi);\n local.vsub(xj, local); // Convert position to relative the convex origin\n\n qj.conjugate(cqj);\n cqj.vmult(local, local);\n\n if (sj.pointIsInside(local)) {\n if (sj.worldVerticesNeedsUpdate) {\n sj.computeWorldVertices(xj, qj);\n }\n\n if (sj.worldFaceNormalsNeedsUpdate) {\n sj.computeWorldFaceNormals(qj);\n } // For each world polygon in the polyhedra\n\n\n for (let i = 0, nfaces = sj.faces.length; i !== nfaces; i++) {\n // Construct world face vertices\n const verts = [sj.worldVertices[sj.faces[i][0]]];\n const normal = sj.worldFaceNormals[i]; // Check how much the particle penetrates the polygon plane.\n\n xi.vsub(verts[0], convexParticle_vertexToParticle);\n const penetration = -normal.dot(convexParticle_vertexToParticle);\n\n if (minPenetration === null || Math.abs(penetration) < Math.abs(minPenetration)) {\n if (justTest) {\n return true;\n }\n\n minPenetration = penetration;\n penetratedFaceIndex = i;\n penetratedFaceNormal.copy(normal);\n }\n }\n\n if (penetratedFaceIndex !== -1) {\n // Setup contact\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n penetratedFaceNormal.scale(minPenetration, worldPenetrationVec); // rj is the particle position projected to the face\n\n worldPenetrationVec.vadd(xi, worldPenetrationVec);\n worldPenetrationVec.vsub(xj, worldPenetrationVec);\n r.rj.copy(worldPenetrationVec); //const projectedToFace = xi.vsub(xj).vadd(worldPenetrationVec);\n //projectedToFace.copy(r.rj);\n //qj.vmult(r.rj,r.rj);\n\n penetratedFaceNormal.negate(r.ni); // Contact normal\n\n r.ri.set(0, 0, 0); // Center of particle\n\n const ri = r.ri;\n const rj = r.rj; // Make relative to bodies\n\n ri.vadd(xi, ri);\n ri.vsub(bi.position, ri);\n rj.vadd(xj, rj);\n rj.vsub(bj.position, rj);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n } else {\n console.warn('Point found inside convex, but did not find penetrating face!');\n }\n }\n }\n\n heightfieldCylinder(hfShape, convexShape, hfPos, convexPos, hfQuat, convexQuat, hfBody, convexBody, rsi, rsj, justTest) {\n return this.convexHeightfield(convexShape, hfShape, convexPos, hfPos, convexQuat, hfQuat, convexBody, hfBody, rsi, rsj, justTest);\n }\n\n particleCylinder(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n return this.convexParticle(sj, si, xj, xi, qj, qi, bj, bi, rsi, rsj, justTest);\n }\n\n sphereTrimesh(sphereShape, trimeshShape, spherePos, trimeshPos, sphereQuat, trimeshQuat, sphereBody, trimeshBody, rsi, rsj, justTest) {\n const edgeVertexA = sphereTrimesh_edgeVertexA;\n const edgeVertexB = sphereTrimesh_edgeVertexB;\n const edgeVector = sphereTrimesh_edgeVector;\n const edgeVectorUnit = sphereTrimesh_edgeVectorUnit;\n const localSpherePos = sphereTrimesh_localSpherePos;\n const tmp = sphereTrimesh_tmp;\n const localSphereAABB = sphereTrimesh_localSphereAABB;\n const v2 = sphereTrimesh_v2;\n const relpos = sphereTrimesh_relpos;\n const triangles = sphereTrimesh_triangles; // Convert sphere position to local in the trimesh\n\n Transform.pointToLocalFrame(trimeshPos, trimeshQuat, spherePos, localSpherePos); // Get the aabb of the sphere locally in the trimesh\n\n const sphereRadius = sphereShape.radius;\n localSphereAABB.lowerBound.set(localSpherePos.x - sphereRadius, localSpherePos.y - sphereRadius, localSpherePos.z - sphereRadius);\n localSphereAABB.upperBound.set(localSpherePos.x + sphereRadius, localSpherePos.y + sphereRadius, localSpherePos.z + sphereRadius);\n trimeshShape.getTrianglesInAABB(localSphereAABB, triangles); //for (let i = 0; i < trimeshShape.indices.length / 3; i++) triangles.push(i); // All\n // Vertices\n\n const v = sphereTrimesh_v;\n const radiusSquared = sphereShape.radius * sphereShape.radius;\n\n for (let i = 0; i < triangles.length; i++) {\n for (let j = 0; j < 3; j++) {\n trimeshShape.getVertex(trimeshShape.indices[triangles[i] * 3 + j], v); // Check vertex overlap in sphere\n\n v.vsub(localSpherePos, relpos);\n\n if (relpos.lengthSquared() <= radiusSquared) {\n // Safe up\n v2.copy(v);\n Transform.pointToWorldFrame(trimeshPos, trimeshQuat, v2, v);\n v.vsub(spherePos, relpos);\n\n if (justTest) {\n return true;\n }\n\n let r = this.createContactEquation(sphereBody, trimeshBody, sphereShape, trimeshShape, rsi, rsj);\n r.ni.copy(relpos);\n r.ni.normalize(); // ri is the vector from sphere center to the sphere surface\n\n r.ri.copy(r.ni);\n r.ri.scale(sphereShape.radius, r.ri);\n r.ri.vadd(spherePos, r.ri);\n r.ri.vsub(sphereBody.position, r.ri);\n r.rj.copy(v);\n r.rj.vsub(trimeshBody.position, r.rj); // Store result\n\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n } // Check all edges\n\n\n for (let i = 0; i < triangles.length; i++) {\n for (let j = 0; j < 3; j++) {\n trimeshShape.getVertex(trimeshShape.indices[triangles[i] * 3 + j], edgeVertexA);\n trimeshShape.getVertex(trimeshShape.indices[triangles[i] * 3 + (j + 1) % 3], edgeVertexB);\n edgeVertexB.vsub(edgeVertexA, edgeVector); // Project sphere position to the edge\n\n localSpherePos.vsub(edgeVertexB, tmp);\n const positionAlongEdgeB = tmp.dot(edgeVector);\n localSpherePos.vsub(edgeVertexA, tmp);\n let positionAlongEdgeA = tmp.dot(edgeVector);\n\n if (positionAlongEdgeA > 0 && positionAlongEdgeB < 0) {\n // Now check the orthogonal distance from edge to sphere center\n localSpherePos.vsub(edgeVertexA, tmp);\n edgeVectorUnit.copy(edgeVector);\n edgeVectorUnit.normalize();\n positionAlongEdgeA = tmp.dot(edgeVectorUnit);\n edgeVectorUnit.scale(positionAlongEdgeA, tmp);\n tmp.vadd(edgeVertexA, tmp); // tmp is now the sphere center position projected to the edge, defined locally in the trimesh frame\n\n const dist = tmp.distanceTo(localSpherePos);\n\n if (dist < sphereShape.radius) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(sphereBody, trimeshBody, sphereShape, trimeshShape, rsi, rsj);\n tmp.vsub(localSpherePos, r.ni);\n r.ni.normalize();\n r.ni.scale(sphereShape.radius, r.ri);\n r.ri.vadd(spherePos, r.ri);\n r.ri.vsub(sphereBody.position, r.ri);\n Transform.pointToWorldFrame(trimeshPos, trimeshQuat, tmp, tmp);\n tmp.vsub(trimeshBody.position, r.rj);\n Transform.vectorToWorldFrame(trimeshQuat, r.ni, r.ni);\n Transform.vectorToWorldFrame(trimeshQuat, r.ri, r.ri);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n }\n } // Triangle faces\n\n\n const va = sphereTrimesh_va;\n const vb = sphereTrimesh_vb;\n const vc = sphereTrimesh_vc;\n const normal = sphereTrimesh_normal;\n\n for (let i = 0, N = triangles.length; i !== N; i++) {\n trimeshShape.getTriangleVertices(triangles[i], va, vb, vc);\n trimeshShape.getNormal(triangles[i], normal);\n localSpherePos.vsub(va, tmp);\n let dist = tmp.dot(normal);\n normal.scale(dist, tmp);\n localSpherePos.vsub(tmp, tmp); // tmp is now the sphere position projected to the triangle plane\n\n dist = tmp.distanceTo(localSpherePos);\n\n if (Ray.pointInTriangle(tmp, va, vb, vc) && dist < sphereShape.radius) {\n if (justTest) {\n return true;\n }\n\n let r = this.createContactEquation(sphereBody, trimeshBody, sphereShape, trimeshShape, rsi, rsj);\n tmp.vsub(localSpherePos, r.ni);\n r.ni.normalize();\n r.ni.scale(sphereShape.radius, r.ri);\n r.ri.vadd(spherePos, r.ri);\n r.ri.vsub(sphereBody.position, r.ri);\n Transform.pointToWorldFrame(trimeshPos, trimeshQuat, tmp, tmp);\n tmp.vsub(trimeshBody.position, r.rj);\n Transform.vectorToWorldFrame(trimeshQuat, r.ni, r.ni);\n Transform.vectorToWorldFrame(trimeshQuat, r.ri, r.ri);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n\n triangles.length = 0;\n }\n\n planeTrimesh(planeShape, trimeshShape, planePos, trimeshPos, planeQuat, trimeshQuat, planeBody, trimeshBody, rsi, rsj, justTest) {\n // Make contacts!\n const v = new Vec3();\n const normal = planeTrimesh_normal;\n normal.set(0, 0, 1);\n planeQuat.vmult(normal, normal); // Turn normal according to plane\n\n for (let i = 0; i < trimeshShape.vertices.length / 3; i++) {\n // Get world vertex from trimesh\n trimeshShape.getVertex(i, v); // Safe up\n\n const v2 = new Vec3();\n v2.copy(v);\n Transform.pointToWorldFrame(trimeshPos, trimeshQuat, v2, v); // Check plane side\n\n const relpos = planeTrimesh_relpos;\n v.vsub(planePos, relpos);\n const dot = normal.dot(relpos);\n\n if (dot <= 0.0) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(planeBody, trimeshBody, planeShape, trimeshShape, rsi, rsj);\n r.ni.copy(normal); // Contact normal is the plane normal\n // Get vertex position projected on plane\n\n const projected = planeTrimesh_projected;\n normal.scale(relpos.dot(normal), projected);\n v.vsub(projected, projected); // ri is the projected world position minus plane position\n\n r.ri.copy(projected);\n r.ri.vsub(planeBody.position, r.ri);\n r.rj.copy(v);\n r.rj.vsub(trimeshBody.position, r.rj); // Store result\n\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n } // convexTrimesh(\n // si: ConvexPolyhedron, sj: Trimesh, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion,\n // bi: Body, bj: Body, rsi?: Shape | null, rsj?: Shape | null,\n // faceListA?: number[] | null, faceListB?: number[] | null,\n // ) {\n // const sepAxis = convexConvex_sepAxis;\n // if(xi.distanceTo(xj) > si.boundingSphereRadius + sj.boundingSphereRadius){\n // return;\n // }\n // // Construct a temp hull for each triangle\n // const hullB = new ConvexPolyhedron();\n // hullB.faces = [[0,1,2]];\n // const va = new Vec3();\n // const vb = new Vec3();\n // const vc = new Vec3();\n // hullB.vertices = [\n // va,\n // vb,\n // vc\n // ];\n // for (let i = 0; i < sj.indices.length / 3; i++) {\n // const triangleNormal = new Vec3();\n // sj.getNormal(i, triangleNormal);\n // hullB.faceNormals = [triangleNormal];\n // sj.getTriangleVertices(i, va, vb, vc);\n // let d = si.testSepAxis(triangleNormal, hullB, xi, qi, xj, qj);\n // if(!d){\n // triangleNormal.scale(-1, triangleNormal);\n // d = si.testSepAxis(triangleNormal, hullB, xi, qi, xj, qj);\n // if(!d){\n // continue;\n // }\n // }\n // const res: ConvexPolyhedronContactPoint[] = [];\n // const q = convexConvex_q;\n // si.clipAgainstHull(xi,qi,hullB,xj,qj,triangleNormal,-100,100,res);\n // for(let j = 0; j !== res.length; j++){\n // const r = this.createContactEquation(bi,bj,si,sj,rsi,rsj),\n // ri = r.ri,\n // rj = r.rj;\n // r.ni.copy(triangleNormal);\n // r.ni.negate(r.ni);\n // res[j].normal.negate(q);\n // q.mult(res[j].depth, q);\n // res[j].point.vadd(q, ri);\n // rj.copy(res[j].point);\n // // Contact points are in world coordinates. Transform back to relative\n // ri.vsub(xi,ri);\n // rj.vsub(xj,rj);\n // // Make relative to bodies\n // ri.vadd(xi, ri);\n // ri.vsub(bi.position, ri);\n // rj.vadd(xj, rj);\n // rj.vsub(bj.position, rj);\n // result.push(r);\n // }\n // }\n // }\n\n\n}\nconst averageNormal = new Vec3();\nconst averageContactPointA = new Vec3();\nconst averageContactPointB = new Vec3();\nconst tmpVec1 = new Vec3();\nconst tmpVec2 = new Vec3();\nconst tmpQuat1 = new Quaternion();\nconst tmpQuat2 = new Quaternion();\n\nconst planeTrimesh_normal = new Vec3();\nconst planeTrimesh_relpos = new Vec3();\nconst planeTrimesh_projected = new Vec3();\nconst sphereTrimesh_normal = new Vec3();\nconst sphereTrimesh_relpos = new Vec3();\nnew Vec3();\nconst sphereTrimesh_v = new Vec3();\nconst sphereTrimesh_v2 = new Vec3();\nconst sphereTrimesh_edgeVertexA = new Vec3();\nconst sphereTrimesh_edgeVertexB = new Vec3();\nconst sphereTrimesh_edgeVector = new Vec3();\nconst sphereTrimesh_edgeVectorUnit = new Vec3();\nconst sphereTrimesh_localSpherePos = new Vec3();\nconst sphereTrimesh_tmp = new Vec3();\nconst sphereTrimesh_va = new Vec3();\nconst sphereTrimesh_vb = new Vec3();\nconst sphereTrimesh_vc = new Vec3();\nconst sphereTrimesh_localSphereAABB = new AABB();\nconst sphereTrimesh_triangles = [];\nconst point_on_plane_to_sphere = new Vec3();\nconst plane_to_sphere_ortho = new Vec3(); // See http://bulletphysics.com/Bullet/BulletFull/SphereTriangleDetector_8cpp_source.html\n\nconst pointInPolygon_edge = new Vec3();\nconst pointInPolygon_edge_x_normal = new Vec3();\nconst pointInPolygon_vtp = new Vec3();\n\nfunction pointInPolygon(verts, normal, p) {\n let positiveResult = null;\n const N = verts.length;\n\n for (let i = 0; i !== N; i++) {\n const v = verts[i]; // Get edge to the next vertex\n\n const edge = pointInPolygon_edge;\n verts[(i + 1) % N].vsub(v, edge); // Get cross product between polygon normal and the edge\n\n const edge_x_normal = pointInPolygon_edge_x_normal; //const edge_x_normal = new Vec3();\n\n edge.cross(normal, edge_x_normal); // Get vector between point and current vertex\n\n const vertex_to_p = pointInPolygon_vtp;\n p.vsub(v, vertex_to_p); // This dot product determines which side of the edge the point is\n\n const r = edge_x_normal.dot(vertex_to_p); // If all such dot products have same sign, we are inside the polygon.\n\n if (positiveResult === null || r > 0 && positiveResult === true || r <= 0 && positiveResult === false) {\n if (positiveResult === null) {\n positiveResult = r > 0;\n }\n\n continue;\n } else {\n return false; // Encountered some other sign. Exit.\n }\n } // If we got here, all dot products were of the same sign.\n\n\n return true;\n}\n\nconst box_to_sphere = new Vec3();\nconst sphereBox_ns = new Vec3();\nconst sphereBox_ns1 = new Vec3();\nconst sphereBox_ns2 = new Vec3();\nconst sphereBox_sides = [new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3()];\nconst sphereBox_sphere_to_corner = new Vec3();\nconst sphereBox_side_ns = new Vec3();\nconst sphereBox_side_ns1 = new Vec3();\nconst sphereBox_side_ns2 = new Vec3();\nconst convex_to_sphere = new Vec3();\nconst sphereConvex_edge = new Vec3();\nconst sphereConvex_edgeUnit = new Vec3();\nconst sphereConvex_sphereToCorner = new Vec3();\nconst sphereConvex_worldCorner = new Vec3();\nconst sphereConvex_worldNormal = new Vec3();\nconst sphereConvex_worldPoint = new Vec3();\nconst sphereConvex_worldSpherePointClosestToPlane = new Vec3();\nconst sphereConvex_penetrationVec = new Vec3();\nconst sphereConvex_sphereToWorldPoint = new Vec3();\nnew Vec3();\nnew Vec3();\nconst planeConvex_v = new Vec3();\nconst planeConvex_normal = new Vec3();\nconst planeConvex_relpos = new Vec3();\nconst planeConvex_projected = new Vec3();\nconst convexConvex_sepAxis = new Vec3();\nconst convexConvex_q = new Vec3();\nconst particlePlane_normal = new Vec3();\nconst particlePlane_relpos = new Vec3();\nconst particlePlane_projected = new Vec3();\nconst particleSphere_normal = new Vec3(); // WIP\n\nconst cqj = new Quaternion();\nconst convexParticle_local = new Vec3();\nnew Vec3();\nconst convexParticle_penetratedFaceNormal = new Vec3();\nconst convexParticle_vertexToParticle = new Vec3();\nconst convexParticle_worldPenetrationVec = new Vec3();\nconst convexHeightfield_tmp1 = new Vec3();\nconst convexHeightfield_tmp2 = new Vec3();\nconst convexHeightfield_faceList = [0];\nconst sphereHeightfield_tmp1 = new Vec3();\nconst sphereHeightfield_tmp2 = new Vec3();\n\nclass OverlapKeeper {\n /**\n * @todo Remove useless constructor\n */\n constructor() {\n this.current = [];\n this.previous = [];\n }\n /**\n * getKey\n */\n\n\n getKey(i, j) {\n if (j < i) {\n const temp = j;\n j = i;\n i = temp;\n }\n\n return i << 16 | j;\n }\n /**\n * set\n */\n\n\n set(i, j) {\n // Insertion sort. This way the diff will have linear complexity.\n const key = this.getKey(i, j);\n const current = this.current;\n let index = 0;\n\n while (key > current[index]) {\n index++;\n }\n\n if (key === current[index]) {\n return; // Pair was already added\n }\n\n for (let j = current.length - 1; j >= index; j--) {\n current[j + 1] = current[j];\n }\n\n current[index] = key;\n }\n /**\n * tick\n */\n\n\n tick() {\n const tmp = this.current;\n this.current = this.previous;\n this.previous = tmp;\n this.current.length = 0;\n }\n /**\n * getDiff\n */\n\n\n getDiff(additions, removals) {\n const a = this.current;\n const b = this.previous;\n const al = a.length;\n const bl = b.length;\n let j = 0;\n\n for (let i = 0; i < al; i++) {\n let found = false;\n const keyA = a[i];\n\n while (keyA > b[j]) {\n j++;\n }\n\n found = keyA === b[j];\n\n if (!found) {\n unpackAndPush(additions, keyA);\n }\n }\n\n j = 0;\n\n for (let i = 0; i < bl; i++) {\n let found = false;\n const keyB = b[i];\n\n while (keyB > a[j]) {\n j++;\n }\n\n found = a[j] === keyB;\n\n if (!found) {\n unpackAndPush(removals, keyB);\n }\n }\n }\n\n}\n\nfunction unpackAndPush(array, key) {\n array.push((key & 0xffff0000) >> 16, key & 0x0000ffff);\n}\n\nconst getKey = (i, j) => i < j ? `${i}-${j}` : `${j}-${i}`;\n/**\n * TupleDictionary\n */\n\n\nclass TupleDictionary {\n constructor() {\n this.data = {\n keys: []\n };\n }\n\n /** get */\n get(i, j) {\n const key = getKey(i, j);\n return this.data[key];\n }\n /** set */\n\n\n set(i, j, value) {\n const key = getKey(i, j); // Check if key already exists\n\n if (!this.get(i, j)) {\n this.data.keys.push(key);\n }\n\n this.data[key] = value;\n }\n /** delete */\n\n\n delete(i, j) {\n const key = getKey(i, j);\n const index = this.data.keys.indexOf(key);\n\n if (index !== -1) {\n this.data.keys.splice(index, 1);\n }\n\n delete this.data[key];\n }\n /** reset */\n\n\n reset() {\n const data = this.data;\n const keys = data.keys;\n\n while (keys.length > 0) {\n const key = keys.pop();\n delete data[key];\n }\n }\n\n}\n\n/**\n * The physics world\n */\nclass World extends EventTarget {\n /**\n * Currently / last used timestep. Is set to -1 if not available. This value is updated before each internal step, which means that it is \"fresh\" inside event callbacks.\n */\n\n /**\n * Makes bodies go to sleep when they've been inactive.\n * @default false\n */\n\n /**\n * All the current contacts (instances of ContactEquation) in the world.\n */\n\n /**\n * How often to normalize quaternions. Set to 0 for every step, 1 for every second etc.. A larger value increases performance. If bodies tend to explode, set to a smaller value (zero to be sure nothing can go wrong).\n * @default 0\n */\n\n /**\n * Set to true to use fast quaternion normalization. It is often enough accurate to use.\n * If bodies tend to explode, set to false.\n * @default false\n */\n\n /**\n * The wall-clock time since simulation start.\n */\n\n /**\n * Number of timesteps taken since start.\n */\n\n /**\n * Default and last timestep sizes.\n */\n\n /**\n * The gravity of the world.\n */\n\n /**\n * Gravity to use when approximating the friction max force (mu*mass*gravity).\n * If undefined, global gravity will be used.\n * Use to enable friction in a World with a null gravity vector (no gravity).\n */\n\n /**\n * The broadphase algorithm to use.\n * @default NaiveBroadphase\n */\n\n /**\n * All bodies in this world\n */\n\n /**\n * True if any bodies are not sleeping, false if every body is sleeping.\n */\n\n /**\n * The solver algorithm to use.\n * @default GSSolver\n */\n\n /**\n * collisionMatrix\n */\n\n /**\n * CollisionMatrix from the previous step.\n */\n\n /**\n * All added contactmaterials.\n */\n\n /**\n * Used to look up a ContactMaterial given two instances of Material.\n */\n\n /**\n * The default material of the bodies.\n */\n\n /**\n * This contact material is used if no suitable contactmaterial is found for a contact.\n */\n\n /**\n * Time accumulator for interpolation.\n * @see https://gafferongames.com/game-physics/fix-your-timestep/\n */\n\n /**\n * Dispatched after a body has been added to the world.\n */\n\n /**\n * Dispatched after a body has been removed from the world.\n */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n super();\n this.dt = -1;\n this.allowSleep = !!options.allowSleep;\n this.contacts = [];\n this.frictionEquations = [];\n this.quatNormalizeSkip = options.quatNormalizeSkip !== undefined ? options.quatNormalizeSkip : 0;\n this.quatNormalizeFast = options.quatNormalizeFast !== undefined ? options.quatNormalizeFast : false;\n this.time = 0.0;\n this.stepnumber = 0;\n this.default_dt = 1 / 60;\n this.nextId = 0;\n this.gravity = new Vec3();\n\n if (options.gravity) {\n this.gravity.copy(options.gravity);\n }\n\n if (options.frictionGravity) {\n this.frictionGravity = new Vec3();\n this.frictionGravity.copy(options.frictionGravity);\n }\n\n this.broadphase = options.broadphase !== undefined ? options.broadphase : new NaiveBroadphase();\n this.bodies = [];\n this.hasActiveBodies = false;\n this.solver = options.solver !== undefined ? options.solver : new GSSolver();\n this.constraints = [];\n this.narrowphase = new Narrowphase(this);\n this.collisionMatrix = new ArrayCollisionMatrix();\n this.collisionMatrixPrevious = new ArrayCollisionMatrix();\n this.bodyOverlapKeeper = new OverlapKeeper();\n this.shapeOverlapKeeper = new OverlapKeeper();\n this.contactmaterials = [];\n this.contactMaterialTable = new TupleDictionary();\n this.defaultMaterial = new Material('default');\n this.defaultContactMaterial = new ContactMaterial(this.defaultMaterial, this.defaultMaterial, {\n friction: 0.3,\n restitution: 0.0\n });\n this.doProfiling = false;\n this.profile = {\n solve: 0,\n makeContactConstraints: 0,\n broadphase: 0,\n integrate: 0,\n narrowphase: 0\n };\n this.accumulator = 0;\n this.subsystems = [];\n this.addBodyEvent = {\n type: 'addBody',\n body: null\n };\n this.removeBodyEvent = {\n type: 'removeBody',\n body: null\n };\n this.idToBodyMap = {};\n this.broadphase.setWorld(this);\n }\n /**\n * Get the contact material between materials m1 and m2\n * @return The contact material if it was found.\n */\n\n\n getContactMaterial(m1, m2) {\n return this.contactMaterialTable.get(m1.id, m2.id);\n }\n /**\n * Store old collision state info\n */\n\n\n collisionMatrixTick() {\n const temp = this.collisionMatrixPrevious;\n this.collisionMatrixPrevious = this.collisionMatrix;\n this.collisionMatrix = temp;\n this.collisionMatrix.reset();\n this.bodyOverlapKeeper.tick();\n this.shapeOverlapKeeper.tick();\n }\n /**\n * Add a constraint to the simulation.\n */\n\n\n addConstraint(c) {\n this.constraints.push(c);\n }\n /**\n * Removes a constraint\n */\n\n\n removeConstraint(c) {\n const idx = this.constraints.indexOf(c);\n\n if (idx !== -1) {\n this.constraints.splice(idx, 1);\n }\n }\n /**\n * Raycast test\n * @deprecated Use .raycastAll, .raycastClosest or .raycastAny instead.\n */\n\n\n rayTest(from, to, result) {\n if (result instanceof RaycastResult) {\n // Do raycastClosest\n this.raycastClosest(from, to, {\n skipBackfaces: true\n }, result);\n } else {\n // Do raycastAll\n this.raycastAll(from, to, {\n skipBackfaces: true\n }, result);\n }\n }\n /**\n * Ray cast against all bodies. The provided callback will be executed for each hit with a RaycastResult as single argument.\n * @return True if any body was hit.\n */\n\n\n raycastAll(from, to, options, callback) {\n if (options === void 0) {\n options = {};\n }\n\n options.mode = Ray.ALL;\n options.from = from;\n options.to = to;\n options.callback = callback;\n return tmpRay.intersectWorld(this, options);\n }\n /**\n * Ray cast, and stop at the first result. Note that the order is random - but the method is fast.\n * @return True if any body was hit.\n */\n\n\n raycastAny(from, to, options, result) {\n if (options === void 0) {\n options = {};\n }\n\n options.mode = Ray.ANY;\n options.from = from;\n options.to = to;\n options.result = result;\n return tmpRay.intersectWorld(this, options);\n }\n /**\n * Ray cast, and return information of the closest hit.\n * @return True if any body was hit.\n */\n\n\n raycastClosest(from, to, options, result) {\n if (options === void 0) {\n options = {};\n }\n\n options.mode = Ray.CLOSEST;\n options.from = from;\n options.to = to;\n options.result = result;\n return tmpRay.intersectWorld(this, options);\n }\n /**\n * Add a rigid body to the simulation.\n * @todo If the simulation has not yet started, why recrete and copy arrays for each body? Accumulate in dynamic arrays in this case.\n * @todo Adding an array of bodies should be possible. This would save some loops too\n */\n\n\n addBody(body) {\n if (this.bodies.includes(body)) {\n return;\n }\n\n body.index = this.bodies.length;\n this.bodies.push(body);\n body.world = this;\n body.initPosition.copy(body.position);\n body.initVelocity.copy(body.velocity);\n body.timeLastSleepy = this.time;\n\n if (body instanceof Body) {\n body.initAngularVelocity.copy(body.angularVelocity);\n body.initQuaternion.copy(body.quaternion);\n }\n\n this.collisionMatrix.setNumObjects(this.bodies.length);\n this.addBodyEvent.body = body;\n this.idToBodyMap[body.id] = body;\n this.dispatchEvent(this.addBodyEvent);\n }\n /**\n * Remove a rigid body from the simulation.\n */\n\n\n removeBody(body) {\n body.world = null;\n const n = this.bodies.length - 1;\n const bodies = this.bodies;\n const idx = bodies.indexOf(body);\n\n if (idx !== -1) {\n bodies.splice(idx, 1); // Todo: should use a garbage free method\n // Recompute index\n\n for (let i = 0; i !== bodies.length; i++) {\n bodies[i].index = i;\n }\n\n this.collisionMatrix.setNumObjects(n);\n this.removeBodyEvent.body = body;\n delete this.idToBodyMap[body.id];\n this.dispatchEvent(this.removeBodyEvent);\n }\n }\n\n getBodyById(id) {\n return this.idToBodyMap[id];\n }\n /**\n * @todo Make a faster map\n */\n\n\n getShapeById(id) {\n const bodies = this.bodies;\n\n for (let i = 0; i < bodies.length; i++) {\n const shapes = bodies[i].shapes;\n\n for (let j = 0; j < shapes.length; j++) {\n const shape = shapes[j];\n\n if (shape.id === id) {\n return shape;\n }\n }\n }\n\n return null;\n }\n /**\n * Adds a contact material to the World\n */\n\n\n addContactMaterial(cmat) {\n // Add contact material\n this.contactmaterials.push(cmat); // Add current contact material to the material table\n\n this.contactMaterialTable.set(cmat.materials[0].id, cmat.materials[1].id, cmat);\n }\n /**\n * Removes a contact material from the World.\n */\n\n\n removeContactMaterial(cmat) {\n const idx = this.contactmaterials.indexOf(cmat);\n\n if (idx === -1) {\n return;\n }\n\n this.contactmaterials.splice(idx, 1);\n this.contactMaterialTable.delete(cmat.materials[0].id, cmat.materials[1].id);\n }\n /**\n * Step the simulation forward keeping track of last called time\n * to be able to step the world at a fixed rate, independently of framerate.\n *\n * @param dt The fixed time step size to use (default: 1 / 60).\n * @param maxSubSteps Maximum number of fixed steps to take per function call (default: 10).\n * @see https://gafferongames.com/post/fix_your_timestep/\n * @example\n * // Run the simulation independently of framerate every 1 / 60 ms\n * world.fixedStep()\n */\n\n\n fixedStep(dt, maxSubSteps) {\n if (dt === void 0) {\n dt = 1 / 60;\n }\n\n if (maxSubSteps === void 0) {\n maxSubSteps = 10;\n }\n\n const time = performance.now() / 1000; // seconds\n\n if (!this.lastCallTime) {\n this.step(dt, undefined, maxSubSteps);\n } else {\n const timeSinceLastCalled = time - this.lastCallTime;\n this.step(dt, timeSinceLastCalled, maxSubSteps);\n }\n\n this.lastCallTime = time;\n }\n /**\n * Step the physics world forward in time.\n *\n * There are two modes. The simple mode is fixed timestepping without interpolation. In this case you only use the first argument. The second case uses interpolation. In that you also provide the time since the function was last used, as well as the maximum fixed timesteps to take.\n *\n * @param dt The fixed time step size to use.\n * @param timeSinceLastCalled The time elapsed since the function was last called.\n * @param maxSubSteps Maximum number of fixed steps to take per function call (default: 10).\n * @see https://web.archive.org/web/20180426154531/http://bulletphysics.org/mediawiki-1.5.8/index.php/Stepping_The_World#What_do_the_parameters_to_btDynamicsWorld::stepSimulation_mean.3F\n * @example\n * // fixed timestepping without interpolation\n * world.step(1 / 60)\n */\n\n\n step(dt, timeSinceLastCalled, maxSubSteps) {\n if (maxSubSteps === void 0) {\n maxSubSteps = 10;\n }\n\n if (timeSinceLastCalled === undefined) {\n // Fixed, simple stepping\n this.internalStep(dt); // Increment time\n\n this.time += dt;\n } else {\n this.accumulator += timeSinceLastCalled;\n const t0 = performance.now();\n let substeps = 0;\n\n while (this.accumulator >= dt && substeps < maxSubSteps) {\n // Do fixed steps to catch up\n this.internalStep(dt);\n this.accumulator -= dt;\n substeps++;\n\n if (performance.now() - t0 > dt * 1000) {\n // The framerate is not interactive anymore.\n // We are below the target framerate.\n // Better bail out.\n break;\n }\n } // Remove the excess accumulator, since we may not\n // have had enough substeps available to catch up\n\n\n this.accumulator = this.accumulator % dt;\n const t = this.accumulator / dt;\n\n for (let j = 0; j !== this.bodies.length; j++) {\n const b = this.bodies[j];\n b.previousPosition.lerp(b.position, t, b.interpolatedPosition);\n b.previousQuaternion.slerp(b.quaternion, t, b.interpolatedQuaternion);\n b.previousQuaternion.normalize();\n }\n\n this.time += timeSinceLastCalled;\n }\n }\n\n internalStep(dt) {\n this.dt = dt;\n const contacts = this.contacts;\n const p1 = World_step_p1;\n const p2 = World_step_p2;\n const N = this.bodies.length;\n const bodies = this.bodies;\n const solver = this.solver;\n const gravity = this.gravity;\n const doProfiling = this.doProfiling;\n const profile = this.profile;\n const DYNAMIC = Body.DYNAMIC;\n let profilingStart = -Infinity;\n const constraints = this.constraints;\n const frictionEquationPool = World_step_frictionEquationPool;\n gravity.length();\n const gx = gravity.x;\n const gy = gravity.y;\n const gz = gravity.z;\n let i = 0;\n\n if (doProfiling) {\n profilingStart = performance.now();\n } // Add gravity to all objects\n\n\n for (i = 0; i !== N; i++) {\n const bi = bodies[i];\n\n if (bi.type === DYNAMIC) {\n // Only for dynamic bodies\n const f = bi.force;\n const m = bi.mass;\n f.x += m * gx;\n f.y += m * gy;\n f.z += m * gz;\n }\n } // Update subsystems\n\n\n for (let i = 0, Nsubsystems = this.subsystems.length; i !== Nsubsystems; i++) {\n this.subsystems[i].update();\n } // Collision detection\n\n\n if (doProfiling) {\n profilingStart = performance.now();\n }\n\n p1.length = 0; // Clean up pair arrays from last step\n\n p2.length = 0;\n this.broadphase.collisionPairs(this, p1, p2);\n\n if (doProfiling) {\n profile.broadphase = performance.now() - profilingStart;\n } // Remove constrained pairs with collideConnected == false\n\n\n let Nconstraints = constraints.length;\n\n for (i = 0; i !== Nconstraints; i++) {\n const c = constraints[i];\n\n if (!c.collideConnected) {\n for (let j = p1.length - 1; j >= 0; j -= 1) {\n if (c.bodyA === p1[j] && c.bodyB === p2[j] || c.bodyB === p1[j] && c.bodyA === p2[j]) {\n p1.splice(j, 1);\n p2.splice(j, 1);\n }\n }\n }\n }\n\n this.collisionMatrixTick(); // Generate contacts\n\n if (doProfiling) {\n profilingStart = performance.now();\n }\n\n const oldcontacts = World_step_oldContacts;\n const NoldContacts = contacts.length;\n\n for (i = 0; i !== NoldContacts; i++) {\n oldcontacts.push(contacts[i]);\n }\n\n contacts.length = 0; // Transfer FrictionEquation from current list to the pool for reuse\n\n const NoldFrictionEquations = this.frictionEquations.length;\n\n for (i = 0; i !== NoldFrictionEquations; i++) {\n frictionEquationPool.push(this.frictionEquations[i]);\n }\n\n this.frictionEquations.length = 0;\n this.narrowphase.getContacts(p1, p2, this, contacts, oldcontacts, // To be reused\n this.frictionEquations, frictionEquationPool);\n\n if (doProfiling) {\n profile.narrowphase = performance.now() - profilingStart;\n } // Loop over all collisions\n\n\n if (doProfiling) {\n profilingStart = performance.now();\n } // Add all friction eqs\n\n\n for (i = 0; i < this.frictionEquations.length; i++) {\n solver.addEquation(this.frictionEquations[i]);\n }\n\n const ncontacts = contacts.length;\n\n for (let k = 0; k !== ncontacts; k++) {\n // Current contact\n const c = contacts[k]; // Get current collision indeces\n\n const bi = c.bi;\n const bj = c.bj;\n const si = c.si;\n const sj = c.sj; // Get collision properties\n\n let cm;\n\n if (bi.material && bj.material) {\n cm = this.getContactMaterial(bi.material, bj.material) || this.defaultContactMaterial;\n } else {\n cm = this.defaultContactMaterial;\n } // c.enabled = bi.collisionResponse && bj.collisionResponse && si.collisionResponse && sj.collisionResponse;\n\n\n cm.friction; // c.restitution = cm.restitution;\n // If friction or restitution were specified in the material, use them\n\n if (bi.material && bj.material) {\n if (bi.material.friction >= 0 && bj.material.friction >= 0) {\n bi.material.friction * bj.material.friction;\n }\n\n if (bi.material.restitution >= 0 && bj.material.restitution >= 0) {\n c.restitution = bi.material.restitution * bj.material.restitution;\n }\n } // c.setSpookParams(\n // cm.contactEquationStiffness,\n // cm.contactEquationRelaxation,\n // dt\n // );\n\n\n solver.addEquation(c); // // Add friction constraint equation\n // if(mu > 0){\n // \t// Create 2 tangent equations\n // \tconst mug = mu * gnorm;\n // \tconst reducedMass = (bi.invMass + bj.invMass);\n // \tif(reducedMass > 0){\n // \t\treducedMass = 1/reducedMass;\n // \t}\n // \tconst pool = frictionEquationPool;\n // \tconst c1 = pool.length ? pool.pop() : new FrictionEquation(bi,bj,mug*reducedMass);\n // \tconst c2 = pool.length ? pool.pop() : new FrictionEquation(bi,bj,mug*reducedMass);\n // \tthis.frictionEquations.push(c1, c2);\n // \tc1.bi = c2.bi = bi;\n // \tc1.bj = c2.bj = bj;\n // \tc1.minForce = c2.minForce = -mug*reducedMass;\n // \tc1.maxForce = c2.maxForce = mug*reducedMass;\n // \t// Copy over the relative vectors\n // \tc1.ri.copy(c.ri);\n // \tc1.rj.copy(c.rj);\n // \tc2.ri.copy(c.ri);\n // \tc2.rj.copy(c.rj);\n // \t// Construct tangents\n // \tc.ni.tangents(c1.t, c2.t);\n // // Set spook params\n // c1.setSpookParams(cm.frictionEquationStiffness, cm.frictionEquationRelaxation, dt);\n // c2.setSpookParams(cm.frictionEquationStiffness, cm.frictionEquationRelaxation, dt);\n // c1.enabled = c2.enabled = c.enabled;\n // \t// Add equations to solver\n // \tsolver.addEquation(c1);\n // \tsolver.addEquation(c2);\n // }\n\n if (bi.allowSleep && bi.type === Body.DYNAMIC && bi.sleepState === Body.SLEEPING && bj.sleepState === Body.AWAKE && bj.type !== Body.STATIC) {\n const speedSquaredB = bj.velocity.lengthSquared() + bj.angularVelocity.lengthSquared();\n const speedLimitSquaredB = bj.sleepSpeedLimit ** 2;\n\n if (speedSquaredB >= speedLimitSquaredB * 2) {\n bi.wakeUpAfterNarrowphase = true;\n }\n }\n\n if (bj.allowSleep && bj.type === Body.DYNAMIC && bj.sleepState === Body.SLEEPING && bi.sleepState === Body.AWAKE && bi.type !== Body.STATIC) {\n const speedSquaredA = bi.velocity.lengthSquared() + bi.angularVelocity.lengthSquared();\n const speedLimitSquaredA = bi.sleepSpeedLimit ** 2;\n\n if (speedSquaredA >= speedLimitSquaredA * 2) {\n bj.wakeUpAfterNarrowphase = true;\n }\n } // Now we know that i and j are in contact. Set collision matrix state\n\n\n this.collisionMatrix.set(bi, bj, true);\n\n if (!this.collisionMatrixPrevious.get(bi, bj)) {\n // First contact!\n // We reuse the collideEvent object, otherwise we will end up creating new objects for each new contact, even if there's no event listener attached.\n World_step_collideEvent.body = bj;\n World_step_collideEvent.contact = c;\n bi.dispatchEvent(World_step_collideEvent);\n World_step_collideEvent.body = bi;\n bj.dispatchEvent(World_step_collideEvent);\n }\n\n this.bodyOverlapKeeper.set(bi.id, bj.id);\n this.shapeOverlapKeeper.set(si.id, sj.id);\n }\n\n this.emitContactEvents();\n\n if (doProfiling) {\n profile.makeContactConstraints = performance.now() - profilingStart;\n profilingStart = performance.now();\n } // Wake up bodies\n\n\n for (i = 0; i !== N; i++) {\n const bi = bodies[i];\n\n if (bi.wakeUpAfterNarrowphase) {\n bi.wakeUp();\n bi.wakeUpAfterNarrowphase = false;\n }\n } // Add user-added constraints\n\n\n Nconstraints = constraints.length;\n\n for (i = 0; i !== Nconstraints; i++) {\n const c = constraints[i];\n c.update();\n\n for (let j = 0, Neq = c.equations.length; j !== Neq; j++) {\n const eq = c.equations[j];\n solver.addEquation(eq);\n }\n } // Solve the constrained system\n\n\n solver.solve(dt, this);\n\n if (doProfiling) {\n profile.solve = performance.now() - profilingStart;\n } // Remove all contacts from solver\n\n\n solver.removeAllEquations(); // Apply damping, see http://code.google.com/p/bullet/issues/detail?id=74 for details\n\n const pow = Math.pow;\n\n for (i = 0; i !== N; i++) {\n const bi = bodies[i];\n\n if (bi.type & DYNAMIC) {\n // Only for dynamic bodies\n const ld = pow(1.0 - bi.linearDamping, dt);\n const v = bi.velocity;\n v.scale(ld, v);\n const av = bi.angularVelocity;\n\n if (av) {\n const ad = pow(1.0 - bi.angularDamping, dt);\n av.scale(ad, av);\n }\n }\n }\n\n this.dispatchEvent(World_step_preStepEvent); // Leap frog\n // vnew = v + h*f/m\n // xnew = x + h*vnew\n\n if (doProfiling) {\n profilingStart = performance.now();\n }\n\n const stepnumber = this.stepnumber;\n const quatNormalize = stepnumber % (this.quatNormalizeSkip + 1) === 0;\n const quatNormalizeFast = this.quatNormalizeFast;\n\n for (i = 0; i !== N; i++) {\n bodies[i].integrate(dt, quatNormalize, quatNormalizeFast);\n }\n\n this.clearForces();\n this.broadphase.dirty = true;\n\n if (doProfiling) {\n profile.integrate = performance.now() - profilingStart;\n } // Update step number\n\n\n this.stepnumber += 1;\n this.dispatchEvent(World_step_postStepEvent); // Sleeping update\n\n let hasActiveBodies = true;\n\n if (this.allowSleep) {\n hasActiveBodies = false;\n\n for (i = 0; i !== N; i++) {\n const bi = bodies[i];\n bi.sleepTick(this.time);\n\n if (bi.sleepState !== Body.SLEEPING) {\n hasActiveBodies = true;\n }\n }\n }\n\n this.hasActiveBodies = hasActiveBodies;\n }\n\n emitContactEvents() {\n const hasBeginContact = this.hasAnyEventListener('beginContact');\n const hasEndContact = this.hasAnyEventListener('endContact');\n\n if (hasBeginContact || hasEndContact) {\n this.bodyOverlapKeeper.getDiff(additions, removals);\n }\n\n if (hasBeginContact) {\n for (let i = 0, l = additions.length; i < l; i += 2) {\n beginContactEvent.bodyA = this.getBodyById(additions[i]);\n beginContactEvent.bodyB = this.getBodyById(additions[i + 1]);\n this.dispatchEvent(beginContactEvent);\n }\n\n beginContactEvent.bodyA = beginContactEvent.bodyB = null;\n }\n\n if (hasEndContact) {\n for (let i = 0, l = removals.length; i < l; i += 2) {\n endContactEvent.bodyA = this.getBodyById(removals[i]);\n endContactEvent.bodyB = this.getBodyById(removals[i + 1]);\n this.dispatchEvent(endContactEvent);\n }\n\n endContactEvent.bodyA = endContactEvent.bodyB = null;\n }\n\n additions.length = removals.length = 0;\n const hasBeginShapeContact = this.hasAnyEventListener('beginShapeContact');\n const hasEndShapeContact = this.hasAnyEventListener('endShapeContact');\n\n if (hasBeginShapeContact || hasEndShapeContact) {\n this.shapeOverlapKeeper.getDiff(additions, removals);\n }\n\n if (hasBeginShapeContact) {\n for (let i = 0, l = additions.length; i < l; i += 2) {\n const shapeA = this.getShapeById(additions[i]);\n const shapeB = this.getShapeById(additions[i + 1]);\n beginShapeContactEvent.shapeA = shapeA;\n beginShapeContactEvent.shapeB = shapeB;\n if (shapeA) beginShapeContactEvent.bodyA = shapeA.body;\n if (shapeB) beginShapeContactEvent.bodyB = shapeB.body;\n this.dispatchEvent(beginShapeContactEvent);\n }\n\n beginShapeContactEvent.bodyA = beginShapeContactEvent.bodyB = beginShapeContactEvent.shapeA = beginShapeContactEvent.shapeB = null;\n }\n\n if (hasEndShapeContact) {\n for (let i = 0, l = removals.length; i < l; i += 2) {\n const shapeA = this.getShapeById(removals[i]);\n const shapeB = this.getShapeById(removals[i + 1]);\n endShapeContactEvent.shapeA = shapeA;\n endShapeContactEvent.shapeB = shapeB;\n if (shapeA) endShapeContactEvent.bodyA = shapeA.body;\n if (shapeB) endShapeContactEvent.bodyB = shapeB.body;\n this.dispatchEvent(endShapeContactEvent);\n }\n\n endShapeContactEvent.bodyA = endShapeContactEvent.bodyB = endShapeContactEvent.shapeA = endShapeContactEvent.shapeB = null;\n }\n }\n /**\n * Sets all body forces in the world to zero.\n */\n\n\n clearForces() {\n const bodies = this.bodies;\n const N = bodies.length;\n\n for (let i = 0; i !== N; i++) {\n const b = bodies[i];\n b.force;\n b.torque;\n b.force.set(0, 0, 0);\n b.torque.set(0, 0, 0);\n }\n }\n\n} // Temp stuff\n\nnew AABB();\nconst tmpRay = new Ray(); // performance.now() fallback on Date.now()\n\nconst performance = globalThis.performance || {};\n\nif (!performance.now) {\n let nowOffset = Date.now();\n\n if (performance.timing && performance.timing.navigationStart) {\n nowOffset = performance.timing.navigationStart;\n }\n\n performance.now = () => Date.now() - nowOffset;\n}\n\nnew Vec3(); // Dispatched after the world has stepped forward in time.\n// Reusable event objects to save memory.\n\nconst World_step_postStepEvent = {\n type: 'postStep'\n}; // Dispatched before the world steps forward in time.\n\nconst World_step_preStepEvent = {\n type: 'preStep'\n};\nconst World_step_collideEvent = {\n type: Body.COLLIDE_EVENT_NAME,\n body: null,\n contact: null\n}; // Pools for unused objects\n\nconst World_step_oldContacts = [];\nconst World_step_frictionEquationPool = []; // Reusable arrays for collision pairs\n\nconst World_step_p1 = [];\nconst World_step_p2 = []; // Stuff for emitContactEvents\n\nconst additions = [];\nconst removals = [];\nconst beginContactEvent = {\n type: 'beginContact',\n bodyA: null,\n bodyB: null\n};\nconst endContactEvent = {\n type: 'endContact',\n bodyA: null,\n bodyB: null\n};\nconst beginShapeContactEvent = {\n type: 'beginShapeContact',\n bodyA: null,\n bodyB: null,\n shapeA: null,\n shapeB: null\n};\nconst endShapeContactEvent = {\n type: 'endShapeContact',\n bodyA: null,\n bodyB: null,\n shapeA: null,\n shapeB: null\n};\n\n\n\n\n//# sourceURL=webpack://3d_game/./node_modules/cannon-es/dist/cannon-es.js?")},"./node_modules/three/build/three.module.js":function _node_modules_three_build_threeModuleJs(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__){eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ACESFilmicToneMapping: () => (/* binding */ ACESFilmicToneMapping),\n/* harmony export */ AddEquation: () => (/* binding */ AddEquation),\n/* harmony export */ AddOperation: () => (/* binding */ AddOperation),\n/* harmony export */ AdditiveAnimationBlendMode: () => (/* binding */ AdditiveAnimationBlendMode),\n/* harmony export */ AdditiveBlending: () => (/* binding */ AdditiveBlending),\n/* harmony export */ AgXToneMapping: () => (/* binding */ AgXToneMapping),\n/* harmony export */ AlphaFormat: () => (/* binding */ AlphaFormat),\n/* harmony export */ AlwaysCompare: () => (/* binding */ AlwaysCompare),\n/* harmony export */ AlwaysDepth: () => (/* binding */ AlwaysDepth),\n/* harmony export */ AlwaysStencilFunc: () => (/* binding */ AlwaysStencilFunc),\n/* harmony export */ AmbientLight: () => (/* binding */ AmbientLight),\n/* harmony export */ AnimationAction: () => (/* binding */ AnimationAction),\n/* harmony export */ AnimationClip: () => (/* binding */ AnimationClip),\n/* harmony export */ AnimationLoader: () => (/* binding */ AnimationLoader),\n/* harmony export */ AnimationMixer: () => (/* binding */ AnimationMixer),\n/* harmony export */ AnimationObjectGroup: () => (/* binding */ AnimationObjectGroup),\n/* harmony export */ AnimationUtils: () => (/* binding */ AnimationUtils),\n/* harmony export */ ArcCurve: () => (/* binding */ ArcCurve),\n/* harmony export */ ArrayCamera: () => (/* binding */ ArrayCamera),\n/* harmony export */ ArrowHelper: () => (/* binding */ ArrowHelper),\n/* harmony export */ AttachedBindMode: () => (/* binding */ AttachedBindMode),\n/* harmony export */ Audio: () => (/* binding */ Audio),\n/* harmony export */ AudioAnalyser: () => (/* binding */ AudioAnalyser),\n/* harmony export */ AudioContext: () => (/* binding */ AudioContext),\n/* harmony export */ AudioListener: () => (/* binding */ AudioListener),\n/* harmony export */ AudioLoader: () => (/* binding */ AudioLoader),\n/* harmony export */ AxesHelper: () => (/* binding */ AxesHelper),\n/* harmony export */ BackSide: () => (/* binding */ BackSide),\n/* harmony export */ BasicDepthPacking: () => (/* binding */ BasicDepthPacking),\n/* harmony export */ BasicShadowMap: () => (/* binding */ BasicShadowMap),\n/* harmony export */ BatchedMesh: () => (/* binding */ BatchedMesh),\n/* harmony export */ Bone: () => (/* binding */ Bone),\n/* harmony export */ BooleanKeyframeTrack: () => (/* binding */ BooleanKeyframeTrack),\n/* harmony export */ Box2: () => (/* binding */ Box2),\n/* harmony export */ Box3: () => (/* binding */ Box3),\n/* harmony export */ Box3Helper: () => (/* binding */ Box3Helper),\n/* harmony export */ BoxGeometry: () => (/* binding */ BoxGeometry),\n/* harmony export */ BoxHelper: () => (/* binding */ BoxHelper),\n/* harmony export */ BufferAttribute: () => (/* binding */ BufferAttribute),\n/* harmony export */ BufferGeometry: () => (/* binding */ BufferGeometry),\n/* harmony export */ BufferGeometryLoader: () => (/* binding */ BufferGeometryLoader),\n/* harmony export */ ByteType: () => (/* binding */ ByteType),\n/* harmony export */ Cache: () => (/* binding */ Cache),\n/* harmony export */ Camera: () => (/* binding */ Camera),\n/* harmony export */ CameraHelper: () => (/* binding */ CameraHelper),\n/* harmony export */ CanvasTexture: () => (/* binding */ CanvasTexture),\n/* harmony export */ CapsuleGeometry: () => (/* binding */ CapsuleGeometry),\n/* harmony export */ CatmullRomCurve3: () => (/* binding */ CatmullRomCurve3),\n/* harmony export */ CineonToneMapping: () => (/* binding */ CineonToneMapping),\n/* harmony export */ CircleGeometry: () => (/* binding */ CircleGeometry),\n/* harmony export */ ClampToEdgeWrapping: () => (/* binding */ ClampToEdgeWrapping),\n/* harmony export */ Clock: () => (/* binding */ Clock),\n/* harmony export */ Color: () => (/* binding */ Color),\n/* harmony export */ ColorKeyframeTrack: () => (/* binding */ ColorKeyframeTrack),\n/* harmony export */ ColorManagement: () => (/* binding */ ColorManagement),\n/* harmony export */ CompressedArrayTexture: () => (/* binding */ CompressedArrayTexture),\n/* harmony export */ CompressedCubeTexture: () => (/* binding */ CompressedCubeTexture),\n/* harmony export */ CompressedTexture: () => (/* binding */ CompressedTexture),\n/* harmony export */ CompressedTextureLoader: () => (/* binding */ CompressedTextureLoader),\n/* harmony export */ ConeGeometry: () => (/* binding */ ConeGeometry),\n/* harmony export */ ConstantAlphaFactor: () => (/* binding */ ConstantAlphaFactor),\n/* harmony export */ ConstantColorFactor: () => (/* binding */ ConstantColorFactor),\n/* harmony export */ Controls: () => (/* binding */ Controls),\n/* harmony export */ CubeCamera: () => (/* binding */ CubeCamera),\n/* harmony export */ CubeReflectionMapping: () => (/* binding */ CubeReflectionMapping),\n/* harmony export */ CubeRefractionMapping: () => (/* binding */ CubeRefractionMapping),\n/* harmony export */ CubeTexture: () => (/* binding */ CubeTexture),\n/* harmony export */ CubeTextureLoader: () => (/* binding */ CubeTextureLoader),\n/* harmony export */ CubeUVReflectionMapping: () => (/* binding */ CubeUVReflectionMapping),\n/* harmony export */ CubicBezierCurve: () => (/* binding */ CubicBezierCurve),\n/* harmony export */ CubicBezierCurve3: () => (/* binding */ CubicBezierCurve3),\n/* harmony export */ CubicInterpolant: () => (/* binding */ CubicInterpolant),\n/* harmony export */ CullFaceBack: () => (/* binding */ CullFaceBack),\n/* harmony export */ CullFaceFront: () => (/* binding */ CullFaceFront),\n/* harmony export */ CullFaceFrontBack: () => (/* binding */ CullFaceFrontBack),\n/* harmony export */ CullFaceNone: () => (/* binding */ CullFaceNone),\n/* harmony export */ Curve: () => (/* binding */ Curve),\n/* harmony export */ CurvePath: () => (/* binding */ CurvePath),\n/* harmony export */ CustomBlending: () => (/* binding */ CustomBlending),\n/* harmony export */ CustomToneMapping: () => (/* binding */ CustomToneMapping),\n/* harmony export */ CylinderGeometry: () => (/* binding */ CylinderGeometry),\n/* harmony export */ Cylindrical: () => (/* binding */ Cylindrical),\n/* harmony export */ Data3DTexture: () => (/* binding */ Data3DTexture),\n/* harmony export */ DataArrayTexture: () => (/* binding */ DataArrayTexture),\n/* harmony export */ DataTexture: () => (/* binding */ DataTexture),\n/* harmony export */ DataTextureLoader: () => (/* binding */ DataTextureLoader),\n/* harmony export */ DataUtils: () => (/* binding */ DataUtils),\n/* harmony export */ DecrementStencilOp: () => (/* binding */ DecrementStencilOp),\n/* harmony export */ DecrementWrapStencilOp: () => (/* binding */ DecrementWrapStencilOp),\n/* harmony export */ DefaultLoadingManager: () => (/* binding */ DefaultLoadingManager),\n/* harmony export */ DepthFormat: () => (/* binding */ DepthFormat),\n/* harmony export */ DepthStencilFormat: () => (/* binding */ DepthStencilFormat),\n/* harmony export */ DepthTexture: () => (/* binding */ DepthTexture),\n/* harmony export */ DetachedBindMode: () => (/* binding */ DetachedBindMode),\n/* harmony export */ DirectionalLight: () => (/* binding */ DirectionalLight),\n/* harmony export */ DirectionalLightHelper: () => (/* binding */ DirectionalLightHelper),\n/* harmony export */ DiscreteInterpolant: () => (/* binding */ DiscreteInterpolant),\n/* harmony export */ DisplayP3ColorSpace: () => (/* binding */ DisplayP3ColorSpace),\n/* harmony export */ DodecahedronGeometry: () => (/* binding */ DodecahedronGeometry),\n/* harmony export */ DoubleSide: () => (/* binding */ DoubleSide),\n/* harmony export */ DstAlphaFactor: () => (/* binding */ DstAlphaFactor),\n/* harmony export */ DstColorFactor: () => (/* binding */ DstColorFactor),\n/* harmony export */ DynamicCopyUsage: () => (/* binding */ DynamicCopyUsage),\n/* harmony export */ DynamicDrawUsage: () => (/* binding */ DynamicDrawUsage),\n/* harmony export */ DynamicReadUsage: () => (/* binding */ DynamicReadUsage),\n/* harmony export */ EdgesGeometry: () => (/* binding */ EdgesGeometry),\n/* harmony export */ EllipseCurve: () => (/* binding */ EllipseCurve),\n/* harmony export */ EqualCompare: () => (/* binding */ EqualCompare),\n/* harmony export */ EqualDepth: () => (/* binding */ EqualDepth),\n/* harmony export */ EqualStencilFunc: () => (/* binding */ EqualStencilFunc),\n/* harmony export */ EquirectangularReflectionMapping: () => (/* binding */ EquirectangularReflectionMapping),\n/* harmony export */ EquirectangularRefractionMapping: () => (/* binding */ EquirectangularRefractionMapping),\n/* harmony export */ Euler: () => (/* binding */ Euler),\n/* harmony export */ EventDispatcher: () => (/* binding */ EventDispatcher),\n/* harmony export */ ExtrudeGeometry: () => (/* binding */ ExtrudeGeometry),\n/* harmony export */ FileLoader: () => (/* binding */ FileLoader),\n/* harmony export */ Float16BufferAttribute: () => (/* binding */ Float16BufferAttribute),\n/* harmony export */ Float32BufferAttribute: () => (/* binding */ Float32BufferAttribute),\n/* harmony export */ FloatType: () => (/* binding */ FloatType),\n/* harmony export */ Fog: () => (/* binding */ Fog),\n/* harmony export */ FogExp2: () => (/* binding */ FogExp2),\n/* harmony export */ FramebufferTexture: () => (/* binding */ FramebufferTexture),\n/* harmony export */ FrontSide: () => (/* binding */ FrontSide),\n/* harmony export */ Frustum: () => (/* binding */ Frustum),\n/* harmony export */ GLBufferAttribute: () => (/* binding */ GLBufferAttribute),\n/* harmony export */ GLSL1: () => (/* binding */ GLSL1),\n/* harmony export */ GLSL3: () => (/* binding */ GLSL3),\n/* harmony export */ GreaterCompare: () => (/* binding */ GreaterCompare),\n/* harmony export */ GreaterDepth: () => (/* binding */ GreaterDepth),\n/* harmony export */ GreaterEqualCompare: () => (/* binding */ GreaterEqualCompare),\n/* harmony export */ GreaterEqualDepth: () => (/* binding */ GreaterEqualDepth),\n/* harmony export */ GreaterEqualStencilFunc: () => (/* binding */ GreaterEqualStencilFunc),\n/* harmony export */ GreaterStencilFunc: () => (/* binding */ GreaterStencilFunc),\n/* harmony export */ GridHelper: () => (/* binding */ GridHelper),\n/* harmony export */ Group: () => (/* binding */ Group),\n/* harmony export */ HalfFloatType: () => (/* binding */ HalfFloatType),\n/* harmony export */ HemisphereLight: () => (/* binding */ HemisphereLight),\n/* harmony export */ HemisphereLightHelper: () => (/* binding */ HemisphereLightHelper),\n/* harmony export */ IcosahedronGeometry: () => (/* binding */ IcosahedronGeometry),\n/* harmony export */ ImageBitmapLoader: () => (/* binding */ ImageBitmapLoader),\n/* harmony export */ ImageLoader: () => (/* binding */ ImageLoader),\n/* harmony export */ ImageUtils: () => (/* binding */ ImageUtils),\n/* harmony export */ IncrementStencilOp: () => (/* binding */ IncrementStencilOp),\n/* harmony export */ IncrementWrapStencilOp: () => (/* binding */ IncrementWrapStencilOp),\n/* harmony export */ InstancedBufferAttribute: () => (/* binding */ InstancedBufferAttribute),\n/* harmony export */ InstancedBufferGeometry: () => (/* binding */ InstancedBufferGeometry),\n/* harmony export */ InstancedInterleavedBuffer: () => (/* binding */ InstancedInterleavedBuffer),\n/* harmony export */ InstancedMesh: () => (/* binding */ InstancedMesh),\n/* harmony export */ Int16BufferAttribute: () => (/* binding */ Int16BufferAttribute),\n/* harmony export */ Int32BufferAttribute: () => (/* binding */ Int32BufferAttribute),\n/* harmony export */ Int8BufferAttribute: () => (/* binding */ Int8BufferAttribute),\n/* harmony export */ IntType: () => (/* binding */ IntType),\n/* harmony export */ InterleavedBuffer: () => (/* binding */ InterleavedBuffer),\n/* harmony export */ InterleavedBufferAttribute: () => (/* binding */ InterleavedBufferAttribute),\n/* harmony export */ Interpolant: () => (/* binding */ Interpolant),\n/* harmony export */ InterpolateDiscrete: () => (/* binding */ InterpolateDiscrete),\n/* harmony export */ InterpolateLinear: () => (/* binding */ InterpolateLinear),\n/* harmony export */ InterpolateSmooth: () => (/* binding */ InterpolateSmooth),\n/* harmony export */ InvertStencilOp: () => (/* binding */ InvertStencilOp),\n/* harmony export */ KeepStencilOp: () => (/* binding */ KeepStencilOp),\n/* harmony export */ KeyframeTrack: () => (/* binding */ KeyframeTrack),\n/* harmony export */ LOD: () => (/* binding */ LOD),\n/* harmony export */ LatheGeometry: () => (/* binding */ LatheGeometry),\n/* harmony export */ Layers: () => (/* binding */ Layers),\n/* harmony export */ LessCompare: () => (/* binding */ LessCompare),\n/* harmony export */ LessDepth: () => (/* binding */ LessDepth),\n/* harmony export */ LessEqualCompare: () => (/* binding */ LessEqualCompare),\n/* harmony export */ LessEqualDepth: () => (/* binding */ LessEqualDepth),\n/* harmony export */ LessEqualStencilFunc: () => (/* binding */ LessEqualStencilFunc),\n/* harmony export */ LessStencilFunc: () => (/* binding */ LessStencilFunc),\n/* harmony export */ Light: () => (/* binding */ Light),\n/* harmony export */ LightProbe: () => (/* binding */ LightProbe),\n/* harmony export */ Line: () => (/* binding */ Line),\n/* harmony export */ Line3: () => (/* binding */ Line3),\n/* harmony export */ LineBasicMaterial: () => (/* binding */ LineBasicMaterial),\n/* harmony export */ LineCurve: () => (/* binding */ LineCurve),\n/* harmony export */ LineCurve3: () => (/* binding */ LineCurve3),\n/* harmony export */ LineDashedMaterial: () => (/* binding */ LineDashedMaterial),\n/* harmony export */ LineLoop: () => (/* binding */ LineLoop),\n/* harmony export */ LineSegments: () => (/* binding */ LineSegments),\n/* harmony export */ LinearDisplayP3ColorSpace: () => (/* binding */ LinearDisplayP3ColorSpace),\n/* harmony export */ LinearFilter: () => (/* binding */ LinearFilter),\n/* harmony export */ LinearInterpolant: () => (/* binding */ LinearInterpolant),\n/* harmony export */ LinearMipMapLinearFilter: () => (/* binding */ LinearMipMapLinearFilter),\n/* harmony export */ LinearMipMapNearestFilter: () => (/* binding */ LinearMipMapNearestFilter),\n/* harmony export */ LinearMipmapLinearFilter: () => (/* binding */ LinearMipmapLinearFilter),\n/* harmony export */ LinearMipmapNearestFilter: () => (/* binding */ LinearMipmapNearestFilter),\n/* harmony export */ LinearSRGBColorSpace: () => (/* binding */ LinearSRGBColorSpace),\n/* harmony export */ LinearToneMapping: () => (/* binding */ LinearToneMapping),\n/* harmony export */ LinearTransfer: () => (/* binding */ LinearTransfer),\n/* harmony export */ Loader: () => (/* binding */ Loader),\n/* harmony export */ LoaderUtils: () => (/* binding */ LoaderUtils),\n/* harmony export */ LoadingManager: () => (/* binding */ LoadingManager),\n/* harmony export */ LoopOnce: () => (/* binding */ LoopOnce),\n/* harmony export */ LoopPingPong: () => (/* binding */ LoopPingPong),\n/* harmony export */ LoopRepeat: () => (/* binding */ LoopRepeat),\n/* harmony export */ LuminanceAlphaFormat: () => (/* binding */ LuminanceAlphaFormat),\n/* harmony export */ LuminanceFormat: () => (/* binding */ LuminanceFormat),\n/* harmony export */ MOUSE: () => (/* binding */ MOUSE),\n/* harmony export */ Material: () => (/* binding */ Material),\n/* harmony export */ MaterialLoader: () => (/* binding */ MaterialLoader),\n/* harmony export */ MathUtils: () => (/* binding */ MathUtils),\n/* harmony export */ Matrix2: () => (/* binding */ Matrix2),\n/* harmony export */ Matrix3: () => (/* binding */ Matrix3),\n/* harmony export */ Matrix4: () => (/* binding */ Matrix4),\n/* harmony export */ MaxEquation: () => (/* binding */ MaxEquation),\n/* harmony export */ Mesh: () => (/* binding */ Mesh),\n/* harmony export */ MeshBasicMaterial: () => (/* binding */ MeshBasicMaterial),\n/* harmony export */ MeshDepthMaterial: () => (/* binding */ MeshDepthMaterial),\n/* harmony export */ MeshDistanceMaterial: () => (/* binding */ MeshDistanceMaterial),\n/* harmony export */ MeshLambertMaterial: () => (/* binding */ MeshLambertMaterial),\n/* harmony export */ MeshMatcapMaterial: () => (/* binding */ MeshMatcapMaterial),\n/* harmony export */ MeshNormalMaterial: () => (/* binding */ MeshNormalMaterial),\n/* harmony export */ MeshPhongMaterial: () => (/* binding */ MeshPhongMaterial),\n/* harmony export */ MeshPhysicalMaterial: () => (/* binding */ MeshPhysicalMaterial),\n/* harmony export */ MeshStandardMaterial: () => (/* binding */ MeshStandardMaterial),\n/* harmony export */ MeshToonMaterial: () => (/* binding */ MeshToonMaterial),\n/* harmony export */ MinEquation: () => (/* binding */ MinEquation),\n/* harmony export */ MirroredRepeatWrapping: () => (/* binding */ MirroredRepeatWrapping),\n/* harmony export */ MixOperation: () => (/* binding */ MixOperation),\n/* harmony export */ MultiplyBlending: () => (/* binding */ MultiplyBlending),\n/* harmony export */ MultiplyOperation: () => (/* binding */ MultiplyOperation),\n/* harmony export */ NearestFilter: () => (/* binding */ NearestFilter),\n/* harmony export */ NearestMipMapLinearFilter: () => (/* binding */ NearestMipMapLinearFilter),\n/* harmony export */ NearestMipMapNearestFilter: () => (/* binding */ NearestMipMapNearestFilter),\n/* harmony export */ NearestMipmapLinearFilter: () => (/* binding */ NearestMipmapLinearFilter),\n/* harmony export */ NearestMipmapNearestFilter: () => (/* binding */ NearestMipmapNearestFilter),\n/* harmony export */ NeutralToneMapping: () => (/* binding */ NeutralToneMapping),\n/* harmony export */ NeverCompare: () => (/* binding */ NeverCompare),\n/* harmony export */ NeverDepth: () => (/* binding */ NeverDepth),\n/* harmony export */ NeverStencilFunc: () => (/* binding */ NeverStencilFunc),\n/* harmony export */ NoBlending: () => (/* binding */ NoBlending),\n/* harmony export */ NoColorSpace: () => (/* binding */ NoColorSpace),\n/* harmony export */ NoToneMapping: () => (/* binding */ NoToneMapping),\n/* harmony export */ NormalAnimationBlendMode: () => (/* binding */ NormalAnimationBlendMode),\n/* harmony export */ NormalBlending: () => (/* binding */ NormalBlending),\n/* harmony export */ NotEqualCompare: () => (/* binding */ NotEqualCompare),\n/* harmony export */ NotEqualDepth: () => (/* binding */ NotEqualDepth),\n/* harmony export */ NotEqualStencilFunc: () => (/* binding */ NotEqualStencilFunc),\n/* harmony export */ NumberKeyframeTrack: () => (/* binding */ NumberKeyframeTrack),\n/* harmony export */ Object3D: () => (/* binding */ Object3D),\n/* harmony export */ ObjectLoader: () => (/* binding */ ObjectLoader),\n/* harmony export */ ObjectSpaceNormalMap: () => (/* binding */ ObjectSpaceNormalMap),\n/* harmony export */ OctahedronGeometry: () => (/* binding */ OctahedronGeometry),\n/* harmony export */ OneFactor: () => (/* binding */ OneFactor),\n/* harmony export */ OneMinusConstantAlphaFactor: () => (/* binding */ OneMinusConstantAlphaFactor),\n/* harmony export */ OneMinusConstantColorFactor: () => (/* binding */ OneMinusConstantColorFactor),\n/* harmony export */ OneMinusDstAlphaFactor: () => (/* binding */ OneMinusDstAlphaFactor),\n/* harmony export */ OneMinusDstColorFactor: () => (/* binding */ OneMinusDstColorFactor),\n/* harmony export */ OneMinusSrcAlphaFactor: () => (/* binding */ OneMinusSrcAlphaFactor),\n/* harmony export */ OneMinusSrcColorFactor: () => (/* binding */ OneMinusSrcColorFactor),\n/* harmony export */ OrthographicCamera: () => (/* binding */ OrthographicCamera),\n/* harmony export */ P3Primaries: () => (/* binding */ P3Primaries),\n/* harmony export */ PCFShadowMap: () => (/* binding */ PCFShadowMap),\n/* harmony export */ PCFSoftShadowMap: () => (/* binding */ PCFSoftShadowMap),\n/* harmony export */ PMREMGenerator: () => (/* binding */ PMREMGenerator),\n/* harmony export */ Path: () => (/* binding */ Path),\n/* harmony export */ PerspectiveCamera: () => (/* binding */ PerspectiveCamera),\n/* harmony export */ Plane: () => (/* binding */ Plane),\n/* harmony export */ PlaneGeometry: () => (/* binding */ PlaneGeometry),\n/* harmony export */ PlaneHelper: () => (/* binding */ PlaneHelper),\n/* harmony export */ PointLight: () => (/* binding */ PointLight),\n/* harmony export */ PointLightHelper: () => (/* binding */ PointLightHelper),\n/* harmony export */ Points: () => (/* binding */ Points),\n/* harmony export */ PointsMaterial: () => (/* binding */ PointsMaterial),\n/* harmony export */ PolarGridHelper: () => (/* binding */ PolarGridHelper),\n/* harmony export */ PolyhedronGeometry: () => (/* binding */ PolyhedronGeometry),\n/* harmony export */ PositionalAudio: () => (/* binding */ PositionalAudio),\n/* harmony export */ PropertyBinding: () => (/* binding */ PropertyBinding),\n/* harmony export */ PropertyMixer: () => (/* binding */ PropertyMixer),\n/* harmony export */ QuadraticBezierCurve: () => (/* binding */ QuadraticBezierCurve),\n/* harmony export */ QuadraticBezierCurve3: () => (/* binding */ QuadraticBezierCurve3),\n/* harmony export */ Quaternion: () => (/* binding */ Quaternion),\n/* harmony export */ QuaternionKeyframeTrack: () => (/* binding */ QuaternionKeyframeTrack),\n/* harmony export */ QuaternionLinearInterpolant: () => (/* binding */ QuaternionLinearInterpolant),\n/* harmony export */ RED_GREEN_RGTC2_Format: () => (/* binding */ RED_GREEN_RGTC2_Format),\n/* harmony export */ RED_RGTC1_Format: () => (/* binding */ RED_RGTC1_Format),\n/* harmony export */ REVISION: () => (/* binding */ REVISION),\n/* harmony export */ RGBADepthPacking: () => (/* binding */ RGBADepthPacking),\n/* harmony export */ RGBAFormat: () => (/* binding */ RGBAFormat),\n/* harmony export */ RGBAIntegerFormat: () => (/* binding */ RGBAIntegerFormat),\n/* harmony export */ RGBA_ASTC_10x10_Format: () => (/* binding */ RGBA_ASTC_10x10_Format),\n/* harmony export */ RGBA_ASTC_10x5_Format: () => (/* binding */ RGBA_ASTC_10x5_Format),\n/* harmony export */ RGBA_ASTC_10x6_Format: () => (/* binding */ RGBA_ASTC_10x6_Format),\n/* harmony export */ RGBA_ASTC_10x8_Format: () => (/* binding */ RGBA_ASTC_10x8_Format),\n/* harmony export */ RGBA_ASTC_12x10_Format: () => (/* binding */ RGBA_ASTC_12x10_Format),\n/* harmony export */ RGBA_ASTC_12x12_Format: () => (/* binding */ RGBA_ASTC_12x12_Format),\n/* harmony export */ RGBA_ASTC_4x4_Format: () => (/* binding */ RGBA_ASTC_4x4_Format),\n/* harmony export */ RGBA_ASTC_5x4_Format: () => (/* binding */ RGBA_ASTC_5x4_Format),\n/* harmony export */ RGBA_ASTC_5x5_Format: () => (/* binding */ RGBA_ASTC_5x5_Format),\n/* harmony export */ RGBA_ASTC_6x5_Format: () => (/* binding */ RGBA_ASTC_6x5_Format),\n/* harmony export */ RGBA_ASTC_6x6_Format: () => (/* binding */ RGBA_ASTC_6x6_Format),\n/* harmony export */ RGBA_ASTC_8x5_Format: () => (/* binding */ RGBA_ASTC_8x5_Format),\n/* harmony export */ RGBA_ASTC_8x6_Format: () => (/* binding */ RGBA_ASTC_8x6_Format),\n/* harmony export */ RGBA_ASTC_8x8_Format: () => (/* binding */ RGBA_ASTC_8x8_Format),\n/* harmony export */ RGBA_BPTC_Format: () => (/* binding */ RGBA_BPTC_Format),\n/* harmony export */ RGBA_ETC2_EAC_Format: () => (/* binding */ RGBA_ETC2_EAC_Format),\n/* harmony export */ RGBA_PVRTC_2BPPV1_Format: () => (/* binding */ RGBA_PVRTC_2BPPV1_Format),\n/* harmony export */ RGBA_PVRTC_4BPPV1_Format: () => (/* binding */ RGBA_PVRTC_4BPPV1_Format),\n/* harmony export */ RGBA_S3TC_DXT1_Format: () => (/* binding */ RGBA_S3TC_DXT1_Format),\n/* harmony export */ RGBA_S3TC_DXT3_Format: () => (/* binding */ RGBA_S3TC_DXT3_Format),\n/* harmony export */ RGBA_S3TC_DXT5_Format: () => (/* binding */ RGBA_S3TC_DXT5_Format),\n/* harmony export */ RGBDepthPacking: () => (/* binding */ RGBDepthPacking),\n/* harmony export */ RGBFormat: () => (/* binding */ RGBFormat),\n/* harmony export */ RGBIntegerFormat: () => (/* binding */ RGBIntegerFormat),\n/* harmony export */ RGB_BPTC_SIGNED_Format: () => (/* binding */ RGB_BPTC_SIGNED_Format),\n/* harmony export */ RGB_BPTC_UNSIGNED_Format: () => (/* binding */ RGB_BPTC_UNSIGNED_Format),\n/* harmony export */ RGB_ETC1_Format: () => (/* binding */ RGB_ETC1_Format),\n/* harmony export */ RGB_ETC2_Format: () => (/* binding */ RGB_ETC2_Format),\n/* harmony export */ RGB_PVRTC_2BPPV1_Format: () => (/* binding */ RGB_PVRTC_2BPPV1_Format),\n/* harmony export */ RGB_PVRTC_4BPPV1_Format: () => (/* binding */ RGB_PVRTC_4BPPV1_Format),\n/* harmony export */ RGB_S3TC_DXT1_Format: () => (/* binding */ RGB_S3TC_DXT1_Format),\n/* harmony export */ RGDepthPacking: () => (/* binding */ RGDepthPacking),\n/* harmony export */ RGFormat: () => (/* binding */ RGFormat),\n/* harmony export */ RGIntegerFormat: () => (/* binding */ RGIntegerFormat),\n/* harmony export */ RawShaderMaterial: () => (/* binding */ RawShaderMaterial),\n/* harmony export */ Ray: () => (/* binding */ Ray),\n/* harmony export */ Raycaster: () => (/* binding */ Raycaster),\n/* harmony export */ Rec709Primaries: () => (/* binding */ Rec709Primaries),\n/* harmony export */ RectAreaLight: () => (/* binding */ RectAreaLight),\n/* harmony export */ RedFormat: () => (/* binding */ RedFormat),\n/* harmony export */ RedIntegerFormat: () => (/* binding */ RedIntegerFormat),\n/* harmony export */ ReinhardToneMapping: () => (/* binding */ ReinhardToneMapping),\n/* harmony export */ RenderTarget: () => (/* binding */ RenderTarget),\n/* harmony export */ RepeatWrapping: () => (/* binding */ RepeatWrapping),\n/* harmony export */ ReplaceStencilOp: () => (/* binding */ ReplaceStencilOp),\n/* harmony export */ ReverseSubtractEquation: () => (/* binding */ ReverseSubtractEquation),\n/* harmony export */ RingGeometry: () => (/* binding */ RingGeometry),\n/* harmony export */ SIGNED_RED_GREEN_RGTC2_Format: () => (/* binding */ SIGNED_RED_GREEN_RGTC2_Format),\n/* harmony export */ SIGNED_RED_RGTC1_Format: () => (/* binding */ SIGNED_RED_RGTC1_Format),\n/* harmony export */ SRGBColorSpace: () => (/* binding */ SRGBColorSpace),\n/* harmony export */ SRGBTransfer: () => (/* binding */ SRGBTransfer),\n/* harmony export */ Scene: () => (/* binding */ Scene),\n/* harmony export */ ShaderChunk: () => (/* binding */ ShaderChunk),\n/* harmony export */ ShaderLib: () => (/* binding */ ShaderLib),\n/* harmony export */ ShaderMaterial: () => (/* binding */ ShaderMaterial),\n/* harmony export */ ShadowMaterial: () => (/* binding */ ShadowMaterial),\n/* harmony export */ Shape: () => (/* binding */ Shape),\n/* harmony export */ ShapeGeometry: () => (/* binding */ ShapeGeometry),\n/* harmony export */ ShapePath: () => (/* binding */ ShapePath),\n/* harmony export */ ShapeUtils: () => (/* binding */ ShapeUtils),\n/* harmony export */ ShortType: () => (/* binding */ ShortType),\n/* harmony export */ Skeleton: () => (/* binding */ Skeleton),\n/* harmony export */ SkeletonHelper: () => (/* binding */ SkeletonHelper),\n/* harmony export */ SkinnedMesh: () => (/* binding */ SkinnedMesh),\n/* harmony export */ Source: () => (/* binding */ Source),\n/* harmony export */ Sphere: () => (/* binding */ Sphere),\n/* harmony export */ SphereGeometry: () => (/* binding */ SphereGeometry),\n/* harmony export */ Spherical: () => (/* binding */ Spherical),\n/* harmony export */ SphericalHarmonics3: () => (/* binding */ SphericalHarmonics3),\n/* harmony export */ SplineCurve: () => (/* binding */ SplineCurve),\n/* harmony export */ SpotLight: () => (/* binding */ SpotLight),\n/* harmony export */ SpotLightHelper: () => (/* binding */ SpotLightHelper),\n/* harmony export */ Sprite: () => (/* binding */ Sprite),\n/* harmony export */ SpriteMaterial: () => (/* binding */ SpriteMaterial),\n/* harmony export */ SrcAlphaFactor: () => (/* binding */ SrcAlphaFactor),\n/* harmony export */ SrcAlphaSaturateFactor: () => (/* binding */ SrcAlphaSaturateFactor),\n/* harmony export */ SrcColorFactor: () => (/* binding */ SrcColorFactor),\n/* harmony export */ StaticCopyUsage: () => (/* binding */ StaticCopyUsage),\n/* harmony export */ StaticDrawUsage: () => (/* binding */ StaticDrawUsage),\n/* harmony export */ StaticReadUsage: () => (/* binding */ StaticReadUsage),\n/* harmony export */ StereoCamera: () => (/* binding */ StereoCamera),\n/* harmony export */ StreamCopyUsage: () => (/* binding */ StreamCopyUsage),\n/* harmony export */ StreamDrawUsage: () => (/* binding */ StreamDrawUsage),\n/* harmony export */ StreamReadUsage: () => (/* binding */ StreamReadUsage),\n/* harmony export */ StringKeyframeTrack: () => (/* binding */ StringKeyframeTrack),\n/* harmony export */ SubtractEquation: () => (/* binding */ SubtractEquation),\n/* harmony export */ SubtractiveBlending: () => (/* binding */ SubtractiveBlending),\n/* harmony export */ TOUCH: () => (/* binding */ TOUCH),\n/* harmony export */ TangentSpaceNormalMap: () => (/* binding */ TangentSpaceNormalMap),\n/* harmony export */ TetrahedronGeometry: () => (/* binding */ TetrahedronGeometry),\n/* harmony export */ Texture: () => (/* binding */ Texture),\n/* harmony export */ TextureLoader: () => (/* binding */ TextureLoader),\n/* harmony export */ TextureUtils: () => (/* binding */ TextureUtils),\n/* harmony export */ TorusGeometry: () => (/* binding */ TorusGeometry),\n/* harmony export */ TorusKnotGeometry: () => (/* binding */ TorusKnotGeometry),\n/* harmony export */ Triangle: () => (/* binding */ Triangle),\n/* harmony export */ TriangleFanDrawMode: () => (/* binding */ TriangleFanDrawMode),\n/* harmony export */ TriangleStripDrawMode: () => (/* binding */ TriangleStripDrawMode),\n/* harmony export */ TrianglesDrawMode: () => (/* binding */ TrianglesDrawMode),\n/* harmony export */ TubeGeometry: () => (/* binding */ TubeGeometry),\n/* harmony export */ UVMapping: () => (/* binding */ UVMapping),\n/* harmony export */ Uint16BufferAttribute: () => (/* binding */ Uint16BufferAttribute),\n/* harmony export */ Uint32BufferAttribute: () => (/* binding */ Uint32BufferAttribute),\n/* harmony export */ Uint8BufferAttribute: () => (/* binding */ Uint8BufferAttribute),\n/* harmony export */ Uint8ClampedBufferAttribute: () => (/* binding */ Uint8ClampedBufferAttribute),\n/* harmony export */ Uniform: () => (/* binding */ Uniform),\n/* harmony export */ UniformsGroup: () => (/* binding */ UniformsGroup),\n/* harmony export */ UniformsLib: () => (/* binding */ UniformsLib),\n/* harmony export */ UniformsUtils: () => (/* binding */ UniformsUtils),\n/* harmony export */ UnsignedByteType: () => (/* binding */ UnsignedByteType),\n/* harmony export */ UnsignedInt248Type: () => (/* binding */ UnsignedInt248Type),\n/* harmony export */ UnsignedInt5999Type: () => (/* binding */ UnsignedInt5999Type),\n/* harmony export */ UnsignedIntType: () => (/* binding */ UnsignedIntType),\n/* harmony export */ UnsignedShort4444Type: () => (/* binding */ UnsignedShort4444Type),\n/* harmony export */ UnsignedShort5551Type: () => (/* binding */ UnsignedShort5551Type),\n/* harmony export */ UnsignedShortType: () => (/* binding */ UnsignedShortType),\n/* harmony export */ VSMShadowMap: () => (/* binding */ VSMShadowMap),\n/* harmony export */ Vector2: () => (/* binding */ Vector2),\n/* harmony export */ Vector3: () => (/* binding */ Vector3),\n/* harmony export */ Vector4: () => (/* binding */ Vector4),\n/* harmony export */ VectorKeyframeTrack: () => (/* binding */ VectorKeyframeTrack),\n/* harmony export */ VideoTexture: () => (/* binding */ VideoTexture),\n/* harmony export */ WebGL3DRenderTarget: () => (/* binding */ WebGL3DRenderTarget),\n/* harmony export */ WebGLArrayRenderTarget: () => (/* binding */ WebGLArrayRenderTarget),\n/* harmony export */ WebGLCoordinateSystem: () => (/* binding */ WebGLCoordinateSystem),\n/* harmony export */ WebGLCubeRenderTarget: () => (/* binding */ WebGLCubeRenderTarget),\n/* harmony export */ WebGLMultipleRenderTargets: () => (/* binding */ WebGLMultipleRenderTargets),\n/* harmony export */ WebGLRenderTarget: () => (/* binding */ WebGLRenderTarget),\n/* harmony export */ WebGLRenderer: () => (/* binding */ WebGLRenderer),\n/* harmony export */ WebGLUtils: () => (/* binding */ WebGLUtils),\n/* harmony export */ WebGPUCoordinateSystem: () => (/* binding */ WebGPUCoordinateSystem),\n/* harmony export */ WireframeGeometry: () => (/* binding */ WireframeGeometry),\n/* harmony export */ WrapAroundEnding: () => (/* binding */ WrapAroundEnding),\n/* harmony export */ ZeroCurvatureEnding: () => (/* binding */ ZeroCurvatureEnding),\n/* harmony export */ ZeroFactor: () => (/* binding */ ZeroFactor),\n/* harmony export */ ZeroSlopeEnding: () => (/* binding */ ZeroSlopeEnding),\n/* harmony export */ ZeroStencilOp: () => (/* binding */ ZeroStencilOp),\n/* harmony export */ createCanvasElement: () => (/* binding */ createCanvasElement)\n/* harmony export */ });\n/**\n * @license\n * Copyright 2010-2024 Three.js Authors\n * SPDX-License-Identifier: MIT\n */\nconst REVISION = '168';\n\nconst MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };\nconst TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };\nconst CullFaceNone = 0;\nconst CullFaceBack = 1;\nconst CullFaceFront = 2;\nconst CullFaceFrontBack = 3;\nconst BasicShadowMap = 0;\nconst PCFShadowMap = 1;\nconst PCFSoftShadowMap = 2;\nconst VSMShadowMap = 3;\nconst FrontSide = 0;\nconst BackSide = 1;\nconst DoubleSide = 2;\nconst NoBlending = 0;\nconst NormalBlending = 1;\nconst AdditiveBlending = 2;\nconst SubtractiveBlending = 3;\nconst MultiplyBlending = 4;\nconst CustomBlending = 5;\nconst AddEquation = 100;\nconst SubtractEquation = 101;\nconst ReverseSubtractEquation = 102;\nconst MinEquation = 103;\nconst MaxEquation = 104;\nconst ZeroFactor = 200;\nconst OneFactor = 201;\nconst SrcColorFactor = 202;\nconst OneMinusSrcColorFactor = 203;\nconst SrcAlphaFactor = 204;\nconst OneMinusSrcAlphaFactor = 205;\nconst DstAlphaFactor = 206;\nconst OneMinusDstAlphaFactor = 207;\nconst DstColorFactor = 208;\nconst OneMinusDstColorFactor = 209;\nconst SrcAlphaSaturateFactor = 210;\nconst ConstantColorFactor = 211;\nconst OneMinusConstantColorFactor = 212;\nconst ConstantAlphaFactor = 213;\nconst OneMinusConstantAlphaFactor = 214;\nconst NeverDepth = 0;\nconst AlwaysDepth = 1;\nconst LessDepth = 2;\nconst LessEqualDepth = 3;\nconst EqualDepth = 4;\nconst GreaterEqualDepth = 5;\nconst GreaterDepth = 6;\nconst NotEqualDepth = 7;\nconst MultiplyOperation = 0;\nconst MixOperation = 1;\nconst AddOperation = 2;\nconst NoToneMapping = 0;\nconst LinearToneMapping = 1;\nconst ReinhardToneMapping = 2;\nconst CineonToneMapping = 3;\nconst ACESFilmicToneMapping = 4;\nconst CustomToneMapping = 5;\nconst AgXToneMapping = 6;\nconst NeutralToneMapping = 7;\nconst AttachedBindMode = 'attached';\nconst DetachedBindMode = 'detached';\n\nconst UVMapping = 300;\nconst CubeReflectionMapping = 301;\nconst CubeRefractionMapping = 302;\nconst EquirectangularReflectionMapping = 303;\nconst EquirectangularRefractionMapping = 304;\nconst CubeUVReflectionMapping = 306;\nconst RepeatWrapping = 1000;\nconst ClampToEdgeWrapping = 1001;\nconst MirroredRepeatWrapping = 1002;\nconst NearestFilter = 1003;\nconst NearestMipmapNearestFilter = 1004;\nconst NearestMipMapNearestFilter = 1004;\nconst NearestMipmapLinearFilter = 1005;\nconst NearestMipMapLinearFilter = 1005;\nconst LinearFilter = 1006;\nconst LinearMipmapNearestFilter = 1007;\nconst LinearMipMapNearestFilter = 1007;\nconst LinearMipmapLinearFilter = 1008;\nconst LinearMipMapLinearFilter = 1008;\nconst UnsignedByteType = 1009;\nconst ByteType = 1010;\nconst ShortType = 1011;\nconst UnsignedShortType = 1012;\nconst IntType = 1013;\nconst UnsignedIntType = 1014;\nconst FloatType = 1015;\nconst HalfFloatType = 1016;\nconst UnsignedShort4444Type = 1017;\nconst UnsignedShort5551Type = 1018;\nconst UnsignedInt248Type = 1020;\nconst UnsignedInt5999Type = 35902;\nconst AlphaFormat = 1021;\nconst RGBFormat = 1022;\nconst RGBAFormat = 1023;\nconst LuminanceFormat = 1024;\nconst LuminanceAlphaFormat = 1025;\nconst DepthFormat = 1026;\nconst DepthStencilFormat = 1027;\nconst RedFormat = 1028;\nconst RedIntegerFormat = 1029;\nconst RGFormat = 1030;\nconst RGIntegerFormat = 1031;\nconst RGBIntegerFormat = 1032;\nconst RGBAIntegerFormat = 1033;\n\nconst RGB_S3TC_DXT1_Format = 33776;\nconst RGBA_S3TC_DXT1_Format = 33777;\nconst RGBA_S3TC_DXT3_Format = 33778;\nconst RGBA_S3TC_DXT5_Format = 33779;\nconst RGB_PVRTC_4BPPV1_Format = 35840;\nconst RGB_PVRTC_2BPPV1_Format = 35841;\nconst RGBA_PVRTC_4BPPV1_Format = 35842;\nconst RGBA_PVRTC_2BPPV1_Format = 35843;\nconst RGB_ETC1_Format = 36196;\nconst RGB_ETC2_Format = 37492;\nconst RGBA_ETC2_EAC_Format = 37496;\nconst RGBA_ASTC_4x4_Format = 37808;\nconst RGBA_ASTC_5x4_Format = 37809;\nconst RGBA_ASTC_5x5_Format = 37810;\nconst RGBA_ASTC_6x5_Format = 37811;\nconst RGBA_ASTC_6x6_Format = 37812;\nconst RGBA_ASTC_8x5_Format = 37813;\nconst RGBA_ASTC_8x6_Format = 37814;\nconst RGBA_ASTC_8x8_Format = 37815;\nconst RGBA_ASTC_10x5_Format = 37816;\nconst RGBA_ASTC_10x6_Format = 37817;\nconst RGBA_ASTC_10x8_Format = 37818;\nconst RGBA_ASTC_10x10_Format = 37819;\nconst RGBA_ASTC_12x10_Format = 37820;\nconst RGBA_ASTC_12x12_Format = 37821;\nconst RGBA_BPTC_Format = 36492;\nconst RGB_BPTC_SIGNED_Format = 36494;\nconst RGB_BPTC_UNSIGNED_Format = 36495;\nconst RED_RGTC1_Format = 36283;\nconst SIGNED_RED_RGTC1_Format = 36284;\nconst RED_GREEN_RGTC2_Format = 36285;\nconst SIGNED_RED_GREEN_RGTC2_Format = 36286;\nconst LoopOnce = 2200;\nconst LoopRepeat = 2201;\nconst LoopPingPong = 2202;\nconst InterpolateDiscrete = 2300;\nconst InterpolateLinear = 2301;\nconst InterpolateSmooth = 2302;\nconst ZeroCurvatureEnding = 2400;\nconst ZeroSlopeEnding = 2401;\nconst WrapAroundEnding = 2402;\nconst NormalAnimationBlendMode = 2500;\nconst AdditiveAnimationBlendMode = 2501;\nconst TrianglesDrawMode = 0;\nconst TriangleStripDrawMode = 1;\nconst TriangleFanDrawMode = 2;\nconst BasicDepthPacking = 3200;\nconst RGBADepthPacking = 3201;\nconst RGBDepthPacking = 3202;\nconst RGDepthPacking = 3203;\nconst TangentSpaceNormalMap = 0;\nconst ObjectSpaceNormalMap = 1;\n\n// Color space string identifiers, matching CSS Color Module Level 4 and WebGPU names where available.\nconst NoColorSpace = '';\nconst SRGBColorSpace = 'srgb';\nconst LinearSRGBColorSpace = 'srgb-linear';\nconst DisplayP3ColorSpace = 'display-p3';\nconst LinearDisplayP3ColorSpace = 'display-p3-linear';\n\nconst LinearTransfer = 'linear';\nconst SRGBTransfer = 'srgb';\n\nconst Rec709Primaries = 'rec709';\nconst P3Primaries = 'p3';\n\nconst ZeroStencilOp = 0;\nconst KeepStencilOp = 7680;\nconst ReplaceStencilOp = 7681;\nconst IncrementStencilOp = 7682;\nconst DecrementStencilOp = 7683;\nconst IncrementWrapStencilOp = 34055;\nconst DecrementWrapStencilOp = 34056;\nconst InvertStencilOp = 5386;\n\nconst NeverStencilFunc = 512;\nconst LessStencilFunc = 513;\nconst EqualStencilFunc = 514;\nconst LessEqualStencilFunc = 515;\nconst GreaterStencilFunc = 516;\nconst NotEqualStencilFunc = 517;\nconst GreaterEqualStencilFunc = 518;\nconst AlwaysStencilFunc = 519;\n\nconst NeverCompare = 512;\nconst LessCompare = 513;\nconst EqualCompare = 514;\nconst LessEqualCompare = 515;\nconst GreaterCompare = 516;\nconst NotEqualCompare = 517;\nconst GreaterEqualCompare = 518;\nconst AlwaysCompare = 519;\n\nconst StaticDrawUsage = 35044;\nconst DynamicDrawUsage = 35048;\nconst StreamDrawUsage = 35040;\nconst StaticReadUsage = 35045;\nconst DynamicReadUsage = 35049;\nconst StreamReadUsage = 35041;\nconst StaticCopyUsage = 35046;\nconst DynamicCopyUsage = 35050;\nconst StreamCopyUsage = 35042;\n\nconst GLSL1 = '100';\nconst GLSL3 = '300 es';\n\nconst WebGLCoordinateSystem = 2000;\nconst WebGPUCoordinateSystem = 2001;\n\n/**\n * https://github.com/mrdoob/eventdispatcher.js/\n */\n\nclass EventDispatcher {\n\n\taddEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) this._listeners = {};\n\n\t\tconst listeners = this._listeners;\n\n\t\tif ( listeners[ type ] === undefined ) {\n\n\t\t\tlisteners[ type ] = [];\n\n\t\t}\n\n\t\tif ( listeners[ type ].indexOf( listener ) === - 1 ) {\n\n\t\t\tlisteners[ type ].push( listener );\n\n\t\t}\n\n\t}\n\n\thasEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return false;\n\n\t\tconst listeners = this._listeners;\n\n\t\treturn listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;\n\n\t}\n\n\tremoveEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tconst listeners = this._listeners;\n\t\tconst listenerArray = listeners[ type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tconst index = listenerArray.indexOf( listener );\n\n\t\t\tif ( index !== - 1 ) {\n\n\t\t\t\tlistenerArray.splice( index, 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tdispatchEvent( event ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tconst listeners = this._listeners;\n\t\tconst listenerArray = listeners[ event.type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tevent.target = this;\n\n\t\t\t// Make a copy, in case listeners are removed while iterating.\n\t\t\tconst array = listenerArray.slice( 0 );\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tarray[ i ].call( this, event );\n\n\t\t\t}\n\n\t\t\tevent.target = null;\n\n\t\t}\n\n\t}\n\n}\n\nconst _lut = [ '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0a', '0b', '0c', '0d', '0e', '0f', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '1a', '1b', '1c', '1d', '1e', '1f', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '2a', '2b', '2c', '2d', '2e', '2f', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '3a', '3b', '3c', '3d', '3e', '3f', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '4a', '4b', '4c', '4d', '4e', '4f', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5a', '5b', '5c', '5d', '5e', '5f', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '6a', '6b', '6c', '6d', '6e', '6f', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '7a', '7b', '7c', '7d', '7e', '7f', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '8a', '8b', '8c', '8d', '8e', '8f', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '9a', '9b', '9c', '9d', '9e', '9f', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'aa', 'ab', 'ac', 'ad', 'ae', 'af', 'b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'ba', 'bb', 'bc', 'bd', 'be', 'bf', 'c0', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'ca', 'cb', 'cc', 'cd', 'ce', 'cf', 'd0', 'd1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'da', 'db', 'dc', 'dd', 'de', 'df', 'e0', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'ea', 'eb', 'ec', 'ed', 'ee', 'ef', 'f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'fa', 'fb', 'fc', 'fd', 'fe', 'ff' ];\n\nlet _seed = 1234567;\n\n\nconst DEG2RAD = Math.PI / 180;\nconst RAD2DEG = 180 / Math.PI;\n\n// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136\nfunction generateUUID() {\n\n\tconst d0 = Math.random() * 0xffffffff | 0;\n\tconst d1 = Math.random() * 0xffffffff | 0;\n\tconst d2 = Math.random() * 0xffffffff | 0;\n\tconst d3 = Math.random() * 0xffffffff | 0;\n\tconst uuid = _lut[ d0 & 0xff ] + _lut[ d0 >> 8 & 0xff ] + _lut[ d0 >> 16 & 0xff ] + _lut[ d0 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d1 & 0xff ] + _lut[ d1 >> 8 & 0xff ] + '-' + _lut[ d1 >> 16 & 0x0f | 0x40 ] + _lut[ d1 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d2 & 0x3f | 0x80 ] + _lut[ d2 >> 8 & 0xff ] + '-' + _lut[ d2 >> 16 & 0xff ] + _lut[ d2 >> 24 & 0xff ] +\n\t\t\t_lut[ d3 & 0xff ] + _lut[ d3 >> 8 & 0xff ] + _lut[ d3 >> 16 & 0xff ] + _lut[ d3 >> 24 & 0xff ];\n\n\t// .toLowerCase() here flattens concatenated strings to save heap memory space.\n\treturn uuid.toLowerCase();\n\n}\n\nfunction clamp( value, min, max ) {\n\n\treturn Math.max( min, Math.min( max, value ) );\n\n}\n\n// compute euclidean modulo of m % n\n// https://en.wikipedia.org/wiki/Modulo_operation\nfunction euclideanModulo( n, m ) {\n\n\treturn ( ( n % m ) + m ) % m;\n\n}\n\n// Linear mapping from range to range \nfunction mapLinear( x, a1, a2, b1, b2 ) {\n\n\treturn b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );\n\n}\n\n// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/\nfunction inverseLerp( x, y, value ) {\n\n\tif ( x !== y ) {\n\n\t\treturn ( value - x ) / ( y - x );\n\n\t} else {\n\n\t\treturn 0;\n\n\t}\n\n}\n\n// https://en.wikipedia.org/wiki/Linear_interpolation\nfunction lerp( x, y, t ) {\n\n\treturn ( 1 - t ) * x + t * y;\n\n}\n\n// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/\nfunction damp( x, y, lambda, dt ) {\n\n\treturn lerp( x, y, 1 - Math.exp( - lambda * dt ) );\n\n}\n\n// https://www.desmos.com/calculator/vcsjnyz7x4\nfunction pingpong( x, length = 1 ) {\n\n\treturn length - Math.abs( euclideanModulo( x, length * 2 ) - length );\n\n}\n\n// http://en.wikipedia.org/wiki/Smoothstep\nfunction smoothstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * ( 3 - 2 * x );\n\n}\n\nfunction smootherstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * x * ( x * ( x * 6 - 15 ) + 10 );\n\n}\n\n// Random integer from interval\nfunction randInt( low, high ) {\n\n\treturn low + Math.floor( Math.random() * ( high - low + 1 ) );\n\n}\n\n// Random float from interval\nfunction randFloat( low, high ) {\n\n\treturn low + Math.random() * ( high - low );\n\n}\n\n// Random float from <-range/2, range/2> interval\nfunction randFloatSpread( range ) {\n\n\treturn range * ( 0.5 - Math.random() );\n\n}\n\n// Deterministic pseudo-random float in the interval [ 0, 1 ]\nfunction seededRandom( s ) {\n\n\tif ( s !== undefined ) _seed = s;\n\n\t// Mulberry32 generator\n\n\tlet t = _seed += 0x6D2B79F5;\n\n\tt = Math.imul( t ^ t >>> 15, t | 1 );\n\n\tt ^= t + Math.imul( t ^ t >>> 7, t | 61 );\n\n\treturn ( ( t ^ t >>> 14 ) >>> 0 ) / 4294967296;\n\n}\n\nfunction degToRad( degrees ) {\n\n\treturn degrees * DEG2RAD;\n\n}\n\nfunction radToDeg( radians ) {\n\n\treturn radians * RAD2DEG;\n\n}\n\nfunction isPowerOfTwo( value ) {\n\n\treturn ( value & ( value - 1 ) ) === 0 && value !== 0;\n\n}\n\nfunction ceilPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.ceil( Math.log( value ) / Math.LN2 ) );\n\n}\n\nfunction floorPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.floor( Math.log( value ) / Math.LN2 ) );\n\n}\n\nfunction setQuaternionFromProperEuler( q, a, b, c, order ) {\n\n\t// Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles\n\n\t// rotations are applied to the axes in the order specified by 'order'\n\t// rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'\n\t// angles are in radians\n\n\tconst cos = Math.cos;\n\tconst sin = Math.sin;\n\n\tconst c2 = cos( b / 2 );\n\tconst s2 = sin( b / 2 );\n\n\tconst c13 = cos( ( a + c ) / 2 );\n\tconst s13 = sin( ( a + c ) / 2 );\n\n\tconst c1_3 = cos( ( a - c ) / 2 );\n\tconst s1_3 = sin( ( a - c ) / 2 );\n\n\tconst c3_1 = cos( ( c - a ) / 2 );\n\tconst s3_1 = sin( ( c - a ) / 2 );\n\n\tswitch ( order ) {\n\n\t\tcase 'XYX':\n\t\t\tq.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YZY':\n\t\t\tq.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZXZ':\n\t\t\tq.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'XZX':\n\t\t\tq.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YXY':\n\t\t\tq.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZYZ':\n\t\t\tq.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order );\n\n\t}\n\n}\n\nfunction denormalize( value, array ) {\n\n\tswitch ( array.constructor ) {\n\n\t\tcase Float32Array:\n\n\t\t\treturn value;\n\n\t\tcase Uint32Array:\n\n\t\t\treturn value / 4294967295.0;\n\n\t\tcase Uint16Array:\n\n\t\t\treturn value / 65535.0;\n\n\t\tcase Uint8Array:\n\n\t\t\treturn value / 255.0;\n\n\t\tcase Int32Array:\n\n\t\t\treturn Math.max( value / 2147483647.0, - 1.0 );\n\n\t\tcase Int16Array:\n\n\t\t\treturn Math.max( value / 32767.0, - 1.0 );\n\n\t\tcase Int8Array:\n\n\t\t\treturn Math.max( value / 127.0, - 1.0 );\n\n\t\tdefault:\n\n\t\t\tthrow new Error( 'Invalid component type.' );\n\n\t}\n\n}\n\nfunction normalize( value, array ) {\n\n\tswitch ( array.constructor ) {\n\n\t\tcase Float32Array:\n\n\t\t\treturn value;\n\n\t\tcase Uint32Array:\n\n\t\t\treturn Math.round( value * 4294967295.0 );\n\n\t\tcase Uint16Array:\n\n\t\t\treturn Math.round( value * 65535.0 );\n\n\t\tcase Uint8Array:\n\n\t\t\treturn Math.round( value * 255.0 );\n\n\t\tcase Int32Array:\n\n\t\t\treturn Math.round( value * 2147483647.0 );\n\n\t\tcase Int16Array:\n\n\t\t\treturn Math.round( value * 32767.0 );\n\n\t\tcase Int8Array:\n\n\t\t\treturn Math.round( value * 127.0 );\n\n\t\tdefault:\n\n\t\t\tthrow new Error( 'Invalid component type.' );\n\n\t}\n\n}\n\nconst MathUtils = {\n\tDEG2RAD: DEG2RAD,\n\tRAD2DEG: RAD2DEG,\n\tgenerateUUID: generateUUID,\n\tclamp: clamp,\n\teuclideanModulo: euclideanModulo,\n\tmapLinear: mapLinear,\n\tinverseLerp: inverseLerp,\n\tlerp: lerp,\n\tdamp: damp,\n\tpingpong: pingpong,\n\tsmoothstep: smoothstep,\n\tsmootherstep: smootherstep,\n\trandInt: randInt,\n\trandFloat: randFloat,\n\trandFloatSpread: randFloatSpread,\n\tseededRandom: seededRandom,\n\tdegToRad: degToRad,\n\tradToDeg: radToDeg,\n\tisPowerOfTwo: isPowerOfTwo,\n\tceilPowerOfTwo: ceilPowerOfTwo,\n\tfloorPowerOfTwo: floorPowerOfTwo,\n\tsetQuaternionFromProperEuler: setQuaternionFromProperEuler,\n\tnormalize: normalize,\n\tdenormalize: denormalize\n};\n\nclass Vector2 {\n\n\tconstructor( x = 0, y = 0 ) {\n\n\t\tVector2.prototype.isVector2 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t}\n\n\tget width() {\n\n\t\treturn this.x;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.x = value;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.y;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.y = value;\n\n\t}\n\n\tset( x, y ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ];\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ];\n\n\t\treturn this;\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y;\n\n\t}\n\n\tcross( v ) {\n\n\t\treturn this.x * v.y - this.y * v.x;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tangle() {\n\n\t\t// computes the angle in radians with respect to the positive x-axis\n\n\t\tconst angle = Math.atan2( - this.y, - this.x ) + Math.PI;\n\n\t\treturn angle;\n\n\t}\n\n\tangleTo( v ) {\n\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tconst theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( clamp( theta, - 1, 1 ) );\n\n\t}\n\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y;\n\t\treturn dx * dx + dy * dy;\n\n\t}\n\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\n\t\treturn this;\n\n\t}\n\n\trotateAround( center, angle ) {\n\n\t\tconst c = Math.cos( angle ), s = Math.sin( angle );\n\n\t\tconst x = this.x - center.x;\n\t\tconst y = this.y - center.y;\n\n\t\tthis.x = x * c - y * s + center.x;\n\t\tthis.y = x * s + y * c + center.y;\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\n\t}\n\n}\n\nclass Matrix3 {\n\n\tconstructor( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\tMatrix3.prototype.isMatrix3 = true;\n\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n13, n21, n22, n23, n31, n32, n33 );\n\n\t\t}\n\n\t}\n\n\tset( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 1 ] = n21; te[ 2 ] = n31;\n\t\tte[ 3 ] = n12; te[ 4 ] = n22; te[ 5 ] = n32;\n\t\tte[ 6 ] = n13; te[ 7 ] = n23; te[ 8 ] = n33;\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ];\n\t\tte[ 3 ] = me[ 3 ]; te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ];\n\t\tte[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ]; te[ 8 ] = me[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrix3Column( this, 0 );\n\t\tyAxis.setFromMatrix3Column( this, 1 );\n\t\tzAxis.setFromMatrix3Column( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrix4( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 4 ], me[ 8 ],\n\t\t\tme[ 1 ], me[ 5 ], me[ 9 ],\n\t\t\tme[ 2 ], me[ 6 ], me[ 10 ]\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 3 ], a13 = ae[ 6 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 4 ], a23 = ae[ 7 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 5 ], a33 = ae[ 8 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 3 ], b13 = be[ 6 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 4 ], b23 = be[ 7 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 5 ], b33 = be[ 8 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31;\n\t\tte[ 3 ] = a11 * b12 + a12 * b22 + a13 * b32;\n\t\tte[ 6 ] = a11 * b13 + a12 * b23 + a13 * b33;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31;\n\t\tte[ 4 ] = a21 * b12 + a22 * b22 + a23 * b32;\n\t\tte[ 7 ] = a21 * b13 + a22 * b23 + a23 * b33;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31;\n\t\tte[ 5 ] = a31 * b12 + a32 * b22 + a33 * b32;\n\t\tte[ 8 ] = a31 * b13 + a32 * b23 + a33 * b33;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s;\n\t\tte[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s;\n\t\tte[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst a = te[ 0 ], b = te[ 1 ], c = te[ 2 ],\n\t\t\td = te[ 3 ], e = te[ 4 ], f = te[ 5 ],\n\t\t\tg = te[ 6 ], h = te[ 7 ], i = te[ 8 ];\n\n\t\treturn a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;\n\n\t}\n\n\tinvert() {\n\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ],\n\t\t\tn12 = te[ 3 ], n22 = te[ 4 ], n32 = te[ 5 ],\n\t\t\tn13 = te[ 6 ], n23 = te[ 7 ], n33 = te[ 8 ],\n\n\t\t\tt11 = n33 * n22 - n32 * n23,\n\t\t\tt12 = n32 * n13 - n33 * n12,\n\t\t\tt13 = n23 * n12 - n22 * n13,\n\n\t\t\tdet = n11 * t11 + n21 * t12 + n31 * t13;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n31 * n23 - n33 * n21 ) * detInv;\n\t\tte[ 2 ] = ( n32 * n21 - n31 * n22 ) * detInv;\n\n\t\tte[ 3 ] = t12 * detInv;\n\t\tte[ 4 ] = ( n33 * n11 - n31 * n13 ) * detInv;\n\t\tte[ 5 ] = ( n31 * n12 - n32 * n11 ) * detInv;\n\n\t\tte[ 6 ] = t13 * detInv;\n\t\tte[ 7 ] = ( n21 * n13 - n23 * n11 ) * detInv;\n\t\tte[ 8 ] = ( n22 * n11 - n21 * n12 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\ttranspose() {\n\n\t\tlet tmp;\n\t\tconst m = this.elements;\n\n\t\ttmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp;\n\t\ttmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp;\n\t\ttmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\tgetNormalMatrix( matrix4 ) {\n\n\t\treturn this.setFromMatrix4( matrix4 ).invert().transpose();\n\n\t}\n\n\ttransposeIntoArray( r ) {\n\n\t\tconst m = this.elements;\n\n\t\tr[ 0 ] = m[ 0 ];\n\t\tr[ 1 ] = m[ 3 ];\n\t\tr[ 2 ] = m[ 6 ];\n\t\tr[ 3 ] = m[ 1 ];\n\t\tr[ 4 ] = m[ 4 ];\n\t\tr[ 5 ] = m[ 7 ];\n\t\tr[ 6 ] = m[ 2 ];\n\t\tr[ 7 ] = m[ 5 ];\n\t\tr[ 8 ] = m[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetUvTransform( tx, ty, sx, sy, rotation, cx, cy ) {\n\n\t\tconst c = Math.cos( rotation );\n\t\tconst s = Math.sin( rotation );\n\n\t\tthis.set(\n\t\t\tsx * c, sx * s, - sx * ( c * cx + s * cy ) + cx + tx,\n\t\t\t- sy * s, sy * c, - sy * ( - s * cx + c * cy ) + cy + ty,\n\t\t\t0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t//\n\n\tscale( sx, sy ) {\n\n\t\tthis.premultiply( _m3.makeScale( sx, sy ) );\n\n\t\treturn this;\n\n\t}\n\n\trotate( theta ) {\n\n\t\tthis.premultiply( _m3.makeRotation( - theta ) );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( tx, ty ) {\n\n\t\tthis.premultiply( _m3.makeTranslation( tx, ty ) );\n\n\t\treturn this;\n\n\t}\n\n\t// for 2D Transforms\n\n\tmakeTranslation( x, y ) {\n\n\t\tif ( x.isVector2 ) {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, x.x,\n\t\t\t\t0, 1, x.y,\n\t\t\t\t0, 0, 1\n\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, x,\n\t\t\t\t0, 1, y,\n\t\t\t\t0, 0, 1\n\n\t\t\t);\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotation( theta ) {\n\n\t\t// counterclockwise\n\n\t\tconst c = Math.cos( theta );\n\t\tconst s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0,\n\t\t\ts, c, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeScale( x, y ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0,\n\t\t\t0, y, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t//\n\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\n\t\treturn array;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().fromArray( this.elements );\n\n\t}\n\n}\n\nconst _m3 = /*@__PURE__*/ new Matrix3();\n\nfunction arrayNeedsUint32( array ) {\n\n\t// assumes larger values usually on last\n\n\tfor ( let i = array.length - 1; i >= 0; -- i ) {\n\n\t\tif ( array[ i ] >= 65535 ) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565\n\n\t}\n\n\treturn false;\n\n}\n\nconst TYPED_ARRAYS = {\n\tInt8Array: Int8Array,\n\tUint8Array: Uint8Array,\n\tUint8ClampedArray: Uint8ClampedArray,\n\tInt16Array: Int16Array,\n\tUint16Array: Uint16Array,\n\tInt32Array: Int32Array,\n\tUint32Array: Uint32Array,\n\tFloat32Array: Float32Array,\n\tFloat64Array: Float64Array\n};\n\nfunction getTypedArray( type, buffer ) {\n\n\treturn new TYPED_ARRAYS[ type ]( buffer );\n\n}\n\nfunction createElementNS( name ) {\n\n\treturn document.createElementNS( 'http://www.w3.org/1999/xhtml', name );\n\n}\n\nfunction createCanvasElement() {\n\n\tconst canvas = createElementNS( 'canvas' );\n\tcanvas.style.display = 'block';\n\treturn canvas;\n\n}\n\nconst _cache = {};\n\nfunction warnOnce( message ) {\n\n\tif ( message in _cache ) return;\n\n\t_cache[ message ] = true;\n\n\tconsole.warn( message );\n\n}\n\nfunction probeAsync( gl, sync, interval ) {\n\n\treturn new Promise( function ( resolve, reject ) {\n\n\t\tfunction probe() {\n\n\t\t\tswitch ( gl.clientWaitSync( sync, gl.SYNC_FLUSH_COMMANDS_BIT, 0 ) ) {\n\n\t\t\t\tcase gl.WAIT_FAILED:\n\t\t\t\t\treject();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase gl.TIMEOUT_EXPIRED:\n\t\t\t\t\tsetTimeout( probe, interval );\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tresolve();\n\n\t\t\t}\n\n\t\t}\n\n\t\tsetTimeout( probe, interval );\n\n\t} );\n\n}\n\n/**\n * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping\n * or clipping. Based on W3C specifications for sRGB and Display P3,\n * and ICC specifications for the D50 connection space. Values in/out\n * are _linear_ sRGB and _linear_ Display P3.\n *\n * Note that both sRGB and Display P3 use the sRGB transfer functions.\n *\n * Reference:\n * - http://www.russellcottrell.com/photo/matrixCalculator.htm\n */\n\nconst LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().set(\n\t0.8224621, 0.177538, 0.0,\n\t0.0331941, 0.9668058, 0.0,\n\t0.0170827, 0.0723974, 0.9105199,\n);\n\nconst LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().set(\n\t1.2249401, - 0.2249404, 0.0,\n\t- 0.0420569, 1.0420571, 0.0,\n\t- 0.0196376, - 0.0786361, 1.0982735\n);\n\n/**\n * Defines supported color spaces by transfer function and primaries,\n * and provides conversions to/from the Linear-sRGB reference space.\n */\nconst COLOR_SPACES = {\n\t[ LinearSRGBColorSpace ]: {\n\t\ttransfer: LinearTransfer,\n\t\tprimaries: Rec709Primaries,\n\t\tluminanceCoefficients: [ 0.2126, 0.7152, 0.0722 ],\n\t\ttoReference: ( color ) => color,\n\t\tfromReference: ( color ) => color,\n\t},\n\t[ SRGBColorSpace ]: {\n\t\ttransfer: SRGBTransfer,\n\t\tprimaries: Rec709Primaries,\n\t\tluminanceCoefficients: [ 0.2126, 0.7152, 0.0722 ],\n\t\ttoReference: ( color ) => color.convertSRGBToLinear(),\n\t\tfromReference: ( color ) => color.convertLinearToSRGB(),\n\t},\n\t[ LinearDisplayP3ColorSpace ]: {\n\t\ttransfer: LinearTransfer,\n\t\tprimaries: P3Primaries,\n\t\tluminanceCoefficients: [ 0.2289, 0.6917, 0.0793 ],\n\t\ttoReference: ( color ) => color.applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),\n\t\tfromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ),\n\t},\n\t[ DisplayP3ColorSpace ]: {\n\t\ttransfer: SRGBTransfer,\n\t\tprimaries: P3Primaries,\n\t\tluminanceCoefficients: [ 0.2289, 0.6917, 0.0793 ],\n\t\ttoReference: ( color ) => color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),\n\t\tfromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB(),\n\t},\n};\n\nconst SUPPORTED_WORKING_COLOR_SPACES = new Set( [ LinearSRGBColorSpace, LinearDisplayP3ColorSpace ] );\n\nconst ColorManagement = {\n\n\tenabled: true,\n\n\t_workingColorSpace: LinearSRGBColorSpace,\n\n\tget workingColorSpace() {\n\n\t\treturn this._workingColorSpace;\n\n\t},\n\n\tset workingColorSpace( colorSpace ) {\n\n\t\tif ( ! SUPPORTED_WORKING_COLOR_SPACES.has( colorSpace ) ) {\n\n\t\t\tthrow new Error( `Unsupported working color space, \"${ colorSpace }\".` );\n\n\t\t}\n\n\t\tthis._workingColorSpace = colorSpace;\n\n\t},\n\n\tconvert: function ( color, sourceColorSpace, targetColorSpace ) {\n\n\t\tif ( this.enabled === false || sourceColorSpace === targetColorSpace || ! sourceColorSpace || ! targetColorSpace ) {\n\n\t\t\treturn color;\n\n\t\t}\n\n\t\tconst sourceToReference = COLOR_SPACES[ sourceColorSpace ].toReference;\n\t\tconst targetFromReference = COLOR_SPACES[ targetColorSpace ].fromReference;\n\n\t\treturn targetFromReference( sourceToReference( color ) );\n\n\t},\n\n\tfromWorkingColorSpace: function ( color, targetColorSpace ) {\n\n\t\treturn this.convert( color, this._workingColorSpace, targetColorSpace );\n\n\t},\n\n\ttoWorkingColorSpace: function ( color, sourceColorSpace ) {\n\n\t\treturn this.convert( color, sourceColorSpace, this._workingColorSpace );\n\n\t},\n\n\tgetPrimaries: function ( colorSpace ) {\n\n\t\treturn COLOR_SPACES[ colorSpace ].primaries;\n\n\t},\n\n\tgetTransfer: function ( colorSpace ) {\n\n\t\tif ( colorSpace === NoColorSpace ) return LinearTransfer;\n\n\t\treturn COLOR_SPACES[ colorSpace ].transfer;\n\n\t},\n\n\tgetLuminanceCoefficients: function ( target, colorSpace = this._workingColorSpace ) {\n\n\t\treturn target.fromArray( COLOR_SPACES[ colorSpace ].luminanceCoefficients );\n\n\t},\n\n};\n\n\nfunction SRGBToLinear( c ) {\n\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n\n}\n\nfunction LinearToSRGB( c ) {\n\n\treturn ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;\n\n}\n\nlet _canvas;\n\nclass ImageUtils {\n\n\tstatic getDataURL( image ) {\n\n\t\tif ( /^data:/i.test( image.src ) ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tif ( typeof HTMLCanvasElement === 'undefined' ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tlet canvas;\n\n\t\tif ( image instanceof HTMLCanvasElement ) {\n\n\t\t\tcanvas = image;\n\n\t\t} else {\n\n\t\t\tif ( _canvas === undefined ) _canvas = createElementNS( 'canvas' );\n\n\t\t\t_canvas.width = image.width;\n\t\t\t_canvas.height = image.height;\n\n\t\t\tconst context = _canvas.getContext( '2d' );\n\n\t\t\tif ( image instanceof ImageData ) {\n\n\t\t\t\tcontext.putImageData( image, 0, 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\t}\n\n\t\t\tcanvas = _canvas;\n\n\t\t}\n\n\t\tif ( canvas.width > 2048 || canvas.height > 2048 ) {\n\n\t\t\tconsole.warn( 'THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons', image );\n\n\t\t\treturn canvas.toDataURL( 'image/jpeg', 0.6 );\n\n\t\t} else {\n\n\t\t\treturn canvas.toDataURL( 'image/png' );\n\n\t\t}\n\n\t}\n\n\tstatic sRGBToLinear( image ) {\n\n\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t\tconst canvas = createElementNS( 'canvas' );\n\n\t\t\tcanvas.width = image.width;\n\t\t\tcanvas.height = image.height;\n\n\t\t\tconst context = canvas.getContext( '2d' );\n\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\tconst imageData = context.getImageData( 0, 0, image.width, image.height );\n\t\t\tconst data = imageData.data;\n\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] / 255 ) * 255;\n\n\t\t\t}\n\n\t\t\tcontext.putImageData( imageData, 0, 0 );\n\n\t\t\treturn canvas;\n\n\t\t} else if ( image.data ) {\n\n\t\t\tconst data = image.data.slice( 0 );\n\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\t\tif ( data instanceof Uint8Array || data instanceof Uint8ClampedArray ) {\n\n\t\t\t\t\tdata[ i ] = Math.floor( SRGBToLinear( data[ i ] / 255 ) * 255 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// assuming float\n\n\t\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tdata: data,\n\t\t\t\twidth: image.width,\n\t\t\t\theight: image.height\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.' );\n\t\t\treturn image;\n\n\t\t}\n\n\t}\n\n}\n\nlet _sourceId = 0;\n\nclass Source {\n\n\tconstructor( data = null ) {\n\n\t\tthis.isSource = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _sourceId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.data = data;\n\t\tthis.dataReady = true;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.images[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.images[ this.uuid ];\n\n\t\t}\n\n\t\tconst output = {\n\t\t\tuuid: this.uuid,\n\t\t\turl: ''\n\t\t};\n\n\t\tconst data = this.data;\n\n\t\tif ( data !== null ) {\n\n\t\t\tlet url;\n\n\t\t\tif ( Array.isArray( data ) ) {\n\n\t\t\t\t// cube texture\n\n\t\t\t\turl = [];\n\n\t\t\t\tfor ( let i = 0, l = data.length; i < l; i ++ ) {\n\n\t\t\t\t\tif ( data[ i ].isDataTexture ) {\n\n\t\t\t\t\t\turl.push( serializeImage( data[ i ].image ) );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\turl.push( serializeImage( data[ i ] ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// texture\n\n\t\t\t\turl = serializeImage( data );\n\n\t\t\t}\n\n\t\t\toutput.url = url;\n\n\t\t}\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.images[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n}\n\nfunction serializeImage( image ) {\n\n\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t// default images\n\n\t\treturn ImageUtils.getDataURL( image );\n\n\t} else {\n\n\t\tif ( image.data ) {\n\n\t\t\t// images of DataTexture\n\n\t\t\treturn {\n\t\t\t\tdata: Array.from( image.data ),\n\t\t\t\twidth: image.width,\n\t\t\t\theight: image.height,\n\t\t\t\ttype: image.data.constructor.name\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.Texture: Unable to serialize Texture.' );\n\t\t\treturn {};\n\n\t\t}\n\n\t}\n\n}\n\nlet _textureId = 0;\n\nclass Texture extends EventDispatcher {\n\n\tconstructor( image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = Texture.DEFAULT_ANISOTROPY, colorSpace = NoColorSpace ) {\n\n\t\tsuper();\n\n\t\tthis.isTexture = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _textureId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\n\t\tthis.source = new Source( image );\n\t\tthis.mipmaps = [];\n\n\t\tthis.mapping = mapping;\n\t\tthis.channel = 0;\n\n\t\tthis.wrapS = wrapS;\n\t\tthis.wrapT = wrapT;\n\n\t\tthis.magFilter = magFilter;\n\t\tthis.minFilter = minFilter;\n\n\t\tthis.anisotropy = anisotropy;\n\n\t\tthis.format = format;\n\t\tthis.internalFormat = null;\n\t\tthis.type = type;\n\n\t\tthis.offset = new Vector2( 0, 0 );\n\t\tthis.repeat = new Vector2( 1, 1 );\n\t\tthis.center = new Vector2( 0, 0 );\n\t\tthis.rotation = 0;\n\n\t\tthis.matrixAutoUpdate = true;\n\t\tthis.matrix = new Matrix3();\n\n\t\tthis.generateMipmaps = true;\n\t\tthis.premultiplyAlpha = false;\n\t\tthis.flipY = true;\n\t\tthis.unpackAlignment = 4;\t// valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)\n\n\t\tthis.colorSpace = colorSpace;\n\n\t\tthis.userData = {};\n\n\t\tthis.version = 0;\n\t\tthis.onUpdate = null;\n\n\t\tthis.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not\n\t\tthis.pmremVersion = 0; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)\n\n\t}\n\n\tget image() {\n\n\t\treturn this.source.data;\n\n\t}\n\n\tset image( value = null ) {\n\n\t\tthis.source.data = value;\n\n\t}\n\n\tupdateMatrix() {\n\n\t\tthis.matrix.setUvTransform( this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.source = source.source;\n\t\tthis.mipmaps = source.mipmaps.slice( 0 );\n\n\t\tthis.mapping = source.mapping;\n\t\tthis.channel = source.channel;\n\n\t\tthis.wrapS = source.wrapS;\n\t\tthis.wrapT = source.wrapT;\n\n\t\tthis.magFilter = source.magFilter;\n\t\tthis.minFilter = source.minFilter;\n\n\t\tthis.anisotropy = source.anisotropy;\n\n\t\tthis.format = source.format;\n\t\tthis.internalFormat = source.internalFormat;\n\t\tthis.type = source.type;\n\n\t\tthis.offset.copy( source.offset );\n\t\tthis.repeat.copy( source.repeat );\n\t\tthis.center.copy( source.center );\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\t\tthis.matrix.copy( source.matrix );\n\n\t\tthis.generateMipmaps = source.generateMipmaps;\n\t\tthis.premultiplyAlpha = source.premultiplyAlpha;\n\t\tthis.flipY = source.flipY;\n\t\tthis.unpackAlignment = source.unpackAlignment;\n\t\tthis.colorSpace = source.colorSpace;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tthis.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.textures[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.textures[ this.uuid ];\n\n\t\t}\n\n\t\tconst output = {\n\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Texture',\n\t\t\t\tgenerator: 'Texture.toJSON'\n\t\t\t},\n\n\t\t\tuuid: this.uuid,\n\t\t\tname: this.name,\n\n\t\t\timage: this.source.toJSON( meta ).uuid,\n\n\t\t\tmapping: this.mapping,\n\t\t\tchannel: this.channel,\n\n\t\t\trepeat: [ this.repeat.x, this.repeat.y ],\n\t\t\toffset: [ this.offset.x, this.offset.y ],\n\t\t\tcenter: [ this.center.x, this.center.y ],\n\t\t\trotation: this.rotation,\n\n\t\t\twrap: [ this.wrapS, this.wrapT ],\n\n\t\t\tformat: this.format,\n\t\t\tinternalFormat: this.internalFormat,\n\t\t\ttype: this.type,\n\t\t\tcolorSpace: this.colorSpace,\n\n\t\t\tminFilter: this.minFilter,\n\t\t\tmagFilter: this.magFilter,\n\t\t\tanisotropy: this.anisotropy,\n\n\t\t\tflipY: this.flipY,\n\n\t\t\tgenerateMipmaps: this.generateMipmaps,\n\t\t\tpremultiplyAlpha: this.premultiplyAlpha,\n\t\t\tunpackAlignment: this.unpackAlignment\n\n\t\t};\n\n\t\tif ( Object.keys( this.userData ).length > 0 ) output.userData = this.userData;\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.textures[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\ttransformUv( uv ) {\n\n\t\tif ( this.mapping !== UVMapping ) return uv;\n\n\t\tuv.applyMatrix3( this.matrix );\n\n\t\tif ( uv.x < 0 || uv.x > 1 ) {\n\n\t\t\tswitch ( this.wrapS ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.x = uv.x < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.x ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.x = Math.ceil( uv.x ) - uv.x;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( uv.y < 0 || uv.y > 1 ) {\n\n\t\t\tswitch ( this.wrapT ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.y = uv.y < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.y ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.y = Math.ceil( uv.y ) - uv.y;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.flipY ) {\n\n\t\t\tuv.y = 1 - uv.y;\n\n\t\t}\n\n\t\treturn uv;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.version ++;\n\t\t\tthis.source.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tset needsPMREMUpdate( value ) {\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.pmremVersion ++;\n\n\t\t}\n\n\t}\n\n}\n\nTexture.DEFAULT_IMAGE = null;\nTexture.DEFAULT_MAPPING = UVMapping;\nTexture.DEFAULT_ANISOTROPY = 1;\n\nclass Vector4 {\n\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\tVector4.prototype.isVector4 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t}\n\n\tget width() {\n\n\t\treturn this.z;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.z = value;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.w;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.w = value;\n\n\t}\n\n\tset( x, y, z, w ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\t\tthis.w = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetW( w ) {\n\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tcase 3: this.w = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tcase 3: return this.w;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z, this.w );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\t\tthis.w = ( v.w !== undefined ) ? v.w : 1;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\t\tthis.w += v.w;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\t\tthis.w += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\t\tthis.w = a.w + b.w;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\t\tthis.w += v.w * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\t\tthis.w -= v.w;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\t\tthis.w -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\t\tthis.w = a.w - b.w;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\t\tthis.w *= v.w;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\t\tthis.w *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z, w = this.w;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w;\n\t\tthis.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tsetAxisAngleFromQuaternion( q ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm\n\n\t\t// q is assumed to be normalized\n\n\t\tthis.w = 2 * Math.acos( q.w );\n\n\t\tconst s = Math.sqrt( 1 - q.w * q.w );\n\n\t\tif ( s < 0.0001 ) {\n\n\t\t\tthis.x = 1;\n\t\t\tthis.y = 0;\n\t\t\tthis.z = 0;\n\n\t\t} else {\n\n\t\t\tthis.x = q.x / s;\n\t\t\tthis.y = q.y / s;\n\t\t\tthis.z = q.z / s;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetAxisAngleFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tlet angle, x, y, z; // variables for result\n\t\tconst epsilon = 0.01,\t\t// margin to allow for rounding errors\n\t\t\tepsilon2 = 0.1,\t\t// margin to distinguish between 0 and 180 degrees\n\n\t\t\tte = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tif ( ( Math.abs( m12 - m21 ) < epsilon ) &&\n\t\t ( Math.abs( m13 - m31 ) < epsilon ) &&\n\t\t ( Math.abs( m23 - m32 ) < epsilon ) ) {\n\n\t\t\t// singularity found\n\t\t\t// first check for identity matrix which must have +1 for all terms\n\t\t\t// in leading diagonal and zero in other terms\n\n\t\t\tif ( ( Math.abs( m12 + m21 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m13 + m31 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m23 + m32 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {\n\n\t\t\t\t// this singularity is identity matrix so angle = 0\n\n\t\t\t\tthis.set( 1, 0, 0, 0 );\n\n\t\t\t\treturn this; // zero angle, arbitrary axis\n\n\t\t\t}\n\n\t\t\t// otherwise this singularity is angle = 180\n\n\t\t\tangle = Math.PI;\n\n\t\t\tconst xx = ( m11 + 1 ) / 2;\n\t\t\tconst yy = ( m22 + 1 ) / 2;\n\t\t\tconst zz = ( m33 + 1 ) / 2;\n\t\t\tconst xy = ( m12 + m21 ) / 4;\n\t\t\tconst xz = ( m13 + m31 ) / 4;\n\t\t\tconst yz = ( m23 + m32 ) / 4;\n\n\t\t\tif ( ( xx > yy ) && ( xx > zz ) ) {\n\n\t\t\t\t// m11 is the largest diagonal term\n\n\t\t\t\tif ( xx < epsilon ) {\n\n\t\t\t\t\tx = 0;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tx = Math.sqrt( xx );\n\t\t\t\t\ty = xy / x;\n\t\t\t\t\tz = xz / x;\n\n\t\t\t\t}\n\n\t\t\t} else if ( yy > zz ) {\n\n\t\t\t\t// m22 is the largest diagonal term\n\n\t\t\t\tif ( yy < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ty = Math.sqrt( yy );\n\t\t\t\t\tx = xy / y;\n\t\t\t\t\tz = yz / y;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// m33 is the largest diagonal term so base result on this\n\n\t\t\t\tif ( zz < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tz = Math.sqrt( zz );\n\t\t\t\t\tx = xz / z;\n\t\t\t\t\ty = yz / z;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.set( x, y, z, angle );\n\n\t\t\treturn this; // return 180 deg rotation\n\n\t\t}\n\n\t\t// as we have reached here there are no singularities so we can handle normally\n\n\t\tlet s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) +\n\t\t\t( m13 - m31 ) * ( m13 - m31 ) +\n\t\t\t( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize\n\n\t\tif ( Math.abs( s ) < 0.001 ) s = 1;\n\n\t\t// prevent divide by zero, should not happen if matrix is orthogonal and should be\n\t\t// caught by singularity test above, but I've left it in just in case\n\n\t\tthis.x = ( m32 - m23 ) / s;\n\t\tthis.y = ( m13 - m31 ) / s;\n\t\tthis.z = ( m21 - m12 ) / s;\n\t\tthis.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixPosition( m ) {\n\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 12 ];\n\t\tthis.y = e[ 13 ];\n\t\tthis.z = e[ 14 ];\n\t\tthis.w = e[ 15 ];\n\n\t\treturn this;\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\t\tthis.w = Math.min( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\t\tthis.w = Math.max( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\n\t\tthis.w = Math.max( min.w, Math.min( max.w, this.w ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\n\t\tthis.w = Math.max( minVal, Math.min( maxVal, this.w ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\t\tthis.w = Math.floor( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\t\tthis.w = Math.ceil( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\t\tthis.w = Math.round( this.w );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\t\tthis.z = Math.trunc( this.z );\n\t\tthis.w = Math.trunc( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\t\tthis.w = - this.w;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\t\tthis.w += ( v.w - this.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\t\tthis.w = v1.w + ( v2.w - v1.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\t\tthis.w = array[ offset + 3 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\t\tarray[ offset + 3 ] = this.w;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\t\tthis.w = attribute.getW( index );\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\t\tthis.w = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\t\tyield this.w;\n\n\t}\n\n}\n\n/*\n In options, we can specify:\n * Texture parameters for an auto-generated target texture\n * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers\n*/\nclass RenderTarget extends EventDispatcher {\n\n\tconstructor( width = 1, height = 1, options = {} ) {\n\n\t\tsuper();\n\n\t\tthis.isRenderTarget = true;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\t\tthis.depth = 1;\n\n\t\tthis.scissor = new Vector4( 0, 0, width, height );\n\t\tthis.scissorTest = false;\n\n\t\tthis.viewport = new Vector4( 0, 0, width, height );\n\n\t\tconst image = { width: width, height: height, depth: 1 };\n\n\t\toptions = Object.assign( {\n\t\t\tgenerateMipmaps: false,\n\t\t\tinternalFormat: null,\n\t\t\tminFilter: LinearFilter,\n\t\t\tdepthBuffer: true,\n\t\t\tstencilBuffer: false,\n\t\t\tresolveDepthBuffer: true,\n\t\t\tresolveStencilBuffer: true,\n\t\t\tdepthTexture: null,\n\t\t\tsamples: 0,\n\t\t\tcount: 1\n\t\t}, options );\n\n\t\tconst texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );\n\n\t\ttexture.flipY = false;\n\t\ttexture.generateMipmaps = options.generateMipmaps;\n\t\ttexture.internalFormat = options.internalFormat;\n\n\t\tthis.textures = [];\n\n\t\tconst count = options.count;\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.textures[ i ] = texture.clone();\n\t\t\tthis.textures[ i ].isRenderTargetTexture = true;\n\n\t\t}\n\n\t\tthis.depthBuffer = options.depthBuffer;\n\t\tthis.stencilBuffer = options.stencilBuffer;\n\n\t\tthis.resolveDepthBuffer = options.resolveDepthBuffer;\n\t\tthis.resolveStencilBuffer = options.resolveStencilBuffer;\n\n\t\tthis.depthTexture = options.depthTexture;\n\n\t\tthis.samples = options.samples;\n\n\t}\n\n\tget texture() {\n\n\t\treturn this.textures[ 0 ];\n\n\t}\n\n\tset texture( value ) {\n\n\t\tthis.textures[ 0 ] = value;\n\n\t}\n\n\tsetSize( width, height, depth = 1 ) {\n\n\t\tif ( this.width !== width || this.height !== height || this.depth !== depth ) {\n\n\t\t\tthis.width = width;\n\t\t\tthis.height = height;\n\t\t\tthis.depth = depth;\n\n\t\t\tfor ( let i = 0, il = this.textures.length; i < il; i ++ ) {\n\n\t\t\t\tthis.textures[ i ].image.width = width;\n\t\t\t\tthis.textures[ i ].image.height = height;\n\t\t\t\tthis.textures[ i ].image.depth = depth;\n\n\t\t\t}\n\n\t\t\tthis.dispose();\n\n\t\t}\n\n\t\tthis.viewport.set( 0, 0, width, height );\n\t\tthis.scissor.set( 0, 0, width, height );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\t\tthis.depth = source.depth;\n\n\t\tthis.scissor.copy( source.scissor );\n\t\tthis.scissorTest = source.scissorTest;\n\n\t\tthis.viewport.copy( source.viewport );\n\n\t\tthis.textures.length = 0;\n\n\t\tfor ( let i = 0, il = source.textures.length; i < il; i ++ ) {\n\n\t\t\tthis.textures[ i ] = source.textures[ i ].clone();\n\t\t\tthis.textures[ i ].isRenderTargetTexture = true;\n\n\t\t}\n\n\t\t// ensure image object is not shared, see #20328\n\n\t\tconst image = Object.assign( {}, source.texture.image );\n\t\tthis.texture.source = new Source( image );\n\n\t\tthis.depthBuffer = source.depthBuffer;\n\t\tthis.stencilBuffer = source.stencilBuffer;\n\n\t\tthis.resolveDepthBuffer = source.resolveDepthBuffer;\n\t\tthis.resolveStencilBuffer = source.resolveStencilBuffer;\n\n\t\tif ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();\n\n\t\tthis.samples = source.samples;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nclass WebGLRenderTarget extends RenderTarget {\n\n\tconstructor( width = 1, height = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\tthis.isWebGLRenderTarget = true;\n\n\t}\n\n}\n\nclass DataArrayTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\n\n\t\tsuper( null );\n\n\t\tthis.isDataArrayTexture = true;\n\n\t\tthis.image = { data, width, height, depth };\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t\tthis.layerUpdates = new Set();\n\n\t}\n\n\taddLayerUpdate( layerIndex ) {\n\n\t\tthis.layerUpdates.add( layerIndex );\n\n\t}\n\n\tclearLayerUpdates() {\n\n\t\tthis.layerUpdates.clear();\n\n\t}\n\n}\n\nclass WebGLArrayRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, depth = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\tthis.isWebGLArrayRenderTarget = true;\n\n\t\tthis.depth = depth;\n\n\t\tthis.texture = new DataArrayTexture( null, width, height, depth );\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t}\n\n}\n\nclass Data3DTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\n\n\t\t// We're going to add .setXXX() methods for setting properties later.\n\t\t// Users can still set in DataTexture3D directly.\n\t\t//\n\t\t//\tconst texture = new THREE.DataTexture3D( data, width, height, depth );\n\t\t// \ttexture.anisotropy = 16;\n\t\t//\n\t\t// See #14839\n\n\t\tsuper( null );\n\n\t\tthis.isData3DTexture = true;\n\n\t\tthis.image = { data, width, height, depth };\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nclass WebGL3DRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, depth = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\tthis.isWebGL3DRenderTarget = true;\n\n\t\tthis.depth = depth;\n\n\t\tthis.texture = new Data3DTexture( null, width, height, depth );\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t}\n\n}\n\nclass Quaternion {\n\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\tthis.isQuaternion = true;\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t}\n\n\tstatic slerpFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) {\n\n\t\t// fuzz-free, array-based Quaternion SLERP operation\n\n\t\tlet x0 = src0[ srcOffset0 + 0 ],\n\t\t\ty0 = src0[ srcOffset0 + 1 ],\n\t\t\tz0 = src0[ srcOffset0 + 2 ],\n\t\t\tw0 = src0[ srcOffset0 + 3 ];\n\n\t\tconst x1 = src1[ srcOffset1 + 0 ],\n\t\t\ty1 = src1[ srcOffset1 + 1 ],\n\t\t\tz1 = src1[ srcOffset1 + 2 ],\n\t\t\tw1 = src1[ srcOffset1 + 3 ];\n\n\t\tif ( t === 0 ) {\n\n\t\t\tdst[ dstOffset + 0 ] = x0;\n\t\t\tdst[ dstOffset + 1 ] = y0;\n\t\t\tdst[ dstOffset + 2 ] = z0;\n\t\t\tdst[ dstOffset + 3 ] = w0;\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( t === 1 ) {\n\n\t\t\tdst[ dstOffset + 0 ] = x1;\n\t\t\tdst[ dstOffset + 1 ] = y1;\n\t\t\tdst[ dstOffset + 2 ] = z1;\n\t\t\tdst[ dstOffset + 3 ] = w1;\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) {\n\n\t\t\tlet s = 1 - t;\n\t\t\tconst cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,\n\t\t\t\tdir = ( cos >= 0 ? 1 : - 1 ),\n\t\t\t\tsqrSin = 1 - cos * cos;\n\n\t\t\t// Skip the Slerp for tiny steps to avoid numeric problems:\n\t\t\tif ( sqrSin > Number.EPSILON ) {\n\n\t\t\t\tconst sin = Math.sqrt( sqrSin ),\n\t\t\t\t\tlen = Math.atan2( sin, cos * dir );\n\n\t\t\t\ts = Math.sin( s * len ) / sin;\n\t\t\t\tt = Math.sin( t * len ) / sin;\n\n\t\t\t}\n\n\t\t\tconst tDir = t * dir;\n\n\t\t\tx0 = x0 * s + x1 * tDir;\n\t\t\ty0 = y0 * s + y1 * tDir;\n\t\t\tz0 = z0 * s + z1 * tDir;\n\t\t\tw0 = w0 * s + w1 * tDir;\n\n\t\t\t// Normalize in case we just did a lerp:\n\t\t\tif ( s === 1 - t ) {\n\n\t\t\t\tconst f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 );\n\n\t\t\t\tx0 *= f;\n\t\t\t\ty0 *= f;\n\t\t\t\tz0 *= f;\n\t\t\t\tw0 *= f;\n\n\t\t\t}\n\n\t\t}\n\n\t\tdst[ dstOffset ] = x0;\n\t\tdst[ dstOffset + 1 ] = y0;\n\t\tdst[ dstOffset + 2 ] = z0;\n\t\tdst[ dstOffset + 3 ] = w0;\n\n\t}\n\n\tstatic multiplyQuaternionsFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1 ) {\n\n\t\tconst x0 = src0[ srcOffset0 ];\n\t\tconst y0 = src0[ srcOffset0 + 1 ];\n\t\tconst z0 = src0[ srcOffset0 + 2 ];\n\t\tconst w0 = src0[ srcOffset0 + 3 ];\n\n\t\tconst x1 = src1[ srcOffset1 ];\n\t\tconst y1 = src1[ srcOffset1 + 1 ];\n\t\tconst z1 = src1[ srcOffset1 + 2 ];\n\t\tconst w1 = src1[ srcOffset1 + 3 ];\n\n\t\tdst[ dstOffset ] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;\n\t\tdst[ dstOffset + 1 ] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;\n\t\tdst[ dstOffset + 2 ] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;\n\t\tdst[ dstOffset + 3 ] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;\n\n\t\treturn dst;\n\n\t}\n\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget w() {\n\n\t\treturn this._w;\n\n\t}\n\n\tset w( value ) {\n\n\t\tthis._w = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tset( x, y, z, w ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._w );\n\n\t}\n\n\tcopy( quaternion ) {\n\n\t\tthis._x = quaternion.x;\n\t\tthis._y = quaternion.y;\n\t\tthis._z = quaternion.z;\n\t\tthis._w = quaternion.w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromEuler( euler, update = true ) {\n\n\t\tconst x = euler._x, y = euler._y, z = euler._z, order = euler._order;\n\n\t\t// http://www.mathworks.com/matlabcentral/fileexchange/\n\t\t// \t20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\n\t\t//\tcontent/SpinCalc.m\n\n\t\tconst cos = Math.cos;\n\t\tconst sin = Math.sin;\n\n\t\tconst c1 = cos( x / 2 );\n\t\tconst c2 = cos( y / 2 );\n\t\tconst c3 = cos( z / 2 );\n\n\t\tconst s1 = sin( x / 2 );\n\t\tconst s2 = sin( y / 2 );\n\t\tconst s3 = sin( z / 2 );\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tconsole.warn( 'THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tif ( update === true ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromAxisAngle( axis, angle ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n\n\t\t// assumes axis is normalized\n\n\t\tconst halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n\t\tthis._x = axis.x * s;\n\t\tthis._y = axis.y * s;\n\t\tthis._z = axis.z * s;\n\t\tthis._w = Math.cos( halfAngle );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tconst te = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ],\n\n\t\t\ttrace = m11 + m22 + m33;\n\n\t\tif ( trace > 0 ) {\n\n\t\t\tconst s = 0.5 / Math.sqrt( trace + 1.0 );\n\n\t\t\tthis._w = 0.25 / s;\n\t\t\tthis._x = ( m32 - m23 ) * s;\n\t\t\tthis._y = ( m13 - m31 ) * s;\n\t\t\tthis._z = ( m21 - m12 ) * s;\n\n\t\t} else if ( m11 > m22 && m11 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 );\n\n\t\t\tthis._w = ( m32 - m23 ) / s;\n\t\t\tthis._x = 0.25 * s;\n\t\t\tthis._y = ( m12 + m21 ) / s;\n\t\t\tthis._z = ( m13 + m31 ) / s;\n\n\t\t} else if ( m22 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 );\n\n\t\t\tthis._w = ( m13 - m31 ) / s;\n\t\t\tthis._x = ( m12 + m21 ) / s;\n\t\t\tthis._y = 0.25 * s;\n\t\t\tthis._z = ( m23 + m32 ) / s;\n\n\t\t} else {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 );\n\n\t\t\tthis._w = ( m21 - m12 ) / s;\n\t\t\tthis._x = ( m13 + m31 ) / s;\n\t\t\tthis._y = ( m23 + m32 ) / s;\n\t\t\tthis._z = 0.25 * s;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromUnitVectors( vFrom, vTo ) {\n\n\t\t// assumes direction vectors vFrom and vTo are normalized\n\n\t\tlet r = vFrom.dot( vTo ) + 1;\n\n\t\tif ( r < Number.EPSILON ) {\n\n\t\t\t// vFrom and vTo point in opposite directions\n\n\t\t\tr = 0;\n\n\t\t\tif ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n\n\t\t\t\tthis._x = - vFrom.y;\n\t\t\t\tthis._y = vFrom.x;\n\t\t\t\tthis._z = 0;\n\t\t\t\tthis._w = r;\n\n\t\t\t} else {\n\n\t\t\t\tthis._x = 0;\n\t\t\t\tthis._y = - vFrom.z;\n\t\t\t\tthis._z = vFrom.y;\n\t\t\t\tthis._w = r;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3\n\n\t\t\tthis._x = vFrom.y * vTo.z - vFrom.z * vTo.y;\n\t\t\tthis._y = vFrom.z * vTo.x - vFrom.x * vTo.z;\n\t\t\tthis._z = vFrom.x * vTo.y - vFrom.y * vTo.x;\n\t\t\tthis._w = r;\n\n\t\t}\n\n\t\treturn this.normalize();\n\n\t}\n\n\tangleTo( q ) {\n\n\t\treturn 2 * Math.acos( Math.abs( clamp( this.dot( q ), - 1, 1 ) ) );\n\n\t}\n\n\trotateTowards( q, step ) {\n\n\t\tconst angle = this.angleTo( q );\n\n\t\tif ( angle === 0 ) return this;\n\n\t\tconst t = Math.min( 1, step / angle );\n\n\t\tthis.slerp( q, t );\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\treturn this.set( 0, 0, 0, 1 );\n\n\t}\n\n\tinvert() {\n\n\t\t// quaternion is assumed to have unit length\n\n\t\treturn this.conjugate();\n\n\t}\n\n\tconjugate() {\n\n\t\tthis._x *= - 1;\n\t\tthis._y *= - 1;\n\t\tthis._z *= - 1;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w );\n\n\t}\n\n\tnormalize() {\n\n\t\tlet l = this.length();\n\n\t\tif ( l === 0 ) {\n\n\t\t\tthis._x = 0;\n\t\t\tthis._y = 0;\n\t\t\tthis._z = 0;\n\t\t\tthis._w = 1;\n\n\t\t} else {\n\n\t\t\tl = 1 / l;\n\n\t\t\tthis._x = this._x * l;\n\t\t\tthis._y = this._y * l;\n\t\t\tthis._z = this._z * l;\n\t\t\tthis._w = this._w * l;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( q ) {\n\n\t\treturn this.multiplyQuaternions( this, q );\n\n\t}\n\n\tpremultiply( q ) {\n\n\t\treturn this.multiplyQuaternions( q, this );\n\n\t}\n\n\tmultiplyQuaternions( a, b ) {\n\n\t\t// from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n\t\tconst qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;\n\t\tconst qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;\n\n\t\tthis._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n\t\tthis._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n\t\tthis._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n\t\tthis._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tslerp( qb, t ) {\n\n\t\tif ( t === 0 ) return this;\n\t\tif ( t === 1 ) return this.copy( qb );\n\n\t\tconst x = this._x, y = this._y, z = this._z, w = this._w;\n\n\t\t// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n\t\tlet cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;\n\n\t\tif ( cosHalfTheta < 0 ) {\n\n\t\t\tthis._w = - qb._w;\n\t\t\tthis._x = - qb._x;\n\t\t\tthis._y = - qb._y;\n\t\t\tthis._z = - qb._z;\n\n\t\t\tcosHalfTheta = - cosHalfTheta;\n\n\t\t} else {\n\n\t\t\tthis.copy( qb );\n\n\t\t}\n\n\t\tif ( cosHalfTheta >= 1.0 ) {\n\n\t\t\tthis._w = w;\n\t\t\tthis._x = x;\n\t\t\tthis._y = y;\n\t\t\tthis._z = z;\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;\n\n\t\tif ( sqrSinHalfTheta <= Number.EPSILON ) {\n\n\t\t\tconst s = 1 - t;\n\t\t\tthis._w = s * w + t * this._w;\n\t\t\tthis._x = s * x + t * this._x;\n\t\t\tthis._y = s * y + t * this._y;\n\t\t\tthis._z = s * z + t * this._z;\n\n\t\t\tthis.normalize(); // normalize calls _onChangeCallback()\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst sinHalfTheta = Math.sqrt( sqrSinHalfTheta );\n\t\tconst halfTheta = Math.atan2( sinHalfTheta, cosHalfTheta );\n\t\tconst ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\n\t\t\tratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\n\n\t\tthis._w = ( w * ratioA + this._w * ratioB );\n\t\tthis._x = ( x * ratioA + this._x * ratioB );\n\t\tthis._y = ( y * ratioA + this._y * ratioB );\n\t\tthis._z = ( z * ratioA + this._z * ratioB );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tslerpQuaternions( qa, qb, t ) {\n\n\t\treturn this.copy( qa ).slerp( qb, t );\n\n\t}\n\n\trandom() {\n\n\t\t// sets this quaternion to a uniform random unit quaternnion\n\n\t\t// Ken Shoemake\n\t\t// Uniform random rotations\n\t\t// D. Kirk, editor, Graphics Gems III, pages 124-132. Academic Press, New York, 1992.\n\n\t\tconst theta1 = 2 * Math.PI * Math.random();\n\t\tconst theta2 = 2 * Math.PI * Math.random();\n\n\t\tconst x0 = Math.random();\n\t\tconst r1 = Math.sqrt( 1 - x0 );\n\t\tconst r2 = Math.sqrt( x0 );\n\n\t\treturn this.set(\n\t\t\tr1 * Math.sin( theta1 ),\n\t\t\tr1 * Math.cos( theta1 ),\n\t\t\tr2 * Math.sin( theta2 ),\n\t\t\tr2 * Math.cos( theta2 ),\n\t\t);\n\n\t}\n\n\tequals( quaternion ) {\n\n\t\treturn ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis._x = array[ offset ];\n\t\tthis._y = array[ offset + 1 ];\n\t\tthis._z = array[ offset + 2 ];\n\t\tthis._w = array[ offset + 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._w;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis._x = attribute.getX( index );\n\t\tthis._y = attribute.getY( index );\n\t\tthis._z = attribute.getZ( index );\n\t\tthis._w = attribute.getW( index );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.toArray();\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this._x;\n\t\tyield this._y;\n\t\tyield this._z;\n\t\tyield this._w;\n\n\t}\n\n}\n\nclass Vector3 {\n\n\tconstructor( x = 0, y = 0, z = 0 ) {\n\n\t\tVector3.prototype.isVector3 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t}\n\n\tset( x, y, z ) {\n\n\t\tif ( z === undefined ) z = this.z; // sprite.scale.set(x,y)\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyVectors( a, b ) {\n\n\t\tthis.x = a.x * b.x;\n\t\tthis.y = a.y * b.y;\n\t\tthis.z = a.z * b.z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyEuler( euler ) {\n\n\t\treturn this.applyQuaternion( _quaternion$4.setFromEuler( euler ) );\n\n\t}\n\n\tapplyAxisAngle( axis, angle ) {\n\n\t\treturn this.applyQuaternion( _quaternion$4.setFromAxisAngle( axis, angle ) );\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\treturn this.applyMatrix3( m ).normalize();\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tconst w = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] );\n\n\t\tthis.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * w;\n\t\tthis.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * w;\n\t\tthis.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * w;\n\n\t\treturn this;\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\t// quaternion q is assumed to have unit length\n\n\t\tconst vx = this.x, vy = this.y, vz = this.z;\n\t\tconst qx = q.x, qy = q.y, qz = q.z, qw = q.w;\n\n\t\t// t = 2 * cross( q.xyz, v );\n\t\tconst tx = 2 * ( qy * vz - qz * vy );\n\t\tconst ty = 2 * ( qz * vx - qx * vz );\n\t\tconst tz = 2 * ( qx * vy - qy * vx );\n\n\t\t// v + q.w * t + cross( q.xyz, t );\n\t\tthis.x = vx + qw * tx + qy * tz - qz * ty;\n\t\tthis.y = vy + qw * ty + qz * tx - qx * tz;\n\t\tthis.z = vz + qw * tz + qx * ty - qy * tx;\n\n\t\treturn this;\n\n\t}\n\n\tproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix );\n\n\t}\n\n\tunproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.projectionMatrixInverse ).applyMatrix4( camera.matrixWorld );\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\t// input: THREE.Matrix4 affine matrix\n\t\t// vector interpreted as a direction\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z;\n\n\t\treturn this.normalize();\n\n\t}\n\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\t\tthis.z /= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\t\tthis.z = Math.trunc( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z;\n\n\t}\n\n\t// TODO lengthSquared?\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tcross( v ) {\n\n\t\treturn this.crossVectors( this, v );\n\n\t}\n\n\tcrossVectors( a, b ) {\n\n\t\tconst ax = a.x, ay = a.y, az = a.z;\n\t\tconst bx = b.x, by = b.y, bz = b.z;\n\n\t\tthis.x = ay * bz - az * by;\n\t\tthis.y = az * bx - ax * bz;\n\t\tthis.z = ax * by - ay * bx;\n\n\t\treturn this;\n\n\t}\n\n\tprojectOnVector( v ) {\n\n\t\tconst denominator = v.lengthSq();\n\n\t\tif ( denominator === 0 ) return this.set( 0, 0, 0 );\n\n\t\tconst scalar = v.dot( this ) / denominator;\n\n\t\treturn this.copy( v ).multiplyScalar( scalar );\n\n\t}\n\n\tprojectOnPlane( planeNormal ) {\n\n\t\t_vector$c.copy( this ).projectOnVector( planeNormal );\n\n\t\treturn this.sub( _vector$c );\n\n\t}\n\n\treflect( normal ) {\n\n\t\t// reflect incident vector off plane orthogonal to normal\n\t\t// normal is assumed to have unit length\n\n\t\treturn this.sub( _vector$c.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );\n\n\t}\n\n\tangleTo( v ) {\n\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tconst theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( clamp( theta, - 1, 1 ) );\n\n\t}\n\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;\n\n\t\treturn dx * dx + dy * dy + dz * dz;\n\n\t}\n\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z );\n\n\t}\n\n\tsetFromSpherical( s ) {\n\n\t\treturn this.setFromSphericalCoords( s.radius, s.phi, s.theta );\n\n\t}\n\n\tsetFromSphericalCoords( radius, phi, theta ) {\n\n\t\tconst sinPhiRadius = Math.sin( phi ) * radius;\n\n\t\tthis.x = sinPhiRadius * Math.sin( theta );\n\t\tthis.y = Math.cos( phi ) * radius;\n\t\tthis.z = sinPhiRadius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCylindrical( c ) {\n\n\t\treturn this.setFromCylindricalCoords( c.radius, c.theta, c.y );\n\n\t}\n\n\tsetFromCylindricalCoords( radius, theta, y ) {\n\n\t\tthis.x = radius * Math.sin( theta );\n\t\tthis.y = y;\n\t\tthis.z = radius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixPosition( m ) {\n\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 12 ];\n\t\tthis.y = e[ 13 ];\n\t\tthis.z = e[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixScale( m ) {\n\n\t\tconst sx = this.setFromMatrixColumn( m, 0 ).length();\n\t\tconst sy = this.setFromMatrixColumn( m, 1 ).length();\n\t\tconst sz = this.setFromMatrixColumn( m, 2 ).length();\n\n\t\tthis.x = sx;\n\t\tthis.y = sy;\n\t\tthis.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixColumn( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 4 );\n\n\t}\n\n\tsetFromMatrix3Column( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 3 );\n\n\t}\n\n\tsetFromEuler( e ) {\n\n\t\tthis.x = e._x;\n\t\tthis.y = e._y;\n\t\tthis.z = e._z;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromColor( c ) {\n\n\t\tthis.x = c.r;\n\t\tthis.y = c.g;\n\t\tthis.z = c.b;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\trandomDirection() {\n\n\t\t// https://mathworld.wolfram.com/SpherePointPicking.html\n\n\t\tconst theta = Math.random() * Math.PI * 2;\n\t\tconst u = Math.random() * 2 - 1;\n\t\tconst c = Math.sqrt( 1 - u * u );\n\n\t\tthis.x = c * Math.cos( theta );\n\t\tthis.y = u;\n\t\tthis.z = c * Math.sin( theta );\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\n\t}\n\n}\n\nconst _vector$c = /*@__PURE__*/ new Vector3();\nconst _quaternion$4 = /*@__PURE__*/ new Quaternion();\n\nclass Box3 {\n\n\tconstructor( min = new Vector3( + Infinity, + Infinity, + Infinity ), max = new Vector3( - Infinity, - Infinity, - Infinity ) ) {\n\n\t\tthis.isBox3 = true;\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tset( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromArray( array ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = array.length; i < il; i += 3 ) {\n\n\t\t\tthis.expandByPoint( _vector$b.fromArray( array, i ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromBufferAttribute( attribute ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = attribute.count; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( _vector$b.fromBufferAttribute( attribute, i ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCenterAndSize( center, size ) {\n\n\t\tconst halfSize = _vector$b.copy( size ).multiplyScalar( 0.5 );\n\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromObject( object, precise = false ) {\n\n\t\tthis.makeEmpty();\n\n\t\treturn this.expandByObject( object, precise );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.min.x = this.min.y = this.min.z = + Infinity;\n\t\tthis.max.x = this.max.y = this.max.z = - Infinity;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z );\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t}\n\n\tgetSize( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t}\n\n\texpandByVector( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t}\n\n\texpandByScalar( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t}\n\n\texpandByObject( object, precise = false ) {\n\n\t\t// Computes the world-axis-aligned bounding box of an object (including its children),\n\t\t// accounting for both the object's, and children's, world transforms\n\n\t\tobject.updateWorldMatrix( false, false );\n\n\t\tconst geometry = object.geometry;\n\n\t\tif ( geometry !== undefined ) {\n\n\t\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\t\t// precise AABB computation based on vertex data requires at least a position attribute.\n\t\t\t// instancing isn't supported so far and uses the normal (conservative) code path.\n\n\t\t\tif ( precise === true && positionAttribute !== undefined && object.isInstancedMesh !== true ) {\n\n\t\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t\tif ( object.isMesh === true ) {\n\n\t\t\t\t\t\tobject.getVertexPosition( i, _vector$b );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_vector$b.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_vector$b.applyMatrix4( object.matrixWorld );\n\t\t\t\t\tthis.expandByPoint( _vector$b );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( object.boundingBox !== undefined ) {\n\n\t\t\t\t\t// object-level bounding box\n\n\t\t\t\t\tif ( object.boundingBox === null ) {\n\n\t\t\t\t\t\tobject.computeBoundingBox();\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_box$4.copy( object.boundingBox );\n\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// geometry-level bounding box\n\n\t\t\t\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\t\t\t\tgeometry.computeBoundingBox();\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_box$4.copy( geometry.boundingBox );\n\n\t\t\t\t}\n\n\t\t\t\t_box$4.applyMatrix4( object.matrixWorld );\n\n\t\t\t\tthis.union( _box$4 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tthis.expandByObject( children[ i ], precise );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn point.x >= this.min.x && point.x <= this.max.x &&\n\t\t\tpoint.y >= this.min.y && point.y <= this.max.y &&\n\t\t\tpoint.z >= this.min.z && point.z <= this.max.z;\n\n\t}\n\n\tcontainsBox( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y &&\n\t\t\tthis.min.z <= box.min.z && box.max.z <= this.max.z;\n\n\t}\n\n\tgetParameter( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y ),\n\t\t\t( point.z - this.min.z ) / ( this.max.z - this.min.z )\n\t\t);\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\t// using 6 splitting planes to rule out intersections.\n\t\treturn box.max.x >= this.min.x && box.min.x <= this.max.x &&\n\t\t\tbox.max.y >= this.min.y && box.min.y <= this.max.y &&\n\t\t\tbox.max.z >= this.min.z && box.min.z <= this.max.z;\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\t// Find the point on the AABB closest to the sphere center.\n\t\tthis.clampPoint( sphere.center, _vector$b );\n\n\t\t// If that point is inside the sphere, the AABB and sphere intersect.\n\t\treturn _vector$b.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\t// We compute the minimum and maximum dot product values. If those values\n\t\t// are on the same side (back or front) of the plane, then there is no intersection.\n\n\t\tlet min, max;\n\n\t\tif ( plane.normal.x > 0 ) {\n\n\t\t\tmin = plane.normal.x * this.min.x;\n\t\t\tmax = plane.normal.x * this.max.x;\n\n\t\t} else {\n\n\t\t\tmin = plane.normal.x * this.max.x;\n\t\t\tmax = plane.normal.x * this.min.x;\n\n\t\t}\n\n\t\tif ( plane.normal.y > 0 ) {\n\n\t\t\tmin += plane.normal.y * this.min.y;\n\t\t\tmax += plane.normal.y * this.max.y;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.y * this.max.y;\n\t\t\tmax += plane.normal.y * this.min.y;\n\n\t\t}\n\n\t\tif ( plane.normal.z > 0 ) {\n\n\t\t\tmin += plane.normal.z * this.min.z;\n\t\t\tmax += plane.normal.z * this.max.z;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.z * this.max.z;\n\t\t\tmax += plane.normal.z * this.min.z;\n\n\t\t}\n\n\t\treturn ( min <= - plane.constant && max >= - plane.constant );\n\n\t}\n\n\tintersectsTriangle( triangle ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// compute box center and extents\n\t\tthis.getCenter( _center );\n\t\t_extents.subVectors( this.max, _center );\n\n\t\t// translate triangle to aabb origin\n\t\t_v0$3.subVectors( triangle.a, _center );\n\t\t_v1$7.subVectors( triangle.b, _center );\n\t\t_v2$4.subVectors( triangle.c, _center );\n\n\t\t// compute edge vectors for triangle\n\t\t_f0.subVectors( _v1$7, _v0$3 );\n\t\t_f1.subVectors( _v2$4, _v1$7 );\n\t\t_f2.subVectors( _v0$3, _v2$4 );\n\n\t\t// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb\n\t\t// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation\n\t\t// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)\n\t\tlet axes = [\n\t\t\t0, - _f0.z, _f0.y, 0, - _f1.z, _f1.y, 0, - _f2.z, _f2.y,\n\t\t\t_f0.z, 0, - _f0.x, _f1.z, 0, - _f1.x, _f2.z, 0, - _f2.x,\n\t\t\t- _f0.y, _f0.x, 0, - _f1.y, _f1.x, 0, - _f2.y, _f2.x, 0\n\t\t];\n\t\tif ( ! satForAxes( axes, _v0$3, _v1$7, _v2$4, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// test 3 face normals from the aabb\n\t\taxes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];\n\t\tif ( ! satForAxes( axes, _v0$3, _v1$7, _v2$4, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// finally testing the face normal of the triangle\n\t\t// use already existing triangle edge vectors here\n\t\t_triangleNormal.crossVectors( _f0, _f1 );\n\t\taxes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ];\n\n\t\treturn satForAxes( axes, _v0$3, _v1$7, _v2$4, _extents );\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.clampPoint( point, _vector$b ).distanceTo( point );\n\n\t}\n\n\tgetBoundingSphere( target ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\ttarget.makeEmpty();\n\n\t\t} else {\n\n\t\t\tthis.getCenter( target.center );\n\n\t\t\ttarget.radius = this.getSize( _vector$b ).length() * 0.5;\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tintersect( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\t// ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.\n\t\tif ( this.isEmpty() ) this.makeEmpty();\n\n\t\treturn this;\n\n\t}\n\n\tunion( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\t// transform of empty box is an empty box.\n\t\tif ( this.isEmpty() ) return this;\n\n\t\t// NOTE: I am using a binary pattern to specify all 2^3 combinations below\n\t\t_points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000\n\t\t_points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001\n\t\t_points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010\n\t\t_points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011\n\t\t_points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100\n\t\t_points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101\n\t\t_points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110\n\t\t_points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111\n\n\t\tthis.setFromPoints( _points );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\tequals( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n}\n\nconst _points = [\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3()\n];\n\nconst _vector$b = /*@__PURE__*/ new Vector3();\n\nconst _box$4 = /*@__PURE__*/ new Box3();\n\n// triangle centered vertices\n\nconst _v0$3 = /*@__PURE__*/ new Vector3();\nconst _v1$7 = /*@__PURE__*/ new Vector3();\nconst _v2$4 = /*@__PURE__*/ new Vector3();\n\n// triangle edge vectors\n\nconst _f0 = /*@__PURE__*/ new Vector3();\nconst _f1 = /*@__PURE__*/ new Vector3();\nconst _f2 = /*@__PURE__*/ new Vector3();\n\nconst _center = /*@__PURE__*/ new Vector3();\nconst _extents = /*@__PURE__*/ new Vector3();\nconst _triangleNormal = /*@__PURE__*/ new Vector3();\nconst _testAxis = /*@__PURE__*/ new Vector3();\n\nfunction satForAxes( axes, v0, v1, v2, extents ) {\n\n\tfor ( let i = 0, j = axes.length - 3; i <= j; i += 3 ) {\n\n\t\t_testAxis.fromArray( axes, i );\n\t\t// project the aabb onto the separating axis\n\t\tconst r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z );\n\t\t// project all 3 vertices of the triangle onto the separating axis\n\t\tconst p0 = v0.dot( _testAxis );\n\t\tconst p1 = v1.dot( _testAxis );\n\t\tconst p2 = v2.dot( _testAxis );\n\t\t// actual test, basically see if either of the most extreme of the triangle points intersects r\n\t\tif ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {\n\n\t\t\t// points of the projected triangle are outside the projected half-length of the aabb\n\t\t\t// the axis is separating and we can exit\n\t\t\treturn false;\n\n\t\t}\n\n\t}\n\n\treturn true;\n\n}\n\nconst _box$3 = /*@__PURE__*/ new Box3();\nconst _v1$6 = /*@__PURE__*/ new Vector3();\nconst _v2$3 = /*@__PURE__*/ new Vector3();\n\nclass Sphere {\n\n\tconstructor( center = new Vector3(), radius = - 1 ) {\n\n\t\tthis.isSphere = true;\n\n\t\tthis.center = center;\n\t\tthis.radius = radius;\n\n\t}\n\n\tset( center, radius ) {\n\n\t\tthis.center.copy( center );\n\t\tthis.radius = radius;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points, optionalCenter ) {\n\n\t\tconst center = this.center;\n\n\t\tif ( optionalCenter !== undefined ) {\n\n\t\t\tcenter.copy( optionalCenter );\n\n\t\t} else {\n\n\t\t\t_box$3.setFromPoints( points ).getCenter( center );\n\n\t\t}\n\n\t\tlet maxRadiusSq = 0;\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );\n\n\t\t}\n\n\t\tthis.radius = Math.sqrt( maxRadiusSq );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( sphere ) {\n\n\t\tthis.center.copy( sphere.center );\n\t\tthis.radius = sphere.radius;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\treturn ( this.radius < 0 );\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.center.set( 0, 0, 0 );\n\t\tthis.radius = - 1;\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn ( point.distanceTo( this.center ) - this.radius );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\tconst radiusSum = this.radius + sphere.radius;\n\n\t\treturn sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsSphere( this );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\treturn Math.abs( plane.distanceToPoint( this.center ) ) <= this.radius;\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\tconst deltaLengthSq = this.center.distanceToSquared( point );\n\n\t\ttarget.copy( point );\n\n\t\tif ( deltaLengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\ttarget.sub( this.center ).normalize();\n\t\t\ttarget.multiplyScalar( this.radius ).add( this.center );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\t// Empty sphere produces empty bounding box\n\t\t\ttarget.makeEmpty();\n\t\t\treturn target;\n\n\t\t}\n\n\t\ttarget.set( this.center, this.center );\n\t\ttarget.expandByScalar( this.radius );\n\n\t\treturn target;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tthis.center.applyMatrix4( matrix );\n\t\tthis.radius = this.radius * matrix.getMaxScaleOnAxis();\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.center.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\tthis.center.copy( point );\n\n\t\t\tthis.radius = 0;\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\t_v1$6.subVectors( point, this.center );\n\n\t\tconst lengthSq = _v1$6.lengthSq();\n\n\t\tif ( lengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\t// calculate the minimal sphere\n\n\t\t\tconst length = Math.sqrt( lengthSq );\n\n\t\t\tconst delta = ( length - this.radius ) * 0.5;\n\n\t\t\tthis.center.addScaledVector( _v1$6, delta / length );\n\n\t\t\tthis.radius += delta;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tunion( sphere ) {\n\n\t\tif ( sphere.isEmpty() ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\tthis.copy( sphere );\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( this.center.equals( sphere.center ) === true ) {\n\n\t\t\t this.radius = Math.max( this.radius, sphere.radius );\n\n\t\t} else {\n\n\t\t\t_v2$3.subVectors( sphere.center, this.center ).setLength( sphere.radius );\n\n\t\t\tthis.expandByPoint( _v1$6.copy( sphere.center ).add( _v2$3 ) );\n\n\t\t\tthis.expandByPoint( _v1$6.copy( sphere.center ).sub( _v2$3 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tequals( sphere ) {\n\n\t\treturn sphere.center.equals( this.center ) && ( sphere.radius === this.radius );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$a = /*@__PURE__*/ new Vector3();\nconst _segCenter = /*@__PURE__*/ new Vector3();\nconst _segDir = /*@__PURE__*/ new Vector3();\nconst _diff = /*@__PURE__*/ new Vector3();\n\nconst _edge1 = /*@__PURE__*/ new Vector3();\nconst _edge2 = /*@__PURE__*/ new Vector3();\nconst _normal$1 = /*@__PURE__*/ new Vector3();\n\nclass Ray {\n\n\tconstructor( origin = new Vector3(), direction = new Vector3( 0, 0, - 1 ) ) {\n\n\t\tthis.origin = origin;\n\t\tthis.direction = direction;\n\n\t}\n\n\tset( origin, direction ) {\n\n\t\tthis.origin.copy( origin );\n\t\tthis.direction.copy( direction );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( ray ) {\n\n\t\tthis.origin.copy( ray.origin );\n\t\tthis.direction.copy( ray.direction );\n\n\t\treturn this;\n\n\t}\n\n\tat( t, target ) {\n\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, t );\n\n\t}\n\n\tlookAt( v ) {\n\n\t\tthis.direction.copy( v ).sub( this.origin ).normalize();\n\n\t\treturn this;\n\n\t}\n\n\trecast( t ) {\n\n\t\tthis.origin.copy( this.at( t, _vector$a ) );\n\n\t\treturn this;\n\n\t}\n\n\tclosestPointToPoint( point, target ) {\n\n\t\ttarget.subVectors( point, this.origin );\n\n\t\tconst directionDistance = target.dot( this.direction );\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn target.copy( this.origin );\n\n\t\t}\n\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn Math.sqrt( this.distanceSqToPoint( point ) );\n\n\t}\n\n\tdistanceSqToPoint( point ) {\n\n\t\tconst directionDistance = _vector$a.subVectors( point, this.origin ).dot( this.direction );\n\n\t\t// point behind the ray\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn this.origin.distanceToSquared( point );\n\n\t\t}\n\n\t\t_vector$a.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t\treturn _vector$a.distanceToSquared( point );\n\n\t}\n\n\tdistanceSqToSegment( v0, v1, optionalPointOnRay, optionalPointOnSegment ) {\n\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h\n\t\t// It returns the min distance between the ray and the segment\n\t\t// defined by v0 and v1\n\t\t// It can also set two optional targets :\n\t\t// - The closest point on the ray\n\t\t// - The closest point on the segment\n\n\t\t_segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 );\n\t\t_segDir.copy( v1 ).sub( v0 ).normalize();\n\t\t_diff.copy( this.origin ).sub( _segCenter );\n\n\t\tconst segExtent = v0.distanceTo( v1 ) * 0.5;\n\t\tconst a01 = - this.direction.dot( _segDir );\n\t\tconst b0 = _diff.dot( this.direction );\n\t\tconst b1 = - _diff.dot( _segDir );\n\t\tconst c = _diff.lengthSq();\n\t\tconst det = Math.abs( 1 - a01 * a01 );\n\t\tlet s0, s1, sqrDist, extDet;\n\n\t\tif ( det > 0 ) {\n\n\t\t\t// The ray and segment are not parallel.\n\n\t\t\ts0 = a01 * b1 - b0;\n\t\t\ts1 = a01 * b0 - b1;\n\t\t\textDet = segExtent * det;\n\n\t\t\tif ( s0 >= 0 ) {\n\n\t\t\t\tif ( s1 >= - extDet ) {\n\n\t\t\t\t\tif ( s1 <= extDet ) {\n\n\t\t\t\t\t\t// region 0\n\t\t\t\t\t\t// Minimum at interior points of ray and segment.\n\n\t\t\t\t\t\tconst invDet = 1 / det;\n\t\t\t\t\t\ts0 *= invDet;\n\t\t\t\t\t\ts1 *= invDet;\n\t\t\t\t\t\tsqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// region 1\n\n\t\t\t\t\t\ts1 = segExtent;\n\t\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 5\n\n\t\t\t\t\ts1 = - segExtent;\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( s1 <= - extDet ) {\n\n\t\t\t\t\t// region 4\n\n\t\t\t\t\ts0 = Math.max( 0, - ( - a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else if ( s1 <= extDet ) {\n\n\t\t\t\t\t// region 3\n\n\t\t\t\t\ts0 = 0;\n\t\t\t\t\ts1 = Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 2\n\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// Ray and segment are parallel.\n\n\t\t\ts1 = ( a01 > 0 ) ? - segExtent : segExtent;\n\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t}\n\n\t\tif ( optionalPointOnRay ) {\n\n\t\t\toptionalPointOnRay.copy( this.origin ).addScaledVector( this.direction, s0 );\n\n\t\t}\n\n\t\tif ( optionalPointOnSegment ) {\n\n\t\t\toptionalPointOnSegment.copy( _segCenter ).addScaledVector( _segDir, s1 );\n\n\t\t}\n\n\t\treturn sqrDist;\n\n\t}\n\n\tintersectSphere( sphere, target ) {\n\n\t\t_vector$a.subVectors( sphere.center, this.origin );\n\t\tconst tca = _vector$a.dot( this.direction );\n\t\tconst d2 = _vector$a.dot( _vector$a ) - tca * tca;\n\t\tconst radius2 = sphere.radius * sphere.radius;\n\n\t\tif ( d2 > radius2 ) return null;\n\n\t\tconst thc = Math.sqrt( radius2 - d2 );\n\n\t\t// t0 = first intersect point - entrance on front of sphere\n\t\tconst t0 = tca - thc;\n\n\t\t// t1 = second intersect point - exit point on back of sphere\n\t\tconst t1 = tca + thc;\n\n\t\t// test to see if t1 is behind the ray - if so, return null\n\t\tif ( t1 < 0 ) return null;\n\n\t\t// test to see if t0 is behind the ray:\n\t\t// if it is, the ray is inside the sphere, so return the second exit point scaled by t1,\n\t\t// in order to always return an intersect point that is in front of the ray.\n\t\tif ( t0 < 0 ) return this.at( t1, target );\n\n\t\t// else t0 is in front of the ray, so return the first collision point scaled by t0\n\t\treturn this.at( t0, target );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\tdistanceToPlane( plane ) {\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( plane.distanceToPoint( this.origin ) === 0 ) {\n\n\t\t\t\treturn 0;\n\n\t\t\t}\n\n\t\t\t// Null is preferable to undefined since undefined means.... it is undefined\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator;\n\n\t\t// Return if the ray never intersects the plane\n\n\t\treturn t >= 0 ? t : null;\n\n\t}\n\n\tintersectPlane( plane, target ) {\n\n\t\tconst t = this.distanceToPlane( plane );\n\n\t\tif ( t === null ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn this.at( t, target );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\t// check if the ray lies on the plane first\n\n\t\tconst distToPoint = plane.distanceToPoint( this.origin );\n\n\t\tif ( distToPoint === 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator * distToPoint < 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\t// ray origin is behind the plane (and is pointing behind it)\n\n\t\treturn false;\n\n\t}\n\n\tintersectBox( box, target ) {\n\n\t\tlet tmin, tmax, tymin, tymax, tzmin, tzmax;\n\n\t\tconst invdirx = 1 / this.direction.x,\n\t\t\tinvdiry = 1 / this.direction.y,\n\t\t\tinvdirz = 1 / this.direction.z;\n\n\t\tconst origin = this.origin;\n\n\t\tif ( invdirx >= 0 ) {\n\n\t\t\ttmin = ( box.min.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.max.x - origin.x ) * invdirx;\n\n\t\t} else {\n\n\t\t\ttmin = ( box.max.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.min.x - origin.x ) * invdirx;\n\n\t\t}\n\n\t\tif ( invdiry >= 0 ) {\n\n\t\t\ttymin = ( box.min.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.max.y - origin.y ) * invdiry;\n\n\t\t} else {\n\n\t\t\ttymin = ( box.max.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.min.y - origin.y ) * invdiry;\n\n\t\t}\n\n\t\tif ( ( tmin > tymax ) || ( tymin > tmax ) ) return null;\n\n\t\tif ( tymin > tmin || isNaN( tmin ) ) tmin = tymin;\n\n\t\tif ( tymax < tmax || isNaN( tmax ) ) tmax = tymax;\n\n\t\tif ( invdirz >= 0 ) {\n\n\t\t\ttzmin = ( box.min.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.max.z - origin.z ) * invdirz;\n\n\t\t} else {\n\n\t\t\ttzmin = ( box.max.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.min.z - origin.z ) * invdirz;\n\n\t\t}\n\n\t\tif ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null;\n\n\t\tif ( tzmin > tmin || tmin !== tmin ) tmin = tzmin;\n\n\t\tif ( tzmax < tmax || tmax !== tmax ) tmax = tzmax;\n\n\t\t//return point closest to the ray (positive side)\n\n\t\tif ( tmax < 0 ) return null;\n\n\t\treturn this.at( tmin >= 0 ? tmin : tmax, target );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn this.intersectBox( box, _vector$a ) !== null;\n\n\t}\n\n\tintersectTriangle( a, b, c, backfaceCulling, target ) {\n\n\t\t// Compute the offset origin, edges, and normal.\n\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h\n\n\t\t_edge1.subVectors( b, a );\n\t\t_edge2.subVectors( c, a );\n\t\t_normal$1.crossVectors( _edge1, _edge2 );\n\n\t\t// Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,\n\t\t// E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by\n\t\t// |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))\n\t\t// |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))\n\t\t// |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)\n\t\tlet DdN = this.direction.dot( _normal$1 );\n\t\tlet sign;\n\n\t\tif ( DdN > 0 ) {\n\n\t\t\tif ( backfaceCulling ) return null;\n\t\t\tsign = 1;\n\n\t\t} else if ( DdN < 0 ) {\n\n\t\t\tsign = - 1;\n\t\t\tDdN = - DdN;\n\n\t\t} else {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t_diff.subVectors( this.origin, a );\n\t\tconst DdQxE2 = sign * this.direction.dot( _edge2.crossVectors( _diff, _edge2 ) );\n\n\t\t// b1 < 0, no intersection\n\t\tif ( DdQxE2 < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst DdE1xQ = sign * this.direction.dot( _edge1.cross( _diff ) );\n\n\t\t// b2 < 0, no intersection\n\t\tif ( DdE1xQ < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// b1+b2 > 1, no intersection\n\t\tif ( DdQxE2 + DdE1xQ > DdN ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Line intersects triangle, check if ray does.\n\t\tconst QdN = - sign * _diff.dot( _normal$1 );\n\n\t\t// t < 0, no intersection\n\t\tif ( QdN < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Ray intersects triangle.\n\t\treturn this.at( QdN / DdN, target );\n\n\t}\n\n\tapplyMatrix4( matrix4 ) {\n\n\t\tthis.origin.applyMatrix4( matrix4 );\n\t\tthis.direction.transformDirection( matrix4 );\n\n\t\treturn this;\n\n\t}\n\n\tequals( ray ) {\n\n\t\treturn ray.origin.equals( this.origin ) && ray.direction.equals( this.direction );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass Matrix4 {\n\n\tconstructor( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\tMatrix4.prototype.isMatrix4 = true;\n\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 );\n\n\t\t}\n\n\t}\n\n\tset( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;\n\t\tte[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;\n\t\tte[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;\n\t\tte[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Matrix4().fromArray( this.elements );\n\n\t}\n\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; te[ 3 ] = me[ 3 ];\n\t\tte[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ];\n\t\tte[ 8 ] = me[ 8 ]; te[ 9 ] = me[ 9 ]; te[ 10 ] = me[ 10 ]; te[ 11 ] = me[ 11 ];\n\t\tte[ 12 ] = me[ 12 ]; te[ 13 ] = me[ 13 ]; te[ 14 ] = me[ 14 ]; te[ 15 ] = me[ 15 ];\n\n\t\treturn this;\n\n\t}\n\n\tcopyPosition( m ) {\n\n\t\tconst te = this.elements, me = m.elements;\n\n\t\tte[ 12 ] = me[ 12 ];\n\t\tte[ 13 ] = me[ 13 ];\n\t\tte[ 14 ] = me[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrix3( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 3 ], me[ 6 ], 0,\n\t\t\tme[ 1 ], me[ 4 ], me[ 7 ], 0,\n\t\t\tme[ 2 ], me[ 5 ], me[ 8 ], 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrixColumn( this, 0 );\n\t\tyAxis.setFromMatrixColumn( this, 1 );\n\t\tzAxis.setFromMatrixColumn( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\tmakeBasis( xAxis, yAxis, zAxis ) {\n\n\t\tthis.set(\n\t\t\txAxis.x, yAxis.x, zAxis.x, 0,\n\t\t\txAxis.y, yAxis.y, zAxis.y, 0,\n\t\t\txAxis.z, yAxis.z, zAxis.z, 0,\n\t\t\t0, 0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\textractRotation( m ) {\n\n\t\t// this method does not support reflection matrices\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tconst scaleX = 1 / _v1$5.setFromMatrixColumn( m, 0 ).length();\n\t\tconst scaleY = 1 / _v1$5.setFromMatrixColumn( m, 1 ).length();\n\t\tconst scaleZ = 1 / _v1$5.setFromMatrixColumn( m, 2 ).length();\n\n\t\tte[ 0 ] = me[ 0 ] * scaleX;\n\t\tte[ 1 ] = me[ 1 ] * scaleX;\n\t\tte[ 2 ] = me[ 2 ] * scaleX;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = me[ 4 ] * scaleY;\n\t\tte[ 5 ] = me[ 5 ] * scaleY;\n\t\tte[ 6 ] = me[ 6 ] * scaleY;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = me[ 8 ] * scaleZ;\n\t\tte[ 9 ] = me[ 9 ] * scaleZ;\n\t\tte[ 10 ] = me[ 10 ] * scaleZ;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationFromEuler( euler ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = euler.x, y = euler.y, z = euler.z;\n\t\tconst a = Math.cos( x ), b = Math.sin( x );\n\t\tconst c = Math.cos( y ), d = Math.sin( y );\n\t\tconst e = Math.cos( z ), f = Math.sin( z );\n\n\t\tif ( euler.order === 'XYZ' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - c * f;\n\t\t\tte[ 8 ] = d;\n\n\t\t\tte[ 1 ] = af + be * d;\n\t\t\tte[ 5 ] = ae - bf * d;\n\t\t\tte[ 9 ] = - b * c;\n\n\t\t\tte[ 2 ] = bf - ae * d;\n\t\t\tte[ 6 ] = be + af * d;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YXZ' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce + df * b;\n\t\t\tte[ 4 ] = de * b - cf;\n\t\t\tte[ 8 ] = a * d;\n\n\t\t\tte[ 1 ] = a * f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b;\n\n\t\t\tte[ 2 ] = cf * b - de;\n\t\t\tte[ 6 ] = df + ce * b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZXY' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce - df * b;\n\t\t\tte[ 4 ] = - a * f;\n\t\t\tte[ 8 ] = de + cf * b;\n\n\t\t\tte[ 1 ] = cf + de * b;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = df - ce * b;\n\n\t\t\tte[ 2 ] = - a * d;\n\t\t\tte[ 6 ] = b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZYX' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = be * d - af;\n\t\t\tte[ 8 ] = ae * d + bf;\n\n\t\t\tte[ 1 ] = c * f;\n\t\t\tte[ 5 ] = bf * d + ae;\n\t\t\tte[ 9 ] = af * d - be;\n\n\t\t\tte[ 2 ] = - d;\n\t\t\tte[ 6 ] = b * c;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YZX' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = bd - ac * f;\n\t\t\tte[ 8 ] = bc * f + ad;\n\n\t\t\tte[ 1 ] = f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b * e;\n\n\t\t\tte[ 2 ] = - d * e;\n\t\t\tte[ 6 ] = ad * f + bc;\n\t\t\tte[ 10 ] = ac - bd * f;\n\n\t\t} else if ( euler.order === 'XZY' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - f;\n\t\t\tte[ 8 ] = d * e;\n\n\t\t\tte[ 1 ] = ac * f + bd;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = ad * f - bc;\n\n\t\t\tte[ 2 ] = bc * f - ad;\n\t\t\tte[ 6 ] = b * e;\n\t\t\tte[ 10 ] = bd * f + ac;\n\n\t\t}\n\n\t\t// bottom row\n\t\tte[ 3 ] = 0;\n\t\tte[ 7 ] = 0;\n\t\tte[ 11 ] = 0;\n\n\t\t// last column\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationFromQuaternion( q ) {\n\n\t\treturn this.compose( _zero, q, _one );\n\n\t}\n\n\tlookAt( eye, target, up ) {\n\n\t\tconst te = this.elements;\n\n\t\t_z.subVectors( eye, target );\n\n\t\tif ( _z.lengthSq() === 0 ) {\n\n\t\t\t// eye and target are in the same position\n\n\t\t\t_z.z = 1;\n\n\t\t}\n\n\t\t_z.normalize();\n\t\t_x.crossVectors( up, _z );\n\n\t\tif ( _x.lengthSq() === 0 ) {\n\n\t\t\t// up and z are parallel\n\n\t\t\tif ( Math.abs( up.z ) === 1 ) {\n\n\t\t\t\t_z.x += 0.0001;\n\n\t\t\t} else {\n\n\t\t\t\t_z.z += 0.0001;\n\n\t\t\t}\n\n\t\t\t_z.normalize();\n\t\t\t_x.crossVectors( up, _z );\n\n\t\t}\n\n\t\t_x.normalize();\n\t\t_y.crossVectors( _z, _x );\n\n\t\tte[ 0 ] = _x.x; te[ 4 ] = _y.x; te[ 8 ] = _z.x;\n\t\tte[ 1 ] = _x.y; te[ 5 ] = _y.y; te[ 9 ] = _z.y;\n\t\tte[ 2 ] = _x.z; te[ 6 ] = _y.z; te[ 10 ] = _z.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];\n\t\tconst a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];\n\t\tconst b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;\n\t\tte[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;\n\t\tte[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;\n\t\tte[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;\n\t\tte[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;\n\t\tte[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;\n\t\tte[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;\n\t\tte[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;\n\t\tte[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;\n\t\tte[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;\n\n\t\tte[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;\n\t\tte[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;\n\t\tte[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;\n\t\tte[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;\n\t\tte[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;\n\t\tte[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;\n\t\tte[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];\n\t\tconst n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];\n\t\tconst n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];\n\t\tconst n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];\n\n\t\t//TODO: make this more efficient\n\t\t//( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )\n\n\t\treturn (\n\t\t\tn41 * (\n\t\t\t\t+ n14 * n23 * n32\n\t\t\t\t - n13 * n24 * n32\n\t\t\t\t - n14 * n22 * n33\n\t\t\t\t + n12 * n24 * n33\n\t\t\t\t + n13 * n22 * n34\n\t\t\t\t - n12 * n23 * n34\n\t\t\t) +\n\t\t\tn42 * (\n\t\t\t\t+ n11 * n23 * n34\n\t\t\t\t - n11 * n24 * n33\n\t\t\t\t + n14 * n21 * n33\n\t\t\t\t - n13 * n21 * n34\n\t\t\t\t + n13 * n24 * n31\n\t\t\t\t - n14 * n23 * n31\n\t\t\t) +\n\t\t\tn43 * (\n\t\t\t\t+ n11 * n24 * n32\n\t\t\t\t - n11 * n22 * n34\n\t\t\t\t - n14 * n21 * n32\n\t\t\t\t + n12 * n21 * n34\n\t\t\t\t + n14 * n22 * n31\n\t\t\t\t - n12 * n24 * n31\n\t\t\t) +\n\t\t\tn44 * (\n\t\t\t\t- n13 * n22 * n31\n\t\t\t\t - n11 * n23 * n32\n\t\t\t\t + n11 * n22 * n33\n\t\t\t\t + n13 * n21 * n32\n\t\t\t\t - n12 * n21 * n33\n\t\t\t\t + n12 * n23 * n31\n\t\t\t)\n\n\t\t);\n\n\t}\n\n\ttranspose() {\n\n\t\tconst te = this.elements;\n\t\tlet tmp;\n\n\t\ttmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;\n\t\ttmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;\n\t\ttmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;\n\n\t\ttmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;\n\t\ttmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;\n\t\ttmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\tsetPosition( x, y, z ) {\n\n\t\tconst te = this.elements;\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tte[ 12 ] = x.x;\n\t\t\tte[ 13 ] = x.y;\n\t\t\tte[ 14 ] = x.z;\n\n\t\t} else {\n\n\t\t\tte[ 12 ] = x;\n\t\t\tte[ 13 ] = y;\n\t\t\tte[ 14 ] = z;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tinvert() {\n\n\t\t// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ], n41 = te[ 3 ],\n\t\t\tn12 = te[ 4 ], n22 = te[ 5 ], n32 = te[ 6 ], n42 = te[ 7 ],\n\t\t\tn13 = te[ 8 ], n23 = te[ 9 ], n33 = te[ 10 ], n43 = te[ 11 ],\n\t\t\tn14 = te[ 12 ], n24 = te[ 13 ], n34 = te[ 14 ], n44 = te[ 15 ],\n\n\t\t\tt11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,\n\t\t\tt12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,\n\t\t\tt13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,\n\t\t\tt14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;\n\n\t\tconst det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44 ) * detInv;\n\t\tte[ 2 ] = ( n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44 ) * detInv;\n\t\tte[ 3 ] = ( n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43 ) * detInv;\n\n\t\tte[ 4 ] = t12 * detInv;\n\t\tte[ 5 ] = ( n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44 ) * detInv;\n\t\tte[ 6 ] = ( n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44 ) * detInv;\n\t\tte[ 7 ] = ( n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43 ) * detInv;\n\n\t\tte[ 8 ] = t13 * detInv;\n\t\tte[ 9 ] = ( n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44 ) * detInv;\n\t\tte[ 10 ] = ( n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44 ) * detInv;\n\t\tte[ 11 ] = ( n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43 ) * detInv;\n\n\t\tte[ 12 ] = t14 * detInv;\n\t\tte[ 13 ] = ( n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34 ) * detInv;\n\t\tte[ 14 ] = ( n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34 ) * detInv;\n\t\tte[ 15 ] = ( n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\tscale( v ) {\n\n\t\tconst te = this.elements;\n\t\tconst x = v.x, y = v.y, z = v.z;\n\n\t\tte[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;\n\t\tte[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;\n\t\tte[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;\n\t\tte[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;\n\n\t\treturn this;\n\n\t}\n\n\tgetMaxScaleOnAxis() {\n\n\t\tconst te = this.elements;\n\n\t\tconst scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];\n\t\tconst scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];\n\t\tconst scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];\n\n\t\treturn Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) );\n\n\t}\n\n\tmakeTranslation( x, y, z ) {\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, 0, x.x,\n\t\t\t\t0, 1, 0, x.y,\n\t\t\t\t0, 0, 1, x.z,\n\t\t\t\t0, 0, 0, 1\n\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, 0, x,\n\t\t\t\t0, 1, 0, y,\n\t\t\t\t0, 0, 1, z,\n\t\t\t\t0, 0, 0, 1\n\n\t\t\t);\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationX( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, c, - s, 0,\n\t\t\t0, s, c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationY( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t c, 0, s, 0,\n\t\t\t 0, 1, 0, 0,\n\t\t\t- s, 0, c, 0,\n\t\t\t 0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationZ( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0, 0,\n\t\t\ts, c, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationAxis( axis, angle ) {\n\n\t\t// Based on http://www.gamedev.net/reference/articles/article1199.asp\n\n\t\tconst c = Math.cos( angle );\n\t\tconst s = Math.sin( angle );\n\t\tconst t = 1 - c;\n\t\tconst x = axis.x, y = axis.y, z = axis.z;\n\t\tconst tx = t * x, ty = t * y;\n\n\t\tthis.set(\n\n\t\t\ttx * x + c, tx * y - s * z, tx * z + s * y, 0,\n\t\t\ttx * y + s * z, ty * y + c, ty * z - s * x, 0,\n\t\t\ttx * z - s * y, ty * z + s * x, t * z * z + c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeScale( x, y, z ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0, 0,\n\t\t\t0, y, 0, 0,\n\t\t\t0, 0, z, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeShear( xy, xz, yx, yz, zx, zy ) {\n\n\t\tthis.set(\n\n\t\t\t1, yx, zx, 0,\n\t\t\txy, 1, zy, 0,\n\t\t\txz, yz, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tcompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;\n\t\tconst x2 = x + x,\ty2 = y + y, z2 = z + z;\n\t\tconst xx = x * x2, xy = x * y2, xz = x * z2;\n\t\tconst yy = y * y2, yz = y * z2, zz = z * z2;\n\t\tconst wx = w * x2, wy = w * y2, wz = w * z2;\n\n\t\tconst sx = scale.x, sy = scale.y, sz = scale.z;\n\n\t\tte[ 0 ] = ( 1 - ( yy + zz ) ) * sx;\n\t\tte[ 1 ] = ( xy + wz ) * sx;\n\t\tte[ 2 ] = ( xz - wy ) * sx;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = ( xy - wz ) * sy;\n\t\tte[ 5 ] = ( 1 - ( xx + zz ) ) * sy;\n\t\tte[ 6 ] = ( yz + wx ) * sy;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = ( xz + wy ) * sz;\n\t\tte[ 9 ] = ( yz - wx ) * sz;\n\t\tte[ 10 ] = ( 1 - ( xx + yy ) ) * sz;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = position.x;\n\t\tte[ 13 ] = position.y;\n\t\tte[ 14 ] = position.z;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tdecompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tlet sx = _v1$5.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();\n\t\tconst sy = _v1$5.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();\n\t\tconst sz = _v1$5.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();\n\n\t\t// if determine is negative, we need to invert one scale\n\t\tconst det = this.determinant();\n\t\tif ( det < 0 ) sx = - sx;\n\n\t\tposition.x = te[ 12 ];\n\t\tposition.y = te[ 13 ];\n\t\tposition.z = te[ 14 ];\n\n\t\t// scale the rotation part\n\t\t_m1$4.copy( this );\n\n\t\tconst invSX = 1 / sx;\n\t\tconst invSY = 1 / sy;\n\t\tconst invSZ = 1 / sz;\n\n\t\t_m1$4.elements[ 0 ] *= invSX;\n\t\t_m1$4.elements[ 1 ] *= invSX;\n\t\t_m1$4.elements[ 2 ] *= invSX;\n\n\t\t_m1$4.elements[ 4 ] *= invSY;\n\t\t_m1$4.elements[ 5 ] *= invSY;\n\t\t_m1$4.elements[ 6 ] *= invSY;\n\n\t\t_m1$4.elements[ 8 ] *= invSZ;\n\t\t_m1$4.elements[ 9 ] *= invSZ;\n\t\t_m1$4.elements[ 10 ] *= invSZ;\n\n\t\tquaternion.setFromRotationMatrix( _m1$4 );\n\n\t\tscale.x = sx;\n\t\tscale.y = sy;\n\t\tscale.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\tmakePerspective( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst te = this.elements;\n\t\tconst x = 2 * near / ( right - left );\n\t\tconst y = 2 * near / ( top - bottom );\n\n\t\tconst a = ( right + left ) / ( right - left );\n\t\tconst b = ( top + bottom ) / ( top - bottom );\n\n\t\tlet c, d;\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tc = - ( far + near ) / ( far - near );\n\t\t\td = ( - 2 * far * near ) / ( far - near );\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tc = - far / ( far - near );\n\t\t\td = ( - far * near ) / ( far - near );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Matrix4.makePerspective(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tte[ 0 ] = x;\tte[ 4 ] = 0;\tte[ 8 ] = a; \tte[ 12 ] = 0;\n\t\tte[ 1 ] = 0;\tte[ 5 ] = y;\tte[ 9 ] = b; \tte[ 13 ] = 0;\n\t\tte[ 2 ] = 0;\tte[ 6 ] = 0;\tte[ 10 ] = c; \tte[ 14 ] = d;\n\t\tte[ 3 ] = 0;\tte[ 7 ] = 0;\tte[ 11 ] = - 1;\tte[ 15 ] = 0;\n\n\t\treturn this;\n\n\t}\n\n\tmakeOrthographic( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst te = this.elements;\n\t\tconst w = 1.0 / ( right - left );\n\t\tconst h = 1.0 / ( top - bottom );\n\t\tconst p = 1.0 / ( far - near );\n\n\t\tconst x = ( right + left ) * w;\n\t\tconst y = ( top + bottom ) * h;\n\n\t\tlet z, zInv;\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tz = ( far + near ) * p;\n\t\t\tzInv = - 2 * p;\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tz = near * p;\n\t\t\tzInv = - 1 * p;\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tte[ 0 ] = 2 * w;\tte[ 4 ] = 0;\t\tte[ 8 ] = 0; \t\tte[ 12 ] = - x;\n\t\tte[ 1 ] = 0; \t\tte[ 5 ] = 2 * h;\tte[ 9 ] = 0; \t\tte[ 13 ] = - y;\n\t\tte[ 2 ] = 0; \t\tte[ 6 ] = 0;\t\tte[ 10 ] = zInv;\tte[ 14 ] = - z;\n\t\tte[ 3 ] = 0; \t\tte[ 7 ] = 0;\t\tte[ 11 ] = 0;\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\t\tarray[ offset + 9 ] = te[ 9 ];\n\t\tarray[ offset + 10 ] = te[ 10 ];\n\t\tarray[ offset + 11 ] = te[ 11 ];\n\n\t\tarray[ offset + 12 ] = te[ 12 ];\n\t\tarray[ offset + 13 ] = te[ 13 ];\n\t\tarray[ offset + 14 ] = te[ 14 ];\n\t\tarray[ offset + 15 ] = te[ 15 ];\n\n\t\treturn array;\n\n\t}\n\n}\n\nconst _v1$5 = /*@__PURE__*/ new Vector3();\nconst _m1$4 = /*@__PURE__*/ new Matrix4();\nconst _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );\nconst _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );\nconst _x = /*@__PURE__*/ new Vector3();\nconst _y = /*@__PURE__*/ new Vector3();\nconst _z = /*@__PURE__*/ new Vector3();\n\nconst _matrix$2 = /*@__PURE__*/ new Matrix4();\nconst _quaternion$3 = /*@__PURE__*/ new Quaternion();\n\nclass Euler {\n\n\tconstructor( x = 0, y = 0, z = 0, order = Euler.DEFAULT_ORDER ) {\n\n\t\tthis.isEuler = true;\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t}\n\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget order() {\n\n\t\treturn this._order;\n\n\t}\n\n\tset order( value ) {\n\n\t\tthis._order = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tset( x, y, z, order = this._order ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._order );\n\n\t}\n\n\tcopy( euler ) {\n\n\t\tthis._x = euler._x;\n\t\tthis._y = euler._y;\n\t\tthis._z = euler._z;\n\t\tthis._order = euler._order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromRotationMatrix( m, order = this._order, update = true ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tconst te = m.elements;\n\t\tconst m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ];\n\t\tconst m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ];\n\t\tconst m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\n\t\t\t\tthis._y = Math.asin( clamp( m13, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m13 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\n\t\t\t\tthis._x = Math.asin( - clamp( m23, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m23 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\n\t\t\t\tthis._x = Math.asin( clamp( m32, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m32 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = 0;\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\n\t\t\t\tthis._y = Math.asin( - clamp( m31, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m31 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\n\t\t\t\tthis._z = Math.asin( clamp( m21, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m21 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m22 );\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\n\t\t\t\tthis._z = Math.asin( - clamp( m12, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m12 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._y = Math.atan2( m13, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._y = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tconsole.warn( 'THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tthis._order = order;\n\n\t\tif ( update === true ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromQuaternion( q, order, update ) {\n\n\t\t_matrix$2.makeRotationFromQuaternion( q );\n\n\t\treturn this.setFromRotationMatrix( _matrix$2, order, update );\n\n\t}\n\n\tsetFromVector3( v, order = this._order ) {\n\n\t\treturn this.set( v.x, v.y, v.z, order );\n\n\t}\n\n\treorder( newOrder ) {\n\n\t\t// WARNING: this discards revolution information -bhouston\n\n\t\t_quaternion$3.setFromEuler( this );\n\n\t\treturn this.setFromQuaternion( _quaternion$3, newOrder );\n\n\t}\n\n\tequals( euler ) {\n\n\t\treturn ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order );\n\n\t}\n\n\tfromArray( array ) {\n\n\t\tthis._x = array[ 0 ];\n\t\tthis._y = array[ 1 ];\n\t\tthis._z = array[ 2 ];\n\t\tif ( array[ 3 ] !== undefined ) this._order = array[ 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._order;\n\n\t\treturn array;\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this._x;\n\t\tyield this._y;\n\t\tyield this._z;\n\t\tyield this._order;\n\n\t}\n\n}\n\nEuler.DEFAULT_ORDER = 'XYZ';\n\nclass Layers {\n\n\tconstructor() {\n\n\t\tthis.mask = 1 | 0;\n\n\t}\n\n\tset( channel ) {\n\n\t\tthis.mask = ( 1 << channel | 0 ) >>> 0;\n\n\t}\n\n\tenable( channel ) {\n\n\t\tthis.mask |= 1 << channel | 0;\n\n\t}\n\n\tenableAll() {\n\n\t\tthis.mask = 0xffffffff | 0;\n\n\t}\n\n\ttoggle( channel ) {\n\n\t\tthis.mask ^= 1 << channel | 0;\n\n\t}\n\n\tdisable( channel ) {\n\n\t\tthis.mask &= ~ ( 1 << channel | 0 );\n\n\t}\n\n\tdisableAll() {\n\n\t\tthis.mask = 0;\n\n\t}\n\n\ttest( layers ) {\n\n\t\treturn ( this.mask & layers.mask ) !== 0;\n\n\t}\n\n\tisEnabled( channel ) {\n\n\t\treturn ( this.mask & ( 1 << channel | 0 ) ) !== 0;\n\n\t}\n\n}\n\nlet _object3DId = 0;\n\nconst _v1$4 = /*@__PURE__*/ new Vector3();\nconst _q1 = /*@__PURE__*/ new Quaternion();\nconst _m1$3 = /*@__PURE__*/ new Matrix4();\nconst _target = /*@__PURE__*/ new Vector3();\n\nconst _position$3 = /*@__PURE__*/ new Vector3();\nconst _scale$2 = /*@__PURE__*/ new Vector3();\nconst _quaternion$2 = /*@__PURE__*/ new Quaternion();\n\nconst _xAxis = /*@__PURE__*/ new Vector3( 1, 0, 0 );\nconst _yAxis = /*@__PURE__*/ new Vector3( 0, 1, 0 );\nconst _zAxis = /*@__PURE__*/ new Vector3( 0, 0, 1 );\n\nconst _addedEvent = { type: 'added' };\nconst _removedEvent = { type: 'removed' };\n\nconst _childaddedEvent = { type: 'childadded', child: null };\nconst _childremovedEvent = { type: 'childremoved', child: null };\n\nclass Object3D extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isObject3D = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _object3DId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'Object3D';\n\n\t\tthis.parent = null;\n\t\tthis.children = [];\n\n\t\tthis.up = Object3D.DEFAULT_UP.clone();\n\n\t\tconst position = new Vector3();\n\t\tconst rotation = new Euler();\n\t\tconst quaternion = new Quaternion();\n\t\tconst scale = new Vector3( 1, 1, 1 );\n\n\t\tfunction onRotationChange() {\n\n\t\t\tquaternion.setFromEuler( rotation, false );\n\n\t\t}\n\n\t\tfunction onQuaternionChange() {\n\n\t\t\trotation.setFromQuaternion( quaternion, undefined, false );\n\n\t\t}\n\n\t\trotation._onChange( onRotationChange );\n\t\tquaternion._onChange( onQuaternionChange );\n\n\t\tObject.defineProperties( this, {\n\t\t\tposition: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: position\n\t\t\t},\n\t\t\trotation: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: rotation\n\t\t\t},\n\t\t\tquaternion: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: quaternion\n\t\t\t},\n\t\t\tscale: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: scale\n\t\t\t},\n\t\t\tmodelViewMatrix: {\n\t\t\t\tvalue: new Matrix4()\n\t\t\t},\n\t\t\tnormalMatrix: {\n\t\t\t\tvalue: new Matrix3()\n\t\t\t}\n\t\t} );\n\n\t\tthis.matrix = new Matrix4();\n\t\tthis.matrixWorld = new Matrix4();\n\n\t\tthis.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;\n\n\t\tthis.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer\n\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\tthis.layers = new Layers();\n\t\tthis.visible = true;\n\n\t\tthis.castShadow = false;\n\t\tthis.receiveShadow = false;\n\n\t\tthis.frustumCulled = true;\n\t\tthis.renderOrder = 0;\n\n\t\tthis.animations = [];\n\n\t\tthis.userData = {};\n\n\t}\n\n\tonBeforeShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}\n\n\tonAfterShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\tonAfterRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tthis.matrix.premultiply( matrix );\n\n\t\tthis.matrix.decompose( this.position, this.quaternion, this.scale );\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\tthis.quaternion.premultiply( q );\n\n\t\treturn this;\n\n\t}\n\n\tsetRotationFromAxisAngle( axis, angle ) {\n\n\t\t// assumes axis is normalized\n\n\t\tthis.quaternion.setFromAxisAngle( axis, angle );\n\n\t}\n\n\tsetRotationFromEuler( euler ) {\n\n\t\tthis.quaternion.setFromEuler( euler, true );\n\n\t}\n\n\tsetRotationFromMatrix( m ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tthis.quaternion.setFromRotationMatrix( m );\n\n\t}\n\n\tsetRotationFromQuaternion( q ) {\n\n\t\t// assumes q is normalized\n\n\t\tthis.quaternion.copy( q );\n\n\t}\n\n\trotateOnAxis( axis, angle ) {\n\n\t\t// rotate object on axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.multiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateOnWorldAxis( axis, angle ) {\n\n\t\t// rotate object on axis in world space\n\t\t// axis is assumed to be normalized\n\t\t// method assumes no rotated parent\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.premultiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateX( angle ) {\n\n\t\treturn this.rotateOnAxis( _xAxis, angle );\n\n\t}\n\n\trotateY( angle ) {\n\n\t\treturn this.rotateOnAxis( _yAxis, angle );\n\n\t}\n\n\trotateZ( angle ) {\n\n\t\treturn this.rotateOnAxis( _zAxis, angle );\n\n\t}\n\n\ttranslateOnAxis( axis, distance ) {\n\n\t\t// translate object by distance along axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_v1$4.copy( axis ).applyQuaternion( this.quaternion );\n\n\t\tthis.position.add( _v1$4.multiplyScalar( distance ) );\n\n\t\treturn this;\n\n\t}\n\n\ttranslateX( distance ) {\n\n\t\treturn this.translateOnAxis( _xAxis, distance );\n\n\t}\n\n\ttranslateY( distance ) {\n\n\t\treturn this.translateOnAxis( _yAxis, distance );\n\n\t}\n\n\ttranslateZ( distance ) {\n\n\t\treturn this.translateOnAxis( _zAxis, distance );\n\n\t}\n\n\tlocalToWorld( vector ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn vector.applyMatrix4( this.matrixWorld );\n\n\t}\n\n\tworldToLocal( vector ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn vector.applyMatrix4( _m1$3.copy( this.matrixWorld ).invert() );\n\n\t}\n\n\tlookAt( x, y, z ) {\n\n\t\t// This method does not support objects having non-uniformly-scaled parent(s)\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\t_target.copy( x );\n\n\t\t} else {\n\n\t\t\t_target.set( x, y, z );\n\n\t\t}\n\n\t\tconst parent = this.parent;\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_position$3.setFromMatrixPosition( this.matrixWorld );\n\n\t\tif ( this.isCamera || this.isLight ) {\n\n\t\t\t_m1$3.lookAt( _position$3, _target, this.up );\n\n\t\t} else {\n\n\t\t\t_m1$3.lookAt( _target, _position$3, this.up );\n\n\t\t}\n\n\t\tthis.quaternion.setFromRotationMatrix( _m1$3 );\n\n\t\tif ( parent ) {\n\n\t\t\t_m1$3.extractRotation( parent.matrixWorld );\n\t\t\t_q1.setFromRotationMatrix( _m1$3 );\n\t\t\tthis.quaternion.premultiply( _q1.invert() );\n\n\t\t}\n\n\t}\n\n\tadd( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.add( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object === this ) {\n\n\t\t\tconsole.error( 'THREE.Object3D.add: object can\\'t be added as a child of itself.', object );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object && object.isObject3D ) {\n\n\t\t\tobject.removeFromParent();\n\t\t\tobject.parent = this;\n\t\t\tthis.children.push( object );\n\n\t\t\tobject.dispatchEvent( _addedEvent );\n\n\t\t\t_childaddedEvent.child = object;\n\t\t\tthis.dispatchEvent( _childaddedEvent );\n\t\t\t_childaddedEvent.child = null;\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.Object3D.add: object not an instance of THREE.Object3D.', object );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremove( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.remove( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst index = this.children.indexOf( object );\n\n\t\tif ( index !== - 1 ) {\n\n\t\t\tobject.parent = null;\n\t\t\tthis.children.splice( index, 1 );\n\n\t\t\tobject.dispatchEvent( _removedEvent );\n\n\t\t\t_childremovedEvent.child = object;\n\t\t\tthis.dispatchEvent( _childremovedEvent );\n\t\t\t_childremovedEvent.child = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremoveFromParent() {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tparent.remove( this );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclear() {\n\n\t\treturn this.remove( ... this.children );\n\n\t}\n\n\tattach( object ) {\n\n\t\t// adds object as a child of this, while maintaining the object's world transform\n\n\t\t// Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_m1$3.copy( this.matrixWorld ).invert();\n\n\t\tif ( object.parent !== null ) {\n\n\t\t\tobject.parent.updateWorldMatrix( true, false );\n\n\t\t\t_m1$3.multiply( object.parent.matrixWorld );\n\n\t\t}\n\n\t\tobject.applyMatrix4( _m1$3 );\n\n\t\tobject.removeFromParent();\n\t\tobject.parent = this;\n\t\tthis.children.push( object );\n\n\t\tobject.updateWorldMatrix( false, true );\n\n\t\tobject.dispatchEvent( _addedEvent );\n\n\t\t_childaddedEvent.child = object;\n\t\tthis.dispatchEvent( _childaddedEvent );\n\t\t_childaddedEvent.child = null;\n\n\t\treturn this;\n\n\t}\n\n\tgetObjectById( id ) {\n\n\t\treturn this.getObjectByProperty( 'id', id );\n\n\t}\n\n\tgetObjectByName( name ) {\n\n\t\treturn this.getObjectByProperty( 'name', name );\n\n\t}\n\n\tgetObjectByProperty( name, value ) {\n\n\t\tif ( this[ name ] === value ) return this;\n\n\t\tfor ( let i = 0, l = this.children.length; i < l; i ++ ) {\n\n\t\t\tconst child = this.children[ i ];\n\t\t\tconst object = child.getObjectByProperty( name, value );\n\n\t\t\tif ( object !== undefined ) {\n\n\t\t\t\treturn object;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n\tgetObjectsByProperty( name, value, result = [] ) {\n\n\t\tif ( this[ name ] === value ) result.push( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].getObjectsByProperty( name, value, result );\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tgetWorldPosition( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn target.setFromMatrixPosition( this.matrixWorld );\n\n\t}\n\n\tgetWorldQuaternion( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position$3, target, _scale$2 );\n\n\t\treturn target;\n\n\t}\n\n\tgetWorldScale( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position$3, _quaternion$2, target );\n\n\t\treturn target;\n\n\t}\n\n\tgetWorldDirection( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tconst e = this.matrixWorld.elements;\n\n\t\treturn target.set( e[ 8 ], e[ 9 ], e[ 10 ] ).normalize();\n\n\t}\n\n\traycast( /* raycaster, intersects */ ) {}\n\n\ttraverse( callback ) {\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverse( callback );\n\n\t\t}\n\n\t}\n\n\ttraverseVisible( callback ) {\n\n\t\tif ( this.visible === false ) return;\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverseVisible( callback );\n\n\t\t}\n\n\t}\n\n\ttraverseAncestors( callback ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tcallback( parent );\n\n\t\t\tparent.traverseAncestors( callback );\n\n\t\t}\n\n\t}\n\n\tupdateMatrix() {\n\n\t\tthis.matrix.compose( this.position, this.quaternion, this.scale );\n\n\t\tthis.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.matrixWorldNeedsUpdate || force ) {\n\n\t\t\tif ( this.matrixWorldAutoUpdate === true ) {\n\n\t\t\t\tif ( this.parent === null ) {\n\n\t\t\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\t\tforce = true;\n\n\t\t}\n\n\t\t// make sure descendants are updated if required\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tconst child = children[ i ];\n\n\t\t\tchild.updateMatrixWorld( force );\n\n\t\t}\n\n\t}\n\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( updateParents === true && parent !== null ) {\n\n\t\t\tparent.updateWorldMatrix( true, false );\n\n\t\t}\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.matrixWorldAutoUpdate === true ) {\n\n\t\t\tif ( this.parent === null ) {\n\n\t\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// make sure descendants are updated\n\n\t\tif ( updateChildren === true ) {\n\n\t\t\tconst children = this.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tconst child = children[ i ];\n\n\t\t\t\tchild.updateWorldMatrix( false, true );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\t// meta is a string when called from JSON.stringify\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tconst output = {};\n\n\t\t// meta is a hash used to collect geometries, materials.\n\t\t// not providing it implies that this is the root object\n\t\t// being serialized.\n\t\tif ( isRootObject ) {\n\n\t\t\t// initialize meta obj\n\t\t\tmeta = {\n\t\t\t\tgeometries: {},\n\t\t\t\tmaterials: {},\n\t\t\t\ttextures: {},\n\t\t\t\timages: {},\n\t\t\t\tshapes: {},\n\t\t\t\tskeletons: {},\n\t\t\t\tanimations: {},\n\t\t\t\tnodes: {}\n\t\t\t};\n\n\t\t\toutput.metadata = {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Object',\n\t\t\t\tgenerator: 'Object3D.toJSON'\n\t\t\t};\n\n\t\t}\n\n\t\t// standard Object3D serialization\n\n\t\tconst object = {};\n\n\t\tobject.uuid = this.uuid;\n\t\tobject.type = this.type;\n\n\t\tif ( this.name !== '' ) object.name = this.name;\n\t\tif ( this.castShadow === true ) object.castShadow = true;\n\t\tif ( this.receiveShadow === true ) object.receiveShadow = true;\n\t\tif ( this.visible === false ) object.visible = false;\n\t\tif ( this.frustumCulled === false ) object.frustumCulled = false;\n\t\tif ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;\n\t\tif ( Object.keys( this.userData ).length > 0 ) object.userData = this.userData;\n\n\t\tobject.layers = this.layers.mask;\n\t\tobject.matrix = this.matrix.toArray();\n\t\tobject.up = this.up.toArray();\n\n\t\tif ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;\n\n\t\t// object specific properties\n\n\t\tif ( this.isInstancedMesh ) {\n\n\t\t\tobject.type = 'InstancedMesh';\n\t\t\tobject.count = this.count;\n\t\t\tobject.instanceMatrix = this.instanceMatrix.toJSON();\n\t\t\tif ( this.instanceColor !== null ) object.instanceColor = this.instanceColor.toJSON();\n\n\t\t}\n\n\t\tif ( this.isBatchedMesh ) {\n\n\t\t\tobject.type = 'BatchedMesh';\n\t\t\tobject.perObjectFrustumCulled = this.perObjectFrustumCulled;\n\t\t\tobject.sortObjects = this.sortObjects;\n\n\t\t\tobject.drawRanges = this._drawRanges;\n\t\t\tobject.reservedRanges = this._reservedRanges;\n\n\t\t\tobject.visibility = this._visibility;\n\t\t\tobject.active = this._active;\n\t\t\tobject.bounds = this._bounds.map( bound => ( {\n\t\t\t\tboxInitialized: bound.boxInitialized,\n\t\t\t\tboxMin: bound.box.min.toArray(),\n\t\t\t\tboxMax: bound.box.max.toArray(),\n\n\t\t\t\tsphereInitialized: bound.sphereInitialized,\n\t\t\t\tsphereRadius: bound.sphere.radius,\n\t\t\t\tsphereCenter: bound.sphere.center.toArray()\n\t\t\t} ) );\n\n\t\t\tobject.maxInstanceCount = this._maxInstanceCount;\n\t\t\tobject.maxVertexCount = this._maxVertexCount;\n\t\t\tobject.maxIndexCount = this._maxIndexCount;\n\n\t\t\tobject.geometryInitialized = this._geometryInitialized;\n\t\t\tobject.geometryCount = this._geometryCount;\n\n\t\t\tobject.matricesTexture = this._matricesTexture.toJSON( meta );\n\n\t\t\tif ( this._colorsTexture !== null ) object.colorsTexture = this._colorsTexture.toJSON( meta );\n\n\t\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\t\tobject.boundingSphere = {\n\t\t\t\t\tcenter: object.boundingSphere.center.toArray(),\n\t\t\t\t\tradius: object.boundingSphere.radius\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t\tif ( this.boundingBox !== null ) {\n\n\t\t\t\tobject.boundingBox = {\n\t\t\t\t\tmin: object.boundingBox.min.toArray(),\n\t\t\t\t\tmax: object.boundingBox.max.toArray()\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tfunction serialize( library, element ) {\n\n\t\t\tif ( library[ element.uuid ] === undefined ) {\n\n\t\t\t\tlibrary[ element.uuid ] = element.toJSON( meta );\n\n\t\t\t}\n\n\t\t\treturn element.uuid;\n\n\t\t}\n\n\t\tif ( this.isScene ) {\n\n\t\t\tif ( this.background ) {\n\n\t\t\t\tif ( this.background.isColor ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON();\n\n\t\t\t\t} else if ( this.background.isTexture ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON( meta ).uuid;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true ) {\n\n\t\t\t\tobject.environment = this.environment.toJSON( meta ).uuid;\n\n\t\t\t}\n\n\t\t} else if ( this.isMesh || this.isLine || this.isPoints ) {\n\n\t\t\tobject.geometry = serialize( meta.geometries, this.geometry );\n\n\t\t\tconst parameters = this.geometry.parameters;\n\n\t\t\tif ( parameters !== undefined && parameters.shapes !== undefined ) {\n\n\t\t\t\tconst shapes = parameters.shapes;\n\n\t\t\t\tif ( Array.isArray( shapes ) ) {\n\n\t\t\t\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\t\t\t\tconst shape = shapes[ i ];\n\n\t\t\t\t\t\tserialize( meta.shapes, shape );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tserialize( meta.shapes, shapes );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.isSkinnedMesh ) {\n\n\t\t\tobject.bindMode = this.bindMode;\n\t\t\tobject.bindMatrix = this.bindMatrix.toArray();\n\n\t\t\tif ( this.skeleton !== undefined ) {\n\n\t\t\t\tserialize( meta.skeletons, this.skeleton );\n\n\t\t\t\tobject.skeleton = this.skeleton.uuid;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.material !== undefined ) {\n\n\t\t\tif ( Array.isArray( this.material ) ) {\n\n\t\t\t\tconst uuids = [];\n\n\t\t\t\tfor ( let i = 0, l = this.material.length; i < l; i ++ ) {\n\n\t\t\t\t\tuuids.push( serialize( meta.materials, this.material[ i ] ) );\n\n\t\t\t\t}\n\n\t\t\t\tobject.material = uuids;\n\n\t\t\t} else {\n\n\t\t\t\tobject.material = serialize( meta.materials, this.material );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.children.length > 0 ) {\n\n\t\t\tobject.children = [];\n\n\t\t\tfor ( let i = 0; i < this.children.length; i ++ ) {\n\n\t\t\t\tobject.children.push( this.children[ i ].toJSON( meta ).object );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.animations.length > 0 ) {\n\n\t\t\tobject.animations = [];\n\n\t\t\tfor ( let i = 0; i < this.animations.length; i ++ ) {\n\n\t\t\t\tconst animation = this.animations[ i ];\n\n\t\t\t\tobject.animations.push( serialize( meta.animations, animation ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tconst geometries = extractFromCache( meta.geometries );\n\t\t\tconst materials = extractFromCache( meta.materials );\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\t\t\tconst shapes = extractFromCache( meta.shapes );\n\t\t\tconst skeletons = extractFromCache( meta.skeletons );\n\t\t\tconst animations = extractFromCache( meta.animations );\n\t\t\tconst nodes = extractFromCache( meta.nodes );\n\n\t\t\tif ( geometries.length > 0 ) output.geometries = geometries;\n\t\t\tif ( materials.length > 0 ) output.materials = materials;\n\t\t\tif ( textures.length > 0 ) output.textures = textures;\n\t\t\tif ( images.length > 0 ) output.images = images;\n\t\t\tif ( shapes.length > 0 ) output.shapes = shapes;\n\t\t\tif ( skeletons.length > 0 ) output.skeletons = skeletons;\n\t\t\tif ( animations.length > 0 ) output.animations = animations;\n\t\t\tif ( nodes.length > 0 ) output.nodes = nodes;\n\n\t\t}\n\n\t\toutput.object = object;\n\n\t\treturn output;\n\n\t\t// extract data from the cache hash\n\t\t// remove metadata on each item\n\t\t// and return as array\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t}\n\n\tclone( recursive ) {\n\n\t\treturn new this.constructor().copy( this, recursive );\n\n\t}\n\n\tcopy( source, recursive = true ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.up.copy( source.up );\n\n\t\tthis.position.copy( source.position );\n\t\tthis.rotation.order = source.rotation.order;\n\t\tthis.quaternion.copy( source.quaternion );\n\t\tthis.scale.copy( source.scale );\n\n\t\tthis.matrix.copy( source.matrix );\n\t\tthis.matrixWorld.copy( source.matrixWorld );\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\n\t\tthis.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;\n\t\tthis.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;\n\n\t\tthis.layers.mask = source.layers.mask;\n\t\tthis.visible = source.visible;\n\n\t\tthis.castShadow = source.castShadow;\n\t\tthis.receiveShadow = source.receiveShadow;\n\n\t\tthis.frustumCulled = source.frustumCulled;\n\t\tthis.renderOrder = source.renderOrder;\n\n\t\tthis.animations = source.animations.slice();\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tif ( recursive === true ) {\n\n\t\t\tfor ( let i = 0; i < source.children.length; i ++ ) {\n\n\t\t\t\tconst child = source.children[ i ];\n\t\t\t\tthis.add( child.clone() );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nObject3D.DEFAULT_UP = /*@__PURE__*/ new Vector3( 0, 1, 0 );\nObject3D.DEFAULT_MATRIX_AUTO_UPDATE = true;\nObject3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;\n\nconst _v0$2 = /*@__PURE__*/ new Vector3();\nconst _v1$3 = /*@__PURE__*/ new Vector3();\nconst _v2$2 = /*@__PURE__*/ new Vector3();\nconst _v3$2 = /*@__PURE__*/ new Vector3();\n\nconst _vab = /*@__PURE__*/ new Vector3();\nconst _vac = /*@__PURE__*/ new Vector3();\nconst _vbc = /*@__PURE__*/ new Vector3();\nconst _vap = /*@__PURE__*/ new Vector3();\nconst _vbp = /*@__PURE__*/ new Vector3();\nconst _vcp = /*@__PURE__*/ new Vector3();\n\nclass Triangle {\n\n\tconstructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {\n\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t\tthis.c = c;\n\n\t}\n\n\tstatic getNormal( a, b, c, target ) {\n\n\t\ttarget.subVectors( c, b );\n\t\t_v0$2.subVectors( a, b );\n\t\ttarget.cross( _v0$2 );\n\n\t\tconst targetLengthSq = target.lengthSq();\n\t\tif ( targetLengthSq > 0 ) {\n\n\t\t\treturn target.multiplyScalar( 1 / Math.sqrt( targetLengthSq ) );\n\n\t\t}\n\n\t\treturn target.set( 0, 0, 0 );\n\n\t}\n\n\t// static/instance method to calculate barycentric coordinates\n\t// based on: http://www.blackpawn.com/texts/pointinpoly/default.html\n\tstatic getBarycoord( point, a, b, c, target ) {\n\n\t\t_v0$2.subVectors( c, a );\n\t\t_v1$3.subVectors( b, a );\n\t\t_v2$2.subVectors( point, a );\n\n\t\tconst dot00 = _v0$2.dot( _v0$2 );\n\t\tconst dot01 = _v0$2.dot( _v1$3 );\n\t\tconst dot02 = _v0$2.dot( _v2$2 );\n\t\tconst dot11 = _v1$3.dot( _v1$3 );\n\t\tconst dot12 = _v1$3.dot( _v2$2 );\n\n\t\tconst denom = ( dot00 * dot11 - dot01 * dot01 );\n\n\t\t// collinear or singular triangle\n\t\tif ( denom === 0 ) {\n\n\t\t\ttarget.set( 0, 0, 0 );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst invDenom = 1 / denom;\n\t\tconst u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;\n\t\tconst v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;\n\n\t\t// barycentric coordinates must always sum to 1\n\t\treturn target.set( 1 - u - v, v, u );\n\n\t}\n\n\tstatic containsPoint( point, a, b, c ) {\n\n\t\t// if the triangle is degenerate then we can't contain a point\n\t\tif ( this.getBarycoord( point, a, b, c, _v3$2 ) === null ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn ( _v3$2.x >= 0 ) && ( _v3$2.y >= 0 ) && ( ( _v3$2.x + _v3$2.y ) <= 1 );\n\n\t}\n\n\tstatic getInterpolation( point, p1, p2, p3, v1, v2, v3, target ) {\n\n\t\tif ( this.getBarycoord( point, p1, p2, p3, _v3$2 ) === null ) {\n\n\t\t\ttarget.x = 0;\n\t\t\ttarget.y = 0;\n\t\t\tif ( 'z' in target ) target.z = 0;\n\t\t\tif ( 'w' in target ) target.w = 0;\n\t\t\treturn null;\n\n\t\t}\n\n\t\ttarget.setScalar( 0 );\n\t\ttarget.addScaledVector( v1, _v3$2.x );\n\t\ttarget.addScaledVector( v2, _v3$2.y );\n\t\ttarget.addScaledVector( v3, _v3$2.z );\n\n\t\treturn target;\n\n\t}\n\n\tstatic isFrontFacing( a, b, c, direction ) {\n\n\t\t_v0$2.subVectors( c, b );\n\t\t_v1$3.subVectors( a, b );\n\n\t\t// strictly front facing\n\t\treturn ( _v0$2.cross( _v1$3 ).dot( direction ) < 0 ) ? true : false;\n\n\t}\n\n\tset( a, b, c ) {\n\n\t\tthis.a.copy( a );\n\t\tthis.b.copy( b );\n\t\tthis.c.copy( c );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPointsAndIndices( points, i0, i1, i2 ) {\n\n\t\tthis.a.copy( points[ i0 ] );\n\t\tthis.b.copy( points[ i1 ] );\n\t\tthis.c.copy( points[ i2 ] );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromAttributeAndIndices( attribute, i0, i1, i2 ) {\n\n\t\tthis.a.fromBufferAttribute( attribute, i0 );\n\t\tthis.b.fromBufferAttribute( attribute, i1 );\n\t\tthis.c.fromBufferAttribute( attribute, i2 );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( triangle ) {\n\n\t\tthis.a.copy( triangle.a );\n\t\tthis.b.copy( triangle.b );\n\t\tthis.c.copy( triangle.c );\n\n\t\treturn this;\n\n\t}\n\n\tgetArea() {\n\n\t\t_v0$2.subVectors( this.c, this.b );\n\t\t_v1$3.subVectors( this.a, this.b );\n\n\t\treturn _v0$2.cross( _v1$3 ).length() * 0.5;\n\n\t}\n\n\tgetMidpoint( target ) {\n\n\t\treturn target.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 );\n\n\t}\n\n\tgetNormal( target ) {\n\n\t\treturn Triangle.getNormal( this.a, this.b, this.c, target );\n\n\t}\n\n\tgetPlane( target ) {\n\n\t\treturn target.setFromCoplanarPoints( this.a, this.b, this.c );\n\n\t}\n\n\tgetBarycoord( point, target ) {\n\n\t\treturn Triangle.getBarycoord( point, this.a, this.b, this.c, target );\n\n\t}\n\n\tgetInterpolation( point, v1, v2, v3, target ) {\n\n\t\treturn Triangle.getInterpolation( point, this.a, this.b, this.c, v1, v2, v3, target );\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn Triangle.containsPoint( point, this.a, this.b, this.c );\n\n\t}\n\n\tisFrontFacing( direction ) {\n\n\t\treturn Triangle.isFrontFacing( this.a, this.b, this.c, direction );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsTriangle( this );\n\n\t}\n\n\tclosestPointToPoint( p, target ) {\n\n\t\tconst a = this.a, b = this.b, c = this.c;\n\t\tlet v, w;\n\n\t\t// algorithm thanks to Real-Time Collision Detection by Christer Ericson,\n\t\t// published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,\n\t\t// under the accompanying license; see chapter 5.1.5 for detailed explanation.\n\t\t// basically, we're distinguishing which of the voronoi regions of the triangle\n\t\t// the point lies in with the minimum amount of redundant computation.\n\n\t\t_vab.subVectors( b, a );\n\t\t_vac.subVectors( c, a );\n\t\t_vap.subVectors( p, a );\n\t\tconst d1 = _vab.dot( _vap );\n\t\tconst d2 = _vac.dot( _vap );\n\t\tif ( d1 <= 0 && d2 <= 0 ) {\n\n\t\t\t// vertex region of A; barycentric coords (1, 0, 0)\n\t\t\treturn target.copy( a );\n\n\t\t}\n\n\t\t_vbp.subVectors( p, b );\n\t\tconst d3 = _vab.dot( _vbp );\n\t\tconst d4 = _vac.dot( _vbp );\n\t\tif ( d3 >= 0 && d4 <= d3 ) {\n\n\t\t\t// vertex region of B; barycentric coords (0, 1, 0)\n\t\t\treturn target.copy( b );\n\n\t\t}\n\n\t\tconst vc = d1 * d4 - d3 * d2;\n\t\tif ( vc <= 0 && d1 >= 0 && d3 <= 0 ) {\n\n\t\t\tv = d1 / ( d1 - d3 );\n\t\t\t// edge region of AB; barycentric coords (1-v, v, 0)\n\t\t\treturn target.copy( a ).addScaledVector( _vab, v );\n\n\t\t}\n\n\t\t_vcp.subVectors( p, c );\n\t\tconst d5 = _vab.dot( _vcp );\n\t\tconst d6 = _vac.dot( _vcp );\n\t\tif ( d6 >= 0 && d5 <= d6 ) {\n\n\t\t\t// vertex region of C; barycentric coords (0, 0, 1)\n\t\t\treturn target.copy( c );\n\n\t\t}\n\n\t\tconst vb = d5 * d2 - d1 * d6;\n\t\tif ( vb <= 0 && d2 >= 0 && d6 <= 0 ) {\n\n\t\t\tw = d2 / ( d2 - d6 );\n\t\t\t// edge region of AC; barycentric coords (1-w, 0, w)\n\t\t\treturn target.copy( a ).addScaledVector( _vac, w );\n\n\t\t}\n\n\t\tconst va = d3 * d6 - d5 * d4;\n\t\tif ( va <= 0 && ( d4 - d3 ) >= 0 && ( d5 - d6 ) >= 0 ) {\n\n\t\t\t_vbc.subVectors( c, b );\n\t\t\tw = ( d4 - d3 ) / ( ( d4 - d3 ) + ( d5 - d6 ) );\n\t\t\t// edge region of BC; barycentric coords (0, 1-w, w)\n\t\t\treturn target.copy( b ).addScaledVector( _vbc, w ); // edge region of BC\n\n\t\t}\n\n\t\t// face region\n\t\tconst denom = 1 / ( va + vb + vc );\n\t\t// u = va * denom\n\t\tv = vb * denom;\n\t\tw = vc * denom;\n\n\t\treturn target.copy( a ).addScaledVector( _vab, v ).addScaledVector( _vac, w );\n\n\t}\n\n\tequals( triangle ) {\n\n\t\treturn triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c );\n\n\t}\n\n}\n\nconst _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,\n\t'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,\n\t'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50,\n\t'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B,\n\t'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B,\n\t'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F,\n\t'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3,\n\t'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222,\n\t'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700,\n\t'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4,\n\t'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00,\n\t'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3,\n\t'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA,\n\t'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32,\n\t'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3,\n\t'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC,\n\t'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD,\n\t'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6,\n\t'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9,\n\t'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'rebeccapurple': 0x663399, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F,\n\t'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE,\n\t'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA,\n\t'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,\n\t'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };\n\nconst _hslA = { h: 0, s: 0, l: 0 };\nconst _hslB = { h: 0, s: 0, l: 0 };\n\nfunction hue2rgb( p, q, t ) {\n\n\tif ( t < 0 ) t += 1;\n\tif ( t > 1 ) t -= 1;\n\tif ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;\n\tif ( t < 1 / 2 ) return q;\n\tif ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );\n\treturn p;\n\n}\n\nclass Color {\n\n\tconstructor( r, g, b ) {\n\n\t\tthis.isColor = true;\n\n\t\tthis.r = 1;\n\t\tthis.g = 1;\n\t\tthis.b = 1;\n\n\t\treturn this.set( r, g, b );\n\n\t}\n\n\tset( r, g, b ) {\n\n\t\tif ( g === undefined && b === undefined ) {\n\n\t\t\t// r is THREE.Color, hex or string\n\n\t\t\tconst value = r;\n\n\t\t\tif ( value && value.isColor ) {\n\n\t\t\t\tthis.copy( value );\n\n\t\t\t} else if ( typeof value === 'number' ) {\n\n\t\t\t\tthis.setHex( value );\n\n\t\t\t} else if ( typeof value === 'string' ) {\n\n\t\t\t\tthis.setStyle( value );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.setRGB( r, g, b );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.r = scalar;\n\t\tthis.g = scalar;\n\t\tthis.b = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetHex( hex, colorSpace = SRGBColorSpace ) {\n\n\t\thex = Math.floor( hex );\n\n\t\tthis.r = ( hex >> 16 & 255 ) / 255;\n\t\tthis.g = ( hex >> 8 & 255 ) / 255;\n\t\tthis.b = ( hex & 255 ) / 255;\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetRGB( r, g, b, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\tthis.r = r;\n\t\tthis.g = g;\n\t\tthis.b = b;\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetHSL( h, s, l, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\t\th = euclideanModulo( h, 1 );\n\t\ts = clamp( s, 0, 1 );\n\t\tl = clamp( l, 0, 1 );\n\n\t\tif ( s === 0 ) {\n\n\t\t\tthis.r = this.g = this.b = l;\n\n\t\t} else {\n\n\t\t\tconst p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );\n\t\t\tconst q = ( 2 * l ) - p;\n\n\t\t\tthis.r = hue2rgb( q, p, h + 1 / 3 );\n\t\t\tthis.g = hue2rgb( q, p, h );\n\t\t\tthis.b = hue2rgb( q, p, h - 1 / 3 );\n\n\t\t}\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetStyle( style, colorSpace = SRGBColorSpace ) {\n\n\t\tfunction handleAlpha( string ) {\n\n\t\t\tif ( string === undefined ) return;\n\n\t\t\tif ( parseFloat( string ) < 1 ) {\n\n\t\t\t\tconsole.warn( 'THREE.Color: Alpha component of ' + style + ' will be ignored.' );\n\n\t\t\t}\n\n\t\t}\n\n\n\t\tlet m;\n\n\t\tif ( m = /^(\\w+)\\(([^\\)]*)\\)/.exec( style ) ) {\n\n\t\t\t// rgb / hsl\n\n\t\t\tlet color;\n\t\t\tconst name = m[ 1 ];\n\t\t\tconst components = m[ 2 ];\n\n\t\t\tswitch ( name ) {\n\n\t\t\t\tcase 'rgb':\n\t\t\t\tcase 'rgba':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(255,0,0) rgba(255,0,0,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setRGB(\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 1 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 2 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 3 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setRGB(\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 1 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 2 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 3 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'hsl':\n\t\t\t\tcase 'hsla':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// hsl(120,50%,50%) hsla(120,50%,50%,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setHSL(\n\t\t\t\t\t\t\tparseFloat( color[ 1 ] ) / 360,\n\t\t\t\t\t\t\tparseFloat( color[ 2 ] ) / 100,\n\t\t\t\t\t\t\tparseFloat( color[ 3 ] ) / 100,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tconsole.warn( 'THREE.Color: Unknown color model ' + style );\n\n\t\t\t}\n\n\t\t} else if ( m = /^\\#([A-Fa-f\\d]+)$/.exec( style ) ) {\n\n\t\t\t// hex color\n\n\t\t\tconst hex = m[ 1 ];\n\t\t\tconst size = hex.length;\n\n\t\t\tif ( size === 3 ) {\n\n\t\t\t\t// #ff0\n\t\t\t\treturn this.setRGB(\n\t\t\t\t\tparseInt( hex.charAt( 0 ), 16 ) / 15,\n\t\t\t\t\tparseInt( hex.charAt( 1 ), 16 ) / 15,\n\t\t\t\t\tparseInt( hex.charAt( 2 ), 16 ) / 15,\n\t\t\t\t\tcolorSpace\n\t\t\t\t);\n\n\t\t\t} else if ( size === 6 ) {\n\n\t\t\t\t// #ff0000\n\t\t\t\treturn this.setHex( parseInt( hex, 16 ), colorSpace );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.Color: Invalid hex color ' + style );\n\n\t\t\t}\n\n\t\t} else if ( style && style.length > 0 ) {\n\n\t\t\treturn this.setColorName( style, colorSpace );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetColorName( style, colorSpace = SRGBColorSpace ) {\n\n\t\t// color keywords\n\t\tconst hex = _colorKeywords[ style.toLowerCase() ];\n\n\t\tif ( hex !== undefined ) {\n\n\t\t\t// red\n\t\t\tthis.setHex( hex, colorSpace );\n\n\t\t} else {\n\n\t\t\t// unknown color\n\t\t\tconsole.warn( 'THREE.Color: Unknown color ' + style );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.r, this.g, this.b );\n\n\t}\n\n\tcopy( color ) {\n\n\t\tthis.r = color.r;\n\t\tthis.g = color.g;\n\t\tthis.b = color.b;\n\n\t\treturn this;\n\n\t}\n\n\tcopySRGBToLinear( color ) {\n\n\t\tthis.r = SRGBToLinear( color.r );\n\t\tthis.g = SRGBToLinear( color.g );\n\t\tthis.b = SRGBToLinear( color.b );\n\n\t\treturn this;\n\n\t}\n\n\tcopyLinearToSRGB( color ) {\n\n\t\tthis.r = LinearToSRGB( color.r );\n\t\tthis.g = LinearToSRGB( color.g );\n\t\tthis.b = LinearToSRGB( color.b );\n\n\t\treturn this;\n\n\t}\n\n\tconvertSRGBToLinear() {\n\n\t\tthis.copySRGBToLinear( this );\n\n\t\treturn this;\n\n\t}\n\n\tconvertLinearToSRGB() {\n\n\t\tthis.copyLinearToSRGB( this );\n\n\t\treturn this;\n\n\t}\n\n\tgetHex( colorSpace = SRGBColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\treturn Math.round( clamp( _color.r * 255, 0, 255 ) ) * 65536 + Math.round( clamp( _color.g * 255, 0, 255 ) ) * 256 + Math.round( clamp( _color.b * 255, 0, 255 ) );\n\n\t}\n\n\tgetHexString( colorSpace = SRGBColorSpace ) {\n\n\t\treturn ( '000000' + this.getHex( colorSpace ).toString( 16 ) ).slice( - 6 );\n\n\t}\n\n\tgetHSL( target, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\n\n\t\tconst max = Math.max( r, g, b );\n\t\tconst min = Math.min( r, g, b );\n\n\t\tlet hue, saturation;\n\t\tconst lightness = ( min + max ) / 2.0;\n\n\t\tif ( min === max ) {\n\n\t\t\thue = 0;\n\t\t\tsaturation = 0;\n\n\t\t} else {\n\n\t\t\tconst delta = max - min;\n\n\t\t\tsaturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min );\n\n\t\t\tswitch ( max ) {\n\n\t\t\t\tcase r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break;\n\t\t\t\tcase g: hue = ( b - r ) / delta + 2; break;\n\t\t\t\tcase b: hue = ( r - g ) / delta + 4; break;\n\n\t\t\t}\n\n\t\t\thue /= 6;\n\n\t\t}\n\n\t\ttarget.h = hue;\n\t\ttarget.s = saturation;\n\t\ttarget.l = lightness;\n\n\t\treturn target;\n\n\t}\n\n\tgetRGB( target, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\ttarget.r = _color.r;\n\t\ttarget.g = _color.g;\n\t\ttarget.b = _color.b;\n\n\t\treturn target;\n\n\t}\n\n\tgetStyle( colorSpace = SRGBColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\n\n\t\tif ( colorSpace !== SRGBColorSpace ) {\n\n\t\t\t// Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).\n\t\t\treturn `color(${ colorSpace } ${ r.toFixed( 3 ) } ${ g.toFixed( 3 ) } ${ b.toFixed( 3 ) })`;\n\n\t\t}\n\n\t\treturn `rgb(${ Math.round( r * 255 ) },${ Math.round( g * 255 ) },${ Math.round( b * 255 ) })`;\n\n\t}\n\n\toffsetHSL( h, s, l ) {\n\n\t\tthis.getHSL( _hslA );\n\n\t\treturn this.setHSL( _hslA.h + h, _hslA.s + s, _hslA.l + l );\n\n\t}\n\n\tadd( color ) {\n\n\t\tthis.r += color.r;\n\t\tthis.g += color.g;\n\t\tthis.b += color.b;\n\n\t\treturn this;\n\n\t}\n\n\taddColors( color1, color2 ) {\n\n\t\tthis.r = color1.r + color2.r;\n\t\tthis.g = color1.g + color2.g;\n\t\tthis.b = color1.b + color2.b;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.r += s;\n\t\tthis.g += s;\n\t\tthis.b += s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( color ) {\n\n\t\tthis.r = Math.max( 0, this.r - color.r );\n\t\tthis.g = Math.max( 0, this.g - color.g );\n\t\tthis.b = Math.max( 0, this.b - color.b );\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( color ) {\n\n\t\tthis.r *= color.r;\n\t\tthis.g *= color.g;\n\t\tthis.b *= color.b;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tthis.r *= s;\n\t\tthis.g *= s;\n\t\tthis.b *= s;\n\n\t\treturn this;\n\n\t}\n\n\tlerp( color, alpha ) {\n\n\t\tthis.r += ( color.r - this.r ) * alpha;\n\t\tthis.g += ( color.g - this.g ) * alpha;\n\t\tthis.b += ( color.b - this.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpColors( color1, color2, alpha ) {\n\n\t\tthis.r = color1.r + ( color2.r - color1.r ) * alpha;\n\t\tthis.g = color1.g + ( color2.g - color1.g ) * alpha;\n\t\tthis.b = color1.b + ( color2.b - color1.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpHSL( color, alpha ) {\n\n\t\tthis.getHSL( _hslA );\n\t\tcolor.getHSL( _hslB );\n\n\t\tconst h = lerp( _hslA.h, _hslB.h, alpha );\n\t\tconst s = lerp( _hslA.s, _hslB.s, alpha );\n\t\tconst l = lerp( _hslA.l, _hslB.l, alpha );\n\n\t\tthis.setHSL( h, s, l );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\tthis.r = v.x;\n\t\tthis.g = v.y;\n\t\tthis.b = v.z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst r = this.r, g = this.g, b = this.b;\n\t\tconst e = m.elements;\n\n\t\tthis.r = e[ 0 ] * r + e[ 3 ] * g + e[ 6 ] * b;\n\t\tthis.g = e[ 1 ] * r + e[ 4 ] * g + e[ 7 ] * b;\n\t\tthis.b = e[ 2 ] * r + e[ 5 ] * g + e[ 8 ] * b;\n\n\t\treturn this;\n\n\t}\n\n\tequals( c ) {\n\n\t\treturn ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.r = array[ offset ];\n\t\tthis.g = array[ offset + 1 ];\n\t\tthis.b = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.r;\n\t\tarray[ offset + 1 ] = this.g;\n\t\tarray[ offset + 2 ] = this.b;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.r = attribute.getX( index );\n\t\tthis.g = attribute.getY( index );\n\t\tthis.b = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.getHex();\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.r;\n\t\tyield this.g;\n\t\tyield this.b;\n\n\t}\n\n}\n\nconst _color = /*@__PURE__*/ new Color();\n\nColor.NAMES = _colorKeywords;\n\nlet _materialId = 0;\n\nclass Material extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isMaterial = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _materialId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'Material';\n\n\t\tthis.blending = NormalBlending;\n\t\tthis.side = FrontSide;\n\t\tthis.vertexColors = false;\n\n\t\tthis.opacity = 1;\n\t\tthis.transparent = false;\n\t\tthis.alphaHash = false;\n\n\t\tthis.blendSrc = SrcAlphaFactor;\n\t\tthis.blendDst = OneMinusSrcAlphaFactor;\n\t\tthis.blendEquation = AddEquation;\n\t\tthis.blendSrcAlpha = null;\n\t\tthis.blendDstAlpha = null;\n\t\tthis.blendEquationAlpha = null;\n\t\tthis.blendColor = new Color( 0, 0, 0 );\n\t\tthis.blendAlpha = 0;\n\n\t\tthis.depthFunc = LessEqualDepth;\n\t\tthis.depthTest = true;\n\t\tthis.depthWrite = true;\n\n\t\tthis.stencilWriteMask = 0xff;\n\t\tthis.stencilFunc = AlwaysStencilFunc;\n\t\tthis.stencilRef = 0;\n\t\tthis.stencilFuncMask = 0xff;\n\t\tthis.stencilFail = KeepStencilOp;\n\t\tthis.stencilZFail = KeepStencilOp;\n\t\tthis.stencilZPass = KeepStencilOp;\n\t\tthis.stencilWrite = false;\n\n\t\tthis.clippingPlanes = null;\n\t\tthis.clipIntersection = false;\n\t\tthis.clipShadows = false;\n\n\t\tthis.shadowSide = null;\n\n\t\tthis.colorWrite = true;\n\n\t\tthis.precision = null; // override the renderer's default precision for this material\n\n\t\tthis.polygonOffset = false;\n\t\tthis.polygonOffsetFactor = 0;\n\t\tthis.polygonOffsetUnits = 0;\n\n\t\tthis.dithering = false;\n\n\t\tthis.alphaToCoverage = false;\n\t\tthis.premultipliedAlpha = false;\n\t\tthis.forceSinglePass = false;\n\n\t\tthis.visible = true;\n\n\t\tthis.toneMapped = true;\n\n\t\tthis.userData = {};\n\n\t\tthis.version = 0;\n\n\t\tthis._alphaTest = 0;\n\n\t}\n\n\tget alphaTest() {\n\n\t\treturn this._alphaTest;\n\n\t}\n\n\tset alphaTest( value ) {\n\n\t\tif ( this._alphaTest > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._alphaTest = value;\n\n\t}\n\n\t// onBeforeRender and onBeforeCompile only supported in WebGLRenderer\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}\n\n\tonBeforeCompile( /* shaderobject, renderer */ ) {}\n\n\tcustomProgramCacheKey() {\n\n\t\treturn this.onBeforeCompile.toString();\n\n\t}\n\n\tsetValues( values ) {\n\n\t\tif ( values === undefined ) return;\n\n\t\tfor ( const key in values ) {\n\n\t\t\tconst newValue = values[ key ];\n\n\t\t\tif ( newValue === undefined ) {\n\n\t\t\t\tconsole.warn( `THREE.Material: parameter '${ key }' has value of undefined.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst currentValue = this[ key ];\n\n\t\t\tif ( currentValue === undefined ) {\n\n\t\t\t\tconsole.warn( `THREE.Material: '${ key }' is not a property of THREE.${ this.type }.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( currentValue && currentValue.isColor ) {\n\n\t\t\t\tcurrentValue.set( newValue );\n\n\t\t\t} else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) {\n\n\t\t\t\tcurrentValue.copy( newValue );\n\n\t\t\t} else {\n\n\t\t\t\tthis[ key ] = newValue;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( isRootObject ) {\n\n\t\t\tmeta = {\n\t\t\t\ttextures: {},\n\t\t\t\timages: {}\n\t\t\t};\n\n\t\t}\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Material',\n\t\t\t\tgenerator: 'Material.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard Material serialization\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\n\t\tif ( this.color && this.color.isColor ) data.color = this.color.getHex();\n\n\t\tif ( this.roughness !== undefined ) data.roughness = this.roughness;\n\t\tif ( this.metalness !== undefined ) data.metalness = this.metalness;\n\n\t\tif ( this.sheen !== undefined ) data.sheen = this.sheen;\n\t\tif ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();\n\t\tif ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;\n\t\tif ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();\n\t\tif ( this.emissiveIntensity !== undefined && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;\n\n\t\tif ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();\n\t\tif ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;\n\t\tif ( this.specularColor && this.specularColor.isColor ) data.specularColor = this.specularColor.getHex();\n\t\tif ( this.shininess !== undefined ) data.shininess = this.shininess;\n\t\tif ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat;\n\t\tif ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness;\n\n\t\tif ( this.clearcoatMap && this.clearcoatMap.isTexture ) {\n\n\t\t\tdata.clearcoatMap = this.clearcoatMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture ) {\n\n\t\t\tdata.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture ) {\n\n\t\t\tdata.clearcoatNormalMap = this.clearcoatNormalMap.toJSON( meta ).uuid;\n\t\t\tdata.clearcoatNormalScale = this.clearcoatNormalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.dispersion !== undefined ) data.dispersion = this.dispersion;\n\n\t\tif ( this.iridescence !== undefined ) data.iridescence = this.iridescence;\n\t\tif ( this.iridescenceIOR !== undefined ) data.iridescenceIOR = this.iridescenceIOR;\n\t\tif ( this.iridescenceThicknessRange !== undefined ) data.iridescenceThicknessRange = this.iridescenceThicknessRange;\n\n\t\tif ( this.iridescenceMap && this.iridescenceMap.isTexture ) {\n\n\t\t\tdata.iridescenceMap = this.iridescenceMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture ) {\n\n\t\t\tdata.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.anisotropy !== undefined ) data.anisotropy = this.anisotropy;\n\t\tif ( this.anisotropyRotation !== undefined ) data.anisotropyRotation = this.anisotropyRotation;\n\n\t\tif ( this.anisotropyMap && this.anisotropyMap.isTexture ) {\n\n\t\t\tdata.anisotropyMap = this.anisotropyMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid;\n\t\tif ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid;\n\t\tif ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;\n\n\t\tif ( this.lightMap && this.lightMap.isTexture ) {\n\n\t\t\tdata.lightMap = this.lightMap.toJSON( meta ).uuid;\n\t\t\tdata.lightMapIntensity = this.lightMapIntensity;\n\n\t\t}\n\n\t\tif ( this.aoMap && this.aoMap.isTexture ) {\n\n\t\t\tdata.aoMap = this.aoMap.toJSON( meta ).uuid;\n\t\t\tdata.aoMapIntensity = this.aoMapIntensity;\n\n\t\t}\n\n\t\tif ( this.bumpMap && this.bumpMap.isTexture ) {\n\n\t\t\tdata.bumpMap = this.bumpMap.toJSON( meta ).uuid;\n\t\t\tdata.bumpScale = this.bumpScale;\n\n\t\t}\n\n\t\tif ( this.normalMap && this.normalMap.isTexture ) {\n\n\t\t\tdata.normalMap = this.normalMap.toJSON( meta ).uuid;\n\t\t\tdata.normalMapType = this.normalMapType;\n\t\t\tdata.normalScale = this.normalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.displacementMap && this.displacementMap.isTexture ) {\n\n\t\t\tdata.displacementMap = this.displacementMap.toJSON( meta ).uuid;\n\t\t\tdata.displacementScale = this.displacementScale;\n\t\t\tdata.displacementBias = this.displacementBias;\n\n\t\t}\n\n\t\tif ( this.roughnessMap && this.roughnessMap.isTexture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid;\n\t\tif ( this.metalnessMap && this.metalnessMap.isTexture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid;\n\n\t\tif ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid;\n\t\tif ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;\n\t\tif ( this.specularIntensityMap && this.specularIntensityMap.isTexture ) data.specularIntensityMap = this.specularIntensityMap.toJSON( meta ).uuid;\n\t\tif ( this.specularColorMap && this.specularColorMap.isTexture ) data.specularColorMap = this.specularColorMap.toJSON( meta ).uuid;\n\n\t\tif ( this.envMap && this.envMap.isTexture ) {\n\n\t\t\tdata.envMap = this.envMap.toJSON( meta ).uuid;\n\n\t\t\tif ( this.combine !== undefined ) data.combine = this.combine;\n\n\t\t}\n\n\t\tif ( this.envMapRotation !== undefined ) data.envMapRotation = this.envMapRotation.toArray();\n\t\tif ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;\n\t\tif ( this.reflectivity !== undefined ) data.reflectivity = this.reflectivity;\n\t\tif ( this.refractionRatio !== undefined ) data.refractionRatio = this.refractionRatio;\n\n\t\tif ( this.gradientMap && this.gradientMap.isTexture ) {\n\n\t\t\tdata.gradientMap = this.gradientMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.transmission !== undefined ) data.transmission = this.transmission;\n\t\tif ( this.transmissionMap && this.transmissionMap.isTexture ) data.transmissionMap = this.transmissionMap.toJSON( meta ).uuid;\n\t\tif ( this.thickness !== undefined ) data.thickness = this.thickness;\n\t\tif ( this.thicknessMap && this.thicknessMap.isTexture ) data.thicknessMap = this.thicknessMap.toJSON( meta ).uuid;\n\t\tif ( this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity ) data.attenuationDistance = this.attenuationDistance;\n\t\tif ( this.attenuationColor !== undefined ) data.attenuationColor = this.attenuationColor.getHex();\n\n\t\tif ( this.size !== undefined ) data.size = this.size;\n\t\tif ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;\n\t\tif ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;\n\n\t\tif ( this.blending !== NormalBlending ) data.blending = this.blending;\n\t\tif ( this.side !== FrontSide ) data.side = this.side;\n\t\tif ( this.vertexColors === true ) data.vertexColors = true;\n\n\t\tif ( this.opacity < 1 ) data.opacity = this.opacity;\n\t\tif ( this.transparent === true ) data.transparent = true;\n\n\t\tif ( this.blendSrc !== SrcAlphaFactor ) data.blendSrc = this.blendSrc;\n\t\tif ( this.blendDst !== OneMinusSrcAlphaFactor ) data.blendDst = this.blendDst;\n\t\tif ( this.blendEquation !== AddEquation ) data.blendEquation = this.blendEquation;\n\t\tif ( this.blendSrcAlpha !== null ) data.blendSrcAlpha = this.blendSrcAlpha;\n\t\tif ( this.blendDstAlpha !== null ) data.blendDstAlpha = this.blendDstAlpha;\n\t\tif ( this.blendEquationAlpha !== null ) data.blendEquationAlpha = this.blendEquationAlpha;\n\t\tif ( this.blendColor && this.blendColor.isColor ) data.blendColor = this.blendColor.getHex();\n\t\tif ( this.blendAlpha !== 0 ) data.blendAlpha = this.blendAlpha;\n\n\t\tif ( this.depthFunc !== LessEqualDepth ) data.depthFunc = this.depthFunc;\n\t\tif ( this.depthTest === false ) data.depthTest = this.depthTest;\n\t\tif ( this.depthWrite === false ) data.depthWrite = this.depthWrite;\n\t\tif ( this.colorWrite === false ) data.colorWrite = this.colorWrite;\n\n\t\tif ( this.stencilWriteMask !== 0xff ) data.stencilWriteMask = this.stencilWriteMask;\n\t\tif ( this.stencilFunc !== AlwaysStencilFunc ) data.stencilFunc = this.stencilFunc;\n\t\tif ( this.stencilRef !== 0 ) data.stencilRef = this.stencilRef;\n\t\tif ( this.stencilFuncMask !== 0xff ) data.stencilFuncMask = this.stencilFuncMask;\n\t\tif ( this.stencilFail !== KeepStencilOp ) data.stencilFail = this.stencilFail;\n\t\tif ( this.stencilZFail !== KeepStencilOp ) data.stencilZFail = this.stencilZFail;\n\t\tif ( this.stencilZPass !== KeepStencilOp ) data.stencilZPass = this.stencilZPass;\n\t\tif ( this.stencilWrite === true ) data.stencilWrite = this.stencilWrite;\n\n\t\t// rotation (SpriteMaterial)\n\t\tif ( this.rotation !== undefined && this.rotation !== 0 ) data.rotation = this.rotation;\n\n\t\tif ( this.polygonOffset === true ) data.polygonOffset = true;\n\t\tif ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;\n\t\tif ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;\n\n\t\tif ( this.linewidth !== undefined && this.linewidth !== 1 ) data.linewidth = this.linewidth;\n\t\tif ( this.dashSize !== undefined ) data.dashSize = this.dashSize;\n\t\tif ( this.gapSize !== undefined ) data.gapSize = this.gapSize;\n\t\tif ( this.scale !== undefined ) data.scale = this.scale;\n\n\t\tif ( this.dithering === true ) data.dithering = true;\n\n\t\tif ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;\n\t\tif ( this.alphaHash === true ) data.alphaHash = true;\n\t\tif ( this.alphaToCoverage === true ) data.alphaToCoverage = true;\n\t\tif ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;\n\t\tif ( this.forceSinglePass === true ) data.forceSinglePass = true;\n\n\t\tif ( this.wireframe === true ) data.wireframe = true;\n\t\tif ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;\n\t\tif ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;\n\t\tif ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;\n\n\t\tif ( this.flatShading === true ) data.flatShading = true;\n\n\t\tif ( this.visible === false ) data.visible = false;\n\n\t\tif ( this.toneMapped === false ) data.toneMapped = false;\n\n\t\tif ( this.fog === false ) data.fog = false;\n\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\t// TODO: Copied from Object3D.toJSON\n\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\n\t\t\tif ( textures.length > 0 ) data.textures = textures;\n\t\t\tif ( images.length > 0 ) data.images = images;\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.blending = source.blending;\n\t\tthis.side = source.side;\n\t\tthis.vertexColors = source.vertexColors;\n\n\t\tthis.opacity = source.opacity;\n\t\tthis.transparent = source.transparent;\n\n\t\tthis.blendSrc = source.blendSrc;\n\t\tthis.blendDst = source.blendDst;\n\t\tthis.blendEquation = source.blendEquation;\n\t\tthis.blendSrcAlpha = source.blendSrcAlpha;\n\t\tthis.blendDstAlpha = source.blendDstAlpha;\n\t\tthis.blendEquationAlpha = source.blendEquationAlpha;\n\t\tthis.blendColor.copy( source.blendColor );\n\t\tthis.blendAlpha = source.blendAlpha;\n\n\t\tthis.depthFunc = source.depthFunc;\n\t\tthis.depthTest = source.depthTest;\n\t\tthis.depthWrite = source.depthWrite;\n\n\t\tthis.stencilWriteMask = source.stencilWriteMask;\n\t\tthis.stencilFunc = source.stencilFunc;\n\t\tthis.stencilRef = source.stencilRef;\n\t\tthis.stencilFuncMask = source.stencilFuncMask;\n\t\tthis.stencilFail = source.stencilFail;\n\t\tthis.stencilZFail = source.stencilZFail;\n\t\tthis.stencilZPass = source.stencilZPass;\n\t\tthis.stencilWrite = source.stencilWrite;\n\n\t\tconst srcPlanes = source.clippingPlanes;\n\t\tlet dstPlanes = null;\n\n\t\tif ( srcPlanes !== null ) {\n\n\t\t\tconst n = srcPlanes.length;\n\t\t\tdstPlanes = new Array( n );\n\n\t\t\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\t\t\tdstPlanes[ i ] = srcPlanes[ i ].clone();\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.clippingPlanes = dstPlanes;\n\t\tthis.clipIntersection = source.clipIntersection;\n\t\tthis.clipShadows = source.clipShadows;\n\n\t\tthis.shadowSide = source.shadowSide;\n\n\t\tthis.colorWrite = source.colorWrite;\n\n\t\tthis.precision = source.precision;\n\n\t\tthis.polygonOffset = source.polygonOffset;\n\t\tthis.polygonOffsetFactor = source.polygonOffsetFactor;\n\t\tthis.polygonOffsetUnits = source.polygonOffsetUnits;\n\n\t\tthis.dithering = source.dithering;\n\n\t\tthis.alphaTest = source.alphaTest;\n\t\tthis.alphaHash = source.alphaHash;\n\t\tthis.alphaToCoverage = source.alphaToCoverage;\n\t\tthis.premultipliedAlpha = source.premultipliedAlpha;\n\t\tthis.forceSinglePass = source.forceSinglePass;\n\n\t\tthis.visible = source.visible;\n\n\t\tthis.toneMapped = source.toneMapped;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tonBuild( /* shaderobject, renderer */ ) {\n\n\t\tconsole.warn( 'Material: onBuild() has been removed.' ); // @deprecated, r166\n\n\t}\n\n}\n\nclass MeshBasicMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshBasicMaterial = true;\n\n\t\tthis.type = 'MeshBasicMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // emissive\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.envMapRotation = new Euler();\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapRotation.copy( source.envMapRotation );\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\n// Fast Half Float Conversions, http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n\nconst _tables = /*@__PURE__*/ _generateTables();\n\nfunction _generateTables() {\n\n\t// float32 to float16 helpers\n\n\tconst buffer = new ArrayBuffer( 4 );\n\tconst floatView = new Float32Array( buffer );\n\tconst uint32View = new Uint32Array( buffer );\n\n\tconst baseTable = new Uint32Array( 512 );\n\tconst shiftTable = new Uint32Array( 512 );\n\n\tfor ( let i = 0; i < 256; ++ i ) {\n\n\t\tconst e = i - 127;\n\n\t\t// very small number (0, -0)\n\n\t\tif ( e < - 27 ) {\n\n\t\t\tbaseTable[ i ] = 0x0000;\n\t\t\tbaseTable[ i | 0x100 ] = 0x8000;\n\t\t\tshiftTable[ i ] = 24;\n\t\t\tshiftTable[ i | 0x100 ] = 24;\n\n\t\t\t// small number (denorm)\n\n\t\t} else if ( e < - 14 ) {\n\n\t\t\tbaseTable[ i ] = 0x0400 >> ( - e - 14 );\n\t\t\tbaseTable[ i | 0x100 ] = ( 0x0400 >> ( - e - 14 ) ) | 0x8000;\n\t\t\tshiftTable[ i ] = - e - 1;\n\t\t\tshiftTable[ i | 0x100 ] = - e - 1;\n\n\t\t\t// normal number\n\n\t\t} else if ( e <= 15 ) {\n\n\t\t\tbaseTable[ i ] = ( e + 15 ) << 10;\n\t\t\tbaseTable[ i | 0x100 ] = ( ( e + 15 ) << 10 ) | 0x8000;\n\t\t\tshiftTable[ i ] = 13;\n\t\t\tshiftTable[ i | 0x100 ] = 13;\n\n\t\t\t// large number (Infinity, -Infinity)\n\n\t\t} else if ( e < 128 ) {\n\n\t\t\tbaseTable[ i ] = 0x7c00;\n\t\t\tbaseTable[ i | 0x100 ] = 0xfc00;\n\t\t\tshiftTable[ i ] = 24;\n\t\t\tshiftTable[ i | 0x100 ] = 24;\n\n\t\t\t// stay (NaN, Infinity, -Infinity)\n\n\t\t} else {\n\n\t\t\tbaseTable[ i ] = 0x7c00;\n\t\t\tbaseTable[ i | 0x100 ] = 0xfc00;\n\t\t\tshiftTable[ i ] = 13;\n\t\t\tshiftTable[ i | 0x100 ] = 13;\n\n\t\t}\n\n\t}\n\n\t// float16 to float32 helpers\n\n\tconst mantissaTable = new Uint32Array( 2048 );\n\tconst exponentTable = new Uint32Array( 64 );\n\tconst offsetTable = new Uint32Array( 64 );\n\n\tfor ( let i = 1; i < 1024; ++ i ) {\n\n\t\tlet m = i << 13; // zero pad mantissa bits\n\t\tlet e = 0; // zero exponent\n\n\t\t// normalized\n\t\twhile ( ( m & 0x00800000 ) === 0 ) {\n\n\t\t\tm <<= 1;\n\t\t\te -= 0x00800000; // decrement exponent\n\n\t\t}\n\n\t\tm &= ~ 0x00800000; // clear leading 1 bit\n\t\te += 0x38800000; // adjust bias\n\n\t\tmantissaTable[ i ] = m | e;\n\n\t}\n\n\tfor ( let i = 1024; i < 2048; ++ i ) {\n\n\t\tmantissaTable[ i ] = 0x38000000 + ( ( i - 1024 ) << 13 );\n\n\t}\n\n\tfor ( let i = 1; i < 31; ++ i ) {\n\n\t\texponentTable[ i ] = i << 23;\n\n\t}\n\n\texponentTable[ 31 ] = 0x47800000;\n\texponentTable[ 32 ] = 0x80000000;\n\n\tfor ( let i = 33; i < 63; ++ i ) {\n\n\t\texponentTable[ i ] = 0x80000000 + ( ( i - 32 ) << 23 );\n\n\t}\n\n\texponentTable[ 63 ] = 0xc7800000;\n\n\tfor ( let i = 1; i < 64; ++ i ) {\n\n\t\tif ( i !== 32 ) {\n\n\t\t\toffsetTable[ i ] = 1024;\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tfloatView: floatView,\n\t\tuint32View: uint32View,\n\t\tbaseTable: baseTable,\n\t\tshiftTable: shiftTable,\n\t\tmantissaTable: mantissaTable,\n\t\texponentTable: exponentTable,\n\t\toffsetTable: offsetTable\n\t};\n\n}\n\n// float32 to float16\n\nfunction toHalfFloat( val ) {\n\n\tif ( Math.abs( val ) > 65504 ) console.warn( 'THREE.DataUtils.toHalfFloat(): Value out of range.' );\n\n\tval = clamp( val, - 65504, 65504 );\n\n\t_tables.floatView[ 0 ] = val;\n\tconst f = _tables.uint32View[ 0 ];\n\tconst e = ( f >> 23 ) & 0x1ff;\n\treturn _tables.baseTable[ e ] + ( ( f & 0x007fffff ) >> _tables.shiftTable[ e ] );\n\n}\n\n// float16 to float32\n\nfunction fromHalfFloat( val ) {\n\n\tconst m = val >> 10;\n\t_tables.uint32View[ 0 ] = _tables.mantissaTable[ _tables.offsetTable[ m ] + ( val & 0x3ff ) ] + _tables.exponentTable[ m ];\n\treturn _tables.floatView[ 0 ];\n\n}\n\nconst DataUtils = {\n\ttoHalfFloat: toHalfFloat,\n\tfromHalfFloat: fromHalfFloat,\n};\n\nconst _vector$9 = /*@__PURE__*/ new Vector3();\nconst _vector2$1 = /*@__PURE__*/ new Vector2();\n\nclass BufferAttribute {\n\n\tconstructor( array, itemSize, normalized = false ) {\n\n\t\tif ( Array.isArray( array ) ) {\n\n\t\t\tthrow new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' );\n\n\t\t}\n\n\t\tthis.isBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.array = array;\n\t\tthis.itemSize = itemSize;\n\t\tthis.count = array !== undefined ? array.length / itemSize : 0;\n\t\tthis.normalized = normalized;\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis._updateRange = { offset: 0, count: - 1 };\n\t\tthis.updateRanges = [];\n\t\tthis.gpuType = FloatType;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tonUploadCallback() {}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tget updateRange() {\n\n\t\twarnOnce( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159\n\t\treturn this._updateRange;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\taddUpdateRange( start, count ) {\n\n\t\tthis.updateRanges.push( { start, count } );\n\n\t}\n\n\tclearUpdateRanges() {\n\n\t\tthis.updateRanges.length = 0;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.itemSize = source.itemSize;\n\t\tthis.count = source.count;\n\t\tthis.normalized = source.normalized;\n\n\t\tthis.usage = source.usage;\n\t\tthis.gpuType = source.gpuType;\n\n\t\treturn this;\n\n\t}\n\n\tcopyAt( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.itemSize;\n\t\tindex2 *= attribute.itemSize;\n\n\t\tfor ( let i = 0, l = this.itemSize; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcopyArray( array ) {\n\n\t\tthis.array.set( array );\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tif ( this.itemSize === 2 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector2$1.fromBufferAttribute( this, i );\n\t\t\t\t_vector2$1.applyMatrix3( m );\n\n\t\t\t\tthis.setXY( i, _vector2$1.x, _vector2$1.y );\n\n\t\t\t}\n\n\t\t} else if ( this.itemSize === 3 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector$9.fromBufferAttribute( this, i );\n\t\t\t\t_vector$9.applyMatrix3( m );\n\n\t\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$9.fromBufferAttribute( this, i );\n\n\t\t\t_vector$9.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$9.fromBufferAttribute( this, i );\n\n\t\t\t_vector$9.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$9.fromBufferAttribute( this, i );\n\n\t\t\t_vector$9.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tset( value, offset = 0 ) {\n\n\t\t// Matching BufferAttribute constructor, do not normalize the array.\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index, component ) {\n\n\t\tlet value = this.array[ index * this.itemSize + component ];\n\n\t\tif ( this.normalized ) value = denormalize( value, this.array );\n\n\t\treturn value;\n\n\t}\n\n\tsetComponent( index, component, value ) {\n\n\t\tif ( this.normalized ) value = normalize( value, this.array );\n\n\t\tthis.array[ index * this.itemSize + component ] = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = this.array[ index * this.itemSize ];\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.array[ index * this.itemSize ] = x;\n\n\t\treturn this;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = this.array[ index * this.itemSize + 1 ];\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.array[ index * this.itemSize + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = this.array[ index * this.itemSize + 2 ];\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.array[ index * this.itemSize + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = this.array[ index * this.itemSize + 3 ];\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.array[ index * this.itemSize + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\t\tthis.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tonUpload( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.array, this.itemSize ).copy( this );\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\titemSize: this.itemSize,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tarray: Array.from( this.array ),\n\t\t\tnormalized: this.normalized\n\t\t};\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( this.usage !== StaticDrawUsage ) data.usage = this.usage;\n\n\t\treturn data;\n\n\t}\n\n}\n\n//\n\nclass Int8BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint8BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint8ClampedBufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8ClampedArray( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Int16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Int32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Float16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t\tthis.isFloat16BufferAttribute = true;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = fromHalfFloat( this.array[ index * this.itemSize ] );\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.array[ index * this.itemSize ] = toHalfFloat( x );\n\n\t\treturn this;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = fromHalfFloat( this.array[ index * this.itemSize + 1 ] );\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.array[ index * this.itemSize + 1 ] = toHalfFloat( y );\n\n\t\treturn this;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = fromHalfFloat( this.array[ index * this.itemSize + 2 ] );\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.array[ index * this.itemSize + 2 ] = toHalfFloat( z );\n\n\t\treturn this;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = fromHalfFloat( this.array[ index * this.itemSize + 3 ] );\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.array[ index * this.itemSize + 3 ] = toHalfFloat( w );\n\n\t\treturn this;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\n\t\tthis.array[ index + 3 ] = toHalfFloat( w );\n\n\t\treturn this;\n\n\t}\n\n}\n\n\nclass Float32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Float32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nlet _id$2 = 0;\n\nconst _m1$2 = /*@__PURE__*/ new Matrix4();\nconst _obj = /*@__PURE__*/ new Object3D();\nconst _offset = /*@__PURE__*/ new Vector3();\nconst _box$2 = /*@__PURE__*/ new Box3();\nconst _boxMorphTargets = /*@__PURE__*/ new Box3();\nconst _vector$8 = /*@__PURE__*/ new Vector3();\n\nclass BufferGeometry extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isBufferGeometry = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _id$2 ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'BufferGeometry';\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\n\t\tthis.morphAttributes = {};\n\t\tthis.morphTargetsRelative = false;\n\n\t\tthis.groups = [];\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\tthis.drawRange = { start: 0, count: Infinity };\n\n\t\tthis.userData = {};\n\n\t}\n\n\tgetIndex() {\n\n\t\treturn this.index;\n\n\t}\n\n\tsetIndex( index ) {\n\n\t\tif ( Array.isArray( index ) ) {\n\n\t\t\tthis.index = new ( arrayNeedsUint32( index ) ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 );\n\n\t\t} else {\n\n\t\t\tthis.index = index;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetAttribute( name ) {\n\n\t\treturn this.attributes[ name ];\n\n\t}\n\n\tsetAttribute( name, attribute ) {\n\n\t\tthis.attributes[ name ] = attribute;\n\n\t\treturn this;\n\n\t}\n\n\tdeleteAttribute( name ) {\n\n\t\tdelete this.attributes[ name ];\n\n\t\treturn this;\n\n\t}\n\n\thasAttribute( name ) {\n\n\t\treturn this.attributes[ name ] !== undefined;\n\n\t}\n\n\taddGroup( start, count, materialIndex = 0 ) {\n\n\t\tthis.groups.push( {\n\n\t\t\tstart: start,\n\t\t\tcount: count,\n\t\t\tmaterialIndex: materialIndex\n\n\t\t} );\n\n\t}\n\n\tclearGroups() {\n\n\t\tthis.groups = [];\n\n\t}\n\n\tsetDrawRange( start, count ) {\n\n\t\tthis.drawRange.start = start;\n\t\tthis.drawRange.count = count;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tconst position = this.attributes.position;\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tposition.applyMatrix4( matrix );\n\n\t\t\tposition.needsUpdate = true;\n\n\t\t}\n\n\t\tconst normal = this.attributes.normal;\n\n\t\tif ( normal !== undefined ) {\n\n\t\t\tconst normalMatrix = new Matrix3().getNormalMatrix( matrix );\n\n\t\t\tnormal.applyNormalMatrix( normalMatrix );\n\n\t\t\tnormal.needsUpdate = true;\n\n\t\t}\n\n\t\tconst tangent = this.attributes.tangent;\n\n\t\tif ( tangent !== undefined ) {\n\n\t\t\ttangent.transformDirection( matrix );\n\n\t\t\ttangent.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tthis.computeBoundingBox();\n\n\t\t}\n\n\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\tthis.computeBoundingSphere();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\t_m1$2.makeRotationFromQuaternion( q );\n\n\t\tthis.applyMatrix4( _m1$2 );\n\n\t\treturn this;\n\n\t}\n\n\trotateX( angle ) {\n\n\t\t// rotate geometry around world x-axis\n\n\t\t_m1$2.makeRotationX( angle );\n\n\t\tthis.applyMatrix4( _m1$2 );\n\n\t\treturn this;\n\n\t}\n\n\trotateY( angle ) {\n\n\t\t// rotate geometry around world y-axis\n\n\t\t_m1$2.makeRotationY( angle );\n\n\t\tthis.applyMatrix4( _m1$2 );\n\n\t\treturn this;\n\n\t}\n\n\trotateZ( angle ) {\n\n\t\t// rotate geometry around world z-axis\n\n\t\t_m1$2.makeRotationZ( angle );\n\n\t\tthis.applyMatrix4( _m1$2 );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( x, y, z ) {\n\n\t\t// translate geometry\n\n\t\t_m1$2.makeTranslation( x, y, z );\n\n\t\tthis.applyMatrix4( _m1$2 );\n\n\t\treturn this;\n\n\t}\n\n\tscale( x, y, z ) {\n\n\t\t// scale geometry\n\n\t\t_m1$2.makeScale( x, y, z );\n\n\t\tthis.applyMatrix4( _m1$2 );\n\n\t\treturn this;\n\n\t}\n\n\tlookAt( vector ) {\n\n\t\t_obj.lookAt( vector );\n\n\t\t_obj.updateMatrix();\n\n\t\tthis.applyMatrix4( _obj.matrix );\n\n\t\treturn this;\n\n\t}\n\n\tcenter() {\n\n\t\tthis.computeBoundingBox();\n\n\t\tthis.boundingBox.getCenter( _offset ).negate();\n\n\t\tthis.translate( _offset.x, _offset.y, _offset.z );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tconst position = [];\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst point = points[ i ];\n\t\t\tposition.push( point.x, point.y, point.z || 0 );\n\n\t\t}\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );\n\n\t\treturn this;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.', this );\n\n\t\t\tthis.boundingBox.set(\n\t\t\t\tnew Vector3( - Infinity, - Infinity, - Infinity ),\n\t\t\t\tnew Vector3( + Infinity, + Infinity, + Infinity )\n\t\t\t);\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tthis.boundingBox.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_box$2.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$8.addVectors( this.boundingBox.min, _box$2.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$8 );\n\n\t\t\t\t\t\t_vector$8.addVectors( this.boundingBox.max, _box$2.max );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$8 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$2.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$2.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.boundingBox.makeEmpty();\n\n\t\t}\n\n\t\tif ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.', this );\n\n\t\t\tthis.boundingSphere.set( new Vector3(), Infinity );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position ) {\n\n\t\t\t// first, find the center of the bounding sphere\n\n\t\t\tconst center = this.boundingSphere.center;\n\n\t\t\t_box$2.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_boxMorphTargets.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$8.addVectors( _box$2.min, _boxMorphTargets.min );\n\t\t\t\t\t\t_box$2.expandByPoint( _vector$8 );\n\n\t\t\t\t\t\t_vector$8.addVectors( _box$2.max, _boxMorphTargets.max );\n\t\t\t\t\t\t_box$2.expandByPoint( _vector$8 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_box$2.expandByPoint( _boxMorphTargets.min );\n\t\t\t\t\t\t_box$2.expandByPoint( _boxMorphTargets.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_box$2.getCenter( center );\n\n\t\t\t// second, try to find a boundingSphere with a radius smaller than the\n\t\t\t// boundingSphere of the boundingBox: sqrt(3) smaller in the best case\n\n\t\t\tlet maxRadiusSq = 0;\n\n\t\t\tfor ( let i = 0, il = position.count; i < il; i ++ ) {\n\n\t\t\t\t_vector$8.fromBufferAttribute( position, i );\n\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );\n\n\t\t\t}\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\tconst morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t\t\t\tfor ( let j = 0, jl = morphAttribute.count; j < jl; j ++ ) {\n\n\t\t\t\t\t\t_vector$8.fromBufferAttribute( morphAttribute, j );\n\n\t\t\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t\t\t_offset.fromBufferAttribute( position, j );\n\t\t\t\t\t\t\t_vector$8.add( _offset );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.boundingSphere.radius = Math.sqrt( maxRadiusSq );\n\n\t\t\tif ( isNaN( this.boundingSphere.radius ) ) {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcomputeTangents() {\n\n\t\tconst index = this.index;\n\t\tconst attributes = this.attributes;\n\n\t\t// based on http://www.terathon.com/code/tangent.html\n\t\t// (per vertex tangents)\n\n\t\tif ( index === null ||\n\t\t\t attributes.position === undefined ||\n\t\t\t attributes.normal === undefined ||\n\t\t\t attributes.uv === undefined ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst positionAttribute = attributes.position;\n\t\tconst normalAttribute = attributes.normal;\n\t\tconst uvAttribute = attributes.uv;\n\n\t\tif ( this.hasAttribute( 'tangent' ) === false ) {\n\n\t\t\tthis.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * positionAttribute.count ), 4 ) );\n\n\t\t}\n\n\t\tconst tangentAttribute = this.getAttribute( 'tangent' );\n\n\t\tconst tan1 = [], tan2 = [];\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\n\n\t\t\ttan1[ i ] = new Vector3();\n\t\t\ttan2[ i ] = new Vector3();\n\n\t\t}\n\n\t\tconst vA = new Vector3(),\n\t\t\tvB = new Vector3(),\n\t\t\tvC = new Vector3(),\n\n\t\t\tuvA = new Vector2(),\n\t\t\tuvB = new Vector2(),\n\t\t\tuvC = new Vector2(),\n\n\t\t\tsdir = new Vector3(),\n\t\t\ttdir = new Vector3();\n\n\t\tfunction handleTriangle( a, b, c ) {\n\n\t\t\tvA.fromBufferAttribute( positionAttribute, a );\n\t\t\tvB.fromBufferAttribute( positionAttribute, b );\n\t\t\tvC.fromBufferAttribute( positionAttribute, c );\n\n\t\t\tuvA.fromBufferAttribute( uvAttribute, a );\n\t\t\tuvB.fromBufferAttribute( uvAttribute, b );\n\t\t\tuvC.fromBufferAttribute( uvAttribute, c );\n\n\t\t\tvB.sub( vA );\n\t\t\tvC.sub( vA );\n\n\t\t\tuvB.sub( uvA );\n\t\t\tuvC.sub( uvA );\n\n\t\t\tconst r = 1.0 / ( uvB.x * uvC.y - uvC.x * uvB.y );\n\n\t\t\t// silently ignore degenerate uv triangles having coincident or colinear vertices\n\n\t\t\tif ( ! isFinite( r ) ) return;\n\n\t\t\tsdir.copy( vB ).multiplyScalar( uvC.y ).addScaledVector( vC, - uvB.y ).multiplyScalar( r );\n\t\t\ttdir.copy( vC ).multiplyScalar( uvB.x ).addScaledVector( vB, - uvC.x ).multiplyScalar( r );\n\n\t\t\ttan1[ a ].add( sdir );\n\t\t\ttan1[ b ].add( sdir );\n\t\t\ttan1[ c ].add( sdir );\n\n\t\t\ttan2[ a ].add( tdir );\n\t\t\ttan2[ b ].add( tdir );\n\t\t\ttan2[ c ].add( tdir );\n\n\t\t}\n\n\t\tlet groups = this.groups;\n\n\t\tif ( groups.length === 0 ) {\n\n\t\t\tgroups = [ {\n\t\t\t\tstart: 0,\n\t\t\t\tcount: index.count\n\t\t\t} ];\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleTriangle(\n\t\t\t\t\tindex.getX( j + 0 ),\n\t\t\t\t\tindex.getX( j + 1 ),\n\t\t\t\t\tindex.getX( j + 2 )\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst tmp = new Vector3(), tmp2 = new Vector3();\n\t\tconst n = new Vector3(), n2 = new Vector3();\n\n\t\tfunction handleVertex( v ) {\n\n\t\t\tn.fromBufferAttribute( normalAttribute, v );\n\t\t\tn2.copy( n );\n\n\t\t\tconst t = tan1[ v ];\n\n\t\t\t// Gram-Schmidt orthogonalize\n\n\t\t\ttmp.copy( t );\n\t\t\ttmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();\n\n\t\t\t// Calculate handedness\n\n\t\t\ttmp2.crossVectors( n2, t );\n\t\t\tconst test = tmp2.dot( tan2[ v ] );\n\t\t\tconst w = ( test < 0.0 ) ? - 1.0 : 1.0;\n\n\t\t\ttangentAttribute.setXYZW( v, tmp.x, tmp.y, tmp.z, w );\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleVertex( index.getX( j + 0 ) );\n\t\t\t\thandleVertex( index.getX( j + 1 ) );\n\t\t\t\thandleVertex( index.getX( j + 2 ) );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcomputeVertexNormals() {\n\n\t\tconst index = this.index;\n\t\tconst positionAttribute = this.getAttribute( 'position' );\n\n\t\tif ( positionAttribute !== undefined ) {\n\n\t\t\tlet normalAttribute = this.getAttribute( 'normal' );\n\n\t\t\tif ( normalAttribute === undefined ) {\n\n\t\t\t\tnormalAttribute = new BufferAttribute( new Float32Array( positionAttribute.count * 3 ), 3 );\n\t\t\t\tthis.setAttribute( 'normal', normalAttribute );\n\n\t\t\t} else {\n\n\t\t\t\t// reset existing normals to zero\n\n\t\t\t\tfor ( let i = 0, il = normalAttribute.count; i < il; i ++ ) {\n\n\t\t\t\t\tnormalAttribute.setXYZ( i, 0, 0, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst pA = new Vector3(), pB = new Vector3(), pC = new Vector3();\n\t\t\tconst nA = new Vector3(), nB = new Vector3(), nC = new Vector3();\n\t\t\tconst cb = new Vector3(), ab = new Vector3();\n\n\t\t\t// indexed elements\n\n\t\t\tif ( index ) {\n\n\t\t\t\tfor ( let i = 0, il = index.count; i < il; i += 3 ) {\n\n\t\t\t\t\tconst vA = index.getX( i + 0 );\n\t\t\t\t\tconst vB = index.getX( i + 1 );\n\t\t\t\t\tconst vC = index.getX( i + 2 );\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, vA );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, vB );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, vC );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnA.fromBufferAttribute( normalAttribute, vA );\n\t\t\t\t\tnB.fromBufferAttribute( normalAttribute, vB );\n\t\t\t\t\tnC.fromBufferAttribute( normalAttribute, vC );\n\n\t\t\t\t\tnA.add( cb );\n\t\t\t\t\tnB.add( cb );\n\t\t\t\t\tnC.add( cb );\n\n\t\t\t\t\tnormalAttribute.setXYZ( vA, nA.x, nA.y, nA.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vB, nB.x, nB.y, nB.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vC, nC.x, nC.y, nC.z );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed elements (unconnected triangle soup)\n\n\t\t\t\tfor ( let i = 0, il = positionAttribute.count; i < il; i += 3 ) {\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, i + 0 );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, i + 1 );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, i + 2 );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnormalAttribute.setXYZ( i + 0, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 1, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 2, cb.x, cb.y, cb.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.normalizeNormals();\n\n\t\t\tnormalAttribute.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tnormalizeNormals() {\n\n\t\tconst normals = this.attributes.normal;\n\n\t\tfor ( let i = 0, il = normals.count; i < il; i ++ ) {\n\n\t\t\t_vector$8.fromBufferAttribute( normals, i );\n\n\t\t\t_vector$8.normalize();\n\n\t\t\tnormals.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t}\n\n\t}\n\n\ttoNonIndexed() {\n\n\t\tfunction convertBufferAttribute( attribute, indices ) {\n\n\t\t\tconst array = attribute.array;\n\t\t\tconst itemSize = attribute.itemSize;\n\t\t\tconst normalized = attribute.normalized;\n\n\t\t\tconst array2 = new array.constructor( indices.length * itemSize );\n\n\t\t\tlet index = 0, index2 = 0;\n\n\t\t\tfor ( let i = 0, l = indices.length; i < l; i ++ ) {\n\n\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\tindex = indices[ i ] * attribute.data.stride + attribute.offset;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tindex = indices[ i ] * itemSize;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let j = 0; j < itemSize; j ++ ) {\n\n\t\t\t\t\tarray2[ index2 ++ ] = array[ index ++ ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( array2, itemSize, normalized );\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.index === null ) {\n\n\t\t\tconsole.warn( 'THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.' );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst geometry2 = new BufferGeometry();\n\n\t\tconst indices = this.index.array;\n\t\tconst attributes = this.attributes;\n\n\t\t// attributes\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\n\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\tgeometry2.setAttribute( name, newAttribute );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = this.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst morphArray = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, il = morphAttribute.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = morphAttribute[ i ];\n\n\t\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\t\tmorphArray.push( newAttribute );\n\n\t\t\t}\n\n\t\t\tgeometry2.morphAttributes[ name ] = morphArray;\n\n\t\t}\n\n\t\tgeometry2.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = this.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tgeometry2.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\treturn geometry2;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'BufferGeometry',\n\t\t\t\tgenerator: 'BufferGeometry.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard BufferGeometry serialization\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\tif ( this.parameters !== undefined ) {\n\n\t\t\tconst parameters = this.parameters;\n\n\t\t\tfor ( const key in parameters ) {\n\n\t\t\t\tif ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ];\n\n\t\t\t}\n\n\t\t\treturn data;\n\n\t\t}\n\n\t\t// for simplicity the code assumes attributes are not shared across geometries, see #15811\n\n\t\tdata.data = { attributes: {} };\n\n\t\tconst index = this.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tdata.data.index = {\n\t\t\t\ttype: index.array.constructor.name,\n\t\t\t\tarray: Array.prototype.slice.call( index.array )\n\t\t\t};\n\n\t\t}\n\n\t\tconst attributes = this.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\n\t\t\tdata.data.attributes[ key ] = attribute.toJSON( data.data );\n\n\t\t}\n\n\t\tconst morphAttributes = {};\n\t\tlet hasMorphAttributes = false;\n\n\t\tfor ( const key in this.morphAttributes ) {\n\n\t\t\tconst attributeArray = this.morphAttributes[ key ];\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = attributeArray[ i ];\n\n\t\t\t\tarray.push( attribute.toJSON( data.data ) );\n\n\t\t\t}\n\n\t\t\tif ( array.length > 0 ) {\n\n\t\t\t\tmorphAttributes[ key ] = array;\n\n\t\t\t\thasMorphAttributes = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( hasMorphAttributes ) {\n\n\t\t\tdata.data.morphAttributes = morphAttributes;\n\t\t\tdata.data.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t}\n\n\t\tconst groups = this.groups;\n\n\t\tif ( groups.length > 0 ) {\n\n\t\t\tdata.data.groups = JSON.parse( JSON.stringify( groups ) );\n\n\t\t}\n\n\t\tconst boundingSphere = this.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tdata.data.boundingSphere = {\n\t\t\t\tcenter: boundingSphere.center.toArray(),\n\t\t\t\tradius: boundingSphere.radius\n\t\t\t};\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\t// reset\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\t\tthis.morphAttributes = {};\n\t\tthis.groups = [];\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\t// used for storing cloned, shared data\n\n\t\tconst data = {};\n\n\t\t// name\n\n\t\tthis.name = source.name;\n\n\t\t// index\n\n\t\tconst index = source.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tthis.setIndex( index.clone( data ) );\n\n\t\t}\n\n\t\t// attributes\n\n\t\tconst attributes = source.attributes;\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\t\t\tthis.setAttribute( name, attribute.clone( data ) );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = source.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst array = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, l = morphAttribute.length; i < l; i ++ ) {\n\n\t\t\t\tarray.push( morphAttribute[ i ].clone( data ) );\n\n\t\t\t}\n\n\t\t\tthis.morphAttributes[ name ] = array;\n\n\t\t}\n\n\t\tthis.morphTargetsRelative = source.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = source.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tthis.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\t// bounding box\n\n\t\tconst boundingBox = source.boundingBox;\n\n\t\tif ( boundingBox !== null ) {\n\n\t\t\tthis.boundingBox = boundingBox.clone();\n\n\t\t}\n\n\t\t// bounding sphere\n\n\t\tconst boundingSphere = source.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tthis.boundingSphere = boundingSphere.clone();\n\n\t\t}\n\n\t\t// draw range\n\n\t\tthis.drawRange.start = source.drawRange.start;\n\t\tthis.drawRange.count = source.drawRange.count;\n\n\t\t// user data\n\n\t\tthis.userData = source.userData;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nconst _inverseMatrix$3 = /*@__PURE__*/ new Matrix4();\nconst _ray$3 = /*@__PURE__*/ new Ray();\nconst _sphere$6 = /*@__PURE__*/ new Sphere();\nconst _sphereHitAt = /*@__PURE__*/ new Vector3();\n\nconst _vA$1 = /*@__PURE__*/ new Vector3();\nconst _vB$1 = /*@__PURE__*/ new Vector3();\nconst _vC$1 = /*@__PURE__*/ new Vector3();\n\nconst _tempA = /*@__PURE__*/ new Vector3();\nconst _morphA = /*@__PURE__*/ new Vector3();\n\nconst _uvA$1 = /*@__PURE__*/ new Vector2();\nconst _uvB$1 = /*@__PURE__*/ new Vector2();\nconst _uvC$1 = /*@__PURE__*/ new Vector2();\n\nconst _normalA = /*@__PURE__*/ new Vector3();\nconst _normalB = /*@__PURE__*/ new Vector3();\nconst _normalC = /*@__PURE__*/ new Vector3();\n\nconst _intersectionPoint = /*@__PURE__*/ new Vector3();\nconst _intersectionPointWorld = /*@__PURE__*/ new Vector3();\n\nclass Mesh extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new MeshBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isMesh = true;\n\n\t\tthis.type = 'Mesh';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.morphTargetInfluences !== undefined ) {\n\n\t\t\tthis.morphTargetInfluences = source.morphTargetInfluences.slice();\n\n\t\t}\n\n\t\tif ( source.morphTargetDictionary !== undefined ) {\n\n\t\t\tthis.morphTargetDictionary = Object.assign( {}, source.morphTargetDictionary );\n\n\t\t}\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tgetVertexPosition( index, target ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst position = geometry.attributes.position;\n\t\tconst morphPosition = geometry.morphAttributes.position;\n\t\tconst morphTargetsRelative = geometry.morphTargetsRelative;\n\n\t\ttarget.fromBufferAttribute( position, index );\n\n\t\tconst morphInfluences = this.morphTargetInfluences;\n\n\t\tif ( morphPosition && morphInfluences ) {\n\n\t\t\t_morphA.set( 0, 0, 0 );\n\n\t\t\tfor ( let i = 0, il = morphPosition.length; i < il; i ++ ) {\n\n\t\t\t\tconst influence = morphInfluences[ i ];\n\t\t\t\tconst morphAttribute = morphPosition[ i ];\n\n\t\t\t\tif ( influence === 0 ) continue;\n\n\t\t\t\t_tempA.fromBufferAttribute( morphAttribute, index );\n\n\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA, influence );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA.sub( target ), influence );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\ttarget.add( _morphA );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\t\tconst matrixWorld = this.matrixWorld;\n\n\t\tif ( material === undefined ) return;\n\n\t\t// test with bounding sphere in world space\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$6.copy( geometry.boundingSphere );\n\t\t_sphere$6.applyMatrix4( matrixWorld );\n\n\t\t// check distance from ray origin to bounding sphere\n\n\t\t_ray$3.copy( raycaster.ray ).recast( raycaster.near );\n\n\t\tif ( _sphere$6.containsPoint( _ray$3.origin ) === false ) {\n\n\t\t\tif ( _ray$3.intersectSphere( _sphere$6, _sphereHitAt ) === null ) return;\n\n\t\t\tif ( _ray$3.origin.distanceToSquared( _sphereHitAt ) > ( raycaster.far - raycaster.near ) ** 2 ) return;\n\n\t\t}\n\n\t\t// convert ray to local space of mesh\n\n\t\t_inverseMatrix$3.copy( matrixWorld ).invert();\n\t\t_ray$3.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$3 );\n\n\t\t// test with bounding box in local space\n\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tif ( _ray$3.intersectsBox( geometry.boundingBox ) === false ) return;\n\n\t\t}\n\n\t\t// test for intersections with geometry\n\n\t\tthis._computeIntersections( raycaster, intersects, _ray$3 );\n\n\t}\n\n\t_computeIntersections( raycaster, intersects, rayLocalSpace ) {\n\n\t\tlet intersection;\n\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\n\t\tconst index = geometry.index;\n\t\tconst position = geometry.attributes.position;\n\t\tconst uv = geometry.attributes.uv;\n\t\tconst uv1 = geometry.attributes.uv1;\n\t\tconst normal = geometry.attributes.normal;\n\t\tconst groups = geometry.groups;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\tif ( index !== null ) {\n\n\t\t\t// indexed buffer geometry\n\n\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\tconst end = Math.min( index.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\tconst a = index.getX( j );\n\t\t\t\t\t\tconst b = index.getX( j + 1 );\n\t\t\t\t\t\tconst c = index.getX( j + 2 );\n\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\tconst a = index.getX( i );\n\t\t\t\t\tconst b = index.getX( i + 1 );\n\t\t\t\t\tconst c = index.getX( i + 2 );\n\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( position !== undefined ) {\n\n\t\t\t// non-indexed buffer geometry\n\n\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\tconst end = Math.min( position.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\tconst a = j;\n\t\t\t\t\t\tconst b = j + 1;\n\t\t\t\t\t\tconst c = j + 2;\n\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( position.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\tconst a = i;\n\t\t\t\t\tconst b = i + 1;\n\t\t\t\t\tconst c = i + 2;\n\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction checkIntersection$1( object, material, raycaster, ray, pA, pB, pC, point ) {\n\n\tlet intersect;\n\n\tif ( material.side === BackSide ) {\n\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\n\n\t} else {\n\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, ( material.side === FrontSide ), point );\n\n\t}\n\n\tif ( intersect === null ) return null;\n\n\t_intersectionPointWorld.copy( point );\n\t_intersectionPointWorld.applyMatrix4( object.matrixWorld );\n\n\tconst distance = raycaster.ray.origin.distanceTo( _intersectionPointWorld );\n\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\n\n\treturn {\n\t\tdistance: distance,\n\t\tpoint: _intersectionPointWorld.clone(),\n\t\tobject: object\n\t};\n\n}\n\nfunction checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, normal, a, b, c ) {\n\n\tobject.getVertexPosition( a, _vA$1 );\n\tobject.getVertexPosition( b, _vB$1 );\n\tobject.getVertexPosition( c, _vC$1 );\n\n\tconst intersection = checkIntersection$1( object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint );\n\n\tif ( intersection ) {\n\n\t\tif ( uv ) {\n\n\t\t\t_uvA$1.fromBufferAttribute( uv, a );\n\t\t\t_uvB$1.fromBufferAttribute( uv, b );\n\t\t\t_uvC$1.fromBufferAttribute( uv, c );\n\n\t\t\tintersection.uv = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );\n\n\t\t}\n\n\t\tif ( uv1 ) {\n\n\t\t\t_uvA$1.fromBufferAttribute( uv1, a );\n\t\t\t_uvB$1.fromBufferAttribute( uv1, b );\n\t\t\t_uvC$1.fromBufferAttribute( uv1, c );\n\n\t\t\tintersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );\n\n\t\t}\n\n\t\tif ( normal ) {\n\n\t\t\t_normalA.fromBufferAttribute( normal, a );\n\t\t\t_normalB.fromBufferAttribute( normal, b );\n\t\t\t_normalC.fromBufferAttribute( normal, c );\n\n\t\t\tintersection.normal = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _normalA, _normalB, _normalC, new Vector3() );\n\n\t\t\tif ( intersection.normal.dot( ray.direction ) > 0 ) {\n\n\t\t\t\tintersection.normal.multiplyScalar( - 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst face = {\n\t\t\ta: a,\n\t\t\tb: b,\n\t\t\tc: c,\n\t\t\tnormal: new Vector3(),\n\t\t\tmaterialIndex: 0\n\t\t};\n\n\t\tTriangle.getNormal( _vA$1, _vB$1, _vC$1, face.normal );\n\n\t\tintersection.face = face;\n\n\t}\n\n\treturn intersection;\n\n}\n\nclass BoxGeometry extends BufferGeometry {\n\n\tconstructor( width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'BoxGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\tdepth: depth,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tdepthSegments: depthSegments\n\t\t};\n\n\t\tconst scope = this;\n\n\t\t// segments\n\n\t\twidthSegments = Math.floor( widthSegments );\n\t\theightSegments = Math.floor( heightSegments );\n\t\tdepthSegments = Math.floor( depthSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet numberOfVertices = 0;\n\t\tlet groupStart = 0;\n\n\t\t// build each side of the box geometry\n\n\t\tbuildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px\n\t\tbuildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx\n\t\tbuildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py\n\t\tbuildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny\n\t\tbuildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz\n\t\tbuildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) {\n\n\t\t\tconst segmentWidth = width / gridX;\n\t\t\tconst segmentHeight = height / gridY;\n\n\t\t\tconst widthHalf = width / 2;\n\t\t\tconst heightHalf = height / 2;\n\t\t\tconst depthHalf = depth / 2;\n\n\t\t\tconst gridX1 = gridX + 1;\n\t\t\tconst gridY1 = gridY + 1;\n\n\t\t\tlet vertexCounter = 0;\n\t\t\tlet groupCount = 0;\n\n\t\t\tconst vector = new Vector3();\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\t\tconst y = iy * segmentHeight - heightHalf;\n\n\t\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\t\tconst x = ix * segmentWidth - widthHalf;\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = x * udir;\n\t\t\t\t\tvector[ v ] = y * vdir;\n\t\t\t\t\tvector[ w ] = depthHalf;\n\n\t\t\t\t\t// now apply vector to vertex buffer\n\n\t\t\t\t\tvertices.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = 0;\n\t\t\t\t\tvector[ v ] = 0;\n\t\t\t\t\tvector[ w ] = depth > 0 ? 1 : - 1;\n\n\t\t\t\t\t// now apply vector to normal buffer\n\n\t\t\t\t\tnormals.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// uvs\n\n\t\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t\t\t// counters\n\n\t\t\t\t\tvertexCounter += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\t// 1. you need three indices to draw a single face\n\t\t\t// 2. a single segment consists of two faces\n\t\t\t// 3. so we need to generate six (2*3) indices per segment\n\n\t\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\t\tconst a = numberOfVertices + ix + gridX1 * iy;\n\t\t\t\t\tconst b = numberOfVertices + ix + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t\t// increase counter\n\n\t\t\t\t\tgroupCount += 6;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, materialIndex );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t\t// update total number of vertices\n\n\t\t\tnumberOfVertices += vertexCounter;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new BoxGeometry( data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments );\n\n\t}\n\n}\n\n/**\n * Uniform Utilities\n */\n\nfunction cloneUniforms( src ) {\n\n\tconst dst = {};\n\n\tfor ( const u in src ) {\n\n\t\tdst[ u ] = {};\n\n\t\tfor ( const p in src[ u ] ) {\n\n\t\t\tconst property = src[ u ][ p ];\n\n\t\t\tif ( property && ( property.isColor ||\n\t\t\t\tproperty.isMatrix3 || property.isMatrix4 ||\n\t\t\t\tproperty.isVector2 || property.isVector3 || property.isVector4 ||\n\t\t\t\tproperty.isTexture || property.isQuaternion ) ) {\n\n\t\t\t\tif ( property.isRenderTargetTexture ) {\n\n\t\t\t\t\tconsole.warn( 'UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().' );\n\t\t\t\t\tdst[ u ][ p ] = null;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdst[ u ][ p ] = property.clone();\n\n\t\t\t\t}\n\n\t\t\t} else if ( Array.isArray( property ) ) {\n\n\t\t\t\tdst[ u ][ p ] = property.slice();\n\n\t\t\t} else {\n\n\t\t\t\tdst[ u ][ p ] = property;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn dst;\n\n}\n\nfunction mergeUniforms( uniforms ) {\n\n\tconst merged = {};\n\n\tfor ( let u = 0; u < uniforms.length; u ++ ) {\n\n\t\tconst tmp = cloneUniforms( uniforms[ u ] );\n\n\t\tfor ( const p in tmp ) {\n\n\t\t\tmerged[ p ] = tmp[ p ];\n\n\t\t}\n\n\t}\n\n\treturn merged;\n\n}\n\nfunction cloneUniformsGroups( src ) {\n\n\tconst dst = [];\n\n\tfor ( let u = 0; u < src.length; u ++ ) {\n\n\t\tdst.push( src[ u ].clone() );\n\n\t}\n\n\treturn dst;\n\n}\n\nfunction getUnlitUniformColorSpace( renderer ) {\n\n\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\tif ( currentRenderTarget === null ) {\n\n\t\t// https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398\n\t\treturn renderer.outputColorSpace;\n\n\t}\n\n\t// https://github.com/mrdoob/three.js/issues/27868\n\tif ( currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\treturn currentRenderTarget.texture.colorSpace;\n\n\t}\n\n\treturn ColorManagement.workingColorSpace;\n\n}\n\n// Legacy\n\nconst UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms };\n\nvar default_vertex = \"void main() {\\n\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\n}\";\n\nvar default_fragment = \"void main() {\\n\\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\\n}\";\n\nclass ShaderMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isShaderMaterial = true;\n\n\t\tthis.type = 'ShaderMaterial';\n\n\t\tthis.defines = {};\n\t\tthis.uniforms = {};\n\t\tthis.uniformsGroups = [];\n\n\t\tthis.vertexShader = default_vertex;\n\t\tthis.fragmentShader = default_fragment;\n\n\t\tthis.linewidth = 1;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.fog = false; // set to use scene fog\n\t\tthis.lights = false; // set to use scene lights\n\t\tthis.clipping = false; // set to use user-defined clipping planes\n\n\t\tthis.forceSinglePass = true;\n\n\t\tthis.extensions = {\n\t\t\tclipCullDistance: false, // set to use vertex shader clipping\n\t\t\tmultiDraw: false // set to use vertex shader multi_draw / enable gl_DrawID\n\t\t};\n\n\t\t// When rendered geometry doesn't include these attributes but the material does,\n\t\t// use these default values in WebGL. This avoids errors when buffer data is missing.\n\t\tthis.defaultAttributeValues = {\n\t\t\t'color': [ 1, 1, 1 ],\n\t\t\t'uv': [ 0, 0 ],\n\t\t\t'uv1': [ 0, 0 ]\n\t\t};\n\n\t\tthis.index0AttributeName = undefined;\n\t\tthis.uniformsNeedUpdate = false;\n\n\t\tthis.glslVersion = null;\n\n\t\tif ( parameters !== undefined ) {\n\n\t\t\tthis.setValues( parameters );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.fragmentShader = source.fragmentShader;\n\t\tthis.vertexShader = source.vertexShader;\n\n\t\tthis.uniforms = cloneUniforms( source.uniforms );\n\t\tthis.uniformsGroups = cloneUniformsGroups( source.uniformsGroups );\n\n\t\tthis.defines = Object.assign( {}, source.defines );\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\tthis.fog = source.fog;\n\t\tthis.lights = source.lights;\n\t\tthis.clipping = source.clipping;\n\n\t\tthis.extensions = Object.assign( {}, source.extensions );\n\n\t\tthis.glslVersion = source.glslVersion;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.glslVersion = this.glslVersion;\n\t\tdata.uniforms = {};\n\n\t\tfor ( const name in this.uniforms ) {\n\n\t\t\tconst uniform = this.uniforms[ name ];\n\t\t\tconst value = uniform.value;\n\n\t\t\tif ( value && value.isTexture ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 't',\n\t\t\t\t\tvalue: value.toJSON( meta ).uuid\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isColor ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'c',\n\t\t\t\t\tvalue: value.getHex()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector2 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v2',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector3 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v3',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector4 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v4',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isMatrix3 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'm3',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isMatrix4 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'm4',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\tvalue: value\n\t\t\t\t};\n\n\t\t\t\t// note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( Object.keys( this.defines ).length > 0 ) data.defines = this.defines;\n\n\t\tdata.vertexShader = this.vertexShader;\n\t\tdata.fragmentShader = this.fragmentShader;\n\n\t\tdata.lights = this.lights;\n\t\tdata.clipping = this.clipping;\n\n\t\tconst extensions = {};\n\n\t\tfor ( const key in this.extensions ) {\n\n\t\t\tif ( this.extensions[ key ] === true ) extensions[ key ] = true;\n\n\t\t}\n\n\t\tif ( Object.keys( extensions ).length > 0 ) data.extensions = extensions;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass Camera extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isCamera = true;\n\n\t\tthis.type = 'Camera';\n\n\t\tthis.matrixWorldInverse = new Matrix4();\n\n\t\tthis.projectionMatrix = new Matrix4();\n\t\tthis.projectionMatrixInverse = new Matrix4();\n\n\t\tthis.coordinateSystem = WebGLCoordinateSystem;\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.matrixWorldInverse.copy( source.matrixWorldInverse );\n\n\t\tthis.projectionMatrix.copy( source.projectionMatrix );\n\t\tthis.projectionMatrixInverse.copy( source.projectionMatrixInverse );\n\n\t\tthis.coordinateSystem = source.coordinateSystem;\n\n\t\treturn this;\n\n\t}\n\n\tgetWorldDirection( target ) {\n\n\t\treturn super.getWorldDirection( target ).negate();\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t}\n\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tsuper.updateWorldMatrix( updateParents, updateChildren );\n\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _v3$1 = /*@__PURE__*/ new Vector3();\nconst _minTarget = /*@__PURE__*/ new Vector2();\nconst _maxTarget = /*@__PURE__*/ new Vector2();\n\n\nclass PerspectiveCamera extends Camera {\n\n\tconstructor( fov = 50, aspect = 1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\tthis.isPerspectiveCamera = true;\n\n\t\tthis.type = 'PerspectiveCamera';\n\n\t\tthis.fov = fov;\n\t\tthis.zoom = 1;\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\t\tthis.focus = 10;\n\n\t\tthis.aspect = aspect;\n\t\tthis.view = null;\n\n\t\tthis.filmGauge = 35;\t// width of the film (default in millimeters)\n\t\tthis.filmOffset = 0;\t// horizontal film offset (same unit as gauge)\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.fov = source.fov;\n\t\tthis.zoom = source.zoom;\n\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\t\tthis.focus = source.focus;\n\n\t\tthis.aspect = source.aspect;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\tthis.filmGauge = source.filmGauge;\n\t\tthis.filmOffset = source.filmOffset;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the FOV by focal length in respect to the current .filmGauge.\n\t *\n\t * The default film gauge is 35, so that the focal length can be specified for\n\t * a 35mm (full frame) camera.\n\t *\n\t * Values for focal length and film gauge must have the same unit.\n\t */\n\tsetFocalLength( focalLength ) {\n\n\t\t/** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */\n\t\tconst vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;\n\n\t\tthis.fov = RAD2DEG * 2 * Math.atan( vExtentSlope );\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\t/**\n\t * Calculates the focal length from the current .fov and .filmGauge.\n\t */\n\tgetFocalLength() {\n\n\t\tconst vExtentSlope = Math.tan( DEG2RAD * 0.5 * this.fov );\n\n\t\treturn 0.5 * this.getFilmHeight() / vExtentSlope;\n\n\t}\n\n\tgetEffectiveFOV() {\n\n\t\treturn RAD2DEG * 2 * Math.atan(\n\t\t\tMath.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom );\n\n\t}\n\n\tgetFilmWidth() {\n\n\t\t// film not completely covered in portrait format (aspect < 1)\n\t\treturn this.filmGauge * Math.min( this.aspect, 1 );\n\n\t}\n\n\tgetFilmHeight() {\n\n\t\t// film not completely covered in landscape format (aspect > 1)\n\t\treturn this.filmGauge / Math.max( this.aspect, 1 );\n\n\t}\n\n\t/**\n\t * Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction.\n\t * Sets minTarget and maxTarget to the coordinates of the lower-left and upper-right corners of the view rectangle.\n\t */\n\tgetViewBounds( distance, minTarget, maxTarget ) {\n\n\t\t_v3$1.set( - 1, - 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );\n\n\t\tminTarget.set( _v3$1.x, _v3$1.y ).multiplyScalar( - distance / _v3$1.z );\n\n\t\t_v3$1.set( 1, 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );\n\n\t\tmaxTarget.set( _v3$1.x, _v3$1.y ).multiplyScalar( - distance / _v3$1.z );\n\n\t}\n\n\t/**\n\t * Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.\n\t * Copies the result into the target Vector2, where x is width and y is height.\n\t */\n\tgetViewSize( distance, target ) {\n\n\t\tthis.getViewBounds( distance, _minTarget, _maxTarget );\n\n\t\treturn target.subVectors( _maxTarget, _minTarget );\n\n\t}\n\n\t/**\n\t * Sets an offset in a larger frustum. This is useful for multi-window or\n\t * multi-monitor/multi-machine setups.\n\t *\n\t * For example, if you have 3x2 monitors and each monitor is 1920x1080 and\n\t * the monitors are in grid like this\n\t *\n\t * +---+---+---+\n\t * | A | B | C |\n\t * +---+---+---+\n\t * | D | E | F |\n\t * +---+---+---+\n\t *\n\t * then for each monitor you would call it like this\n\t *\n\t * const w = 1920;\n\t * const h = 1080;\n\t * const fullWidth = w * 3;\n\t * const fullHeight = h * 2;\n\t *\n\t * --A--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );\n\t * --B--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );\n\t * --C--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );\n\t * --D--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );\n\t * --E--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );\n\t * --F--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );\n\t *\n\t * Note there is no reason monitors have to be the same size or in a grid.\n\t */\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tthis.aspect = fullWidth / fullHeight;\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tupdateProjectionMatrix() {\n\n\t\tconst near = this.near;\n\t\tlet top = near * Math.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom;\n\t\tlet height = 2 * top;\n\t\tlet width = this.aspect * height;\n\t\tlet left = - 0.5 * width;\n\t\tconst view = this.view;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst fullWidth = view.fullWidth,\n\t\t\t\tfullHeight = view.fullHeight;\n\n\t\t\tleft += view.offsetX * width / fullWidth;\n\t\t\ttop -= view.offsetY * height / fullHeight;\n\t\t\twidth *= view.width / fullWidth;\n\t\t\theight *= view.height / fullHeight;\n\n\t\t}\n\n\t\tconst skew = this.filmOffset;\n\t\tif ( skew !== 0 ) left += near * skew / this.getFilmWidth();\n\n\t\tthis.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far, this.coordinateSystem );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.fov = this.fov;\n\t\tdata.object.zoom = this.zoom;\n\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\t\tdata.object.focus = this.focus;\n\n\t\tdata.object.aspect = this.aspect;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\tdata.object.filmGauge = this.filmGauge;\n\t\tdata.object.filmOffset = this.filmOffset;\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst fov = - 90; // negative fov is not an error\nconst aspect = 1;\n\nclass CubeCamera extends Object3D {\n\n\tconstructor( near, far, renderTarget ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CubeCamera';\n\n\t\tthis.renderTarget = renderTarget;\n\t\tthis.coordinateSystem = null;\n\t\tthis.activeMipmapLevel = 0;\n\n\t\tconst cameraPX = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPX.layers = this.layers;\n\t\tthis.add( cameraPX );\n\n\t\tconst cameraNX = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNX.layers = this.layers;\n\t\tthis.add( cameraNX );\n\n\t\tconst cameraPY = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPY.layers = this.layers;\n\t\tthis.add( cameraPY );\n\n\t\tconst cameraNY = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNY.layers = this.layers;\n\t\tthis.add( cameraNY );\n\n\t\tconst cameraPZ = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPZ.layers = this.layers;\n\t\tthis.add( cameraPZ );\n\n\t\tconst cameraNZ = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNZ.layers = this.layers;\n\t\tthis.add( cameraNZ );\n\n\t}\n\n\tupdateCoordinateSystem() {\n\n\t\tconst coordinateSystem = this.coordinateSystem;\n\n\t\tconst cameras = this.children.concat();\n\n\t\tconst [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = cameras;\n\n\t\tfor ( const camera of cameras ) this.remove( camera );\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tcameraPX.up.set( 0, 1, 0 );\n\t\t\tcameraPX.lookAt( 1, 0, 0 );\n\n\t\t\tcameraNX.up.set( 0, 1, 0 );\n\t\t\tcameraNX.lookAt( - 1, 0, 0 );\n\n\t\t\tcameraPY.up.set( 0, 0, - 1 );\n\t\t\tcameraPY.lookAt( 0, 1, 0 );\n\n\t\t\tcameraNY.up.set( 0, 0, 1 );\n\t\t\tcameraNY.lookAt( 0, - 1, 0 );\n\n\t\t\tcameraPZ.up.set( 0, 1, 0 );\n\t\t\tcameraPZ.lookAt( 0, 0, 1 );\n\n\t\t\tcameraNZ.up.set( 0, 1, 0 );\n\t\t\tcameraNZ.lookAt( 0, 0, - 1 );\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tcameraPX.up.set( 0, - 1, 0 );\n\t\t\tcameraPX.lookAt( - 1, 0, 0 );\n\n\t\t\tcameraNX.up.set( 0, - 1, 0 );\n\t\t\tcameraNX.lookAt( 1, 0, 0 );\n\n\t\t\tcameraPY.up.set( 0, 0, 1 );\n\t\t\tcameraPY.lookAt( 0, 1, 0 );\n\n\t\t\tcameraNY.up.set( 0, 0, - 1 );\n\t\t\tcameraNY.lookAt( 0, - 1, 0 );\n\n\t\t\tcameraPZ.up.set( 0, - 1, 0 );\n\t\t\tcameraPZ.lookAt( 0, 0, 1 );\n\n\t\t\tcameraNZ.up.set( 0, - 1, 0 );\n\t\t\tcameraNZ.lookAt( 0, 0, - 1 );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tfor ( const camera of cameras ) {\n\n\t\t\tthis.add( camera );\n\n\t\t\tcamera.updateMatrixWorld();\n\n\t\t}\n\n\t}\n\n\tupdate( renderer, scene ) {\n\n\t\tif ( this.parent === null ) this.updateMatrixWorld();\n\n\t\tconst { renderTarget, activeMipmapLevel } = this;\n\n\t\tif ( this.coordinateSystem !== renderer.coordinateSystem ) {\n\n\t\t\tthis.coordinateSystem = renderer.coordinateSystem;\n\n\t\t\tthis.updateCoordinateSystem();\n\n\t\t}\n\n\t\tconst [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = this.children;\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\t\tconst currentActiveCubeFace = renderer.getActiveCubeFace();\n\t\tconst currentActiveMipmapLevel = renderer.getActiveMipmapLevel();\n\n\t\tconst currentXrEnabled = renderer.xr.enabled;\n\n\t\trenderer.xr.enabled = false;\n\n\t\tconst generateMipmaps = renderTarget.texture.generateMipmaps;\n\n\t\trenderTarget.texture.generateMipmaps = false;\n\n\t\trenderer.setRenderTarget( renderTarget, 0, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPX );\n\n\t\trenderer.setRenderTarget( renderTarget, 1, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNX );\n\n\t\trenderer.setRenderTarget( renderTarget, 2, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPY );\n\n\t\trenderer.setRenderTarget( renderTarget, 3, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNY );\n\n\t\trenderer.setRenderTarget( renderTarget, 4, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPZ );\n\n\t\t// mipmaps are generated during the last call of render()\n\t\t// at this point, all sides of the cube render target are defined\n\n\t\trenderTarget.texture.generateMipmaps = generateMipmaps;\n\n\t\trenderer.setRenderTarget( renderTarget, 5, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNZ );\n\n\t\trenderer.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );\n\n\t\trenderer.xr.enabled = currentXrEnabled;\n\n\t\trenderTarget.texture.needsPMREMUpdate = true;\n\n\t}\n\n}\n\nclass CubeTexture extends Texture {\n\n\tconstructor( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace ) {\n\n\t\timages = images !== undefined ? images : [];\n\t\tmapping = mapping !== undefined ? mapping : CubeReflectionMapping;\n\n\t\tsuper( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isCubeTexture = true;\n\n\t\tthis.flipY = false;\n\n\t}\n\n\tget images() {\n\n\t\treturn this.image;\n\n\t}\n\n\tset images( value ) {\n\n\t\tthis.image = value;\n\n\t}\n\n}\n\nclass WebGLCubeRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( size = 1, options = {} ) {\n\n\t\tsuper( size, size, options );\n\n\t\tthis.isWebGLCubeRenderTarget = true;\n\n\t\tconst image = { width: size, height: size, depth: 1 };\n\t\tconst images = [ image, image, image, image, image, image ];\n\n\t\tthis.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );\n\n\t\t// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)\n\t\t// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,\n\t\t// in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.\n\n\t\t// three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped\n\t\t// and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture\n\t\t// as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t\tthis.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\n\t\tthis.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;\n\n\t}\n\n\tfromEquirectangularTexture( renderer, texture ) {\n\n\t\tthis.texture.type = texture.type;\n\t\tthis.texture.colorSpace = texture.colorSpace;\n\n\t\tthis.texture.generateMipmaps = texture.generateMipmaps;\n\t\tthis.texture.minFilter = texture.minFilter;\n\t\tthis.texture.magFilter = texture.magFilter;\n\n\t\tconst shader = {\n\n\t\t\tuniforms: {\n\t\t\t\ttEquirect: { value: null },\n\t\t\t},\n\n\t\t\tvertexShader: /* glsl */`\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t`,\n\n\t\t\tfragmentShader: /* glsl */`\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t`\n\t\t};\n\n\t\tconst geometry = new BoxGeometry( 5, 5, 5 );\n\n\t\tconst material = new ShaderMaterial( {\n\n\t\t\tname: 'CubemapFromEquirect',\n\n\t\t\tuniforms: cloneUniforms( shader.uniforms ),\n\t\t\tvertexShader: shader.vertexShader,\n\t\t\tfragmentShader: shader.fragmentShader,\n\t\t\tside: BackSide,\n\t\t\tblending: NoBlending\n\n\t\t} );\n\n\t\tmaterial.uniforms.tEquirect.value = texture;\n\n\t\tconst mesh = new Mesh( geometry, material );\n\n\t\tconst currentMinFilter = texture.minFilter;\n\n\t\t// Avoid blurred poles\n\t\tif ( texture.minFilter === LinearMipmapLinearFilter ) texture.minFilter = LinearFilter;\n\n\t\tconst camera = new CubeCamera( 1, 10, this );\n\t\tcamera.update( renderer, mesh );\n\n\t\ttexture.minFilter = currentMinFilter;\n\n\t\tmesh.geometry.dispose();\n\t\tmesh.material.dispose();\n\n\t\treturn this;\n\n\t}\n\n\tclear( renderer, color, depth, stencil ) {\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\trenderer.setRenderTarget( this, i );\n\n\t\t\trenderer.clear( color, depth, stencil );\n\n\t\t}\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t}\n\n}\n\nconst _vector1 = /*@__PURE__*/ new Vector3();\nconst _vector2 = /*@__PURE__*/ new Vector3();\nconst _normalMatrix = /*@__PURE__*/ new Matrix3();\n\nclass Plane {\n\n\tconstructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) {\n\n\t\tthis.isPlane = true;\n\n\t\t// normal is assumed to be normalized\n\n\t\tthis.normal = normal;\n\t\tthis.constant = constant;\n\n\t}\n\n\tset( normal, constant ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = constant;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponents( x, y, z, w ) {\n\n\t\tthis.normal.set( x, y, z );\n\t\tthis.constant = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromNormalAndCoplanarPoint( normal, point ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = - point.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCoplanarPoints( a, b, c ) {\n\n\t\tconst normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();\n\n\t\t// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?\n\n\t\tthis.setFromNormalAndCoplanarPoint( normal, a );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( plane ) {\n\n\t\tthis.normal.copy( plane.normal );\n\t\tthis.constant = plane.constant;\n\n\t\treturn this;\n\n\t}\n\n\tnormalize() {\n\n\t\t// Note: will lead to a divide by zero if the plane is invalid.\n\n\t\tconst inverseNormalLength = 1.0 / this.normal.length();\n\t\tthis.normal.multiplyScalar( inverseNormalLength );\n\t\tthis.constant *= inverseNormalLength;\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.constant *= - 1;\n\t\tthis.normal.negate();\n\n\t\treturn this;\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.normal.dot( point ) + this.constant;\n\n\t}\n\n\tdistanceToSphere( sphere ) {\n\n\t\treturn this.distanceToPoint( sphere.center ) - sphere.radius;\n\n\t}\n\n\tprojectPoint( point, target ) {\n\n\t\treturn target.copy( point ).addScaledVector( this.normal, - this.distanceToPoint( point ) );\n\n\t}\n\n\tintersectLine( line, target ) {\n\n\t\tconst direction = line.delta( _vector1 );\n\n\t\tconst denominator = this.normal.dot( direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( this.distanceToPoint( line.start ) === 0 ) {\n\n\t\t\t\treturn target.copy( line.start );\n\n\t\t\t}\n\n\t\t\t// Unsure if this is the correct method to handle this case.\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;\n\n\t\tif ( t < 0 || t > 1 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn target.copy( line.start ).addScaledVector( direction, t );\n\n\t}\n\n\tintersectsLine( line ) {\n\n\t\t// Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.\n\n\t\tconst startSign = this.distanceToPoint( line.start );\n\t\tconst endSign = this.distanceToPoint( line.end );\n\n\t\treturn ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsPlane( this );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn sphere.intersectsPlane( this );\n\n\t}\n\n\tcoplanarPoint( target ) {\n\n\t\treturn target.copy( this.normal ).multiplyScalar( - this.constant );\n\n\t}\n\n\tapplyMatrix4( matrix, optionalNormalMatrix ) {\n\n\t\tconst normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );\n\n\t\tconst referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );\n\n\t\tconst normal = this.normal.applyMatrix3( normalMatrix ).normalize();\n\n\t\tthis.constant = - referencePoint.dot( normal );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.constant -= offset.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\tequals( plane ) {\n\n\t\treturn plane.normal.equals( this.normal ) && ( plane.constant === this.constant );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _sphere$5 = /*@__PURE__*/ new Sphere();\nconst _vector$7 = /*@__PURE__*/ new Vector3();\n\nclass Frustum {\n\n\tconstructor( p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane() ) {\n\n\t\tthis.planes = [ p0, p1, p2, p3, p4, p5 ];\n\n\t}\n\n\tset( p0, p1, p2, p3, p4, p5 ) {\n\n\t\tconst planes = this.planes;\n\n\t\tplanes[ 0 ].copy( p0 );\n\t\tplanes[ 1 ].copy( p1 );\n\t\tplanes[ 2 ].copy( p2 );\n\t\tplanes[ 3 ].copy( p3 );\n\t\tplanes[ 4 ].copy( p4 );\n\t\tplanes[ 5 ].copy( p5 );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( frustum ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tplanes[ i ].copy( frustum.planes[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromProjectionMatrix( m, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst planes = this.planes;\n\t\tconst me = m.elements;\n\t\tconst me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ];\n\t\tconst me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ];\n\t\tconst me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ];\n\t\tconst me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ];\n\n\t\tplanes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize();\n\t\tplanes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize();\n\t\tplanes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();\n\t\tplanes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();\n\t\tplanes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize();\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tplanes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tplanes[ 5 ].setComponents( me2, me6, me10, me14 ).normalize();\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tintersectsObject( object ) {\n\n\t\tif ( object.boundingSphere !== undefined ) {\n\n\t\t\tif ( object.boundingSphere === null ) object.computeBoundingSphere();\n\n\t\t\t_sphere$5.copy( object.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\t} else {\n\n\t\t\tconst geometry = object.geometry;\n\n\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t\t_sphere$5.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\t}\n\n\t\treturn this.intersectsSphere( _sphere$5 );\n\n\t}\n\n\tintersectsSprite( sprite ) {\n\n\t\t_sphere$5.center.set( 0, 0, 0 );\n\t\t_sphere$5.radius = 0.7071067811865476;\n\t\t_sphere$5.applyMatrix4( sprite.matrixWorld );\n\n\t\treturn this.intersectsSphere( _sphere$5 );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\tconst planes = this.planes;\n\t\tconst center = sphere.center;\n\t\tconst negRadius = - sphere.radius;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst distance = planes[ i ].distanceToPoint( center );\n\n\t\t\tif ( distance < negRadius ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst plane = planes[ i ];\n\n\t\t\t// corner at max distance\n\n\t\t\t_vector$7.x = plane.normal.x > 0 ? box.max.x : box.min.x;\n\t\t\t_vector$7.y = plane.normal.y > 0 ? box.max.y : box.min.y;\n\t\t\t_vector$7.z = plane.normal.z > 0 ? box.max.z : box.min.z;\n\n\t\t\tif ( plane.distanceToPoint( _vector$7 ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tif ( planes[ i ].distanceToPoint( point ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nfunction WebGLAnimation() {\n\n\tlet context = null;\n\tlet isAnimating = false;\n\tlet animationLoop = null;\n\tlet requestId = null;\n\n\tfunction onAnimationFrame( time, frame ) {\n\n\t\tanimationLoop( time, frame );\n\n\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\n\n\t}\n\n\treturn {\n\n\t\tstart: function () {\n\n\t\t\tif ( isAnimating === true ) return;\n\t\t\tif ( animationLoop === null ) return;\n\n\t\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\n\n\t\t\tisAnimating = true;\n\n\t\t},\n\n\t\tstop: function () {\n\n\t\t\tcontext.cancelAnimationFrame( requestId );\n\n\t\t\tisAnimating = false;\n\n\t\t},\n\n\t\tsetAnimationLoop: function ( callback ) {\n\n\t\t\tanimationLoop = callback;\n\n\t\t},\n\n\t\tsetContext: function ( value ) {\n\n\t\t\tcontext = value;\n\n\t\t}\n\n\t};\n\n}\n\nfunction WebGLAttributes( gl ) {\n\n\tconst buffers = new WeakMap();\n\n\tfunction createBuffer( attribute, bufferType ) {\n\n\t\tconst array = attribute.array;\n\t\tconst usage = attribute.usage;\n\t\tconst size = array.byteLength;\n\n\t\tconst buffer = gl.createBuffer();\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\t\tgl.bufferData( bufferType, array, usage );\n\n\t\tattribute.onUploadCallback();\n\n\t\tlet type;\n\n\t\tif ( array instanceof Float32Array ) {\n\n\t\t\ttype = gl.FLOAT;\n\n\t\t} else if ( array instanceof Uint16Array ) {\n\n\t\t\tif ( attribute.isFloat16BufferAttribute ) {\n\n\t\t\t\ttype = gl.HALF_FLOAT;\n\n\t\t\t} else {\n\n\t\t\t\ttype = gl.UNSIGNED_SHORT;\n\n\t\t\t}\n\n\t\t} else if ( array instanceof Int16Array ) {\n\n\t\t\ttype = gl.SHORT;\n\n\t\t} else if ( array instanceof Uint32Array ) {\n\n\t\t\ttype = gl.UNSIGNED_INT;\n\n\t\t} else if ( array instanceof Int32Array ) {\n\n\t\t\ttype = gl.INT;\n\n\t\t} else if ( array instanceof Int8Array ) {\n\n\t\t\ttype = gl.BYTE;\n\n\t\t} else if ( array instanceof Uint8Array ) {\n\n\t\t\ttype = gl.UNSIGNED_BYTE;\n\n\t\t} else if ( array instanceof Uint8ClampedArray ) {\n\n\t\t\ttype = gl.UNSIGNED_BYTE;\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.WebGLAttributes: Unsupported buffer data format: ' + array );\n\n\t\t}\n\n\t\treturn {\n\t\t\tbuffer: buffer,\n\t\t\ttype: type,\n\t\t\tbytesPerElement: array.BYTES_PER_ELEMENT,\n\t\t\tversion: attribute.version,\n\t\t\tsize: size\n\t\t};\n\n\t}\n\n\tfunction updateBuffer( buffer, attribute, bufferType ) {\n\n\t\tconst array = attribute.array;\n\t\tconst updateRange = attribute._updateRange; // @deprecated, r159\n\t\tconst updateRanges = attribute.updateRanges;\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\n\t\tif ( updateRange.count === - 1 && updateRanges.length === 0 ) {\n\n\t\t\t// Not using update ranges\n\t\t\tgl.bufferSubData( bufferType, 0, array );\n\n\t\t}\n\n\t\tif ( updateRanges.length !== 0 ) {\n\n\t\t\tfor ( let i = 0, l = updateRanges.length; i < l; i ++ ) {\n\n\t\t\t\tconst range = updateRanges[ i ];\n\n\t\t\t\tgl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,\n\t\t\t\t\tarray, range.start, range.count );\n\n\t\t\t}\n\n\t\t\tattribute.clearUpdateRanges();\n\n\t\t}\n\n\t\t// @deprecated, r159\n\t\tif ( updateRange.count !== - 1 ) {\n\n\t\t\tgl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,\n\t\t\t\tarray, updateRange.offset, updateRange.count );\n\n\t\t\tupdateRange.count = - 1; // reset range\n\n\t\t}\n\n\t\tattribute.onUploadCallback();\n\n\t}\n\n\t//\n\n\tfunction get( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\treturn buffers.get( attribute );\n\n\t}\n\n\tfunction remove( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tconst data = buffers.get( attribute );\n\n\t\tif ( data ) {\n\n\t\t\tgl.deleteBuffer( data.buffer );\n\n\t\t\tbuffers.delete( attribute );\n\n\t\t}\n\n\t}\n\n\tfunction update( attribute, bufferType ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tif ( attribute.isGLBufferAttribute ) {\n\n\t\t\tconst cached = buffers.get( attribute );\n\n\t\t\tif ( ! cached || cached.version < attribute.version ) {\n\n\t\t\t\tbuffers.set( attribute, {\n\t\t\t\t\tbuffer: attribute.buffer,\n\t\t\t\t\ttype: attribute.type,\n\t\t\t\t\tbytesPerElement: attribute.elementSize,\n\t\t\t\t\tversion: attribute.version\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst data = buffers.get( attribute );\n\n\t\tif ( data === undefined ) {\n\n\t\t\tbuffers.set( attribute, createBuffer( attribute, bufferType ) );\n\n\t\t} else if ( data.version < attribute.version ) {\n\n\t\t\tif ( data.size !== attribute.array.byteLength ) {\n\n\t\t\t\tthrow new Error( 'THREE.WebGLAttributes: The size of the buffer attribute\\'s array buffer does not match the original size. Resizing buffer attributes is not supported.' );\n\n\t\t\t}\n\n\t\t\tupdateBuffer( data.buffer, attribute, bufferType );\n\n\t\t\tdata.version = attribute.version;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update\n\n\t};\n\n}\n\nclass PlaneGeometry extends BufferGeometry {\n\n\tconstructor( width = 1, height = 1, widthSegments = 1, heightSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PlaneGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments\n\t\t};\n\n\t\tconst width_half = width / 2;\n\t\tconst height_half = height / 2;\n\n\t\tconst gridX = Math.floor( widthSegments );\n\t\tconst gridY = Math.floor( heightSegments );\n\n\t\tconst gridX1 = gridX + 1;\n\t\tconst gridY1 = gridY + 1;\n\n\t\tconst segment_width = width / gridX;\n\t\tconst segment_height = height / gridY;\n\n\t\t//\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\tconst y = iy * segment_height - height_half;\n\n\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\tconst x = ix * segment_width - width_half;\n\n\t\t\t\tvertices.push( x, - y, 0 );\n\n\t\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\tconst a = ix + gridX1 * iy;\n\t\t\t\tconst b = ix + gridX1 * ( iy + 1 );\n\t\t\t\tconst c = ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\tconst d = ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new PlaneGeometry( data.width, data.height, data.widthSegments, data.heightSegments );\n\n\t}\n\n}\n\nvar alphahash_fragment = \"#ifdef USE_ALPHAHASH\\n\\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\\n#endif\";\n\nvar alphahash_pars_fragment = \"#ifdef USE_ALPHAHASH\\n\\tconst float ALPHA_HASH_SCALE = 0.05;\\n\\tfloat hash2D( vec2 value ) {\\n\\t\\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\\n\\t}\\n\\tfloat hash3D( vec3 value ) {\\n\\t\\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\\n\\t}\\n\\tfloat getAlphaHashThreshold( vec3 position ) {\\n\\t\\tfloat maxDeriv = max(\\n\\t\\t\\tlength( dFdx( position.xyz ) ),\\n\\t\\t\\tlength( dFdy( position.xyz ) )\\n\\t\\t);\\n\\t\\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\\n\\t\\tvec2 pixScales = vec2(\\n\\t\\t\\texp2( floor( log2( pixScale ) ) ),\\n\\t\\t\\texp2( ceil( log2( pixScale ) ) )\\n\\t\\t);\\n\\t\\tvec2 alpha = vec2(\\n\\t\\t\\thash3D( floor( pixScales.x * position.xyz ) ),\\n\\t\\t\\thash3D( floor( pixScales.y * position.xyz ) )\\n\\t\\t);\\n\\t\\tfloat lerpFactor = fract( log2( pixScale ) );\\n\\t\\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\\n\\t\\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\\n\\t\\tvec3 cases = vec3(\\n\\t\\t\\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\\n\\t\\t\\t( x - 0.5 * a ) / ( 1.0 - a ),\\n\\t\\t\\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\\n\\t\\t);\\n\\t\\tfloat threshold = ( x < ( 1.0 - a ) )\\n\\t\\t\\t? ( ( x < a ) ? cases.x : cases.y )\\n\\t\\t\\t: cases.z;\\n\\t\\treturn clamp( threshold , 1.0e-6, 1.0 );\\n\\t}\\n#endif\";\n\nvar alphamap_fragment = \"#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\\n#endif\";\n\nvar alphamap_pars_fragment = \"#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\n\nvar alphatest_fragment = \"#ifdef USE_ALPHATEST\\n\\t#ifdef ALPHA_TO_COVERAGE\\n\\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\\n\\tif ( diffuseColor.a == 0.0 ) discard;\\n\\t#else\\n\\tif ( diffuseColor.a < alphaTest ) discard;\\n\\t#endif\\n#endif\";\n\nvar alphatest_pars_fragment = \"#ifdef USE_ALPHATEST\\n\\tuniform float alphaTest;\\n#endif\";\n\nvar aomap_fragment = \"#ifdef USE_AOMAP\\n\\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\\n\\treflectedLight.indirectDiffuse *= ambientOcclusion;\\n\\t#if defined( USE_CLEARCOAT ) \\n\\t\\tclearcoatSpecularIndirect *= ambientOcclusion;\\n\\t#endif\\n\\t#if defined( USE_SHEEN ) \\n\\t\\tsheenSpecularIndirect *= ambientOcclusion;\\n\\t#endif\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD )\\n\\t\\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\\n\\t\\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\\n\\t#endif\\n#endif\";\n\nvar aomap_pars_fragment = \"#ifdef USE_AOMAP\\n\\tuniform sampler2D aoMap;\\n\\tuniform float aoMapIntensity;\\n#endif\";\n\nvar batching_pars_vertex = \"#ifdef USE_BATCHING\\n\\t#if ! defined( GL_ANGLE_multi_draw )\\n\\t#define gl_DrawID _gl_DrawID\\n\\tuniform int _gl_DrawID;\\n\\t#endif\\n\\tuniform highp sampler2D batchingTexture;\\n\\tuniform highp usampler2D batchingIdTexture;\\n\\tmat4 getBatchingMatrix( const in float i ) {\\n\\t\\tint size = textureSize( batchingTexture, 0 ).x;\\n\\t\\tint j = int( i ) * 4;\\n\\t\\tint x = j % size;\\n\\t\\tint y = j / size;\\n\\t\\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\\n\\t\\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\\n\\t\\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\\n\\t\\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\\n\\t\\treturn mat4( v1, v2, v3, v4 );\\n\\t}\\n\\tfloat getIndirectIndex( const in int i ) {\\n\\t\\tint size = textureSize( batchingIdTexture, 0 ).x;\\n\\t\\tint x = i % size;\\n\\t\\tint y = i / size;\\n\\t\\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\\n\\t}\\n#endif\\n#ifdef USE_BATCHING_COLOR\\n\\tuniform sampler2D batchingColorTexture;\\n\\tvec3 getBatchingColor( const in float i ) {\\n\\t\\tint size = textureSize( batchingColorTexture, 0 ).x;\\n\\t\\tint j = int( i );\\n\\t\\tint x = j % size;\\n\\t\\tint y = j / size;\\n\\t\\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\\n\\t}\\n#endif\";\n\nvar batching_vertex = \"#ifdef USE_BATCHING\\n\\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\\n#endif\";\n\nvar begin_vertex = \"vec3 transformed = vec3( position );\\n#ifdef USE_ALPHAHASH\\n\\tvPosition = vec3( position );\\n#endif\";\n\nvar beginnormal_vertex = \"vec3 objectNormal = vec3( normal );\\n#ifdef USE_TANGENT\\n\\tvec3 objectTangent = vec3( tangent.xyz );\\n#endif\";\n\nvar bsdfs = \"float G_BlinnPhong_Implicit( ) {\\n\\treturn 0.25;\\n}\\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\\n\\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\\n}\\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\\n\\tfloat G = G_BlinnPhong_Implicit( );\\n\\tfloat D = D_BlinnPhong( shininess, dotNH );\\n\\treturn F * ( G * D );\\n} // validated\";\n\nvar iridescence_fragment = \"#ifdef USE_IRIDESCENCE\\n\\tconst mat3 XYZ_TO_REC709 = mat3(\\n\\t\\t 3.2404542, -0.9692660, 0.0556434,\\n\\t\\t-1.5371385, 1.8760108, -0.2040259,\\n\\t\\t-0.4985314, 0.0415560, 1.0572252\\n\\t);\\n\\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\\n\\t\\tvec3 sqrtF0 = sqrt( fresnel0 );\\n\\t\\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\\n\\t}\\n\\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\\n\\t\\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\\n\\t}\\n\\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\\n\\t\\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\\n\\t}\\n\\tvec3 evalSensitivity( float OPD, vec3 shift ) {\\n\\t\\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\\n\\t\\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\\n\\t\\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\\n\\t\\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\\n\\t\\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\\n\\t\\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\\n\\t\\txyz /= 1.0685e-7;\\n\\t\\tvec3 rgb = XYZ_TO_REC709 * xyz;\\n\\t\\treturn rgb;\\n\\t}\\n\\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\\n\\t\\tvec3 I;\\n\\t\\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\\n\\t\\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\\n\\t\\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\\n\\t\\tif ( cosTheta2Sq < 0.0 ) {\\n\\t\\t\\treturn vec3( 1.0 );\\n\\t\\t}\\n\\t\\tfloat cosTheta2 = sqrt( cosTheta2Sq );\\n\\t\\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\\n\\t\\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\\n\\t\\tfloat T121 = 1.0 - R12;\\n\\t\\tfloat phi12 = 0.0;\\n\\t\\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\\n\\t\\tfloat phi21 = PI - phi12;\\n\\t\\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\\t\\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\\n\\t\\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\\n\\t\\tvec3 phi23 = vec3( 0.0 );\\n\\t\\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\\n\\t\\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\\n\\t\\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\\n\\t\\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\\n\\t\\tvec3 phi = vec3( phi21 ) + phi23;\\n\\t\\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\\n\\t\\tvec3 r123 = sqrt( R123 );\\n\\t\\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\\n\\t\\tvec3 C0 = R12 + Rs;\\n\\t\\tI = C0;\\n\\t\\tvec3 Cm = Rs - T121;\\n\\t\\tfor ( int m = 1; m <= 2; ++ m ) {\\n\\t\\t\\tCm *= r123;\\n\\t\\t\\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\\n\\t\\t\\tI += Cm * Sm;\\n\\t\\t}\\n\\t\\treturn max( I, vec3( 0.0 ) );\\n\\t}\\n#endif\";\n\nvar bumpmap_pars_fragment = \"#ifdef USE_BUMPMAP\\n\\tuniform sampler2D bumpMap;\\n\\tuniform float bumpScale;\\n\\tvec2 dHdxy_fwd() {\\n\\t\\tvec2 dSTdx = dFdx( vBumpMapUv );\\n\\t\\tvec2 dSTdy = dFdy( vBumpMapUv );\\n\\t\\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\\n\\t\\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\\n\\t\\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\\n\\t\\treturn vec2( dBx, dBy );\\n\\t}\\n\\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\\n\\t\\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\\n\\t\\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\\n\\t\\tvec3 vN = surf_norm;\\n\\t\\tvec3 R1 = cross( vSigmaY, vN );\\n\\t\\tvec3 R2 = cross( vN, vSigmaX );\\n\\t\\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\\n\\t\\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\\n\\t\\treturn normalize( abs( fDet ) * surf_norm - vGrad );\\n\\t}\\n#endif\";\n\nvar clipping_planes_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvec4 plane;\\n\\t#ifdef ALPHA_TO_COVERAGE\\n\\t\\tfloat distanceToPlane, distanceGradient;\\n\\t\\tfloat clipOpacity = 1.0;\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\\n\\t\\t\\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\\n\\t\\t\\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\\n\\t\\t\\tif ( clipOpacity == 0.0 ) discard;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\n\\t\\t\\tfloat unionClipOpacity = 1.0;\\n\\t\\t\\t#pragma unroll_loop_start\\n\\t\\t\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\t\\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\\n\\t\\t\\t\\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\\n\\t\\t\\t\\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\\n\\t\\t\\t}\\n\\t\\t\\t#pragma unroll_loop_end\\n\\t\\t\\tclipOpacity *= 1.0 - unionClipOpacity;\\n\\t\\t#endif\\n\\t\\tdiffuseColor.a *= clipOpacity;\\n\\t\\tif ( diffuseColor.a == 0.0 ) discard;\\n\\t#else\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\n\\t\\t\\tbool clipped = true;\\n\\t\\t\\t#pragma unroll_loop_start\\n\\t\\t\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\t\\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\\n\\t\\t\\t}\\n\\t\\t\\t#pragma unroll_loop_end\\n\\t\\t\\tif ( clipped ) discard;\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar clipping_planes_pars_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n\\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\\n#endif\";\n\nvar clipping_planes_pars_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n#endif\";\n\nvar clipping_planes_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvClipPosition = - mvPosition.xyz;\\n#endif\";\n\nvar color_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tdiffuseColor *= vColor;\\n#elif defined( USE_COLOR )\\n\\tdiffuseColor.rgb *= vColor;\\n#endif\";\n\nvar color_pars_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\n\nvar color_pars_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\n\nvar color_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvColor = vec4( 1.0 );\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\\n\\tvColor = vec3( 1.0 );\\n#endif\\n#ifdef USE_COLOR\\n\\tvColor *= color;\\n#endif\\n#ifdef USE_INSTANCING_COLOR\\n\\tvColor.xyz *= instanceColor.xyz;\\n#endif\\n#ifdef USE_BATCHING_COLOR\\n\\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\\n\\tvColor.xyz *= batchingColor.xyz;\\n#endif\";\n\nvar common = \"#define PI 3.141592653589793\\n#define PI2 6.283185307179586\\n#define PI_HALF 1.5707963267948966\\n#define RECIPROCAL_PI 0.3183098861837907\\n#define RECIPROCAL_PI2 0.15915494309189535\\n#define EPSILON 1e-6\\n#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\\nfloat pow2( const in float x ) { return x*x; }\\nvec3 pow2( const in vec3 x ) { return x*x; }\\nfloat pow3( const in float x ) { return x*x*x; }\\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\\nhighp float rand( const in vec2 uv ) {\\n\\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\\n\\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\\n\\treturn fract( sin( sn ) * c );\\n}\\n#ifdef HIGH_PRECISION\\n\\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\\n#else\\n\\tfloat precisionSafeLength( vec3 v ) {\\n\\t\\tfloat maxComponent = max3( abs( v ) );\\n\\t\\treturn length( v / maxComponent ) * maxComponent;\\n\\t}\\n#endif\\nstruct IncidentLight {\\n\\tvec3 color;\\n\\tvec3 direction;\\n\\tbool visible;\\n};\\nstruct ReflectedLight {\\n\\tvec3 directDiffuse;\\n\\tvec3 directSpecular;\\n\\tvec3 indirectDiffuse;\\n\\tvec3 indirectSpecular;\\n};\\n#ifdef USE_ALPHAHASH\\n\\tvarying vec3 vPosition;\\n#endif\\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\\n}\\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\\n}\\nmat3 transposeMat3( const in mat3 m ) {\\n\\tmat3 tmp;\\n\\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\\n\\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\\n\\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\\n\\treturn tmp;\\n}\\nbool isPerspectiveMatrix( mat4 m ) {\\n\\treturn m[ 2 ][ 3 ] == - 1.0;\\n}\\nvec2 equirectUv( in vec3 dir ) {\\n\\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\\n\\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\\n\\treturn vec2( u, v );\\n}\\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\\n\\treturn RECIPROCAL_PI * diffuseColor;\\n}\\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\\n\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n}\\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\\n\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n} // validated\";\n\nvar cube_uv_reflection_fragment = \"#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t#define cubeUV_minMipLevel 4.0\\n\\t#define cubeUV_minTileSize 16.0\\n\\tfloat getFace( vec3 direction ) {\\n\\t\\tvec3 absDirection = abs( direction );\\n\\t\\tfloat face = - 1.0;\\n\\t\\tif ( absDirection.x > absDirection.z ) {\\n\\t\\t\\tif ( absDirection.x > absDirection.y )\\n\\t\\t\\t\\tface = direction.x > 0.0 ? 0.0 : 3.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t} else {\\n\\t\\t\\tif ( absDirection.z > absDirection.y )\\n\\t\\t\\t\\tface = direction.z > 0.0 ? 2.0 : 5.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t}\\n\\t\\treturn face;\\n\\t}\\n\\tvec2 getUV( vec3 direction, float face ) {\\n\\t\\tvec2 uv;\\n\\t\\tif ( face == 0.0 ) {\\n\\t\\t\\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 1.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\\n\\t\\t} else if ( face == 2.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\\n\\t\\t} else if ( face == 3.0 ) {\\n\\t\\t\\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 4.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\\n\\t\\t} else {\\n\\t\\t\\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\\n\\t\\t}\\n\\t\\treturn 0.5 * ( uv + 1.0 );\\n\\t}\\n\\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\\n\\t\\tfloat face = getFace( direction );\\n\\t\\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\\n\\t\\tmipInt = max( mipInt, cubeUV_minMipLevel );\\n\\t\\tfloat faceSize = exp2( mipInt );\\n\\t\\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\\n\\t\\tif ( face > 2.0 ) {\\n\\t\\t\\tuv.y += faceSize;\\n\\t\\t\\tface -= 3.0;\\n\\t\\t}\\n\\t\\tuv.x += face * faceSize;\\n\\t\\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\\n\\t\\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\\n\\t\\tuv.x *= CUBEUV_TEXEL_WIDTH;\\n\\t\\tuv.y *= CUBEUV_TEXEL_HEIGHT;\\n\\t\\t#ifdef texture2DGradEXT\\n\\t\\t\\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\\n\\t\\t#else\\n\\t\\t\\treturn texture2D( envMap, uv ).rgb;\\n\\t\\t#endif\\n\\t}\\n\\t#define cubeUV_r0 1.0\\n\\t#define cubeUV_m0 - 2.0\\n\\t#define cubeUV_r1 0.8\\n\\t#define cubeUV_m1 - 1.0\\n\\t#define cubeUV_r4 0.4\\n\\t#define cubeUV_m4 2.0\\n\\t#define cubeUV_r5 0.305\\n\\t#define cubeUV_m5 3.0\\n\\t#define cubeUV_r6 0.21\\n\\t#define cubeUV_m6 4.0\\n\\tfloat roughnessToMip( float roughness ) {\\n\\t\\tfloat mip = 0.0;\\n\\t\\tif ( roughness >= cubeUV_r1 ) {\\n\\t\\t\\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\\n\\t\\t} else if ( roughness >= cubeUV_r4 ) {\\n\\t\\t\\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\\n\\t\\t} else if ( roughness >= cubeUV_r5 ) {\\n\\t\\t\\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\\n\\t\\t} else if ( roughness >= cubeUV_r6 ) {\\n\\t\\t\\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\\n\\t\\t} else {\\n\\t\\t\\tmip = - 2.0 * log2( 1.16 * roughness );\\t\\t}\\n\\t\\treturn mip;\\n\\t}\\n\\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\\n\\t\\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\\n\\t\\tfloat mipF = fract( mip );\\n\\t\\tfloat mipInt = floor( mip );\\n\\t\\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\\n\\t\\tif ( mipF == 0.0 ) {\\n\\t\\t\\treturn vec4( color0, 1.0 );\\n\\t\\t} else {\\n\\t\\t\\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\\n\\t\\t\\treturn vec4( mix( color0, color1, mipF ), 1.0 );\\n\\t\\t}\\n\\t}\\n#endif\";\n\nvar defaultnormal_vertex = \"vec3 transformedNormal = objectNormal;\\n#ifdef USE_TANGENT\\n\\tvec3 transformedTangent = objectTangent;\\n#endif\\n#ifdef USE_BATCHING\\n\\tmat3 bm = mat3( batchingMatrix );\\n\\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\\n\\ttransformedNormal = bm * transformedNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\ttransformedTangent = bm * transformedTangent;\\n\\t#endif\\n#endif\\n#ifdef USE_INSTANCING\\n\\tmat3 im = mat3( instanceMatrix );\\n\\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\\n\\ttransformedNormal = im * transformedNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\ttransformedTangent = im * transformedTangent;\\n\\t#endif\\n#endif\\ntransformedNormal = normalMatrix * transformedNormal;\\n#ifdef FLIP_SIDED\\n\\ttransformedNormal = - transformedNormal;\\n#endif\\n#ifdef USE_TANGENT\\n\\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\\n\\t#ifdef FLIP_SIDED\\n\\t\\ttransformedTangent = - transformedTangent;\\n\\t#endif\\n#endif\";\n\nvar displacementmap_pars_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\tuniform sampler2D displacementMap;\\n\\tuniform float displacementScale;\\n\\tuniform float displacementBias;\\n#endif\";\n\nvar displacementmap_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\\n#endif\";\n\nvar emissivemap_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\\n\\ttotalEmissiveRadiance *= emissiveColor.rgb;\\n#endif\";\n\nvar emissivemap_pars_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tuniform sampler2D emissiveMap;\\n#endif\";\n\nvar colorspace_fragment = \"gl_FragColor = linearToOutputTexel( gl_FragColor );\";\n\nvar colorspace_pars_fragment = \"\\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\\n\\tvec3( 0.8224621, 0.177538, 0.0 ),\\n\\tvec3( 0.0331941, 0.9668058, 0.0 ),\\n\\tvec3( 0.0170827, 0.0723974, 0.9105199 )\\n);\\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\\n\\tvec3( 1.2249401, - 0.2249404, 0.0 ),\\n\\tvec3( - 0.0420569, 1.0420571, 0.0 ),\\n\\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\\n);\\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\\n\\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\\n}\\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\\n\\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\\n}\\nvec4 LinearTransferOETF( in vec4 value ) {\\n\\treturn value;\\n}\\nvec4 sRGBTransferOETF( in vec4 value ) {\\n\\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\\n}\";\n\nvar envmap_fragment = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvec3 cameraToFrag;\\n\\t\\tif ( isOrthographic ) {\\n\\t\\t\\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\\n\\t\\t}\\n\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\\n\\t\\t#else\\n\\t\\t\\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\\n\\t\\t#endif\\n\\t#else\\n\\t\\tvec3 reflectVec = vReflect;\\n\\t#endif\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\\n\\t#else\\n\\t\\tvec4 envColor = vec4( 0.0 );\\n\\t#endif\\n\\t#ifdef ENVMAP_BLENDING_MULTIPLY\\n\\t\\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\\n\\t#elif defined( ENVMAP_BLENDING_MIX )\\n\\t\\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\\n\\t#elif defined( ENVMAP_BLENDING_ADD )\\n\\t\\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\\n\\t#endif\\n#endif\";\n\nvar envmap_common_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float envMapIntensity;\\n\\tuniform float flipEnvMap;\\n\\tuniform mat3 envMapRotation;\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tuniform samplerCube envMap;\\n\\t#else\\n\\t\\tuniform sampler2D envMap;\\n\\t#endif\\n\\t\\n#endif\";\n\nvar envmap_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float reflectivity;\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\n\\t\\t#define ENV_WORLDPOS\\n\\t#endif\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvarying vec3 vWorldPosition;\\n\\t\\tuniform float refractionRatio;\\n\\t#else\\n\\t\\tvarying vec3 vReflect;\\n\\t#endif\\n#endif\";\n\nvar envmap_pars_vertex = \"#ifdef USE_ENVMAP\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\n\\t\\t#define ENV_WORLDPOS\\n\\t#endif\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\t\\n\\t\\tvarying vec3 vWorldPosition;\\n\\t#else\\n\\t\\tvarying vec3 vReflect;\\n\\t\\tuniform float refractionRatio;\\n\\t#endif\\n#endif\";\n\nvar envmap_vertex = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvWorldPosition = worldPosition.xyz;\\n\\t#else\\n\\t\\tvec3 cameraToVertex;\\n\\t\\tif ( isOrthographic ) {\\n\\t\\t\\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\\n\\t\\t}\\n\\t\\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\tvReflect = reflect( cameraToVertex, worldNormal );\\n\\t\\t#else\\n\\t\\t\\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar fog_vertex = \"#ifdef USE_FOG\\n\\tvFogDepth = - mvPosition.z;\\n#endif\";\n\nvar fog_pars_vertex = \"#ifdef USE_FOG\\n\\tvarying float vFogDepth;\\n#endif\";\n\nvar fog_fragment = \"#ifdef USE_FOG\\n\\t#ifdef FOG_EXP2\\n\\t\\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\\n\\t#else\\n\\t\\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\\n\\t#endif\\n\\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\\n#endif\";\n\nvar fog_pars_fragment = \"#ifdef USE_FOG\\n\\tuniform vec3 fogColor;\\n\\tvarying float vFogDepth;\\n\\t#ifdef FOG_EXP2\\n\\t\\tuniform float fogDensity;\\n\\t#else\\n\\t\\tuniform float fogNear;\\n\\t\\tuniform float fogFar;\\n\\t#endif\\n#endif\";\n\nvar gradientmap_pars_fragment = \"#ifdef USE_GRADIENTMAP\\n\\tuniform sampler2D gradientMap;\\n#endif\\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\\n\\tfloat dotNL = dot( normal, lightDirection );\\n\\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\\n\\t#ifdef USE_GRADIENTMAP\\n\\t\\treturn vec3( texture2D( gradientMap, coord ).r );\\n\\t#else\\n\\t\\tvec2 fw = fwidth( coord ) * 0.5;\\n\\t\\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\\n\\t#endif\\n}\";\n\nvar lightmap_pars_fragment = \"#ifdef USE_LIGHTMAP\\n\\tuniform sampler2D lightMap;\\n\\tuniform float lightMapIntensity;\\n#endif\";\n\nvar lights_lambert_fragment = \"LambertMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularStrength = specularStrength;\";\n\nvar lights_lambert_pars_fragment = \"varying vec3 vViewPosition;\\nstruct LambertMaterial {\\n\\tvec3 diffuseColor;\\n\\tfloat specularStrength;\\n};\\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Lambert\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Lambert\";\n\nvar lights_pars_begin = \"uniform bool receiveShadow;\\nuniform vec3 ambientLightColor;\\n#if defined( USE_LIGHT_PROBES )\\n\\tuniform vec3 lightProbe[ 9 ];\\n#endif\\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\\n\\tfloat x = normal.x, y = normal.y, z = normal.z;\\n\\tvec3 result = shCoefficients[ 0 ] * 0.886227;\\n\\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\\n\\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\\n\\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\\n\\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\\n\\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\\n\\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\\n\\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\\n\\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\\n\\treturn result;\\n}\\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\\n\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\\n\\treturn irradiance;\\n}\\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\\n\\tvec3 irradiance = ambientLightColor;\\n\\treturn irradiance;\\n}\\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\\n\\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\\n\\tif ( cutoffDistance > 0.0 ) {\\n\\t\\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\\n\\t}\\n\\treturn distanceFalloff;\\n}\\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\\n\\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\\n}\\n#if NUM_DIR_LIGHTS > 0\\n\\tstruct DirectionalLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t};\\n\\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\\n\\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\\n\\t\\tlight.color = directionalLight.color;\\n\\t\\tlight.direction = directionalLight.direction;\\n\\t\\tlight.visible = true;\\n\\t}\\n#endif\\n#if NUM_POINT_LIGHTS > 0\\n\\tstruct PointLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t};\\n\\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\\n\\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\\n\\t\\tvec3 lVector = pointLight.position - geometryPosition;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat lightDistance = length( lVector );\\n\\t\\tlight.color = pointLight.color;\\n\\t\\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\\n\\t\\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\\t}\\n#endif\\n#if NUM_SPOT_LIGHTS > 0\\n\\tstruct SpotLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t\\tfloat coneCos;\\n\\t\\tfloat penumbraCos;\\n\\t};\\n\\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\\n\\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\\n\\t\\tvec3 lVector = spotLight.position - geometryPosition;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat angleCos = dot( light.direction, spotLight.direction );\\n\\t\\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\\n\\t\\tif ( spotAttenuation > 0.0 ) {\\n\\t\\t\\tfloat lightDistance = length( lVector );\\n\\t\\t\\tlight.color = spotLight.color * spotAttenuation;\\n\\t\\t\\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\\n\\t\\t\\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\\t\\t} else {\\n\\t\\t\\tlight.color = vec3( 0.0 );\\n\\t\\t\\tlight.visible = false;\\n\\t\\t}\\n\\t}\\n#endif\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tstruct RectAreaLight {\\n\\t\\tvec3 color;\\n\\t\\tvec3 position;\\n\\t\\tvec3 halfWidth;\\n\\t\\tvec3 halfHeight;\\n\\t};\\n\\tuniform sampler2D ltc_1;\\tuniform sampler2D ltc_2;\\n\\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\\n#endif\\n#if NUM_HEMI_LIGHTS > 0\\n\\tstruct HemisphereLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 skyColor;\\n\\t\\tvec3 groundColor;\\n\\t};\\n\\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\\n\\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\\n\\t\\tfloat dotNL = dot( normal, hemiLight.direction );\\n\\t\\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\\n\\t\\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\\n\\t\\treturn irradiance;\\n\\t}\\n#endif\";\n\nvar envmap_physical_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tvec3 getIBLIrradiance( const in vec3 normal ) {\\n\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\\n\\t\\t\\treturn PI * envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n\\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\\n\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\tvec3 reflectVec = reflect( - viewDir, normal );\\n\\t\\t\\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\\n\\t\\t\\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\\n\\t\\t\\treturn envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\\n\\t\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\t\\tvec3 bentNormal = cross( bitangent, viewDir );\\n\\t\\t\\t\\tbentNormal = normalize( cross( bentNormal, bitangent ) );\\n\\t\\t\\t\\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\\n\\t\\t\\t\\treturn getIBLRadiance( viewDir, bentNormal, roughness );\\n\\t\\t\\t#else\\n\\t\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t\\t#endif\\n\\t\\t}\\n\\t#endif\\n#endif\";\n\nvar lights_toon_fragment = \"ToonMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\";\n\nvar lights_toon_pars_fragment = \"varying vec3 vViewPosition;\\nstruct ToonMaterial {\\n\\tvec3 diffuseColor;\\n};\\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Toon\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Toon\";\n\nvar lights_phong_fragment = \"BlinnPhongMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularColor = specular;\\nmaterial.specularShininess = shininess;\\nmaterial.specularStrength = specularStrength;\";\n\nvar lights_phong_pars_fragment = \"varying vec3 vViewPosition;\\nstruct BlinnPhongMaterial {\\n\\tvec3 diffuseColor;\\n\\tvec3 specularColor;\\n\\tfloat specularShininess;\\n\\tfloat specularStrength;\\n};\\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n\\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\\n}\\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_BlinnPhong\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_BlinnPhong\";\n\nvar lights_physical_fragment = \"PhysicalMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\\nmaterial.roughness = min( material.roughness, 1.0 );\\n#ifdef IOR\\n\\tmaterial.ior = ior;\\n\\t#ifdef USE_SPECULAR\\n\\t\\tfloat specularIntensityFactor = specularIntensity;\\n\\t\\tvec3 specularColorFactor = specularColor;\\n\\t\\t#ifdef USE_SPECULAR_COLORMAP\\n\\t\\t\\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\\n\\t\\t#endif\\n\\t\\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\\t\\t\\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\\n\\t\\t#endif\\n\\t\\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\\n\\t#else\\n\\t\\tfloat specularIntensityFactor = 1.0;\\n\\t\\tvec3 specularColorFactor = vec3( 1.0 );\\n\\t\\tmaterial.specularF90 = 1.0;\\n\\t#endif\\n\\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\\n#else\\n\\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\\n\\tmaterial.specularF90 = 1.0;\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tmaterial.clearcoat = clearcoat;\\n\\tmaterial.clearcoatRoughness = clearcoatRoughness;\\n\\tmaterial.clearcoatF0 = vec3( 0.04 );\\n\\tmaterial.clearcoatF90 = 1.0;\\n\\t#ifdef USE_CLEARCOATMAP\\n\\t\\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\t\\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\\n\\t#endif\\n\\tmaterial.clearcoat = saturate( material.clearcoat );\\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\\n\\tmaterial.clearcoatRoughness += geometryRoughness;\\n\\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\\n#endif\\n#ifdef USE_DISPERSION\\n\\tmaterial.dispersion = dispersion;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tmaterial.iridescence = iridescence;\\n\\tmaterial.iridescenceIOR = iridescenceIOR;\\n\\t#ifdef USE_IRIDESCENCEMAP\\n\\t\\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\\n\\t#endif\\n\\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\t\\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\\n\\t#else\\n\\t\\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\\n\\t#endif\\n#endif\\n#ifdef USE_SHEEN\\n\\tmaterial.sheenColor = sheenColor;\\n\\t#ifdef USE_SHEEN_COLORMAP\\n\\t\\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\\n\\t#endif\\n\\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\\n\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\t\\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\\n\\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\\t#ifdef USE_ANISOTROPYMAP\\n\\t\\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\\n\\t\\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\\n\\t\\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\\n\\t#else\\n\\t\\tvec2 anisotropyV = anisotropyVector;\\n\\t#endif\\n\\tmaterial.anisotropy = length( anisotropyV );\\n\\tif( material.anisotropy == 0.0 ) {\\n\\t\\tanisotropyV = vec2( 1.0, 0.0 );\\n\\t} else {\\n\\t\\tanisotropyV /= material.anisotropy;\\n\\t\\tmaterial.anisotropy = saturate( material.anisotropy );\\n\\t}\\n\\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\\n\\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\\n\\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\\n#endif\";\n\nvar lights_physical_pars_fragment = \"struct PhysicalMaterial {\\n\\tvec3 diffuseColor;\\n\\tfloat roughness;\\n\\tvec3 specularColor;\\n\\tfloat specularF90;\\n\\tfloat dispersion;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat clearcoat;\\n\\t\\tfloat clearcoatRoughness;\\n\\t\\tvec3 clearcoatF0;\\n\\t\\tfloat clearcoatF90;\\n\\t#endif\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tfloat iridescence;\\n\\t\\tfloat iridescenceIOR;\\n\\t\\tfloat iridescenceThickness;\\n\\t\\tvec3 iridescenceFresnel;\\n\\t\\tvec3 iridescenceF0;\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tvec3 sheenColor;\\n\\t\\tfloat sheenRoughness;\\n\\t#endif\\n\\t#ifdef IOR\\n\\t\\tfloat ior;\\n\\t#endif\\n\\t#ifdef USE_TRANSMISSION\\n\\t\\tfloat transmission;\\n\\t\\tfloat transmissionAlpha;\\n\\t\\tfloat thickness;\\n\\t\\tfloat attenuationDistance;\\n\\t\\tvec3 attenuationColor;\\n\\t#endif\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tfloat anisotropy;\\n\\t\\tfloat alphaT;\\n\\t\\tvec3 anisotropyT;\\n\\t\\tvec3 anisotropyB;\\n\\t#endif\\n};\\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\\nvec3 sheenSpecularDirect = vec3( 0.0 );\\nvec3 sheenSpecularIndirect = vec3(0.0 );\\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\\n float x2 = x * x;\\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\\n}\\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\\n\\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\\n\\treturn 0.5 / max( gv + gl, EPSILON );\\n}\\nfloat D_GGX( const in float alpha, const in float dotNH ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\\n\\treturn RECIPROCAL_PI * a2 / pow2( denom );\\n}\\n#ifdef USE_ANISOTROPY\\n\\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\\n\\t\\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\\n\\t\\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\\n\\t\\tfloat v = 0.5 / ( gv + gl );\\n\\t\\treturn saturate(v);\\n\\t}\\n\\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\\n\\t\\tfloat a2 = alphaT * alphaB;\\n\\t\\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\\n\\t\\thighp float v2 = dot( v, v );\\n\\t\\tfloat w2 = a2 / v2;\\n\\t\\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\\n\\t}\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\\n\\t\\tvec3 f0 = material.clearcoatF0;\\n\\t\\tfloat f90 = material.clearcoatF90;\\n\\t\\tfloat roughness = material.clearcoatRoughness;\\n\\t\\tfloat alpha = pow2( roughness );\\n\\t\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\t\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\t\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\t\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\t\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\t\\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\\t\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\t\\tfloat D = D_GGX( alpha, dotNH );\\n\\t\\treturn F * ( V * D );\\n\\t}\\n#endif\\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\\n\\tvec3 f0 = material.specularColor;\\n\\tfloat f90 = material.specularF90;\\n\\tfloat roughness = material.roughness;\\n\\tfloat alpha = pow2( roughness );\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tF = mix( F, material.iridescenceFresnel, material.iridescence );\\n\\t#endif\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tfloat dotTL = dot( material.anisotropyT, lightDir );\\n\\t\\tfloat dotTV = dot( material.anisotropyT, viewDir );\\n\\t\\tfloat dotTH = dot( material.anisotropyT, halfDir );\\n\\t\\tfloat dotBL = dot( material.anisotropyB, lightDir );\\n\\t\\tfloat dotBV = dot( material.anisotropyB, viewDir );\\n\\t\\tfloat dotBH = dot( material.anisotropyB, halfDir );\\n\\t\\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\\n\\t\\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\\n\\t#else\\n\\t\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\t\\tfloat D = D_GGX( alpha, dotNH );\\n\\t#endif\\n\\treturn F * ( V * D );\\n}\\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\\n\\tconst float LUT_SIZE = 64.0;\\n\\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\\n\\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\\n\\tfloat dotNV = saturate( dot( N, V ) );\\n\\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\\n\\tuv = uv * LUT_SCALE + LUT_BIAS;\\n\\treturn uv;\\n}\\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\\n\\tfloat l = length( f );\\n\\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\\n}\\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\\n\\tfloat x = dot( v1, v2 );\\n\\tfloat y = abs( x );\\n\\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\\n\\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\\n\\tfloat v = a / b;\\n\\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\\n\\treturn cross( v1, v2 ) * theta_sintheta;\\n}\\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\\n\\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\\n\\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\\n\\tvec3 lightNormal = cross( v1, v2 );\\n\\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\\n\\tvec3 T1, T2;\\n\\tT1 = normalize( V - N * dot( V, N ) );\\n\\tT2 = - cross( N, T1 );\\n\\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\\n\\tvec3 coords[ 4 ];\\n\\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\\n\\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\\n\\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\\n\\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\\n\\tcoords[ 0 ] = normalize( coords[ 0 ] );\\n\\tcoords[ 1 ] = normalize( coords[ 1 ] );\\n\\tcoords[ 2 ] = normalize( coords[ 2 ] );\\n\\tcoords[ 3 ] = normalize( coords[ 3 ] );\\n\\tvec3 vectorFormFactor = vec3( 0.0 );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\\n\\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\\n\\treturn vec3( result );\\n}\\n#if defined( USE_SHEEN )\\nfloat D_Charlie( float roughness, float dotNH ) {\\n\\tfloat alpha = pow2( roughness );\\n\\tfloat invAlpha = 1.0 / alpha;\\n\\tfloat cos2h = dotNH * dotNH;\\n\\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\\n\\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\\n}\\nfloat V_Neubelt( float dotNV, float dotNL ) {\\n\\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\\n}\\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat D = D_Charlie( sheenRoughness, dotNH );\\n\\tfloat V = V_Neubelt( dotNV, dotNL );\\n\\treturn sheenColor * ( D * V );\\n}\\n#endif\\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat r2 = roughness * roughness;\\n\\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\\n\\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\\n\\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\\n\\treturn saturate( DG * RECIPROCAL_PI );\\n}\\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\\n\\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\\n\\tvec4 r = roughness * c0 + c1;\\n\\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\\n\\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\\n\\treturn fab;\\n}\\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\\n\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\\treturn specularColor * fab.x + specularF90 * fab.y;\\n}\\n#ifdef USE_IRIDESCENCE\\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#else\\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#endif\\n\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\\n\\t#else\\n\\t\\tvec3 Fr = specularColor;\\n\\t#endif\\n\\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\\n\\tfloat Ess = fab.x + fab.y;\\n\\tfloat Ems = 1.0 - Ess;\\n\\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\\n\\tsingleScatter += FssEss;\\n\\tmultiScatter += Fms * Ems;\\n}\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\t\\tvec3 normal = geometryNormal;\\n\\t\\tvec3 viewDir = geometryViewDir;\\n\\t\\tvec3 position = geometryPosition;\\n\\t\\tvec3 lightPos = rectAreaLight.position;\\n\\t\\tvec3 halfWidth = rectAreaLight.halfWidth;\\n\\t\\tvec3 halfHeight = rectAreaLight.halfHeight;\\n\\t\\tvec3 lightColor = rectAreaLight.color;\\n\\t\\tfloat roughness = material.roughness;\\n\\t\\tvec3 rectCoords[ 4 ];\\n\\t\\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\\t\\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\\n\\t\\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\\n\\t\\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\\n\\t\\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\\n\\t\\tvec4 t1 = texture2D( ltc_1, uv );\\n\\t\\tvec4 t2 = texture2D( ltc_2, uv );\\n\\t\\tmat3 mInv = mat3(\\n\\t\\t\\tvec3( t1.x, 0, t1.y ),\\n\\t\\t\\tvec3( 0, 1, 0 ),\\n\\t\\t\\tvec3( t1.z, 0, t1.w )\\n\\t\\t);\\n\\t\\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\\n\\t\\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\\n\\t\\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\\n\\t}\\n#endif\\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\\n\\t\\tvec3 ccIrradiance = dotNLcc * directLight.color;\\n\\t\\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\\n\\t#endif\\n\\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\\n\\t#endif\\n\\tvec3 singleScattering = vec3( 0.0 );\\n\\tvec3 multiScattering = vec3( 0.0 );\\n\\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\\n\\t#else\\n\\t\\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\\n\\t#endif\\n\\tvec3 totalScattering = singleScattering + multiScattering;\\n\\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\\n\\treflectedLight.indirectSpecular += radiance * singleScattering;\\n\\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\\n\\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Physical\\n#define RE_Direct_RectArea\\t\\tRE_Direct_RectArea_Physical\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Physical\\n#define RE_IndirectSpecular\\t\\tRE_IndirectSpecular_Physical\\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\\n\\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\\n}\";\n\nvar lights_fragment_begin = \"\\nvec3 geometryPosition = - vViewPosition;\\nvec3 geometryNormal = normal;\\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\\nvec3 geometryClearcoatNormal = vec3( 0.0 );\\n#ifdef USE_CLEARCOAT\\n\\tgeometryClearcoatNormal = clearcoatNormal;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\\n\\tif ( material.iridescenceThickness == 0.0 ) {\\n\\t\\tmaterial.iridescence = 0.0;\\n\\t} else {\\n\\t\\tmaterial.iridescence = saturate( material.iridescence );\\n\\t}\\n\\tif ( material.iridescence > 0.0 ) {\\n\\t\\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\\n\\t\\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\\n\\t}\\n#endif\\nIncidentLight directLight;\\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tPointLight pointLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\\n\\tPointLightShadow pointLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\\n\\t\\tpointLight = pointLights[ i ];\\n\\t\\tgetPointLightInfo( pointLight, geometryPosition, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\\n\\t\\tpointLightShadow = pointLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tSpotLight spotLight;\\n\\tvec4 spotColor;\\n\\tvec3 spotLightCoord;\\n\\tbool inSpotLightMap;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\\n\\tSpotLightShadow spotLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\\n\\t\\tspotLight = spotLights[ i ];\\n\\t\\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\\n\\t\\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\\n\\t\\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\\n\\t\\t#else\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\\t\\t#endif\\n\\t\\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\\n\\t\\t\\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\\n\\t\\t\\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\\n\\t\\t\\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\\n\\t\\t\\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\\n\\t\\t#endif\\n\\t\\t#undef SPOT_LIGHT_MAP_INDEX\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\tspotLightShadow = spotLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tDirectionalLight directionalLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\\n\\tDirectionalLightShadow directionalLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLights[ i ];\\n\\t\\tgetDirectionalLightInfo( directionalLight, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\\n\\t\\tdirectionalLightShadow = directionalLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\\n\\tRectAreaLight rectAreaLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\\n\\t\\trectAreaLight = rectAreaLights[ i ];\\n\\t\\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if defined( RE_IndirectDiffuse )\\n\\tvec3 iblIrradiance = vec3( 0.0 );\\n\\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\\n\\t#if defined( USE_LIGHT_PROBES )\\n\\t\\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\\n\\t#endif\\n\\t#if ( NUM_HEMI_LIGHTS > 0 )\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\\n\\t\\t\\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tvec3 radiance = vec3( 0.0 );\\n\\tvec3 clearcoatRadiance = vec3( 0.0 );\\n#endif\";\n\nvar lights_fragment_maps = \"#if defined( RE_IndirectDiffuse )\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\t\\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\\t\\tirradiance += lightMapIrradiance;\\n\\t#endif\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tiblIrradiance += getIBLIrradiance( geometryNormal );\\n\\t#endif\\n#endif\\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\\n\\t#else\\n\\t\\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\\n\\t#endif\\n#endif\";\n\nvar lights_fragment_end = \"#if defined( RE_IndirectDiffuse )\\n\\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n#endif\";\n\nvar logdepthbuf_fragment = \"#if defined( USE_LOGDEPTHBUF )\\n\\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\\n#endif\";\n\nvar logdepthbuf_pars_fragment = \"#if defined( USE_LOGDEPTHBUF )\\n\\tuniform float logDepthBufFC;\\n\\tvarying float vFragDepth;\\n\\tvarying float vIsPerspective;\\n#endif\";\n\nvar logdepthbuf_pars_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\tvarying float vFragDepth;\\n\\tvarying float vIsPerspective;\\n#endif\";\n\nvar logdepthbuf_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\tvFragDepth = 1.0 + gl_Position.w;\\n\\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\\n#endif\";\n\nvar map_fragment = \"#ifdef USE_MAP\\n\\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\\n\\t#ifdef DECODE_VIDEO_TEXTURE\\n\\t\\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\\n\\t\\n\\t#endif\\n\\tdiffuseColor *= sampledDiffuseColor;\\n#endif\";\n\nvar map_pars_fragment = \"#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\";\n\nvar map_particle_fragment = \"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\t#if defined( USE_POINTS_UV )\\n\\t\\tvec2 uv = vUv;\\n\\t#else\\n\\t\\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\\n\\t#endif\\n#endif\\n#ifdef USE_MAP\\n\\tdiffuseColor *= texture2D( map, uv );\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\\n#endif\";\n\nvar map_particle_pars_fragment = \"#if defined( USE_POINTS_UV )\\n\\tvarying vec2 vUv;\\n#else\\n\\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\t\\tuniform mat3 uvTransform;\\n\\t#endif\\n#endif\\n#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\n\nvar metalnessmap_fragment = \"float metalnessFactor = metalness;\\n#ifdef USE_METALNESSMAP\\n\\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\\n\\tmetalnessFactor *= texelMetalness.b;\\n#endif\";\n\nvar metalnessmap_pars_fragment = \"#ifdef USE_METALNESSMAP\\n\\tuniform sampler2D metalnessMap;\\n#endif\";\n\nvar morphinstance_vertex = \"#ifdef USE_INSTANCING_MORPH\\n\\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\\n\\t}\\n#endif\";\n\nvar morphcolor_vertex = \"#if defined( USE_MORPHCOLORS )\\n\\tvColor *= morphTargetBaseInfluence;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t#if defined( USE_COLOR_ALPHA )\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\\n\\t\\t#elif defined( USE_COLOR )\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\\n\\t\\t#endif\\n\\t}\\n#endif\";\n\nvar morphnormal_vertex = \"#ifdef USE_MORPHNORMALS\\n\\tobjectNormal *= morphTargetBaseInfluence;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\\n\\t}\\n#endif\";\n\nvar morphtarget_pars_vertex = \"#ifdef USE_MORPHTARGETS\\n\\t#ifndef USE_INSTANCING_MORPH\\n\\t\\tuniform float morphTargetBaseInfluence;\\n\\t\\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\\t#endif\\n\\tuniform sampler2DArray morphTargetsTexture;\\n\\tuniform ivec2 morphTargetsTextureSize;\\n\\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\\n\\t\\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\\n\\t\\tint y = texelIndex / morphTargetsTextureSize.x;\\n\\t\\tint x = texelIndex - y * morphTargetsTextureSize.x;\\n\\t\\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\\n\\t\\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\\n\\t}\\n#endif\";\n\nvar morphtarget_vertex = \"#ifdef USE_MORPHTARGETS\\n\\ttransformed *= morphTargetBaseInfluence;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\\n\\t}\\n#endif\";\n\nvar normal_fragment_begin = \"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\\n#ifdef FLAT_SHADED\\n\\tvec3 fdx = dFdx( vViewPosition );\\n\\tvec3 fdy = dFdy( vViewPosition );\\n\\tvec3 normal = normalize( cross( fdx, fdy ) );\\n#else\\n\\tvec3 normal = normalize( vNormal );\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal *= faceDirection;\\n\\t#endif\\n#endif\\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\\n\\t#ifdef USE_TANGENT\\n\\t\\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\\t#else\\n\\t\\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\\n\\t\\t#if defined( USE_NORMALMAP )\\n\\t\\t\\tvNormalMapUv\\n\\t\\t#elif defined( USE_CLEARCOAT_NORMALMAP )\\n\\t\\t\\tvClearcoatNormalMapUv\\n\\t\\t#else\\n\\t\\t\\tvUv\\n\\t\\t#endif\\n\\t\\t);\\n\\t#endif\\n\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\\t\\ttbn[0] *= faceDirection;\\n\\t\\ttbn[1] *= faceDirection;\\n\\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\t#ifdef USE_TANGENT\\n\\t\\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\\t#else\\n\\t\\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\\n\\t#endif\\n\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\\t\\ttbn2[0] *= faceDirection;\\n\\t\\ttbn2[1] *= faceDirection;\\n\\t#endif\\n#endif\\nvec3 nonPerturbedNormal = normal;\";\n\nvar normal_fragment_maps = \"#ifdef USE_NORMALMAP_OBJECTSPACE\\n\\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\\t#ifdef FLIP_SIDED\\n\\t\\tnormal = - normal;\\n\\t#endif\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal = normal * faceDirection;\\n\\t#endif\\n\\tnormal = normalize( normalMatrix * normal );\\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\\tmapN.xy *= normalScale;\\n\\tnormal = normalize( tbn * mapN );\\n#elif defined( USE_BUMPMAP )\\n\\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\\n#endif\";\n\nvar normal_pars_fragment = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\n\nvar normal_pars_vertex = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\n\nvar normal_vertex = \"#ifndef FLAT_SHADED\\n\\tvNormal = normalize( transformedNormal );\\n\\t#ifdef USE_TANGENT\\n\\t\\tvTangent = normalize( transformedTangent );\\n\\t\\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\\n\\t#endif\\n#endif\";\n\nvar normalmap_pars_fragment = \"#ifdef USE_NORMALMAP\\n\\tuniform sampler2D normalMap;\\n\\tuniform vec2 normalScale;\\n#endif\\n#ifdef USE_NORMALMAP_OBJECTSPACE\\n\\tuniform mat3 normalMatrix;\\n#endif\\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\\n\\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\\n\\t\\tvec3 q0 = dFdx( eye_pos.xyz );\\n\\t\\tvec3 q1 = dFdy( eye_pos.xyz );\\n\\t\\tvec2 st0 = dFdx( uv.st );\\n\\t\\tvec2 st1 = dFdy( uv.st );\\n\\t\\tvec3 N = surf_norm;\\n\\t\\tvec3 q1perp = cross( q1, N );\\n\\t\\tvec3 q0perp = cross( N, q0 );\\n\\t\\tvec3 T = q1perp * st0.x + q0perp * st1.x;\\n\\t\\tvec3 B = q1perp * st0.y + q0perp * st1.y;\\n\\t\\tfloat det = max( dot( T, T ), dot( B, B ) );\\n\\t\\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\\n\\t\\treturn mat3( T * scale, B * scale, N );\\n\\t}\\n#endif\";\n\nvar clearcoat_normal_fragment_begin = \"#ifdef USE_CLEARCOAT\\n\\tvec3 clearcoatNormal = nonPerturbedNormal;\\n#endif\";\n\nvar clearcoat_normal_fragment_maps = \"#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\\n\\tclearcoatMapN.xy *= clearcoatNormalScale;\\n\\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\\n#endif\";\n\nvar clearcoat_pars_fragment = \"#ifdef USE_CLEARCOATMAP\\n\\tuniform sampler2D clearcoatMap;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform sampler2D clearcoatNormalMap;\\n\\tuniform vec2 clearcoatNormalScale;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tuniform sampler2D clearcoatRoughnessMap;\\n#endif\";\n\nvar iridescence_pars_fragment = \"#ifdef USE_IRIDESCENCEMAP\\n\\tuniform sampler2D iridescenceMap;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tuniform sampler2D iridescenceThicknessMap;\\n#endif\";\n\nvar opaque_fragment = \"#ifdef OPAQUE\\ndiffuseColor.a = 1.0;\\n#endif\\n#ifdef USE_TRANSMISSION\\ndiffuseColor.a *= material.transmissionAlpha;\\n#endif\\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\";\n\nvar packing = \"vec3 packNormalToRGB( const in vec3 normal ) {\\n\\treturn normalize( normal ) * 0.5 + 0.5;\\n}\\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\\n\\treturn 2.0 * rgb.xyz - 1.0;\\n}\\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\\nconst float Inv255 = 1. / 255.;\\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\\nvec4 packDepthToRGBA( const in float v ) {\\n\\tif( v <= 0.0 )\\n\\t\\treturn vec4( 0., 0., 0., 0. );\\n\\tif( v >= 1.0 )\\n\\t\\treturn vec4( 1., 1., 1., 1. );\\n\\tfloat vuf;\\n\\tfloat af = modf( v * PackFactors.a, vuf );\\n\\tfloat bf = modf( vuf * ShiftRight8, vuf );\\n\\tfloat gf = modf( vuf * ShiftRight8, vuf );\\n\\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\\n}\\nvec3 packDepthToRGB( const in float v ) {\\n\\tif( v <= 0.0 )\\n\\t\\treturn vec3( 0., 0., 0. );\\n\\tif( v >= 1.0 )\\n\\t\\treturn vec3( 1., 1., 1. );\\n\\tfloat vuf;\\n\\tfloat bf = modf( v * PackFactors.b, vuf );\\n\\tfloat gf = modf( vuf * ShiftRight8, vuf );\\n\\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\\n}\\nvec2 packDepthToRG( const in float v ) {\\n\\tif( v <= 0.0 )\\n\\t\\treturn vec2( 0., 0. );\\n\\tif( v >= 1.0 )\\n\\t\\treturn vec2( 1., 1. );\\n\\tfloat vuf;\\n\\tfloat gf = modf( v * 256., vuf );\\n\\treturn vec2( vuf * Inv255, gf );\\n}\\nfloat unpackRGBAToDepth( const in vec4 v ) {\\n\\treturn dot( v, UnpackFactors4 );\\n}\\nfloat unpackRGBToDepth( const in vec3 v ) {\\n\\treturn dot( v, UnpackFactors3 );\\n}\\nfloat unpackRGToDepth( const in vec2 v ) {\\n\\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\\n}\\nvec4 pack2HalfToRGBA( const in vec2 v ) {\\n\\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\\n\\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\\n}\\nvec2 unpackRGBATo2Half( const in vec4 v ) {\\n\\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\\n}\\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\\n\\treturn ( viewZ + near ) / ( near - far );\\n}\\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\\n\\treturn depth * ( near - far ) - near;\\n}\\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\\n\\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\\n}\\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\\n\\treturn ( near * far ) / ( ( far - near ) * depth - far );\\n}\";\n\nvar premultiplied_alpha_fragment = \"#ifdef PREMULTIPLIED_ALPHA\\n\\tgl_FragColor.rgb *= gl_FragColor.a;\\n#endif\";\n\nvar project_vertex = \"vec4 mvPosition = vec4( transformed, 1.0 );\\n#ifdef USE_BATCHING\\n\\tmvPosition = batchingMatrix * mvPosition;\\n#endif\\n#ifdef USE_INSTANCING\\n\\tmvPosition = instanceMatrix * mvPosition;\\n#endif\\nmvPosition = modelViewMatrix * mvPosition;\\ngl_Position = projectionMatrix * mvPosition;\";\n\nvar dithering_fragment = \"#ifdef DITHERING\\n\\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\\n#endif\";\n\nvar dithering_pars_fragment = \"#ifdef DITHERING\\n\\tvec3 dithering( vec3 color ) {\\n\\t\\tfloat grid_position = rand( gl_FragCoord.xy );\\n\\t\\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\\n\\t\\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\\n\\t\\treturn color + dither_shift_RGB;\\n\\t}\\n#endif\";\n\nvar roughnessmap_fragment = \"float roughnessFactor = roughness;\\n#ifdef USE_ROUGHNESSMAP\\n\\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\\n\\troughnessFactor *= texelRoughness.g;\\n#endif\";\n\nvar roughnessmap_pars_fragment = \"#ifdef USE_ROUGHNESSMAP\\n\\tuniform sampler2D roughnessMap;\\n#endif\";\n\nvar shadowmap_pars_fragment = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#if NUM_SPOT_LIGHT_MAPS > 0\\n\\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\\n\\t\\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\\n\\t}\\n\\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\\n\\t\\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\\n\\t}\\n\\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\\n\\t\\tfloat occlusion = 1.0;\\n\\t\\tvec2 distribution = texture2DDistribution( shadow, uv );\\n\\t\\tfloat hard_shadow = step( compare , distribution.x );\\n\\t\\tif (hard_shadow != 1.0 ) {\\n\\t\\t\\tfloat distance = compare - distribution.x ;\\n\\t\\t\\tfloat variance = max( 0.00000, distribution.y * distribution.y );\\n\\t\\t\\tfloat softness_probability = variance / (variance + distance * distance );\\t\\t\\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\\t\\t\\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\\n\\t\\t}\\n\\t\\treturn occlusion;\\n\\t}\\n\\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\\n\\t\\tfloat shadow = 1.0;\\n\\t\\tshadowCoord.xyz /= shadowCoord.w;\\n\\t\\tshadowCoord.z += shadowBias;\\n\\t\\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\\n\\t\\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\\n\\t\\tif ( frustumTest ) {\\n\\t\\t#if defined( SHADOWMAP_TYPE_PCF )\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\\n\\t\\t\\tfloat dx0 = - texelSize.x * shadowRadius;\\n\\t\\t\\tfloat dy0 = - texelSize.y * shadowRadius;\\n\\t\\t\\tfloat dx1 = + texelSize.x * shadowRadius;\\n\\t\\t\\tfloat dy1 = + texelSize.y * shadowRadius;\\n\\t\\t\\tfloat dx2 = dx0 / 2.0;\\n\\t\\t\\tfloat dy2 = dy0 / 2.0;\\n\\t\\t\\tfloat dx3 = dx1 / 2.0;\\n\\t\\t\\tfloat dy3 = dy1 / 2.0;\\n\\t\\t\\tshadow = (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\\n\\t\\t\\t) * ( 1.0 / 17.0 );\\n\\t\\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\\n\\t\\t\\tfloat dx = texelSize.x;\\n\\t\\t\\tfloat dy = texelSize.y;\\n\\t\\t\\tvec2 uv = shadowCoord.xy;\\n\\t\\t\\tvec2 f = fract( uv * shadowMapSize + 0.5 );\\n\\t\\t\\tuv -= f * texelSize;\\n\\t\\t\\tshadow = (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.x ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.x ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.y ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.y ) +\\n\\t\\t\\t\\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t f.x ),\\n\\t\\t\\t\\t\\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t f.x ),\\n\\t\\t\\t\\t\\t f.y )\\n\\t\\t\\t) * ( 1.0 / 9.0 );\\n\\t\\t#elif defined( SHADOWMAP_TYPE_VSM )\\n\\t\\t\\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\\n\\t\\t#else\\n\\t\\t\\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\\n\\t\\t#endif\\n\\t\\t}\\n\\t\\treturn mix( 1.0, shadow, shadowIntensity );\\n\\t}\\n\\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\\n\\t\\tvec3 absV = abs( v );\\n\\t\\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\\n\\t\\tabsV *= scaleToCube;\\n\\t\\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\\n\\t\\tvec2 planar = v.xy;\\n\\t\\tfloat almostATexel = 1.5 * texelSizeY;\\n\\t\\tfloat almostOne = 1.0 - almostATexel;\\n\\t\\tif ( absV.z >= almostOne ) {\\n\\t\\t\\tif ( v.z > 0.0 )\\n\\t\\t\\t\\tplanar.x = 4.0 - v.x;\\n\\t\\t} else if ( absV.x >= almostOne ) {\\n\\t\\t\\tfloat signX = sign( v.x );\\n\\t\\t\\tplanar.x = v.z * signX + 2.0 * signX;\\n\\t\\t} else if ( absV.y >= almostOne ) {\\n\\t\\t\\tfloat signY = sign( v.y );\\n\\t\\t\\tplanar.x = v.x + 2.0 * signY + 2.0;\\n\\t\\t\\tplanar.y = v.z * signY - 2.0;\\n\\t\\t}\\n\\t\\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\\n\\t}\\n\\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\\n\\t\\tfloat shadow = 1.0;\\n\\t\\tvec3 lightToPosition = shadowCoord.xyz;\\n\\t\\t\\n\\t\\tfloat lightToPositionLength = length( lightToPosition );\\n\\t\\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\\n\\t\\t\\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\\t\\t\\tdp += shadowBias;\\n\\t\\t\\tvec3 bd3D = normalize( lightToPosition );\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\\n\\t\\t\\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\\n\\t\\t\\t\\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\\n\\t\\t\\t\\tshadow = (\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\\n\\t\\t\\t\\t) * ( 1.0 / 9.0 );\\n\\t\\t\\t#else\\n\\t\\t\\t\\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\\n\\t\\t\\t#endif\\n\\t\\t}\\n\\t\\treturn mix( 1.0, shadow, shadowIntensity );\\n\\t}\\n#endif\";\n\nvar shadowmap_pars_vertex = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\\n\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n#endif\";\n\nvar shadowmap_vertex = \"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\\n\\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\\tvec4 shadowWorldPosition;\\n#endif\\n#if defined( USE_SHADOWMAP )\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\t\\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\t\\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n#endif\\n#if NUM_SPOT_LIGHT_COORDS > 0\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\\n\\t\\tshadowWorldPosition = worldPosition;\\n\\t\\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\t\\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\\n\\t\\t#endif\\n\\t\\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\";\n\nvar shadowmask_pars_fragment = \"float getShadowMask() {\\n\\tfloat shadow = 1.0;\\n\\t#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\tDirectionalLightShadow directionalLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\tSpotLightShadow spotLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tspotLight = spotLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\tPointLightShadow pointLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tpointLight = pointLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#endif\\n\\treturn shadow;\\n}\";\n\nvar skinbase_vertex = \"#ifdef USE_SKINNING\\n\\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\\n\\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\\n\\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\\n\\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\\n#endif\";\n\nvar skinning_pars_vertex = \"#ifdef USE_SKINNING\\n\\tuniform mat4 bindMatrix;\\n\\tuniform mat4 bindMatrixInverse;\\n\\tuniform highp sampler2D boneTexture;\\n\\tmat4 getBoneMatrix( const in float i ) {\\n\\t\\tint size = textureSize( boneTexture, 0 ).x;\\n\\t\\tint j = int( i ) * 4;\\n\\t\\tint x = j % size;\\n\\t\\tint y = j / size;\\n\\t\\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\\n\\t\\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\\n\\t\\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\\n\\t\\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\\n\\t\\treturn mat4( v1, v2, v3, v4 );\\n\\t}\\n#endif\";\n\nvar skinning_vertex = \"#ifdef USE_SKINNING\\n\\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\\n\\tvec4 skinned = vec4( 0.0 );\\n\\tskinned += boneMatX * skinVertex * skinWeight.x;\\n\\tskinned += boneMatY * skinVertex * skinWeight.y;\\n\\tskinned += boneMatZ * skinVertex * skinWeight.z;\\n\\tskinned += boneMatW * skinVertex * skinWeight.w;\\n\\ttransformed = ( bindMatrixInverse * skinned ).xyz;\\n#endif\";\n\nvar skinnormal_vertex = \"#ifdef USE_SKINNING\\n\\tmat4 skinMatrix = mat4( 0.0 );\\n\\tskinMatrix += skinWeight.x * boneMatX;\\n\\tskinMatrix += skinWeight.y * boneMatY;\\n\\tskinMatrix += skinWeight.z * boneMatZ;\\n\\tskinMatrix += skinWeight.w * boneMatW;\\n\\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\\n\\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\\n\\t#ifdef USE_TANGENT\\n\\t\\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\\n\\t#endif\\n#endif\";\n\nvar specularmap_fragment = \"float specularStrength;\\n#ifdef USE_SPECULARMAP\\n\\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\\n\\tspecularStrength = texelSpecular.r;\\n#else\\n\\tspecularStrength = 1.0;\\n#endif\";\n\nvar specularmap_pars_fragment = \"#ifdef USE_SPECULARMAP\\n\\tuniform sampler2D specularMap;\\n#endif\";\n\nvar tonemapping_fragment = \"#if defined( TONE_MAPPING )\\n\\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\\n#endif\";\n\nvar tonemapping_pars_fragment = \"#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\nuniform float toneMappingExposure;\\nvec3 LinearToneMapping( vec3 color ) {\\n\\treturn saturate( toneMappingExposure * color );\\n}\\nvec3 ReinhardToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\treturn saturate( color / ( vec3( 1.0 ) + color ) );\\n}\\nvec3 CineonToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\tcolor = max( vec3( 0.0 ), color - 0.004 );\\n\\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\\n}\\nvec3 RRTAndODTFit( vec3 v ) {\\n\\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\\n\\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\\n\\treturn a / b;\\n}\\nvec3 ACESFilmicToneMapping( vec3 color ) {\\n\\tconst mat3 ACESInputMat = mat3(\\n\\t\\tvec3( 0.59719, 0.07600, 0.02840 ),\\t\\tvec3( 0.35458, 0.90834, 0.13383 ),\\n\\t\\tvec3( 0.04823, 0.01566, 0.83777 )\\n\\t);\\n\\tconst mat3 ACESOutputMat = mat3(\\n\\t\\tvec3( 1.60475, -0.10208, -0.00327 ),\\t\\tvec3( -0.53108, 1.10813, -0.07276 ),\\n\\t\\tvec3( -0.07367, -0.00605, 1.07602 )\\n\\t);\\n\\tcolor *= toneMappingExposure / 0.6;\\n\\tcolor = ACESInputMat * color;\\n\\tcolor = RRTAndODTFit( color );\\n\\tcolor = ACESOutputMat * color;\\n\\treturn saturate( color );\\n}\\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\\n\\tvec3( 1.6605, - 0.1246, - 0.0182 ),\\n\\tvec3( - 0.5876, 1.1329, - 0.1006 ),\\n\\tvec3( - 0.0728, - 0.0083, 1.1187 )\\n);\\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\\n\\tvec3( 0.6274, 0.0691, 0.0164 ),\\n\\tvec3( 0.3293, 0.9195, 0.0880 ),\\n\\tvec3( 0.0433, 0.0113, 0.8956 )\\n);\\nvec3 agxDefaultContrastApprox( vec3 x ) {\\n\\tvec3 x2 = x * x;\\n\\tvec3 x4 = x2 * x2;\\n\\treturn + 15.5 * x4 * x2\\n\\t\\t- 40.14 * x4 * x\\n\\t\\t+ 31.96 * x4\\n\\t\\t- 6.868 * x2 * x\\n\\t\\t+ 0.4298 * x2\\n\\t\\t+ 0.1191 * x\\n\\t\\t- 0.00232;\\n}\\nvec3 AgXToneMapping( vec3 color ) {\\n\\tconst mat3 AgXInsetMatrix = mat3(\\n\\t\\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\\n\\t\\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\\n\\t\\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\\n\\t);\\n\\tconst mat3 AgXOutsetMatrix = mat3(\\n\\t\\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\\n\\t\\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\\n\\t\\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\\n\\t);\\n\\tconst float AgxMinEv = - 12.47393;\\tconst float AgxMaxEv = 4.026069;\\n\\tcolor *= toneMappingExposure;\\n\\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\\n\\tcolor = AgXInsetMatrix * color;\\n\\tcolor = max( color, 1e-10 );\\tcolor = log2( color );\\n\\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\\n\\tcolor = clamp( color, 0.0, 1.0 );\\n\\tcolor = agxDefaultContrastApprox( color );\\n\\tcolor = AgXOutsetMatrix * color;\\n\\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\\n\\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\\n\\tcolor = clamp( color, 0.0, 1.0 );\\n\\treturn color;\\n}\\nvec3 NeutralToneMapping( vec3 color ) {\\n\\tconst float StartCompression = 0.8 - 0.04;\\n\\tconst float Desaturation = 0.15;\\n\\tcolor *= toneMappingExposure;\\n\\tfloat x = min( color.r, min( color.g, color.b ) );\\n\\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\\n\\tcolor -= offset;\\n\\tfloat peak = max( color.r, max( color.g, color.b ) );\\n\\tif ( peak < StartCompression ) return color;\\n\\tfloat d = 1. - StartCompression;\\n\\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\\n\\tcolor *= newPeak / peak;\\n\\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\\n\\treturn mix( color, vec3( newPeak ), g );\\n}\\nvec3 CustomToneMapping( vec3 color ) { return color; }\";\n\nvar transmission_fragment = \"#ifdef USE_TRANSMISSION\\n\\tmaterial.transmission = transmission;\\n\\tmaterial.transmissionAlpha = 1.0;\\n\\tmaterial.thickness = thickness;\\n\\tmaterial.attenuationDistance = attenuationDistance;\\n\\tmaterial.attenuationColor = attenuationColor;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\\n\\t#endif\\n\\tvec3 pos = vWorldPosition;\\n\\tvec3 v = normalize( cameraPosition - pos );\\n\\tvec3 n = inverseTransformDirection( normal, viewMatrix );\\n\\tvec4 transmitted = getIBLVolumeRefraction(\\n\\t\\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\\n\\t\\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\\n\\t\\tmaterial.attenuationColor, material.attenuationDistance );\\n\\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\\n\\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\\n#endif\";\n\nvar transmission_pars_fragment = \"#ifdef USE_TRANSMISSION\\n\\tuniform float transmission;\\n\\tuniform float thickness;\\n\\tuniform float attenuationDistance;\\n\\tuniform vec3 attenuationColor;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\tuniform sampler2D transmissionMap;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tuniform sampler2D thicknessMap;\\n\\t#endif\\n\\tuniform vec2 transmissionSamplerSize;\\n\\tuniform sampler2D transmissionSamplerMap;\\n\\tuniform mat4 modelMatrix;\\n\\tuniform mat4 projectionMatrix;\\n\\tvarying vec3 vWorldPosition;\\n\\tfloat w0( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\\n\\t}\\n\\tfloat w1( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\\n\\t}\\n\\tfloat w2( float a ){\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\\n\\t}\\n\\tfloat w3( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * a * a );\\n\\t}\\n\\tfloat g0( float a ) {\\n\\t\\treturn w0( a ) + w1( a );\\n\\t}\\n\\tfloat g1( float a ) {\\n\\t\\treturn w2( a ) + w3( a );\\n\\t}\\n\\tfloat h0( float a ) {\\n\\t\\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\\n\\t}\\n\\tfloat h1( float a ) {\\n\\t\\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\\n\\t}\\n\\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\\n\\t\\tuv = uv * texelSize.zw + 0.5;\\n\\t\\tvec2 iuv = floor( uv );\\n\\t\\tvec2 fuv = fract( uv );\\n\\t\\tfloat g0x = g0( fuv.x );\\n\\t\\tfloat g1x = g1( fuv.x );\\n\\t\\tfloat h0x = h0( fuv.x );\\n\\t\\tfloat h1x = h1( fuv.x );\\n\\t\\tfloat h0y = h0( fuv.y );\\n\\t\\tfloat h1y = h1( fuv.y );\\n\\t\\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\\t\\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\\n\\t\\t\\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\\n\\t}\\n\\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\\n\\t\\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\\n\\t\\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\\n\\t\\tvec2 fLodSizeInv = 1.0 / fLodSize;\\n\\t\\tvec2 cLodSizeInv = 1.0 / cLodSize;\\n\\t\\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\\n\\t\\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\\n\\t\\treturn mix( fSample, cSample, fract( lod ) );\\n\\t}\\n\\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\\n\\t\\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\\n\\t\\tvec3 modelScale;\\n\\t\\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\\n\\t\\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\\n\\t\\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\\n\\t\\treturn normalize( refractionVector ) * thickness * modelScale;\\n\\t}\\n\\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\\n\\t\\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\\n\\t}\\n\\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\\n\\t\\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\\n\\t\\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\\n\\t}\\n\\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tif ( isinf( attenuationDistance ) ) {\\n\\t\\t\\treturn vec3( 1.0 );\\n\\t\\t} else {\\n\\t\\t\\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\\n\\t\\t\\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\\t\\t\\treturn transmittance;\\n\\t\\t}\\n\\t}\\n\\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\\n\\t\\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\\n\\t\\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\\n\\t\\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tvec4 transmittedLight;\\n\\t\\tvec3 transmittance;\\n\\t\\t#ifdef USE_DISPERSION\\n\\t\\t\\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\\n\\t\\t\\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\\n\\t\\t\\tfor ( int i = 0; i < 3; i ++ ) {\\n\\t\\t\\t\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\\n\\t\\t\\t\\tvec3 refractedRayExit = position + transmissionRay;\\n\\t\\t\\n\\t\\t\\t\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\\t\\t\\t\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\\t\\t\\t\\trefractionCoords += 1.0;\\n\\t\\t\\t\\trefractionCoords /= 2.0;\\n\\t\\t\\n\\t\\t\\t\\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\\n\\t\\t\\t\\ttransmittedLight[ i ] = transmissionSample[ i ];\\n\\t\\t\\t\\ttransmittedLight.a += transmissionSample.a;\\n\\t\\t\\t\\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\\n\\t\\t\\t}\\n\\t\\t\\ttransmittedLight.a /= 3.0;\\n\\t\\t\\n\\t\\t#else\\n\\t\\t\\n\\t\\t\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\\n\\t\\t\\tvec3 refractedRayExit = position + transmissionRay;\\n\\t\\t\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\\t\\t\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\\t\\t\\trefractionCoords += 1.0;\\n\\t\\t\\trefractionCoords /= 2.0;\\n\\t\\t\\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\\n\\t\\t\\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\\n\\t\\t\\n\\t\\t#endif\\n\\t\\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\\n\\t\\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\\n\\t\\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\\n\\t\\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\\n\\t}\\n#endif\";\n\nvar uv_pars_fragment = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tuniform mat3 transmissionMapTransform;\\n\\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tuniform mat3 thicknessMapTransform;\\n\\tvarying vec2 vThicknessMapUv;\\n#endif\";\n\nvar uv_pars_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\\tuniform mat3 mapTransform;\\n\\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform mat3 alphaMapTransform;\\n\\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tuniform mat3 lightMapTransform;\\n\\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\\tuniform mat3 aoMapTransform;\\n\\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tuniform mat3 bumpMapTransform;\\n\\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tuniform mat3 normalMapTransform;\\n\\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\\tuniform mat3 displacementMapTransform;\\n\\tvarying vec2 vDisplacementMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tuniform mat3 emissiveMapTransform;\\n\\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tuniform mat3 metalnessMapTransform;\\n\\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tuniform mat3 roughnessMapTransform;\\n\\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tuniform mat3 anisotropyMapTransform;\\n\\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tuniform mat3 clearcoatMapTransform;\\n\\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform mat3 clearcoatNormalMapTransform;\\n\\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tuniform mat3 clearcoatRoughnessMapTransform;\\n\\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tuniform mat3 sheenColorMapTransform;\\n\\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tuniform mat3 sheenRoughnessMapTransform;\\n\\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tuniform mat3 iridescenceMapTransform;\\n\\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tuniform mat3 iridescenceThicknessMapTransform;\\n\\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tuniform mat3 specularMapTransform;\\n\\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tuniform mat3 specularColorMapTransform;\\n\\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tuniform mat3 specularIntensityMapTransform;\\n\\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tuniform mat3 transmissionMapTransform;\\n\\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tuniform mat3 thicknessMapTransform;\\n\\tvarying vec2 vThicknessMapUv;\\n#endif\";\n\nvar uv_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvUv = vec3( uv, 1 ).xy;\\n#endif\\n#ifdef USE_MAP\\n\\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_AOMAP\\n\\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\";\n\nvar worldpos_vertex = \"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\\n\\tvec4 worldPosition = vec4( transformed, 1.0 );\\n\\t#ifdef USE_BATCHING\\n\\t\\tworldPosition = batchingMatrix * worldPosition;\\n\\t#endif\\n\\t#ifdef USE_INSTANCING\\n\\t\\tworldPosition = instanceMatrix * worldPosition;\\n\\t#endif\\n\\tworldPosition = modelMatrix * worldPosition;\\n#endif\";\n\nconst vertex$h = \"varying vec2 vUv;\\nuniform mat3 uvTransform;\\nvoid main() {\\n\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\\tgl_Position = vec4( position.xy, 1.0, 1.0 );\\n}\";\n\nconst fragment$h = \"uniform sampler2D t2D;\\nuniform float backgroundIntensity;\\nvarying vec2 vUv;\\nvoid main() {\\n\\tvec4 texColor = texture2D( t2D, vUv );\\n\\t#ifdef DECODE_VIDEO_TEXTURE\\n\\t\\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\\n\\t#endif\\n\\ttexColor.rgb *= backgroundIntensity;\\n\\tgl_FragColor = texColor;\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$g = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n\\tgl_Position.z = gl_Position.w;\\n}\";\n\nconst fragment$g = \"#ifdef ENVMAP_TYPE_CUBE\\n\\tuniform samplerCube envMap;\\n#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\tuniform sampler2D envMap;\\n#endif\\nuniform float flipEnvMap;\\nuniform float backgroundBlurriness;\\nuniform float backgroundIntensity;\\nuniform mat3 backgroundRotation;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\\n\\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\\n\\t#else\\n\\t\\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\\n\\t#endif\\n\\ttexColor.rgb *= backgroundIntensity;\\n\\tgl_FragColor = texColor;\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$f = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n\\tgl_Position.z = gl_Position.w;\\n}\";\n\nconst fragment$f = \"uniform samplerCube tCube;\\nuniform float tFlip;\\nuniform float opacity;\\nvarying vec3 vWorldDirection;\\nvoid main() {\\n\\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\\n\\tgl_FragColor = texColor;\\n\\tgl_FragColor.a *= opacity;\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$e = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvHighPrecisionZW = gl_Position.zw;\\n}\";\n\nconst fragment$e = \"#if DEPTH_PACKING == 3200\\n\\tuniform float opacity;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include \\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tdiffuseColor.a = opacity;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\\n\\t#elif DEPTH_PACKING == 3201\\n\\t\\tgl_FragColor = packDepthToRGBA( fragCoordZ );\\n\\t#elif DEPTH_PACKING == 3202\\n\\t\\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\\n\\t#elif DEPTH_PACKING == 3203\\n\\t\\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\\n\\t#endif\\n}\";\n\nconst vertex$d = \"#define DISTANCE\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvWorldPosition = worldPosition.xyz;\\n}\";\n\nconst fragment$d = \"#define DISTANCE\\nuniform vec3 referencePosition;\\nuniform float nearDistance;\\nuniform float farDistance;\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main () {\\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tfloat dist = length( vWorldPosition - referencePosition );\\n\\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\\n\\tdist = saturate( dist );\\n\\tgl_FragColor = packDepthToRGBA( dist );\\n}\";\n\nconst vertex$c = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$c = \"uniform sampler2D tEquirect;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvec3 direction = normalize( vWorldDirection );\\n\\tvec2 sampleUV = equirectUv( direction );\\n\\tgl_FragColor = texture2D( tEquirect, sampleUV );\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$b = \"uniform float scale;\\nattribute float lineDistance;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvLineDistance = scale * lineDistance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$b = \"uniform vec3 diffuse;\\nuniform float opacity;\\nuniform float dashSize;\\nuniform float totalSize;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\\n\\t\\tdiscard;\\n\\t}\\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$a = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$a = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\t\\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\\n\\t#else\\n\\t\\treflectedLight.indirectDiffuse += vec3( 1.0 );\\n\\t#endif\\n\\t#include \\n\\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\\n\\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$9 = \"#define LAMBERT\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$9 = \"#define LAMBERT\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$8 = \"#define MATCAP\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n}\";\n\nconst fragment$8 = \"#define MATCAP\\nuniform vec3 diffuse;\\nuniform float opacity;\\nuniform sampler2D matcap;\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 viewDir = normalize( vViewPosition );\\n\\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\\n\\tvec3 y = cross( viewDir, x );\\n\\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\\n\\t#ifdef USE_MATCAP\\n\\t\\tvec4 matcapColor = texture2D( matcap, uv );\\n\\t#else\\n\\t\\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\\n\\t#endif\\n\\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$7 = \"#define NORMAL\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvViewPosition = - mvPosition.xyz;\\n#endif\\n}\";\n\nconst fragment$7 = \"#define NORMAL\\nuniform float opacity;\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\\n\\t#ifdef OPAQUE\\n\\t\\tgl_FragColor.a = 1.0;\\n\\t#endif\\n}\";\n\nconst vertex$6 = \"#define PHONG\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$6 = \"#define PHONG\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform vec3 specular;\\nuniform float shininess;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$5 = \"#define STANDARD\\nvarying vec3 vViewPosition;\\n#ifdef USE_TRANSMISSION\\n\\tvarying vec3 vWorldPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n#ifdef USE_TRANSMISSION\\n\\tvWorldPosition = worldPosition.xyz;\\n#endif\\n}\";\n\nconst fragment$5 = \"#define STANDARD\\n#ifdef PHYSICAL\\n\\t#define IOR\\n\\t#define USE_SPECULAR\\n#endif\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float roughness;\\nuniform float metalness;\\nuniform float opacity;\\n#ifdef IOR\\n\\tuniform float ior;\\n#endif\\n#ifdef USE_SPECULAR\\n\\tuniform float specularIntensity;\\n\\tuniform vec3 specularColor;\\n\\t#ifdef USE_SPECULAR_COLORMAP\\n\\t\\tuniform sampler2D specularColorMap;\\n\\t#endif\\n\\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\\t\\tuniform sampler2D specularIntensityMap;\\n\\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tuniform float clearcoat;\\n\\tuniform float clearcoatRoughness;\\n#endif\\n#ifdef USE_DISPERSION\\n\\tuniform float dispersion;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tuniform float iridescence;\\n\\tuniform float iridescenceIOR;\\n\\tuniform float iridescenceThicknessMinimum;\\n\\tuniform float iridescenceThicknessMaximum;\\n#endif\\n#ifdef USE_SHEEN\\n\\tuniform vec3 sheenColor;\\n\\tuniform float sheenRoughness;\\n\\t#ifdef USE_SHEEN_COLORMAP\\n\\t\\tuniform sampler2D sheenColorMap;\\n\\t#endif\\n\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\t\\tuniform sampler2D sheenRoughnessMap;\\n\\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\\tuniform vec2 anisotropyVector;\\n\\t#ifdef USE_ANISOTROPYMAP\\n\\t\\tuniform sampler2D anisotropyMap;\\n\\t#endif\\n#endif\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\\n\\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\\n\\t#include \\n\\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\\n\\t#ifdef USE_SHEEN\\n\\t\\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\\n\\t\\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\\n\\t\\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\\n\\t\\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$4 = \"#define TOON\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$4 = \"#define TOON\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$3 = \"uniform float size;\\nuniform float scale;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#ifdef USE_POINTS_UV\\n\\tvarying vec2 vUv;\\n\\tuniform mat3 uvTransform;\\n#endif\\nvoid main() {\\n\\t#ifdef USE_POINTS_UV\\n\\t\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tgl_PointSize = size;\\n\\t#ifdef USE_SIZEATTENUATION\\n\\t\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\n\\t\\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$3 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$2 = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$2 = \"uniform vec3 color;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$1 = \"uniform float rotation;\\nuniform vec2 center;\\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\\n\\tvec2 scale;\\n\\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\\n\\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\\n\\t#ifndef USE_SIZEATTENUATION\\n\\t\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\n\\t\\tif ( isPerspective ) scale *= - mvPosition.z;\\n\\t#endif\\n\\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\\n\\tvec2 rotatedPosition;\\n\\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\\n\\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\\n\\tmvPosition.xy += rotatedPosition;\\n\\tgl_Position = projectionMatrix * mvPosition;\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$1 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst ShaderChunk = {\n\talphahash_fragment: alphahash_fragment,\n\talphahash_pars_fragment: alphahash_pars_fragment,\n\talphamap_fragment: alphamap_fragment,\n\talphamap_pars_fragment: alphamap_pars_fragment,\n\talphatest_fragment: alphatest_fragment,\n\talphatest_pars_fragment: alphatest_pars_fragment,\n\taomap_fragment: aomap_fragment,\n\taomap_pars_fragment: aomap_pars_fragment,\n\tbatching_pars_vertex: batching_pars_vertex,\n\tbatching_vertex: batching_vertex,\n\tbegin_vertex: begin_vertex,\n\tbeginnormal_vertex: beginnormal_vertex,\n\tbsdfs: bsdfs,\n\tiridescence_fragment: iridescence_fragment,\n\tbumpmap_pars_fragment: bumpmap_pars_fragment,\n\tclipping_planes_fragment: clipping_planes_fragment,\n\tclipping_planes_pars_fragment: clipping_planes_pars_fragment,\n\tclipping_planes_pars_vertex: clipping_planes_pars_vertex,\n\tclipping_planes_vertex: clipping_planes_vertex,\n\tcolor_fragment: color_fragment,\n\tcolor_pars_fragment: color_pars_fragment,\n\tcolor_pars_vertex: color_pars_vertex,\n\tcolor_vertex: color_vertex,\n\tcommon: common,\n\tcube_uv_reflection_fragment: cube_uv_reflection_fragment,\n\tdefaultnormal_vertex: defaultnormal_vertex,\n\tdisplacementmap_pars_vertex: displacementmap_pars_vertex,\n\tdisplacementmap_vertex: displacementmap_vertex,\n\temissivemap_fragment: emissivemap_fragment,\n\temissivemap_pars_fragment: emissivemap_pars_fragment,\n\tcolorspace_fragment: colorspace_fragment,\n\tcolorspace_pars_fragment: colorspace_pars_fragment,\n\tenvmap_fragment: envmap_fragment,\n\tenvmap_common_pars_fragment: envmap_common_pars_fragment,\n\tenvmap_pars_fragment: envmap_pars_fragment,\n\tenvmap_pars_vertex: envmap_pars_vertex,\n\tenvmap_physical_pars_fragment: envmap_physical_pars_fragment,\n\tenvmap_vertex: envmap_vertex,\n\tfog_vertex: fog_vertex,\n\tfog_pars_vertex: fog_pars_vertex,\n\tfog_fragment: fog_fragment,\n\tfog_pars_fragment: fog_pars_fragment,\n\tgradientmap_pars_fragment: gradientmap_pars_fragment,\n\tlightmap_pars_fragment: lightmap_pars_fragment,\n\tlights_lambert_fragment: lights_lambert_fragment,\n\tlights_lambert_pars_fragment: lights_lambert_pars_fragment,\n\tlights_pars_begin: lights_pars_begin,\n\tlights_toon_fragment: lights_toon_fragment,\n\tlights_toon_pars_fragment: lights_toon_pars_fragment,\n\tlights_phong_fragment: lights_phong_fragment,\n\tlights_phong_pars_fragment: lights_phong_pars_fragment,\n\tlights_physical_fragment: lights_physical_fragment,\n\tlights_physical_pars_fragment: lights_physical_pars_fragment,\n\tlights_fragment_begin: lights_fragment_begin,\n\tlights_fragment_maps: lights_fragment_maps,\n\tlights_fragment_end: lights_fragment_end,\n\tlogdepthbuf_fragment: logdepthbuf_fragment,\n\tlogdepthbuf_pars_fragment: logdepthbuf_pars_fragment,\n\tlogdepthbuf_pars_vertex: logdepthbuf_pars_vertex,\n\tlogdepthbuf_vertex: logdepthbuf_vertex,\n\tmap_fragment: map_fragment,\n\tmap_pars_fragment: map_pars_fragment,\n\tmap_particle_fragment: map_particle_fragment,\n\tmap_particle_pars_fragment: map_particle_pars_fragment,\n\tmetalnessmap_fragment: metalnessmap_fragment,\n\tmetalnessmap_pars_fragment: metalnessmap_pars_fragment,\n\tmorphinstance_vertex: morphinstance_vertex,\n\tmorphcolor_vertex: morphcolor_vertex,\n\tmorphnormal_vertex: morphnormal_vertex,\n\tmorphtarget_pars_vertex: morphtarget_pars_vertex,\n\tmorphtarget_vertex: morphtarget_vertex,\n\tnormal_fragment_begin: normal_fragment_begin,\n\tnormal_fragment_maps: normal_fragment_maps,\n\tnormal_pars_fragment: normal_pars_fragment,\n\tnormal_pars_vertex: normal_pars_vertex,\n\tnormal_vertex: normal_vertex,\n\tnormalmap_pars_fragment: normalmap_pars_fragment,\n\tclearcoat_normal_fragment_begin: clearcoat_normal_fragment_begin,\n\tclearcoat_normal_fragment_maps: clearcoat_normal_fragment_maps,\n\tclearcoat_pars_fragment: clearcoat_pars_fragment,\n\tiridescence_pars_fragment: iridescence_pars_fragment,\n\topaque_fragment: opaque_fragment,\n\tpacking: packing,\n\tpremultiplied_alpha_fragment: premultiplied_alpha_fragment,\n\tproject_vertex: project_vertex,\n\tdithering_fragment: dithering_fragment,\n\tdithering_pars_fragment: dithering_pars_fragment,\n\troughnessmap_fragment: roughnessmap_fragment,\n\troughnessmap_pars_fragment: roughnessmap_pars_fragment,\n\tshadowmap_pars_fragment: shadowmap_pars_fragment,\n\tshadowmap_pars_vertex: shadowmap_pars_vertex,\n\tshadowmap_vertex: shadowmap_vertex,\n\tshadowmask_pars_fragment: shadowmask_pars_fragment,\n\tskinbase_vertex: skinbase_vertex,\n\tskinning_pars_vertex: skinning_pars_vertex,\n\tskinning_vertex: skinning_vertex,\n\tskinnormal_vertex: skinnormal_vertex,\n\tspecularmap_fragment: specularmap_fragment,\n\tspecularmap_pars_fragment: specularmap_pars_fragment,\n\ttonemapping_fragment: tonemapping_fragment,\n\ttonemapping_pars_fragment: tonemapping_pars_fragment,\n\ttransmission_fragment: transmission_fragment,\n\ttransmission_pars_fragment: transmission_pars_fragment,\n\tuv_pars_fragment: uv_pars_fragment,\n\tuv_pars_vertex: uv_pars_vertex,\n\tuv_vertex: uv_vertex,\n\tworldpos_vertex: worldpos_vertex,\n\n\tbackground_vert: vertex$h,\n\tbackground_frag: fragment$h,\n\tbackgroundCube_vert: vertex$g,\n\tbackgroundCube_frag: fragment$g,\n\tcube_vert: vertex$f,\n\tcube_frag: fragment$f,\n\tdepth_vert: vertex$e,\n\tdepth_frag: fragment$e,\n\tdistanceRGBA_vert: vertex$d,\n\tdistanceRGBA_frag: fragment$d,\n\tequirect_vert: vertex$c,\n\tequirect_frag: fragment$c,\n\tlinedashed_vert: vertex$b,\n\tlinedashed_frag: fragment$b,\n\tmeshbasic_vert: vertex$a,\n\tmeshbasic_frag: fragment$a,\n\tmeshlambert_vert: vertex$9,\n\tmeshlambert_frag: fragment$9,\n\tmeshmatcap_vert: vertex$8,\n\tmeshmatcap_frag: fragment$8,\n\tmeshnormal_vert: vertex$7,\n\tmeshnormal_frag: fragment$7,\n\tmeshphong_vert: vertex$6,\n\tmeshphong_frag: fragment$6,\n\tmeshphysical_vert: vertex$5,\n\tmeshphysical_frag: fragment$5,\n\tmeshtoon_vert: vertex$4,\n\tmeshtoon_frag: fragment$4,\n\tpoints_vert: vertex$3,\n\tpoints_frag: fragment$3,\n\tshadow_vert: vertex$2,\n\tshadow_frag: fragment$2,\n\tsprite_vert: vertex$1,\n\tsprite_frag: fragment$1\n};\n\n/**\n * Uniforms library for shared webgl shaders\n */\n\nconst UniformsLib = {\n\n\tcommon: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\n\t\tmap: { value: null },\n\t\tmapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\n\t\talphaTest: { value: 0 }\n\n\t},\n\n\tspecularmap: {\n\n\t\tspecularMap: { value: null },\n\t\tspecularMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tenvmap: {\n\n\t\tenvMap: { value: null },\n\t\tenvMapRotation: { value: /*@__PURE__*/ new Matrix3() },\n\t\tflipEnvMap: { value: - 1 },\n\t\treflectivity: { value: 1.0 }, // basic, lambert, phong\n\t\tior: { value: 1.5 }, // physical\n\t\trefractionRatio: { value: 0.98 }, // basic, lambert, phong\n\n\t},\n\n\taomap: {\n\n\t\taoMap: { value: null },\n\t\taoMapIntensity: { value: 1 },\n\t\taoMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tlightmap: {\n\n\t\tlightMap: { value: null },\n\t\tlightMapIntensity: { value: 1 },\n\t\tlightMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tbumpmap: {\n\n\t\tbumpMap: { value: null },\n\t\tbumpMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tbumpScale: { value: 1 }\n\n\t},\n\n\tnormalmap: {\n\n\t\tnormalMap: { value: null },\n\t\tnormalMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tnormalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) }\n\n\t},\n\n\tdisplacementmap: {\n\n\t\tdisplacementMap: { value: null },\n\t\tdisplacementMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tdisplacementScale: { value: 1 },\n\t\tdisplacementBias: { value: 0 }\n\n\t},\n\n\temissivemap: {\n\n\t\temissiveMap: { value: null },\n\t\temissiveMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tmetalnessmap: {\n\n\t\tmetalnessMap: { value: null },\n\t\tmetalnessMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\troughnessmap: {\n\n\t\troughnessMap: { value: null },\n\t\troughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tgradientmap: {\n\n\t\tgradientMap: { value: null }\n\n\t},\n\n\tfog: {\n\n\t\tfogDensity: { value: 0.00025 },\n\t\tfogNear: { value: 1 },\n\t\tfogFar: { value: 2000 },\n\t\tfogColor: { value: /*@__PURE__*/ new Color( 0xffffff ) }\n\n\t},\n\n\tlights: {\n\n\t\tambientLightColor: { value: [] },\n\n\t\tlightProbe: { value: [] },\n\n\t\tdirectionalLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tcolor: {}\n\t\t} },\n\n\t\tdirectionalLightShadows: { value: [], properties: {\n\t\t\tshadowIntensity: 1,\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tdirectionalShadowMap: { value: [] },\n\t\tdirectionalShadowMatrix: { value: [] },\n\n\t\tspotLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdirection: {},\n\t\t\tdistance: {},\n\t\t\tconeCos: {},\n\t\t\tpenumbraCos: {},\n\t\t\tdecay: {}\n\t\t} },\n\n\t\tspotLightShadows: { value: [], properties: {\n\t\t\tshadowIntensity: 1,\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tspotLightMap: { value: [] },\n\t\tspotShadowMap: { value: [] },\n\t\tspotLightMatrix: { value: [] },\n\n\t\tpointLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdecay: {},\n\t\t\tdistance: {}\n\t\t} },\n\n\t\tpointLightShadows: { value: [], properties: {\n\t\t\tshadowIntensity: 1,\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {},\n\t\t\tshadowCameraNear: {},\n\t\t\tshadowCameraFar: {}\n\t\t} },\n\n\t\tpointShadowMap: { value: [] },\n\t\tpointShadowMatrix: { value: [] },\n\n\t\themisphereLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tskyColor: {},\n\t\t\tgroundColor: {}\n\t\t} },\n\n\t\t// TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src\n\t\trectAreaLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\twidth: {},\n\t\t\theight: {}\n\t\t} },\n\n\t\tltc_1: { value: null },\n\t\tltc_2: { value: null }\n\n\t},\n\n\tpoints: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\t\tsize: { value: 1.0 },\n\t\tscale: { value: 1.0 },\n\t\tmap: { value: null },\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaTest: { value: 0 },\n\t\tuvTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tsprite: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\t\tcenter: { value: /*@__PURE__*/ new Vector2( 0.5, 0.5 ) },\n\t\trotation: { value: 0.0 },\n\t\tmap: { value: null },\n\t\tmapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaTest: { value: 0 }\n\n\t}\n\n};\n\nconst ShaderLib = {\n\n\tbasic: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshbasic_vert,\n\t\tfragmentShader: ShaderChunk.meshbasic_frag\n\n\t},\n\n\tlambert: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshlambert_vert,\n\t\tfragmentShader: ShaderChunk.meshlambert_frag\n\n\t},\n\n\tphong: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\t\tspecular: { value: /*@__PURE__*/ new Color( 0x111111 ) },\n\t\t\t\tshininess: { value: 30 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphong_vert,\n\t\tfragmentShader: ShaderChunk.meshphong_frag\n\n\t},\n\n\tstandard: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.roughnessmap,\n\t\t\tUniformsLib.metalnessmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\t\troughness: { value: 1.0 },\n\t\t\t\tmetalness: { value: 0.0 },\n\t\t\t\tenvMapIntensity: { value: 1 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphysical_vert,\n\t\tfragmentShader: ShaderChunk.meshphysical_frag\n\n\t},\n\n\ttoon: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.gradientmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshtoon_vert,\n\t\tfragmentShader: ShaderChunk.meshtoon_frag\n\n\t},\n\n\tmatcap: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tmatcap: { value: null }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshmatcap_vert,\n\t\tfragmentShader: ShaderChunk.meshmatcap_frag\n\n\t},\n\n\tpoints: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.points,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.points_vert,\n\t\tfragmentShader: ShaderChunk.points_frag\n\n\t},\n\n\tdashed: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tscale: { value: 1 },\n\t\t\t\tdashSize: { value: 1 },\n\t\t\t\ttotalSize: { value: 2 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.linedashed_vert,\n\t\tfragmentShader: ShaderChunk.linedashed_frag\n\n\t},\n\n\tdepth: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.depth_vert,\n\t\tfragmentShader: ShaderChunk.depth_frag\n\n\t},\n\n\tnormal: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshnormal_vert,\n\t\tfragmentShader: ShaderChunk.meshnormal_frag\n\n\t},\n\n\tsprite: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.sprite,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.sprite_vert,\n\t\tfragmentShader: ShaderChunk.sprite_frag\n\n\t},\n\n\tbackground: {\n\n\t\tuniforms: {\n\t\t\tuvTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tt2D: { value: null },\n\t\t\tbackgroundIntensity: { value: 1 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.background_vert,\n\t\tfragmentShader: ShaderChunk.background_frag\n\n\t},\n\n\tbackgroundCube: {\n\n\t\tuniforms: {\n\t\t\tenvMap: { value: null },\n\t\t\tflipEnvMap: { value: - 1 },\n\t\t\tbackgroundBlurriness: { value: 0 },\n\t\t\tbackgroundIntensity: { value: 1 },\n\t\t\tbackgroundRotation: { value: /*@__PURE__*/ new Matrix3() }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.backgroundCube_vert,\n\t\tfragmentShader: ShaderChunk.backgroundCube_frag\n\n\t},\n\n\tcube: {\n\n\t\tuniforms: {\n\t\t\ttCube: { value: null },\n\t\t\ttFlip: { value: - 1 },\n\t\t\topacity: { value: 1.0 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.cube_vert,\n\t\tfragmentShader: ShaderChunk.cube_frag\n\n\t},\n\n\tequirect: {\n\n\t\tuniforms: {\n\t\t\ttEquirect: { value: null },\n\t\t},\n\n\t\tvertexShader: ShaderChunk.equirect_vert,\n\t\tfragmentShader: ShaderChunk.equirect_frag\n\n\t},\n\n\tdistanceRGBA: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\treferencePosition: { value: /*@__PURE__*/ new Vector3() },\n\t\t\t\tnearDistance: { value: 1 },\n\t\t\t\tfarDistance: { value: 1000 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.distanceRGBA_vert,\n\t\tfragmentShader: ShaderChunk.distanceRGBA_frag\n\n\t},\n\n\tshadow: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.lights,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tcolor: { value: /*@__PURE__*/ new Color( 0x00000 ) },\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t},\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.shadow_vert,\n\t\tfragmentShader: ShaderChunk.shadow_frag\n\n\t}\n\n};\n\nShaderLib.physical = {\n\n\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\tShaderLib.standard.uniforms,\n\t\t{\n\t\t\tclearcoat: { value: 0 },\n\t\t\tclearcoatMap: { value: null },\n\t\t\tclearcoatMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tclearcoatNormalMap: { value: null },\n\t\t\tclearcoatNormalMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tclearcoatNormalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) },\n\t\t\tclearcoatRoughness: { value: 0 },\n\t\t\tclearcoatRoughnessMap: { value: null },\n\t\t\tclearcoatRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tdispersion: { value: 0 },\n\t\t\tiridescence: { value: 0 },\n\t\t\tiridescenceMap: { value: null },\n\t\t\tiridescenceMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tiridescenceIOR: { value: 1.3 },\n\t\t\tiridescenceThicknessMinimum: { value: 100 },\n\t\t\tiridescenceThicknessMaximum: { value: 400 },\n\t\t\tiridescenceThicknessMap: { value: null },\n\t\t\tiridescenceThicknessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tsheen: { value: 0 },\n\t\t\tsheenColor: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\tsheenColorMap: { value: null },\n\t\t\tsheenColorMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tsheenRoughness: { value: 1 },\n\t\t\tsheenRoughnessMap: { value: null },\n\t\t\tsheenRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\ttransmission: { value: 0 },\n\t\t\ttransmissionMap: { value: null },\n\t\t\ttransmissionMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\ttransmissionSamplerSize: { value: /*@__PURE__*/ new Vector2() },\n\t\t\ttransmissionSamplerMap: { value: null },\n\t\t\tthickness: { value: 0 },\n\t\t\tthicknessMap: { value: null },\n\t\t\tthicknessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tattenuationDistance: { value: 0 },\n\t\t\tattenuationColor: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\tspecularColor: { value: /*@__PURE__*/ new Color( 1, 1, 1 ) },\n\t\t\tspecularColorMap: { value: null },\n\t\t\tspecularColorMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tspecularIntensity: { value: 1 },\n\t\t\tspecularIntensityMap: { value: null },\n\t\t\tspecularIntensityMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tanisotropyVector: { value: /*@__PURE__*/ new Vector2() },\n\t\t\tanisotropyMap: { value: null },\n\t\t\tanisotropyMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t}\n\t] ),\n\n\tvertexShader: ShaderChunk.meshphysical_vert,\n\tfragmentShader: ShaderChunk.meshphysical_frag\n\n};\n\nconst _rgb = { r: 0, b: 0, g: 0 };\nconst _e1$1 = /*@__PURE__*/ new Euler();\nconst _m1$1 = /*@__PURE__*/ new Matrix4();\n\nfunction WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha ) {\n\n\tconst clearColor = new Color( 0x000000 );\n\tlet clearAlpha = alpha === true ? 0 : 1;\n\n\tlet planeMesh;\n\tlet boxMesh;\n\n\tlet currentBackground = null;\n\tlet currentBackgroundVersion = 0;\n\tlet currentTonemapping = null;\n\n\tfunction getBackground( scene ) {\n\n\t\tlet background = scene.isScene === true ? scene.background : null;\n\n\t\tif ( background && background.isTexture ) {\n\n\t\t\tconst usePMREM = scene.backgroundBlurriness > 0; // use PMREM if the user wants to blur the background\n\t\t\tbackground = ( usePMREM ? cubeuvmaps : cubemaps ).get( background );\n\n\t\t}\n\n\t\treturn background;\n\n\t}\n\n\tfunction render( scene ) {\n\n\t\tlet forceClear = false;\n\t\tconst background = getBackground( scene );\n\n\t\tif ( background === null ) {\n\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t} else if ( background && background.isColor ) {\n\n\t\t\tsetClear( background, 1 );\n\t\t\tforceClear = true;\n\n\t\t}\n\n\t\tconst environmentBlendMode = renderer.xr.getEnvironmentBlendMode();\n\n\t\tif ( environmentBlendMode === 'additive' ) {\n\n\t\t\tstate.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );\n\n\t\t} else if ( environmentBlendMode === 'alpha-blend' ) {\n\n\t\t\tstate.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );\n\n\t\t}\n\n\t\tif ( renderer.autoClear || forceClear ) {\n\n\t\t\t// buffers might not be writable which is required to ensure a correct clear\n\n\t\t\tstate.buffers.depth.setTest( true );\n\t\t\tstate.buffers.depth.setMask( true );\n\t\t\tstate.buffers.color.setMask( true );\n\n\t\t\trenderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );\n\n\t\t}\n\n\t}\n\n\tfunction addToRenderList( renderList, scene ) {\n\n\t\tconst background = getBackground( scene );\n\n\t\tif ( background && ( background.isCubeTexture || background.mapping === CubeUVReflectionMapping ) ) {\n\n\t\t\tif ( boxMesh === undefined ) {\n\n\t\t\t\tboxMesh = new Mesh(\n\t\t\t\t\tnew BoxGeometry( 1, 1, 1 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\tname: 'BackgroundCubeMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.backgroundCube.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.backgroundCube.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.backgroundCube.fragmentShader,\n\t\t\t\t\t\tside: BackSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'normal' );\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'uv' );\n\n\t\t\t\tboxMesh.onBeforeRender = function ( renderer, scene, camera ) {\n\n\t\t\t\t\tthis.matrixWorld.copyPosition( camera.matrixWorld );\n\n\t\t\t\t};\n\n\t\t\t\t// add \"envMap\" material property so the renderer can evaluate it like for built-in materials\n\t\t\t\tObject.defineProperty( boxMesh.material, 'envMap', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.envMap.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( boxMesh );\n\n\t\t\t}\n\n\t\t\t_e1$1.copy( scene.backgroundRotation );\n\n\t\t\t// accommodate left-handed frame\n\t\t\t_e1$1.x *= - 1; _e1$1.y *= - 1; _e1$1.z *= - 1;\n\n\t\t\tif ( background.isCubeTexture && background.isRenderTargetTexture === false ) {\n\n\t\t\t\t// environment maps which are not cube render targets or PMREMs follow a different convention\n\t\t\t\t_e1$1.y *= - 1;\n\t\t\t\t_e1$1.z *= - 1;\n\n\t\t\t}\n\n\t\t\tboxMesh.material.uniforms.envMap.value = background;\n\t\t\tboxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;\n\t\t\tboxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;\n\t\t\tboxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n\t\t\tboxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4( _m1$1.makeRotationFromEuler( _e1$1 ) );\n\t\t\tboxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tboxMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = background.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t\tboxMesh.layers.enableAll();\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null );\n\n\t\t} else if ( background && background.isTexture ) {\n\n\t\t\tif ( planeMesh === undefined ) {\n\n\t\t\t\tplaneMesh = new Mesh(\n\t\t\t\t\tnew PlaneGeometry( 2, 2 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\tname: 'BackgroundMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.background.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.background.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.background.fragmentShader,\n\t\t\t\t\t\tside: FrontSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tplaneMesh.geometry.deleteAttribute( 'normal' );\n\n\t\t\t\t// add \"map\" material property so the renderer can evaluate it like for built-in materials\n\t\t\t\tObject.defineProperty( planeMesh.material, 'map', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.t2D.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( planeMesh );\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.t2D.value = background;\n\t\t\tplaneMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n\t\t\tplaneMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;\n\n\t\t\tif ( background.matrixAutoUpdate === true ) {\n\n\t\t\t\tbackground.updateMatrix();\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.uvTransform.value.copy( background.matrix );\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tplaneMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = background.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t\tplaneMesh.layers.enableAll();\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null );\n\n\t\t}\n\n\t}\n\n\tfunction setClear( color, alpha ) {\n\n\t\tcolor.getRGB( _rgb, getUnlitUniformColorSpace( renderer ) );\n\n\t\tstate.buffers.color.setClear( _rgb.r, _rgb.g, _rgb.b, alpha, premultipliedAlpha );\n\n\t}\n\n\treturn {\n\n\t\tgetClearColor: function () {\n\n\t\t\treturn clearColor;\n\n\t\t},\n\t\tsetClearColor: function ( color, alpha = 1 ) {\n\n\t\t\tclearColor.set( color );\n\t\t\tclearAlpha = alpha;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\tgetClearAlpha: function () {\n\n\t\t\treturn clearAlpha;\n\n\t\t},\n\t\tsetClearAlpha: function ( alpha ) {\n\n\t\t\tclearAlpha = alpha;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\trender: render,\n\t\taddToRenderList: addToRenderList\n\n\t};\n\n}\n\nfunction WebGLBindingStates( gl, attributes ) {\n\n\tconst maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\n\n\tconst bindingStates = {};\n\n\tconst defaultState = createBindingState( null );\n\tlet currentState = defaultState;\n\tlet forceUpdate = false;\n\n\tfunction setup( object, material, program, geometry, index ) {\n\n\t\tlet updateBuffers = false;\n\n\t\tconst state = getBindingState( geometry, program, material );\n\n\t\tif ( currentState !== state ) {\n\n\t\t\tcurrentState = state;\n\t\t\tbindVertexArrayObject( currentState.object );\n\n\t\t}\n\n\t\tupdateBuffers = needsUpdate( object, geometry, program, index );\n\n\t\tif ( updateBuffers ) saveCache( object, geometry, program, index );\n\n\t\tif ( index !== null ) {\n\n\t\t\tattributes.update( index, gl.ELEMENT_ARRAY_BUFFER );\n\n\t\t}\n\n\t\tif ( updateBuffers || forceUpdate ) {\n\n\t\t\tforceUpdate = false;\n\n\t\t\tsetupVertexAttributes( object, material, program, geometry );\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tgl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, attributes.get( index ).buffer );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction createVertexArrayObject() {\n\n\t\treturn gl.createVertexArray();\n\n\t}\n\n\tfunction bindVertexArrayObject( vao ) {\n\n\t\treturn gl.bindVertexArray( vao );\n\n\t}\n\n\tfunction deleteVertexArrayObject( vao ) {\n\n\t\treturn gl.deleteVertexArray( vao );\n\n\t}\n\n\tfunction getBindingState( geometry, program, material ) {\n\n\t\tconst wireframe = ( material.wireframe === true );\n\n\t\tlet programMap = bindingStates[ geometry.id ];\n\n\t\tif ( programMap === undefined ) {\n\n\t\t\tprogramMap = {};\n\t\t\tbindingStates[ geometry.id ] = programMap;\n\n\t\t}\n\n\t\tlet stateMap = programMap[ program.id ];\n\n\t\tif ( stateMap === undefined ) {\n\n\t\t\tstateMap = {};\n\t\t\tprogramMap[ program.id ] = stateMap;\n\n\t\t}\n\n\t\tlet state = stateMap[ wireframe ];\n\n\t\tif ( state === undefined ) {\n\n\t\t\tstate = createBindingState( createVertexArrayObject() );\n\t\t\tstateMap[ wireframe ] = state;\n\n\t\t}\n\n\t\treturn state;\n\n\t}\n\n\tfunction createBindingState( vao ) {\n\n\t\tconst newAttributes = [];\n\t\tconst enabledAttributes = [];\n\t\tconst attributeDivisors = [];\n\n\t\tfor ( let i = 0; i < maxVertexAttributes; i ++ ) {\n\n\t\t\tnewAttributes[ i ] = 0;\n\t\t\tenabledAttributes[ i ] = 0;\n\t\t\tattributeDivisors[ i ] = 0;\n\n\t\t}\n\n\t\treturn {\n\n\t\t\t// for backward compatibility on non-VAO support browser\n\t\t\tgeometry: null,\n\t\t\tprogram: null,\n\t\t\twireframe: false,\n\n\t\t\tnewAttributes: newAttributes,\n\t\t\tenabledAttributes: enabledAttributes,\n\t\t\tattributeDivisors: attributeDivisors,\n\t\t\tobject: vao,\n\t\t\tattributes: {},\n\t\t\tindex: null\n\n\t\t};\n\n\t}\n\n\tfunction needsUpdate( object, geometry, program, index ) {\n\n\t\tconst cachedAttributes = currentState.attributes;\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\tlet attributesNum = 0;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tconst cachedAttribute = cachedAttributes[ name ];\n\t\t\t\tlet geometryAttribute = geometryAttributes[ name ];\n\n\t\t\t\tif ( geometryAttribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tif ( cachedAttribute === undefined ) return true;\n\n\t\t\t\tif ( cachedAttribute.attribute !== geometryAttribute ) return true;\n\n\t\t\t\tif ( geometryAttribute && cachedAttribute.data !== geometryAttribute.data ) return true;\n\n\t\t\t\tattributesNum ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( currentState.attributesNum !== attributesNum ) return true;\n\n\t\tif ( currentState.index !== index ) return true;\n\n\t\treturn false;\n\n\t}\n\n\tfunction saveCache( object, geometry, program, index ) {\n\n\t\tconst cache = {};\n\t\tconst attributes = geometry.attributes;\n\t\tlet attributesNum = 0;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tlet attribute = attributes[ name ];\n\n\t\t\t\tif ( attribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) attribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) attribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tconst data = {};\n\t\t\t\tdata.attribute = attribute;\n\n\t\t\t\tif ( attribute && attribute.data ) {\n\n\t\t\t\t\tdata.data = attribute.data;\n\n\t\t\t\t}\n\n\t\t\t\tcache[ name ] = data;\n\n\t\t\t\tattributesNum ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tcurrentState.attributes = cache;\n\t\tcurrentState.attributesNum = attributesNum;\n\n\t\tcurrentState.index = index;\n\n\t}\n\n\tfunction initAttributes() {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\n\t\tfor ( let i = 0, il = newAttributes.length; i < il; i ++ ) {\n\n\t\t\tnewAttributes[ i ] = 0;\n\n\t\t}\n\n\t}\n\n\tfunction enableAttribute( attribute ) {\n\n\t\tenableAttributeAndDivisor( attribute, 0 );\n\n\t}\n\n\tfunction enableAttributeAndDivisor( attribute, meshPerAttribute ) {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\t\tconst enabledAttributes = currentState.enabledAttributes;\n\t\tconst attributeDivisors = currentState.attributeDivisors;\n\n\t\tnewAttributes[ attribute ] = 1;\n\n\t\tif ( enabledAttributes[ attribute ] === 0 ) {\n\n\t\t\tgl.enableVertexAttribArray( attribute );\n\t\t\tenabledAttributes[ attribute ] = 1;\n\n\t\t}\n\n\t\tif ( attributeDivisors[ attribute ] !== meshPerAttribute ) {\n\n\t\t\tgl.vertexAttribDivisor( attribute, meshPerAttribute );\n\t\t\tattributeDivisors[ attribute ] = meshPerAttribute;\n\n\t\t}\n\n\t}\n\n\tfunction disableUnusedAttributes() {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\t\tconst enabledAttributes = currentState.enabledAttributes;\n\n\t\tfor ( let i = 0, il = enabledAttributes.length; i < il; i ++ ) {\n\n\t\t\tif ( enabledAttributes[ i ] !== newAttributes[ i ] ) {\n\n\t\t\t\tgl.disableVertexAttribArray( i );\n\t\t\t\tenabledAttributes[ i ] = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction vertexAttribPointer( index, size, type, normalized, stride, offset, integer ) {\n\n\t\tif ( integer === true ) {\n\n\t\t\tgl.vertexAttribIPointer( index, size, type, stride, offset );\n\n\t\t} else {\n\n\t\t\tgl.vertexAttribPointer( index, size, type, normalized, stride, offset );\n\n\t\t}\n\n\t}\n\n\tfunction setupVertexAttributes( object, material, program, geometry ) {\n\n\t\tinitAttributes();\n\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tconst materialDefaultAttributeValues = material.defaultAttributeValues;\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tlet geometryAttribute = geometryAttributes[ name ];\n\n\t\t\t\tif ( geometryAttribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tif ( geometryAttribute !== undefined ) {\n\n\t\t\t\t\tconst normalized = geometryAttribute.normalized;\n\t\t\t\t\tconst size = geometryAttribute.itemSize;\n\n\t\t\t\t\tconst attribute = attributes.get( geometryAttribute );\n\n\t\t\t\t\t// TODO Attribute may not be available on context restore\n\n\t\t\t\t\tif ( attribute === undefined ) continue;\n\n\t\t\t\t\tconst buffer = attribute.buffer;\n\t\t\t\t\tconst type = attribute.type;\n\t\t\t\t\tconst bytesPerElement = attribute.bytesPerElement;\n\n\t\t\t\t\t// check for integer attributes\n\n\t\t\t\t\tconst integer = ( type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === IntType );\n\n\t\t\t\t\tif ( geometryAttribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\t\tconst data = geometryAttribute.data;\n\t\t\t\t\t\tconst stride = data.stride;\n\t\t\t\t\t\tconst offset = geometryAttribute.offset;\n\n\t\t\t\t\t\tif ( data.isInstancedInterleavedBuffer ) {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, data.meshPerAttribute );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = data.meshPerAttribute * data.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgl.bindBuffer( gl.ARRAY_BUFFER, buffer );\n\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\tvertexAttribPointer(\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\tnormalized,\n\t\t\t\t\t\t\t\tstride * bytesPerElement,\n\t\t\t\t\t\t\t\t( offset + ( size / programAttribute.locationSize ) * i ) * bytesPerElement,\n\t\t\t\t\t\t\t\tinteger\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( geometryAttribute.isInstancedBufferAttribute ) {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, geometryAttribute.meshPerAttribute );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgl.bindBuffer( gl.ARRAY_BUFFER, buffer );\n\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\tvertexAttribPointer(\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\tnormalized,\n\t\t\t\t\t\t\t\tsize * bytesPerElement,\n\t\t\t\t\t\t\t\t( size / programAttribute.locationSize ) * i * bytesPerElement,\n\t\t\t\t\t\t\t\tinteger\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( materialDefaultAttributeValues !== undefined ) {\n\n\t\t\t\t\tconst value = materialDefaultAttributeValues[ name ];\n\n\t\t\t\t\tif ( value !== undefined ) {\n\n\t\t\t\t\t\tswitch ( value.length ) {\n\n\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\tgl.vertexAttrib2fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\t\tgl.vertexAttrib3fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 4:\n\t\t\t\t\t\t\t\tgl.vertexAttrib4fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tgl.vertexAttrib1fv( programAttribute.location, value );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tdisableUnusedAttributes();\n\n\t}\n\n\tfunction dispose() {\n\n\t\treset();\n\n\t\tfor ( const geometryId in bindingStates ) {\n\n\t\t\tconst programMap = bindingStates[ geometryId ];\n\n\t\t\tfor ( const programId in programMap ) {\n\n\t\t\t\tconst stateMap = programMap[ programId ];\n\n\t\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t\t}\n\n\t\t\t\tdelete programMap[ programId ];\n\n\t\t\t}\n\n\t\t\tdelete bindingStates[ geometryId ];\n\n\t\t}\n\n\t}\n\n\tfunction releaseStatesOfGeometry( geometry ) {\n\n\t\tif ( bindingStates[ geometry.id ] === undefined ) return;\n\n\t\tconst programMap = bindingStates[ geometry.id ];\n\n\t\tfor ( const programId in programMap ) {\n\n\t\t\tconst stateMap = programMap[ programId ];\n\n\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t}\n\n\t\t\tdelete programMap[ programId ];\n\n\t\t}\n\n\t\tdelete bindingStates[ geometry.id ];\n\n\t}\n\n\tfunction releaseStatesOfProgram( program ) {\n\n\t\tfor ( const geometryId in bindingStates ) {\n\n\t\t\tconst programMap = bindingStates[ geometryId ];\n\n\t\t\tif ( programMap[ program.id ] === undefined ) continue;\n\n\t\t\tconst stateMap = programMap[ program.id ];\n\n\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t}\n\n\t\t\tdelete programMap[ program.id ];\n\n\t\t}\n\n\t}\n\n\tfunction reset() {\n\n\t\tresetDefaultState();\n\t\tforceUpdate = true;\n\n\t\tif ( currentState === defaultState ) return;\n\n\t\tcurrentState = defaultState;\n\t\tbindVertexArrayObject( currentState.object );\n\n\t}\n\n\t// for backward-compatibility\n\n\tfunction resetDefaultState() {\n\n\t\tdefaultState.geometry = null;\n\t\tdefaultState.program = null;\n\t\tdefaultState.wireframe = false;\n\n\t}\n\n\treturn {\n\n\t\tsetup: setup,\n\t\treset: reset,\n\t\tresetDefaultState: resetDefaultState,\n\t\tdispose: dispose,\n\t\treleaseStatesOfGeometry: releaseStatesOfGeometry,\n\t\treleaseStatesOfProgram: releaseStatesOfProgram,\n\n\t\tinitAttributes: initAttributes,\n\t\tenableAttribute: enableAttribute,\n\t\tdisableUnusedAttributes: disableUnusedAttributes\n\n\t};\n\n}\n\nfunction WebGLBufferRenderer( gl, extensions, info ) {\n\n\tlet mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawArrays( mode, start, count );\n\n\t\tinfo.update( count, mode, 1 );\n\n\t}\n\n\tfunction renderInstances( start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tgl.drawArraysInstanced( mode, start, count, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\tfunction renderMultiDraw( starts, counts, drawCount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\t\textension.multiDrawArraysWEBGL( mode, starts, 0, counts, 0, drawCount );\n\n\t\tlet elementCount = 0;\n\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\telementCount += counts[ i ];\n\n\t\t}\n\n\t\tinfo.update( elementCount, mode, 1 );\n\n\t}\n\n\tfunction renderMultiDrawInstances( starts, counts, drawCount, primcount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\n\t\tif ( extension === null ) {\n\n\t\t\tfor ( let i = 0; i < starts.length; i ++ ) {\n\n\t\t\t\trenderInstances( starts[ i ], counts[ i ], primcount[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\textension.multiDrawArraysInstancedWEBGL( mode, starts, 0, counts, 0, primcount, 0, drawCount );\n\n\t\t\tlet elementCount = 0;\n\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\telementCount += counts[ i ];\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0; i < primcount.length; i ++ ) {\n\n\t\t\t\tinfo.update( elementCount, mode, primcount[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\tthis.renderMultiDraw = renderMultiDraw;\n\tthis.renderMultiDrawInstances = renderMultiDrawInstances;\n\n}\n\nfunction WebGLCapabilities( gl, extensions, parameters, utils ) {\n\n\tlet maxAnisotropy;\n\n\tfunction getMaxAnisotropy() {\n\n\t\tif ( maxAnisotropy !== undefined ) return maxAnisotropy;\n\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\n\n\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\n\t\t\tmaxAnisotropy = gl.getParameter( extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT );\n\n\t\t} else {\n\n\t\t\tmaxAnisotropy = 0;\n\n\t\t}\n\n\t\treturn maxAnisotropy;\n\n\t}\n\n\tfunction textureFormatReadable( textureFormat ) {\n\n\t\tif ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_FORMAT ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfunction textureTypeReadable( textureType ) {\n\n\t\tconst halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) );\n\n\t\tif ( textureType !== UnsignedByteType && utils.convert( textureType ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)\n\t\t\ttextureType !== FloatType && ! halfFloatSupportedByExt ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfunction getMaxPrecision( precision ) {\n\n\t\tif ( precision === 'highp' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.HIGH_FLOAT ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.HIGH_FLOAT ).precision > 0 ) {\n\n\t\t\t\treturn 'highp';\n\n\t\t\t}\n\n\t\t\tprecision = 'mediump';\n\n\t\t}\n\n\t\tif ( precision === 'mediump' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.MEDIUM_FLOAT ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT ).precision > 0 ) {\n\n\t\t\t\treturn 'mediump';\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn 'lowp';\n\n\t}\n\n\tlet precision = parameters.precision !== undefined ? parameters.precision : 'highp';\n\tconst maxPrecision = getMaxPrecision( precision );\n\n\tif ( maxPrecision !== precision ) {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.' );\n\t\tprecision = maxPrecision;\n\n\t}\n\n\tconst logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;\n\n\tconst maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );\n\tconst maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );\n\tconst maxTextureSize = gl.getParameter( gl.MAX_TEXTURE_SIZE );\n\tconst maxCubemapSize = gl.getParameter( gl.MAX_CUBE_MAP_TEXTURE_SIZE );\n\n\tconst maxAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\n\tconst maxVertexUniforms = gl.getParameter( gl.MAX_VERTEX_UNIFORM_VECTORS );\n\tconst maxVaryings = gl.getParameter( gl.MAX_VARYING_VECTORS );\n\tconst maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS );\n\n\tconst vertexTextures = maxVertexTextures > 0;\n\n\tconst maxSamples = gl.getParameter( gl.MAX_SAMPLES );\n\n\treturn {\n\n\t\tisWebGL2: true, // keeping this for backwards compatibility\n\n\t\tgetMaxAnisotropy: getMaxAnisotropy,\n\t\tgetMaxPrecision: getMaxPrecision,\n\n\t\ttextureFormatReadable: textureFormatReadable,\n\t\ttextureTypeReadable: textureTypeReadable,\n\n\t\tprecision: precision,\n\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\n\t\tmaxTextures: maxTextures,\n\t\tmaxVertexTextures: maxVertexTextures,\n\t\tmaxTextureSize: maxTextureSize,\n\t\tmaxCubemapSize: maxCubemapSize,\n\n\t\tmaxAttributes: maxAttributes,\n\t\tmaxVertexUniforms: maxVertexUniforms,\n\t\tmaxVaryings: maxVaryings,\n\t\tmaxFragmentUniforms: maxFragmentUniforms,\n\n\t\tvertexTextures: vertexTextures,\n\n\t\tmaxSamples: maxSamples\n\n\t};\n\n}\n\nfunction WebGLClipping( properties ) {\n\n\tconst scope = this;\n\n\tlet globalState = null,\n\t\tnumGlobalPlanes = 0,\n\t\tlocalClippingEnabled = false,\n\t\trenderingShadows = false;\n\n\tconst plane = new Plane(),\n\t\tviewNormalMatrix = new Matrix3(),\n\n\t\tuniform = { value: null, needsUpdate: false };\n\n\tthis.uniform = uniform;\n\tthis.numPlanes = 0;\n\tthis.numIntersection = 0;\n\n\tthis.init = function ( planes, enableLocalClipping ) {\n\n\t\tconst enabled =\n\t\t\tplanes.length !== 0 ||\n\t\t\tenableLocalClipping ||\n\t\t\t// enable state of previous frame - the clipping code has to\n\t\t\t// run another frame in order to reset the state:\n\t\t\tnumGlobalPlanes !== 0 ||\n\t\t\tlocalClippingEnabled;\n\n\t\tlocalClippingEnabled = enableLocalClipping;\n\n\t\tnumGlobalPlanes = planes.length;\n\n\t\treturn enabled;\n\n\t};\n\n\tthis.beginShadows = function () {\n\n\t\trenderingShadows = true;\n\t\tprojectPlanes( null );\n\n\t};\n\n\tthis.endShadows = function () {\n\n\t\trenderingShadows = false;\n\n\t};\n\n\tthis.setGlobalState = function ( planes, camera ) {\n\n\t\tglobalState = projectPlanes( planes, camera, 0 );\n\n\t};\n\n\tthis.setState = function ( material, camera, useCache ) {\n\n\t\tconst planes = material.clippingPlanes,\n\t\t\tclipIntersection = material.clipIntersection,\n\t\t\tclipShadows = material.clipShadows;\n\n\t\tconst materialProperties = properties.get( material );\n\n\t\tif ( ! localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && ! clipShadows ) {\n\n\t\t\t// there's no local clipping\n\n\t\t\tif ( renderingShadows ) {\n\n\t\t\t\t// there's no global clipping\n\n\t\t\t\tprojectPlanes( null );\n\n\t\t\t} else {\n\n\t\t\t\tresetGlobalState();\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst nGlobal = renderingShadows ? 0 : numGlobalPlanes,\n\t\t\t\tlGlobal = nGlobal * 4;\n\n\t\t\tlet dstArray = materialProperties.clippingState || null;\n\n\t\t\tuniform.value = dstArray; // ensure unique state\n\n\t\t\tdstArray = projectPlanes( planes, camera, lGlobal, useCache );\n\n\t\t\tfor ( let i = 0; i !== lGlobal; ++ i ) {\n\n\t\t\t\tdstArray[ i ] = globalState[ i ];\n\n\t\t\t}\n\n\t\t\tmaterialProperties.clippingState = dstArray;\n\t\t\tthis.numIntersection = clipIntersection ? this.numPlanes : 0;\n\t\t\tthis.numPlanes += nGlobal;\n\n\t\t}\n\n\n\t};\n\n\tfunction resetGlobalState() {\n\n\t\tif ( uniform.value !== globalState ) {\n\n\t\t\tuniform.value = globalState;\n\t\t\tuniform.needsUpdate = numGlobalPlanes > 0;\n\n\t\t}\n\n\t\tscope.numPlanes = numGlobalPlanes;\n\t\tscope.numIntersection = 0;\n\n\t}\n\n\tfunction projectPlanes( planes, camera, dstOffset, skipTransform ) {\n\n\t\tconst nPlanes = planes !== null ? planes.length : 0;\n\t\tlet dstArray = null;\n\n\t\tif ( nPlanes !== 0 ) {\n\n\t\t\tdstArray = uniform.value;\n\n\t\t\tif ( skipTransform !== true || dstArray === null ) {\n\n\t\t\t\tconst flatSize = dstOffset + nPlanes * 4,\n\t\t\t\t\tviewMatrix = camera.matrixWorldInverse;\n\n\t\t\t\tviewNormalMatrix.getNormalMatrix( viewMatrix );\n\n\t\t\t\tif ( dstArray === null || dstArray.length < flatSize ) {\n\n\t\t\t\t\tdstArray = new Float32Array( flatSize );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0, i4 = dstOffset; i !== nPlanes; ++ i, i4 += 4 ) {\n\n\t\t\t\t\tplane.copy( planes[ i ] ).applyMatrix4( viewMatrix, viewNormalMatrix );\n\n\t\t\t\t\tplane.normal.toArray( dstArray, i4 );\n\t\t\t\t\tdstArray[ i4 + 3 ] = plane.constant;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tuniform.value = dstArray;\n\t\t\tuniform.needsUpdate = true;\n\n\t\t}\n\n\t\tscope.numPlanes = nPlanes;\n\t\tscope.numIntersection = 0;\n\n\t\treturn dstArray;\n\n\t}\n\n}\n\nfunction WebGLCubeMaps( renderer ) {\n\n\tlet cubemaps = new WeakMap();\n\n\tfunction mapTextureMapping( texture, mapping ) {\n\n\t\tif ( mapping === EquirectangularReflectionMapping ) {\n\n\t\t\ttexture.mapping = CubeReflectionMapping;\n\n\t\t} else if ( mapping === EquirectangularRefractionMapping ) {\n\n\t\t\ttexture.mapping = CubeRefractionMapping;\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction get( texture ) {\n\n\t\tif ( texture && texture.isTexture ) {\n\n\t\t\tconst mapping = texture.mapping;\n\n\t\t\tif ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping ) {\n\n\t\t\t\tif ( cubemaps.has( texture ) ) {\n\n\t\t\t\t\tconst cubemap = cubemaps.get( texture ).texture;\n\t\t\t\t\treturn mapTextureMapping( cubemap, texture.mapping );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconst image = texture.image;\n\n\t\t\t\t\tif ( image && image.height > 0 ) {\n\n\t\t\t\t\t\tconst renderTarget = new WebGLCubeRenderTarget( image.height );\n\t\t\t\t\t\trenderTarget.fromEquirectangularTexture( renderer, texture );\n\t\t\t\t\t\tcubemaps.set( texture, renderTarget );\n\n\t\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t\t\t\t\treturn mapTextureMapping( renderTarget.texture, texture.mapping );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// image not yet ready. try the conversion next frame\n\n\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tconst cubemap = cubemaps.get( texture );\n\n\t\tif ( cubemap !== undefined ) {\n\n\t\t\tcubemaps.delete( texture );\n\t\t\tcubemap.dispose();\n\n\t\t}\n\n\t}\n\n\tfunction dispose() {\n\n\t\tcubemaps = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nclass OrthographicCamera extends Camera {\n\n\tconstructor( left = - 1, right = 1, top = 1, bottom = - 1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\tthis.isOrthographicCamera = true;\n\n\t\tthis.type = 'OrthographicCamera';\n\n\t\tthis.zoom = 1;\n\t\tthis.view = null;\n\n\t\tthis.left = left;\n\t\tthis.right = right;\n\t\tthis.top = top;\n\t\tthis.bottom = bottom;\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.left = source.left;\n\t\tthis.right = source.right;\n\t\tthis.top = source.top;\n\t\tthis.bottom = source.bottom;\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\n\t\tthis.zoom = source.zoom;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\treturn this;\n\n\t}\n\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tupdateProjectionMatrix() {\n\n\t\tconst dx = ( this.right - this.left ) / ( 2 * this.zoom );\n\t\tconst dy = ( this.top - this.bottom ) / ( 2 * this.zoom );\n\t\tconst cx = ( this.right + this.left ) / 2;\n\t\tconst cy = ( this.top + this.bottom ) / 2;\n\n\t\tlet left = cx - dx;\n\t\tlet right = cx + dx;\n\t\tlet top = cy + dy;\n\t\tlet bottom = cy - dy;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst scaleW = ( this.right - this.left ) / this.view.fullWidth / this.zoom;\n\t\t\tconst scaleH = ( this.top - this.bottom ) / this.view.fullHeight / this.zoom;\n\n\t\t\tleft += scaleW * this.view.offsetX;\n\t\t\tright = left + scaleW * this.view.width;\n\t\t\ttop -= scaleH * this.view.offsetY;\n\t\t\tbottom = top - scaleH * this.view.height;\n\n\t\t}\n\n\t\tthis.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far, this.coordinateSystem );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.zoom = this.zoom;\n\t\tdata.object.left = this.left;\n\t\tdata.object.right = this.right;\n\t\tdata.object.top = this.top;\n\t\tdata.object.bottom = this.bottom;\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst LOD_MIN = 4;\n\n// The standard deviations (radians) associated with the extra mips. These are\n// chosen to approximate a Trowbridge-Reitz distribution function times the\n// geometric shadowing function. These sigma values squared must match the\n// variance #defines in cube_uv_reflection_fragment.glsl.js.\nconst EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ];\n\n// The maximum length of the blur for loop. Smaller sigmas will use fewer\n// samples and exit early, but not recompile the shader.\nconst MAX_SAMPLES = 20;\n\nconst _flatCamera = /*@__PURE__*/ new OrthographicCamera();\nconst _clearColor = /*@__PURE__*/ new Color();\nlet _oldTarget = null;\nlet _oldActiveCubeFace = 0;\nlet _oldActiveMipmapLevel = 0;\nlet _oldXrEnabled = false;\n\n// Golden Ratio\nconst PHI = ( 1 + Math.sqrt( 5 ) ) / 2;\nconst INV_PHI = 1 / PHI;\n\n// Vertices of a dodecahedron (except the opposites, which represent the\n// same axis), used as axis directions evenly spread on a sphere.\nconst _axisDirections = [\n\t/*@__PURE__*/ new Vector3( - PHI, INV_PHI, 0 ),\n\t/*@__PURE__*/ new Vector3( PHI, INV_PHI, 0 ),\n\t/*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),\n\t/*@__PURE__*/ new Vector3( - 1, 1, - 1 ),\n\t/*@__PURE__*/ new Vector3( 1, 1, - 1 ),\n\t/*@__PURE__*/ new Vector3( - 1, 1, 1 ),\n\t/*@__PURE__*/ new Vector3( 1, 1, 1 ) ];\n\n/**\n * This class generates a Prefiltered, Mipmapped Radiance Environment Map\n * (PMREM) from a cubeMap environment texture. This allows different levels of\n * blur to be quickly accessed based on material roughness. It is packed into a\n * special CubeUV format that allows us to perform custom interpolation so that\n * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap\n * chain, it only goes down to the LOD_MIN level (above), and then creates extra\n * even more filtered 'mips' at the same LOD_MIN resolution, associated with\n * higher roughness levels. In this way we maintain resolution to smoothly\n * interpolate diffuse lighting while limiting sampling computation.\n *\n * Paper: Fast, Accurate Image-Based Lighting\n * https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view\n*/\n\nclass PMREMGenerator {\n\n\tconstructor( renderer ) {\n\n\t\tthis._renderer = renderer;\n\t\tthis._pingPongRenderTarget = null;\n\n\t\tthis._lodMax = 0;\n\t\tthis._cubeSize = 0;\n\t\tthis._lodPlanes = [];\n\t\tthis._sizeLods = [];\n\t\tthis._sigmas = [];\n\n\t\tthis._blurMaterial = null;\n\t\tthis._cubemapMaterial = null;\n\t\tthis._equirectMaterial = null;\n\n\t\tthis._compileMaterial( this._blurMaterial );\n\n\t}\n\n\t/**\n\t * Generates a PMREM from a supplied Scene, which can be faster than using an\n\t * image if networking bandwidth is low. Optional sigma specifies a blur radius\n\t * in radians to be applied to the scene before PMREM generation. Optional near\n\t * and far planes ensure the scene is rendered in its entirety (the cubeCamera\n\t * is placed at the origin).\n\t */\n\tfromScene( scene, sigma = 0, near = 0.1, far = 100 ) {\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\n\t\t_oldXrEnabled = this._renderer.xr.enabled;\n\n\t\tthis._renderer.xr.enabled = false;\n\n\t\tthis._setSize( 256 );\n\n\t\tconst cubeUVRenderTarget = this._allocateTargets();\n\t\tcubeUVRenderTarget.depthBuffer = true;\n\n\t\tthis._sceneToCubeUV( scene, near, far, cubeUVRenderTarget );\n\n\t\tif ( sigma > 0 ) {\n\n\t\t\tthis._blur( cubeUVRenderTarget, 0, 0, sigma );\n\n\t\t}\n\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an equirectangular texture, which can be either LDR\n\t * or HDR. The ideal input image size is 1k (1024 x 512),\n\t * as this matches best with the 256 x 256 cubemap output.\n\t * The smallest supported equirectangular image size is 64 x 32.\n\t */\n\tfromEquirectangular( equirectangular, renderTarget = null ) {\n\n\t\treturn this._fromTexture( equirectangular, renderTarget );\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an cubemap texture, which can be either LDR\n\t * or HDR. The ideal input cube size is 256 x 256,\n\t * as this matches best with the 256 x 256 cubemap output.\n\t * The smallest supported cube size is 16 x 16.\n\t */\n\tfromCubemap( cubemap, renderTarget = null ) {\n\n\t\treturn this._fromTexture( cubemap, renderTarget );\n\n\t}\n\n\t/**\n\t * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileCubemapShader() {\n\n\t\tif ( this._cubemapMaterial === null ) {\n\n\t\t\tthis._cubemapMaterial = _getCubemapMaterial();\n\t\t\tthis._compileMaterial( this._cubemapMaterial );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileEquirectangularShader() {\n\n\t\tif ( this._equirectMaterial === null ) {\n\n\t\t\tthis._equirectMaterial = _getEquirectMaterial();\n\t\t\tthis._compileMaterial( this._equirectMaterial );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,\n\t * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on\n\t * one of them will cause any others to also become unusable.\n\t */\n\tdispose() {\n\n\t\tthis._dispose();\n\n\t\tif ( this._cubemapMaterial !== null ) this._cubemapMaterial.dispose();\n\t\tif ( this._equirectMaterial !== null ) this._equirectMaterial.dispose();\n\n\t}\n\n\t// private interface\n\n\t_setSize( cubeSize ) {\n\n\t\tthis._lodMax = Math.floor( Math.log2( cubeSize ) );\n\t\tthis._cubeSize = Math.pow( 2, this._lodMax );\n\n\t}\n\n\t_dispose() {\n\n\t\tif ( this._blurMaterial !== null ) this._blurMaterial.dispose();\n\n\t\tif ( this._pingPongRenderTarget !== null ) this._pingPongRenderTarget.dispose();\n\n\t\tfor ( let i = 0; i < this._lodPlanes.length; i ++ ) {\n\n\t\t\tthis._lodPlanes[ i ].dispose();\n\n\t\t}\n\n\t}\n\n\t_cleanup( outputTarget ) {\n\n\t\tthis._renderer.setRenderTarget( _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel );\n\t\tthis._renderer.xr.enabled = _oldXrEnabled;\n\n\t\toutputTarget.scissorTest = false;\n\t\t_setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );\n\n\t}\n\n\t_fromTexture( texture, renderTarget ) {\n\n\t\tif ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping ) {\n\n\t\t\tthis._setSize( texture.image.length === 0 ? 16 : ( texture.image[ 0 ].width || texture.image[ 0 ].image.width ) );\n\n\t\t} else { // Equirectangular\n\n\t\t\tthis._setSize( texture.image.width / 4 );\n\n\t\t}\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\n\t\t_oldXrEnabled = this._renderer.xr.enabled;\n\n\t\tthis._renderer.xr.enabled = false;\n\n\t\tconst cubeUVRenderTarget = renderTarget || this._allocateTargets();\n\t\tthis._textureToCubeUV( texture, cubeUVRenderTarget );\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_allocateTargets() {\n\n\t\tconst width = 3 * Math.max( this._cubeSize, 16 * 7 );\n\t\tconst height = 4 * this._cubeSize;\n\n\t\tconst params = {\n\t\t\tmagFilter: LinearFilter,\n\t\t\tminFilter: LinearFilter,\n\t\t\tgenerateMipmaps: false,\n\t\t\ttype: HalfFloatType,\n\t\t\tformat: RGBAFormat,\n\t\t\tcolorSpace: LinearSRGBColorSpace,\n\t\t\tdepthBuffer: false\n\t\t};\n\n\t\tconst cubeUVRenderTarget = _createRenderTarget( width, height, params );\n\n\t\tif ( this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== width || this._pingPongRenderTarget.height !== height ) {\n\n\t\t\tif ( this._pingPongRenderTarget !== null ) {\n\n\t\t\t\tthis._dispose();\n\n\t\t\t}\n\n\t\t\tthis._pingPongRenderTarget = _createRenderTarget( width, height, params );\n\n\t\t\tconst { _lodMax } = this;\n\t\t\t( { sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = _createPlanes( _lodMax ) );\n\n\t\t\tthis._blurMaterial = _getBlurShader( _lodMax, width, height );\n\n\t\t}\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_compileMaterial( material ) {\n\n\t\tconst tmpMesh = new Mesh( this._lodPlanes[ 0 ], material );\n\t\tthis._renderer.compile( tmpMesh, _flatCamera );\n\n\t}\n\n\t_sceneToCubeUV( scene, near, far, cubeUVRenderTarget ) {\n\n\t\tconst fov = 90;\n\t\tconst aspect = 1;\n\t\tconst cubeCamera = new PerspectiveCamera( fov, aspect, near, far );\n\t\tconst upSign = [ 1, - 1, 1, 1, 1, 1 ];\n\t\tconst forwardSign = [ 1, 1, 1, - 1, - 1, - 1 ];\n\t\tconst renderer = this._renderer;\n\n\t\tconst originalAutoClear = renderer.autoClear;\n\t\tconst toneMapping = renderer.toneMapping;\n\t\trenderer.getClearColor( _clearColor );\n\n\t\trenderer.toneMapping = NoToneMapping;\n\t\trenderer.autoClear = false;\n\n\t\tconst backgroundMaterial = new MeshBasicMaterial( {\n\t\t\tname: 'PMREM.Background',\n\t\t\tside: BackSide,\n\t\t\tdepthWrite: false,\n\t\t\tdepthTest: false,\n\t\t} );\n\n\t\tconst backgroundBox = new Mesh( new BoxGeometry(), backgroundMaterial );\n\n\t\tlet useSolidColor = false;\n\t\tconst background = scene.background;\n\n\t\tif ( background ) {\n\n\t\t\tif ( background.isColor ) {\n\n\t\t\t\tbackgroundMaterial.color.copy( background );\n\t\t\t\tscene.background = null;\n\t\t\t\tuseSolidColor = true;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tbackgroundMaterial.color.copy( _clearColor );\n\t\t\tuseSolidColor = true;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst col = i % 3;\n\n\t\t\tif ( col === 0 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.lookAt( forwardSign[ i ], 0, 0 );\n\n\t\t\t} else if ( col === 1 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, 0, upSign[ i ] );\n\t\t\t\tcubeCamera.lookAt( 0, forwardSign[ i ], 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.lookAt( 0, 0, forwardSign[ i ] );\n\n\t\t\t}\n\n\t\t\tconst size = this._cubeSize;\n\n\t\t\t_setViewport( cubeUVRenderTarget, col * size, i > 2 ? size : 0, size, size );\n\n\t\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\n\t\t\tif ( useSolidColor ) {\n\n\t\t\t\trenderer.render( backgroundBox, cubeCamera );\n\n\t\t\t}\n\n\t\t\trenderer.render( scene, cubeCamera );\n\n\t\t}\n\n\t\tbackgroundBox.geometry.dispose();\n\t\tbackgroundBox.material.dispose();\n\n\t\trenderer.toneMapping = toneMapping;\n\t\trenderer.autoClear = originalAutoClear;\n\t\tscene.background = background;\n\n\t}\n\n\t_textureToCubeUV( texture, cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst isCubeTexture = ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping );\n\n\t\tif ( isCubeTexture ) {\n\n\t\t\tif ( this._cubemapMaterial === null ) {\n\n\t\t\t\tthis._cubemapMaterial = _getCubemapMaterial();\n\n\t\t\t}\n\n\t\t\tthis._cubemapMaterial.uniforms.flipEnvMap.value = ( texture.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t} else {\n\n\t\t\tif ( this._equirectMaterial === null ) {\n\n\t\t\t\tthis._equirectMaterial = _getEquirectMaterial();\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial;\n\t\tconst mesh = new Mesh( this._lodPlanes[ 0 ], material );\n\n\t\tconst uniforms = material.uniforms;\n\n\t\tuniforms[ 'envMap' ].value = texture;\n\n\t\tconst size = this._cubeSize;\n\n\t\t_setViewport( cubeUVRenderTarget, 0, 0, 3 * size, 2 * size );\n\n\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\t\trenderer.render( mesh, _flatCamera );\n\n\t}\n\n\t_applyPMREM( cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst autoClear = renderer.autoClear;\n\t\trenderer.autoClear = false;\n\t\tconst n = this._lodPlanes.length;\n\n\t\tfor ( let i = 1; i < n; i ++ ) {\n\n\t\t\tconst sigma = Math.sqrt( this._sigmas[ i ] * this._sigmas[ i ] - this._sigmas[ i - 1 ] * this._sigmas[ i - 1 ] );\n\n\t\t\tconst poleAxis = _axisDirections[ ( n - i - 1 ) % _axisDirections.length ];\n\n\t\t\tthis._blur( cubeUVRenderTarget, i - 1, i, sigma, poleAxis );\n\n\t\t}\n\n\t\trenderer.autoClear = autoClear;\n\n\t}\n\n\t/**\n\t * This is a two-pass Gaussian blur for a cubemap. Normally this is done\n\t * vertically and horizontally, but this breaks down on a cube. Here we apply\n\t * the blur latitudinally (around the poles), and then longitudinally (towards\n\t * the poles) to approximate the orthogonally-separable blur. It is least\n\t * accurate at the poles, but still does a decent job.\n\t */\n\t_blur( cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis ) {\n\n\t\tconst pingPongRenderTarget = this._pingPongRenderTarget;\n\n\t\tthis._halfBlur(\n\t\t\tcubeUVRenderTarget,\n\t\t\tpingPongRenderTarget,\n\t\t\tlodIn,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'latitudinal',\n\t\t\tpoleAxis );\n\n\t\tthis._halfBlur(\n\t\t\tpingPongRenderTarget,\n\t\t\tcubeUVRenderTarget,\n\t\t\tlodOut,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'longitudinal',\n\t\t\tpoleAxis );\n\n\t}\n\n\t_halfBlur( targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst blurMaterial = this._blurMaterial;\n\n\t\tif ( direction !== 'latitudinal' && direction !== 'longitudinal' ) {\n\n\t\t\tconsole.error(\n\t\t\t\t'blur direction must be either latitudinal or longitudinal!' );\n\n\t\t}\n\n\t\t// Number of standard deviations at which to cut off the discrete approximation.\n\t\tconst STANDARD_DEVIATIONS = 3;\n\n\t\tconst blurMesh = new Mesh( this._lodPlanes[ lodOut ], blurMaterial );\n\t\tconst blurUniforms = blurMaterial.uniforms;\n\n\t\tconst pixels = this._sizeLods[ lodIn ] - 1;\n\t\tconst radiansPerPixel = isFinite( sigmaRadians ) ? Math.PI / ( 2 * pixels ) : 2 * Math.PI / ( 2 * MAX_SAMPLES - 1 );\n\t\tconst sigmaPixels = sigmaRadians / radiansPerPixel;\n\t\tconst samples = isFinite( sigmaRadians ) ? 1 + Math.floor( STANDARD_DEVIATIONS * sigmaPixels ) : MAX_SAMPLES;\n\n\t\tif ( samples > MAX_SAMPLES ) {\n\n\t\t\tconsole.warn( `sigmaRadians, ${\n\t\t\t\tsigmaRadians}, is too large and will clip, as it requested ${\n\t\t\t\tsamples} samples when the maximum is set to ${MAX_SAMPLES}` );\n\n\t\t}\n\n\t\tconst weights = [];\n\t\tlet sum = 0;\n\n\t\tfor ( let i = 0; i < MAX_SAMPLES; ++ i ) {\n\n\t\t\tconst x = i / sigmaPixels;\n\t\t\tconst weight = Math.exp( - x * x / 2 );\n\t\t\tweights.push( weight );\n\n\t\t\tif ( i === 0 ) {\n\n\t\t\t\tsum += weight;\n\n\t\t\t} else if ( i < samples ) {\n\n\t\t\t\tsum += 2 * weight;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < weights.length; i ++ ) {\n\n\t\t\tweights[ i ] = weights[ i ] / sum;\n\n\t\t}\n\n\t\tblurUniforms[ 'envMap' ].value = targetIn.texture;\n\t\tblurUniforms[ 'samples' ].value = samples;\n\t\tblurUniforms[ 'weights' ].value = weights;\n\t\tblurUniforms[ 'latitudinal' ].value = direction === 'latitudinal';\n\n\t\tif ( poleAxis ) {\n\n\t\t\tblurUniforms[ 'poleAxis' ].value = poleAxis;\n\n\t\t}\n\n\t\tconst { _lodMax } = this;\n\t\tblurUniforms[ 'dTheta' ].value = radiansPerPixel;\n\t\tblurUniforms[ 'mipInt' ].value = _lodMax - lodIn;\n\n\t\tconst outputSize = this._sizeLods[ lodOut ];\n\t\tconst x = 3 * outputSize * ( lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0 );\n\t\tconst y = 4 * ( this._cubeSize - outputSize );\n\n\t\t_setViewport( targetOut, x, y, 3 * outputSize, 2 * outputSize );\n\t\trenderer.setRenderTarget( targetOut );\n\t\trenderer.render( blurMesh, _flatCamera );\n\n\t}\n\n}\n\n\n\nfunction _createPlanes( lodMax ) {\n\n\tconst lodPlanes = [];\n\tconst sizeLods = [];\n\tconst sigmas = [];\n\n\tlet lod = lodMax;\n\n\tconst totalLods = lodMax - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;\n\n\tfor ( let i = 0; i < totalLods; i ++ ) {\n\n\t\tconst sizeLod = Math.pow( 2, lod );\n\t\tsizeLods.push( sizeLod );\n\t\tlet sigma = 1.0 / sizeLod;\n\n\t\tif ( i > lodMax - LOD_MIN ) {\n\n\t\t\tsigma = EXTRA_LOD_SIGMA[ i - lodMax + LOD_MIN - 1 ];\n\n\t\t} else if ( i === 0 ) {\n\n\t\t\tsigma = 0;\n\n\t\t}\n\n\t\tsigmas.push( sigma );\n\n\t\tconst texelSize = 1.0 / ( sizeLod - 2 );\n\t\tconst min = - texelSize;\n\t\tconst max = 1 + texelSize;\n\t\tconst uv1 = [ min, min, max, min, max, max, min, min, max, max, min, max ];\n\n\t\tconst cubeFaces = 6;\n\t\tconst vertices = 6;\n\t\tconst positionSize = 3;\n\t\tconst uvSize = 2;\n\t\tconst faceIndexSize = 1;\n\n\t\tconst position = new Float32Array( positionSize * vertices * cubeFaces );\n\t\tconst uv = new Float32Array( uvSize * vertices * cubeFaces );\n\t\tconst faceIndex = new Float32Array( faceIndexSize * vertices * cubeFaces );\n\n\t\tfor ( let face = 0; face < cubeFaces; face ++ ) {\n\n\t\t\tconst x = ( face % 3 ) * 2 / 3 - 1;\n\t\t\tconst y = face > 2 ? 0 : - 1;\n\t\t\tconst coordinates = [\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y + 1, 0\n\t\t\t];\n\t\t\tposition.set( coordinates, positionSize * vertices * face );\n\t\t\tuv.set( uv1, uvSize * vertices * face );\n\t\t\tconst fill = [ face, face, face, face, face, face ];\n\t\t\tfaceIndex.set( fill, faceIndexSize * vertices * face );\n\n\t\t}\n\n\t\tconst planes = new BufferGeometry();\n\t\tplanes.setAttribute( 'position', new BufferAttribute( position, positionSize ) );\n\t\tplanes.setAttribute( 'uv', new BufferAttribute( uv, uvSize ) );\n\t\tplanes.setAttribute( 'faceIndex', new BufferAttribute( faceIndex, faceIndexSize ) );\n\t\tlodPlanes.push( planes );\n\n\t\tif ( lod > LOD_MIN ) {\n\n\t\t\tlod --;\n\n\t\t}\n\n\t}\n\n\treturn { lodPlanes, sizeLods, sigmas };\n\n}\n\nfunction _createRenderTarget( width, height, params ) {\n\n\tconst cubeUVRenderTarget = new WebGLRenderTarget( width, height, params );\n\tcubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping;\n\tcubeUVRenderTarget.texture.name = 'PMREM.cubeUv';\n\tcubeUVRenderTarget.scissorTest = true;\n\treturn cubeUVRenderTarget;\n\n}\n\nfunction _setViewport( target, x, y, width, height ) {\n\n\ttarget.viewport.set( x, y, width, height );\n\ttarget.scissor.set( x, y, width, height );\n\n}\n\nfunction _getBlurShader( lodMax, width, height ) {\n\n\tconst weights = new Float32Array( MAX_SAMPLES );\n\tconst poleAxis = new Vector3( 0, 1, 0 );\n\tconst shaderMaterial = new ShaderMaterial( {\n\n\t\tname: 'SphericalGaussianBlur',\n\n\t\tdefines: {\n\t\t\t'n': MAX_SAMPLES,\n\t\t\t'CUBEUV_TEXEL_WIDTH': 1.0 / width,\n\t\t\t'CUBEUV_TEXEL_HEIGHT': 1.0 / height,\n\t\t\t'CUBEUV_MAX_MIP': `${lodMax}.0`,\n\t\t},\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'samples': { value: 1 },\n\t\t\t'weights': { value: weights },\n\t\t\t'latitudinal': { value: false },\n\t\t\t'dTheta': { value: 0 },\n\t\t\t'mipInt': { value: 0 },\n\t\t\t'poleAxis': { value: poleAxis }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n\treturn shaderMaterial;\n\n}\n\nfunction _getEquirectMaterial() {\n\n\treturn new ShaderMaterial( {\n\n\t\tname: 'EquirectangularToCubeUV',\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n}\n\nfunction _getCubemapMaterial() {\n\n\treturn new ShaderMaterial( {\n\n\t\tname: 'CubemapToCubeUV',\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'flipEnvMap': { value: - 1 }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n}\n\nfunction _getCommonVertexShader() {\n\n\treturn /* glsl */`\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t`;\n\n}\n\nfunction WebGLCubeUVMaps( renderer ) {\n\n\tlet cubeUVmaps = new WeakMap();\n\n\tlet pmremGenerator = null;\n\n\tfunction get( texture ) {\n\n\t\tif ( texture && texture.isTexture ) {\n\n\t\t\tconst mapping = texture.mapping;\n\n\t\t\tconst isEquirectMap = ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping );\n\t\t\tconst isCubeMap = ( mapping === CubeReflectionMapping || mapping === CubeRefractionMapping );\n\n\t\t\t// equirect/cube map to cubeUV conversion\n\n\t\t\tif ( isEquirectMap || isCubeMap ) {\n\n\t\t\t\tlet renderTarget = cubeUVmaps.get( texture );\n\n\t\t\t\tconst currentPMREMVersion = renderTarget !== undefined ? renderTarget.texture.pmremVersion : 0;\n\n\t\t\t\tif ( texture.isRenderTargetTexture && texture.pmremVersion !== currentPMREMVersion ) {\n\n\t\t\t\t\tif ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );\n\n\t\t\t\t\trenderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture, renderTarget ) : pmremGenerator.fromCubemap( texture, renderTarget );\n\t\t\t\t\trenderTarget.texture.pmremVersion = texture.pmremVersion;\n\n\t\t\t\t\tcubeUVmaps.set( texture, renderTarget );\n\n\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( renderTarget !== undefined ) {\n\n\t\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst image = texture.image;\n\n\t\t\t\t\t\tif ( ( isEquirectMap && image && image.height > 0 ) || ( isCubeMap && image && isCubeTextureComplete( image ) ) ) {\n\n\t\t\t\t\t\t\tif ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );\n\n\t\t\t\t\t\t\trenderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );\n\t\t\t\t\t\t\trenderTarget.texture.pmremVersion = texture.pmremVersion;\n\n\t\t\t\t\t\t\tcubeUVmaps.set( texture, renderTarget );\n\n\t\t\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// image not yet ready. try the conversion next frame\n\n\t\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction isCubeTextureComplete( image ) {\n\n\t\tlet count = 0;\n\t\tconst length = 6;\n\n\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\tif ( image[ i ] !== undefined ) count ++;\n\n\t\t}\n\n\t\treturn count === length;\n\n\n\t}\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tconst cubemapUV = cubeUVmaps.get( texture );\n\n\t\tif ( cubemapUV !== undefined ) {\n\n\t\t\tcubeUVmaps.delete( texture );\n\t\t\tcubemapUV.dispose();\n\n\t\t}\n\n\t}\n\n\tfunction dispose() {\n\n\t\tcubeUVmaps = new WeakMap();\n\n\t\tif ( pmremGenerator !== null ) {\n\n\t\t\tpmremGenerator.dispose();\n\t\t\tpmremGenerator = null;\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction WebGLExtensions( gl ) {\n\n\tconst extensions = {};\n\n\tfunction getExtension( name ) {\n\n\t\tif ( extensions[ name ] !== undefined ) {\n\n\t\t\treturn extensions[ name ];\n\n\t\t}\n\n\t\tlet extension;\n\n\t\tswitch ( name ) {\n\n\t\t\tcase 'WEBGL_depth_texture':\n\t\t\t\textension = gl.getExtension( 'WEBGL_depth_texture' ) || gl.getExtension( 'MOZ_WEBGL_depth_texture' ) || gl.getExtension( 'WEBKIT_WEBGL_depth_texture' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'EXT_texture_filter_anisotropic':\n\t\t\t\textension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'WEBGL_compressed_texture_s3tc':\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'WEBGL_compressed_texture_pvrtc':\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\textension = gl.getExtension( name );\n\n\t\t}\n\n\t\textensions[ name ] = extension;\n\n\t\treturn extension;\n\n\t}\n\n\treturn {\n\n\t\thas: function ( name ) {\n\n\t\t\treturn getExtension( name ) !== null;\n\n\t\t},\n\n\t\tinit: function () {\n\n\t\t\tgetExtension( 'EXT_color_buffer_float' );\n\t\t\tgetExtension( 'WEBGL_clip_cull_distance' );\n\t\t\tgetExtension( 'OES_texture_float_linear' );\n\t\t\tgetExtension( 'EXT_color_buffer_half_float' );\n\t\t\tgetExtension( 'WEBGL_multisampled_render_to_texture' );\n\t\t\tgetExtension( 'WEBGL_render_shared_exponent' );\n\n\t\t},\n\n\t\tget: function ( name ) {\n\n\t\t\tconst extension = getExtension( name );\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\twarnOnce( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' );\n\n\t\t\t}\n\n\t\t\treturn extension;\n\n\t\t}\n\n\t};\n\n}\n\nfunction WebGLGeometries( gl, attributes, info, bindingStates ) {\n\n\tconst geometries = {};\n\tconst wireframeAttributes = new WeakMap();\n\n\tfunction onGeometryDispose( event ) {\n\n\t\tconst geometry = event.target;\n\n\t\tif ( geometry.index !== null ) {\n\n\t\t\tattributes.remove( geometry.index );\n\n\t\t}\n\n\t\tfor ( const name in geometry.attributes ) {\n\n\t\t\tattributes.remove( geometry.attributes[ name ] );\n\n\t\t}\n\n\t\tfor ( const name in geometry.morphAttributes ) {\n\n\t\t\tconst array = geometry.morphAttributes[ name ];\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tattributes.remove( array[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.removeEventListener( 'dispose', onGeometryDispose );\n\n\t\tdelete geometries[ geometry.id ];\n\n\t\tconst attribute = wireframeAttributes.get( geometry );\n\n\t\tif ( attribute ) {\n\n\t\t\tattributes.remove( attribute );\n\t\t\twireframeAttributes.delete( geometry );\n\n\t\t}\n\n\t\tbindingStates.releaseStatesOfGeometry( geometry );\n\n\t\tif ( geometry.isInstancedBufferGeometry === true ) {\n\n\t\t\tdelete geometry._maxInstanceCount;\n\n\t\t}\n\n\t\t//\n\n\t\tinfo.memory.geometries --;\n\n\t}\n\n\tfunction get( object, geometry ) {\n\n\t\tif ( geometries[ geometry.id ] === true ) return geometry;\n\n\t\tgeometry.addEventListener( 'dispose', onGeometryDispose );\n\n\t\tgeometries[ geometry.id ] = true;\n\n\t\tinfo.memory.geometries ++;\n\n\t\treturn geometry;\n\n\t}\n\n\tfunction update( geometry ) {\n\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates.\n\n\t\tfor ( const name in geometryAttributes ) {\n\n\t\t\tattributes.update( geometryAttributes[ name ], gl.ARRAY_BUFFER );\n\n\t\t}\n\n\t\t// morph targets\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst array = morphAttributes[ name ];\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tattributes.update( array[ i ], gl.ARRAY_BUFFER );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction updateWireframeAttribute( geometry ) {\n\n\t\tconst indices = [];\n\n\t\tconst geometryIndex = geometry.index;\n\t\tconst geometryPosition = geometry.attributes.position;\n\t\tlet version = 0;\n\n\t\tif ( geometryIndex !== null ) {\n\n\t\t\tconst array = geometryIndex.array;\n\t\t\tversion = geometryIndex.version;\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i += 3 ) {\n\n\t\t\t\tconst a = array[ i + 0 ];\n\t\t\t\tconst b = array[ i + 1 ];\n\t\t\t\tconst c = array[ i + 2 ];\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t} else if ( geometryPosition !== undefined ) {\n\n\t\t\tconst array = geometryPosition.array;\n\t\t\tversion = geometryPosition.version;\n\n\t\t\tfor ( let i = 0, l = ( array.length / 3 ) - 1; i < l; i += 3 ) {\n\n\t\t\t\tconst a = i + 0;\n\t\t\t\tconst b = i + 1;\n\t\t\t\tconst c = i + 2;\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst attribute = new ( arrayNeedsUint32( indices ) ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );\n\t\tattribute.version = version;\n\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates\n\n\t\t//\n\n\t\tconst previousAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( previousAttribute ) attributes.remove( previousAttribute );\n\n\t\t//\n\n\t\twireframeAttributes.set( geometry, attribute );\n\n\t}\n\n\tfunction getWireframeAttribute( geometry ) {\n\n\t\tconst currentAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( currentAttribute ) {\n\n\t\t\tconst geometryIndex = geometry.index;\n\n\t\t\tif ( geometryIndex !== null ) {\n\n\t\t\t\t// if the attribute is obsolete, create a new one\n\n\t\t\t\tif ( currentAttribute.version < geometryIndex.version ) {\n\n\t\t\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t}\n\n\t\treturn wireframeAttributes.get( geometry );\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tupdate: update,\n\n\t\tgetWireframeAttribute: getWireframeAttribute\n\n\t};\n\n}\n\nfunction WebGLIndexedBufferRenderer( gl, extensions, info ) {\n\n\tlet mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tlet type, bytesPerElement;\n\n\tfunction setIndex( value ) {\n\n\t\ttype = value.type;\n\t\tbytesPerElement = value.bytesPerElement;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawElements( mode, count, type, start * bytesPerElement );\n\n\t\tinfo.update( count, mode, 1 );\n\n\t}\n\n\tfunction renderInstances( start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tgl.drawElementsInstanced( mode, count, type, start * bytesPerElement, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\tfunction renderMultiDraw( starts, counts, drawCount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\t\textension.multiDrawElementsWEBGL( mode, counts, 0, type, starts, 0, drawCount );\n\n\t\tlet elementCount = 0;\n\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\telementCount += counts[ i ];\n\n\t\t}\n\n\t\tinfo.update( elementCount, mode, 1 );\n\n\n\t}\n\n\tfunction renderMultiDrawInstances( starts, counts, drawCount, primcount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\n\t\tif ( extension === null ) {\n\n\t\t\tfor ( let i = 0; i < starts.length; i ++ ) {\n\n\t\t\t\trenderInstances( starts[ i ] / bytesPerElement, counts[ i ], primcount[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\textension.multiDrawElementsInstancedWEBGL( mode, counts, 0, type, starts, 0, primcount, 0, drawCount );\n\n\t\t\tlet elementCount = 0;\n\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\telementCount += counts[ i ];\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0; i < primcount.length; i ++ ) {\n\n\t\t\t\tinfo.update( elementCount, mode, primcount[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.setIndex = setIndex;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\tthis.renderMultiDraw = renderMultiDraw;\n\tthis.renderMultiDrawInstances = renderMultiDrawInstances;\n\n}\n\nfunction WebGLInfo( gl ) {\n\n\tconst memory = {\n\t\tgeometries: 0,\n\t\ttextures: 0\n\t};\n\n\tconst render = {\n\t\tframe: 0,\n\t\tcalls: 0,\n\t\ttriangles: 0,\n\t\tpoints: 0,\n\t\tlines: 0\n\t};\n\n\tfunction update( count, mode, instanceCount ) {\n\n\t\trender.calls ++;\n\n\t\tswitch ( mode ) {\n\n\t\t\tcase gl.TRIANGLES:\n\t\t\t\trender.triangles += instanceCount * ( count / 3 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINES:\n\t\t\t\trender.lines += instanceCount * ( count / 2 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINE_STRIP:\n\t\t\t\trender.lines += instanceCount * ( count - 1 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINE_LOOP:\n\t\t\t\trender.lines += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tcase gl.POINTS:\n\t\t\t\trender.points += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tconsole.error( 'THREE.WebGLInfo: Unknown draw mode:', mode );\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\tfunction reset() {\n\n\t\trender.calls = 0;\n\t\trender.triangles = 0;\n\t\trender.points = 0;\n\t\trender.lines = 0;\n\n\t}\n\n\treturn {\n\t\tmemory: memory,\n\t\trender: render,\n\t\tprograms: null,\n\t\tautoReset: true,\n\t\treset: reset,\n\t\tupdate: update\n\t};\n\n}\n\nfunction WebGLMorphtargets( gl, capabilities, textures ) {\n\n\tconst morphTextures = new WeakMap();\n\tconst morph = new Vector4();\n\n\tfunction update( object, geometry, program ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\t// the following encodes morph targets into an array of data textures. Each layer represents a single morph target.\n\n\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\tlet entry = morphTextures.get( geometry );\n\n\t\tif ( entry === undefined || entry.count !== morphTargetsCount ) {\n\n\t\t\tif ( entry !== undefined ) entry.texture.dispose();\n\n\t\t\tconst hasMorphPosition = geometry.morphAttributes.position !== undefined;\n\t\t\tconst hasMorphNormals = geometry.morphAttributes.normal !== undefined;\n\t\t\tconst hasMorphColors = geometry.morphAttributes.color !== undefined;\n\n\t\t\tconst morphTargets = geometry.morphAttributes.position || [];\n\t\t\tconst morphNormals = geometry.morphAttributes.normal || [];\n\t\t\tconst morphColors = geometry.morphAttributes.color || [];\n\n\t\t\tlet vertexDataCount = 0;\n\n\t\t\tif ( hasMorphPosition === true ) vertexDataCount = 1;\n\t\t\tif ( hasMorphNormals === true ) vertexDataCount = 2;\n\t\t\tif ( hasMorphColors === true ) vertexDataCount = 3;\n\n\t\t\tlet width = geometry.attributes.position.count * vertexDataCount;\n\t\t\tlet height = 1;\n\n\t\t\tif ( width > capabilities.maxTextureSize ) {\n\n\t\t\t\theight = Math.ceil( width / capabilities.maxTextureSize );\n\t\t\t\twidth = capabilities.maxTextureSize;\n\n\t\t\t}\n\n\t\t\tconst buffer = new Float32Array( width * height * 4 * morphTargetsCount );\n\n\t\t\tconst texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );\n\t\t\ttexture.type = FloatType;\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\t// fill buffer\n\n\t\t\tconst vertexDataStride = vertexDataCount * 4;\n\n\t\t\tfor ( let i = 0; i < morphTargetsCount; i ++ ) {\n\n\t\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\t\tconst morphNormal = morphNormals[ i ];\n\t\t\t\tconst morphColor = morphColors[ i ];\n\n\t\t\t\tconst offset = width * height * 4 * i;\n\n\t\t\t\tfor ( let j = 0; j < morphTarget.count; j ++ ) {\n\n\t\t\t\t\tconst stride = j * vertexDataStride;\n\n\t\t\t\t\tif ( hasMorphPosition === true ) {\n\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphTarget, j );\n\n\t\t\t\t\t\tbuffer[ offset + stride + 0 ] = morph.x;\n\t\t\t\t\t\tbuffer[ offset + stride + 1 ] = morph.y;\n\t\t\t\t\t\tbuffer[ offset + stride + 2 ] = morph.z;\n\t\t\t\t\t\tbuffer[ offset + stride + 3 ] = 0;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hasMorphNormals === true ) {\n\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphNormal, j );\n\n\t\t\t\t\t\tbuffer[ offset + stride + 4 ] = morph.x;\n\t\t\t\t\t\tbuffer[ offset + stride + 5 ] = morph.y;\n\t\t\t\t\t\tbuffer[ offset + stride + 6 ] = morph.z;\n\t\t\t\t\t\tbuffer[ offset + stride + 7 ] = 0;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hasMorphColors === true ) {\n\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphColor, j );\n\n\t\t\t\t\t\tbuffer[ offset + stride + 8 ] = morph.x;\n\t\t\t\t\t\tbuffer[ offset + stride + 9 ] = morph.y;\n\t\t\t\t\t\tbuffer[ offset + stride + 10 ] = morph.z;\n\t\t\t\t\t\tbuffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tentry = {\n\t\t\t\tcount: morphTargetsCount,\n\t\t\t\ttexture: texture,\n\t\t\t\tsize: new Vector2( width, height )\n\t\t\t};\n\n\t\t\tmorphTextures.set( geometry, entry );\n\n\t\t\tfunction disposeTexture() {\n\n\t\t\t\ttexture.dispose();\n\n\t\t\t\tmorphTextures.delete( geometry );\n\n\t\t\t\tgeometry.removeEventListener( 'dispose', disposeTexture );\n\n\t\t\t}\n\n\t\t\tgeometry.addEventListener( 'dispose', disposeTexture );\n\n\t\t}\n\n\t\t//\n\t\tif ( object.isInstancedMesh === true && object.morphTexture !== null ) {\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTexture', object.morphTexture, textures );\n\n\t\t} else {\n\n\t\t\tlet morphInfluencesSum = 0;\n\n\t\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\t\tmorphInfluencesSum += objectInfluences[ i ];\n\n\t\t\t}\n\n\t\t\tconst morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );\n\n\t\t}\n\n\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );\n\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );\n\n\t}\n\n\treturn {\n\n\t\tupdate: update\n\n\t};\n\n}\n\nfunction WebGLObjects( gl, geometries, attributes, info ) {\n\n\tlet updateMap = new WeakMap();\n\n\tfunction update( object ) {\n\n\t\tconst frame = info.render.frame;\n\n\t\tconst geometry = object.geometry;\n\t\tconst buffergeometry = geometries.get( object, geometry );\n\n\t\t// Update once per frame\n\n\t\tif ( updateMap.get( buffergeometry ) !== frame ) {\n\n\t\t\tgeometries.update( buffergeometry );\n\n\t\t\tupdateMap.set( buffergeometry, frame );\n\n\t\t}\n\n\t\tif ( object.isInstancedMesh ) {\n\n\t\t\tif ( object.hasEventListener( 'dispose', onInstancedMeshDispose ) === false ) {\n\n\t\t\t\tobject.addEventListener( 'dispose', onInstancedMeshDispose );\n\n\t\t\t}\n\n\t\t\tif ( updateMap.get( object ) !== frame ) {\n\n\t\t\t\tattributes.update( object.instanceMatrix, gl.ARRAY_BUFFER );\n\n\t\t\t\tif ( object.instanceColor !== null ) {\n\n\t\t\t\t\tattributes.update( object.instanceColor, gl.ARRAY_BUFFER );\n\n\t\t\t\t}\n\n\t\t\t\tupdateMap.set( object, frame );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\tconst skeleton = object.skeleton;\n\n\t\t\tif ( updateMap.get( skeleton ) !== frame ) {\n\n\t\t\t\tskeleton.update();\n\n\t\t\t\tupdateMap.set( skeleton, frame );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn buffergeometry;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tupdateMap = new WeakMap();\n\n\t}\n\n\tfunction onInstancedMeshDispose( event ) {\n\n\t\tconst instancedMesh = event.target;\n\n\t\tinstancedMesh.removeEventListener( 'dispose', onInstancedMeshDispose );\n\n\t\tattributes.remove( instancedMesh.instanceMatrix );\n\n\t\tif ( instancedMesh.instanceColor !== null ) attributes.remove( instancedMesh.instanceColor );\n\n\t}\n\n\treturn {\n\n\t\tupdate: update,\n\t\tdispose: dispose\n\n\t};\n\n}\n\nclass DepthTexture extends Texture {\n\n\tconstructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format = DepthFormat ) {\n\n\t\tif ( format !== DepthFormat && format !== DepthStencilFormat ) {\n\n\t\t\tthrow new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );\n\n\t\t}\n\n\t\tif ( type === undefined && format === DepthFormat ) type = UnsignedIntType;\n\t\tif ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isDepthTexture = true;\n\n\t\tthis.image = { width: width, height: height };\n\n\t\tthis.magFilter = magFilter !== undefined ? magFilter : NearestFilter;\n\t\tthis.minFilter = minFilter !== undefined ? minFilter : NearestFilter;\n\n\t\tthis.flipY = false;\n\t\tthis.generateMipmaps = false;\n\n\t\tthis.compareFunction = null;\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.compareFunction = source.compareFunction;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.compareFunction !== null ) data.compareFunction = this.compareFunction;\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * Uniforms of a program.\n * Those form a tree structure with a special top-level container for the root,\n * which you get by calling 'new WebGLUniforms( gl, program )'.\n *\n *\n * Properties of inner nodes including the top-level container:\n *\n * .seq - array of nested uniforms\n * .map - nested uniforms by name\n *\n *\n * Methods of all nodes except the top-level container:\n *\n * .setValue( gl, value, [textures] )\n *\n * \t\tuploads a uniform value(s)\n * \tthe 'textures' parameter is needed for sampler uniforms\n *\n *\n * Static methods of the top-level container (textures factorizations):\n *\n * .upload( gl, seq, values, textures )\n *\n * \t\tsets uniforms in 'seq' to 'values[id].value'\n *\n * .seqWithValue( seq, values ) : filteredSeq\n *\n * \t\tfilters 'seq' entries with corresponding entry in values\n *\n *\n * Methods of the top-level container (textures factorizations):\n *\n * .setValue( gl, name, value, textures )\n *\n * \t\tsets uniform with name 'name' to 'value'\n *\n * .setOptional( gl, obj, prop )\n *\n * \t\tlike .set for an optional property of the object\n *\n */\n\n\nconst emptyTexture = /*@__PURE__*/ new Texture();\n\nconst emptyShadowTexture = /*@__PURE__*/ new DepthTexture( 1, 1 );\n\nconst emptyArrayTexture = /*@__PURE__*/ new DataArrayTexture();\nconst empty3dTexture = /*@__PURE__*/ new Data3DTexture();\nconst emptyCubeTexture = /*@__PURE__*/ new CubeTexture();\n\n// --- Utilities ---\n\n// Array Caches (provide typed arrays for temporary by size)\n\nconst arrayCacheF32 = [];\nconst arrayCacheI32 = [];\n\n// Float32Array caches used for uploading Matrix uniforms\n\nconst mat4array = new Float32Array( 16 );\nconst mat3array = new Float32Array( 9 );\nconst mat2array = new Float32Array( 4 );\n\n// Flattening for arrays of vectors and matrices\n\nfunction flatten( array, nBlocks, blockSize ) {\n\n\tconst firstElem = array[ 0 ];\n\n\tif ( firstElem <= 0 || firstElem > 0 ) return array;\n\t// unoptimized: ! isNaN( firstElem )\n\t// see http://jacksondunstan.com/articles/983\n\n\tconst n = nBlocks * blockSize;\n\tlet r = arrayCacheF32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Float32Array( n );\n\t\tarrayCacheF32[ n ] = r;\n\n\t}\n\n\tif ( nBlocks !== 0 ) {\n\n\t\tfirstElem.toArray( r, 0 );\n\n\t\tfor ( let i = 1, offset = 0; i !== nBlocks; ++ i ) {\n\n\t\t\toffset += blockSize;\n\t\t\tarray[ i ].toArray( r, offset );\n\n\t\t}\n\n\t}\n\n\treturn r;\n\n}\n\nfunction arraysEqual( a, b ) {\n\n\tif ( a.length !== b.length ) return false;\n\n\tfor ( let i = 0, l = a.length; i < l; i ++ ) {\n\n\t\tif ( a[ i ] !== b[ i ] ) return false;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction copyArray( a, b ) {\n\n\tfor ( let i = 0, l = b.length; i < l; i ++ ) {\n\n\t\ta[ i ] = b[ i ];\n\n\t}\n\n}\n\n// Texture unit allocation\n\nfunction allocTexUnits( textures, n ) {\n\n\tlet r = arrayCacheI32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Int32Array( n );\n\t\tarrayCacheI32[ n ] = r;\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\tr[ i ] = textures.allocateTextureUnit();\n\n\t}\n\n\treturn r;\n\n}\n\n// --- Setters ---\n\n// Note: Defining these methods externally, because they come in a bunch\n// and this way their names minify.\n\n// Single scalar\n\nfunction setValueV1f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1f( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single float vector (from flat array or THREE.VectorN)\n\nfunction setValueV2f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2f( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3f( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else if ( v.r !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.r || cache[ 1 ] !== v.g || cache[ 2 ] !== v.b ) {\n\n\t\t\tgl.uniform3f( this.addr, v.r, v.g, v.b );\n\n\t\t\tcache[ 0 ] = v.r;\n\t\t\tcache[ 1 ] = v.g;\n\t\t\tcache[ 2 ] = v.b;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4f( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n// Single matrix (from flat array or THREE.MatrixN)\n\nfunction setValueM2( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix2fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat2array.set( elements );\n\n\t\tgl.uniformMatrix2fv( this.addr, false, mat2array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM3( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix3fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat3array.set( elements );\n\n\t\tgl.uniformMatrix3fv( this.addr, false, mat3array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM4( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix4fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat4array.set( elements );\n\n\t\tgl.uniformMatrix4fv( this.addr, false, mat4array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\n// Single integer / boolean\n\nfunction setValueV1i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1i( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single integer / boolean vector (from flat array or THREE.VectorN)\n\nfunction setValueV2i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2i( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3i( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4i( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n// Single unsigned integer\n\nfunction setValueV1ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1ui( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single unsigned integer vector (from flat array or THREE.VectorN)\n\nfunction setValueV2ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2ui( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3ui( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4ui( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n\n// Single texture (2D / Cube)\n\nfunction setValueT1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\tlet emptyTexture2D;\n\n\tif ( this.type === gl.SAMPLER_2D_SHADOW ) {\n\n\t\temptyShadowTexture.compareFunction = LessEqualCompare; // #28670\n\t\temptyTexture2D = emptyShadowTexture;\n\n\t} else {\n\n\t\temptyTexture2D = emptyTexture;\n\n\t}\n\n\ttextures.setTexture2D( v || emptyTexture2D, unit );\n\n}\n\nfunction setValueT3D1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture3D( v || empty3dTexture, unit );\n\n}\n\nfunction setValueT6( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTextureCube( v || emptyCubeTexture, unit );\n\n}\n\nfunction setValueT2DArray1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture2DArray( v || emptyArrayTexture, unit );\n\n}\n\n// Helper to pick the right setter for the singular case\n\nfunction getSingularSetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1f; // FLOAT\n\t\tcase 0x8b50: return setValueV2f; // _VEC2\n\t\tcase 0x8b51: return setValueV3f; // _VEC3\n\t\tcase 0x8b52: return setValueV4f; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2; // _MAT2\n\t\tcase 0x8b5b: return setValueM3; // _MAT3\n\t\tcase 0x8b5c: return setValueM4; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1i; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2i; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3i; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4i; // _VEC4\n\n\t\tcase 0x1405: return setValueV1ui; // UINT\n\t\tcase 0x8dc6: return setValueV2ui; // _VEC2\n\t\tcase 0x8dc7: return setValueV3ui; // _VEC3\n\t\tcase 0x8dc8: return setValueV4ui; // _VEC4\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1;\n\n\t\tcase 0x8b5f: // SAMPLER_3D\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\n\t\t\treturn setValueT3D1;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6;\n\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\n\t\t\treturn setValueT2DArray1;\n\n\t}\n\n}\n\n\n// Array of scalars\n\nfunction setValueV1fArray( gl, v ) {\n\n\tgl.uniform1fv( this.addr, v );\n\n}\n\n// Array of vectors (from flat array or array of THREE.VectorN)\n\nfunction setValueV2fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 2 );\n\n\tgl.uniform2fv( this.addr, data );\n\n}\n\nfunction setValueV3fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 3 );\n\n\tgl.uniform3fv( this.addr, data );\n\n}\n\nfunction setValueV4fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 4 );\n\n\tgl.uniform4fv( this.addr, data );\n\n}\n\n// Array of matrices (from flat array or array of THREE.MatrixN)\n\nfunction setValueM2Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 4 );\n\n\tgl.uniformMatrix2fv( this.addr, false, data );\n\n}\n\nfunction setValueM3Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 9 );\n\n\tgl.uniformMatrix3fv( this.addr, false, data );\n\n}\n\nfunction setValueM4Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 16 );\n\n\tgl.uniformMatrix4fv( this.addr, false, data );\n\n}\n\n// Array of integer / boolean\n\nfunction setValueV1iArray( gl, v ) {\n\n\tgl.uniform1iv( this.addr, v );\n\n}\n\n// Array of integer / boolean vectors (from flat array)\n\nfunction setValueV2iArray( gl, v ) {\n\n\tgl.uniform2iv( this.addr, v );\n\n}\n\nfunction setValueV3iArray( gl, v ) {\n\n\tgl.uniform3iv( this.addr, v );\n\n}\n\nfunction setValueV4iArray( gl, v ) {\n\n\tgl.uniform4iv( this.addr, v );\n\n}\n\n// Array of unsigned integer\n\nfunction setValueV1uiArray( gl, v ) {\n\n\tgl.uniform1uiv( this.addr, v );\n\n}\n\n// Array of unsigned integer vectors (from flat array)\n\nfunction setValueV2uiArray( gl, v ) {\n\n\tgl.uniform2uiv( this.addr, v );\n\n}\n\nfunction setValueV3uiArray( gl, v ) {\n\n\tgl.uniform3uiv( this.addr, v );\n\n}\n\nfunction setValueV4uiArray( gl, v ) {\n\n\tgl.uniform4uiv( this.addr, v );\n\n}\n\n\n// Array of textures (2D / 3D / Cube / 2DArray)\n\nfunction setValueT1Array( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture2D( v[ i ] || emptyTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT3DArray( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture3D( v[ i ] || empty3dTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT6Array( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTextureCube( v[ i ] || emptyCubeTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT2DArrayArray( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture2DArray( v[ i ] || emptyArrayTexture, units[ i ] );\n\n\t}\n\n}\n\n\n// Helper to pick the right setter for a pure (bottom-level) array\n\nfunction getPureArraySetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1fArray; // FLOAT\n\t\tcase 0x8b50: return setValueV2fArray; // _VEC2\n\t\tcase 0x8b51: return setValueV3fArray; // _VEC3\n\t\tcase 0x8b52: return setValueV4fArray; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2Array; // _MAT2\n\t\tcase 0x8b5b: return setValueM3Array; // _MAT3\n\t\tcase 0x8b5c: return setValueM4Array; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1iArray; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2iArray; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3iArray; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4iArray; // _VEC4\n\n\t\tcase 0x1405: return setValueV1uiArray; // UINT\n\t\tcase 0x8dc6: return setValueV2uiArray; // _VEC2\n\t\tcase 0x8dc7: return setValueV3uiArray; // _VEC3\n\t\tcase 0x8dc8: return setValueV4uiArray; // _VEC4\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1Array;\n\n\t\tcase 0x8b5f: // SAMPLER_3D\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\n\t\t\treturn setValueT3DArray;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6Array;\n\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\n\t\t\treturn setValueT2DArrayArray;\n\n\t}\n\n}\n\n// --- Uniform Classes ---\n\nclass SingleUniform {\n\n\tconstructor( id, activeInfo, addr ) {\n\n\t\tthis.id = id;\n\t\tthis.addr = addr;\n\t\tthis.cache = [];\n\t\tthis.type = activeInfo.type;\n\t\tthis.setValue = getSingularSetter( activeInfo.type );\n\n\t\t// this.path = activeInfo.name; // DEBUG\n\n\t}\n\n}\n\nclass PureArrayUniform {\n\n\tconstructor( id, activeInfo, addr ) {\n\n\t\tthis.id = id;\n\t\tthis.addr = addr;\n\t\tthis.cache = [];\n\t\tthis.type = activeInfo.type;\n\t\tthis.size = activeInfo.size;\n\t\tthis.setValue = getPureArraySetter( activeInfo.type );\n\n\t\t// this.path = activeInfo.name; // DEBUG\n\n\t}\n\n}\n\nclass StructuredUniform {\n\n\tconstructor( id ) {\n\n\t\tthis.id = id;\n\n\t\tthis.seq = [];\n\t\tthis.map = {};\n\n\t}\n\n\tsetValue( gl, value, textures ) {\n\n\t\tconst seq = this.seq;\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ];\n\t\t\tu.setValue( gl, value[ u.id ], textures );\n\n\t\t}\n\n\t}\n\n}\n\n// --- Top-level ---\n\n// Parser - builds up the property tree from the path strings\n\nconst RePathPart = /(\\w+)(\\])?(\\[|\\.)?/g;\n\n// extracts\n// \t- the identifier (member name or array index)\n// - followed by an optional right bracket (found when array index)\n// - followed by an optional left bracket or dot (type of subscript)\n//\n// Note: These portions can be read in a non-overlapping fashion and\n// allow straightforward parsing of the hierarchy that WebGL encodes\n// in the uniform names.\n\nfunction addUniform( container, uniformObject ) {\n\n\tcontainer.seq.push( uniformObject );\n\tcontainer.map[ uniformObject.id ] = uniformObject;\n\n}\n\nfunction parseUniform( activeInfo, addr, container ) {\n\n\tconst path = activeInfo.name,\n\t\tpathLength = path.length;\n\n\t// reset RegExp object, because of the early exit of a previous run\n\tRePathPart.lastIndex = 0;\n\n\twhile ( true ) {\n\n\t\tconst match = RePathPart.exec( path ),\n\t\t\tmatchEnd = RePathPart.lastIndex;\n\n\t\tlet id = match[ 1 ];\n\t\tconst idIsIndex = match[ 2 ] === ']',\n\t\t\tsubscript = match[ 3 ];\n\n\t\tif ( idIsIndex ) id = id | 0; // convert to integer\n\n\t\tif ( subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength ) {\n\n\t\t\t// bare name or \"pure\" bottom-level array \"[0]\" suffix\n\n\t\t\taddUniform( container, subscript === undefined ?\n\t\t\t\tnew SingleUniform( id, activeInfo, addr ) :\n\t\t\t\tnew PureArrayUniform( id, activeInfo, addr ) );\n\n\t\t\tbreak;\n\n\t\t} else {\n\n\t\t\t// step into inner node / create it in case it doesn't exist\n\n\t\t\tconst map = container.map;\n\t\t\tlet next = map[ id ];\n\n\t\t\tif ( next === undefined ) {\n\n\t\t\t\tnext = new StructuredUniform( id );\n\t\t\t\taddUniform( container, next );\n\n\t\t\t}\n\n\t\t\tcontainer = next;\n\n\t\t}\n\n\t}\n\n}\n\n// Root Container\n\nclass WebGLUniforms {\n\n\tconstructor( gl, program ) {\n\n\t\tthis.seq = [];\n\t\tthis.map = {};\n\n\t\tconst n = gl.getProgramParameter( program, gl.ACTIVE_UNIFORMS );\n\n\t\tfor ( let i = 0; i < n; ++ i ) {\n\n\t\t\tconst info = gl.getActiveUniform( program, i ),\n\t\t\t\taddr = gl.getUniformLocation( program, info.name );\n\n\t\t\tparseUniform( info, addr, this );\n\n\t\t}\n\n\t}\n\n\tsetValue( gl, name, value, textures ) {\n\n\t\tconst u = this.map[ name ];\n\n\t\tif ( u !== undefined ) u.setValue( gl, value, textures );\n\n\t}\n\n\tsetOptional( gl, object, name ) {\n\n\t\tconst v = object[ name ];\n\n\t\tif ( v !== undefined ) this.setValue( gl, name, v );\n\n\t}\n\n\tstatic upload( gl, seq, values, textures ) {\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ],\n\t\t\t\tv = values[ u.id ];\n\n\t\t\tif ( v.needsUpdate !== false ) {\n\n\t\t\t\t// note: always updating when .needsUpdate is undefined\n\t\t\t\tu.setValue( gl, v.value, textures );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tstatic seqWithValue( seq, values ) {\n\n\t\tconst r = [];\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ];\n\t\t\tif ( u.id in values ) r.push( u );\n\n\t\t}\n\n\t\treturn r;\n\n\t}\n\n}\n\nfunction WebGLShader( gl, type, string ) {\n\n\tconst shader = gl.createShader( type );\n\n\tgl.shaderSource( shader, string );\n\tgl.compileShader( shader );\n\n\treturn shader;\n\n}\n\n// From https://www.khronos.org/registry/webgl/extensions/KHR_parallel_shader_compile/\nconst COMPLETION_STATUS_KHR = 0x91B1;\n\nlet programIdCount = 0;\n\nfunction handleSource( string, errorLine ) {\n\n\tconst lines = string.split( '\\n' );\n\tconst lines2 = [];\n\n\tconst from = Math.max( errorLine - 6, 0 );\n\tconst to = Math.min( errorLine + 6, lines.length );\n\n\tfor ( let i = from; i < to; i ++ ) {\n\n\t\tconst line = i + 1;\n\t\tlines2.push( `${line === errorLine ? '>' : ' '} ${line}: ${lines[ i ]}` );\n\n\t}\n\n\treturn lines2.join( '\\n' );\n\n}\n\nfunction getEncodingComponents( colorSpace ) {\n\n\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\tconst encodingPrimaries = ColorManagement.getPrimaries( colorSpace );\n\n\tlet gamutMapping;\n\n\tif ( workingPrimaries === encodingPrimaries ) {\n\n\t\tgamutMapping = '';\n\n\t} else if ( workingPrimaries === P3Primaries && encodingPrimaries === Rec709Primaries ) {\n\n\t\tgamutMapping = 'LinearDisplayP3ToLinearSRGB';\n\n\t} else if ( workingPrimaries === Rec709Primaries && encodingPrimaries === P3Primaries ) {\n\n\t\tgamutMapping = 'LinearSRGBToLinearDisplayP3';\n\n\t}\n\n\tswitch ( colorSpace ) {\n\n\t\tcase LinearSRGBColorSpace:\n\t\tcase LinearDisplayP3ColorSpace:\n\t\t\treturn [ gamutMapping, 'LinearTransferOETF' ];\n\n\t\tcase SRGBColorSpace:\n\t\tcase DisplayP3ColorSpace:\n\t\t\treturn [ gamutMapping, 'sRGBTransferOETF' ];\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported color space:', colorSpace );\n\t\t\treturn [ gamutMapping, 'LinearTransferOETF' ];\n\n\t}\n\n}\n\nfunction getShaderErrors( gl, shader, type ) {\n\n\tconst status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );\n\tconst errors = gl.getShaderInfoLog( shader ).trim();\n\n\tif ( status && errors === '' ) return '';\n\n\tconst errorMatches = /ERROR: 0:(\\d+)/.exec( errors );\n\tif ( errorMatches ) {\n\n\t\t// --enable-privileged-webgl-extension\n\t\t// console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );\n\n\t\tconst errorLine = parseInt( errorMatches[ 1 ] );\n\t\treturn type.toUpperCase() + '\\n\\n' + errors + '\\n\\n' + handleSource( gl.getShaderSource( shader ), errorLine );\n\n\t} else {\n\n\t\treturn errors;\n\n\t}\n\n}\n\nfunction getTexelEncodingFunction( functionName, colorSpace ) {\n\n\tconst components = getEncodingComponents( colorSpace );\n\treturn `vec4 ${functionName}( vec4 value ) { return ${components[ 0 ]}( ${components[ 1 ]}( value ) ); }`;\n\n}\n\nfunction getToneMappingFunction( functionName, toneMapping ) {\n\n\tlet toneMappingName;\n\n\tswitch ( toneMapping ) {\n\n\t\tcase LinearToneMapping:\n\t\t\ttoneMappingName = 'Linear';\n\t\t\tbreak;\n\n\t\tcase ReinhardToneMapping:\n\t\t\ttoneMappingName = 'Reinhard';\n\t\t\tbreak;\n\n\t\tcase CineonToneMapping:\n\t\t\ttoneMappingName = 'Cineon';\n\t\t\tbreak;\n\n\t\tcase ACESFilmicToneMapping:\n\t\t\ttoneMappingName = 'ACESFilmic';\n\t\t\tbreak;\n\n\t\tcase AgXToneMapping:\n\t\t\ttoneMappingName = 'AgX';\n\t\t\tbreak;\n\n\t\tcase NeutralToneMapping:\n\t\t\ttoneMappingName = 'Neutral';\n\t\t\tbreak;\n\n\t\tcase CustomToneMapping:\n\t\t\ttoneMappingName = 'Custom';\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported toneMapping:', toneMapping );\n\t\t\ttoneMappingName = 'Linear';\n\n\t}\n\n\treturn 'vec3 ' + functionName + '( vec3 color ) { return ' + toneMappingName + 'ToneMapping( color ); }';\n\n}\n\nconst _v0$1 = /*@__PURE__*/ new Vector3();\n\nfunction getLuminanceFunction() {\n\n\tColorManagement.getLuminanceCoefficients( _v0$1 );\n\n\tconst r = _v0$1.x.toFixed( 4 );\n\tconst g = _v0$1.y.toFixed( 4 );\n\tconst b = _v0$1.z.toFixed( 4 );\n\n\treturn [\n\n\t\t'float luminance( const in vec3 rgb ) {',\n\n\t\t`\tconst vec3 weights = vec3( ${ r }, ${ g }, ${ b } );`,\n\n\t\t'\treturn dot( weights, rgb );',\n\n\t\t'}'\n\n\t].join( '\\n' );\n\n}\n\nfunction generateVertexExtensions( parameters ) {\n\n\tconst chunks = [\n\t\tparameters.extensionClipCullDistance ? '#extension GL_ANGLE_clip_cull_distance : require' : '',\n\t\tparameters.extensionMultiDraw ? '#extension GL_ANGLE_multi_draw : require' : '',\n\t];\n\n\treturn chunks.filter( filterEmptyLine ).join( '\\n' );\n\n}\n\nfunction generateDefines( defines ) {\n\n\tconst chunks = [];\n\n\tfor ( const name in defines ) {\n\n\t\tconst value = defines[ name ];\n\n\t\tif ( value === false ) continue;\n\n\t\tchunks.push( '#define ' + name + ' ' + value );\n\n\t}\n\n\treturn chunks.join( '\\n' );\n\n}\n\nfunction fetchAttributeLocations( gl, program ) {\n\n\tconst attributes = {};\n\n\tconst n = gl.getProgramParameter( program, gl.ACTIVE_ATTRIBUTES );\n\n\tfor ( let i = 0; i < n; i ++ ) {\n\n\t\tconst info = gl.getActiveAttrib( program, i );\n\t\tconst name = info.name;\n\n\t\tlet locationSize = 1;\n\t\tif ( info.type === gl.FLOAT_MAT2 ) locationSize = 2;\n\t\tif ( info.type === gl.FLOAT_MAT3 ) locationSize = 3;\n\t\tif ( info.type === gl.FLOAT_MAT4 ) locationSize = 4;\n\n\t\t// console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );\n\n\t\tattributes[ name ] = {\n\t\t\ttype: info.type,\n\t\t\tlocation: gl.getAttribLocation( program, name ),\n\t\t\tlocationSize: locationSize\n\t\t};\n\n\t}\n\n\treturn attributes;\n\n}\n\nfunction filterEmptyLine( string ) {\n\n\treturn string !== '';\n\n}\n\nfunction replaceLightNums( string, parameters ) {\n\n\tconst numSpotLightCoords = parameters.numSpotLightShadows + parameters.numSpotLightMaps - parameters.numSpotLightShadowsWithMaps;\n\n\treturn string\n\t\t.replace( /NUM_DIR_LIGHTS/g, parameters.numDirLights )\n\t\t.replace( /NUM_SPOT_LIGHTS/g, parameters.numSpotLights )\n\t\t.replace( /NUM_SPOT_LIGHT_MAPS/g, parameters.numSpotLightMaps )\n\t\t.replace( /NUM_SPOT_LIGHT_COORDS/g, numSpotLightCoords )\n\t\t.replace( /NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights )\n\t\t.replace( /NUM_POINT_LIGHTS/g, parameters.numPointLights )\n\t\t.replace( /NUM_HEMI_LIGHTS/g, parameters.numHemiLights )\n\t\t.replace( /NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows )\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, parameters.numSpotLightShadowsWithMaps )\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows )\n\t\t.replace( /NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows );\n\n}\n\nfunction replaceClippingPlaneNums( string, parameters ) {\n\n\treturn string\n\t\t.replace( /NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes )\n\t\t.replace( /UNION_CLIPPING_PLANES/g, ( parameters.numClippingPlanes - parameters.numClipIntersection ) );\n\n}\n\n// Resolve Includes\n\nconst includePattern = /^[ \\t]*#include +<([\\w\\d./]+)>/gm;\n\nfunction resolveIncludes( string ) {\n\n\treturn string.replace( includePattern, includeReplacer );\n\n}\n\nconst shaderChunkMap = new Map();\n\nfunction includeReplacer( match, include ) {\n\n\tlet string = ShaderChunk[ include ];\n\n\tif ( string === undefined ) {\n\n\t\tconst newInclude = shaderChunkMap.get( include );\n\n\t\tif ( newInclude !== undefined ) {\n\n\t\t\tstring = ShaderChunk[ newInclude ];\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Shader chunk \"%s\" has been deprecated. Use \"%s\" instead.', include, newInclude );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'Can not resolve #include <' + include + '>' );\n\n\t\t}\n\n\t}\n\n\treturn resolveIncludes( string );\n\n}\n\n// Unroll Loops\n\nconst unrollLoopPattern = /#pragma unroll_loop_start\\s+for\\s*\\(\\s*int\\s+i\\s*=\\s*(\\d+)\\s*;\\s*i\\s*<\\s*(\\d+)\\s*;\\s*i\\s*\\+\\+\\s*\\)\\s*{([\\s\\S]+?)}\\s+#pragma unroll_loop_end/g;\n\nfunction unrollLoops( string ) {\n\n\treturn string.replace( unrollLoopPattern, loopReplacer );\n\n}\n\nfunction loopReplacer( match, start, end, snippet ) {\n\n\tlet string = '';\n\n\tfor ( let i = parseInt( start ); i < parseInt( end ); i ++ ) {\n\n\t\tstring += snippet\n\t\t\t.replace( /\\[\\s*i\\s*\\]/g, '[ ' + i + ' ]' )\n\t\t\t.replace( /UNROLLED_LOOP_INDEX/g, i );\n\n\t}\n\n\treturn string;\n\n}\n\n//\n\nfunction generatePrecision( parameters ) {\n\n\tlet precisionstring = `precision ${parameters.precision} float;\n\tprecision ${parameters.precision} int;\n\tprecision ${parameters.precision} sampler2D;\n\tprecision ${parameters.precision} samplerCube;\n\tprecision ${parameters.precision} sampler3D;\n\tprecision ${parameters.precision} sampler2DArray;\n\tprecision ${parameters.precision} sampler2DShadow;\n\tprecision ${parameters.precision} samplerCubeShadow;\n\tprecision ${parameters.precision} sampler2DArrayShadow;\n\tprecision ${parameters.precision} isampler2D;\n\tprecision ${parameters.precision} isampler3D;\n\tprecision ${parameters.precision} isamplerCube;\n\tprecision ${parameters.precision} isampler2DArray;\n\tprecision ${parameters.precision} usampler2D;\n\tprecision ${parameters.precision} usampler3D;\n\tprecision ${parameters.precision} usamplerCube;\n\tprecision ${parameters.precision} usampler2DArray;\n\t`;\n\n\tif ( parameters.precision === 'highp' ) {\n\n\t\tprecisionstring += '\\n#define HIGH_PRECISION';\n\n\t} else if ( parameters.precision === 'mediump' ) {\n\n\t\tprecisionstring += '\\n#define MEDIUM_PRECISION';\n\n\t} else if ( parameters.precision === 'lowp' ) {\n\n\t\tprecisionstring += '\\n#define LOW_PRECISION';\n\n\t}\n\n\treturn precisionstring;\n\n}\n\nfunction generateShadowMapTypeDefine( parameters ) {\n\n\tlet shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC';\n\n\tif ( parameters.shadowMapType === PCFShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF';\n\n\t} else if ( parameters.shadowMapType === PCFSoftShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT';\n\n\t} else if ( parameters.shadowMapType === VSMShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_VSM';\n\n\t}\n\n\treturn shadowMapTypeDefine;\n\n}\n\nfunction generateEnvMapTypeDefine( parameters ) {\n\n\tlet envMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.envMapMode ) {\n\n\t\t\tcase CubeReflectionMapping:\n\t\t\tcase CubeRefractionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n\t\t\t\tbreak;\n\n\t\t\tcase CubeUVReflectionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapTypeDefine;\n\n}\n\nfunction generateEnvMapModeDefine( parameters ) {\n\n\tlet envMapModeDefine = 'ENVMAP_MODE_REFLECTION';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.envMapMode ) {\n\n\t\t\tcase CubeRefractionMapping:\n\n\t\t\t\tenvMapModeDefine = 'ENVMAP_MODE_REFRACTION';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapModeDefine;\n\n}\n\nfunction generateEnvMapBlendingDefine( parameters ) {\n\n\tlet envMapBlendingDefine = 'ENVMAP_BLENDING_NONE';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.combine ) {\n\n\t\t\tcase MultiplyOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';\n\t\t\t\tbreak;\n\n\t\t\tcase MixOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MIX';\n\t\t\t\tbreak;\n\n\t\t\tcase AddOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_ADD';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapBlendingDefine;\n\n}\n\nfunction generateCubeUVSize( parameters ) {\n\n\tconst imageHeight = parameters.envMapCubeUVHeight;\n\n\tif ( imageHeight === null ) return null;\n\n\tconst maxMip = Math.log2( imageHeight ) - 2;\n\n\tconst texelHeight = 1.0 / imageHeight;\n\n\tconst texelWidth = 1.0 / ( 3 * Math.max( Math.pow( 2, maxMip ), 7 * 16 ) );\n\n\treturn { texelWidth, texelHeight, maxMip };\n\n}\n\nfunction WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {\n\n\t// TODO Send this event to Three.js DevTools\n\t// console.log( 'WebGLProgram', cacheKey );\n\n\tconst gl = renderer.getContext();\n\n\tconst defines = parameters.defines;\n\n\tlet vertexShader = parameters.vertexShader;\n\tlet fragmentShader = parameters.fragmentShader;\n\n\tconst shadowMapTypeDefine = generateShadowMapTypeDefine( parameters );\n\tconst envMapTypeDefine = generateEnvMapTypeDefine( parameters );\n\tconst envMapModeDefine = generateEnvMapModeDefine( parameters );\n\tconst envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );\n\tconst envMapCubeUVSize = generateCubeUVSize( parameters );\n\n\tconst customVertexExtensions = generateVertexExtensions( parameters );\n\n\tconst customDefines = generateDefines( defines );\n\n\tconst program = gl.createProgram();\n\n\tlet prefixVertex, prefixFragment;\n\tlet versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\\n' : '';\n\n\tif ( parameters.isRawShaderMaterial ) {\n\n\t\tprefixVertex = [\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixVertex.length > 0 ) {\n\n\t\t\tprefixVertex += '\\n';\n\n\t\t}\n\n\t\tprefixFragment = [\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixFragment.length > 0 ) {\n\n\t\t\tprefixFragment += '\\n';\n\n\t\t}\n\n\t} else {\n\n\t\tprefixVertex = [\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\tparameters.extensionClipCullDistance ? '#define USE_CLIP_DISTANCE' : '',\n\t\t\tparameters.batching ? '#define USE_BATCHING' : '',\n\t\t\tparameters.batchingColor ? '#define USE_BATCHING_COLOR' : '',\n\t\t\tparameters.instancing ? '#define USE_INSTANCING' : '',\n\t\t\tparameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',\n\t\t\tparameters.instancingMorph ? '#define USE_INSTANCING_MORPH' : '',\n\n\t\t\tparameters.useFog && parameters.fog ? '#define USE_FOG' : '',\n\t\t\tparameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\tparameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',\n\t\t\tparameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',\n\t\t\tparameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\n\t\t\tparameters.anisotropy ? '#define USE_ANISOTROPY' : '',\n\t\t\tparameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',\n\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\n\t\t\tparameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',\n\t\t\tparameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',\n\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '',\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',\n\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\t\t\tparameters.alphaHash ? '#define USE_ALPHAHASH' : '',\n\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\n\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '',\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '',\n\n\t\t\t//\n\n\t\t\tparameters.mapUv ? '#define MAP_UV ' + parameters.mapUv : '',\n\t\t\tparameters.alphaMapUv ? '#define ALPHAMAP_UV ' + parameters.alphaMapUv : '',\n\t\t\tparameters.lightMapUv ? '#define LIGHTMAP_UV ' + parameters.lightMapUv : '',\n\t\t\tparameters.aoMapUv ? '#define AOMAP_UV ' + parameters.aoMapUv : '',\n\t\t\tparameters.emissiveMapUv ? '#define EMISSIVEMAP_UV ' + parameters.emissiveMapUv : '',\n\t\t\tparameters.bumpMapUv ? '#define BUMPMAP_UV ' + parameters.bumpMapUv : '',\n\t\t\tparameters.normalMapUv ? '#define NORMALMAP_UV ' + parameters.normalMapUv : '',\n\t\t\tparameters.displacementMapUv ? '#define DISPLACEMENTMAP_UV ' + parameters.displacementMapUv : '',\n\n\t\t\tparameters.metalnessMapUv ? '#define METALNESSMAP_UV ' + parameters.metalnessMapUv : '',\n\t\t\tparameters.roughnessMapUv ? '#define ROUGHNESSMAP_UV ' + parameters.roughnessMapUv : '',\n\n\t\t\tparameters.anisotropyMapUv ? '#define ANISOTROPYMAP_UV ' + parameters.anisotropyMapUv : '',\n\n\t\t\tparameters.clearcoatMapUv ? '#define CLEARCOATMAP_UV ' + parameters.clearcoatMapUv : '',\n\t\t\tparameters.clearcoatNormalMapUv ? '#define CLEARCOAT_NORMALMAP_UV ' + parameters.clearcoatNormalMapUv : '',\n\t\t\tparameters.clearcoatRoughnessMapUv ? '#define CLEARCOAT_ROUGHNESSMAP_UV ' + parameters.clearcoatRoughnessMapUv : '',\n\n\t\t\tparameters.iridescenceMapUv ? '#define IRIDESCENCEMAP_UV ' + parameters.iridescenceMapUv : '',\n\t\t\tparameters.iridescenceThicknessMapUv ? '#define IRIDESCENCE_THICKNESSMAP_UV ' + parameters.iridescenceThicknessMapUv : '',\n\n\t\t\tparameters.sheenColorMapUv ? '#define SHEEN_COLORMAP_UV ' + parameters.sheenColorMapUv : '',\n\t\t\tparameters.sheenRoughnessMapUv ? '#define SHEEN_ROUGHNESSMAP_UV ' + parameters.sheenRoughnessMapUv : '',\n\n\t\t\tparameters.specularMapUv ? '#define SPECULARMAP_UV ' + parameters.specularMapUv : '',\n\t\t\tparameters.specularColorMapUv ? '#define SPECULAR_COLORMAP_UV ' + parameters.specularColorMapUv : '',\n\t\t\tparameters.specularIntensityMapUv ? '#define SPECULAR_INTENSITYMAP_UV ' + parameters.specularIntensityMapUv : '',\n\n\t\t\tparameters.transmissionMapUv ? '#define TRANSMISSIONMAP_UV ' + parameters.transmissionMapUv : '',\n\t\t\tparameters.thicknessMapUv ? '#define THICKNESSMAP_UV ' + parameters.thicknessMapUv : '',\n\n\t\t\t//\n\n\t\t\tparameters.vertexTangents && parameters.flatShading === false ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexColors ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',\n\t\t\tparameters.vertexUv1s ? '#define USE_UV1' : '',\n\t\t\tparameters.vertexUv2s ? '#define USE_UV2' : '',\n\t\t\tparameters.vertexUv3s ? '#define USE_UV3' : '',\n\n\t\t\tparameters.pointsUvs ? '#define USE_POINTS_UV' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.skinning ? '#define USE_SKINNING' : '',\n\n\t\t\tparameters.morphTargets ? '#define USE_MORPHTARGETS' : '',\n\t\t\tparameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',\n\t\t\t( parameters.morphColors ) ? '#define USE_MORPHCOLORS' : '',\n\t\t\t( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',\n\t\t\t( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',\n\n\t\t\tparameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\n\n\t\t\t'uniform mat4 modelMatrix;',\n\t\t\t'uniform mat4 modelViewMatrix;',\n\t\t\t'uniform mat4 projectionMatrix;',\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform mat3 normalMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t'#ifdef USE_INSTANCING',\n\n\t\t\t'\tattribute mat4 instanceMatrix;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_INSTANCING_COLOR',\n\n\t\t\t'\tattribute vec3 instanceColor;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_INSTANCING_MORPH',\n\n\t\t\t'\tuniform sampler2D morphTexture;',\n\n\t\t\t'#endif',\n\n\t\t\t'attribute vec3 position;',\n\t\t\t'attribute vec3 normal;',\n\t\t\t'attribute vec2 uv;',\n\n\t\t\t'#ifdef USE_UV1',\n\n\t\t\t'\tattribute vec2 uv1;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_UV2',\n\n\t\t\t'\tattribute vec2 uv2;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_UV3',\n\n\t\t\t'\tattribute vec2 uv3;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_TANGENT',\n\n\t\t\t'\tattribute vec4 tangent;',\n\n\t\t\t'#endif',\n\n\t\t\t'#if defined( USE_COLOR_ALPHA )',\n\n\t\t\t'\tattribute vec4 color;',\n\n\t\t\t'#elif defined( USE_COLOR )',\n\n\t\t\t'\tattribute vec3 color;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_SKINNING',\n\n\t\t\t'\tattribute vec4 skinIndex;',\n\t\t\t'\tattribute vec4 skinWeight;',\n\n\t\t\t'#endif',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tprefixFragment = [\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\tparameters.useFog && parameters.fog ? '#define USE_FOG' : '',\n\t\t\tparameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.alphaToCoverage ? '#define ALPHA_TO_COVERAGE' : '',\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.matcap ? '#define USE_MATCAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapTypeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapBlendingDefine : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_TEXEL_WIDTH ' + envMapCubeUVSize.texelWidth : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_TEXEL_HEIGHT ' + envMapCubeUVSize.texelHeight : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_MAX_MIP ' + envMapCubeUVSize.maxMip + '.0' : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\tparameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',\n\t\t\tparameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\n\t\t\tparameters.anisotropy ? '#define USE_ANISOTROPY' : '',\n\t\t\tparameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',\n\n\t\t\tparameters.clearcoat ? '#define USE_CLEARCOAT' : '',\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\n\t\t\tparameters.dispersion ? '#define USE_DISPERSION' : '',\n\n\t\t\tparameters.iridescence ? '#define USE_IRIDESCENCE' : '',\n\t\t\tparameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',\n\t\t\tparameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',\n\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '',\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',\n\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\t\t\tparameters.alphaTest ? '#define USE_ALPHATEST' : '',\n\t\t\tparameters.alphaHash ? '#define USE_ALPHAHASH' : '',\n\n\t\t\tparameters.sheen ? '#define USE_SHEEN' : '',\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '',\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '',\n\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\n\n\t\t\tparameters.vertexTangents && parameters.flatShading === false ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexColors || parameters.instancingColor || parameters.batchingColor ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',\n\t\t\tparameters.vertexUv1s ? '#define USE_UV1' : '',\n\t\t\tparameters.vertexUv2s ? '#define USE_UV2' : '',\n\t\t\tparameters.vertexUv3s ? '#define USE_UV3' : '',\n\n\t\t\tparameters.pointsUvs ? '#define USE_POINTS_UV' : '',\n\n\t\t\tparameters.gradientMap ? '#define USE_GRADIENTMAP' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '',\n\n\t\t\tparameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',\n\n\t\t\tparameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\n\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? '#define TONE_MAPPING' : '',\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? ShaderChunk[ 'tonemapping_pars_fragment' ] : '', // this code is required here because it is used by the toneMapping() function defined below\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '',\n\n\t\t\tparameters.dithering ? '#define DITHERING' : '',\n\t\t\tparameters.opaque ? '#define OPAQUE' : '',\n\n\t\t\tShaderChunk[ 'colorspace_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below\n\t\t\tgetTexelEncodingFunction( 'linearToOutputTexel', parameters.outputColorSpace ),\n\t\t\tgetLuminanceFunction(),\n\n\t\t\tparameters.useDepthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t}\n\n\tvertexShader = resolveIncludes( vertexShader );\n\tvertexShader = replaceLightNums( vertexShader, parameters );\n\tvertexShader = replaceClippingPlaneNums( vertexShader, parameters );\n\n\tfragmentShader = resolveIncludes( fragmentShader );\n\tfragmentShader = replaceLightNums( fragmentShader, parameters );\n\tfragmentShader = replaceClippingPlaneNums( fragmentShader, parameters );\n\n\tvertexShader = unrollLoops( vertexShader );\n\tfragmentShader = unrollLoops( fragmentShader );\n\n\tif ( parameters.isRawShaderMaterial !== true ) {\n\n\t\t// GLSL 3.0 conversion for built-in materials and ShaderMaterial\n\n\t\tversionString = '#version 300 es\\n';\n\n\t\tprefixVertex = [\n\t\t\tcustomVertexExtensions,\n\t\t\t'#define attribute in',\n\t\t\t'#define varying out',\n\t\t\t'#define texture2D texture'\n\t\t].join( '\\n' ) + '\\n' + prefixVertex;\n\n\t\tprefixFragment = [\n\t\t\t'#define varying in',\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',\n\t\t\t'#define gl_FragDepthEXT gl_FragDepth',\n\t\t\t'#define texture2D texture',\n\t\t\t'#define textureCube texture',\n\t\t\t'#define texture2DProj textureProj',\n\t\t\t'#define texture2DLodEXT textureLod',\n\t\t\t'#define texture2DProjLodEXT textureProjLod',\n\t\t\t'#define textureCubeLodEXT textureLod',\n\t\t\t'#define texture2DGradEXT textureGrad',\n\t\t\t'#define texture2DProjGradEXT textureProjGrad',\n\t\t\t'#define textureCubeGradEXT textureGrad'\n\t\t].join( '\\n' ) + '\\n' + prefixFragment;\n\n\t}\n\n\tconst vertexGlsl = versionString + prefixVertex + vertexShader;\n\tconst fragmentGlsl = versionString + prefixFragment + fragmentShader;\n\n\t// console.log( '*VERTEX*', vertexGlsl );\n\t// console.log( '*FRAGMENT*', fragmentGlsl );\n\n\tconst glVertexShader = WebGLShader( gl, gl.VERTEX_SHADER, vertexGlsl );\n\tconst glFragmentShader = WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentGlsl );\n\n\tgl.attachShader( program, glVertexShader );\n\tgl.attachShader( program, glFragmentShader );\n\n\t// Force a particular attribute to index 0.\n\n\tif ( parameters.index0AttributeName !== undefined ) {\n\n\t\tgl.bindAttribLocation( program, 0, parameters.index0AttributeName );\n\n\t} else if ( parameters.morphTargets === true ) {\n\n\t\t// programs with morphTargets displace position out of attribute 0\n\t\tgl.bindAttribLocation( program, 0, 'position' );\n\n\t}\n\n\tgl.linkProgram( program );\n\n\tfunction onFirstUse( self ) {\n\n\t\t// check for link errors\n\t\tif ( renderer.debug.checkShaderErrors ) {\n\n\t\t\tconst programLog = gl.getProgramInfoLog( program ).trim();\n\t\t\tconst vertexLog = gl.getShaderInfoLog( glVertexShader ).trim();\n\t\t\tconst fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim();\n\n\t\t\tlet runnable = true;\n\t\t\tlet haveDiagnostics = true;\n\n\t\t\tif ( gl.getProgramParameter( program, gl.LINK_STATUS ) === false ) {\n\n\t\t\t\trunnable = false;\n\n\t\t\t\tif ( typeof renderer.debug.onShaderError === 'function' ) {\n\n\t\t\t\t\trenderer.debug.onShaderError( gl, program, glVertexShader, glFragmentShader );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// default error reporting\n\n\t\t\t\t\tconst vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );\n\t\t\t\t\tconst fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );\n\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +\n\t\t\t\t\t\t'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\\n\\n' +\n\t\t\t\t\t\t'Material Name: ' + self.name + '\\n' +\n\t\t\t\t\t\t'Material Type: ' + self.type + '\\n\\n' +\n\t\t\t\t\t\t'Program Info Log: ' + programLog + '\\n' +\n\t\t\t\t\t\tvertexErrors + '\\n' +\n\t\t\t\t\t\tfragmentErrors\n\t\t\t\t\t);\n\n\t\t\t\t}\n\n\t\t\t} else if ( programLog !== '' ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLProgram: Program Info Log:', programLog );\n\n\t\t\t} else if ( vertexLog === '' || fragmentLog === '' ) {\n\n\t\t\t\thaveDiagnostics = false;\n\n\t\t\t}\n\n\t\t\tif ( haveDiagnostics ) {\n\n\t\t\t\tself.diagnostics = {\n\n\t\t\t\t\trunnable: runnable,\n\n\t\t\t\t\tprogramLog: programLog,\n\n\t\t\t\t\tvertexShader: {\n\n\t\t\t\t\t\tlog: vertexLog,\n\t\t\t\t\t\tprefix: prefixVertex\n\n\t\t\t\t\t},\n\n\t\t\t\t\tfragmentShader: {\n\n\t\t\t\t\t\tlog: fragmentLog,\n\t\t\t\t\t\tprefix: prefixFragment\n\n\t\t\t\t\t}\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Clean up\n\n\t\t// Crashes in iOS9 and iOS10. #18402\n\t\t// gl.detachShader( program, glVertexShader );\n\t\t// gl.detachShader( program, glFragmentShader );\n\n\t\tgl.deleteShader( glVertexShader );\n\t\tgl.deleteShader( glFragmentShader );\n\n\t\tcachedUniforms = new WebGLUniforms( gl, program );\n\t\tcachedAttributes = fetchAttributeLocations( gl, program );\n\n\t}\n\n\t// set up caching for uniform locations\n\n\tlet cachedUniforms;\n\n\tthis.getUniforms = function () {\n\n\t\tif ( cachedUniforms === undefined ) {\n\n\t\t\t// Populates cachedUniforms and cachedAttributes\n\t\t\tonFirstUse( this );\n\n\t\t}\n\n\t\treturn cachedUniforms;\n\n\t};\n\n\t// set up caching for attribute locations\n\n\tlet cachedAttributes;\n\n\tthis.getAttributes = function () {\n\n\t\tif ( cachedAttributes === undefined ) {\n\n\t\t\t// Populates cachedAttributes and cachedUniforms\n\t\t\tonFirstUse( this );\n\n\t\t}\n\n\t\treturn cachedAttributes;\n\n\t};\n\n\t// indicate when the program is ready to be used. if the KHR_parallel_shader_compile extension isn't supported,\n\t// flag the program as ready immediately. It may cause a stall when it's first used.\n\n\tlet programReady = ( parameters.rendererExtensionParallelShaderCompile === false );\n\n\tthis.isReady = function () {\n\n\t\tif ( programReady === false ) {\n\n\t\t\tprogramReady = gl.getProgramParameter( program, COMPLETION_STATUS_KHR );\n\n\t\t}\n\n\t\treturn programReady;\n\n\t};\n\n\t// free resource\n\n\tthis.destroy = function () {\n\n\t\tbindingStates.releaseStatesOfProgram( this );\n\n\t\tgl.deleteProgram( program );\n\t\tthis.program = undefined;\n\n\t};\n\n\t//\n\n\tthis.type = parameters.shaderType;\n\tthis.name = parameters.shaderName;\n\tthis.id = programIdCount ++;\n\tthis.cacheKey = cacheKey;\n\tthis.usedTimes = 1;\n\tthis.program = program;\n\tthis.vertexShader = glVertexShader;\n\tthis.fragmentShader = glFragmentShader;\n\n\treturn this;\n\n}\n\nlet _id$1 = 0;\n\nclass WebGLShaderCache {\n\n\tconstructor() {\n\n\t\tthis.shaderCache = new Map();\n\t\tthis.materialCache = new Map();\n\n\t}\n\n\tupdate( material ) {\n\n\t\tconst vertexShader = material.vertexShader;\n\t\tconst fragmentShader = material.fragmentShader;\n\n\t\tconst vertexShaderStage = this._getShaderStage( vertexShader );\n\t\tconst fragmentShaderStage = this._getShaderStage( fragmentShader );\n\n\t\tconst materialShaders = this._getShaderCacheForMaterial( material );\n\n\t\tif ( materialShaders.has( vertexShaderStage ) === false ) {\n\n\t\t\tmaterialShaders.add( vertexShaderStage );\n\t\t\tvertexShaderStage.usedTimes ++;\n\n\t\t}\n\n\t\tif ( materialShaders.has( fragmentShaderStage ) === false ) {\n\n\t\t\tmaterialShaders.add( fragmentShaderStage );\n\t\t\tfragmentShaderStage.usedTimes ++;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremove( material ) {\n\n\t\tconst materialShaders = this.materialCache.get( material );\n\n\t\tfor ( const shaderStage of materialShaders ) {\n\n\t\t\tshaderStage.usedTimes --;\n\n\t\t\tif ( shaderStage.usedTimes === 0 ) this.shaderCache.delete( shaderStage.code );\n\n\t\t}\n\n\t\tthis.materialCache.delete( material );\n\n\t\treturn this;\n\n\t}\n\n\tgetVertexShaderID( material ) {\n\n\t\treturn this._getShaderStage( material.vertexShader ).id;\n\n\t}\n\n\tgetFragmentShaderID( material ) {\n\n\t\treturn this._getShaderStage( material.fragmentShader ).id;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shaderCache.clear();\n\t\tthis.materialCache.clear();\n\n\t}\n\n\t_getShaderCacheForMaterial( material ) {\n\n\t\tconst cache = this.materialCache;\n\t\tlet set = cache.get( material );\n\n\t\tif ( set === undefined ) {\n\n\t\t\tset = new Set();\n\t\t\tcache.set( material, set );\n\n\t\t}\n\n\t\treturn set;\n\n\t}\n\n\t_getShaderStage( code ) {\n\n\t\tconst cache = this.shaderCache;\n\t\tlet stage = cache.get( code );\n\n\t\tif ( stage === undefined ) {\n\n\t\t\tstage = new WebGLShaderStage( code );\n\t\t\tcache.set( code, stage );\n\n\t\t}\n\n\t\treturn stage;\n\n\t}\n\n}\n\nclass WebGLShaderStage {\n\n\tconstructor( code ) {\n\n\t\tthis.id = _id$1 ++;\n\n\t\tthis.code = code;\n\t\tthis.usedTimes = 0;\n\n\t}\n\n}\n\nfunction WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping ) {\n\n\tconst _programLayers = new Layers();\n\tconst _customShaders = new WebGLShaderCache();\n\tconst _activeChannels = new Set();\n\tconst programs = [];\n\n\tconst logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;\n\tconst SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;\n\n\tlet precision = capabilities.precision;\n\n\tconst shaderIDs = {\n\t\tMeshDepthMaterial: 'depth',\n\t\tMeshDistanceMaterial: 'distanceRGBA',\n\t\tMeshNormalMaterial: 'normal',\n\t\tMeshBasicMaterial: 'basic',\n\t\tMeshLambertMaterial: 'lambert',\n\t\tMeshPhongMaterial: 'phong',\n\t\tMeshToonMaterial: 'toon',\n\t\tMeshStandardMaterial: 'physical',\n\t\tMeshPhysicalMaterial: 'physical',\n\t\tMeshMatcapMaterial: 'matcap',\n\t\tLineBasicMaterial: 'basic',\n\t\tLineDashedMaterial: 'dashed',\n\t\tPointsMaterial: 'points',\n\t\tShadowMaterial: 'shadow',\n\t\tSpriteMaterial: 'sprite'\n\t};\n\n\tfunction getChannel( value ) {\n\n\t\t_activeChannels.add( value );\n\n\t\tif ( value === 0 ) return 'uv';\n\n\t\treturn `uv${ value }`;\n\n\t}\n\n\tfunction getParameters( material, lights, shadows, scene, object ) {\n\n\t\tconst fog = scene.fog;\n\t\tconst geometry = object.geometry;\n\t\tconst environment = material.isMeshStandardMaterial ? scene.environment : null;\n\n\t\tconst envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );\n\t\tconst envMapCubeUVHeight = ( !! envMap ) && ( envMap.mapping === CubeUVReflectionMapping ) ? envMap.image.height : null;\n\n\t\tconst shaderID = shaderIDs[ material.type ];\n\n\t\t// heuristics to create shader parameters according to lights in the scene\n\t\t// (not to blow over maxLights budget)\n\n\t\tif ( material.precision !== null ) {\n\n\t\t\tprecision = capabilities.getMaxPrecision( material.precision );\n\n\t\t\tif ( precision !== material.precision ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.' );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\tlet morphTextureStride = 0;\n\n\t\tif ( geometry.morphAttributes.position !== undefined ) morphTextureStride = 1;\n\t\tif ( geometry.morphAttributes.normal !== undefined ) morphTextureStride = 2;\n\t\tif ( geometry.morphAttributes.color !== undefined ) morphTextureStride = 3;\n\n\t\t//\n\n\t\tlet vertexShader, fragmentShader;\n\t\tlet customVertexShaderID, customFragmentShaderID;\n\n\t\tif ( shaderID ) {\n\n\t\t\tconst shader = ShaderLib[ shaderID ];\n\n\t\t\tvertexShader = shader.vertexShader;\n\t\t\tfragmentShader = shader.fragmentShader;\n\n\t\t} else {\n\n\t\t\tvertexShader = material.vertexShader;\n\t\t\tfragmentShader = material.fragmentShader;\n\n\t\t\t_customShaders.update( material );\n\n\t\t\tcustomVertexShaderID = _customShaders.getVertexShaderID( material );\n\t\t\tcustomFragmentShaderID = _customShaders.getFragmentShaderID( material );\n\n\t\t}\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tconst IS_INSTANCEDMESH = object.isInstancedMesh === true;\n\t\tconst IS_BATCHEDMESH = object.isBatchedMesh === true;\n\n\t\tconst HAS_MAP = !! material.map;\n\t\tconst HAS_MATCAP = !! material.matcap;\n\t\tconst HAS_ENVMAP = !! envMap;\n\t\tconst HAS_AOMAP = !! material.aoMap;\n\t\tconst HAS_LIGHTMAP = !! material.lightMap;\n\t\tconst HAS_BUMPMAP = !! material.bumpMap;\n\t\tconst HAS_NORMALMAP = !! material.normalMap;\n\t\tconst HAS_DISPLACEMENTMAP = !! material.displacementMap;\n\t\tconst HAS_EMISSIVEMAP = !! material.emissiveMap;\n\n\t\tconst HAS_METALNESSMAP = !! material.metalnessMap;\n\t\tconst HAS_ROUGHNESSMAP = !! material.roughnessMap;\n\n\t\tconst HAS_ANISOTROPY = material.anisotropy > 0;\n\t\tconst HAS_CLEARCOAT = material.clearcoat > 0;\n\t\tconst HAS_DISPERSION = material.dispersion > 0;\n\t\tconst HAS_IRIDESCENCE = material.iridescence > 0;\n\t\tconst HAS_SHEEN = material.sheen > 0;\n\t\tconst HAS_TRANSMISSION = material.transmission > 0;\n\n\t\tconst HAS_ANISOTROPYMAP = HAS_ANISOTROPY && !! material.anisotropyMap;\n\n\t\tconst HAS_CLEARCOATMAP = HAS_CLEARCOAT && !! material.clearcoatMap;\n\t\tconst HAS_CLEARCOAT_NORMALMAP = HAS_CLEARCOAT && !! material.clearcoatNormalMap;\n\t\tconst HAS_CLEARCOAT_ROUGHNESSMAP = HAS_CLEARCOAT && !! material.clearcoatRoughnessMap;\n\n\t\tconst HAS_IRIDESCENCEMAP = HAS_IRIDESCENCE && !! material.iridescenceMap;\n\t\tconst HAS_IRIDESCENCE_THICKNESSMAP = HAS_IRIDESCENCE && !! material.iridescenceThicknessMap;\n\n\t\tconst HAS_SHEEN_COLORMAP = HAS_SHEEN && !! material.sheenColorMap;\n\t\tconst HAS_SHEEN_ROUGHNESSMAP = HAS_SHEEN && !! material.sheenRoughnessMap;\n\n\t\tconst HAS_SPECULARMAP = !! material.specularMap;\n\t\tconst HAS_SPECULAR_COLORMAP = !! material.specularColorMap;\n\t\tconst HAS_SPECULAR_INTENSITYMAP = !! material.specularIntensityMap;\n\n\t\tconst HAS_TRANSMISSIONMAP = HAS_TRANSMISSION && !! material.transmissionMap;\n\t\tconst HAS_THICKNESSMAP = HAS_TRANSMISSION && !! material.thicknessMap;\n\n\t\tconst HAS_GRADIENTMAP = !! material.gradientMap;\n\n\t\tconst HAS_ALPHAMAP = !! material.alphaMap;\n\n\t\tconst HAS_ALPHATEST = material.alphaTest > 0;\n\n\t\tconst HAS_ALPHAHASH = !! material.alphaHash;\n\n\t\tconst HAS_EXTENSIONS = !! material.extensions;\n\n\t\tlet toneMapping = NoToneMapping;\n\n\t\tif ( material.toneMapped ) {\n\n\t\t\tif ( currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\t\t\ttoneMapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst parameters = {\n\n\t\t\tshaderID: shaderID,\n\t\t\tshaderType: material.type,\n\t\t\tshaderName: material.name,\n\n\t\t\tvertexShader: vertexShader,\n\t\t\tfragmentShader: fragmentShader,\n\t\t\tdefines: material.defines,\n\n\t\t\tcustomVertexShaderID: customVertexShaderID,\n\t\t\tcustomFragmentShaderID: customFragmentShaderID,\n\n\t\t\tisRawShaderMaterial: material.isRawShaderMaterial === true,\n\t\t\tglslVersion: material.glslVersion,\n\n\t\t\tprecision: precision,\n\n\t\t\tbatching: IS_BATCHEDMESH,\n\t\t\tbatchingColor: IS_BATCHEDMESH && object._colorsTexture !== null,\n\t\t\tinstancing: IS_INSTANCEDMESH,\n\t\t\tinstancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,\n\t\t\tinstancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,\n\n\t\t\tsupportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,\n\t\t\toutputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace ),\n\t\t\talphaToCoverage: !! material.alphaToCoverage,\n\n\t\t\tmap: HAS_MAP,\n\t\t\tmatcap: HAS_MATCAP,\n\t\t\tenvMap: HAS_ENVMAP,\n\t\t\tenvMapMode: HAS_ENVMAP && envMap.mapping,\n\t\t\tenvMapCubeUVHeight: envMapCubeUVHeight,\n\t\t\taoMap: HAS_AOMAP,\n\t\t\tlightMap: HAS_LIGHTMAP,\n\t\t\tbumpMap: HAS_BUMPMAP,\n\t\t\tnormalMap: HAS_NORMALMAP,\n\t\t\tdisplacementMap: SUPPORTS_VERTEX_TEXTURES && HAS_DISPLACEMENTMAP,\n\t\t\temissiveMap: HAS_EMISSIVEMAP,\n\n\t\t\tnormalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap,\n\t\t\tnormalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap,\n\n\t\t\tmetalnessMap: HAS_METALNESSMAP,\n\t\t\troughnessMap: HAS_ROUGHNESSMAP,\n\n\t\t\tanisotropy: HAS_ANISOTROPY,\n\t\t\tanisotropyMap: HAS_ANISOTROPYMAP,\n\n\t\t\tclearcoat: HAS_CLEARCOAT,\n\t\t\tclearcoatMap: HAS_CLEARCOATMAP,\n\t\t\tclearcoatNormalMap: HAS_CLEARCOAT_NORMALMAP,\n\t\t\tclearcoatRoughnessMap: HAS_CLEARCOAT_ROUGHNESSMAP,\n\n\t\t\tdispersion: HAS_DISPERSION,\n\n\t\t\tiridescence: HAS_IRIDESCENCE,\n\t\t\tiridescenceMap: HAS_IRIDESCENCEMAP,\n\t\t\tiridescenceThicknessMap: HAS_IRIDESCENCE_THICKNESSMAP,\n\n\t\t\tsheen: HAS_SHEEN,\n\t\t\tsheenColorMap: HAS_SHEEN_COLORMAP,\n\t\t\tsheenRoughnessMap: HAS_SHEEN_ROUGHNESSMAP,\n\n\t\t\tspecularMap: HAS_SPECULARMAP,\n\t\t\tspecularColorMap: HAS_SPECULAR_COLORMAP,\n\t\t\tspecularIntensityMap: HAS_SPECULAR_INTENSITYMAP,\n\n\t\t\ttransmission: HAS_TRANSMISSION,\n\t\t\ttransmissionMap: HAS_TRANSMISSIONMAP,\n\t\t\tthicknessMap: HAS_THICKNESSMAP,\n\n\t\t\tgradientMap: HAS_GRADIENTMAP,\n\n\t\t\topaque: material.transparent === false && material.blending === NormalBlending && material.alphaToCoverage === false,\n\n\t\t\talphaMap: HAS_ALPHAMAP,\n\t\t\talphaTest: HAS_ALPHATEST,\n\t\t\talphaHash: HAS_ALPHAHASH,\n\n\t\t\tcombine: material.combine,\n\n\t\t\t//\n\n\t\t\tmapUv: HAS_MAP && getChannel( material.map.channel ),\n\t\t\taoMapUv: HAS_AOMAP && getChannel( material.aoMap.channel ),\n\t\t\tlightMapUv: HAS_LIGHTMAP && getChannel( material.lightMap.channel ),\n\t\t\tbumpMapUv: HAS_BUMPMAP && getChannel( material.bumpMap.channel ),\n\t\t\tnormalMapUv: HAS_NORMALMAP && getChannel( material.normalMap.channel ),\n\t\t\tdisplacementMapUv: HAS_DISPLACEMENTMAP && getChannel( material.displacementMap.channel ),\n\t\t\temissiveMapUv: HAS_EMISSIVEMAP && getChannel( material.emissiveMap.channel ),\n\n\t\t\tmetalnessMapUv: HAS_METALNESSMAP && getChannel( material.metalnessMap.channel ),\n\t\t\troughnessMapUv: HAS_ROUGHNESSMAP && getChannel( material.roughnessMap.channel ),\n\n\t\t\tanisotropyMapUv: HAS_ANISOTROPYMAP && getChannel( material.anisotropyMap.channel ),\n\n\t\t\tclearcoatMapUv: HAS_CLEARCOATMAP && getChannel( material.clearcoatMap.channel ),\n\t\t\tclearcoatNormalMapUv: HAS_CLEARCOAT_NORMALMAP && getChannel( material.clearcoatNormalMap.channel ),\n\t\t\tclearcoatRoughnessMapUv: HAS_CLEARCOAT_ROUGHNESSMAP && getChannel( material.clearcoatRoughnessMap.channel ),\n\n\t\t\tiridescenceMapUv: HAS_IRIDESCENCEMAP && getChannel( material.iridescenceMap.channel ),\n\t\t\tiridescenceThicknessMapUv: HAS_IRIDESCENCE_THICKNESSMAP && getChannel( material.iridescenceThicknessMap.channel ),\n\n\t\t\tsheenColorMapUv: HAS_SHEEN_COLORMAP && getChannel( material.sheenColorMap.channel ),\n\t\t\tsheenRoughnessMapUv: HAS_SHEEN_ROUGHNESSMAP && getChannel( material.sheenRoughnessMap.channel ),\n\n\t\t\tspecularMapUv: HAS_SPECULARMAP && getChannel( material.specularMap.channel ),\n\t\t\tspecularColorMapUv: HAS_SPECULAR_COLORMAP && getChannel( material.specularColorMap.channel ),\n\t\t\tspecularIntensityMapUv: HAS_SPECULAR_INTENSITYMAP && getChannel( material.specularIntensityMap.channel ),\n\n\t\t\ttransmissionMapUv: HAS_TRANSMISSIONMAP && getChannel( material.transmissionMap.channel ),\n\t\t\tthicknessMapUv: HAS_THICKNESSMAP && getChannel( material.thicknessMap.channel ),\n\n\t\t\talphaMapUv: HAS_ALPHAMAP && getChannel( material.alphaMap.channel ),\n\n\t\t\t//\n\n\t\t\tvertexTangents: !! geometry.attributes.tangent && ( HAS_NORMALMAP || HAS_ANISOTROPY ),\n\t\t\tvertexColors: material.vertexColors,\n\t\t\tvertexAlphas: material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4,\n\n\t\t\tpointsUvs: object.isPoints === true && !! geometry.attributes.uv && ( HAS_MAP || HAS_ALPHAMAP ),\n\n\t\t\tfog: !! fog,\n\t\t\tuseFog: material.fog === true,\n\t\t\tfogExp2: ( !! fog && fog.isFogExp2 ),\n\n\t\t\tflatShading: material.flatShading === true,\n\n\t\t\tsizeAttenuation: material.sizeAttenuation === true,\n\t\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\n\t\t\tskinning: object.isSkinnedMesh === true,\n\n\t\t\tmorphTargets: geometry.morphAttributes.position !== undefined,\n\t\t\tmorphNormals: geometry.morphAttributes.normal !== undefined,\n\t\t\tmorphColors: geometry.morphAttributes.color !== undefined,\n\t\t\tmorphTargetsCount: morphTargetsCount,\n\t\t\tmorphTextureStride: morphTextureStride,\n\n\t\t\tnumDirLights: lights.directional.length,\n\t\t\tnumPointLights: lights.point.length,\n\t\t\tnumSpotLights: lights.spot.length,\n\t\t\tnumSpotLightMaps: lights.spotLightMap.length,\n\t\t\tnumRectAreaLights: lights.rectArea.length,\n\t\t\tnumHemiLights: lights.hemi.length,\n\n\t\t\tnumDirLightShadows: lights.directionalShadowMap.length,\n\t\t\tnumPointLightShadows: lights.pointShadowMap.length,\n\t\t\tnumSpotLightShadows: lights.spotShadowMap.length,\n\t\t\tnumSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,\n\n\t\t\tnumLightProbes: lights.numLightProbes,\n\n\t\t\tnumClippingPlanes: clipping.numPlanes,\n\t\t\tnumClipIntersection: clipping.numIntersection,\n\n\t\t\tdithering: material.dithering,\n\n\t\t\tshadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,\n\t\t\tshadowMapType: renderer.shadowMap.type,\n\n\t\t\ttoneMapping: toneMapping,\n\n\t\t\tdecodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( ColorManagement.getTransfer( material.map.colorSpace ) === SRGBTransfer ),\n\n\t\t\tpremultipliedAlpha: material.premultipliedAlpha,\n\n\t\t\tdoubleSided: material.side === DoubleSide,\n\t\t\tflipSided: material.side === BackSide,\n\n\t\t\tuseDepthPacking: material.depthPacking >= 0,\n\t\t\tdepthPacking: material.depthPacking || 0,\n\n\t\t\tindex0AttributeName: material.index0AttributeName,\n\n\t\t\textensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance === true && extensions.has( 'WEBGL_clip_cull_distance' ),\n\t\t\textensionMultiDraw: ( HAS_EXTENSIONS && material.extensions.multiDraw === true || IS_BATCHEDMESH ) && extensions.has( 'WEBGL_multi_draw' ),\n\n\t\t\trendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),\n\n\t\t\tcustomProgramCacheKey: material.customProgramCacheKey()\n\n\t\t};\n\n\t\t// the usage of getChannel() determines the active texture channels for this shader\n\n\t\tparameters.vertexUv1s = _activeChannels.has( 1 );\n\t\tparameters.vertexUv2s = _activeChannels.has( 2 );\n\t\tparameters.vertexUv3s = _activeChannels.has( 3 );\n\n\t\t_activeChannels.clear();\n\n\t\treturn parameters;\n\n\t}\n\n\tfunction getProgramCacheKey( parameters ) {\n\n\t\tconst array = [];\n\n\t\tif ( parameters.shaderID ) {\n\n\t\t\tarray.push( parameters.shaderID );\n\n\t\t} else {\n\n\t\t\tarray.push( parameters.customVertexShaderID );\n\t\t\tarray.push( parameters.customFragmentShaderID );\n\n\t\t}\n\n\t\tif ( parameters.defines !== undefined ) {\n\n\t\t\tfor ( const name in parameters.defines ) {\n\n\t\t\t\tarray.push( name );\n\t\t\t\tarray.push( parameters.defines[ name ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( parameters.isRawShaderMaterial === false ) {\n\n\t\t\tgetProgramCacheKeyParameters( array, parameters );\n\t\t\tgetProgramCacheKeyBooleans( array, parameters );\n\t\t\tarray.push( renderer.outputColorSpace );\n\n\t\t}\n\n\t\tarray.push( parameters.customProgramCacheKey );\n\n\t\treturn array.join();\n\n\t}\n\n\tfunction getProgramCacheKeyParameters( array, parameters ) {\n\n\t\tarray.push( parameters.precision );\n\t\tarray.push( parameters.outputColorSpace );\n\t\tarray.push( parameters.envMapMode );\n\t\tarray.push( parameters.envMapCubeUVHeight );\n\t\tarray.push( parameters.mapUv );\n\t\tarray.push( parameters.alphaMapUv );\n\t\tarray.push( parameters.lightMapUv );\n\t\tarray.push( parameters.aoMapUv );\n\t\tarray.push( parameters.bumpMapUv );\n\t\tarray.push( parameters.normalMapUv );\n\t\tarray.push( parameters.displacementMapUv );\n\t\tarray.push( parameters.emissiveMapUv );\n\t\tarray.push( parameters.metalnessMapUv );\n\t\tarray.push( parameters.roughnessMapUv );\n\t\tarray.push( parameters.anisotropyMapUv );\n\t\tarray.push( parameters.clearcoatMapUv );\n\t\tarray.push( parameters.clearcoatNormalMapUv );\n\t\tarray.push( parameters.clearcoatRoughnessMapUv );\n\t\tarray.push( parameters.iridescenceMapUv );\n\t\tarray.push( parameters.iridescenceThicknessMapUv );\n\t\tarray.push( parameters.sheenColorMapUv );\n\t\tarray.push( parameters.sheenRoughnessMapUv );\n\t\tarray.push( parameters.specularMapUv );\n\t\tarray.push( parameters.specularColorMapUv );\n\t\tarray.push( parameters.specularIntensityMapUv );\n\t\tarray.push( parameters.transmissionMapUv );\n\t\tarray.push( parameters.thicknessMapUv );\n\t\tarray.push( parameters.combine );\n\t\tarray.push( parameters.fogExp2 );\n\t\tarray.push( parameters.sizeAttenuation );\n\t\tarray.push( parameters.morphTargetsCount );\n\t\tarray.push( parameters.morphAttributeCount );\n\t\tarray.push( parameters.numDirLights );\n\t\tarray.push( parameters.numPointLights );\n\t\tarray.push( parameters.numSpotLights );\n\t\tarray.push( parameters.numSpotLightMaps );\n\t\tarray.push( parameters.numHemiLights );\n\t\tarray.push( parameters.numRectAreaLights );\n\t\tarray.push( parameters.numDirLightShadows );\n\t\tarray.push( parameters.numPointLightShadows );\n\t\tarray.push( parameters.numSpotLightShadows );\n\t\tarray.push( parameters.numSpotLightShadowsWithMaps );\n\t\tarray.push( parameters.numLightProbes );\n\t\tarray.push( parameters.shadowMapType );\n\t\tarray.push( parameters.toneMapping );\n\t\tarray.push( parameters.numClippingPlanes );\n\t\tarray.push( parameters.numClipIntersection );\n\t\tarray.push( parameters.depthPacking );\n\n\t}\n\n\tfunction getProgramCacheKeyBooleans( array, parameters ) {\n\n\t\t_programLayers.disableAll();\n\n\t\tif ( parameters.supportsVertexTextures )\n\t\t\t_programLayers.enable( 0 );\n\t\tif ( parameters.instancing )\n\t\t\t_programLayers.enable( 1 );\n\t\tif ( parameters.instancingColor )\n\t\t\t_programLayers.enable( 2 );\n\t\tif ( parameters.instancingMorph )\n\t\t\t_programLayers.enable( 3 );\n\t\tif ( parameters.matcap )\n\t\t\t_programLayers.enable( 4 );\n\t\tif ( parameters.envMap )\n\t\t\t_programLayers.enable( 5 );\n\t\tif ( parameters.normalMapObjectSpace )\n\t\t\t_programLayers.enable( 6 );\n\t\tif ( parameters.normalMapTangentSpace )\n\t\t\t_programLayers.enable( 7 );\n\t\tif ( parameters.clearcoat )\n\t\t\t_programLayers.enable( 8 );\n\t\tif ( parameters.iridescence )\n\t\t\t_programLayers.enable( 9 );\n\t\tif ( parameters.alphaTest )\n\t\t\t_programLayers.enable( 10 );\n\t\tif ( parameters.vertexColors )\n\t\t\t_programLayers.enable( 11 );\n\t\tif ( parameters.vertexAlphas )\n\t\t\t_programLayers.enable( 12 );\n\t\tif ( parameters.vertexUv1s )\n\t\t\t_programLayers.enable( 13 );\n\t\tif ( parameters.vertexUv2s )\n\t\t\t_programLayers.enable( 14 );\n\t\tif ( parameters.vertexUv3s )\n\t\t\t_programLayers.enable( 15 );\n\t\tif ( parameters.vertexTangents )\n\t\t\t_programLayers.enable( 16 );\n\t\tif ( parameters.anisotropy )\n\t\t\t_programLayers.enable( 17 );\n\t\tif ( parameters.alphaHash )\n\t\t\t_programLayers.enable( 18 );\n\t\tif ( parameters.batching )\n\t\t\t_programLayers.enable( 19 );\n\t\tif ( parameters.dispersion )\n\t\t\t_programLayers.enable( 20 );\n\t\tif ( parameters.batchingColor )\n\t\t\t_programLayers.enable( 21 );\n\n\t\tarray.push( _programLayers.mask );\n\t\t_programLayers.disableAll();\n\n\t\tif ( parameters.fog )\n\t\t\t_programLayers.enable( 0 );\n\t\tif ( parameters.useFog )\n\t\t\t_programLayers.enable( 1 );\n\t\tif ( parameters.flatShading )\n\t\t\t_programLayers.enable( 2 );\n\t\tif ( parameters.logarithmicDepthBuffer )\n\t\t\t_programLayers.enable( 3 );\n\t\tif ( parameters.skinning )\n\t\t\t_programLayers.enable( 4 );\n\t\tif ( parameters.morphTargets )\n\t\t\t_programLayers.enable( 5 );\n\t\tif ( parameters.morphNormals )\n\t\t\t_programLayers.enable( 6 );\n\t\tif ( parameters.morphColors )\n\t\t\t_programLayers.enable( 7 );\n\t\tif ( parameters.premultipliedAlpha )\n\t\t\t_programLayers.enable( 8 );\n\t\tif ( parameters.shadowMapEnabled )\n\t\t\t_programLayers.enable( 9 );\n\t\tif ( parameters.doubleSided )\n\t\t\t_programLayers.enable( 10 );\n\t\tif ( parameters.flipSided )\n\t\t\t_programLayers.enable( 11 );\n\t\tif ( parameters.useDepthPacking )\n\t\t\t_programLayers.enable( 12 );\n\t\tif ( parameters.dithering )\n\t\t\t_programLayers.enable( 13 );\n\t\tif ( parameters.transmission )\n\t\t\t_programLayers.enable( 14 );\n\t\tif ( parameters.sheen )\n\t\t\t_programLayers.enable( 15 );\n\t\tif ( parameters.opaque )\n\t\t\t_programLayers.enable( 16 );\n\t\tif ( parameters.pointsUvs )\n\t\t\t_programLayers.enable( 17 );\n\t\tif ( parameters.decodeVideoTexture )\n\t\t\t_programLayers.enable( 18 );\n\t\tif ( parameters.alphaToCoverage )\n\t\t\t_programLayers.enable( 19 );\n\n\t\tarray.push( _programLayers.mask );\n\n\t}\n\n\tfunction getUniforms( material ) {\n\n\t\tconst shaderID = shaderIDs[ material.type ];\n\t\tlet uniforms;\n\n\t\tif ( shaderID ) {\n\n\t\t\tconst shader = ShaderLib[ shaderID ];\n\t\t\tuniforms = UniformsUtils.clone( shader.uniforms );\n\n\t\t} else {\n\n\t\t\tuniforms = material.uniforms;\n\n\t\t}\n\n\t\treturn uniforms;\n\n\t}\n\n\tfunction acquireProgram( parameters, cacheKey ) {\n\n\t\tlet program;\n\n\t\t// Check if code has been already compiled\n\t\tfor ( let p = 0, pl = programs.length; p < pl; p ++ ) {\n\n\t\t\tconst preexistingProgram = programs[ p ];\n\n\t\t\tif ( preexistingProgram.cacheKey === cacheKey ) {\n\n\t\t\t\tprogram = preexistingProgram;\n\t\t\t\t++ program.usedTimes;\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( program === undefined ) {\n\n\t\t\tprogram = new WebGLProgram( renderer, cacheKey, parameters, bindingStates );\n\t\t\tprograms.push( program );\n\n\t\t}\n\n\t\treturn program;\n\n\t}\n\n\tfunction releaseProgram( program ) {\n\n\t\tif ( -- program.usedTimes === 0 ) {\n\n\t\t\t// Remove from unordered set\n\t\t\tconst i = programs.indexOf( program );\n\t\t\tprograms[ i ] = programs[ programs.length - 1 ];\n\t\t\tprograms.pop();\n\n\t\t\t// Free WebGL resources\n\t\t\tprogram.destroy();\n\n\t\t}\n\n\t}\n\n\tfunction releaseShaderCache( material ) {\n\n\t\t_customShaders.remove( material );\n\n\t}\n\n\tfunction dispose() {\n\n\t\t_customShaders.dispose();\n\n\t}\n\n\treturn {\n\t\tgetParameters: getParameters,\n\t\tgetProgramCacheKey: getProgramCacheKey,\n\t\tgetUniforms: getUniforms,\n\t\tacquireProgram: acquireProgram,\n\t\treleaseProgram: releaseProgram,\n\t\treleaseShaderCache: releaseShaderCache,\n\t\t// Exposed for resource monitoring & error feedback via renderer.info:\n\t\tprograms: programs,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction WebGLProperties() {\n\n\tlet properties = new WeakMap();\n\n\tfunction has( object ) {\n\n\t\treturn properties.has( object );\n\n\t}\n\n\tfunction get( object ) {\n\n\t\tlet map = properties.get( object );\n\n\t\tif ( map === undefined ) {\n\n\t\t\tmap = {};\n\t\t\tproperties.set( object, map );\n\n\t\t}\n\n\t\treturn map;\n\n\t}\n\n\tfunction remove( object ) {\n\n\t\tproperties.delete( object );\n\n\t}\n\n\tfunction update( object, key, value ) {\n\n\t\tproperties.get( object )[ key ] = value;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tproperties = new WeakMap();\n\n\t}\n\n\treturn {\n\t\thas: has,\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction painterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.material.id !== b.material.id ) {\n\n\t\treturn a.material.id - b.material.id;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn a.z - b.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\nfunction reversePainterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn b.z - a.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\n\nfunction WebGLRenderList() {\n\n\tconst renderItems = [];\n\tlet renderItemsIndex = 0;\n\n\tconst opaque = [];\n\tconst transmissive = [];\n\tconst transparent = [];\n\n\tfunction init() {\n\n\t\trenderItemsIndex = 0;\n\n\t\topaque.length = 0;\n\t\ttransmissive.length = 0;\n\t\ttransparent.length = 0;\n\n\t}\n\n\tfunction getNextRenderItem( object, geometry, material, groupOrder, z, group ) {\n\n\t\tlet renderItem = renderItems[ renderItemsIndex ];\n\n\t\tif ( renderItem === undefined ) {\n\n\t\t\trenderItem = {\n\t\t\t\tid: object.id,\n\t\t\t\tobject: object,\n\t\t\t\tgeometry: geometry,\n\t\t\t\tmaterial: material,\n\t\t\t\tgroupOrder: groupOrder,\n\t\t\t\trenderOrder: object.renderOrder,\n\t\t\t\tz: z,\n\t\t\t\tgroup: group\n\t\t\t};\n\n\t\t\trenderItems[ renderItemsIndex ] = renderItem;\n\n\t\t} else {\n\n\t\t\trenderItem.id = object.id;\n\t\t\trenderItem.object = object;\n\t\t\trenderItem.geometry = geometry;\n\t\t\trenderItem.material = material;\n\t\t\trenderItem.groupOrder = groupOrder;\n\t\t\trenderItem.renderOrder = object.renderOrder;\n\t\t\trenderItem.z = z;\n\t\t\trenderItem.group = group;\n\n\t\t}\n\n\t\trenderItemsIndex ++;\n\n\t\treturn renderItem;\n\n\t}\n\n\tfunction push( object, geometry, material, groupOrder, z, group ) {\n\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\tif ( material.transmission > 0.0 ) {\n\n\t\t\ttransmissive.push( renderItem );\n\n\t\t} else if ( material.transparent === true ) {\n\n\t\t\ttransparent.push( renderItem );\n\n\t\t} else {\n\n\t\t\topaque.push( renderItem );\n\n\t\t}\n\n\t}\n\n\tfunction unshift( object, geometry, material, groupOrder, z, group ) {\n\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\tif ( material.transmission > 0.0 ) {\n\n\t\t\ttransmissive.unshift( renderItem );\n\n\t\t} else if ( material.transparent === true ) {\n\n\t\t\ttransparent.unshift( renderItem );\n\n\t\t} else {\n\n\t\t\topaque.unshift( renderItem );\n\n\t\t}\n\n\t}\n\n\tfunction sort( customOpaqueSort, customTransparentSort ) {\n\n\t\tif ( opaque.length > 1 ) opaque.sort( customOpaqueSort || painterSortStable );\n\t\tif ( transmissive.length > 1 ) transmissive.sort( customTransparentSort || reversePainterSortStable );\n\t\tif ( transparent.length > 1 ) transparent.sort( customTransparentSort || reversePainterSortStable );\n\n\t}\n\n\tfunction finish() {\n\n\t\t// Clear references from inactive renderItems in the list\n\n\t\tfor ( let i = renderItemsIndex, il = renderItems.length; i < il; i ++ ) {\n\n\t\t\tconst renderItem = renderItems[ i ];\n\n\t\t\tif ( renderItem.id === null ) break;\n\n\t\t\trenderItem.id = null;\n\t\t\trenderItem.object = null;\n\t\t\trenderItem.geometry = null;\n\t\t\trenderItem.material = null;\n\t\t\trenderItem.group = null;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\topaque: opaque,\n\t\ttransmissive: transmissive,\n\t\ttransparent: transparent,\n\n\t\tinit: init,\n\t\tpush: push,\n\t\tunshift: unshift,\n\t\tfinish: finish,\n\n\t\tsort: sort\n\t};\n\n}\n\nfunction WebGLRenderLists() {\n\n\tlet lists = new WeakMap();\n\n\tfunction get( scene, renderCallDepth ) {\n\n\t\tconst listArray = lists.get( scene );\n\t\tlet list;\n\n\t\tif ( listArray === undefined ) {\n\n\t\t\tlist = new WebGLRenderList();\n\t\t\tlists.set( scene, [ list ] );\n\n\t\t} else {\n\n\t\t\tif ( renderCallDepth >= listArray.length ) {\n\n\t\t\t\tlist = new WebGLRenderList();\n\t\t\t\tlistArray.push( list );\n\n\t\t\t} else {\n\n\t\t\t\tlist = listArray[ renderCallDepth ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn list;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tlists = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction UniformsCache() {\n\n\tconst lights = {};\n\n\treturn {\n\n\t\tget: function ( light ) {\n\n\t\t\tif ( lights[ light.id ] !== undefined ) {\n\n\t\t\t\treturn lights[ light.id ];\n\n\t\t\t}\n\n\t\t\tlet uniforms;\n\n\t\t\tswitch ( light.type ) {\n\n\t\t\t\tcase 'DirectionalLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'SpotLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tconeCos: 0,\n\t\t\t\t\t\tpenumbraCos: 0,\n\t\t\t\t\t\tdecay: 0\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'PointLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tdecay: 0\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'HemisphereLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tskyColor: new Color(),\n\t\t\t\t\t\tgroundColor: new Color()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RectAreaLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\thalfWidth: new Vector3(),\n\t\t\t\t\t\thalfHeight: new Vector3()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tlights[ light.id ] = uniforms;\n\n\t\t\treturn uniforms;\n\n\t\t}\n\n\t};\n\n}\n\nfunction ShadowUniformsCache() {\n\n\tconst lights = {};\n\n\treturn {\n\n\t\tget: function ( light ) {\n\n\t\t\tif ( lights[ light.id ] !== undefined ) {\n\n\t\t\t\treturn lights[ light.id ];\n\n\t\t\t}\n\n\t\t\tlet uniforms;\n\n\t\t\tswitch ( light.type ) {\n\n\t\t\t\tcase 'DirectionalLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowIntensity: 1,\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'SpotLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowIntensity: 1,\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'PointLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowIntensity: 1,\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2(),\n\t\t\t\t\t\tshadowCameraNear: 1,\n\t\t\t\t\t\tshadowCameraFar: 1000\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\t// TODO (abelnation): set RectAreaLight shadow uniforms\n\n\t\t\t}\n\n\t\t\tlights[ light.id ] = uniforms;\n\n\t\t\treturn uniforms;\n\n\t\t}\n\n\t};\n\n}\n\n\n\nlet nextVersion = 0;\n\nfunction shadowCastingAndTexturingLightsFirst( lightA, lightB ) {\n\n\treturn ( lightB.castShadow ? 2 : 0 ) - ( lightA.castShadow ? 2 : 0 ) + ( lightB.map ? 1 : 0 ) - ( lightA.map ? 1 : 0 );\n\n}\n\nfunction WebGLLights( extensions ) {\n\n\tconst cache = new UniformsCache();\n\n\tconst shadowCache = ShadowUniformsCache();\n\n\tconst state = {\n\n\t\tversion: 0,\n\n\t\thash: {\n\t\t\tdirectionalLength: - 1,\n\t\t\tpointLength: - 1,\n\t\t\tspotLength: - 1,\n\t\t\trectAreaLength: - 1,\n\t\t\themiLength: - 1,\n\n\t\t\tnumDirectionalShadows: - 1,\n\t\t\tnumPointShadows: - 1,\n\t\t\tnumSpotShadows: - 1,\n\t\t\tnumSpotMaps: - 1,\n\n\t\t\tnumLightProbes: - 1\n\t\t},\n\n\t\tambient: [ 0, 0, 0 ],\n\t\tprobe: [],\n\t\tdirectional: [],\n\t\tdirectionalShadow: [],\n\t\tdirectionalShadowMap: [],\n\t\tdirectionalShadowMatrix: [],\n\t\tspot: [],\n\t\tspotLightMap: [],\n\t\tspotShadow: [],\n\t\tspotShadowMap: [],\n\t\tspotLightMatrix: [],\n\t\trectArea: [],\n\t\trectAreaLTC1: null,\n\t\trectAreaLTC2: null,\n\t\tpoint: [],\n\t\tpointShadow: [],\n\t\tpointShadowMap: [],\n\t\tpointShadowMatrix: [],\n\t\themi: [],\n\t\tnumSpotLightShadowsWithMaps: 0,\n\t\tnumLightProbes: 0\n\n\t};\n\n\tfor ( let i = 0; i < 9; i ++ ) state.probe.push( new Vector3() );\n\n\tconst vector3 = new Vector3();\n\tconst matrix4 = new Matrix4();\n\tconst matrix42 = new Matrix4();\n\n\tfunction setup( lights ) {\n\n\t\tlet r = 0, g = 0, b = 0;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) state.probe[ i ].set( 0, 0, 0 );\n\n\t\tlet directionalLength = 0;\n\t\tlet pointLength = 0;\n\t\tlet spotLength = 0;\n\t\tlet rectAreaLength = 0;\n\t\tlet hemiLength = 0;\n\n\t\tlet numDirectionalShadows = 0;\n\t\tlet numPointShadows = 0;\n\t\tlet numSpotShadows = 0;\n\t\tlet numSpotMaps = 0;\n\t\tlet numSpotShadowsWithMaps = 0;\n\n\t\tlet numLightProbes = 0;\n\n\t\t// ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]\n\t\tlights.sort( shadowCastingAndTexturingLightsFirst );\n\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\n\t\t\tconst color = light.color;\n\t\t\tconst intensity = light.intensity;\n\t\t\tconst distance = light.distance;\n\n\t\t\tconst shadowMap = ( light.shadow && light.shadow.map ) ? light.shadow.map.texture : null;\n\n\t\t\tif ( light.isAmbientLight ) {\n\n\t\t\t\tr += color.r * intensity;\n\t\t\t\tg += color.g * intensity;\n\t\t\t\tb += color.b * intensity;\n\n\t\t\t} else if ( light.isLightProbe ) {\n\n\t\t\t\tfor ( let j = 0; j < 9; j ++ ) {\n\n\t\t\t\t\tstate.probe[ j ].addScaledVector( light.sh.coefficients[ j ], intensity );\n\n\t\t\t\t}\n\n\t\t\t\tnumLightProbes ++;\n\n\t\t\t} else if ( light.isDirectionalLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity );\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowIntensity = shadow.intensity;\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.directionalShadow[ directionalLength ] = shadowUniforms;\n\t\t\t\t\tstate.directionalShadowMap[ directionalLength ] = shadowMap;\n\t\t\t\t\tstate.directionalShadowMatrix[ directionalLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumDirectionalShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.directional[ directionalLength ] = uniforms;\n\n\t\t\t\tdirectionalLength ++;\n\n\t\t\t} else if ( light.isSpotLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity );\n\t\t\t\tuniforms.distance = distance;\n\n\t\t\t\tuniforms.coneCos = Math.cos( light.angle );\n\t\t\t\tuniforms.penumbraCos = Math.cos( light.angle * ( 1 - light.penumbra ) );\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tstate.spot[ spotLength ] = uniforms;\n\n\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\tif ( light.map ) {\n\n\t\t\t\t\tstate.spotLightMap[ numSpotMaps ] = light.map;\n\t\t\t\t\tnumSpotMaps ++;\n\n\t\t\t\t\t// make sure the lightMatrix is up to date\n\t\t\t\t\t// TODO : do it if required only\n\t\t\t\t\tshadow.updateMatrices( light );\n\n\t\t\t\t\tif ( light.castShadow ) numSpotShadowsWithMaps ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.spotLightMatrix[ spotLength ] = shadow.matrix;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowIntensity = shadow.intensity;\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.spotShadow[ spotLength ] = shadowUniforms;\n\t\t\t\t\tstate.spotShadowMap[ spotLength ] = shadowMap;\n\n\t\t\t\t\tnumSpotShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tspotLength ++;\n\n\t\t\t} else if ( light.isRectAreaLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity );\n\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\n\n\t\t\t\tstate.rectArea[ rectAreaLength ] = uniforms;\n\n\t\t\t\trectAreaLength ++;\n\n\t\t\t} else if ( light.isPointLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity );\n\t\t\t\tuniforms.distance = light.distance;\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowIntensity = shadow.intensity;\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\t\t\t\t\tshadowUniforms.shadowCameraNear = shadow.camera.near;\n\t\t\t\t\tshadowUniforms.shadowCameraFar = shadow.camera.far;\n\n\t\t\t\t\tstate.pointShadow[ pointLength ] = shadowUniforms;\n\t\t\t\t\tstate.pointShadowMap[ pointLength ] = shadowMap;\n\t\t\t\t\tstate.pointShadowMatrix[ pointLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumPointShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.point[ pointLength ] = uniforms;\n\n\t\t\t\tpointLength ++;\n\n\t\t\t} else if ( light.isHemisphereLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.skyColor.copy( light.color ).multiplyScalar( intensity );\n\t\t\t\tuniforms.groundColor.copy( light.groundColor ).multiplyScalar( intensity );\n\n\t\t\t\tstate.hemi[ hemiLength ] = uniforms;\n\n\t\t\t\themiLength ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( rectAreaLength > 0 ) {\n\n\t\t\tif ( extensions.has( 'OES_texture_float_linear' ) === true ) {\n\n\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;\n\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;\n\n\t\t\t} else {\n\n\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_HALF_1;\n\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_HALF_2;\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.ambient[ 0 ] = r;\n\t\tstate.ambient[ 1 ] = g;\n\t\tstate.ambient[ 2 ] = b;\n\n\t\tconst hash = state.hash;\n\n\t\tif ( hash.directionalLength !== directionalLength ||\n\t\t\thash.pointLength !== pointLength ||\n\t\t\thash.spotLength !== spotLength ||\n\t\t\thash.rectAreaLength !== rectAreaLength ||\n\t\t\thash.hemiLength !== hemiLength ||\n\t\t\thash.numDirectionalShadows !== numDirectionalShadows ||\n\t\t\thash.numPointShadows !== numPointShadows ||\n\t\t\thash.numSpotShadows !== numSpotShadows ||\n\t\t\thash.numSpotMaps !== numSpotMaps ||\n\t\t\thash.numLightProbes !== numLightProbes ) {\n\n\t\t\tstate.directional.length = directionalLength;\n\t\t\tstate.spot.length = spotLength;\n\t\t\tstate.rectArea.length = rectAreaLength;\n\t\t\tstate.point.length = pointLength;\n\t\t\tstate.hemi.length = hemiLength;\n\n\t\t\tstate.directionalShadow.length = numDirectionalShadows;\n\t\t\tstate.directionalShadowMap.length = numDirectionalShadows;\n\t\t\tstate.pointShadow.length = numPointShadows;\n\t\t\tstate.pointShadowMap.length = numPointShadows;\n\t\t\tstate.spotShadow.length = numSpotShadows;\n\t\t\tstate.spotShadowMap.length = numSpotShadows;\n\t\t\tstate.directionalShadowMatrix.length = numDirectionalShadows;\n\t\t\tstate.pointShadowMatrix.length = numPointShadows;\n\t\t\tstate.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;\n\t\t\tstate.spotLightMap.length = numSpotMaps;\n\t\t\tstate.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;\n\t\t\tstate.numLightProbes = numLightProbes;\n\n\t\t\thash.directionalLength = directionalLength;\n\t\t\thash.pointLength = pointLength;\n\t\t\thash.spotLength = spotLength;\n\t\t\thash.rectAreaLength = rectAreaLength;\n\t\t\thash.hemiLength = hemiLength;\n\n\t\t\thash.numDirectionalShadows = numDirectionalShadows;\n\t\t\thash.numPointShadows = numPointShadows;\n\t\t\thash.numSpotShadows = numSpotShadows;\n\t\t\thash.numSpotMaps = numSpotMaps;\n\n\t\t\thash.numLightProbes = numLightProbes;\n\n\t\t\tstate.version = nextVersion ++;\n\n\t\t}\n\n\t}\n\n\tfunction setupView( lights, camera ) {\n\n\t\tlet directionalLength = 0;\n\t\tlet pointLength = 0;\n\t\tlet spotLength = 0;\n\t\tlet rectAreaLength = 0;\n\t\tlet hemiLength = 0;\n\n\t\tconst viewMatrix = camera.matrixWorldInverse;\n\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\n\t\t\tif ( light.isDirectionalLight ) {\n\n\t\t\t\tconst uniforms = state.directional[ directionalLength ];\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tdirectionalLength ++;\n\n\t\t\t} else if ( light.isSpotLight ) {\n\n\t\t\t\tconst uniforms = state.spot[ spotLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tspotLength ++;\n\n\t\t\t} else if ( light.isRectAreaLight ) {\n\n\t\t\t\tconst uniforms = state.rectArea[ rectAreaLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\t// extract local rotation of light to derive width/height half vectors\n\t\t\t\tmatrix42.identity();\n\t\t\t\tmatrix4.copy( light.matrixWorld );\n\t\t\t\tmatrix4.premultiply( viewMatrix );\n\t\t\t\tmatrix42.extractRotation( matrix4 );\n\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\n\n\t\t\t\tuniforms.halfWidth.applyMatrix4( matrix42 );\n\t\t\t\tuniforms.halfHeight.applyMatrix4( matrix42 );\n\n\t\t\t\trectAreaLength ++;\n\n\t\t\t} else if ( light.isPointLight ) {\n\n\t\t\t\tconst uniforms = state.point[ pointLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tpointLength ++;\n\n\t\t\t} else if ( light.isHemisphereLight ) {\n\n\t\t\t\tconst uniforms = state.hemi[ hemiLength ];\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\themiLength ++;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tsetup: setup,\n\t\tsetupView: setupView,\n\t\tstate: state\n\t};\n\n}\n\nfunction WebGLRenderState( extensions ) {\n\n\tconst lights = new WebGLLights( extensions );\n\n\tconst lightsArray = [];\n\tconst shadowsArray = [];\n\n\tfunction init( camera ) {\n\n\t\tstate.camera = camera;\n\n\t\tlightsArray.length = 0;\n\t\tshadowsArray.length = 0;\n\n\t}\n\n\tfunction pushLight( light ) {\n\n\t\tlightsArray.push( light );\n\n\t}\n\n\tfunction pushShadow( shadowLight ) {\n\n\t\tshadowsArray.push( shadowLight );\n\n\t}\n\n\tfunction setupLights() {\n\n\t\tlights.setup( lightsArray );\n\n\t}\n\n\tfunction setupLightsView( camera ) {\n\n\t\tlights.setupView( lightsArray, camera );\n\n\t}\n\n\tconst state = {\n\t\tlightsArray: lightsArray,\n\t\tshadowsArray: shadowsArray,\n\n\t\tcamera: null,\n\n\t\tlights: lights,\n\n\t\ttransmissionRenderTarget: {}\n\t};\n\n\treturn {\n\t\tinit: init,\n\t\tstate: state,\n\t\tsetupLights: setupLights,\n\t\tsetupLightsView: setupLightsView,\n\n\t\tpushLight: pushLight,\n\t\tpushShadow: pushShadow\n\t};\n\n}\n\nfunction WebGLRenderStates( extensions ) {\n\n\tlet renderStates = new WeakMap();\n\n\tfunction get( scene, renderCallDepth = 0 ) {\n\n\t\tconst renderStateArray = renderStates.get( scene );\n\t\tlet renderState;\n\n\t\tif ( renderStateArray === undefined ) {\n\n\t\t\trenderState = new WebGLRenderState( extensions );\n\t\t\trenderStates.set( scene, [ renderState ] );\n\n\t\t} else {\n\n\t\t\tif ( renderCallDepth >= renderStateArray.length ) {\n\n\t\t\t\trenderState = new WebGLRenderState( extensions );\n\t\t\t\trenderStateArray.push( renderState );\n\n\t\t\t} else {\n\n\t\t\t\trenderState = renderStateArray[ renderCallDepth ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn renderState;\n\n\t}\n\n\tfunction dispose() {\n\n\t\trenderStates = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nclass MeshDepthMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshDepthMaterial = true;\n\n\t\tthis.type = 'MeshDepthMaterial';\n\n\t\tthis.depthPacking = BasicDepthPacking;\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.depthPacking = source.depthPacking;\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshDistanceMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshDistanceMaterial = true;\n\n\t\tthis.type = 'MeshDistanceMaterial';\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst vertex = \"void main() {\\n\\tgl_Position = vec4( position, 1.0 );\\n}\";\n\nconst fragment = \"uniform sampler2D shadow_pass;\\nuniform vec2 resolution;\\nuniform float radius;\\n#include \\nvoid main() {\\n\\tconst float samples = float( VSM_SAMPLES );\\n\\tfloat mean = 0.0;\\n\\tfloat squared_mean = 0.0;\\n\\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\\n\\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\\n\\tfor ( float i = 0.0; i < samples; i ++ ) {\\n\\t\\tfloat uvOffset = uvStart + i * uvStride;\\n\\t\\t#ifdef HORIZONTAL_PASS\\n\\t\\t\\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\\n\\t\\t\\tmean += distribution.x;\\n\\t\\t\\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\\n\\t\\t#else\\n\\t\\t\\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\\n\\t\\t\\tmean += depth;\\n\\t\\t\\tsquared_mean += depth * depth;\\n\\t\\t#endif\\n\\t}\\n\\tmean = mean / samples;\\n\\tsquared_mean = squared_mean / samples;\\n\\tfloat std_dev = sqrt( squared_mean - mean * mean );\\n\\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\\n}\";\n\nfunction WebGLShadowMap( renderer, objects, capabilities ) {\n\n\tlet _frustum = new Frustum();\n\n\tconst _shadowMapSize = new Vector2(),\n\t\t_viewportSize = new Vector2(),\n\n\t\t_viewport = new Vector4(),\n\n\t\t_depthMaterial = new MeshDepthMaterial( { depthPacking: RGBADepthPacking } ),\n\t\t_distanceMaterial = new MeshDistanceMaterial(),\n\n\t\t_materialCache = {},\n\n\t\t_maxTextureSize = capabilities.maxTextureSize;\n\n\tconst shadowSide = { [ FrontSide ]: BackSide, [ BackSide ]: FrontSide, [ DoubleSide ]: DoubleSide };\n\n\tconst shadowMaterialVertical = new ShaderMaterial( {\n\t\tdefines: {\n\t\t\tVSM_SAMPLES: 8\n\t\t},\n\t\tuniforms: {\n\t\t\tshadow_pass: { value: null },\n\t\t\tresolution: { value: new Vector2() },\n\t\t\tradius: { value: 4.0 }\n\t\t},\n\n\t\tvertexShader: vertex,\n\t\tfragmentShader: fragment\n\n\t} );\n\n\tconst shadowMaterialHorizontal = shadowMaterialVertical.clone();\n\tshadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1;\n\n\tconst fullScreenTri = new BufferGeometry();\n\tfullScreenTri.setAttribute(\n\t\t'position',\n\t\tnew BufferAttribute(\n\t\t\tnew Float32Array( [ - 1, - 1, 0.5, 3, - 1, 0.5, - 1, 3, 0.5 ] ),\n\t\t\t3\n\t\t)\n\t);\n\n\tconst fullScreenMesh = new Mesh( fullScreenTri, shadowMaterialVertical );\n\n\tconst scope = this;\n\n\tthis.enabled = false;\n\n\tthis.autoUpdate = true;\n\tthis.needsUpdate = false;\n\n\tthis.type = PCFShadowMap;\n\tlet _previousType = this.type;\n\n\tthis.render = function ( lights, scene, camera ) {\n\n\t\tif ( scope.enabled === false ) return;\n\t\tif ( scope.autoUpdate === false && scope.needsUpdate === false ) return;\n\n\t\tif ( lights.length === 0 ) return;\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\t\tconst activeCubeFace = renderer.getActiveCubeFace();\n\t\tconst activeMipmapLevel = renderer.getActiveMipmapLevel();\n\n\t\tconst _state = renderer.state;\n\n\t\t// Set GL state for depth map.\n\t\t_state.setBlending( NoBlending );\n\t\t_state.buffers.color.setClear( 1, 1, 1, 1 );\n\t\t_state.buffers.depth.setTest( true );\n\t\t_state.setScissorTest( false );\n\n\t\t// check for shadow map type changes\n\n\t\tconst toVSM = ( _previousType !== VSMShadowMap && this.type === VSMShadowMap );\n\t\tconst fromVSM = ( _previousType === VSMShadowMap && this.type !== VSMShadowMap );\n\n\t\t// render depth map\n\n\t\tfor ( let i = 0, il = lights.length; i < il; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\t\t\tconst shadow = light.shadow;\n\n\t\t\tif ( shadow === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLShadowMap:', light, 'has no shadow.' );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( shadow.autoUpdate === false && shadow.needsUpdate === false ) continue;\n\n\t\t\t_shadowMapSize.copy( shadow.mapSize );\n\n\t\t\tconst shadowFrameExtents = shadow.getFrameExtents();\n\n\t\t\t_shadowMapSize.multiply( shadowFrameExtents );\n\n\t\t\t_viewportSize.copy( shadow.mapSize );\n\n\t\t\tif ( _shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize ) {\n\n\t\t\t\tif ( _shadowMapSize.x > _maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.x = Math.floor( _maxTextureSize / shadowFrameExtents.x );\n\t\t\t\t\t_shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x;\n\t\t\t\t\tshadow.mapSize.x = _viewportSize.x;\n\n\t\t\t\t}\n\n\t\t\t\tif ( _shadowMapSize.y > _maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.y = Math.floor( _maxTextureSize / shadowFrameExtents.y );\n\t\t\t\t\t_shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y;\n\t\t\t\t\tshadow.mapSize.y = _viewportSize.y;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( shadow.map === null || toVSM === true || fromVSM === true ) {\n\n\t\t\t\tconst pars = ( this.type !== VSMShadowMap ) ? { minFilter: NearestFilter, magFilter: NearestFilter } : {};\n\n\t\t\t\tif ( shadow.map !== null ) {\n\n\t\t\t\t\tshadow.map.dispose();\n\n\t\t\t\t}\n\n\t\t\t\tshadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );\n\t\t\t\tshadow.map.texture.name = light.name + '.shadowMap';\n\n\t\t\t\tshadow.camera.updateProjectionMatrix();\n\n\t\t\t}\n\n\t\t\trenderer.setRenderTarget( shadow.map );\n\t\t\trenderer.clear();\n\n\t\t\tconst viewportCount = shadow.getViewportCount();\n\n\t\t\tfor ( let vp = 0; vp < viewportCount; vp ++ ) {\n\n\t\t\t\tconst viewport = shadow.getViewport( vp );\n\n\t\t\t\t_viewport.set(\n\t\t\t\t\t_viewportSize.x * viewport.x,\n\t\t\t\t\t_viewportSize.y * viewport.y,\n\t\t\t\t\t_viewportSize.x * viewport.z,\n\t\t\t\t\t_viewportSize.y * viewport.w\n\t\t\t\t);\n\n\t\t\t\t_state.viewport( _viewport );\n\n\t\t\t\tshadow.updateMatrices( light, vp );\n\n\t\t\t\t_frustum = shadow.getFrustum();\n\n\t\t\t\trenderObject( scene, camera, shadow.camera, light, this.type );\n\n\t\t\t}\n\n\t\t\t// do blur pass for VSM\n\n\t\t\tif ( shadow.isPointLightShadow !== true && this.type === VSMShadowMap ) {\n\n\t\t\t\tVSMPass( shadow, camera );\n\n\t\t\t}\n\n\t\t\tshadow.needsUpdate = false;\n\n\t\t}\n\n\t\t_previousType = this.type;\n\n\t\tscope.needsUpdate = false;\n\n\t\trenderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipmapLevel );\n\n\t};\n\n\tfunction VSMPass( shadow, camera ) {\n\n\t\tconst geometry = objects.update( fullScreenMesh );\n\n\t\tif ( shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples ) {\n\n\t\t\tshadowMaterialVertical.defines.VSM_SAMPLES = shadow.blurSamples;\n\t\t\tshadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples;\n\n\t\t\tshadowMaterialVertical.needsUpdate = true;\n\t\t\tshadowMaterialHorizontal.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( shadow.mapPass === null ) {\n\n\t\t\tshadow.mapPass = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y );\n\n\t\t}\n\n\t\t// vertical pass\n\n\t\tshadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;\n\t\tshadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialVertical.uniforms.radius.value = shadow.radius;\n\t\trenderer.setRenderTarget( shadow.mapPass );\n\t\trenderer.clear();\n\t\trenderer.renderBufferDirect( camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null );\n\n\t\t// horizontal pass\n\n\t\tshadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;\n\t\tshadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialHorizontal.uniforms.radius.value = shadow.radius;\n\t\trenderer.setRenderTarget( shadow.map );\n\t\trenderer.clear();\n\t\trenderer.renderBufferDirect( camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null );\n\n\t}\n\n\tfunction getDepthMaterial( object, material, light, type ) {\n\n\t\tlet result = null;\n\n\t\tconst customMaterial = ( light.isPointLight === true ) ? object.customDistanceMaterial : object.customDepthMaterial;\n\n\t\tif ( customMaterial !== undefined ) {\n\n\t\t\tresult = customMaterial;\n\n\t\t} else {\n\n\t\t\tresult = ( light.isPointLight === true ) ? _distanceMaterial : _depthMaterial;\n\n\t\t\tif ( ( renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||\n\t\t\t\t( material.displacementMap && material.displacementScale !== 0 ) ||\n\t\t\t\t( material.alphaMap && material.alphaTest > 0 ) ||\n\t\t\t\t( material.map && material.alphaTest > 0 ) ) {\n\n\t\t\t\t// in this case we need a unique material instance reflecting the\n\t\t\t\t// appropriate state\n\n\t\t\t\tconst keyA = result.uuid, keyB = material.uuid;\n\n\t\t\t\tlet materialsForVariant = _materialCache[ keyA ];\n\n\t\t\t\tif ( materialsForVariant === undefined ) {\n\n\t\t\t\t\tmaterialsForVariant = {};\n\t\t\t\t\t_materialCache[ keyA ] = materialsForVariant;\n\n\t\t\t\t}\n\n\t\t\t\tlet cachedMaterial = materialsForVariant[ keyB ];\n\n\t\t\t\tif ( cachedMaterial === undefined ) {\n\n\t\t\t\t\tcachedMaterial = result.clone();\n\t\t\t\t\tmaterialsForVariant[ keyB ] = cachedMaterial;\n\t\t\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\n\n\t\t\t\t}\n\n\t\t\t\tresult = cachedMaterial;\n\n\t\t\t}\n\n\t\t}\n\n\t\tresult.visible = material.visible;\n\t\tresult.wireframe = material.wireframe;\n\n\t\tif ( type === VSMShadowMap ) {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : material.side;\n\n\t\t} else {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : shadowSide[ material.side ];\n\n\t\t}\n\n\t\tresult.alphaMap = material.alphaMap;\n\t\tresult.alphaTest = material.alphaTest;\n\t\tresult.map = material.map;\n\n\t\tresult.clipShadows = material.clipShadows;\n\t\tresult.clippingPlanes = material.clippingPlanes;\n\t\tresult.clipIntersection = material.clipIntersection;\n\n\t\tresult.displacementMap = material.displacementMap;\n\t\tresult.displacementScale = material.displacementScale;\n\t\tresult.displacementBias = material.displacementBias;\n\n\t\tresult.wireframeLinewidth = material.wireframeLinewidth;\n\t\tresult.linewidth = material.linewidth;\n\n\t\tif ( light.isPointLight === true && result.isMeshDistanceMaterial === true ) {\n\n\t\t\tconst materialProperties = renderer.properties.get( result );\n\t\t\tmaterialProperties.light = light;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tfunction renderObject( object, camera, shadowCamera, light, type ) {\n\n\t\tif ( object.visible === false ) return;\n\n\t\tconst visible = object.layers.test( camera.layers );\n\n\t\tif ( visible && ( object.isMesh || object.isLine || object.isPoints ) ) {\n\n\t\t\tif ( ( object.castShadow || ( object.receiveShadow && type === VSMShadowMap ) ) && ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) ) {\n\n\t\t\t\tobject.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld );\n\n\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\tconst material = object.material;\n\n\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\tconst groups = geometry.groups;\n\n\t\t\t\t\tfor ( let k = 0, kl = groups.length; k < kl; k ++ ) {\n\n\t\t\t\t\t\tconst group = groups[ k ];\n\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, groupMaterial, light, type );\n\n\t\t\t\t\t\t\tobject.onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, group );\n\n\t\t\t\t\t\t\trenderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );\n\n\t\t\t\t\t\t\tobject.onAfterShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, group );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, material, light, type );\n\n\t\t\t\t\tobject.onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, null );\n\n\t\t\t\t\trenderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );\n\n\t\t\t\t\tobject.onAfterShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, null );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\trenderObject( children[ i ], camera, shadowCamera, light, type );\n\n\t\t}\n\n\t}\n\n\tfunction onMaterialDispose( event ) {\n\n\t\tconst material = event.target;\n\n\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\n\n\t\t// make sure to remove the unique distance/depth materials used for shadow map rendering\n\n\t\tfor ( const id in _materialCache ) {\n\n\t\t\tconst cache = _materialCache[ id ];\n\n\t\t\tconst uuid = event.target.uuid;\n\n\t\t\tif ( uuid in cache ) {\n\n\t\t\t\tconst shadowMaterial = cache[ uuid ];\n\t\t\t\tshadowMaterial.dispose();\n\t\t\t\tdelete cache[ uuid ];\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction WebGLState( gl ) {\n\n\tfunction ColorBuffer() {\n\n\t\tlet locked = false;\n\n\t\tconst color = new Vector4();\n\t\tlet currentColorMask = null;\n\t\tconst currentColorClear = new Vector4( 0, 0, 0, 0 );\n\n\t\treturn {\n\n\t\t\tsetMask: function ( colorMask ) {\n\n\t\t\t\tif ( currentColorMask !== colorMask && ! locked ) {\n\n\t\t\t\t\tgl.colorMask( colorMask, colorMask, colorMask, colorMask );\n\t\t\t\t\tcurrentColorMask = colorMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( r, g, b, a, premultipliedAlpha ) {\n\n\t\t\t\tif ( premultipliedAlpha === true ) {\n\n\t\t\t\t\tr *= a; g *= a; b *= a;\n\n\t\t\t\t}\n\n\t\t\t\tcolor.set( r, g, b, a );\n\n\t\t\t\tif ( currentColorClear.equals( color ) === false ) {\n\n\t\t\t\t\tgl.clearColor( r, g, b, a );\n\t\t\t\t\tcurrentColorClear.copy( color );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentColorMask = null;\n\t\t\t\tcurrentColorClear.set( - 1, 0, 0, 0 ); // set to invalid state\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction DepthBuffer() {\n\n\t\tlet locked = false;\n\n\t\tlet currentDepthMask = null;\n\t\tlet currentDepthFunc = null;\n\t\tlet currentDepthClear = null;\n\n\t\treturn {\n\n\t\t\tsetTest: function ( depthTest ) {\n\n\t\t\t\tif ( depthTest ) {\n\n\t\t\t\t\tenable( gl.DEPTH_TEST );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdisable( gl.DEPTH_TEST );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( depthMask ) {\n\n\t\t\t\tif ( currentDepthMask !== depthMask && ! locked ) {\n\n\t\t\t\t\tgl.depthMask( depthMask );\n\t\t\t\t\tcurrentDepthMask = depthMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( depthFunc ) {\n\n\t\t\t\tif ( currentDepthFunc !== depthFunc ) {\n\n\t\t\t\t\tswitch ( depthFunc ) {\n\n\t\t\t\t\t\tcase NeverDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.NEVER );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AlwaysDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.ALWAYS );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase LessDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LESS );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase LessEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase EqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.EQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase GreaterEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.GEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase GreaterDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.GREATER );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase NotEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.NOTEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrentDepthFunc = depthFunc;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( depth ) {\n\n\t\t\t\tif ( currentDepthClear !== depth ) {\n\n\t\t\t\t\tgl.clearDepth( depth );\n\t\t\t\t\tcurrentDepthClear = depth;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentDepthMask = null;\n\t\t\t\tcurrentDepthFunc = null;\n\t\t\t\tcurrentDepthClear = null;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction StencilBuffer() {\n\n\t\tlet locked = false;\n\n\t\tlet currentStencilMask = null;\n\t\tlet currentStencilFunc = null;\n\t\tlet currentStencilRef = null;\n\t\tlet currentStencilFuncMask = null;\n\t\tlet currentStencilFail = null;\n\t\tlet currentStencilZFail = null;\n\t\tlet currentStencilZPass = null;\n\t\tlet currentStencilClear = null;\n\n\t\treturn {\n\n\t\t\tsetTest: function ( stencilTest ) {\n\n\t\t\t\tif ( ! locked ) {\n\n\t\t\t\t\tif ( stencilTest ) {\n\n\t\t\t\t\t\tenable( gl.STENCIL_TEST );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tdisable( gl.STENCIL_TEST );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( stencilMask ) {\n\n\t\t\t\tif ( currentStencilMask !== stencilMask && ! locked ) {\n\n\t\t\t\t\tgl.stencilMask( stencilMask );\n\t\t\t\t\tcurrentStencilMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( stencilFunc, stencilRef, stencilMask ) {\n\n\t\t\t\tif ( currentStencilFunc !== stencilFunc ||\n\t\t\t\t currentStencilRef !== stencilRef ||\n\t\t\t\t currentStencilFuncMask !== stencilMask ) {\n\n\t\t\t\t\tgl.stencilFunc( stencilFunc, stencilRef, stencilMask );\n\n\t\t\t\t\tcurrentStencilFunc = stencilFunc;\n\t\t\t\t\tcurrentStencilRef = stencilRef;\n\t\t\t\t\tcurrentStencilFuncMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetOp: function ( stencilFail, stencilZFail, stencilZPass ) {\n\n\t\t\t\tif ( currentStencilFail !== stencilFail ||\n\t\t\t\t currentStencilZFail !== stencilZFail ||\n\t\t\t\t currentStencilZPass !== stencilZPass ) {\n\n\t\t\t\t\tgl.stencilOp( stencilFail, stencilZFail, stencilZPass );\n\n\t\t\t\t\tcurrentStencilFail = stencilFail;\n\t\t\t\t\tcurrentStencilZFail = stencilZFail;\n\t\t\t\t\tcurrentStencilZPass = stencilZPass;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( stencil ) {\n\n\t\t\t\tif ( currentStencilClear !== stencil ) {\n\n\t\t\t\t\tgl.clearStencil( stencil );\n\t\t\t\t\tcurrentStencilClear = stencil;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentStencilMask = null;\n\t\t\t\tcurrentStencilFunc = null;\n\t\t\t\tcurrentStencilRef = null;\n\t\t\t\tcurrentStencilFuncMask = null;\n\t\t\t\tcurrentStencilFail = null;\n\t\t\t\tcurrentStencilZFail = null;\n\t\t\t\tcurrentStencilZPass = null;\n\t\t\t\tcurrentStencilClear = null;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t//\n\n\tconst colorBuffer = new ColorBuffer();\n\tconst depthBuffer = new DepthBuffer();\n\tconst stencilBuffer = new StencilBuffer();\n\n\tconst uboBindings = new WeakMap();\n\tconst uboProgramMap = new WeakMap();\n\n\tlet enabledCapabilities = {};\n\n\tlet currentBoundFramebuffers = {};\n\tlet currentDrawbuffers = new WeakMap();\n\tlet defaultDrawbuffers = [];\n\n\tlet currentProgram = null;\n\n\tlet currentBlendingEnabled = false;\n\tlet currentBlending = null;\n\tlet currentBlendEquation = null;\n\tlet currentBlendSrc = null;\n\tlet currentBlendDst = null;\n\tlet currentBlendEquationAlpha = null;\n\tlet currentBlendSrcAlpha = null;\n\tlet currentBlendDstAlpha = null;\n\tlet currentBlendColor = new Color( 0, 0, 0 );\n\tlet currentBlendAlpha = 0;\n\tlet currentPremultipledAlpha = false;\n\n\tlet currentFlipSided = null;\n\tlet currentCullFace = null;\n\n\tlet currentLineWidth = null;\n\n\tlet currentPolygonOffsetFactor = null;\n\tlet currentPolygonOffsetUnits = null;\n\n\tconst maxTextures = gl.getParameter( gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS );\n\n\tlet lineWidthAvailable = false;\n\tlet version = 0;\n\tconst glVersion = gl.getParameter( gl.VERSION );\n\n\tif ( glVersion.indexOf( 'WebGL' ) !== - 1 ) {\n\n\t\tversion = parseFloat( /^WebGL (\\d)/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 1.0 );\n\n\t} else if ( glVersion.indexOf( 'OpenGL ES' ) !== - 1 ) {\n\n\t\tversion = parseFloat( /^OpenGL ES (\\d)/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 2.0 );\n\n\t}\n\n\tlet currentTextureSlot = null;\n\tlet currentBoundTextures = {};\n\n\tconst scissorParam = gl.getParameter( gl.SCISSOR_BOX );\n\tconst viewportParam = gl.getParameter( gl.VIEWPORT );\n\n\tconst currentScissor = new Vector4().fromArray( scissorParam );\n\tconst currentViewport = new Vector4().fromArray( viewportParam );\n\n\tfunction createTexture( type, target, count, dimensions ) {\n\n\t\tconst data = new Uint8Array( 4 ); // 4 is required to match default unpack alignment of 4.\n\t\tconst texture = gl.createTexture();\n\n\t\tgl.bindTexture( type, texture );\n\t\tgl.texParameteri( type, gl.TEXTURE_MIN_FILTER, gl.NEAREST );\n\t\tgl.texParameteri( type, gl.TEXTURE_MAG_FILTER, gl.NEAREST );\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tif ( type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\tgl.texImage3D( target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );\n\n\t\t\t} else {\n\n\t\t\t\tgl.texImage2D( target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tconst emptyTextures = {};\n\temptyTextures[ gl.TEXTURE_2D ] = createTexture( gl.TEXTURE_2D, gl.TEXTURE_2D, 1 );\n\temptyTextures[ gl.TEXTURE_CUBE_MAP ] = createTexture( gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6 );\n\temptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );\n\temptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );\n\n\t// init\n\n\tcolorBuffer.setClear( 0, 0, 0, 1 );\n\tdepthBuffer.setClear( 1 );\n\tstencilBuffer.setClear( 0 );\n\n\tenable( gl.DEPTH_TEST );\n\tdepthBuffer.setFunc( LessEqualDepth );\n\n\tsetFlipSided( false );\n\tsetCullFace( CullFaceBack );\n\tenable( gl.CULL_FACE );\n\n\tsetBlending( NoBlending );\n\n\t//\n\n\tfunction enable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== true ) {\n\n\t\t\tgl.enable( id );\n\t\t\tenabledCapabilities[ id ] = true;\n\n\t\t}\n\n\t}\n\n\tfunction disable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== false ) {\n\n\t\t\tgl.disable( id );\n\t\t\tenabledCapabilities[ id ] = false;\n\n\t\t}\n\n\t}\n\n\tfunction bindFramebuffer( target, framebuffer ) {\n\n\t\tif ( currentBoundFramebuffers[ target ] !== framebuffer ) {\n\n\t\t\tgl.bindFramebuffer( target, framebuffer );\n\n\t\t\tcurrentBoundFramebuffers[ target ] = framebuffer;\n\n\t\t\t// gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER\n\n\t\t\tif ( target === gl.DRAW_FRAMEBUFFER ) {\n\n\t\t\t\tcurrentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;\n\n\t\t\t}\n\n\t\t\tif ( target === gl.FRAMEBUFFER ) {\n\n\t\t\t\tcurrentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tfunction drawBuffers( renderTarget, framebuffer ) {\n\n\t\tlet drawBuffers = defaultDrawbuffers;\n\n\t\tlet needsUpdate = false;\n\n\t\tif ( renderTarget ) {\n\n\t\t\tdrawBuffers = currentDrawbuffers.get( framebuffer );\n\n\t\t\tif ( drawBuffers === undefined ) {\n\n\t\t\t\tdrawBuffers = [];\n\t\t\t\tcurrentDrawbuffers.set( framebuffer, drawBuffers );\n\n\t\t\t}\n\n\t\t\tconst textures = renderTarget.textures;\n\n\t\t\tif ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {\n\n\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\tdrawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;\n\n\t\t\t\t}\n\n\t\t\t\tdrawBuffers.length = textures.length;\n\n\t\t\t\tneedsUpdate = true;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( drawBuffers[ 0 ] !== gl.BACK ) {\n\n\t\t\t\tdrawBuffers[ 0 ] = gl.BACK;\n\n\t\t\t\tneedsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( needsUpdate ) {\n\n\t\t\tgl.drawBuffers( drawBuffers );\n\n\t\t}\n\n\t}\n\n\tfunction useProgram( program ) {\n\n\t\tif ( currentProgram !== program ) {\n\n\t\t\tgl.useProgram( program );\n\n\t\t\tcurrentProgram = program;\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tconst equationToGL = {\n\t\t[ AddEquation ]: gl.FUNC_ADD,\n\t\t[ SubtractEquation ]: gl.FUNC_SUBTRACT,\n\t\t[ ReverseSubtractEquation ]: gl.FUNC_REVERSE_SUBTRACT\n\t};\n\n\tequationToGL[ MinEquation ] = gl.MIN;\n\tequationToGL[ MaxEquation ] = gl.MAX;\n\n\tconst factorToGL = {\n\t\t[ ZeroFactor ]: gl.ZERO,\n\t\t[ OneFactor ]: gl.ONE,\n\t\t[ SrcColorFactor ]: gl.SRC_COLOR,\n\t\t[ SrcAlphaFactor ]: gl.SRC_ALPHA,\n\t\t[ SrcAlphaSaturateFactor ]: gl.SRC_ALPHA_SATURATE,\n\t\t[ DstColorFactor ]: gl.DST_COLOR,\n\t\t[ DstAlphaFactor ]: gl.DST_ALPHA,\n\t\t[ OneMinusSrcColorFactor ]: gl.ONE_MINUS_SRC_COLOR,\n\t\t[ OneMinusSrcAlphaFactor ]: gl.ONE_MINUS_SRC_ALPHA,\n\t\t[ OneMinusDstColorFactor ]: gl.ONE_MINUS_DST_COLOR,\n\t\t[ OneMinusDstAlphaFactor ]: gl.ONE_MINUS_DST_ALPHA,\n\t\t[ ConstantColorFactor ]: gl.CONSTANT_COLOR,\n\t\t[ OneMinusConstantColorFactor ]: gl.ONE_MINUS_CONSTANT_COLOR,\n\t\t[ ConstantAlphaFactor ]: gl.CONSTANT_ALPHA,\n\t\t[ OneMinusConstantAlphaFactor ]: gl.ONE_MINUS_CONSTANT_ALPHA\n\t};\n\n\tfunction setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, blendColor, blendAlpha, premultipliedAlpha ) {\n\n\t\tif ( blending === NoBlending ) {\n\n\t\t\tif ( currentBlendingEnabled === true ) {\n\n\t\t\t\tdisable( gl.BLEND );\n\t\t\t\tcurrentBlendingEnabled = false;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( currentBlendingEnabled === false ) {\n\n\t\t\tenable( gl.BLEND );\n\t\t\tcurrentBlendingEnabled = true;\n\n\t\t}\n\n\t\tif ( blending !== CustomBlending ) {\n\n\t\t\tif ( blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha ) {\n\n\t\t\t\tif ( currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation ) {\n\n\t\t\t\t\tgl.blendEquation( gl.FUNC_ADD );\n\n\t\t\t\t\tcurrentBlendEquation = AddEquation;\n\t\t\t\t\tcurrentBlendEquationAlpha = AddEquation;\n\n\t\t\t\t}\n\n\t\t\t\tif ( premultipliedAlpha ) {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.ONE, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.SRC_ALPHA, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.ZERO, gl.SRC_COLOR );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tcurrentBlendSrc = null;\n\t\t\t\tcurrentBlendDst = null;\n\t\t\t\tcurrentBlendSrcAlpha = null;\n\t\t\t\tcurrentBlendDstAlpha = null;\n\t\t\t\tcurrentBlendColor.set( 0, 0, 0 );\n\t\t\t\tcurrentBlendAlpha = 0;\n\n\t\t\t\tcurrentBlending = blending;\n\t\t\t\tcurrentPremultipledAlpha = premultipliedAlpha;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// custom blending\n\n\t\tblendEquationAlpha = blendEquationAlpha || blendEquation;\n\t\tblendSrcAlpha = blendSrcAlpha || blendSrc;\n\t\tblendDstAlpha = blendDstAlpha || blendDst;\n\n\t\tif ( blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha ) {\n\n\t\t\tgl.blendEquationSeparate( equationToGL[ blendEquation ], equationToGL[ blendEquationAlpha ] );\n\n\t\t\tcurrentBlendEquation = blendEquation;\n\t\t\tcurrentBlendEquationAlpha = blendEquationAlpha;\n\n\t\t}\n\n\t\tif ( blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha ) {\n\n\t\t\tgl.blendFuncSeparate( factorToGL[ blendSrc ], factorToGL[ blendDst ], factorToGL[ blendSrcAlpha ], factorToGL[ blendDstAlpha ] );\n\n\t\t\tcurrentBlendSrc = blendSrc;\n\t\t\tcurrentBlendDst = blendDst;\n\t\t\tcurrentBlendSrcAlpha = blendSrcAlpha;\n\t\t\tcurrentBlendDstAlpha = blendDstAlpha;\n\n\t\t}\n\n\t\tif ( blendColor.equals( currentBlendColor ) === false || blendAlpha !== currentBlendAlpha ) {\n\n\t\t\tgl.blendColor( blendColor.r, blendColor.g, blendColor.b, blendAlpha );\n\n\t\t\tcurrentBlendColor.copy( blendColor );\n\t\t\tcurrentBlendAlpha = blendAlpha;\n\n\t\t}\n\n\t\tcurrentBlending = blending;\n\t\tcurrentPremultipledAlpha = false;\n\n\t}\n\n\tfunction setMaterial( material, frontFaceCW ) {\n\n\t\tmaterial.side === DoubleSide\n\t\t\t? disable( gl.CULL_FACE )\n\t\t\t: enable( gl.CULL_FACE );\n\n\t\tlet flipSided = ( material.side === BackSide );\n\t\tif ( frontFaceCW ) flipSided = ! flipSided;\n\n\t\tsetFlipSided( flipSided );\n\n\t\t( material.blending === NormalBlending && material.transparent === false )\n\t\t\t? setBlending( NoBlending )\n\t\t\t: setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.blendColor, material.blendAlpha, material.premultipliedAlpha );\n\n\t\tdepthBuffer.setFunc( material.depthFunc );\n\t\tdepthBuffer.setTest( material.depthTest );\n\t\tdepthBuffer.setMask( material.depthWrite );\n\t\tcolorBuffer.setMask( material.colorWrite );\n\n\t\tconst stencilWrite = material.stencilWrite;\n\t\tstencilBuffer.setTest( stencilWrite );\n\t\tif ( stencilWrite ) {\n\n\t\t\tstencilBuffer.setMask( material.stencilWriteMask );\n\t\t\tstencilBuffer.setFunc( material.stencilFunc, material.stencilRef, material.stencilFuncMask );\n\t\t\tstencilBuffer.setOp( material.stencilFail, material.stencilZFail, material.stencilZPass );\n\n\t\t}\n\n\t\tsetPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );\n\n\t\tmaterial.alphaToCoverage === true\n\t\t\t? enable( gl.SAMPLE_ALPHA_TO_COVERAGE )\n\t\t\t: disable( gl.SAMPLE_ALPHA_TO_COVERAGE );\n\n\t}\n\n\t//\n\n\tfunction setFlipSided( flipSided ) {\n\n\t\tif ( currentFlipSided !== flipSided ) {\n\n\t\t\tif ( flipSided ) {\n\n\t\t\t\tgl.frontFace( gl.CW );\n\n\t\t\t} else {\n\n\t\t\t\tgl.frontFace( gl.CCW );\n\n\t\t\t}\n\n\t\t\tcurrentFlipSided = flipSided;\n\n\t\t}\n\n\t}\n\n\tfunction setCullFace( cullFace ) {\n\n\t\tif ( cullFace !== CullFaceNone ) {\n\n\t\t\tenable( gl.CULL_FACE );\n\n\t\t\tif ( cullFace !== currentCullFace ) {\n\n\t\t\t\tif ( cullFace === CullFaceBack ) {\n\n\t\t\t\t\tgl.cullFace( gl.BACK );\n\n\t\t\t\t} else if ( cullFace === CullFaceFront ) {\n\n\t\t\t\t\tgl.cullFace( gl.FRONT );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tgl.cullFace( gl.FRONT_AND_BACK );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( gl.CULL_FACE );\n\n\t\t}\n\n\t\tcurrentCullFace = cullFace;\n\n\t}\n\n\tfunction setLineWidth( width ) {\n\n\t\tif ( width !== currentLineWidth ) {\n\n\t\t\tif ( lineWidthAvailable ) gl.lineWidth( width );\n\n\t\t\tcurrentLineWidth = width;\n\n\t\t}\n\n\t}\n\n\tfunction setPolygonOffset( polygonOffset, factor, units ) {\n\n\t\tif ( polygonOffset ) {\n\n\t\t\tenable( gl.POLYGON_OFFSET_FILL );\n\n\t\t\tif ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) {\n\n\t\t\t\tgl.polygonOffset( factor, units );\n\n\t\t\t\tcurrentPolygonOffsetFactor = factor;\n\t\t\t\tcurrentPolygonOffsetUnits = units;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( gl.POLYGON_OFFSET_FILL );\n\n\t\t}\n\n\t}\n\n\tfunction setScissorTest( scissorTest ) {\n\n\t\tif ( scissorTest ) {\n\n\t\t\tenable( gl.SCISSOR_TEST );\n\n\t\t} else {\n\n\t\t\tdisable( gl.SCISSOR_TEST );\n\n\t\t}\n\n\t}\n\n\t// texture\n\n\tfunction activeTexture( webglSlot ) {\n\n\t\tif ( webglSlot === undefined ) webglSlot = gl.TEXTURE0 + maxTextures - 1;\n\n\t\tif ( currentTextureSlot !== webglSlot ) {\n\n\t\t\tgl.activeTexture( webglSlot );\n\t\t\tcurrentTextureSlot = webglSlot;\n\n\t\t}\n\n\t}\n\n\tfunction bindTexture( webglType, webglTexture, webglSlot ) {\n\n\t\tif ( webglSlot === undefined ) {\n\n\t\t\tif ( currentTextureSlot === null ) {\n\n\t\t\t\twebglSlot = gl.TEXTURE0 + maxTextures - 1;\n\n\t\t\t} else {\n\n\t\t\t\twebglSlot = currentTextureSlot;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet boundTexture = currentBoundTextures[ webglSlot ];\n\n\t\tif ( boundTexture === undefined ) {\n\n\t\t\tboundTexture = { type: undefined, texture: undefined };\n\t\t\tcurrentBoundTextures[ webglSlot ] = boundTexture;\n\n\t\t}\n\n\t\tif ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) {\n\n\t\t\tif ( currentTextureSlot !== webglSlot ) {\n\n\t\t\t\tgl.activeTexture( webglSlot );\n\t\t\t\tcurrentTextureSlot = webglSlot;\n\n\t\t\t}\n\n\t\t\tgl.bindTexture( webglType, webglTexture || emptyTextures[ webglType ] );\n\n\t\t\tboundTexture.type = webglType;\n\t\t\tboundTexture.texture = webglTexture;\n\n\t\t}\n\n\t}\n\n\tfunction unbindTexture() {\n\n\t\tconst boundTexture = currentBoundTextures[ currentTextureSlot ];\n\n\t\tif ( boundTexture !== undefined && boundTexture.type !== undefined ) {\n\n\t\t\tgl.bindTexture( boundTexture.type, null );\n\n\t\t\tboundTexture.type = undefined;\n\t\t\tboundTexture.texture = undefined;\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texSubImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texSubImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texSubImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texSubImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexSubImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexSubImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexSubImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexSubImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texStorage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texStorage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texStorage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texStorage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction scissor( scissor ) {\n\n\t\tif ( currentScissor.equals( scissor ) === false ) {\n\n\t\t\tgl.scissor( scissor.x, scissor.y, scissor.z, scissor.w );\n\t\t\tcurrentScissor.copy( scissor );\n\n\t\t}\n\n\t}\n\n\tfunction viewport( viewport ) {\n\n\t\tif ( currentViewport.equals( viewport ) === false ) {\n\n\t\t\tgl.viewport( viewport.x, viewport.y, viewport.z, viewport.w );\n\t\t\tcurrentViewport.copy( viewport );\n\n\t\t}\n\n\t}\n\n\tfunction updateUBOMapping( uniformsGroup, program ) {\n\n\t\tlet mapping = uboProgramMap.get( program );\n\n\t\tif ( mapping === undefined ) {\n\n\t\t\tmapping = new WeakMap();\n\n\t\t\tuboProgramMap.set( program, mapping );\n\n\t\t}\n\n\t\tlet blockIndex = mapping.get( uniformsGroup );\n\n\t\tif ( blockIndex === undefined ) {\n\n\t\t\tblockIndex = gl.getUniformBlockIndex( program, uniformsGroup.name );\n\n\t\t\tmapping.set( uniformsGroup, blockIndex );\n\n\t\t}\n\n\t}\n\n\tfunction uniformBlockBinding( uniformsGroup, program ) {\n\n\t\tconst mapping = uboProgramMap.get( program );\n\t\tconst blockIndex = mapping.get( uniformsGroup );\n\n\t\tif ( uboBindings.get( program ) !== blockIndex ) {\n\n\t\t\t// bind shader specific block index to global block point\n\t\t\tgl.uniformBlockBinding( program, blockIndex, uniformsGroup.__bindingPointIndex );\n\n\t\t\tuboBindings.set( program, blockIndex );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction reset() {\n\n\t\t// reset state\n\n\t\tgl.disable( gl.BLEND );\n\t\tgl.disable( gl.CULL_FACE );\n\t\tgl.disable( gl.DEPTH_TEST );\n\t\tgl.disable( gl.POLYGON_OFFSET_FILL );\n\t\tgl.disable( gl.SCISSOR_TEST );\n\t\tgl.disable( gl.STENCIL_TEST );\n\t\tgl.disable( gl.SAMPLE_ALPHA_TO_COVERAGE );\n\n\t\tgl.blendEquation( gl.FUNC_ADD );\n\t\tgl.blendFunc( gl.ONE, gl.ZERO );\n\t\tgl.blendFuncSeparate( gl.ONE, gl.ZERO, gl.ONE, gl.ZERO );\n\t\tgl.blendColor( 0, 0, 0, 0 );\n\n\t\tgl.colorMask( true, true, true, true );\n\t\tgl.clearColor( 0, 0, 0, 0 );\n\n\t\tgl.depthMask( true );\n\t\tgl.depthFunc( gl.LESS );\n\t\tgl.clearDepth( 1 );\n\n\t\tgl.stencilMask( 0xffffffff );\n\t\tgl.stencilFunc( gl.ALWAYS, 0, 0xffffffff );\n\t\tgl.stencilOp( gl.KEEP, gl.KEEP, gl.KEEP );\n\t\tgl.clearStencil( 0 );\n\n\t\tgl.cullFace( gl.BACK );\n\t\tgl.frontFace( gl.CCW );\n\n\t\tgl.polygonOffset( 0, 0 );\n\n\t\tgl.activeTexture( gl.TEXTURE0 );\n\n\t\tgl.bindFramebuffer( gl.FRAMEBUFFER, null );\n\t\tgl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );\n\t\tgl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );\n\n\t\tgl.useProgram( null );\n\n\t\tgl.lineWidth( 1 );\n\n\t\tgl.scissor( 0, 0, gl.canvas.width, gl.canvas.height );\n\t\tgl.viewport( 0, 0, gl.canvas.width, gl.canvas.height );\n\n\t\t// reset internals\n\n\t\tenabledCapabilities = {};\n\n\t\tcurrentTextureSlot = null;\n\t\tcurrentBoundTextures = {};\n\n\t\tcurrentBoundFramebuffers = {};\n\t\tcurrentDrawbuffers = new WeakMap();\n\t\tdefaultDrawbuffers = [];\n\n\t\tcurrentProgram = null;\n\n\t\tcurrentBlendingEnabled = false;\n\t\tcurrentBlending = null;\n\t\tcurrentBlendEquation = null;\n\t\tcurrentBlendSrc = null;\n\t\tcurrentBlendDst = null;\n\t\tcurrentBlendEquationAlpha = null;\n\t\tcurrentBlendSrcAlpha = null;\n\t\tcurrentBlendDstAlpha = null;\n\t\tcurrentBlendColor = new Color( 0, 0, 0 );\n\t\tcurrentBlendAlpha = 0;\n\t\tcurrentPremultipledAlpha = false;\n\n\t\tcurrentFlipSided = null;\n\t\tcurrentCullFace = null;\n\n\t\tcurrentLineWidth = null;\n\n\t\tcurrentPolygonOffsetFactor = null;\n\t\tcurrentPolygonOffsetUnits = null;\n\n\t\tcurrentScissor.set( 0, 0, gl.canvas.width, gl.canvas.height );\n\t\tcurrentViewport.set( 0, 0, gl.canvas.width, gl.canvas.height );\n\n\t\tcolorBuffer.reset();\n\t\tdepthBuffer.reset();\n\t\tstencilBuffer.reset();\n\n\t}\n\n\treturn {\n\n\t\tbuffers: {\n\t\t\tcolor: colorBuffer,\n\t\t\tdepth: depthBuffer,\n\t\t\tstencil: stencilBuffer\n\t\t},\n\n\t\tenable: enable,\n\t\tdisable: disable,\n\n\t\tbindFramebuffer: bindFramebuffer,\n\t\tdrawBuffers: drawBuffers,\n\n\t\tuseProgram: useProgram,\n\n\t\tsetBlending: setBlending,\n\t\tsetMaterial: setMaterial,\n\n\t\tsetFlipSided: setFlipSided,\n\t\tsetCullFace: setCullFace,\n\n\t\tsetLineWidth: setLineWidth,\n\t\tsetPolygonOffset: setPolygonOffset,\n\n\t\tsetScissorTest: setScissorTest,\n\n\t\tactiveTexture: activeTexture,\n\t\tbindTexture: bindTexture,\n\t\tunbindTexture: unbindTexture,\n\t\tcompressedTexImage2D: compressedTexImage2D,\n\t\tcompressedTexImage3D: compressedTexImage3D,\n\t\ttexImage2D: texImage2D,\n\t\ttexImage3D: texImage3D,\n\n\t\tupdateUBOMapping: updateUBOMapping,\n\t\tuniformBlockBinding: uniformBlockBinding,\n\n\t\ttexStorage2D: texStorage2D,\n\t\ttexStorage3D: texStorage3D,\n\t\ttexSubImage2D: texSubImage2D,\n\t\ttexSubImage3D: texSubImage3D,\n\t\tcompressedTexSubImage2D: compressedTexSubImage2D,\n\t\tcompressedTexSubImage3D: compressedTexSubImage3D,\n\n\t\tscissor: scissor,\n\t\tviewport: viewport,\n\n\t\treset: reset\n\n\t};\n\n}\n\nfunction contain( texture, aspect ) {\n\n\tconst imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;\n\n\tif ( imageAspect > aspect ) {\n\n\t\ttexture.repeat.x = 1;\n\t\ttexture.repeat.y = imageAspect / aspect;\n\n\t\ttexture.offset.x = 0;\n\t\ttexture.offset.y = ( 1 - texture.repeat.y ) / 2;\n\n\t} else {\n\n\t\ttexture.repeat.x = aspect / imageAspect;\n\t\ttexture.repeat.y = 1;\n\n\t\ttexture.offset.x = ( 1 - texture.repeat.x ) / 2;\n\t\ttexture.offset.y = 0;\n\n\t}\n\n\treturn texture;\n\n}\n\nfunction cover( texture, aspect ) {\n\n\tconst imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;\n\n\tif ( imageAspect > aspect ) {\n\n\t\ttexture.repeat.x = aspect / imageAspect;\n\t\ttexture.repeat.y = 1;\n\n\t\ttexture.offset.x = ( 1 - texture.repeat.x ) / 2;\n\t\ttexture.offset.y = 0;\n\n\t} else {\n\n\t\ttexture.repeat.x = 1;\n\t\ttexture.repeat.y = imageAspect / aspect;\n\n\t\ttexture.offset.x = 0;\n\t\ttexture.offset.y = ( 1 - texture.repeat.y ) / 2;\n\n\t}\n\n\treturn texture;\n\n}\n\nfunction fill( texture ) {\n\n\ttexture.repeat.x = 1;\n\ttexture.repeat.y = 1;\n\n\ttexture.offset.x = 0;\n\ttexture.offset.y = 0;\n\n\treturn texture;\n\n}\n\n\n\n/**\n * Given the width, height, format, and type of a texture. Determines how many\n * bytes must be used to represent the texture.\n */\nfunction getByteLength( width, height, format, type ) {\n\n\tconst typeByteLength = getTextureTypeByteLength( type );\n\n\tswitch ( format ) {\n\n\t\t// https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml\n\t\tcase AlphaFormat:\n\t\t\treturn width * height;\n\t\tcase LuminanceFormat:\n\t\t\treturn width * height;\n\t\tcase LuminanceAlphaFormat:\n\t\t\treturn width * height * 2;\n\t\tcase RedFormat:\n\t\t\treturn ( ( width * height ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RedIntegerFormat:\n\t\t\treturn ( ( width * height ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGFormat:\n\t\t\treturn ( ( width * height * 2 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGIntegerFormat:\n\t\t\treturn ( ( width * height * 2 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGBFormat:\n\t\t\treturn ( ( width * height * 3 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGBAFormat:\n\t\t\treturn ( ( width * height * 4 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\t\tcase RGBAIntegerFormat:\n\t\t\treturn ( ( width * height * 4 ) / typeByteLength.components ) * typeByteLength.byteLength;\n\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_s3tc_srgb/\n\t\tcase RGB_S3TC_DXT1_Format:\n\t\tcase RGBA_S3TC_DXT1_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;\n\t\tcase RGBA_S3TC_DXT3_Format:\n\t\tcase RGBA_S3TC_DXT5_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\n\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_pvrtc/\n\t\tcase RGB_PVRTC_2BPPV1_Format:\n\t\tcase RGBA_PVRTC_2BPPV1_Format:\n\t\t\treturn ( Math.max( width, 16 ) * Math.max( height, 8 ) ) / 4;\n\t\tcase RGB_PVRTC_4BPPV1_Format:\n\t\tcase RGBA_PVRTC_4BPPV1_Format:\n\t\t\treturn ( Math.max( width, 8 ) * Math.max( height, 8 ) ) / 2;\n\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_etc/\n\t\tcase RGB_ETC1_Format:\n\t\tcase RGB_ETC2_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;\n\t\tcase RGBA_ETC2_EAC_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\n\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/\n\t\tcase RGBA_ASTC_4x4_Format:\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\n\t\tcase RGBA_ASTC_5x4_Format:\n\t\t\treturn Math.floor( ( width + 4 ) / 5 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\n\t\tcase RGBA_ASTC_5x5_Format:\n\t\t\treturn Math.floor( ( width + 4 ) / 5 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\n\t\tcase RGBA_ASTC_6x5_Format:\n\t\t\treturn Math.floor( ( width + 5 ) / 6 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\n\t\tcase RGBA_ASTC_6x6_Format:\n\t\t\treturn Math.floor( ( width + 5 ) / 6 ) * Math.floor( ( height + 5 ) / 6 ) * 16;\n\t\tcase RGBA_ASTC_8x5_Format:\n\t\t\treturn Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\n\t\tcase RGBA_ASTC_8x6_Format:\n\t\t\treturn Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 5 ) / 6 ) * 16;\n\t\tcase RGBA_ASTC_8x8_Format:\n\t\t\treturn Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 7 ) / 8 ) * 16;\n\t\tcase RGBA_ASTC_10x5_Format:\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\n\t\tcase RGBA_ASTC_10x6_Format:\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 5 ) / 6 ) * 16;\n\t\tcase RGBA_ASTC_10x8_Format:\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 7 ) / 8 ) * 16;\n\t\tcase RGBA_ASTC_10x10_Format:\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 9 ) / 10 ) * 16;\n\t\tcase RGBA_ASTC_12x10_Format:\n\t\t\treturn Math.floor( ( width + 11 ) / 12 ) * Math.floor( ( height + 9 ) / 10 ) * 16;\n\t\tcase RGBA_ASTC_12x12_Format:\n\t\t\treturn Math.floor( ( width + 11 ) / 12 ) * Math.floor( ( height + 11 ) / 12 ) * 16;\n\n\t\t// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_bptc/\n\t\tcase RGBA_BPTC_Format:\n\t\tcase RGB_BPTC_SIGNED_Format:\n\t\tcase RGB_BPTC_UNSIGNED_Format:\n\t\t\treturn Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 16;\n\n\t\t// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_rgtc/\n\t\tcase RED_RGTC1_Format:\n\t\tcase SIGNED_RED_RGTC1_Format:\n\t\t\treturn Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 8;\n\t\tcase RED_GREEN_RGTC2_Format:\n\t\tcase SIGNED_RED_GREEN_RGTC2_Format:\n\t\t\treturn Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 16;\n\n\t}\n\n\tthrow new Error(\n\t\t`Unable to determine texture byte length for ${format} format.`,\n\t);\n\n}\n\nfunction getTextureTypeByteLength( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase UnsignedByteType:\n\t\tcase ByteType:\n\t\t\treturn { byteLength: 1, components: 1 };\n\t\tcase UnsignedShortType:\n\t\tcase ShortType:\n\t\tcase HalfFloatType:\n\t\t\treturn { byteLength: 2, components: 1 };\n\t\tcase UnsignedShort4444Type:\n\t\tcase UnsignedShort5551Type:\n\t\t\treturn { byteLength: 2, components: 4 };\n\t\tcase UnsignedIntType:\n\t\tcase IntType:\n\t\tcase FloatType:\n\t\t\treturn { byteLength: 4, components: 1 };\n\t\tcase UnsignedInt5999Type:\n\t\t\treturn { byteLength: 4, components: 3 };\n\n\t}\n\n\tthrow new Error( `Unknown texture type ${type}.` );\n\n}\n\nconst TextureUtils = {\n\tcontain,\n\tcover,\n\tfill,\n\tgetByteLength\n};\n\nfunction WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {\n\n\tconst multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;\n\tconst supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );\n\n\tconst _imageDimensions = new Vector2();\n\tconst _videoTextures = new WeakMap();\n\tlet _canvas;\n\n\tconst _sources = new WeakMap(); // maps WebglTexture objects to instances of Source\n\n\t// cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,\n\t// also OffscreenCanvas.getContext(\"webgl\"), but not OffscreenCanvas.getContext(\"2d\")!\n\t// Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).\n\n\tlet useOffscreenCanvas = false;\n\n\ttry {\n\n\t\tuseOffscreenCanvas = typeof OffscreenCanvas !== 'undefined'\n\t\t\t// eslint-disable-next-line compat/compat\n\t\t\t&& ( new OffscreenCanvas( 1, 1 ).getContext( '2d' ) ) !== null;\n\n\t} catch ( err ) {\n\n\t\t// Ignore any errors\n\n\t}\n\n\tfunction createCanvas( width, height ) {\n\n\t\t// Use OffscreenCanvas when available. Specially needed in web workers\n\n\t\treturn useOffscreenCanvas ?\n\t\t\t// eslint-disable-next-line compat/compat\n\t\t\tnew OffscreenCanvas( width, height ) : createElementNS( 'canvas' );\n\n\t}\n\n\tfunction resizeImage( image, needsNewCanvas, maxSize ) {\n\n\t\tlet scale = 1;\n\n\t\tconst dimensions = getDimensions( image );\n\n\t\t// handle case if texture exceeds max size\n\n\t\tif ( dimensions.width > maxSize || dimensions.height > maxSize ) {\n\n\t\t\tscale = maxSize / Math.max( dimensions.width, dimensions.height );\n\n\t\t}\n\n\t\t// only perform resize if necessary\n\n\t\tif ( scale < 1 ) {\n\n\t\t\t// only perform resize for certain image types\n\n\t\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ||\n\t\t\t\t( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) ) {\n\n\t\t\t\tconst width = Math.floor( scale * dimensions.width );\n\t\t\t\tconst height = Math.floor( scale * dimensions.height );\n\n\t\t\t\tif ( _canvas === undefined ) _canvas = createCanvas( width, height );\n\n\t\t\t\t// cube textures can't reuse the same canvas\n\n\t\t\t\tconst canvas = needsNewCanvas ? createCanvas( width, height ) : _canvas;\n\n\t\t\t\tcanvas.width = width;\n\t\t\t\tcanvas.height = height;\n\n\t\t\t\tconst context = canvas.getContext( '2d' );\n\t\t\t\tcontext.drawImage( image, 0, 0, width, height );\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + dimensions.width + 'x' + dimensions.height + ') to (' + width + 'x' + height + ').' );\n\n\t\t\t\treturn canvas;\n\n\t\t\t} else {\n\n\t\t\t\tif ( 'data' in image ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + dimensions.width + 'x' + dimensions.height + ').' );\n\n\t\t\t\t}\n\n\t\t\t\treturn image;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn image;\n\n\t}\n\n\tfunction textureNeedsGenerateMipmaps( texture ) {\n\n\t\treturn texture.generateMipmaps && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;\n\n\t}\n\n\tfunction generateMipmap( target ) {\n\n\t\t_gl.generateMipmap( target );\n\n\t}\n\n\tfunction getInternalFormat( internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false ) {\n\n\t\tif ( internalFormatName !== null ) {\n\n\t\t\tif ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \\'' + internalFormatName + '\\'' );\n\n\t\t}\n\n\t\tlet internalFormat = glFormat;\n\n\t\tif ( glFormat === _gl.RED ) {\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.R32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.R16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RED_INTEGER ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8UI;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.R16UI;\n\t\t\tif ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.R32UI;\n\t\t\tif ( glType === _gl.BYTE ) internalFormat = _gl.R8I;\n\t\t\tif ( glType === _gl.SHORT ) internalFormat = _gl.R16I;\n\t\t\tif ( glType === _gl.INT ) internalFormat = _gl.R32I;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RG ) {\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.RG32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RG16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RG_INTEGER ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8UI;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RG16UI;\n\t\t\tif ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RG32UI;\n\t\t\tif ( glType === _gl.BYTE ) internalFormat = _gl.RG8I;\n\t\t\tif ( glType === _gl.SHORT ) internalFormat = _gl.RG16I;\n\t\t\tif ( glType === _gl.INT ) internalFormat = _gl.RG32I;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RGB ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RGBA ) {\n\n\t\t\tconst transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.RGBA32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RGBA16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( transfer === SRGBTransfer ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT_4_4_4_4 ) internalFormat = _gl.RGBA4;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT_5_5_5_1 ) internalFormat = _gl.RGB5_A1;\n\n\t\t}\n\n\t\tif ( internalFormat === _gl.R16F || internalFormat === _gl.R32F ||\n\t\t\tinternalFormat === _gl.RG16F || internalFormat === _gl.RG32F ||\n\t\t\tinternalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F ) {\n\n\t\t\textensions.get( 'EXT_color_buffer_float' );\n\n\t\t}\n\n\t\treturn internalFormat;\n\n\t}\n\n\tfunction getInternalDepthFormat( useStencil, depthType ) {\n\n\t\tlet glInternalFormat;\n\t\tif ( useStencil ) {\n\n\t\t\tif ( depthType === null || depthType === UnsignedIntType || depthType === UnsignedInt248Type ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH24_STENCIL8;\n\n\t\t\t} else if ( depthType === FloatType ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH32F_STENCIL8;\n\n\t\t\t} else if ( depthType === UnsignedShortType ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH24_STENCIL8;\n\t\t\t\tconsole.warn( 'DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.' );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( depthType === null || depthType === UnsignedIntType || depthType === UnsignedInt248Type ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT24;\n\n\t\t\t} else if ( depthType === FloatType ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT32F;\n\n\t\t\t} else if ( depthType === UnsignedShortType ) {\n\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT16;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn glInternalFormat;\n\n\t}\n\n\tfunction getMipLevels( texture, image ) {\n\n\t\tif ( textureNeedsGenerateMipmaps( texture ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {\n\n\t\t\treturn Math.log2( Math.max( image.width, image.height ) ) + 1;\n\n\t\t} else if ( texture.mipmaps !== undefined && texture.mipmaps.length > 0 ) {\n\n\t\t\t// user-defined mipmaps\n\n\t\t\treturn texture.mipmaps.length;\n\n\t\t} else if ( texture.isCompressedTexture && Array.isArray( texture.image ) ) {\n\n\t\t\treturn image.mipmaps.length;\n\n\t\t} else {\n\n\t\t\t// texture without mipmaps (only base level)\n\n\t\t\treturn 1;\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tdeallocateTexture( texture );\n\n\t\tif ( texture.isVideoTexture ) {\n\n\t\t\t_videoTextures.delete( texture );\n\n\t\t}\n\n\t}\n\n\tfunction onRenderTargetDispose( event ) {\n\n\t\tconst renderTarget = event.target;\n\n\t\trenderTarget.removeEventListener( 'dispose', onRenderTargetDispose );\n\n\t\tdeallocateRenderTarget( renderTarget );\n\n\t}\n\n\t//\n\n\tfunction deallocateTexture( texture ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( textureProperties.__webglInit === undefined ) return;\n\n\t\t// check if it's necessary to remove the WebGLTexture object\n\n\t\tconst source = texture.source;\n\t\tconst webglTextures = _sources.get( source );\n\n\t\tif ( webglTextures ) {\n\n\t\t\tconst webglTexture = webglTextures[ textureProperties.__cacheKey ];\n\t\t\twebglTexture.usedTimes --;\n\n\t\t\t// the WebGLTexture object is not used anymore, remove it\n\n\t\t\tif ( webglTexture.usedTimes === 0 ) {\n\n\t\t\t\tdeleteTexture( texture );\n\n\t\t\t}\n\n\t\t\t// remove the weak map entry if no WebGLTexture uses the source anymore\n\n\t\t\tif ( Object.keys( webglTextures ).length === 0 ) {\n\n\t\t\t\t_sources.delete( source );\n\n\t\t\t}\n\n\t\t}\n\n\t\tproperties.remove( texture );\n\n\t}\n\n\tfunction deleteTexture( texture ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\t\t_gl.deleteTexture( textureProperties.__webglTexture );\n\n\t\tconst source = texture.source;\n\t\tconst webglTextures = _sources.get( source );\n\t\tdelete webglTextures[ textureProperties.__cacheKey ];\n\n\t\tinfo.memory.textures --;\n\n\t}\n\n\tfunction deallocateRenderTarget( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\tif ( renderTarget.depthTexture ) {\n\n\t\t\trenderTarget.depthTexture.dispose();\n\n\t\t}\n\n\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( Array.isArray( renderTargetProperties.__webglFramebuffer[ i ] ) ) {\n\n\t\t\t\t\tfor ( let level = 0; level < renderTargetProperties.__webglFramebuffer[ i ].length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ][ level ] );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( Array.isArray( renderTargetProperties.__webglFramebuffer ) ) {\n\n\t\t\t\tfor ( let level = 0; level < renderTargetProperties.__webglFramebuffer.length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ level ] );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer );\n\n\t\t\t}\n\n\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer );\n\t\t\tif ( renderTargetProperties.__webglMultisampledFramebuffer ) _gl.deleteFramebuffer( renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\tif ( renderTargetProperties.__webglColorRenderbuffer ) {\n\n\t\t\t\tfor ( let i = 0; i < renderTargetProperties.__webglColorRenderbuffer.length; i ++ ) {\n\n\t\t\t\t\tif ( renderTargetProperties.__webglColorRenderbuffer[ i ] ) _gl.deleteRenderbuffer( renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( renderTargetProperties.__webglDepthRenderbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthRenderbuffer );\n\n\t\t}\n\n\t\tconst textures = renderTarget.textures;\n\n\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\tconst attachmentProperties = properties.get( textures[ i ] );\n\n\t\t\tif ( attachmentProperties.__webglTexture ) {\n\n\t\t\t\t_gl.deleteTexture( attachmentProperties.__webglTexture );\n\n\t\t\t\tinfo.memory.textures --;\n\n\t\t\t}\n\n\t\t\tproperties.remove( textures[ i ] );\n\n\t\t}\n\n\t\tproperties.remove( renderTarget );\n\n\t}\n\n\t//\n\n\tlet textureUnits = 0;\n\n\tfunction resetTextureUnits() {\n\n\t\ttextureUnits = 0;\n\n\t}\n\n\tfunction allocateTextureUnit() {\n\n\t\tconst textureUnit = textureUnits;\n\n\t\tif ( textureUnit >= capabilities.maxTextures ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + capabilities.maxTextures );\n\n\t\t}\n\n\t\ttextureUnits += 1;\n\n\t\treturn textureUnit;\n\n\t}\n\n\tfunction getTextureCacheKey( texture ) {\n\n\t\tconst array = [];\n\n\t\tarray.push( texture.wrapS );\n\t\tarray.push( texture.wrapT );\n\t\tarray.push( texture.wrapR || 0 );\n\t\tarray.push( texture.magFilter );\n\t\tarray.push( texture.minFilter );\n\t\tarray.push( texture.anisotropy );\n\t\tarray.push( texture.internalFormat );\n\t\tarray.push( texture.format );\n\t\tarray.push( texture.type );\n\t\tarray.push( texture.generateMipmaps );\n\t\tarray.push( texture.premultiplyAlpha );\n\t\tarray.push( texture.flipY );\n\t\tarray.push( texture.unpackAlignment );\n\t\tarray.push( texture.colorSpace );\n\n\t\treturn array.join();\n\n\t}\n\n\t//\n\n\tfunction setTexture2D( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.isVideoTexture ) updateVideoTexture( texture );\n\n\t\tif ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tconst image = texture.image;\n\n\t\t\tif ( image === null ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but no image data found.' );\n\n\t\t\t} else if ( image.complete === false ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but image is incomplete' );\n\n\t\t\t} else {\n\n\t\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTexture2DArray( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTexture3D( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTextureCube( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadCubeTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tconst wrappingToGL = {\n\t\t[ RepeatWrapping ]: _gl.REPEAT,\n\t\t[ ClampToEdgeWrapping ]: _gl.CLAMP_TO_EDGE,\n\t\t[ MirroredRepeatWrapping ]: _gl.MIRRORED_REPEAT\n\t};\n\n\tconst filterToGL = {\n\t\t[ NearestFilter ]: _gl.NEAREST,\n\t\t[ NearestMipmapNearestFilter ]: _gl.NEAREST_MIPMAP_NEAREST,\n\t\t[ NearestMipmapLinearFilter ]: _gl.NEAREST_MIPMAP_LINEAR,\n\n\t\t[ LinearFilter ]: _gl.LINEAR,\n\t\t[ LinearMipmapNearestFilter ]: _gl.LINEAR_MIPMAP_NEAREST,\n\t\t[ LinearMipmapLinearFilter ]: _gl.LINEAR_MIPMAP_LINEAR\n\t};\n\n\tconst compareToGL = {\n\t\t[ NeverCompare ]: _gl.NEVER,\n\t\t[ AlwaysCompare ]: _gl.ALWAYS,\n\t\t[ LessCompare ]: _gl.LESS,\n\t\t[ LessEqualCompare ]: _gl.LEQUAL,\n\t\t[ EqualCompare ]: _gl.EQUAL,\n\t\t[ GreaterEqualCompare ]: _gl.GEQUAL,\n\t\t[ GreaterCompare ]: _gl.GREATER,\n\t\t[ NotEqualCompare ]: _gl.NOTEQUAL\n\t};\n\n\tfunction setTextureParameters( textureType, texture ) {\n\n\t\tif ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false &&\n\t\t\t( texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter ||\n\t\t\ttexture.minFilter === LinearFilter || texture.minFilter === LinearMipmapNearestFilter || texture.minFilter === NearestMipmapLinearFilter || texture.minFilter === LinearMipmapLinearFilter ) ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.' );\n\n\t\t}\n\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );\n\n\t\tif ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );\n\n\t\t}\n\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );\n\n\t\tif ( texture.compareFunction ) {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_FUNC, compareToGL[ texture.compareFunction ] );\n\n\t\t}\n\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\n\n\t\t\tif ( texture.magFilter === NearestFilter ) return;\n\t\t\tif ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;\n\t\t\tif ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension\n\n\t\t\tif ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {\n\n\t\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\t\t\t\t_gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) );\n\t\t\t\tproperties.get( texture ).__currentAnisotropy = texture.anisotropy;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction initTexture( textureProperties, texture ) {\n\n\t\tlet forceUpload = false;\n\n\t\tif ( textureProperties.__webglInit === undefined ) {\n\n\t\t\ttextureProperties.__webglInit = true;\n\n\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t}\n\n\t\t// create Source <-> WebGLTextures mapping if necessary\n\n\t\tconst source = texture.source;\n\t\tlet webglTextures = _sources.get( source );\n\n\t\tif ( webglTextures === undefined ) {\n\n\t\t\twebglTextures = {};\n\t\t\t_sources.set( source, webglTextures );\n\n\t\t}\n\n\t\t// check if there is already a WebGLTexture object for the given texture parameters\n\n\t\tconst textureCacheKey = getTextureCacheKey( texture );\n\n\t\tif ( textureCacheKey !== textureProperties.__cacheKey ) {\n\n\t\t\t// if not, create a new instance of WebGLTexture\n\n\t\t\tif ( webglTextures[ textureCacheKey ] === undefined ) {\n\n\t\t\t\t// create new entry\n\n\t\t\t\twebglTextures[ textureCacheKey ] = {\n\t\t\t\t\ttexture: _gl.createTexture(),\n\t\t\t\t\tusedTimes: 0\n\t\t\t\t};\n\n\t\t\t\tinfo.memory.textures ++;\n\n\t\t\t\t// when a new instance of WebGLTexture was created, a texture upload is required\n\t\t\t\t// even if the image contents are identical\n\n\t\t\t\tforceUpload = true;\n\n\t\t\t}\n\n\t\t\twebglTextures[ textureCacheKey ].usedTimes ++;\n\n\t\t\t// every time the texture cache key changes, it's necessary to check if an instance of\n\t\t\t// WebGLTexture can be deleted in order to avoid a memory leak.\n\n\t\t\tconst webglTexture = webglTextures[ textureProperties.__cacheKey ];\n\n\t\t\tif ( webglTexture !== undefined ) {\n\n\t\t\t\twebglTextures[ textureProperties.__cacheKey ].usedTimes --;\n\n\t\t\t\tif ( webglTexture.usedTimes === 0 ) {\n\n\t\t\t\t\tdeleteTexture( texture );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// store references to cache key and WebGLTexture object\n\n\t\t\ttextureProperties.__cacheKey = textureCacheKey;\n\t\t\ttextureProperties.__webglTexture = webglTextures[ textureCacheKey ].texture;\n\n\t\t}\n\n\t\treturn forceUpload;\n\n\t}\n\n\tfunction uploadTexture( textureProperties, texture, slot ) {\n\n\t\tlet textureType = _gl.TEXTURE_2D;\n\n\t\tif ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) textureType = _gl.TEXTURE_2D_ARRAY;\n\t\tif ( texture.isData3DTexture ) textureType = _gl.TEXTURE_3D;\n\n\t\tconst forceUpload = initTexture( textureProperties, texture );\n\t\tconst source = texture.source;\n\n\t\tstate.bindTexture( textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t\tconst sourceProperties = properties.get( source );\n\n\t\tif ( source.version !== sourceProperties.__version || forceUpload === true ) {\n\n\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\n\n\t\t\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\t\t\tconst texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );\n\t\t\tconst unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );\n\n\t\t\tlet image = resizeImage( texture.image, false, capabilities.maxTextureSize );\n\t\t\timage = verifyColorSpace( texture, image );\n\n\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\n\t\t\tconst glType = utils.convert( texture.type );\n\t\t\tlet glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );\n\n\t\t\tsetTextureParameters( textureType, texture );\n\n\t\t\tlet mipmap;\n\t\t\tconst mipmaps = texture.mipmaps;\n\n\t\t\tconst useTexStorage = ( texture.isVideoTexture !== true );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tconst dataReady = source.dataReady;\n\t\t\tconst levels = getMipLevels( texture, image );\n\n\t\t\tif ( texture.isDepthTexture ) {\n\n\t\t\t\tglInternalFormat = getInternalDepthFormat( texture.format === DepthStencilFormat, texture.type );\n\n\t\t\t\t//\n\n\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, 1, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isDataTexture ) {\n\n\t\t\t\t// use manually created mipmaps if available\n\t\t\t\t// if there are no manual mipmaps\n\t\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\t\tif ( mipmaps.length > 0 ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isCompressedTexture ) {\n\n\t\t\t\tif ( texture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\t\tif ( texture.layerUpdates.size > 0 ) {\n\n\t\t\t\t\t\t\t\t\t\t\tconst layerByteLength = getByteLength( mipmap.width, mipmap.height, texture.format, texture.type );\n\n\t\t\t\t\t\t\t\t\t\t\tfor ( const layerIndex of texture.layerUpdates ) {\n\n\t\t\t\t\t\t\t\t\t\t\t\tconst layerData = mipmap.data.subarray(\n\t\t\t\t\t\t\t\t\t\t\t\t\tlayerIndex * layerByteLength / mipmap.data.BYTES_PER_ELEMENT,\n\t\t\t\t\t\t\t\t\t\t\t\t\t( layerIndex + 1 ) * layerByteLength / mipmap.data.BYTES_PER_ELEMENT\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, layerIndex, mipmap.width, mipmap.height, 1, glFormat, layerData, 0, 0 );\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\ttexture.clearLayerUpdates();\n\n\t\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0 );\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0 );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isDataArrayTexture ) {\n\n\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, image.width, image.height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\tif ( texture.layerUpdates.size > 0 ) {\n\n\t\t\t\t\t\t\tconst layerByteLength = getByteLength( image.width, image.height, texture.format, texture.type );\n\n\t\t\t\t\t\t\tfor ( const layerIndex of texture.layerUpdates ) {\n\n\t\t\t\t\t\t\t\tconst layerData = image.data.subarray(\n\t\t\t\t\t\t\t\t\tlayerIndex * layerByteLength / image.data.BYTES_PER_ELEMENT,\n\t\t\t\t\t\t\t\t\t( layerIndex + 1 ) * layerByteLength / image.data.BYTES_PER_ELEMENT\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, layerIndex, image.width, image.height, 1, glFormat, glType, layerData );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\ttexture.clearLayerUpdates();\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isData3DTexture ) {\n\n\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_3D, levels, glInternalFormat, image.width, image.height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isFramebufferTexture ) {\n\n\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tlet width = image.width, height = image.height;\n\n\t\t\t\t\t\tfor ( let i = 0; i < levels; i ++ ) {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, width, height, 0, glFormat, glType, null );\n\n\t\t\t\t\t\t\twidth >>= 1;\n\t\t\t\t\t\t\theight >>= 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// regular Texture (image, video, canvas)\n\n\t\t\t\t// use manually created mipmaps if available\n\t\t\t\t// if there are no manual mipmaps\n\t\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\t\tif ( mipmaps.length > 0 ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tconst dimensions = getDimensions( mipmaps[ 0 ] );\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\t\tconst dimensions = getDimensions( image );\n\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\n\n\t\t\t\tgenerateMipmap( textureType );\n\n\t\t\t}\n\n\t\t\tsourceProperties.__version = source.version;\n\n\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t\t}\n\n\t\ttextureProperties.__version = texture.version;\n\n\t}\n\n\tfunction uploadCubeTexture( textureProperties, texture, slot ) {\n\n\t\tif ( texture.image.length !== 6 ) return;\n\n\t\tconst forceUpload = initTexture( textureProperties, texture );\n\t\tconst source = texture.source;\n\n\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t\tconst sourceProperties = properties.get( source );\n\n\t\tif ( source.version !== sourceProperties.__version || forceUpload === true ) {\n\n\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\n\n\t\t\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\t\t\tconst texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );\n\t\t\tconst unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );\n\n\t\t\tconst isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );\n\t\t\tconst isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );\n\n\t\t\tconst cubeImage = [];\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( ! isCompressed && ! isDataTexture ) {\n\n\t\t\t\t\tcubeImage[ i ] = resizeImage( texture.image[ i ], true, capabilities.maxCubemapSize );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tcubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ];\n\n\t\t\t\t}\n\n\t\t\t\tcubeImage[ i ] = verifyColorSpace( texture, cubeImage[ i ] );\n\n\t\t\t}\n\n\t\t\tconst image = cubeImage[ 0 ],\n\t\t\t\tglFormat = utils.convert( texture.format, texture.colorSpace ),\n\t\t\t\tglType = utils.convert( texture.type ),\n\t\t\t\tglInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\n\t\t\tconst useTexStorage = ( texture.isVideoTexture !== true );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tconst dataReady = source.dataReady;\n\t\t\tlet levels = getMipLevels( texture, image );\n\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );\n\n\t\t\tlet mipmaps;\n\n\t\t\tif ( isCompressed ) {\n\n\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tmipmaps = cubeImage[ i ].mipmaps;\n\n\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tmipmaps = texture.mipmaps;\n\n\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t// TODO: Uniformly handle mipmap definitions\n\t\t\t\t\t// Normal textures and compressed cube textures define base level + mips with their mipmap array\n\t\t\t\t\t// Uncompressed cube textures use their mipmap array only for mips (no base level)\n\n\t\t\t\t\tif ( mipmaps.length > 0 ) levels ++;\n\n\t\t\t\t\tconst dimensions = getDimensions( cubeImage[ 0 ] );\n\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, dimensions.width, dimensions.height );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tif ( isDataTexture ) {\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, cubeImage[ i ].width, cubeImage[ i ].height, glFormat, glType, cubeImage[ i ].data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\t\t\t\t\t\t\tconst mipmapImage = mipmap.image[ i ].image;\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, glFormat, glType, cubeImage[ i ] );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[ i ] );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[ i ] );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[ i ] );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\n\n\t\t\t\t// We assume images for cube map have the same size.\n\t\t\t\tgenerateMipmap( _gl.TEXTURE_CUBE_MAP );\n\n\t\t\t}\n\n\t\t\tsourceProperties.__version = source.version;\n\n\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t\t}\n\n\t\ttextureProperties.__version = texture.version;\n\n\t}\n\n\t// Render targets\n\n\t// Setup storage for target texture and bind it to correct framebuffer\n\tfunction setupFrameBufferTexture( framebuffer, renderTarget, texture, attachment, textureTarget, level ) {\n\n\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\tconst glType = utils.convert( texture.type );\n\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\tif ( ! renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\tconst width = Math.max( 1, renderTarget.width >> level );\n\t\t\tconst height = Math.max( 1, renderTarget.height >> level );\n\n\t\t\tif ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\tstate.texImage3D( textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null );\n\n\t\t\t} else {\n\n\t\t\t\tstate.texImage2D( textureTarget, level, glInternalFormat, width, height, 0, glFormat, glType, null );\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, 0, getRenderTargetSamples( renderTarget ) );\n\n\t\t} else if ( textureTarget === _gl.TEXTURE_2D || ( textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z ) ) { // see #24753\n\n\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, level );\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t}\n\n\t// Setup storage for internal depth/stencil buffers and bind to correct framebuffer\n\tfunction setupRenderBufferStorage( renderbuffer, renderTarget, isMultisample ) {\n\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );\n\n\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\t// retrieve the depth attachment types\n\t\t\tconst depthTexture = renderTarget.depthTexture;\n\t\t\tconst depthType = depthTexture && depthTexture.isDepthTexture ? depthTexture.type : null;\n\t\t\tconst glInternalFormat = getInternalDepthFormat( renderTarget.stencilBuffer, depthType );\n\t\t\tconst glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\n\t\t\t// set up the attachment\n\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\t\t\tconst isUseMultisampledRTT = useMultisampledRTT( renderTarget );\n\t\t\tif ( isUseMultisampledRTT ) {\n\n\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t} else if ( isMultisample ) {\n\n\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, glAttachmentType, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t} else {\n\n\t\t\tconst textures = renderTarget.textures;\n\n\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\tconst texture = textures[ i ];\n\n\t\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\t\t\tconst glType = utils.convert( texture.type );\n\t\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\t\tif ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else if ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\n\n\t}\n\n\t// Setup resources for a Depth Texture for a FBO (needs an extension)\n\tfunction setupDepthTexture( framebuffer, renderTarget ) {\n\n\t\tconst isCube = ( renderTarget && renderTarget.isWebGLCubeRenderTarget );\n\t\tif ( isCube ) throw new Error( 'Depth Texture with cube render targets is not supported' );\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\tif ( ! ( renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture ) ) {\n\n\t\t\tthrow new Error( 'renderTarget.depthTexture must be an instance of THREE.DepthTexture' );\n\n\t\t}\n\n\t\t// upload an empty depth texture with framebuffer size\n\t\tif ( ! properties.get( renderTarget.depthTexture ).__webglTexture ||\n\t\t\t\trenderTarget.depthTexture.image.width !== renderTarget.width ||\n\t\t\t\trenderTarget.depthTexture.image.height !== renderTarget.height ) {\n\n\t\t\trenderTarget.depthTexture.image.width = renderTarget.width;\n\t\t\trenderTarget.depthTexture.image.height = renderTarget.height;\n\t\t\trenderTarget.depthTexture.needsUpdate = true;\n\n\t\t}\n\n\t\tsetTexture2D( renderTarget.depthTexture, 0 );\n\n\t\tconst webglDepthTexture = properties.get( renderTarget.depthTexture ).__webglTexture;\n\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\tif ( renderTarget.depthTexture.format === DepthFormat ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );\n\n\t\t\t}\n\n\t\t} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'Unknown depthTexture format' );\n\n\t\t}\n\n\t}\n\n\t// Setup GL resources for a non-texture depth buffer\n\tfunction setupDepthRenderbuffer( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\n\t\t// if the bound depth texture has changed\n\t\tif ( renderTargetProperties.__boundDepthTexture !== renderTarget.depthTexture ) {\n\n\t\t\t// fire the dispose event to get rid of stored state associated with the previously bound depth buffer\n\t\t\tconst depthTexture = renderTarget.depthTexture;\n\t\t\tif ( renderTargetProperties.__depthDisposeCallback ) {\n\n\t\t\t\trenderTargetProperties.__depthDisposeCallback();\n\n\t\t\t}\n\n\t\t\t// set up dispose listeners to track when the currently attached buffer is implicitly unbound\n\t\t\tif ( depthTexture ) {\n\n\t\t\t\tconst disposeEvent = () => {\n\n\t\t\t\t\tdelete renderTargetProperties.__boundDepthTexture;\n\t\t\t\t\tdelete renderTargetProperties.__depthDisposeCallback;\n\t\t\t\t\tdepthTexture.removeEventListener( 'dispose', disposeEvent );\n\n\t\t\t\t};\n\n\t\t\t\tdepthTexture.addEventListener( 'dispose', disposeEvent );\n\t\t\t\trenderTargetProperties.__depthDisposeCallback = disposeEvent;\n\n\t\t\t}\n\n\t\t\trenderTargetProperties.__boundDepthTexture = depthTexture;\n\n\t\t}\n\n\t\tif ( renderTarget.depthTexture && ! renderTargetProperties.__autoAllocateDepthBuffer ) {\n\n\t\t\tif ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' );\n\n\t\t\tsetupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget );\n\n\t\t} else {\n\n\t\t\tif ( isCube ) {\n\n\t\t\t\trenderTargetProperties.__webglDepthbuffer = [];\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ i ] );\n\n\t\t\t\t\tif ( renderTargetProperties.__webglDepthbuffer[ i ] === undefined ) {\n\n\t\t\t\t\t\trenderTargetProperties.__webglDepthbuffer[ i ] = _gl.createRenderbuffer();\n\t\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer[ i ], renderTarget, false );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// attach buffer if it's been created already\n\t\t\t\t\t\tconst glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\t\t\t\t\t\tconst renderbuffer = renderTargetProperties.__webglDepthbuffer[ i ];\n\t\t\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, glAttachmentType, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\n\t\t\t\tif ( renderTargetProperties.__webglDepthbuffer === undefined ) {\n\n\t\t\t\t\trenderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget, false );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// attach buffer if it's been created already\n\t\t\t\t\tconst glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\t\t\t\t\tconst renderbuffer = renderTargetProperties.__webglDepthbuffer;\n\t\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, glAttachmentType, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t}\n\n\t// rebind framebuffer with external textures\n\tfunction rebindTextures( renderTarget, colorTexture, depthTexture ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\tif ( colorTexture !== undefined ) {\n\n\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, 0 );\n\n\t\t}\n\n\t\tif ( depthTexture !== undefined ) {\n\n\t\t\tsetupDepthRenderbuffer( renderTarget );\n\n\t\t}\n\n\t}\n\n\t// Set up GL resources for the render target\n\tfunction setupRenderTarget( renderTarget ) {\n\n\t\tconst texture = renderTarget.texture;\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst textureProperties = properties.get( texture );\n\n\t\trenderTarget.addEventListener( 'dispose', onRenderTargetDispose );\n\n\t\tconst textures = renderTarget.textures;\n\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\t\tconst isMultipleRenderTargets = ( textures.length > 1 );\n\n\t\tif ( ! isMultipleRenderTargets ) {\n\n\t\t\tif ( textureProperties.__webglTexture === undefined ) {\n\n\t\t\t\ttextureProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t}\n\n\t\t\ttextureProperties.__version = texture.version;\n\t\t\tinfo.memory.textures ++;\n\n\t\t}\n\n\t\t// Setup framebuffer\n\n\t\tif ( isCube ) {\n\n\t\t\trenderTargetProperties.__webglFramebuffer = [];\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = [];\n\n\t\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ][ level ] = _gl.createFramebuffer();\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = _gl.createFramebuffer();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\trenderTargetProperties.__webglFramebuffer = [];\n\n\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ level ] = _gl.createFramebuffer();\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\trenderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();\n\n\t\t\t}\n\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst attachmentProperties = properties.get( textures[ i ] );\n\n\t\t\t\t\tif ( attachmentProperties.__webglTexture === undefined ) {\n\n\t\t\t\t\t\tattachmentProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t\t\t\tinfo.memory.textures ++;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( ( renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\trenderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();\n\t\t\t\trenderTargetProperties.__webglColorRenderbuffer = [];\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tconst texture = textures[ i ];\n\t\t\t\t\trenderTargetProperties.__webglColorRenderbuffer[ i ] = _gl.createRenderbuffer();\n\n\t\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\t\t\t\tconst glType = utils.convert( texture.type );\n\t\t\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, renderTarget.isXRRenderTarget === true );\n\t\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\n\n\t\t\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\t\t\trenderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer();\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true );\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Setup color buffer\n\n\t\tif ( isCube ) {\n\n\t\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ][ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\n\n\t\t\t\tgenerateMipmap( _gl.TEXTURE_CUBE_MAP );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t} else if ( isMultipleRenderTargets ) {\n\n\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\tconst attachment = textures[ i ];\n\t\t\t\tconst attachmentProperties = properties.get( attachment );\n\n\t\t\t\tstate.bindTexture( _gl.TEXTURE_2D, attachmentProperties.__webglTexture );\n\t\t\t\tsetTextureParameters( _gl.TEXTURE_2D, attachment );\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0 );\n\n\t\t\t\tif ( textureNeedsGenerateMipmaps( attachment ) ) {\n\n\t\t\t\t\tgenerateMipmap( _gl.TEXTURE_2D );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t} else {\n\n\t\t\tlet glTextureType = _gl.TEXTURE_2D;\n\n\t\t\tif ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {\n\n\t\t\t\tglTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;\n\n\t\t\t}\n\n\t\t\tstate.bindTexture( glTextureType, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( glTextureType, texture );\n\n\t\t\tif ( texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, level );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, 0 );\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\n\n\t\t\t\tgenerateMipmap( glTextureType );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t}\n\n\t\t// Setup depth and stencil buffers\n\n\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\tsetupDepthRenderbuffer( renderTarget );\n\n\t\t}\n\n\t}\n\n\tfunction updateRenderTargetMipmap( renderTarget ) {\n\n\t\tconst textures = renderTarget.textures;\n\n\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\tconst texture = textures[ i ];\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\n\n\t\t\t\tconst target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D;\n\t\t\t\tconst webglTexture = properties.get( texture ).__webglTexture;\n\n\t\t\t\tstate.bindTexture( target, webglTexture );\n\t\t\t\tgenerateMipmap( target );\n\t\t\t\tstate.unbindTexture();\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tconst invalidationArrayRead = [];\n\tconst invalidationArrayDraw = [];\n\n\tfunction updateMultisampleRenderTarget( renderTarget ) {\n\n\t\tif ( renderTarget.samples > 0 ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\tconst textures = renderTarget.textures;\n\t\t\t\tconst width = renderTarget.width;\n\t\t\t\tconst height = renderTarget.height;\n\t\t\t\tlet mask = _gl.COLOR_BUFFER_BIT;\n\t\t\t\tconst depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\t\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\t\tconst isMultipleRenderTargets = ( textures.length > 1 );\n\n\t\t\t\t// If MRT we need to remove FBO attachments\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, null );\n\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, null, 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tif ( renderTarget.resolveDepthBuffer ) {\n\n\t\t\t\t\t\tif ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT;\n\n\t\t\t\t\t\t// resolving stencil is slow with a D3D backend. disable it for all transmission render targets (see #27799)\n\n\t\t\t\t\t\tif ( renderTarget.stencilBuffer && renderTarget.resolveStencilBuffer ) mask |= _gl.STENCIL_BUFFER_BIT;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\t\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST );\n\n\t\t\t\t\tif ( supportsInvalidateFramebuffer === true ) {\n\n\t\t\t\t\t\tinvalidationArrayRead.length = 0;\n\t\t\t\t\t\tinvalidationArrayDraw.length = 0;\n\n\t\t\t\t\t\tinvalidationArrayRead.push( _gl.COLOR_ATTACHMENT0 + i );\n\n\t\t\t\t\t\tif ( renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false ) {\n\n\t\t\t\t\t\t\tinvalidationArrayRead.push( depthStyle );\n\t\t\t\t\t\t\tinvalidationArrayDraw.push( depthStyle );\n\n\t\t\t\t\t\t\t_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, invalidationArrayDraw );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, invalidationArrayRead );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );\n\n\t\t\t\t// If MRT since pre-blit we removed the FBO we need to reconstruct the attachments\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, webglTexture, 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\t} else {\n\n\t\t\t\tif ( renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false && supportsInvalidateFramebuffer ) {\n\n\t\t\t\t\tconst depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction getRenderTargetSamples( renderTarget ) {\n\n\t\treturn Math.min( capabilities.maxSamples, renderTarget.samples );\n\n\t}\n\n\tfunction useMultisampledRTT( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\treturn renderTarget.samples > 0 && extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTargetProperties.__useRenderToTexture !== false;\n\n\t}\n\n\tfunction updateVideoTexture( texture ) {\n\n\t\tconst frame = info.render.frame;\n\n\t\t// Check the last frame we updated the VideoTexture\n\n\t\tif ( _videoTextures.get( texture ) !== frame ) {\n\n\t\t\t_videoTextures.set( texture, frame );\n\t\t\ttexture.update();\n\n\t\t}\n\n\t}\n\n\tfunction verifyColorSpace( texture, image ) {\n\n\t\tconst colorSpace = texture.colorSpace;\n\t\tconst format = texture.format;\n\t\tconst type = texture.type;\n\n\t\tif ( texture.isCompressedTexture === true || texture.isVideoTexture === true ) return image;\n\n\t\tif ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {\n\n\t\t\t// sRGB\n\n\t\t\tif ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {\n\n\t\t\t\t// in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format\n\n\t\t\t\tif ( format !== RGBAFormat || type !== UnsignedByteType ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( 'THREE.WebGLTextures: Unsupported texture color space:', colorSpace );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn image;\n\n\t}\n\n\tfunction getDimensions( image ) {\n\n\t\tif ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) {\n\n\t\t\t// if intrinsic data are not available, fallback to width/height\n\n\t\t\t_imageDimensions.width = image.naturalWidth || image.width;\n\t\t\t_imageDimensions.height = image.naturalHeight || image.height;\n\n\t\t} else if ( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) {\n\n\t\t\t_imageDimensions.width = image.displayWidth;\n\t\t\t_imageDimensions.height = image.displayHeight;\n\n\t\t} else {\n\n\t\t\t_imageDimensions.width = image.width;\n\t\t\t_imageDimensions.height = image.height;\n\n\t\t}\n\n\t\treturn _imageDimensions;\n\n\t}\n\n\t//\n\n\tthis.allocateTextureUnit = allocateTextureUnit;\n\tthis.resetTextureUnits = resetTextureUnits;\n\n\tthis.setTexture2D = setTexture2D;\n\tthis.setTexture2DArray = setTexture2DArray;\n\tthis.setTexture3D = setTexture3D;\n\tthis.setTextureCube = setTextureCube;\n\tthis.rebindTextures = rebindTextures;\n\tthis.setupRenderTarget = setupRenderTarget;\n\tthis.updateRenderTargetMipmap = updateRenderTargetMipmap;\n\tthis.updateMultisampleRenderTarget = updateMultisampleRenderTarget;\n\tthis.setupDepthRenderbuffer = setupDepthRenderbuffer;\n\tthis.setupFrameBufferTexture = setupFrameBufferTexture;\n\tthis.useMultisampledRTT = useMultisampledRTT;\n\n}\n\nfunction WebGLUtils( gl, extensions ) {\n\n\tfunction convert( p, colorSpace = NoColorSpace ) {\n\n\t\tlet extension;\n\n\t\tconst transfer = ColorManagement.getTransfer( colorSpace );\n\n\t\tif ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;\n\t\tif ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;\n\t\tif ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;\n\t\tif ( p === UnsignedInt5999Type ) return gl.UNSIGNED_INT_5_9_9_9_REV;\n\n\t\tif ( p === ByteType ) return gl.BYTE;\n\t\tif ( p === ShortType ) return gl.SHORT;\n\t\tif ( p === UnsignedShortType ) return gl.UNSIGNED_SHORT;\n\t\tif ( p === IntType ) return gl.INT;\n\t\tif ( p === UnsignedIntType ) return gl.UNSIGNED_INT;\n\t\tif ( p === FloatType ) return gl.FLOAT;\n\t\tif ( p === HalfFloatType ) return gl.HALF_FLOAT;\n\n\t\tif ( p === AlphaFormat ) return gl.ALPHA;\n\t\tif ( p === RGBFormat ) return gl.RGB;\n\t\tif ( p === RGBAFormat ) return gl.RGBA;\n\t\tif ( p === LuminanceFormat ) return gl.LUMINANCE;\n\t\tif ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;\n\t\tif ( p === DepthFormat ) return gl.DEPTH_COMPONENT;\n\t\tif ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;\n\n\t\t// WebGL2 formats.\n\n\t\tif ( p === RedFormat ) return gl.RED;\n\t\tif ( p === RedIntegerFormat ) return gl.RED_INTEGER;\n\t\tif ( p === RGFormat ) return gl.RG;\n\t\tif ( p === RGIntegerFormat ) return gl.RG_INTEGER;\n\t\tif ( p === RGBAIntegerFormat ) return gl.RGBA_INTEGER;\n\n\t\t// S3TC\n\n\t\tif ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {\n\n\t\t\tif ( transfer === SRGBTransfer ) {\n\n\t\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc_srgb' );\n\n\t\t\t\tif ( extension !== null ) {\n\n\t\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc' );\n\n\t\t\t\tif ( extension !== null ) {\n\n\t\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// PVRTC\n\n\t\tif ( p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_pvrtc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ETC\n\n\t\tif ( p === RGB_ETC1_Format || p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_etc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_ETC1_Format || p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;\n\t\t\t\tif ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ASTC\n\n\t\tif ( p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format ||\n\t\t\tp === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format ||\n\t\t\tp === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format ||\n\t\t\tp === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format ||\n\t\t\tp === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_astc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_ASTC_4x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x12_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// BPTC\n\n\t\tif ( p === RGBA_BPTC_Format || p === RGB_BPTC_SIGNED_Format || p === RGB_BPTC_UNSIGNED_Format ) {\n\n\t\t\textension = extensions.get( 'EXT_texture_compression_bptc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_BPTC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;\n\t\t\t\tif ( p === RGB_BPTC_SIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;\n\t\t\t\tif ( p === RGB_BPTC_UNSIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// RGTC\n\n\t\tif ( p === RED_RGTC1_Format || p === SIGNED_RED_RGTC1_Format || p === RED_GREEN_RGTC2_Format || p === SIGNED_RED_GREEN_RGTC2_Format ) {\n\n\t\t\textension = extensions.get( 'EXT_texture_compression_rgtc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_BPTC_Format ) return extension.COMPRESSED_RED_RGTC1_EXT;\n\t\t\t\tif ( p === SIGNED_RED_RGTC1_Format ) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;\n\t\t\t\tif ( p === RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;\n\t\t\t\tif ( p === SIGNED_RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( p === UnsignedInt248Type ) return gl.UNSIGNED_INT_24_8;\n\n\t\t// if \"p\" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)\n\n\t\treturn ( gl[ p ] !== undefined ) ? gl[ p ] : null;\n\n\t}\n\n\treturn { convert: convert };\n\n}\n\nclass ArrayCamera extends PerspectiveCamera {\n\n\tconstructor( array = [] ) {\n\n\t\tsuper();\n\n\t\tthis.isArrayCamera = true;\n\n\t\tthis.cameras = array;\n\n\t}\n\n}\n\nclass Group extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isGroup = true;\n\n\t\tthis.type = 'Group';\n\n\t}\n\n}\n\nconst _moveEvent = { type: 'move' };\n\nclass WebXRController {\n\n\tconstructor() {\n\n\t\tthis._targetRay = null;\n\t\tthis._grip = null;\n\t\tthis._hand = null;\n\n\t}\n\n\tgetHandSpace() {\n\n\t\tif ( this._hand === null ) {\n\n\t\t\tthis._hand = new Group();\n\t\t\tthis._hand.matrixAutoUpdate = false;\n\t\t\tthis._hand.visible = false;\n\n\t\t\tthis._hand.joints = {};\n\t\t\tthis._hand.inputState = { pinching: false };\n\n\t\t}\n\n\t\treturn this._hand;\n\n\t}\n\n\tgetTargetRaySpace() {\n\n\t\tif ( this._targetRay === null ) {\n\n\t\t\tthis._targetRay = new Group();\n\t\t\tthis._targetRay.matrixAutoUpdate = false;\n\t\t\tthis._targetRay.visible = false;\n\t\t\tthis._targetRay.hasLinearVelocity = false;\n\t\t\tthis._targetRay.linearVelocity = new Vector3();\n\t\t\tthis._targetRay.hasAngularVelocity = false;\n\t\t\tthis._targetRay.angularVelocity = new Vector3();\n\n\t\t}\n\n\t\treturn this._targetRay;\n\n\t}\n\n\tgetGripSpace() {\n\n\t\tif ( this._grip === null ) {\n\n\t\t\tthis._grip = new Group();\n\t\t\tthis._grip.matrixAutoUpdate = false;\n\t\t\tthis._grip.visible = false;\n\t\t\tthis._grip.hasLinearVelocity = false;\n\t\t\tthis._grip.linearVelocity = new Vector3();\n\t\t\tthis._grip.hasAngularVelocity = false;\n\t\t\tthis._grip.angularVelocity = new Vector3();\n\n\t\t}\n\n\t\treturn this._grip;\n\n\t}\n\n\tdispatchEvent( event ) {\n\n\t\tif ( this._targetRay !== null ) {\n\n\t\t\tthis._targetRay.dispatchEvent( event );\n\n\t\t}\n\n\t\tif ( this._grip !== null ) {\n\n\t\t\tthis._grip.dispatchEvent( event );\n\n\t\t}\n\n\t\tif ( this._hand !== null ) {\n\n\t\t\tthis._hand.dispatchEvent( event );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tconnect( inputSource ) {\n\n\t\tif ( inputSource && inputSource.hand ) {\n\n\t\t\tconst hand = this._hand;\n\n\t\t\tif ( hand ) {\n\n\t\t\t\tfor ( const inputjoint of inputSource.hand.values() ) {\n\n\t\t\t\t\t// Initialize hand with joints when connected\n\t\t\t\t\tthis._getHandJoint( hand, inputjoint );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.dispatchEvent( { type: 'connected', data: inputSource } );\n\n\t\treturn this;\n\n\t}\n\n\tdisconnect( inputSource ) {\n\n\t\tthis.dispatchEvent( { type: 'disconnected', data: inputSource } );\n\n\t\tif ( this._targetRay !== null ) {\n\n\t\t\tthis._targetRay.visible = false;\n\n\t\t}\n\n\t\tif ( this._grip !== null ) {\n\n\t\t\tthis._grip.visible = false;\n\n\t\t}\n\n\t\tif ( this._hand !== null ) {\n\n\t\t\tthis._hand.visible = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tupdate( inputSource, frame, referenceSpace ) {\n\n\t\tlet inputPose = null;\n\t\tlet gripPose = null;\n\t\tlet handPose = null;\n\n\t\tconst targetRay = this._targetRay;\n\t\tconst grip = this._grip;\n\t\tconst hand = this._hand;\n\n\t\tif ( inputSource && frame.session.visibilityState !== 'visible-blurred' ) {\n\n\t\t\tif ( hand && inputSource.hand ) {\n\n\t\t\t\thandPose = true;\n\n\t\t\t\tfor ( const inputjoint of inputSource.hand.values() ) {\n\n\t\t\t\t\t// Update the joints groups with the XRJoint poses\n\t\t\t\t\tconst jointPose = frame.getJointPose( inputjoint, referenceSpace );\n\n\t\t\t\t\t// The transform of this joint will be updated with the joint pose on each frame\n\t\t\t\t\tconst joint = this._getHandJoint( hand, inputjoint );\n\n\t\t\t\t\tif ( jointPose !== null ) {\n\n\t\t\t\t\t\tjoint.matrix.fromArray( jointPose.transform.matrix );\n\t\t\t\t\t\tjoint.matrix.decompose( joint.position, joint.rotation, joint.scale );\n\t\t\t\t\t\tjoint.matrixWorldNeedsUpdate = true;\n\t\t\t\t\t\tjoint.jointRadius = jointPose.radius;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tjoint.visible = jointPose !== null;\n\n\t\t\t\t}\n\n\t\t\t\t// Custom events\n\n\t\t\t\t// Check pinchz\n\t\t\t\tconst indexTip = hand.joints[ 'index-finger-tip' ];\n\t\t\t\tconst thumbTip = hand.joints[ 'thumb-tip' ];\n\t\t\t\tconst distance = indexTip.position.distanceTo( thumbTip.position );\n\n\t\t\t\tconst distanceToPinch = 0.02;\n\t\t\t\tconst threshold = 0.005;\n\n\t\t\t\tif ( hand.inputState.pinching && distance > distanceToPinch + threshold ) {\n\n\t\t\t\t\thand.inputState.pinching = false;\n\t\t\t\t\tthis.dispatchEvent( {\n\t\t\t\t\t\ttype: 'pinchend',\n\t\t\t\t\t\thandedness: inputSource.handedness,\n\t\t\t\t\t\ttarget: this\n\t\t\t\t\t} );\n\n\t\t\t\t} else if ( ! hand.inputState.pinching && distance <= distanceToPinch - threshold ) {\n\n\t\t\t\t\thand.inputState.pinching = true;\n\t\t\t\t\tthis.dispatchEvent( {\n\t\t\t\t\t\ttype: 'pinchstart',\n\t\t\t\t\t\thandedness: inputSource.handedness,\n\t\t\t\t\t\ttarget: this\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( grip !== null && inputSource.gripSpace ) {\n\n\t\t\t\t\tgripPose = frame.getPose( inputSource.gripSpace, referenceSpace );\n\n\t\t\t\t\tif ( gripPose !== null ) {\n\n\t\t\t\t\t\tgrip.matrix.fromArray( gripPose.transform.matrix );\n\t\t\t\t\t\tgrip.matrix.decompose( grip.position, grip.rotation, grip.scale );\n\t\t\t\t\t\tgrip.matrixWorldNeedsUpdate = true;\n\n\t\t\t\t\t\tif ( gripPose.linearVelocity ) {\n\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = true;\n\t\t\t\t\t\t\tgrip.linearVelocity.copy( gripPose.linearVelocity );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = false;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( gripPose.angularVelocity ) {\n\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = true;\n\t\t\t\t\t\t\tgrip.angularVelocity.copy( gripPose.angularVelocity );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = false;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( targetRay !== null ) {\n\n\t\t\t\tinputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );\n\n\t\t\t\t// Some runtimes (namely Vive Cosmos with Vive OpenXR Runtime) have only grip space and ray space is equal to it\n\t\t\t\tif ( inputPose === null && gripPose !== null ) {\n\n\t\t\t\t\tinputPose = gripPose;\n\n\t\t\t\t}\n\n\t\t\t\tif ( inputPose !== null ) {\n\n\t\t\t\t\ttargetRay.matrix.fromArray( inputPose.transform.matrix );\n\t\t\t\t\ttargetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale );\n\t\t\t\t\ttargetRay.matrixWorldNeedsUpdate = true;\n\n\t\t\t\t\tif ( inputPose.linearVelocity ) {\n\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = true;\n\t\t\t\t\t\ttargetRay.linearVelocity.copy( inputPose.linearVelocity );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( inputPose.angularVelocity ) {\n\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = true;\n\t\t\t\t\t\ttargetRay.angularVelocity.copy( inputPose.angularVelocity );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.dispatchEvent( _moveEvent );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t}\n\n\t\tif ( targetRay !== null ) {\n\n\t\t\ttargetRay.visible = ( inputPose !== null );\n\n\t\t}\n\n\t\tif ( grip !== null ) {\n\n\t\t\tgrip.visible = ( gripPose !== null );\n\n\t\t}\n\n\t\tif ( hand !== null ) {\n\n\t\t\thand.visible = ( handPose !== null );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// private method\n\n\t_getHandJoint( hand, inputjoint ) {\n\n\t\tif ( hand.joints[ inputjoint.jointName ] === undefined ) {\n\n\t\t\tconst joint = new Group();\n\t\t\tjoint.matrixAutoUpdate = false;\n\t\t\tjoint.visible = false;\n\t\t\thand.joints[ inputjoint.jointName ] = joint;\n\n\t\t\thand.add( joint );\n\n\t\t}\n\n\t\treturn hand.joints[ inputjoint.jointName ];\n\n\t}\n\n}\n\nconst _occlusion_vertex = `\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}`;\n\nconst _occlusion_fragment = `\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}`;\n\nclass WebXRDepthSensing {\n\n\tconstructor() {\n\n\t\tthis.texture = null;\n\t\tthis.mesh = null;\n\n\t\tthis.depthNear = 0;\n\t\tthis.depthFar = 0;\n\n\t}\n\n\tinit( renderer, depthData, renderState ) {\n\n\t\tif ( this.texture === null ) {\n\n\t\t\tconst texture = new Texture();\n\n\t\t\tconst texProps = renderer.properties.get( texture );\n\t\t\ttexProps.__webglTexture = depthData.texture;\n\n\t\t\tif ( ( depthData.depthNear != renderState.depthNear ) || ( depthData.depthFar != renderState.depthFar ) ) {\n\n\t\t\t\tthis.depthNear = depthData.depthNear;\n\t\t\t\tthis.depthFar = depthData.depthFar;\n\n\t\t\t}\n\n\t\t\tthis.texture = texture;\n\n\t\t}\n\n\t}\n\n\tgetMesh( cameraXR ) {\n\n\t\tif ( this.texture !== null ) {\n\n\t\t\tif ( this.mesh === null ) {\n\n\t\t\t\tconst viewport = cameraXR.cameras[ 0 ].viewport;\n\t\t\t\tconst material = new ShaderMaterial( {\n\t\t\t\t\tvertexShader: _occlusion_vertex,\n\t\t\t\t\tfragmentShader: _occlusion_fragment,\n\t\t\t\t\tuniforms: {\n\t\t\t\t\t\tdepthColor: { value: this.texture },\n\t\t\t\t\t\tdepthWidth: { value: viewport.z },\n\t\t\t\t\t\tdepthHeight: { value: viewport.w }\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\tthis.mesh = new Mesh( new PlaneGeometry( 20, 20 ), material );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this.mesh;\n\n\t}\n\n\treset() {\n\n\t\tthis.texture = null;\n\t\tthis.mesh = null;\n\n\t}\n\n\tgetDepthTexture() {\n\n\t\treturn this.texture;\n\n\t}\n\n}\n\nclass WebXRManager extends EventDispatcher {\n\n\tconstructor( renderer, gl ) {\n\n\t\tsuper();\n\n\t\tconst scope = this;\n\n\t\tlet session = null;\n\n\t\tlet framebufferScaleFactor = 1.0;\n\n\t\tlet referenceSpace = null;\n\t\tlet referenceSpaceType = 'local-floor';\n\t\t// Set default foveation to maximum.\n\t\tlet foveation = 1.0;\n\t\tlet customReferenceSpace = null;\n\n\t\tlet pose = null;\n\t\tlet glBinding = null;\n\t\tlet glProjLayer = null;\n\t\tlet glBaseLayer = null;\n\t\tlet xrFrame = null;\n\n\t\tconst depthSensing = new WebXRDepthSensing();\n\t\tconst attributes = gl.getContextAttributes();\n\n\t\tlet initialRenderTarget = null;\n\t\tlet newRenderTarget = null;\n\n\t\tconst controllers = [];\n\t\tconst controllerInputSources = [];\n\n\t\tconst currentSize = new Vector2();\n\t\tlet currentPixelRatio = null;\n\n\t\t//\n\n\t\tconst cameraL = new PerspectiveCamera();\n\t\tcameraL.layers.enable( 1 );\n\t\tcameraL.viewport = new Vector4();\n\n\t\tconst cameraR = new PerspectiveCamera();\n\t\tcameraR.layers.enable( 2 );\n\t\tcameraR.viewport = new Vector4();\n\n\t\tconst cameras = [ cameraL, cameraR ];\n\n\t\tconst cameraXR = new ArrayCamera();\n\t\tcameraXR.layers.enable( 1 );\n\t\tcameraXR.layers.enable( 2 );\n\n\t\tlet _currentDepthNear = null;\n\t\tlet _currentDepthFar = null;\n\n\t\t//\n\n\t\tthis.cameraAutoUpdate = true;\n\t\tthis.enabled = false;\n\n\t\tthis.isPresenting = false;\n\n\t\tthis.getController = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getTargetRaySpace();\n\n\t\t};\n\n\t\tthis.getControllerGrip = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getGripSpace();\n\n\t\t};\n\n\t\tthis.getHand = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getHandSpace();\n\n\t\t};\n\n\t\t//\n\n\t\tfunction onSessionEvent( event ) {\n\n\t\t\tconst controllerIndex = controllerInputSources.indexOf( event.inputSource );\n\n\t\t\tif ( controllerIndex === - 1 ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst controller = controllers[ controllerIndex ];\n\n\t\t\tif ( controller !== undefined ) {\n\n\t\t\t\tcontroller.update( event.inputSource, event.frame, customReferenceSpace || referenceSpace );\n\t\t\t\tcontroller.dispatchEvent( { type: event.type, data: event.inputSource } );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onSessionEnd() {\n\n\t\t\tsession.removeEventListener( 'select', onSessionEvent );\n\t\t\tsession.removeEventListener( 'selectstart', onSessionEvent );\n\t\t\tsession.removeEventListener( 'selectend', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeeze', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeezestart', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeezeend', onSessionEvent );\n\t\t\tsession.removeEventListener( 'end', onSessionEnd );\n\t\t\tsession.removeEventListener( 'inputsourceschange', onInputSourcesChange );\n\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\tconst inputSource = controllerInputSources[ i ];\n\n\t\t\t\tif ( inputSource === null ) continue;\n\n\t\t\t\tcontrollerInputSources[ i ] = null;\n\n\t\t\t\tcontrollers[ i ].disconnect( inputSource );\n\n\t\t\t}\n\n\t\t\t_currentDepthNear = null;\n\t\t\t_currentDepthFar = null;\n\n\t\t\tdepthSensing.reset();\n\n\t\t\t// restore framebuffer/rendering state\n\n\t\t\trenderer.setRenderTarget( initialRenderTarget );\n\n\t\t\tglBaseLayer = null;\n\t\t\tglProjLayer = null;\n\t\t\tglBinding = null;\n\t\t\tsession = null;\n\t\t\tnewRenderTarget = null;\n\n\t\t\t//\n\n\t\t\tanimation.stop();\n\n\t\t\tscope.isPresenting = false;\n\n\t\t\trenderer.setPixelRatio( currentPixelRatio );\n\t\t\trenderer.setSize( currentSize.width, currentSize.height, false );\n\n\t\t\tscope.dispatchEvent( { type: 'sessionend' } );\n\n\t\t}\n\n\t\tthis.setFramebufferScaleFactor = function ( value ) {\n\n\t\t\tframebufferScaleFactor = value;\n\n\t\t\tif ( scope.isPresenting === true ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebXRManager: Cannot change framebuffer scale while presenting.' );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.setReferenceSpaceType = function ( value ) {\n\n\t\t\treferenceSpaceType = value;\n\n\t\t\tif ( scope.isPresenting === true ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebXRManager: Cannot change reference space type while presenting.' );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.getReferenceSpace = function () {\n\n\t\t\treturn customReferenceSpace || referenceSpace;\n\n\t\t};\n\n\t\tthis.setReferenceSpace = function ( space ) {\n\n\t\t\tcustomReferenceSpace = space;\n\n\t\t};\n\n\t\tthis.getBaseLayer = function () {\n\n\t\t\treturn glProjLayer !== null ? glProjLayer : glBaseLayer;\n\n\t\t};\n\n\t\tthis.getBinding = function () {\n\n\t\t\treturn glBinding;\n\n\t\t};\n\n\t\tthis.getFrame = function () {\n\n\t\t\treturn xrFrame;\n\n\t\t};\n\n\t\tthis.getSession = function () {\n\n\t\t\treturn session;\n\n\t\t};\n\n\t\tthis.setSession = async function ( value ) {\n\n\t\t\tsession = value;\n\n\t\t\tif ( session !== null ) {\n\n\t\t\t\tinitialRenderTarget = renderer.getRenderTarget();\n\n\t\t\t\tsession.addEventListener( 'select', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'selectstart', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'selectend', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeeze', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeezestart', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeezeend', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'end', onSessionEnd );\n\t\t\t\tsession.addEventListener( 'inputsourceschange', onInputSourcesChange );\n\n\t\t\t\tif ( attributes.xrCompatible !== true ) {\n\n\t\t\t\t\tawait gl.makeXRCompatible();\n\n\t\t\t\t}\n\n\t\t\t\tcurrentPixelRatio = renderer.getPixelRatio();\n\t\t\t\trenderer.getSize( currentSize );\n\n\t\t\t\tif ( session.renderState.layers === undefined ) {\n\n\t\t\t\t\tconst layerInit = {\n\t\t\t\t\t\tantialias: attributes.antialias,\n\t\t\t\t\t\talpha: true,\n\t\t\t\t\t\tdepth: attributes.depth,\n\t\t\t\t\t\tstencil: attributes.stencil,\n\t\t\t\t\t\tframebufferScaleFactor: framebufferScaleFactor\n\t\t\t\t\t};\n\n\t\t\t\t\tglBaseLayer = new XRWebGLLayer( session, gl, layerInit );\n\n\t\t\t\t\tsession.updateRenderState( { baseLayer: glBaseLayer } );\n\n\t\t\t\t\trenderer.setPixelRatio( 1 );\n\t\t\t\t\trenderer.setSize( glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, false );\n\n\t\t\t\t\tnewRenderTarget = new WebGLRenderTarget(\n\t\t\t\t\t\tglBaseLayer.framebufferWidth,\n\t\t\t\t\t\tglBaseLayer.framebufferHeight,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: RGBAFormat,\n\t\t\t\t\t\t\ttype: UnsignedByteType,\n\t\t\t\t\t\t\tcolorSpace: renderer.outputColorSpace,\n\t\t\t\t\t\t\tstencilBuffer: attributes.stencil\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t} else {\n\n\t\t\t\t\tlet depthFormat = null;\n\t\t\t\t\tlet depthType = null;\n\t\t\t\t\tlet glDepthFormat = null;\n\n\t\t\t\t\tif ( attributes.depth ) {\n\n\t\t\t\t\t\tglDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;\n\t\t\t\t\t\tdepthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat;\n\t\t\t\t\t\tdepthType = attributes.stencil ? UnsignedInt248Type : UnsignedIntType;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst projectionlayerInit = {\n\t\t\t\t\t\tcolorFormat: gl.RGBA8,\n\t\t\t\t\t\tdepthFormat: glDepthFormat,\n\t\t\t\t\t\tscaleFactor: framebufferScaleFactor\n\t\t\t\t\t};\n\n\t\t\t\t\tglBinding = new XRWebGLBinding( session, gl );\n\n\t\t\t\t\tglProjLayer = glBinding.createProjectionLayer( projectionlayerInit );\n\n\t\t\t\t\tsession.updateRenderState( { layers: [ glProjLayer ] } );\n\n\t\t\t\t\trenderer.setPixelRatio( 1 );\n\t\t\t\t\trenderer.setSize( glProjLayer.textureWidth, glProjLayer.textureHeight, false );\n\n\t\t\t\t\tnewRenderTarget = new WebGLRenderTarget(\n\t\t\t\t\t\tglProjLayer.textureWidth,\n\t\t\t\t\t\tglProjLayer.textureHeight,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: RGBAFormat,\n\t\t\t\t\t\t\ttype: UnsignedByteType,\n\t\t\t\t\t\t\tdepthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),\n\t\t\t\t\t\t\tstencilBuffer: attributes.stencil,\n\t\t\t\t\t\t\tcolorSpace: renderer.outputColorSpace,\n\t\t\t\t\t\t\tsamples: attributes.antialias ? 4 : 0,\n\t\t\t\t\t\t\tresolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false )\n\t\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t\tnewRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278\n\n\t\t\t\tthis.setFoveation( foveation );\n\n\t\t\t\tcustomReferenceSpace = null;\n\t\t\t\treferenceSpace = await session.requestReferenceSpace( referenceSpaceType );\n\n\t\t\t\tanimation.setContext( session );\n\t\t\t\tanimation.start();\n\n\t\t\t\tscope.isPresenting = true;\n\n\t\t\t\tscope.dispatchEvent( { type: 'sessionstart' } );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.getEnvironmentBlendMode = function () {\n\n\t\t\tif ( session !== null ) {\n\n\t\t\t\treturn session.environmentBlendMode;\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.getDepthTexture = function () {\n\n\t\t\treturn depthSensing.getDepthTexture();\n\n\t\t};\n\n\t\tfunction onInputSourcesChange( event ) {\n\n\t\t\t// Notify disconnected\n\n\t\t\tfor ( let i = 0; i < event.removed.length; i ++ ) {\n\n\t\t\t\tconst inputSource = event.removed[ i ];\n\t\t\t\tconst index = controllerInputSources.indexOf( inputSource );\n\n\t\t\t\tif ( index >= 0 ) {\n\n\t\t\t\t\tcontrollerInputSources[ index ] = null;\n\t\t\t\t\tcontrollers[ index ].disconnect( inputSource );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Notify connected\n\n\t\t\tfor ( let i = 0; i < event.added.length; i ++ ) {\n\n\t\t\t\tconst inputSource = event.added[ i ];\n\n\t\t\t\tlet controllerIndex = controllerInputSources.indexOf( inputSource );\n\n\t\t\t\tif ( controllerIndex === - 1 ) {\n\n\t\t\t\t\t// Assign input source a controller that currently has no input source\n\n\t\t\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\t\t\tif ( i >= controllerInputSources.length ) {\n\n\t\t\t\t\t\t\tcontrollerInputSources.push( inputSource );\n\t\t\t\t\t\t\tcontrollerIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t} else if ( controllerInputSources[ i ] === null ) {\n\n\t\t\t\t\t\t\tcontrollerInputSources[ i ] = inputSource;\n\t\t\t\t\t\t\tcontrollerIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// If all controllers do currently receive input we ignore new ones\n\n\t\t\t\t\tif ( controllerIndex === - 1 ) break;\n\n\t\t\t\t}\n\n\t\t\t\tconst controller = controllers[ controllerIndex ];\n\n\t\t\t\tif ( controller ) {\n\n\t\t\t\t\tcontroller.connect( inputSource );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tconst cameraLPos = new Vector3();\n\t\tconst cameraRPos = new Vector3();\n\n\t\t/**\n\t\t * Assumes 2 cameras that are parallel and share an X-axis, and that\n\t\t * the cameras' projection and world matrices have already been set.\n\t\t * And that near and far planes are identical for both cameras.\n\t\t * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765\n\t\t */\n\t\tfunction setProjectionFromUnion( camera, cameraL, cameraR ) {\n\n\t\t\tcameraLPos.setFromMatrixPosition( cameraL.matrixWorld );\n\t\t\tcameraRPos.setFromMatrixPosition( cameraR.matrixWorld );\n\n\t\t\tconst ipd = cameraLPos.distanceTo( cameraRPos );\n\n\t\t\tconst projL = cameraL.projectionMatrix.elements;\n\t\t\tconst projR = cameraR.projectionMatrix.elements;\n\n\t\t\t// VR systems will have identical far and near planes, and\n\t\t\t// most likely identical top and bottom frustum extents.\n\t\t\t// Use the left camera for these values.\n\t\t\tconst near = projL[ 14 ] / ( projL[ 10 ] - 1 );\n\t\t\tconst far = projL[ 14 ] / ( projL[ 10 ] + 1 );\n\t\t\tconst topFov = ( projL[ 9 ] + 1 ) / projL[ 5 ];\n\t\t\tconst bottomFov = ( projL[ 9 ] - 1 ) / projL[ 5 ];\n\n\t\t\tconst leftFov = ( projL[ 8 ] - 1 ) / projL[ 0 ];\n\t\t\tconst rightFov = ( projR[ 8 ] + 1 ) / projR[ 0 ];\n\t\t\tconst left = near * leftFov;\n\t\t\tconst right = near * rightFov;\n\n\t\t\t// Calculate the new camera's position offset from the\n\t\t\t// left camera. xOffset should be roughly half `ipd`.\n\t\t\tconst zOffset = ipd / ( - leftFov + rightFov );\n\t\t\tconst xOffset = zOffset * - leftFov;\n\n\t\t\t// TODO: Better way to apply this offset?\n\t\t\tcameraL.matrixWorld.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.translateX( xOffset );\n\t\t\tcamera.translateZ( zOffset );\n\t\t\tcamera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\n\n\t\t\t// Check if the projection uses an infinite far plane.\n\t\t\tif ( projL[ 10 ] === - 1.0 ) {\n\n\t\t\t\t// Use the projection matrix from the left eye.\n\t\t\t\t// The camera offset is sufficient to include the view volumes\n\t\t\t\t// of both eyes (assuming symmetric projections).\n\t\t\t\tcamera.projectionMatrix.copy( cameraL.projectionMatrix );\n\t\t\t\tcamera.projectionMatrixInverse.copy( cameraL.projectionMatrixInverse );\n\n\t\t\t} else {\n\n\t\t\t\t// Find the union of the frustum values of the cameras and scale\n\t\t\t\t// the values so that the near plane's position does not change in world space,\n\t\t\t\t// although must now be relative to the new union camera.\n\t\t\t\tconst near2 = near + zOffset;\n\t\t\t\tconst far2 = far + zOffset;\n\t\t\t\tconst left2 = left - xOffset;\n\t\t\t\tconst right2 = right + ( ipd - xOffset );\n\t\t\t\tconst top2 = topFov * far / far2 * near2;\n\t\t\t\tconst bottom2 = bottomFov * far / far2 * near2;\n\n\t\t\t\tcamera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );\n\t\t\t\tcamera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction updateCamera( camera, parent ) {\n\n\t\t\tif ( parent === null ) {\n\n\t\t\t\tcamera.matrixWorld.copy( camera.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tcamera.matrixWorld.multiplyMatrices( parent.matrixWorld, camera.matrix );\n\n\t\t\t}\n\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\n\n\t\t}\n\n\t\tthis.updateCamera = function ( camera ) {\n\n\t\t\tif ( session === null ) return;\n\n\t\t\tlet depthNear = camera.near;\n\t\t\tlet depthFar = camera.far;\n\n\t\t\tif ( depthSensing.texture !== null ) {\n\n\t\t\t\tif ( depthSensing.depthNear > 0 ) depthNear = depthSensing.depthNear;\n\t\t\t\tif ( depthSensing.depthFar > 0 ) depthFar = depthSensing.depthFar;\n\n\t\t\t}\n\n\t\t\tcameraXR.near = cameraR.near = cameraL.near = depthNear;\n\t\t\tcameraXR.far = cameraR.far = cameraL.far = depthFar;\n\n\t\t\tif ( _currentDepthNear !== cameraXR.near || _currentDepthFar !== cameraXR.far ) {\n\n\t\t\t\t// Note that the new renderState won't apply until the next frame. See #18320\n\n\t\t\t\tsession.updateRenderState( {\n\t\t\t\t\tdepthNear: cameraXR.near,\n\t\t\t\t\tdepthFar: cameraXR.far\n\t\t\t\t} );\n\n\t\t\t\t_currentDepthNear = cameraXR.near;\n\t\t\t\t_currentDepthFar = cameraXR.far;\n\n\t\t\t}\n\n\t\t\tconst parent = camera.parent;\n\t\t\tconst cameras = cameraXR.cameras;\n\n\t\t\tupdateCamera( cameraXR, parent );\n\n\t\t\tfor ( let i = 0; i < cameras.length; i ++ ) {\n\n\t\t\t\tupdateCamera( cameras[ i ], parent );\n\n\t\t\t}\n\n\t\t\t// update projection matrix for proper view frustum culling\n\n\t\t\tif ( cameras.length === 2 ) {\n\n\t\t\t\tsetProjectionFromUnion( cameraXR, cameraL, cameraR );\n\n\t\t\t} else {\n\n\t\t\t\t// assume single camera setup (AR)\n\n\t\t\t\tcameraXR.projectionMatrix.copy( cameraL.projectionMatrix );\n\n\t\t\t}\n\n\t\t\t// update user camera and its children\n\n\t\t\tupdateUserCamera( camera, cameraXR, parent );\n\n\t\t};\n\n\t\tfunction updateUserCamera( camera, cameraXR, parent ) {\n\n\t\t\tif ( parent === null ) {\n\n\t\t\t\tcamera.matrix.copy( cameraXR.matrixWorld );\n\n\t\t\t} else {\n\n\t\t\t\tcamera.matrix.copy( parent.matrixWorld );\n\t\t\t\tcamera.matrix.invert();\n\t\t\t\tcamera.matrix.multiply( cameraXR.matrixWorld );\n\n\t\t\t}\n\n\t\t\tcamera.matrix.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.updateMatrixWorld( true );\n\n\t\t\tcamera.projectionMatrix.copy( cameraXR.projectionMatrix );\n\t\t\tcamera.projectionMatrixInverse.copy( cameraXR.projectionMatrixInverse );\n\n\t\t\tif ( camera.isPerspectiveCamera ) {\n\n\t\t\t\tcamera.fov = RAD2DEG * 2 * Math.atan( 1 / camera.projectionMatrix.elements[ 5 ] );\n\t\t\t\tcamera.zoom = 1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.getCamera = function () {\n\n\t\t\treturn cameraXR;\n\n\t\t};\n\n\t\tthis.getFoveation = function () {\n\n\t\t\tif ( glProjLayer === null && glBaseLayer === null ) {\n\n\t\t\t\treturn undefined;\n\n\t\t\t}\n\n\t\t\treturn foveation;\n\n\t\t};\n\n\t\tthis.setFoveation = function ( value ) {\n\n\t\t\t// 0 = no foveation = full resolution\n\t\t\t// 1 = maximum foveation = the edges render at lower resolution\n\n\t\t\tfoveation = value;\n\n\t\t\tif ( glProjLayer !== null ) {\n\n\t\t\t\tglProjLayer.fixedFoveation = value;\n\n\t\t\t}\n\n\t\t\tif ( glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined ) {\n\n\t\t\t\tglBaseLayer.fixedFoveation = value;\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.hasDepthSensing = function () {\n\n\t\t\treturn depthSensing.texture !== null;\n\n\t\t};\n\n\t\tthis.getDepthSensingMesh = function () {\n\n\t\t\treturn depthSensing.getMesh( cameraXR );\n\n\t\t};\n\n\t\t// Animation Loop\n\n\t\tlet onAnimationFrameCallback = null;\n\n\t\tfunction onAnimationFrame( time, frame ) {\n\n\t\t\tpose = frame.getViewerPose( customReferenceSpace || referenceSpace );\n\t\t\txrFrame = frame;\n\n\t\t\tif ( pose !== null ) {\n\n\t\t\t\tconst views = pose.views;\n\n\t\t\t\tif ( glBaseLayer !== null ) {\n\n\t\t\t\t\trenderer.setRenderTargetFramebuffer( newRenderTarget, glBaseLayer.framebuffer );\n\t\t\t\t\trenderer.setRenderTarget( newRenderTarget );\n\n\t\t\t\t}\n\n\t\t\t\tlet cameraXRNeedsUpdate = false;\n\n\t\t\t\t// check if it's necessary to rebuild cameraXR's camera list\n\n\t\t\t\tif ( views.length !== cameraXR.cameras.length ) {\n\n\t\t\t\t\tcameraXR.cameras.length = 0;\n\t\t\t\t\tcameraXRNeedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < views.length; i ++ ) {\n\n\t\t\t\t\tconst view = views[ i ];\n\n\t\t\t\t\tlet viewport = null;\n\n\t\t\t\t\tif ( glBaseLayer !== null ) {\n\n\t\t\t\t\t\tviewport = glBaseLayer.getViewport( view );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst glSubImage = glBinding.getViewSubImage( glProjLayer, view );\n\t\t\t\t\t\tviewport = glSubImage.viewport;\n\n\t\t\t\t\t\t// For side-by-side projection, we only produce a single texture for both eyes.\n\t\t\t\t\t\tif ( i === 0 ) {\n\n\t\t\t\t\t\t\trenderer.setRenderTargetTextures(\n\t\t\t\t\t\t\t\tnewRenderTarget,\n\t\t\t\t\t\t\t\tglSubImage.colorTexture,\n\t\t\t\t\t\t\t\tglProjLayer.ignoreDepthValues ? undefined : glSubImage.depthStencilTexture );\n\n\t\t\t\t\t\t\trenderer.setRenderTarget( newRenderTarget );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlet camera = cameras[ i ];\n\n\t\t\t\t\tif ( camera === undefined ) {\n\n\t\t\t\t\t\tcamera = new PerspectiveCamera();\n\t\t\t\t\t\tcamera.layers.enable( i );\n\t\t\t\t\t\tcamera.viewport = new Vector4();\n\t\t\t\t\t\tcameras[ i ] = camera;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcamera.matrix.fromArray( view.transform.matrix );\n\t\t\t\t\tcamera.matrix.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\t\t\tcamera.projectionMatrix.fromArray( view.projectionMatrix );\n\t\t\t\t\tcamera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();\n\t\t\t\t\tcamera.viewport.set( viewport.x, viewport.y, viewport.width, viewport.height );\n\n\t\t\t\t\tif ( i === 0 ) {\n\n\t\t\t\t\t\tcameraXR.matrix.copy( camera.matrix );\n\t\t\t\t\t\tcameraXR.matrix.decompose( cameraXR.position, cameraXR.quaternion, cameraXR.scale );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( cameraXRNeedsUpdate === true ) {\n\n\t\t\t\t\t\tcameraXR.cameras.push( camera );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t//\n\n\t\t\t\tconst enabledFeatures = session.enabledFeatures;\n\n\t\t\t\tif ( enabledFeatures && enabledFeatures.includes( 'depth-sensing' ) ) {\n\n\t\t\t\t\tconst depthData = glBinding.getDepthInformation( views[ 0 ] );\n\n\t\t\t\t\tif ( depthData && depthData.isValid && depthData.texture ) {\n\n\t\t\t\t\t\tdepthSensing.init( renderer, depthData, session.renderState );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\tconst inputSource = controllerInputSources[ i ];\n\t\t\t\tconst controller = controllers[ i ];\n\n\t\t\t\tif ( inputSource !== null && controller !== undefined ) {\n\n\t\t\t\t\tcontroller.update( inputSource, frame, customReferenceSpace || referenceSpace );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );\n\n\t\t\tif ( frame.detectedPlanes ) {\n\n\t\t\t\tscope.dispatchEvent( { type: 'planesdetected', data: frame } );\n\n\t\t\t}\n\n\t\t\txrFrame = null;\n\n\t\t}\n\n\t\tconst animation = new WebGLAnimation();\n\n\t\tanimation.setAnimationLoop( onAnimationFrame );\n\n\t\tthis.setAnimationLoop = function ( callback ) {\n\n\t\t\tonAnimationFrameCallback = callback;\n\n\t\t};\n\n\t\tthis.dispose = function () {};\n\n\t}\n\n}\n\nconst _e1 = /*@__PURE__*/ new Euler();\nconst _m1 = /*@__PURE__*/ new Matrix4();\n\nfunction WebGLMaterials( renderer, properties ) {\n\n\tfunction refreshTransformUniform( map, uniform ) {\n\n\t\tif ( map.matrixAutoUpdate === true ) {\n\n\t\t\tmap.updateMatrix();\n\n\t\t}\n\n\t\tuniform.value.copy( map.matrix );\n\n\t}\n\n\tfunction refreshFogUniforms( uniforms, fog ) {\n\n\t\tfog.color.getRGB( uniforms.fogColor.value, getUnlitUniformColorSpace( renderer ) );\n\n\t\tif ( fog.isFog ) {\n\n\t\t\tuniforms.fogNear.value = fog.near;\n\t\t\tuniforms.fogFar.value = fog.far;\n\n\t\t} else if ( fog.isFogExp2 ) {\n\n\t\t\tuniforms.fogDensity.value = fog.density;\n\n\t\t}\n\n\t}\n\n\tfunction refreshMaterialUniforms( uniforms, material, pixelRatio, height, transmissionRenderTarget ) {\n\n\t\tif ( material.isMeshBasicMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshLambertMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshToonMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsToon( uniforms, material );\n\n\t\t} else if ( material.isMeshPhongMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsPhong( uniforms, material );\n\n\t\t} else if ( material.isMeshStandardMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsStandard( uniforms, material );\n\n\t\t\tif ( material.isMeshPhysicalMaterial ) {\n\n\t\t\t\trefreshUniformsPhysical( uniforms, material, transmissionRenderTarget );\n\n\t\t\t}\n\n\t\t} else if ( material.isMeshMatcapMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsMatcap( uniforms, material );\n\n\t\t} else if ( material.isMeshDepthMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshDistanceMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsDistance( uniforms, material );\n\n\t\t} else if ( material.isMeshNormalMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isLineBasicMaterial ) {\n\n\t\t\trefreshUniformsLine( uniforms, material );\n\n\t\t\tif ( material.isLineDashedMaterial ) {\n\n\t\t\t\trefreshUniformsDash( uniforms, material );\n\n\t\t\t}\n\n\t\t} else if ( material.isPointsMaterial ) {\n\n\t\t\trefreshUniformsPoints( uniforms, material, pixelRatio, height );\n\n\t\t} else if ( material.isSpriteMaterial ) {\n\n\t\t\trefreshUniformsSprites( uniforms, material );\n\n\t\t} else if ( material.isShadowMaterial ) {\n\n\t\t\tuniforms.color.value.copy( material.color );\n\t\t\tuniforms.opacity.value = material.opacity;\n\n\t\t} else if ( material.isShaderMaterial ) {\n\n\t\t\tmaterial.uniformsNeedUpdate = false; // #15581\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsCommon( uniforms, material ) {\n\n\t\tuniforms.opacity.value = material.opacity;\n\n\t\tif ( material.color ) {\n\n\t\t\tuniforms.diffuse.value.copy( material.color );\n\n\t\t}\n\n\t\tif ( material.emissive ) {\n\n\t\t\tuniforms.emissive.value.copy( material.emissive ).multiplyScalar( material.emissiveIntensity );\n\n\t\t}\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.bumpMap ) {\n\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\n\n\t\t\trefreshTransformUniform( material.bumpMap, uniforms.bumpMapTransform );\n\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\n\n\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\tuniforms.bumpScale.value *= - 1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.normalMap ) {\n\n\t\t\tuniforms.normalMap.value = material.normalMap;\n\n\t\t\trefreshTransformUniform( material.normalMap, uniforms.normalMapTransform );\n\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\n\n\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\tuniforms.normalScale.value.negate();\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\n\t\t\trefreshTransformUniform( material.displacementMap, uniforms.displacementMapTransform );\n\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t\tif ( material.emissiveMap ) {\n\n\t\t\tuniforms.emissiveMap.value = material.emissiveMap;\n\n\t\t\trefreshTransformUniform( material.emissiveMap, uniforms.emissiveMapTransform );\n\n\t\t}\n\n\t\tif ( material.specularMap ) {\n\n\t\t\tuniforms.specularMap.value = material.specularMap;\n\n\t\t\trefreshTransformUniform( material.specularMap, uniforms.specularMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t\tconst materialProperties = properties.get( material );\n\n\t\tconst envMap = materialProperties.envMap;\n\t\tconst envMapRotation = materialProperties.envMapRotation;\n\n\t\tif ( envMap ) {\n\n\t\t\tuniforms.envMap.value = envMap;\n\n\t\t\t_e1.copy( envMapRotation );\n\n\t\t\t// accommodate left-handed frame\n\t\t\t_e1.x *= - 1; _e1.y *= - 1; _e1.z *= - 1;\n\n\t\t\tif ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) {\n\n\t\t\t\t// environment maps which are not cube render targets or PMREMs follow a different convention\n\t\t\t\t_e1.y *= - 1;\n\t\t\t\t_e1.z *= - 1;\n\n\t\t\t}\n\n\t\t\tuniforms.envMapRotation.value.setFromMatrix4( _m1.makeRotationFromEuler( _e1 ) );\n\n\t\t\tuniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t\tuniforms.reflectivity.value = material.reflectivity;\n\t\t\tuniforms.ior.value = material.ior;\n\t\t\tuniforms.refractionRatio.value = material.refractionRatio;\n\n\t\t}\n\n\t\tif ( material.lightMap ) {\n\n\t\t\tuniforms.lightMap.value = material.lightMap;\n\t\t\tuniforms.lightMapIntensity.value = material.lightMapIntensity;\n\n\t\t\trefreshTransformUniform( material.lightMap, uniforms.lightMapTransform );\n\n\t\t}\n\n\t\tif ( material.aoMap ) {\n\n\t\t\tuniforms.aoMap.value = material.aoMap;\n\t\t\tuniforms.aoMapIntensity.value = material.aoMapIntensity;\n\n\t\t\trefreshTransformUniform( material.aoMap, uniforms.aoMapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsLine( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDash( uniforms, material ) {\n\n\t\tuniforms.dashSize.value = material.dashSize;\n\t\tuniforms.totalSize.value = material.dashSize + material.gapSize;\n\t\tuniforms.scale.value = material.scale;\n\n\t}\n\n\tfunction refreshUniformsPoints( uniforms, material, pixelRatio, height ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.size.value = material.size * pixelRatio;\n\t\tuniforms.scale.value = height * 0.5;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.uvTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsSprites( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.rotation.value = material.rotation;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhong( uniforms, material ) {\n\n\t\tuniforms.specular.value.copy( material.specular );\n\t\tuniforms.shininess.value = Math.max( material.shininess, 1e-4 ); // to prevent pow( 0.0, 0.0 )\n\n\t}\n\n\tfunction refreshUniformsToon( uniforms, material ) {\n\n\t\tif ( material.gradientMap ) {\n\n\t\t\tuniforms.gradientMap.value = material.gradientMap;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsStandard( uniforms, material ) {\n\n\t\tuniforms.metalness.value = material.metalness;\n\n\t\tif ( material.metalnessMap ) {\n\n\t\t\tuniforms.metalnessMap.value = material.metalnessMap;\n\n\t\t\trefreshTransformUniform( material.metalnessMap, uniforms.metalnessMapTransform );\n\n\t\t}\n\n\t\tuniforms.roughness.value = material.roughness;\n\n\t\tif ( material.roughnessMap ) {\n\n\t\t\tuniforms.roughnessMap.value = material.roughnessMap;\n\n\t\t\trefreshTransformUniform( material.roughnessMap, uniforms.roughnessMapTransform );\n\n\t\t}\n\n\t\tif ( material.envMap ) {\n\n\t\t\t//uniforms.envMap.value = material.envMap; // part of uniforms common\n\n\t\t\tuniforms.envMapIntensity.value = material.envMapIntensity;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhysical( uniforms, material, transmissionRenderTarget ) {\n\n\t\tuniforms.ior.value = material.ior; // also part of uniforms common\n\n\t\tif ( material.sheen > 0 ) {\n\n\t\t\tuniforms.sheenColor.value.copy( material.sheenColor ).multiplyScalar( material.sheen );\n\n\t\t\tuniforms.sheenRoughness.value = material.sheenRoughness;\n\n\t\t\tif ( material.sheenColorMap ) {\n\n\t\t\t\tuniforms.sheenColorMap.value = material.sheenColorMap;\n\n\t\t\t\trefreshTransformUniform( material.sheenColorMap, uniforms.sheenColorMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.sheenRoughnessMap ) {\n\n\t\t\t\tuniforms.sheenRoughnessMap.value = material.sheenRoughnessMap;\n\n\t\t\t\trefreshTransformUniform( material.sheenRoughnessMap, uniforms.sheenRoughnessMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.clearcoat > 0 ) {\n\n\t\t\tuniforms.clearcoat.value = material.clearcoat;\n\t\t\tuniforms.clearcoatRoughness.value = material.clearcoatRoughness;\n\n\t\t\tif ( material.clearcoatMap ) {\n\n\t\t\t\tuniforms.clearcoatMap.value = material.clearcoatMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatMap, uniforms.clearcoatMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.clearcoatRoughnessMap ) {\n\n\t\t\t\tuniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatRoughnessMap, uniforms.clearcoatRoughnessMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.clearcoatNormalMap ) {\n\n\t\t\t\tuniforms.clearcoatNormalMap.value = material.clearcoatNormalMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatNormalMap, uniforms.clearcoatNormalMapTransform );\n\n\t\t\t\tuniforms.clearcoatNormalScale.value.copy( material.clearcoatNormalScale );\n\n\t\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\t\tuniforms.clearcoatNormalScale.value.negate();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.dispersion > 0 ) {\n\n\t\t\tuniforms.dispersion.value = material.dispersion;\n\n\t\t}\n\n\t\tif ( material.iridescence > 0 ) {\n\n\t\t\tuniforms.iridescence.value = material.iridescence;\n\t\t\tuniforms.iridescenceIOR.value = material.iridescenceIOR;\n\t\t\tuniforms.iridescenceThicknessMinimum.value = material.iridescenceThicknessRange[ 0 ];\n\t\t\tuniforms.iridescenceThicknessMaximum.value = material.iridescenceThicknessRange[ 1 ];\n\n\t\t\tif ( material.iridescenceMap ) {\n\n\t\t\t\tuniforms.iridescenceMap.value = material.iridescenceMap;\n\n\t\t\t\trefreshTransformUniform( material.iridescenceMap, uniforms.iridescenceMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.iridescenceThicknessMap ) {\n\n\t\t\t\tuniforms.iridescenceThicknessMap.value = material.iridescenceThicknessMap;\n\n\t\t\t\trefreshTransformUniform( material.iridescenceThicknessMap, uniforms.iridescenceThicknessMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.transmission > 0 ) {\n\n\t\t\tuniforms.transmission.value = material.transmission;\n\t\t\tuniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture;\n\t\t\tuniforms.transmissionSamplerSize.value.set( transmissionRenderTarget.width, transmissionRenderTarget.height );\n\n\t\t\tif ( material.transmissionMap ) {\n\n\t\t\t\tuniforms.transmissionMap.value = material.transmissionMap;\n\n\t\t\t\trefreshTransformUniform( material.transmissionMap, uniforms.transmissionMapTransform );\n\n\t\t\t}\n\n\t\t\tuniforms.thickness.value = material.thickness;\n\n\t\t\tif ( material.thicknessMap ) {\n\n\t\t\t\tuniforms.thicknessMap.value = material.thicknessMap;\n\n\t\t\t\trefreshTransformUniform( material.thicknessMap, uniforms.thicknessMapTransform );\n\n\t\t\t}\n\n\t\t\tuniforms.attenuationDistance.value = material.attenuationDistance;\n\t\t\tuniforms.attenuationColor.value.copy( material.attenuationColor );\n\n\t\t}\n\n\t\tif ( material.anisotropy > 0 ) {\n\n\t\t\tuniforms.anisotropyVector.value.set( material.anisotropy * Math.cos( material.anisotropyRotation ), material.anisotropy * Math.sin( material.anisotropyRotation ) );\n\n\t\t\tif ( material.anisotropyMap ) {\n\n\t\t\t\tuniforms.anisotropyMap.value = material.anisotropyMap;\n\n\t\t\t\trefreshTransformUniform( material.anisotropyMap, uniforms.anisotropyMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tuniforms.specularIntensity.value = material.specularIntensity;\n\t\tuniforms.specularColor.value.copy( material.specularColor );\n\n\t\tif ( material.specularColorMap ) {\n\n\t\t\tuniforms.specularColorMap.value = material.specularColorMap;\n\n\t\t\trefreshTransformUniform( material.specularColorMap, uniforms.specularColorMapTransform );\n\n\t\t}\n\n\t\tif ( material.specularIntensityMap ) {\n\n\t\t\tuniforms.specularIntensityMap.value = material.specularIntensityMap;\n\n\t\t\trefreshTransformUniform( material.specularIntensityMap, uniforms.specularIntensityMapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsMatcap( uniforms, material ) {\n\n\t\tif ( material.matcap ) {\n\n\t\t\tuniforms.matcap.value = material.matcap;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDistance( uniforms, material ) {\n\n\t\tconst light = properties.get( material ).light;\n\n\t\tuniforms.referencePosition.value.setFromMatrixPosition( light.matrixWorld );\n\t\tuniforms.nearDistance.value = light.shadow.camera.near;\n\t\tuniforms.farDistance.value = light.shadow.camera.far;\n\n\t}\n\n\treturn {\n\t\trefreshFogUniforms: refreshFogUniforms,\n\t\trefreshMaterialUniforms: refreshMaterialUniforms\n\t};\n\n}\n\nfunction WebGLUniformsGroups( gl, info, capabilities, state ) {\n\n\tlet buffers = {};\n\tlet updateList = {};\n\tlet allocatedBindingPoints = [];\n\n\tconst maxBindingPoints = gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ); // binding points are global whereas block indices are per shader program\n\n\tfunction bind( uniformsGroup, program ) {\n\n\t\tconst webglProgram = program.program;\n\t\tstate.uniformBlockBinding( uniformsGroup, webglProgram );\n\n\t}\n\n\tfunction update( uniformsGroup, program ) {\n\n\t\tlet buffer = buffers[ uniformsGroup.id ];\n\n\t\tif ( buffer === undefined ) {\n\n\t\t\tprepareUniformsGroup( uniformsGroup );\n\n\t\t\tbuffer = createBuffer( uniformsGroup );\n\t\t\tbuffers[ uniformsGroup.id ] = buffer;\n\n\t\t\tuniformsGroup.addEventListener( 'dispose', onUniformsGroupsDispose );\n\n\t\t}\n\n\t\t// ensure to update the binding points/block indices mapping for this program\n\n\t\tconst webglProgram = program.program;\n\t\tstate.updateUBOMapping( uniformsGroup, webglProgram );\n\n\t\t// update UBO once per frame\n\n\t\tconst frame = info.render.frame;\n\n\t\tif ( updateList[ uniformsGroup.id ] !== frame ) {\n\n\t\t\tupdateBufferData( uniformsGroup );\n\n\t\t\tupdateList[ uniformsGroup.id ] = frame;\n\n\t\t}\n\n\t}\n\n\tfunction createBuffer( uniformsGroup ) {\n\n\t\t// the setup of an UBO is independent of a particular shader program but global\n\n\t\tconst bindingPointIndex = allocateBindingPointIndex();\n\t\tuniformsGroup.__bindingPointIndex = bindingPointIndex;\n\n\t\tconst buffer = gl.createBuffer();\n\t\tconst size = uniformsGroup.__size;\n\t\tconst usage = uniformsGroup.usage;\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, buffer );\n\t\tgl.bufferData( gl.UNIFORM_BUFFER, size, usage );\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, null );\n\t\tgl.bindBufferBase( gl.UNIFORM_BUFFER, bindingPointIndex, buffer );\n\n\t\treturn buffer;\n\n\t}\n\n\tfunction allocateBindingPointIndex() {\n\n\t\tfor ( let i = 0; i < maxBindingPoints; i ++ ) {\n\n\t\t\tif ( allocatedBindingPoints.indexOf( i ) === - 1 ) {\n\n\t\t\t\tallocatedBindingPoints.push( i );\n\t\t\t\treturn i;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconsole.error( 'THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.' );\n\n\t\treturn 0;\n\n\t}\n\n\tfunction updateBufferData( uniformsGroup ) {\n\n\t\tconst buffer = buffers[ uniformsGroup.id ];\n\t\tconst uniforms = uniformsGroup.uniforms;\n\t\tconst cache = uniformsGroup.__cache;\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, buffer );\n\n\t\tfor ( let i = 0, il = uniforms.length; i < il; i ++ ) {\n\n\t\t\tconst uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];\n\n\t\t\tfor ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {\n\n\t\t\t\tconst uniform = uniformArray[ j ];\n\n\t\t\t\tif ( hasUniformChanged( uniform, i, j, cache ) === true ) {\n\n\t\t\t\t\tconst offset = uniform.__offset;\n\n\t\t\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\t\t\tlet arrayOffset = 0;\n\n\t\t\t\t\tfor ( let k = 0; k < values.length; k ++ ) {\n\n\t\t\t\t\t\tconst value = values[ k ];\n\n\t\t\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\t\t\t// TODO add integer and struct support\n\t\t\t\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\t\t\t\tuniform.__data[ 0 ] = value;\n\t\t\t\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );\n\n\t\t\t\t\t\t} else if ( value.isMatrix3 ) {\n\n\t\t\t\t\t\t\t// manually converting 3x3 to 3x4\n\n\t\t\t\t\t\t\tuniform.__data[ 0 ] = value.elements[ 0 ];\n\t\t\t\t\t\t\tuniform.__data[ 1 ] = value.elements[ 1 ];\n\t\t\t\t\t\t\tuniform.__data[ 2 ] = value.elements[ 2 ];\n\t\t\t\t\t\t\tuniform.__data[ 3 ] = 0;\n\t\t\t\t\t\t\tuniform.__data[ 4 ] = value.elements[ 3 ];\n\t\t\t\t\t\t\tuniform.__data[ 5 ] = value.elements[ 4 ];\n\t\t\t\t\t\t\tuniform.__data[ 6 ] = value.elements[ 5 ];\n\t\t\t\t\t\t\tuniform.__data[ 7 ] = 0;\n\t\t\t\t\t\t\tuniform.__data[ 8 ] = value.elements[ 6 ];\n\t\t\t\t\t\t\tuniform.__data[ 9 ] = value.elements[ 7 ];\n\t\t\t\t\t\t\tuniform.__data[ 10 ] = value.elements[ 8 ];\n\t\t\t\t\t\t\tuniform.__data[ 11 ] = 0;\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tvalue.toArray( uniform.__data, arrayOffset );\n\n\t\t\t\t\t\t\tarrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, null );\n\n\t}\n\n\tfunction hasUniformChanged( uniform, index, indexArray, cache ) {\n\n\t\tconst value = uniform.value;\n\t\tconst indexString = index + '_' + indexArray;\n\n\t\tif ( cache[ indexString ] === undefined ) {\n\n\t\t\t// cache entry does not exist so far\n\n\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\tcache[ indexString ] = value;\n\n\t\t\t} else {\n\n\t\t\t\tcache[ indexString ] = value.clone();\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t} else {\n\n\t\t\tconst cachedObject = cache[ indexString ];\n\n\t\t\t// compare current value with cached entry\n\n\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\tif ( cachedObject !== value ) {\n\n\t\t\t\t\tcache[ indexString ] = value;\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( cachedObject.equals( value ) === false ) {\n\n\t\t\t\t\tcachedObject.copy( value );\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tfunction prepareUniformsGroup( uniformsGroup ) {\n\n\t\t// determine total buffer size according to the STD140 layout\n\t\t// Hint: STD140 is the only supported layout in WebGL 2\n\n\t\tconst uniforms = uniformsGroup.uniforms;\n\n\t\tlet offset = 0; // global buffer offset in bytes\n\t\tconst chunkSize = 16; // size of a chunk in bytes\n\n\t\tfor ( let i = 0, l = uniforms.length; i < l; i ++ ) {\n\n\t\t\tconst uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];\n\n\t\t\tfor ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {\n\n\t\t\t\tconst uniform = uniformArray[ j ];\n\n\t\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\t\tfor ( let k = 0, kl = values.length; k < kl; k ++ ) {\n\n\t\t\t\t\tconst value = values[ k ];\n\n\t\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\t\tconst chunkOffset = offset % chunkSize; // offset in the current chunk\n\t\t\t\t\tconst chunkPadding = chunkOffset % info.boundary; // required padding to match boundary\n\t\t\t\t\tconst chunkStart = chunkOffset + chunkPadding; // the start position in the current chunk for the data\n\n\t\t\t\t\toffset += chunkPadding;\n\n\t\t\t\t\t// Check for chunk overflow\n\t\t\t\t\tif ( chunkStart !== 0 && ( chunkSize - chunkStart ) < info.storage ) {\n\n\t\t\t\t\t\t// Add padding and adjust offset\n\t\t\t\t\t\toffset += ( chunkSize - chunkStart );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the following two properties will be used for partial buffer updates\n\t\t\t\t\tuniform.__data = new Float32Array( info.storage / Float32Array.BYTES_PER_ELEMENT );\n\t\t\t\t\tuniform.__offset = offset;\n\n\t\t\t\t\t// Update the global offset\n\t\t\t\t\toffset += info.storage;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ensure correct final padding\n\n\t\tconst chunkOffset = offset % chunkSize;\n\n\t\tif ( chunkOffset > 0 ) offset += ( chunkSize - chunkOffset );\n\n\t\t//\n\n\t\tuniformsGroup.__size = offset;\n\t\tuniformsGroup.__cache = {};\n\n\t\treturn this;\n\n\t}\n\n\tfunction getUniformSize( value ) {\n\n\t\tconst info = {\n\t\t\tboundary: 0, // bytes\n\t\t\tstorage: 0 // bytes\n\t\t};\n\n\t\t// determine sizes according to STD140\n\n\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t// float/int/bool\n\n\t\t\tinfo.boundary = 4;\n\t\t\tinfo.storage = 4;\n\n\t\t} else if ( value.isVector2 ) {\n\n\t\t\t// vec2\n\n\t\t\tinfo.boundary = 8;\n\t\t\tinfo.storage = 8;\n\n\t\t} else if ( value.isVector3 || value.isColor ) {\n\n\t\t\t// vec3\n\n\t\t\tinfo.boundary = 16;\n\t\t\tinfo.storage = 12; // evil: vec3 must start on a 16-byte boundary but it only consumes 12 bytes\n\n\t\t} else if ( value.isVector4 ) {\n\n\t\t\t// vec4\n\n\t\t\tinfo.boundary = 16;\n\t\t\tinfo.storage = 16;\n\n\t\t} else if ( value.isMatrix3 ) {\n\n\t\t\t// mat3 (in STD140 a 3x3 matrix is represented as 3x4)\n\n\t\t\tinfo.boundary = 48;\n\t\t\tinfo.storage = 48;\n\n\t\t} else if ( value.isMatrix4 ) {\n\n\t\t\t// mat4\n\n\t\t\tinfo.boundary = 64;\n\t\t\tinfo.storage = 64;\n\n\t\t} else if ( value.isTexture ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.' );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Unsupported uniform value type.', value );\n\n\t\t}\n\n\t\treturn info;\n\n\t}\n\n\tfunction onUniformsGroupsDispose( event ) {\n\n\t\tconst uniformsGroup = event.target;\n\n\t\tuniformsGroup.removeEventListener( 'dispose', onUniformsGroupsDispose );\n\n\t\tconst index = allocatedBindingPoints.indexOf( uniformsGroup.__bindingPointIndex );\n\t\tallocatedBindingPoints.splice( index, 1 );\n\n\t\tgl.deleteBuffer( buffers[ uniformsGroup.id ] );\n\n\t\tdelete buffers[ uniformsGroup.id ];\n\t\tdelete updateList[ uniformsGroup.id ];\n\n\t}\n\n\tfunction dispose() {\n\n\t\tfor ( const id in buffers ) {\n\n\t\t\tgl.deleteBuffer( buffers[ id ] );\n\n\t\t}\n\n\t\tallocatedBindingPoints = [];\n\t\tbuffers = {};\n\t\tupdateList = {};\n\n\t}\n\n\treturn {\n\n\t\tbind: bind,\n\t\tupdate: update,\n\n\t\tdispose: dispose\n\n\t};\n\n}\n\nclass WebGLRenderer {\n\n\tconstructor( parameters = {} ) {\n\n\t\tconst {\n\t\t\tcanvas = createCanvasElement(),\n\t\t\tcontext = null,\n\t\t\tdepth = true,\n\t\t\tstencil = false,\n\t\t\talpha = false,\n\t\t\tantialias = false,\n\t\t\tpremultipliedAlpha = true,\n\t\t\tpreserveDrawingBuffer = false,\n\t\t\tpowerPreference = 'default',\n\t\t\tfailIfMajorPerformanceCaveat = false,\n\t\t} = parameters;\n\n\t\tthis.isWebGLRenderer = true;\n\n\t\tlet _alpha;\n\n\t\tif ( context !== null ) {\n\n\t\t\tif ( typeof WebGLRenderingContext !== 'undefined' && context instanceof WebGLRenderingContext ) {\n\n\t\t\t\tthrow new Error( 'THREE.WebGLRenderer: WebGL 1 is not supported since r163.' );\n\n\t\t\t}\n\n\t\t\t_alpha = context.getContextAttributes().alpha;\n\n\t\t} else {\n\n\t\t\t_alpha = alpha;\n\n\t\t}\n\n\t\tconst uintClearColor = new Uint32Array( 4 );\n\t\tconst intClearColor = new Int32Array( 4 );\n\n\t\tlet currentRenderList = null;\n\t\tlet currentRenderState = null;\n\n\t\t// render() can be called from within a callback triggered by another render.\n\t\t// We track this so that the nested render call gets its list and state isolated from the parent render call.\n\n\t\tconst renderListStack = [];\n\t\tconst renderStateStack = [];\n\n\t\t// public properties\n\n\t\tthis.domElement = canvas;\n\n\t\t// Debug configuration container\n\t\tthis.debug = {\n\n\t\t\t/**\n\t\t\t * Enables error checking and reporting when shader programs are being compiled\n\t\t\t * @type {boolean}\n\t\t\t */\n\t\t\tcheckShaderErrors: true,\n\t\t\t/**\n\t\t\t * Callback for custom error reporting.\n\t\t\t * @type {?Function}\n\t\t\t */\n\t\t\tonShaderError: null\n\t\t};\n\n\t\t// clearing\n\n\t\tthis.autoClear = true;\n\t\tthis.autoClearColor = true;\n\t\tthis.autoClearDepth = true;\n\t\tthis.autoClearStencil = true;\n\n\t\t// scene graph\n\n\t\tthis.sortObjects = true;\n\n\t\t// user-defined clipping\n\n\t\tthis.clippingPlanes = [];\n\t\tthis.localClippingEnabled = false;\n\n\t\t// physically based shading\n\n\t\tthis._outputColorSpace = SRGBColorSpace;\n\n\t\t// tone mapping\n\n\t\tthis.toneMapping = NoToneMapping;\n\t\tthis.toneMappingExposure = 1.0;\n\n\t\t// internal properties\n\n\t\tconst _this = this;\n\n\t\tlet _isContextLost = false;\n\n\t\t// internal state cache\n\n\t\tlet _currentActiveCubeFace = 0;\n\t\tlet _currentActiveMipmapLevel = 0;\n\t\tlet _currentRenderTarget = null;\n\t\tlet _currentMaterialId = - 1;\n\n\t\tlet _currentCamera = null;\n\n\t\tconst _currentViewport = new Vector4();\n\t\tconst _currentScissor = new Vector4();\n\t\tlet _currentScissorTest = null;\n\n\t\tconst _currentClearColor = new Color( 0x000000 );\n\t\tlet _currentClearAlpha = 0;\n\n\t\t//\n\n\t\tlet _width = canvas.width;\n\t\tlet _height = canvas.height;\n\n\t\tlet _pixelRatio = 1;\n\t\tlet _opaqueSort = null;\n\t\tlet _transparentSort = null;\n\n\t\tconst _viewport = new Vector4( 0, 0, _width, _height );\n\t\tconst _scissor = new Vector4( 0, 0, _width, _height );\n\t\tlet _scissorTest = false;\n\n\t\t// frustum\n\n\t\tconst _frustum = new Frustum();\n\n\t\t// clipping\n\n\t\tlet _clippingEnabled = false;\n\t\tlet _localClippingEnabled = false;\n\n\t\t// camera matrices cache\n\n\t\tconst _projScreenMatrix = new Matrix4();\n\n\t\tconst _vector3 = new Vector3();\n\n\t\tconst _vector4 = new Vector4();\n\n\t\tconst _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };\n\n\t\tlet _renderBackground = false;\n\n\t\tfunction getTargetPixelRatio() {\n\n\t\t\treturn _currentRenderTarget === null ? _pixelRatio : 1;\n\n\t\t}\n\n\t\t// initialize\n\n\t\tlet _gl = context;\n\n\t\tfunction getContext( contextName, contextAttributes ) {\n\n\t\t\treturn canvas.getContext( contextName, contextAttributes );\n\n\t\t}\n\n\t\ttry {\n\n\t\t\tconst contextAttributes = {\n\t\t\t\talpha: true,\n\t\t\t\tdepth,\n\t\t\t\tstencil,\n\t\t\t\tantialias,\n\t\t\t\tpremultipliedAlpha,\n\t\t\t\tpreserveDrawingBuffer,\n\t\t\t\tpowerPreference,\n\t\t\t\tfailIfMajorPerformanceCaveat,\n\t\t\t};\n\n\t\t\t// OffscreenCanvas does not have setAttribute, see #22811\n\t\t\tif ( 'setAttribute' in canvas ) canvas.setAttribute( 'data-engine', `three.js r${REVISION}` );\n\n\t\t\t// event listeners must be registered before WebGL context is created, see #12753\n\t\t\tcanvas.addEventListener( 'webglcontextlost', onContextLost, false );\n\t\t\tcanvas.addEventListener( 'webglcontextrestored', onContextRestore, false );\n\t\t\tcanvas.addEventListener( 'webglcontextcreationerror', onContextCreationError, false );\n\n\t\t\tif ( _gl === null ) {\n\n\t\t\t\tconst contextName = 'webgl2';\n\n\t\t\t\t_gl = getContext( contextName, contextAttributes );\n\n\t\t\t\tif ( _gl === null ) {\n\n\t\t\t\t\tif ( getContext( contextName ) ) {\n\n\t\t\t\t\t\tthrow new Error( 'Error creating WebGL context with your selected attributes.' );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthrow new Error( 'Error creating WebGL context.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLRenderer: ' + error.message );\n\t\t\tthrow error;\n\n\t\t}\n\n\t\tlet extensions, capabilities, state, info;\n\t\tlet properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;\n\t\tlet programCache, materials, renderLists, renderStates, clipping, shadowMap;\n\n\t\tlet background, morphtargets, bufferRenderer, indexedBufferRenderer;\n\n\t\tlet utils, bindingStates, uniformsGroups;\n\n\t\tfunction initGLContext() {\n\n\t\t\textensions = new WebGLExtensions( _gl );\n\t\t\textensions.init();\n\n\t\t\tutils = new WebGLUtils( _gl, extensions );\n\n\t\t\tcapabilities = new WebGLCapabilities( _gl, extensions, parameters, utils );\n\n\t\t\tstate = new WebGLState( _gl );\n\n\t\t\tinfo = new WebGLInfo( _gl );\n\t\t\tproperties = new WebGLProperties();\n\t\t\ttextures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );\n\t\t\tcubemaps = new WebGLCubeMaps( _this );\n\t\t\tcubeuvmaps = new WebGLCubeUVMaps( _this );\n\t\t\tattributes = new WebGLAttributes( _gl );\n\t\t\tbindingStates = new WebGLBindingStates( _gl, attributes );\n\t\t\tgeometries = new WebGLGeometries( _gl, attributes, info, bindingStates );\n\t\t\tobjects = new WebGLObjects( _gl, geometries, attributes, info );\n\t\t\tmorphtargets = new WebGLMorphtargets( _gl, capabilities, textures );\n\t\t\tclipping = new WebGLClipping( properties );\n\t\t\tprogramCache = new WebGLPrograms( _this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping );\n\t\t\tmaterials = new WebGLMaterials( _this, properties );\n\t\t\trenderLists = new WebGLRenderLists();\n\t\t\trenderStates = new WebGLRenderStates( extensions );\n\t\t\tbackground = new WebGLBackground( _this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha );\n\t\t\tshadowMap = new WebGLShadowMap( _this, objects, capabilities );\n\t\t\tuniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );\n\n\t\t\tbufferRenderer = new WebGLBufferRenderer( _gl, extensions, info );\n\t\t\tindexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info );\n\n\t\t\tinfo.programs = programCache.programs;\n\n\t\t\t_this.capabilities = capabilities;\n\t\t\t_this.extensions = extensions;\n\t\t\t_this.properties = properties;\n\t\t\t_this.renderLists = renderLists;\n\t\t\t_this.shadowMap = shadowMap;\n\t\t\t_this.state = state;\n\t\t\t_this.info = info;\n\n\t\t}\n\n\t\tinitGLContext();\n\n\t\t// xr\n\n\t\tconst xr = new WebXRManager( _this, _gl );\n\n\t\tthis.xr = xr;\n\n\t\t// API\n\n\t\tthis.getContext = function () {\n\n\t\t\treturn _gl;\n\n\t\t};\n\n\t\tthis.getContextAttributes = function () {\n\n\t\t\treturn _gl.getContextAttributes();\n\n\t\t};\n\n\t\tthis.forceContextLoss = function () {\n\n\t\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\n\t\t\tif ( extension ) extension.loseContext();\n\n\t\t};\n\n\t\tthis.forceContextRestore = function () {\n\n\t\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\n\t\t\tif ( extension ) extension.restoreContext();\n\n\t\t};\n\n\t\tthis.getPixelRatio = function () {\n\n\t\t\treturn _pixelRatio;\n\n\t\t};\n\n\t\tthis.setPixelRatio = function ( value ) {\n\n\t\t\tif ( value === undefined ) return;\n\n\t\t\t_pixelRatio = value;\n\n\t\t\tthis.setSize( _width, _height, false );\n\n\t\t};\n\n\t\tthis.getSize = function ( target ) {\n\n\t\t\treturn target.set( _width, _height );\n\n\t\t};\n\n\t\tthis.setSize = function ( width, height, updateStyle = true ) {\n\n\t\t\tif ( xr.isPresenting ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Can\\'t change size while VR device is presenting.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t_width = width;\n\t\t\t_height = height;\n\n\t\t\tcanvas.width = Math.floor( width * _pixelRatio );\n\t\t\tcanvas.height = Math.floor( height * _pixelRatio );\n\n\t\t\tif ( updateStyle === true ) {\n\n\t\t\t\tcanvas.style.width = width + 'px';\n\t\t\t\tcanvas.style.height = height + 'px';\n\n\t\t\t}\n\n\t\t\tthis.setViewport( 0, 0, width, height );\n\n\t\t};\n\n\t\tthis.getDrawingBufferSize = function ( target ) {\n\n\t\t\treturn target.set( _width * _pixelRatio, _height * _pixelRatio ).floor();\n\n\t\t};\n\n\t\tthis.setDrawingBufferSize = function ( width, height, pixelRatio ) {\n\n\t\t\t_width = width;\n\t\t\t_height = height;\n\n\t\t\t_pixelRatio = pixelRatio;\n\n\t\t\tcanvas.width = Math.floor( width * pixelRatio );\n\t\t\tcanvas.height = Math.floor( height * pixelRatio );\n\n\t\t\tthis.setViewport( 0, 0, width, height );\n\n\t\t};\n\n\t\tthis.getCurrentViewport = function ( target ) {\n\n\t\t\treturn target.copy( _currentViewport );\n\n\t\t};\n\n\t\tthis.getViewport = function ( target ) {\n\n\t\t\treturn target.copy( _viewport );\n\n\t\t};\n\n\t\tthis.setViewport = function ( x, y, width, height ) {\n\n\t\t\tif ( x.isVector4 ) {\n\n\t\t\t\t_viewport.set( x.x, x.y, x.z, x.w );\n\n\t\t\t} else {\n\n\t\t\t\t_viewport.set( x, y, width, height );\n\n\t\t\t}\n\n\t\t\tstate.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).round() );\n\n\t\t};\n\n\t\tthis.getScissor = function ( target ) {\n\n\t\t\treturn target.copy( _scissor );\n\n\t\t};\n\n\t\tthis.setScissor = function ( x, y, width, height ) {\n\n\t\t\tif ( x.isVector4 ) {\n\n\t\t\t\t_scissor.set( x.x, x.y, x.z, x.w );\n\n\t\t\t} else {\n\n\t\t\t\t_scissor.set( x, y, width, height );\n\n\t\t\t}\n\n\t\t\tstate.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).round() );\n\n\t\t};\n\n\t\tthis.getScissorTest = function () {\n\n\t\t\treturn _scissorTest;\n\n\t\t};\n\n\t\tthis.setScissorTest = function ( boolean ) {\n\n\t\t\tstate.setScissorTest( _scissorTest = boolean );\n\n\t\t};\n\n\t\tthis.setOpaqueSort = function ( method ) {\n\n\t\t\t_opaqueSort = method;\n\n\t\t};\n\n\t\tthis.setTransparentSort = function ( method ) {\n\n\t\t\t_transparentSort = method;\n\n\t\t};\n\n\t\t// Clearing\n\n\t\tthis.getClearColor = function ( target ) {\n\n\t\t\treturn target.copy( background.getClearColor() );\n\n\t\t};\n\n\t\tthis.setClearColor = function () {\n\n\t\t\tbackground.setClearColor.apply( background, arguments );\n\n\t\t};\n\n\t\tthis.getClearAlpha = function () {\n\n\t\t\treturn background.getClearAlpha();\n\n\t\t};\n\n\t\tthis.setClearAlpha = function () {\n\n\t\t\tbackground.setClearAlpha.apply( background, arguments );\n\n\t\t};\n\n\t\tthis.clear = function ( color = true, depth = true, stencil = true ) {\n\n\t\t\tlet bits = 0;\n\n\t\t\tif ( color ) {\n\n\t\t\t\t// check if we're trying to clear an integer target\n\t\t\t\tlet isIntegerFormat = false;\n\t\t\t\tif ( _currentRenderTarget !== null ) {\n\n\t\t\t\t\tconst targetFormat = _currentRenderTarget.texture.format;\n\t\t\t\t\tisIntegerFormat = targetFormat === RGBAIntegerFormat ||\n\t\t\t\t\t\ttargetFormat === RGIntegerFormat ||\n\t\t\t\t\t\ttargetFormat === RedIntegerFormat;\n\n\t\t\t\t}\n\n\t\t\t\t// use the appropriate clear functions to clear the target if it's a signed\n\t\t\t\t// or unsigned integer target\n\t\t\t\tif ( isIntegerFormat ) {\n\n\t\t\t\t\tconst targetType = _currentRenderTarget.texture.type;\n\t\t\t\t\tconst isUnsignedType = targetType === UnsignedByteType ||\n\t\t\t\t\t\ttargetType === UnsignedIntType ||\n\t\t\t\t\t\ttargetType === UnsignedShortType ||\n\t\t\t\t\t\ttargetType === UnsignedInt248Type ||\n\t\t\t\t\t\ttargetType === UnsignedShort4444Type ||\n\t\t\t\t\t\ttargetType === UnsignedShort5551Type;\n\n\t\t\t\t\tconst clearColor = background.getClearColor();\n\t\t\t\t\tconst a = background.getClearAlpha();\n\t\t\t\t\tconst r = clearColor.r;\n\t\t\t\t\tconst g = clearColor.g;\n\t\t\t\t\tconst b = clearColor.b;\n\n\t\t\t\t\tif ( isUnsignedType ) {\n\n\t\t\t\t\t\tuintClearColor[ 0 ] = r;\n\t\t\t\t\t\tuintClearColor[ 1 ] = g;\n\t\t\t\t\t\tuintClearColor[ 2 ] = b;\n\t\t\t\t\t\tuintClearColor[ 3 ] = a;\n\t\t\t\t\t\t_gl.clearBufferuiv( _gl.COLOR, 0, uintClearColor );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tintClearColor[ 0 ] = r;\n\t\t\t\t\t\tintClearColor[ 1 ] = g;\n\t\t\t\t\t\tintClearColor[ 2 ] = b;\n\t\t\t\t\t\tintClearColor[ 3 ] = a;\n\t\t\t\t\t\t_gl.clearBufferiv( _gl.COLOR, 0, intClearColor );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbits |= _gl.COLOR_BUFFER_BIT;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( depth ) bits |= _gl.DEPTH_BUFFER_BIT;\n\t\t\tif ( stencil ) {\n\n\t\t\t\tbits |= _gl.STENCIL_BUFFER_BIT;\n\t\t\t\tthis.state.buffers.stencil.setMask( 0xffffffff );\n\n\t\t\t}\n\n\t\t\t_gl.clear( bits );\n\n\t\t};\n\n\t\tthis.clearColor = function () {\n\n\t\t\tthis.clear( true, false, false );\n\n\t\t};\n\n\t\tthis.clearDepth = function () {\n\n\t\t\tthis.clear( false, true, false );\n\n\t\t};\n\n\t\tthis.clearStencil = function () {\n\n\t\t\tthis.clear( false, false, true );\n\n\t\t};\n\n\t\t//\n\n\t\tthis.dispose = function () {\n\n\t\t\tcanvas.removeEventListener( 'webglcontextlost', onContextLost, false );\n\t\t\tcanvas.removeEventListener( 'webglcontextrestored', onContextRestore, false );\n\t\t\tcanvas.removeEventListener( 'webglcontextcreationerror', onContextCreationError, false );\n\n\t\t\trenderLists.dispose();\n\t\t\trenderStates.dispose();\n\t\t\tproperties.dispose();\n\t\t\tcubemaps.dispose();\n\t\t\tcubeuvmaps.dispose();\n\t\t\tobjects.dispose();\n\t\t\tbindingStates.dispose();\n\t\t\tuniformsGroups.dispose();\n\t\t\tprogramCache.dispose();\n\n\t\t\txr.dispose();\n\n\t\t\txr.removeEventListener( 'sessionstart', onXRSessionStart );\n\t\t\txr.removeEventListener( 'sessionend', onXRSessionEnd );\n\n\t\t\tanimation.stop();\n\n\t\t};\n\n\t\t// Events\n\n\t\tfunction onContextLost( event ) {\n\n\t\t\tevent.preventDefault();\n\n\t\t\tconsole.log( 'THREE.WebGLRenderer: Context Lost.' );\n\n\t\t\t_isContextLost = true;\n\n\t\t}\n\n\t\tfunction onContextRestore( /* event */ ) {\n\n\t\t\tconsole.log( 'THREE.WebGLRenderer: Context Restored.' );\n\n\t\t\t_isContextLost = false;\n\n\t\t\tconst infoAutoReset = info.autoReset;\n\t\t\tconst shadowMapEnabled = shadowMap.enabled;\n\t\t\tconst shadowMapAutoUpdate = shadowMap.autoUpdate;\n\t\t\tconst shadowMapNeedsUpdate = shadowMap.needsUpdate;\n\t\t\tconst shadowMapType = shadowMap.type;\n\n\t\t\tinitGLContext();\n\n\t\t\tinfo.autoReset = infoAutoReset;\n\t\t\tshadowMap.enabled = shadowMapEnabled;\n\t\t\tshadowMap.autoUpdate = shadowMapAutoUpdate;\n\t\t\tshadowMap.needsUpdate = shadowMapNeedsUpdate;\n\t\t\tshadowMap.type = shadowMapType;\n\n\t\t}\n\n\t\tfunction onContextCreationError( event ) {\n\n\t\t\tconsole.error( 'THREE.WebGLRenderer: A WebGL context could not be created. Reason: ', event.statusMessage );\n\n\t\t}\n\n\t\tfunction onMaterialDispose( event ) {\n\n\t\t\tconst material = event.target;\n\n\t\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\n\n\t\t\tdeallocateMaterial( material );\n\n\t\t}\n\n\t\t// Buffer deallocation\n\n\t\tfunction deallocateMaterial( material ) {\n\n\t\t\treleaseMaterialProgramReferences( material );\n\n\t\t\tproperties.remove( material );\n\n\t\t}\n\n\n\t\tfunction releaseMaterialProgramReferences( material ) {\n\n\t\t\tconst programs = properties.get( material ).programs;\n\n\t\t\tif ( programs !== undefined ) {\n\n\t\t\t\tprograms.forEach( function ( program ) {\n\n\t\t\t\t\tprogramCache.releaseProgram( program );\n\n\t\t\t\t} );\n\n\t\t\t\tif ( material.isShaderMaterial ) {\n\n\t\t\t\t\tprogramCache.releaseShaderCache( material );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Buffer rendering\n\n\t\tthis.renderBufferDirect = function ( camera, scene, geometry, material, object, group ) {\n\n\t\t\tif ( scene === null ) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)\n\n\t\t\tconst frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );\n\n\t\t\tconst program = setProgram( camera, scene, geometry, material, object );\n\n\t\t\tstate.setMaterial( material, frontFaceCW );\n\n\t\t\t//\n\n\t\t\tlet index = geometry.index;\n\t\t\tlet rangeFactor = 1;\n\n\t\t\tif ( material.wireframe === true ) {\n\n\t\t\t\tindex = geometries.getWireframeAttribute( geometry );\n\n\t\t\t\tif ( index === undefined ) return;\n\n\t\t\t\trangeFactor = 2;\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tconst drawRange = geometry.drawRange;\n\t\t\tconst position = geometry.attributes.position;\n\n\t\t\tlet drawStart = drawRange.start * rangeFactor;\n\t\t\tlet drawEnd = ( drawRange.start + drawRange.count ) * rangeFactor;\n\n\t\t\tif ( group !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, group.start * rangeFactor );\n\t\t\t\tdrawEnd = Math.min( drawEnd, ( group.start + group.count ) * rangeFactor );\n\n\t\t\t}\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, 0 );\n\t\t\t\tdrawEnd = Math.min( drawEnd, index.count );\n\n\t\t\t} else if ( position !== undefined && position !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, 0 );\n\t\t\t\tdrawEnd = Math.min( drawEnd, position.count );\n\n\t\t\t}\n\n\t\t\tconst drawCount = drawEnd - drawStart;\n\n\t\t\tif ( drawCount < 0 || drawCount === Infinity ) return;\n\n\t\t\t//\n\n\t\t\tbindingStates.setup( object, material, program, geometry, index );\n\n\t\t\tlet attribute;\n\t\t\tlet renderer = bufferRenderer;\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tattribute = attributes.get( index );\n\n\t\t\t\trenderer = indexedBufferRenderer;\n\t\t\t\trenderer.setIndex( attribute );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( object.isMesh ) {\n\n\t\t\t\tif ( material.wireframe === true ) {\n\n\t\t\t\t\tstate.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() );\n\t\t\t\t\trenderer.setMode( _gl.LINES );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderer.setMode( _gl.TRIANGLES );\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isLine ) {\n\n\t\t\t\tlet lineWidth = material.linewidth;\n\n\t\t\t\tif ( lineWidth === undefined ) lineWidth = 1; // Not using Line*Material\n\n\t\t\t\tstate.setLineWidth( lineWidth * getTargetPixelRatio() );\n\n\t\t\t\tif ( object.isLineSegments ) {\n\n\t\t\t\t\trenderer.setMode( _gl.LINES );\n\n\t\t\t\t} else if ( object.isLineLoop ) {\n\n\t\t\t\t\trenderer.setMode( _gl.LINE_LOOP );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderer.setMode( _gl.LINE_STRIP );\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isPoints ) {\n\n\t\t\t\trenderer.setMode( _gl.POINTS );\n\n\t\t\t} else if ( object.isSprite ) {\n\n\t\t\t\trenderer.setMode( _gl.TRIANGLES );\n\n\t\t\t}\n\n\t\t\tif ( object.isBatchedMesh ) {\n\n\t\t\t\tif ( object._multiDrawInstances !== null ) {\n\n\t\t\t\t\trenderer.renderMultiDrawInstances( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( ! extensions.get( 'WEBGL_multi_draw' ) ) {\n\n\t\t\t\t\t\tconst starts = object._multiDrawStarts;\n\t\t\t\t\t\tconst counts = object._multiDrawCounts;\n\t\t\t\t\t\tconst drawCount = object._multiDrawCount;\n\t\t\t\t\t\tconst bytesPerElement = index ? attributes.get( index ).bytesPerElement : 1;\n\t\t\t\t\t\tconst uniforms = properties.get( material ).currentProgram.getUniforms();\n\t\t\t\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\t\t\t\tuniforms.setValue( _gl, '_gl_DrawID', i );\n\t\t\t\t\t\t\trenderer.render( starts[ i ] / bytesPerElement, counts[ i ] );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\trenderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isInstancedMesh ) {\n\n\t\t\t\trenderer.renderInstances( drawStart, drawCount, object.count );\n\n\t\t\t} else if ( geometry.isInstancedBufferGeometry ) {\n\n\t\t\t\tconst maxInstanceCount = geometry._maxInstanceCount !== undefined ? geometry._maxInstanceCount : Infinity;\n\t\t\t\tconst instanceCount = Math.min( geometry.instanceCount, maxInstanceCount );\n\n\t\t\t\trenderer.renderInstances( drawStart, drawCount, instanceCount );\n\n\t\t\t} else {\n\n\t\t\t\trenderer.render( drawStart, drawCount );\n\n\t\t\t}\n\n\t\t};\n\n\t\t// Compile\n\n\t\tfunction prepareMaterial( material, scene, object ) {\n\n\t\t\tif ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {\n\n\t\t\t\tmaterial.side = BackSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\tmaterial.side = FrontSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\tmaterial.side = DoubleSide;\n\n\t\t\t} else {\n\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.compile = function ( scene, camera, targetScene = null ) {\n\n\t\t\tif ( targetScene === null ) targetScene = scene;\n\n\t\t\tcurrentRenderState = renderStates.get( targetScene );\n\t\t\tcurrentRenderState.init( camera );\n\n\t\t\trenderStateStack.push( currentRenderState );\n\n\t\t\t// gather lights from both the target scene and the new object that will be added to the scene.\n\n\t\t\ttargetScene.traverseVisible( function ( object ) {\n\n\t\t\t\tif ( object.isLight && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\tif ( scene !== targetScene ) {\n\n\t\t\t\tscene.traverseVisible( function ( object ) {\n\n\t\t\t\t\tif ( object.isLight && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\tcurrentRenderState.setupLights();\n\n\t\t\t// Only initialize materials in the new scene, not the targetScene.\n\n\t\t\tconst materials = new Set();\n\n\t\t\tscene.traverse( function ( object ) {\n\n\t\t\t\tconst material = object.material;\n\n\t\t\t\tif ( material ) {\n\n\t\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\t\tfor ( let i = 0; i < material.length; i ++ ) {\n\n\t\t\t\t\t\t\tconst material2 = material[ i ];\n\n\t\t\t\t\t\t\tprepareMaterial( material2, targetScene, object );\n\t\t\t\t\t\t\tmaterials.add( material2 );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tprepareMaterial( material, targetScene, object );\n\t\t\t\t\t\tmaterials.add( material );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\trenderStateStack.pop();\n\t\t\tcurrentRenderState = null;\n\n\t\t\treturn materials;\n\n\t\t};\n\n\t\t// compileAsync\n\n\t\tthis.compileAsync = function ( scene, camera, targetScene = null ) {\n\n\t\t\tconst materials = this.compile( scene, camera, targetScene );\n\n\t\t\t// Wait for all the materials in the new object to indicate that they're\n\t\t\t// ready to be used before resolving the promise.\n\n\t\t\treturn new Promise( ( resolve ) => {\n\n\t\t\t\tfunction checkMaterialsReady() {\n\n\t\t\t\t\tmaterials.forEach( function ( material ) {\n\n\t\t\t\t\t\tconst materialProperties = properties.get( material );\n\t\t\t\t\t\tconst program = materialProperties.currentProgram;\n\n\t\t\t\t\t\tif ( program.isReady() ) {\n\n\t\t\t\t\t\t\t// remove any programs that report they're ready to use from the list\n\t\t\t\t\t\t\tmaterials.delete( material );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} );\n\n\t\t\t\t\t// once the list of compiling materials is empty, call the callback\n\n\t\t\t\t\tif ( materials.size === 0 ) {\n\n\t\t\t\t\t\tresolve( scene );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// if some materials are still not ready, wait a bit and check again\n\n\t\t\t\t\tsetTimeout( checkMaterialsReady, 10 );\n\n\t\t\t\t}\n\n\t\t\t\tif ( extensions.get( 'KHR_parallel_shader_compile' ) !== null ) {\n\n\t\t\t\t\t// If we can check the compilation status of the materials without\n\t\t\t\t\t// blocking then do so right away.\n\n\t\t\t\t\tcheckMaterialsReady();\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Otherwise start by waiting a bit to give the materials we just\n\t\t\t\t\t// initialized a chance to finish.\n\n\t\t\t\t\tsetTimeout( checkMaterialsReady, 10 );\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t// Animation Loop\n\n\t\tlet onAnimationFrameCallback = null;\n\n\t\tfunction onAnimationFrame( time ) {\n\n\t\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time );\n\n\t\t}\n\n\t\tfunction onXRSessionStart() {\n\n\t\t\tanimation.stop();\n\n\t\t}\n\n\t\tfunction onXRSessionEnd() {\n\n\t\t\tanimation.start();\n\n\t\t}\n\n\t\tconst animation = new WebGLAnimation();\n\t\tanimation.setAnimationLoop( onAnimationFrame );\n\n\t\tif ( typeof self !== 'undefined' ) animation.setContext( self );\n\n\t\tthis.setAnimationLoop = function ( callback ) {\n\n\t\t\tonAnimationFrameCallback = callback;\n\t\t\txr.setAnimationLoop( callback );\n\n\t\t\t( callback === null ) ? animation.stop() : animation.start();\n\n\t\t};\n\n\t\txr.addEventListener( 'sessionstart', onXRSessionStart );\n\t\txr.addEventListener( 'sessionend', onXRSessionEnd );\n\n\t\t// Rendering\n\n\t\tthis.render = function ( scene, camera ) {\n\n\t\t\tif ( camera !== undefined && camera.isCamera !== true ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tif ( _isContextLost === true ) return;\n\n\t\t\t// update scene graph\n\n\t\t\tif ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();\n\n\t\t\t// update camera matrices and frustum\n\n\t\t\tif ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();\n\n\t\t\tif ( xr.enabled === true && xr.isPresenting === true ) {\n\n\t\t\t\tif ( xr.cameraAutoUpdate === true ) xr.updateCamera( camera );\n\n\t\t\t\tcamera = xr.getCamera(); // use XR camera for rendering\n\n\t\t\t}\n\n\t\t\t//\n\t\t\tif ( scene.isScene === true ) scene.onBeforeRender( _this, scene, camera, _currentRenderTarget );\n\n\t\t\tcurrentRenderState = renderStates.get( scene, renderStateStack.length );\n\t\t\tcurrentRenderState.init( camera );\n\n\t\t\trenderStateStack.push( currentRenderState );\n\n\t\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\t\t_frustum.setFromProjectionMatrix( _projScreenMatrix );\n\n\t\t\t_localClippingEnabled = this.localClippingEnabled;\n\t\t\t_clippingEnabled = clipping.init( this.clippingPlanes, _localClippingEnabled );\n\n\t\t\tcurrentRenderList = renderLists.get( scene, renderListStack.length );\n\t\t\tcurrentRenderList.init();\n\n\t\t\trenderListStack.push( currentRenderList );\n\n\t\t\tif ( xr.enabled === true && xr.isPresenting === true ) {\n\n\t\t\t\tconst depthSensingMesh = _this.xr.getDepthSensingMesh();\n\n\t\t\t\tif ( depthSensingMesh !== null ) {\n\n\t\t\t\t\tprojectObject( depthSensingMesh, camera, - Infinity, _this.sortObjects );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tprojectObject( scene, camera, 0, _this.sortObjects );\n\n\t\t\tcurrentRenderList.finish();\n\n\t\t\tif ( _this.sortObjects === true ) {\n\n\t\t\t\tcurrentRenderList.sort( _opaqueSort, _transparentSort );\n\n\t\t\t}\n\n\t\t\t_renderBackground = xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false;\n\t\t\tif ( _renderBackground ) {\n\n\t\t\t\tbackground.addToRenderList( currentRenderList, scene );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tthis.info.render.frame ++;\n\n\t\t\tif ( _clippingEnabled === true ) clipping.beginShadows();\n\n\t\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\t\tshadowMap.render( shadowsArray, scene, camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.endShadows();\n\n\t\t\t//\n\n\t\t\tif ( this.info.autoReset === true ) this.info.reset();\n\n\t\t\t// render scene\n\n\t\t\tconst opaqueObjects = currentRenderList.opaque;\n\t\t\tconst transmissiveObjects = currentRenderList.transmissive;\n\n\t\t\tcurrentRenderState.setupLights();\n\n\t\t\tif ( camera.isArrayCamera ) {\n\n\t\t\t\tconst cameras = camera.cameras;\n\n\t\t\t\tif ( transmissiveObjects.length > 0 ) {\n\n\t\t\t\t\tfor ( let i = 0, l = cameras.length; i < l; i ++ ) {\n\n\t\t\t\t\t\tconst camera2 = cameras[ i ];\n\n\t\t\t\t\t\trenderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( _renderBackground ) background.render( scene );\n\n\t\t\t\tfor ( let i = 0, l = cameras.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst camera2 = cameras[ i ];\n\n\t\t\t\t\trenderScene( currentRenderList, scene, camera2, camera2.viewport );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );\n\n\t\t\t\tif ( _renderBackground ) background.render( scene );\n\n\t\t\t\trenderScene( currentRenderList, scene, camera );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( _currentRenderTarget !== null ) {\n\n\t\t\t\t// resolve multisample renderbuffers to a single-sample texture if necessary\n\n\t\t\t\ttextures.updateMultisampleRenderTarget( _currentRenderTarget );\n\n\t\t\t\t// Generate mipmap if we're using any kind of mipmap filtering\n\n\t\t\t\ttextures.updateRenderTargetMipmap( _currentRenderTarget );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );\n\n\t\t\t// _gl.finish();\n\n\t\t\tbindingStates.resetDefaultState();\n\t\t\t_currentMaterialId = - 1;\n\t\t\t_currentCamera = null;\n\n\t\t\trenderStateStack.pop();\n\n\t\t\tif ( renderStateStack.length > 0 ) {\n\n\t\t\t\tcurrentRenderState = renderStateStack[ renderStateStack.length - 1 ];\n\n\t\t\t\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, currentRenderState.state.camera );\n\n\t\t\t} else {\n\n\t\t\t\tcurrentRenderState = null;\n\n\t\t\t}\n\n\t\t\trenderListStack.pop();\n\n\t\t\tif ( renderListStack.length > 0 ) {\n\n\t\t\t\tcurrentRenderList = renderListStack[ renderListStack.length - 1 ];\n\n\t\t\t} else {\n\n\t\t\t\tcurrentRenderList = null;\n\n\t\t\t}\n\n\t\t};\n\n\t\tfunction projectObject( object, camera, groupOrder, sortObjects ) {\n\n\t\t\tif ( object.visible === false ) return;\n\n\t\t\tconst visible = object.layers.test( camera.layers );\n\n\t\t\tif ( visible ) {\n\n\t\t\t\tif ( object.isGroup ) {\n\n\t\t\t\t\tgroupOrder = object.renderOrder;\n\n\t\t\t\t} else if ( object.isLOD ) {\n\n\t\t\t\t\tif ( object.autoUpdate === true ) object.update( camera );\n\n\t\t\t\t} else if ( object.isLight ) {\n\n\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( object.isSprite ) {\n\n\t\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsSprite( object ) ) {\n\n\t\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t\t_vector4.setFromMatrixPosition( object.matrixWorld )\n\t\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\t\t\tconst material = object.material;\n\n\t\t\t\t\t\tif ( material.visible ) {\n\n\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector4.z, null );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( object.isMesh || object.isLine || object.isPoints ) {\n\n\t\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) {\n\n\t\t\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\t\t\tconst material = object.material;\n\n\t\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t\tif ( object.boundingSphere !== undefined ) {\n\n\t\t\t\t\t\t\t\tif ( object.boundingSphere === null ) object.computeBoundingSphere();\n\t\t\t\t\t\t\t\t_vector4.copy( object.boundingSphere.center );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\t\t\t\t\t\t\t\t_vector4.copy( geometry.boundingSphere.center );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t_vector4\n\t\t\t\t\t\t\t\t.applyMatrix4( object.matrixWorld )\n\t\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\t\t\tconst groups = geometry.groups;\n\n\t\t\t\t\t\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\t\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, groupMaterial, groupOrder, _vector4.z, group );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector4.z, null );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst children = object.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tprojectObject( children[ i ], camera, groupOrder, sortObjects );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction renderScene( currentRenderList, scene, camera, viewport ) {\n\n\t\t\tconst opaqueObjects = currentRenderList.opaque;\n\t\t\tconst transmissiveObjects = currentRenderList.transmissive;\n\t\t\tconst transparentObjects = currentRenderList.transparent;\n\n\t\t\tcurrentRenderState.setupLightsView( camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, camera );\n\n\t\t\tif ( viewport ) state.viewport( _currentViewport.copy( viewport ) );\n\n\t\t\tif ( opaqueObjects.length > 0 ) renderObjects( opaqueObjects, scene, camera );\n\t\t\tif ( transmissiveObjects.length > 0 ) renderObjects( transmissiveObjects, scene, camera );\n\t\t\tif ( transparentObjects.length > 0 ) renderObjects( transparentObjects, scene, camera );\n\n\t\t\t// Ensure depth buffer writing is enabled so it can be cleared on next render\n\n\t\t\tstate.buffers.depth.setTest( true );\n\t\t\tstate.buffers.depth.setMask( true );\n\t\t\tstate.buffers.color.setMask( true );\n\n\t\t\tstate.setPolygonOffset( false );\n\n\t\t}\n\n\t\tfunction renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera ) {\n\n\t\t\tconst overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n\n\t\t\tif ( overrideMaterial !== null ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tif ( currentRenderState.state.transmissionRenderTarget[ camera.id ] === undefined ) {\n\n\t\t\t\tcurrentRenderState.state.transmissionRenderTarget[ camera.id ] = new WebGLRenderTarget( 1, 1, {\n\t\t\t\t\tgenerateMipmaps: true,\n\t\t\t\t\ttype: ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) ) ? HalfFloatType : UnsignedByteType,\n\t\t\t\t\tminFilter: LinearMipmapLinearFilter,\n\t\t\t\t\tsamples: 4,\n\t\t\t\t\tstencilBuffer: stencil,\n\t\t\t\t\tresolveDepthBuffer: false,\n\t\t\t\t\tresolveStencilBuffer: false,\n\t\t\t\t\tcolorSpace: ColorManagement.workingColorSpace,\n\t\t\t\t} );\n\n\t\t\t\t// debug\n\n\t\t\t\t/*\n\t\t\t\tconst geometry = new PlaneGeometry();\n\t\t\t\tconst material = new MeshBasicMaterial( { map: _transmissionRenderTarget.texture } );\n\n\t\t\t\tconst mesh = new Mesh( geometry, material );\n\t\t\t\tscene.add( mesh );\n\t\t\t\t*/\n\n\t\t\t}\n\n\t\t\tconst transmissionRenderTarget = currentRenderState.state.transmissionRenderTarget[ camera.id ];\n\n\t\t\tconst activeViewport = camera.viewport || _currentViewport;\n\t\t\ttransmissionRenderTarget.setSize( activeViewport.z, activeViewport.w );\n\n\t\t\t//\n\n\t\t\tconst currentRenderTarget = _this.getRenderTarget();\n\t\t\t_this.setRenderTarget( transmissionRenderTarget );\n\n\t\t\t_this.getClearColor( _currentClearColor );\n\t\t\t_currentClearAlpha = _this.getClearAlpha();\n\t\t\tif ( _currentClearAlpha < 1 ) _this.setClearColor( 0xffffff, 0.5 );\n\n\t\t\t_this.clear();\n\n\t\t\tif ( _renderBackground ) background.render( scene );\n\n\t\t\t// Turn off the features which can affect the frag color for opaque objects pass.\n\t\t\t// Otherwise they are applied twice in opaque objects pass and transmission objects pass.\n\t\t\tconst currentToneMapping = _this.toneMapping;\n\t\t\t_this.toneMapping = NoToneMapping;\n\n\t\t\t// Remove viewport from camera to avoid nested render calls resetting viewport to it (e.g Reflector).\n\t\t\t// Transmission render pass requires viewport to match the transmissionRenderTarget.\n\t\t\tconst currentCameraViewport = camera.viewport;\n\t\t\tif ( camera.viewport !== undefined ) camera.viewport = undefined;\n\n\t\t\tcurrentRenderState.setupLightsView( camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, camera );\n\n\t\t\trenderObjects( opaqueObjects, scene, camera );\n\n\t\t\ttextures.updateMultisampleRenderTarget( transmissionRenderTarget );\n\t\t\ttextures.updateRenderTargetMipmap( transmissionRenderTarget );\n\n\t\t\tif ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === false ) { // see #28131\n\n\t\t\t\tlet renderTargetNeedsUpdate = false;\n\n\t\t\t\tfor ( let i = 0, l = transmissiveObjects.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst renderItem = transmissiveObjects[ i ];\n\n\t\t\t\t\tconst object = renderItem.object;\n\t\t\t\t\tconst geometry = renderItem.geometry;\n\t\t\t\t\tconst material = renderItem.material;\n\t\t\t\t\tconst group = renderItem.group;\n\n\t\t\t\t\tif ( material.side === DoubleSide && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\t\tconst currentSide = material.side;\n\n\t\t\t\t\t\tmaterial.side = BackSide;\n\t\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t\t\t\tmaterial.side = currentSide;\n\t\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\t\trenderTargetNeedsUpdate = true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( renderTargetNeedsUpdate === true ) {\n\n\t\t\t\t\ttextures.updateMultisampleRenderTarget( transmissionRenderTarget );\n\t\t\t\t\ttextures.updateRenderTargetMipmap( transmissionRenderTarget );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_this.setRenderTarget( currentRenderTarget );\n\n\t\t\t_this.setClearColor( _currentClearColor, _currentClearAlpha );\n\n\t\t\tif ( currentCameraViewport !== undefined ) camera.viewport = currentCameraViewport;\n\n\t\t\t_this.toneMapping = currentToneMapping;\n\n\t\t}\n\n\t\tfunction renderObjects( renderList, scene, camera ) {\n\n\t\t\tconst overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n\n\t\t\tfor ( let i = 0, l = renderList.length; i < l; i ++ ) {\n\n\t\t\t\tconst renderItem = renderList[ i ];\n\n\t\t\t\tconst object = renderItem.object;\n\t\t\t\tconst geometry = renderItem.geometry;\n\t\t\t\tconst material = overrideMaterial === null ? renderItem.material : overrideMaterial;\n\t\t\t\tconst group = renderItem.group;\n\n\t\t\t\tif ( object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction renderObject( object, scene, camera, geometry, material, group ) {\n\n\t\t\tobject.onBeforeRender( _this, scene, camera, geometry, material, group );\n\n\t\t\tobject.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );\n\t\t\tobject.normalMatrix.getNormalMatrix( object.modelViewMatrix );\n\n\t\t\tmaterial.onBeforeRender( _this, scene, camera, geometry, object, group );\n\n\t\t\tif ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {\n\n\t\t\t\tmaterial.side = BackSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t\tmaterial.side = FrontSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t\tmaterial.side = DoubleSide;\n\n\t\t\t} else {\n\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t}\n\n\t\t\tobject.onAfterRender( _this, scene, camera, geometry, material, group );\n\n\t\t}\n\n\t\tfunction getProgram( material, scene, object ) {\n\n\t\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n\t\t\tconst materialProperties = properties.get( material );\n\n\t\t\tconst lights = currentRenderState.state.lights;\n\t\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\t\tconst lightsStateVersion = lights.state.version;\n\n\t\t\tconst parameters = programCache.getParameters( material, lights.state, shadowsArray, scene, object );\n\t\t\tconst programCacheKey = programCache.getProgramCacheKey( parameters );\n\n\t\t\tlet programs = materialProperties.programs;\n\n\t\t\t// always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change\n\n\t\t\tmaterialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;\n\t\t\tmaterialProperties.fog = scene.fog;\n\t\t\tmaterialProperties.envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || materialProperties.environment );\n\t\t\tmaterialProperties.envMapRotation = ( materialProperties.environment !== null && material.envMap === null ) ? scene.environmentRotation : material.envMapRotation;\n\n\t\t\tif ( programs === undefined ) {\n\n\t\t\t\t// new material\n\n\t\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\n\n\t\t\t\tprograms = new Map();\n\t\t\t\tmaterialProperties.programs = programs;\n\n\t\t\t}\n\n\t\t\tlet program = programs.get( programCacheKey );\n\n\t\t\tif ( program !== undefined ) {\n\n\t\t\t\t// early out if program and light state is identical\n\n\t\t\t\tif ( materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion ) {\n\n\t\t\t\t\tupdateCommonMaterialProperties( material, parameters );\n\n\t\t\t\t\treturn program;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tparameters.uniforms = programCache.getUniforms( material );\n\n\t\t\t\tmaterial.onBeforeCompile( parameters, _this );\n\n\t\t\t\tprogram = programCache.acquireProgram( parameters, programCacheKey );\n\t\t\t\tprograms.set( programCacheKey, program );\n\n\t\t\t\tmaterialProperties.uniforms = parameters.uniforms;\n\n\t\t\t}\n\n\t\t\tconst uniforms = materialProperties.uniforms;\n\n\t\t\tif ( ( ! material.isShaderMaterial && ! material.isRawShaderMaterial ) || material.clipping === true ) {\n\n\t\t\t\tuniforms.clippingPlanes = clipping.uniform;\n\n\t\t\t}\n\n\t\t\tupdateCommonMaterialProperties( material, parameters );\n\n\t\t\t// store the light setup it was created for\n\n\t\t\tmaterialProperties.needsLights = materialNeedsLights( material );\n\t\t\tmaterialProperties.lightsStateVersion = lightsStateVersion;\n\n\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\t// wire up the material to this renderer's lighting state\n\n\t\t\t\tuniforms.ambientLightColor.value = lights.state.ambient;\n\t\t\t\tuniforms.lightProbe.value = lights.state.probe;\n\t\t\t\tuniforms.directionalLights.value = lights.state.directional;\n\t\t\t\tuniforms.directionalLightShadows.value = lights.state.directionalShadow;\n\t\t\t\tuniforms.spotLights.value = lights.state.spot;\n\t\t\t\tuniforms.spotLightShadows.value = lights.state.spotShadow;\n\t\t\t\tuniforms.rectAreaLights.value = lights.state.rectArea;\n\t\t\t\tuniforms.ltc_1.value = lights.state.rectAreaLTC1;\n\t\t\t\tuniforms.ltc_2.value = lights.state.rectAreaLTC2;\n\t\t\t\tuniforms.pointLights.value = lights.state.point;\n\t\t\t\tuniforms.pointLightShadows.value = lights.state.pointShadow;\n\t\t\t\tuniforms.hemisphereLights.value = lights.state.hemi;\n\n\t\t\t\tuniforms.directionalShadowMap.value = lights.state.directionalShadowMap;\n\t\t\t\tuniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;\n\t\t\t\tuniforms.spotShadowMap.value = lights.state.spotShadowMap;\n\t\t\t\tuniforms.spotLightMatrix.value = lights.state.spotLightMatrix;\n\t\t\t\tuniforms.spotLightMap.value = lights.state.spotLightMap;\n\t\t\t\tuniforms.pointShadowMap.value = lights.state.pointShadowMap;\n\t\t\t\tuniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;\n\t\t\t\t// TODO (abelnation): add area lights shadow info to uniforms\n\n\t\t\t}\n\n\t\t\tmaterialProperties.currentProgram = program;\n\t\t\tmaterialProperties.uniformsList = null;\n\n\t\t\treturn program;\n\n\t\t}\n\n\t\tfunction getUniformList( materialProperties ) {\n\n\t\t\tif ( materialProperties.uniformsList === null ) {\n\n\t\t\t\tconst progUniforms = materialProperties.currentProgram.getUniforms();\n\t\t\t\tmaterialProperties.uniformsList = WebGLUniforms.seqWithValue( progUniforms.seq, materialProperties.uniforms );\n\n\t\t\t}\n\n\t\t\treturn materialProperties.uniformsList;\n\n\t\t}\n\n\t\tfunction updateCommonMaterialProperties( material, parameters ) {\n\n\t\t\tconst materialProperties = properties.get( material );\n\n\t\t\tmaterialProperties.outputColorSpace = parameters.outputColorSpace;\n\t\t\tmaterialProperties.batching = parameters.batching;\n\t\t\tmaterialProperties.batchingColor = parameters.batchingColor;\n\t\t\tmaterialProperties.instancing = parameters.instancing;\n\t\t\tmaterialProperties.instancingColor = parameters.instancingColor;\n\t\t\tmaterialProperties.instancingMorph = parameters.instancingMorph;\n\t\t\tmaterialProperties.skinning = parameters.skinning;\n\t\t\tmaterialProperties.morphTargets = parameters.morphTargets;\n\t\t\tmaterialProperties.morphNormals = parameters.morphNormals;\n\t\t\tmaterialProperties.morphColors = parameters.morphColors;\n\t\t\tmaterialProperties.morphTargetsCount = parameters.morphTargetsCount;\n\t\t\tmaterialProperties.numClippingPlanes = parameters.numClippingPlanes;\n\t\t\tmaterialProperties.numIntersection = parameters.numClipIntersection;\n\t\t\tmaterialProperties.vertexAlphas = parameters.vertexAlphas;\n\t\t\tmaterialProperties.vertexTangents = parameters.vertexTangents;\n\t\t\tmaterialProperties.toneMapping = parameters.toneMapping;\n\n\t\t}\n\n\t\tfunction setProgram( camera, scene, geometry, material, object ) {\n\n\t\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n\t\t\ttextures.resetTextureUnits();\n\n\t\t\tconst fog = scene.fog;\n\t\t\tconst environment = material.isMeshStandardMaterial ? scene.environment : null;\n\t\t\tconst colorSpace = ( _currentRenderTarget === null ) ? _this.outputColorSpace : ( _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace );\n\t\t\tconst envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );\n\t\t\tconst vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;\n\t\t\tconst vertexTangents = !! geometry.attributes.tangent && ( !! material.normalMap || material.anisotropy > 0 );\n\t\t\tconst morphTargets = !! geometry.morphAttributes.position;\n\t\t\tconst morphNormals = !! geometry.morphAttributes.normal;\n\t\t\tconst morphColors = !! geometry.morphAttributes.color;\n\n\t\t\tlet toneMapping = NoToneMapping;\n\n\t\t\tif ( material.toneMapped ) {\n\n\t\t\t\tif ( _currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\t\t\t\ttoneMapping = _this.toneMapping;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\t\tconst materialProperties = properties.get( material );\n\t\t\tconst lights = currentRenderState.state.lights;\n\n\t\t\tif ( _clippingEnabled === true ) {\n\n\t\t\t\tif ( _localClippingEnabled === true || camera !== _currentCamera ) {\n\n\t\t\t\t\tconst useCache =\n\t\t\t\t\t\tcamera === _currentCamera &&\n\t\t\t\t\t\tmaterial.id === _currentMaterialId;\n\n\t\t\t\t\t// we might want to call this function with some ClippingGroup\n\t\t\t\t\t// object instead of the material, once it becomes feasible\n\t\t\t\t\t// (#8465, #8379)\n\t\t\t\t\tclipping.setState( material, camera, useCache );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet needsProgramChange = false;\n\n\t\t\tif ( material.version === materialProperties.__version ) {\n\n\t\t\t\tif ( materialProperties.needsLights && ( materialProperties.lightsStateVersion !== lights.state.version ) ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.outputColorSpace !== colorSpace ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isBatchedMesh && materialProperties.batching === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isBatchedMesh && materialProperties.batching === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isBatchedMesh && materialProperties.batchingColor === true && object.colorTexture === null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isBatchedMesh && materialProperties.batchingColor === false && object.colorTexture !== null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancing === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isInstancedMesh && materialProperties.instancing === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isSkinnedMesh && materialProperties.skinning === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isSkinnedMesh && materialProperties.skinning === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingColor === true && object.instanceColor === null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingColor === false && object.instanceColor !== null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingMorph === true && object.morphTexture === null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingMorph === false && object.morphTexture !== null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.envMap !== envMap ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( material.fog === true && materialProperties.fog !== fog ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.numClippingPlanes !== undefined &&\n\t\t\t\t\t( materialProperties.numClippingPlanes !== clipping.numPlanes ||\n\t\t\t\t\tmaterialProperties.numIntersection !== clipping.numIntersection ) ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.vertexAlphas !== vertexAlphas ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.vertexTangents !== vertexTangents ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphTargets !== morphTargets ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphNormals !== morphNormals ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphColors !== morphColors ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.toneMapping !== toneMapping ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphTargetsCount !== morphTargetsCount ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tneedsProgramChange = true;\n\t\t\t\tmaterialProperties.__version = material.version;\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet program = materialProperties.currentProgram;\n\n\t\t\tif ( needsProgramChange === true ) {\n\n\t\t\t\tprogram = getProgram( material, scene, object );\n\n\t\t\t}\n\n\t\t\tlet refreshProgram = false;\n\t\t\tlet refreshMaterial = false;\n\t\t\tlet refreshLights = false;\n\n\t\t\tconst p_uniforms = program.getUniforms(),\n\t\t\t\tm_uniforms = materialProperties.uniforms;\n\n\t\t\tif ( state.useProgram( program.program ) ) {\n\n\t\t\t\trefreshProgram = true;\n\t\t\t\trefreshMaterial = true;\n\t\t\t\trefreshLights = true;\n\n\t\t\t}\n\n\t\t\tif ( material.id !== _currentMaterialId ) {\n\n\t\t\t\t_currentMaterialId = material.id;\n\n\t\t\t\trefreshMaterial = true;\n\n\t\t\t}\n\n\t\t\tif ( refreshProgram || _currentCamera !== camera ) {\n\n\t\t\t\t// common camera uniforms\n\n\t\t\t\tp_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );\n\t\t\t\tp_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );\n\n\t\t\t\tconst uCamPos = p_uniforms.map.cameraPosition;\n\n\t\t\t\tif ( uCamPos !== undefined ) {\n\n\t\t\t\t\tuCamPos.setValue( _gl, _vector3.setFromMatrixPosition( camera.matrixWorld ) );\n\n\t\t\t\t}\n\n\t\t\t\tif ( capabilities.logarithmicDepthBuffer ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'logDepthBufFC',\n\t\t\t\t\t\t2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );\n\n\t\t\t\t}\n\n\t\t\t\t// consider moving isOrthographic to UniformLib and WebGLMaterials, see https://github.com/mrdoob/three.js/pull/26467#issuecomment-1645185067\n\n\t\t\t\tif ( material.isMeshPhongMaterial ||\n\t\t\t\t\tmaterial.isMeshToonMaterial ||\n\t\t\t\t\tmaterial.isMeshLambertMaterial ||\n\t\t\t\t\tmaterial.isMeshBasicMaterial ||\n\t\t\t\t\tmaterial.isMeshStandardMaterial ||\n\t\t\t\t\tmaterial.isShaderMaterial ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'isOrthographic', camera.isOrthographicCamera === true );\n\n\t\t\t\t}\n\n\t\t\t\tif ( _currentCamera !== camera ) {\n\n\t\t\t\t\t_currentCamera = camera;\n\n\t\t\t\t\t// lighting uniforms depend on the camera so enforce an update\n\t\t\t\t\t// now, in case this material supports lights - or later, when\n\t\t\t\t\t// the next material that does gets activated:\n\n\t\t\t\t\trefreshMaterial = true;\t\t// set to true on material change\n\t\t\t\t\trefreshLights = true;\t\t// remains set until update done\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// skinning and morph target uniforms must be set even if material didn't change\n\t\t\t// auto-setting of texture unit for bone and morph texture must go before other textures\n\t\t\t// otherwise textures used for skinning and morphing can take over texture units reserved for other material textures\n\n\t\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrix' );\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrixInverse' );\n\n\t\t\t\tconst skeleton = object.skeleton;\n\n\t\t\t\tif ( skeleton ) {\n\n\t\t\t\t\tif ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( object.isBatchedMesh ) {\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'batchingTexture' );\n\t\t\t\tp_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'batchingIdTexture' );\n\t\t\t\tp_uniforms.setValue( _gl, 'batchingIdTexture', object._indirectTexture, textures );\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'batchingColorTexture' );\n\t\t\t\tif ( object._colorsTexture !== null ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'batchingColorTexture', object._colorsTexture, textures );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst morphAttributes = geometry.morphAttributes;\n\n\t\t\tif ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined ) ) {\n\n\t\t\t\tmorphtargets.update( object, geometry, program );\n\n\t\t\t}\n\n\t\t\tif ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) {\n\n\t\t\t\tmaterialProperties.receiveShadow = object.receiveShadow;\n\t\t\t\tp_uniforms.setValue( _gl, 'receiveShadow', object.receiveShadow );\n\n\t\t\t}\n\n\t\t\t// https://github.com/mrdoob/three.js/pull/24467#issuecomment-1209031512\n\n\t\t\tif ( material.isMeshGouraudMaterial && material.envMap !== null ) {\n\n\t\t\t\tm_uniforms.envMap.value = envMap;\n\n\t\t\t\tm_uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t\t}\n\n\t\t\tif ( material.isMeshStandardMaterial && material.envMap === null && scene.environment !== null ) {\n\n\t\t\t\tm_uniforms.envMapIntensity.value = scene.environmentIntensity;\n\n\t\t\t}\n\n\t\t\tif ( refreshMaterial ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );\n\n\t\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\t\t// the current material requires lighting info\n\n\t\t\t\t\t// note: all lighting uniforms are always set correctly\n\t\t\t\t\t// they simply reference the renderer's state for their\n\t\t\t\t\t// values\n\t\t\t\t\t//\n\t\t\t\t\t// use the current material's .needsUpdate flags to set\n\t\t\t\t\t// the GL state when required\n\n\t\t\t\t\tmarkUniformsLightsNeedsUpdate( m_uniforms, refreshLights );\n\n\t\t\t\t}\n\n\t\t\t\t// refresh uniforms common to several materials\n\n\t\t\t\tif ( fog && material.fog === true ) {\n\n\t\t\t\t\tmaterials.refreshFogUniforms( m_uniforms, fog );\n\n\t\t\t\t}\n\n\t\t\t\tmaterials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget[ camera.id ] );\n\n\t\t\t\tWebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );\n\n\t\t\t}\n\n\t\t\tif ( material.isShaderMaterial && material.uniformsNeedUpdate === true ) {\n\n\t\t\t\tWebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );\n\t\t\t\tmaterial.uniformsNeedUpdate = false;\n\n\t\t\t}\n\n\t\t\tif ( material.isSpriteMaterial ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'center', object.center );\n\n\t\t\t}\n\n\t\t\t// common matrices\n\n\t\t\tp_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );\n\t\t\tp_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );\n\t\t\tp_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );\n\n\t\t\t// UBOs\n\n\t\t\tif ( material.isShaderMaterial || material.isRawShaderMaterial ) {\n\n\t\t\t\tconst groups = material.uniformsGroups;\n\n\t\t\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\n\t\t\t\t\tuniformsGroups.update( group, program );\n\t\t\t\t\tuniformsGroups.bind( group, program );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn program;\n\n\t\t}\n\n\t\t// If uniforms are marked as clean, they don't need to be loaded to the GPU.\n\n\t\tfunction markUniformsLightsNeedsUpdate( uniforms, value ) {\n\n\t\t\tuniforms.ambientLightColor.needsUpdate = value;\n\t\t\tuniforms.lightProbe.needsUpdate = value;\n\n\t\t\tuniforms.directionalLights.needsUpdate = value;\n\t\t\tuniforms.directionalLightShadows.needsUpdate = value;\n\t\t\tuniforms.pointLights.needsUpdate = value;\n\t\t\tuniforms.pointLightShadows.needsUpdate = value;\n\t\t\tuniforms.spotLights.needsUpdate = value;\n\t\t\tuniforms.spotLightShadows.needsUpdate = value;\n\t\t\tuniforms.rectAreaLights.needsUpdate = value;\n\t\t\tuniforms.hemisphereLights.needsUpdate = value;\n\n\t\t}\n\n\t\tfunction materialNeedsLights( material ) {\n\n\t\t\treturn material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial ||\n\t\t\t\tmaterial.isMeshStandardMaterial || material.isShadowMaterial ||\n\t\t\t\t( material.isShaderMaterial && material.lights === true );\n\n\t\t}\n\n\t\tthis.getActiveCubeFace = function () {\n\n\t\t\treturn _currentActiveCubeFace;\n\n\t\t};\n\n\t\tthis.getActiveMipmapLevel = function () {\n\n\t\t\treturn _currentActiveMipmapLevel;\n\n\t\t};\n\n\t\tthis.getRenderTarget = function () {\n\n\t\t\treturn _currentRenderTarget;\n\n\t\t};\n\n\t\tthis.setRenderTargetTextures = function ( renderTarget, colorTexture, depthTexture ) {\n\n\t\t\tproperties.get( renderTarget.texture ).__webglTexture = colorTexture;\n\t\t\tproperties.get( renderTarget.depthTexture ).__webglTexture = depthTexture;\n\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\trenderTargetProperties.__hasExternalTextures = true;\n\n\t\t\trenderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;\n\n\t\t\tif ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {\n\n\t\t\t\t// The multisample_render_to_texture extension doesn't work properly if there\n\t\t\t\t// are midframe flushes and an external depth buffer. Disable use of the extension.\n\t\t\t\tif ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );\n\t\t\t\t\trenderTargetProperties.__useRenderToTexture = false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.setRenderTargetFramebuffer = function ( renderTarget, defaultFramebuffer ) {\n\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\trenderTargetProperties.__webglFramebuffer = defaultFramebuffer;\n\t\t\trenderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === undefined;\n\n\t\t};\n\n\t\tthis.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {\n\n\t\t\t_currentRenderTarget = renderTarget;\n\t\t\t_currentActiveCubeFace = activeCubeFace;\n\t\t\t_currentActiveMipmapLevel = activeMipmapLevel;\n\n\t\t\tlet useDefaultFramebuffer = true;\n\t\t\tlet framebuffer = null;\n\t\t\tlet isCube = false;\n\t\t\tlet isRenderTarget3D = false;\n\n\t\t\tif ( renderTarget ) {\n\n\t\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\t\t\tif ( renderTargetProperties.__useDefaultFramebuffer !== undefined ) {\n\n\t\t\t\t\t// We need to make sure to rebind the framebuffer.\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\t\t\t\t\tuseDefaultFramebuffer = false;\n\n\t\t\t\t} else if ( renderTargetProperties.__webglFramebuffer === undefined ) {\n\n\t\t\t\t\ttextures.setupRenderTarget( renderTarget );\n\n\t\t\t\t} else if ( renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\t\t\t// Color and depth texture must be rebound in order for the swapchain to update.\n\t\t\t\t\ttextures.rebindTextures( renderTarget, properties.get( renderTarget.texture ).__webglTexture, properties.get( renderTarget.depthTexture ).__webglTexture );\n\n\t\t\t\t} else if ( renderTarget.depthBuffer ) {\n\n\t\t\t\t\t// check if the depth texture is already bound to the frame buffer and that it's been initialized\n\t\t\t\t\tconst depthTexture = renderTarget.depthTexture;\n\t\t\t\t\tif ( renderTargetProperties.__boundDepthTexture !== depthTexture ) {\n\n\t\t\t\t\t\t// check if the depth texture is compatible\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tdepthTexture !== null &&\n\t\t\t\t\t\t\tproperties.has( depthTexture ) &&\n\t\t\t\t\t\t\t( renderTarget.width !== depthTexture.image.width || renderTarget.height !== depthTexture.image.height )\n\t\t\t\t\t\t) {\n\n\t\t\t\t\t\t\tthrow new Error( 'WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.' );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Swap the depth buffer to the currently attached one\n\t\t\t\t\t\ttextures.setupDepthRenderbuffer( renderTarget );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tconst texture = renderTarget.texture;\n\n\t\t\t\tif ( texture.isData3DTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tisRenderTarget3D = true;\n\n\t\t\t\t}\n\n\t\t\t\tconst __webglFramebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\t\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\t\t\tif ( Array.isArray( __webglFramebuffer[ activeCubeFace ] ) ) {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace ][ activeMipmapLevel ];\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace ];\n\n\t\t\t\t\t}\n\n\t\t\t\t\tisCube = true;\n\n\t\t\t\t} else if ( ( renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t\tframebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( Array.isArray( __webglFramebuffer ) ) {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeMipmapLevel ];\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t_currentViewport.copy( renderTarget.viewport );\n\t\t\t\t_currentScissor.copy( renderTarget.scissor );\n\t\t\t\t_currentScissorTest = renderTarget.scissorTest;\n\n\t\t\t} else {\n\n\t\t\t\t_currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t\t_currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t\t_currentScissorTest = _scissorTest;\n\n\t\t\t}\n\n\t\t\tconst framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\tif ( framebufferBound && useDefaultFramebuffer ) {\n\n\t\t\t\tstate.drawBuffers( renderTarget, framebuffer );\n\n\t\t\t}\n\n\t\t\tstate.viewport( _currentViewport );\n\t\t\tstate.scissor( _currentScissor );\n\t\t\tstate.setScissorTest( _currentScissorTest );\n\n\t\t\tif ( isCube ) {\n\n\t\t\t\tconst textureProperties = properties.get( renderTarget.texture );\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel );\n\n\t\t\t} else if ( isRenderTarget3D ) {\n\n\t\t\t\tconst textureProperties = properties.get( renderTarget.texture );\n\t\t\t\tconst layer = activeCubeFace || 0;\n\t\t\t\t_gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel || 0, layer );\n\n\t\t\t}\n\n\t\t\t_currentMaterialId = - 1; // reset current material to ensure correct uniform bindings\n\n\t\t};\n\n\t\tthis.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {\n\n\t\t\tif ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tlet framebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\t\tif ( renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined ) {\n\n\t\t\t\tframebuffer = framebuffer[ activeCubeFaceIndex ];\n\n\t\t\t}\n\n\t\t\tif ( framebuffer ) {\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\t\ttry {\n\n\t\t\t\t\tconst texture = renderTarget.texture;\n\t\t\t\t\tconst textureFormat = texture.format;\n\t\t\t\t\tconst textureType = texture.type;\n\n\t\t\t\t\tif ( ! capabilities.textureFormatReadable( textureFormat ) ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! capabilities.textureTypeReadable( textureType ) ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)\n\n\t\t\t\t\tif ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {\n\n\t\t\t\t\t\t_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), buffer );\n\n\t\t\t\t\t}\n\n\t\t\t\t} finally {\n\n\t\t\t\t\t// restore framebuffer of current render target if necessary\n\n\t\t\t\t\tconst framebuffer = ( _currentRenderTarget !== null ) ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.readRenderTargetPixelsAsync = async function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {\n\n\t\t\tif ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {\n\n\t\t\t\tthrow new Error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );\n\n\t\t\t}\n\n\t\t\tlet framebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\t\t\tif ( renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined ) {\n\n\t\t\t\tframebuffer = framebuffer[ activeCubeFaceIndex ];\n\n\t\t\t}\n\n\t\t\tif ( framebuffer ) {\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\t\ttry {\n\n\t\t\t\t\tconst texture = renderTarget.texture;\n\t\t\t\t\tconst textureFormat = texture.format;\n\t\t\t\t\tconst textureType = texture.type;\n\n\t\t\t\t\tif ( ! capabilities.textureFormatReadable( textureFormat ) ) {\n\n\t\t\t\t\t\tthrow new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! capabilities.textureTypeReadable( textureType ) ) {\n\n\t\t\t\t\t\tthrow new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)\n\t\t\t\t\tif ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {\n\n\t\t\t\t\t\tconst glBuffer = _gl.createBuffer();\n\t\t\t\t\t\t_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );\n\t\t\t\t\t\t_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );\n\t\t\t\t\t\t_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );\n\t\t\t\t\t\t_gl.flush();\n\n\t\t\t\t\t\t// check if the commands have finished every 8 ms\n\t\t\t\t\t\tconst sync = _gl.fenceSync( _gl.SYNC_GPU_COMMANDS_COMPLETE, 0 );\n\t\t\t\t\t\tawait probeAsync( _gl, sync, 4 );\n\n\t\t\t\t\t\ttry {\n\n\t\t\t\t\t\t\t_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );\n\t\t\t\t\t\t\t_gl.getBufferSubData( _gl.PIXEL_PACK_BUFFER, 0, buffer );\n\n\t\t\t\t\t\t} finally {\n\n\t\t\t\t\t\t\t_gl.deleteBuffer( glBuffer );\n\t\t\t\t\t\t\t_gl.deleteSync( sync );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn buffer;\n\n\t\t\t\t\t}\n\n\t\t\t\t} finally {\n\n\t\t\t\t\t// restore framebuffer of current render target if necessary\n\n\t\t\t\t\tconst framebuffer = ( _currentRenderTarget !== null ) ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.copyFramebufferToTexture = function ( texture, position = null, level = 0 ) {\n\n\t\t\t// support previous signature with position first\n\t\t\tif ( texture.isTexture !== true ) {\n\n\t\t\t\t// @deprecated, r165\n\t\t\t\twarnOnce( 'WebGLRenderer: copyFramebufferToTexture function signature has changed.' );\n\n\t\t\t\tposition = arguments[ 0 ] || null;\n\t\t\t\ttexture = arguments[ 1 ];\n\n\t\t\t}\n\n\t\t\tconst levelScale = Math.pow( 2, - level );\n\t\t\tconst width = Math.floor( texture.image.width * levelScale );\n\t\t\tconst height = Math.floor( texture.image.height * levelScale );\n\n\t\t\tconst x = position !== null ? position.x : 0;\n\t\t\tconst y = position !== null ? position.y : 0;\n\n\t\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t\t_gl.copyTexSubImage2D( _gl.TEXTURE_2D, level, 0, 0, x, y, width, height );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {\n\n\t\t\t// support previous signature with dstPosition first\n\t\t\tif ( srcTexture.isTexture !== true ) {\n\n\t\t\t\t// @deprecated, r165\n\t\t\t\twarnOnce( 'WebGLRenderer: copyTextureToTexture function signature has changed.' );\n\n\t\t\t\tdstPosition = arguments[ 0 ] || null;\n\t\t\t\tsrcTexture = arguments[ 1 ];\n\t\t\t\tdstTexture = arguments[ 2 ];\n\t\t\t\tlevel = arguments[ 3 ] || 0;\n\t\t\t\tsrcRegion = null;\n\n\t\t\t}\n\n\t\t\tlet width, height, minX, minY;\n\t\t\tlet dstX, dstY;\n\t\t\tif ( srcRegion !== null ) {\n\n\t\t\t\twidth = srcRegion.max.x - srcRegion.min.x;\n\t\t\t\theight = srcRegion.max.y - srcRegion.min.y;\n\t\t\t\tminX = srcRegion.min.x;\n\t\t\t\tminY = srcRegion.min.y;\n\n\t\t\t} else {\n\n\t\t\t\twidth = srcTexture.image.width;\n\t\t\t\theight = srcTexture.image.height;\n\t\t\t\tminX = 0;\n\t\t\t\tminY = 0;\n\n\t\t\t}\n\n\t\t\tif ( dstPosition !== null ) {\n\n\t\t\t\tdstX = dstPosition.x;\n\t\t\t\tdstY = dstPosition.y;\n\n\t\t\t} else {\n\n\t\t\t\tdstX = 0;\n\t\t\t\tdstY = 0;\n\n\t\t\t}\n\n\t\t\tconst glFormat = utils.convert( dstTexture.format );\n\t\t\tconst glType = utils.convert( dstTexture.type );\n\n\t\t\ttextures.setTexture2D( dstTexture, 0 );\n\n\t\t\t// As another texture upload may have changed pixelStorei\n\t\t\t// parameters, make sure they are correct for the dstTexture\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );\n\n\t\t\tconst currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );\n\t\t\tconst currentUnpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );\n\t\t\tconst currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );\n\t\t\tconst currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );\n\t\t\tconst currentUnpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );\n\n\t\t\tconst image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, minX );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );\n\n\t\t\tif ( srcTexture.isDataTexture ) {\n\n\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, width, height, glFormat, glType, image.data );\n\n\t\t\t} else {\n\n\t\t\t\tif ( srcTexture.isCompressedTexture ) {\n\n\t\t\t\t\t_gl.compressedTexSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, image.width, image.height, glFormat, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, width, height, glFormat, glType, image );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );\n\n\t\t\t// Generate mipmaps only when copying level 0\n\t\t\tif ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( _gl.TEXTURE_2D );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.copyTextureToTexture3D = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {\n\n\t\t\t// support previous signature with source box first\n\t\t\tif ( srcTexture.isTexture !== true ) {\n\n\t\t\t\t// @deprecated, r165\n\t\t\t\twarnOnce( 'WebGLRenderer: copyTextureToTexture3D function signature has changed.' );\n\n\t\t\t\tsrcRegion = arguments[ 0 ] || null;\n\t\t\t\tdstPosition = arguments[ 1 ] || null;\n\t\t\t\tsrcTexture = arguments[ 2 ];\n\t\t\t\tdstTexture = arguments[ 3 ];\n\t\t\t\tlevel = arguments[ 4 ] || 0;\n\n\t\t\t}\n\n\t\t\tlet width, height, depth, minX, minY, minZ;\n\t\t\tlet dstX, dstY, dstZ;\n\t\t\tconst image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;\n\t\t\tif ( srcRegion !== null ) {\n\n\t\t\t\twidth = srcRegion.max.x - srcRegion.min.x;\n\t\t\t\theight = srcRegion.max.y - srcRegion.min.y;\n\t\t\t\tdepth = srcRegion.max.z - srcRegion.min.z;\n\t\t\t\tminX = srcRegion.min.x;\n\t\t\t\tminY = srcRegion.min.y;\n\t\t\t\tminZ = srcRegion.min.z;\n\n\t\t\t} else {\n\n\t\t\t\twidth = image.width;\n\t\t\t\theight = image.height;\n\t\t\t\tdepth = image.depth;\n\t\t\t\tminX = 0;\n\t\t\t\tminY = 0;\n\t\t\t\tminZ = 0;\n\n\t\t\t}\n\n\t\t\tif ( dstPosition !== null ) {\n\n\t\t\t\tdstX = dstPosition.x;\n\t\t\t\tdstY = dstPosition.y;\n\t\t\t\tdstZ = dstPosition.z;\n\n\t\t\t} else {\n\n\t\t\t\tdstX = 0;\n\t\t\t\tdstY = 0;\n\t\t\t\tdstZ = 0;\n\n\t\t\t}\n\n\t\t\tconst glFormat = utils.convert( dstTexture.format );\n\t\t\tconst glType = utils.convert( dstTexture.type );\n\t\t\tlet glTarget;\n\n\t\t\tif ( dstTexture.isData3DTexture ) {\n\n\t\t\t\ttextures.setTexture3D( dstTexture, 0 );\n\t\t\t\tglTarget = _gl.TEXTURE_3D;\n\n\t\t\t} else if ( dstTexture.isDataArrayTexture || dstTexture.isCompressedArrayTexture ) {\n\n\t\t\t\ttextures.setTexture2DArray( dstTexture, 0 );\n\t\t\t\tglTarget = _gl.TEXTURE_2D_ARRAY;\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );\n\n\t\t\tconst currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );\n\t\t\tconst currentUnpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );\n\t\t\tconst currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );\n\t\t\tconst currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );\n\t\t\tconst currentUnpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, minX );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, minZ );\n\n\t\t\tif ( srcTexture.isDataTexture || srcTexture.isData3DTexture ) {\n\n\t\t\t\t_gl.texSubImage3D( glTarget, level, dstX, dstY, dstZ, width, height, depth, glFormat, glType, image.data );\n\n\t\t\t} else {\n\n\t\t\t\tif ( dstTexture.isCompressedArrayTexture ) {\n\n\t\t\t\t\t_gl.compressedTexSubImage3D( glTarget, level, dstX, dstY, dstZ, width, height, depth, glFormat, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.texSubImage3D( glTarget, level, dstX, dstY, dstZ, width, height, depth, glFormat, glType, image );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );\n\n\t\t\t// Generate mipmaps only when copying level 0\n\t\t\tif ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( glTarget );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.initRenderTarget = function ( target ) {\n\n\t\t\tif ( properties.get( target ).__webglFramebuffer === undefined ) {\n\n\t\t\t\ttextures.setupRenderTarget( target );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.initTexture = function ( texture ) {\n\n\t\t\tif ( texture.isCubeTexture ) {\n\n\t\t\t\ttextures.setTextureCube( texture, 0 );\n\n\t\t\t} else if ( texture.isData3DTexture ) {\n\n\t\t\t\ttextures.setTexture3D( texture, 0 );\n\n\t\t\t} else if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) {\n\n\t\t\t\ttextures.setTexture2DArray( texture, 0 );\n\n\t\t\t} else {\n\n\t\t\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.resetState = function () {\n\n\t\t\t_currentActiveCubeFace = 0;\n\t\t\t_currentActiveMipmapLevel = 0;\n\t\t\t_currentRenderTarget = null;\n\n\t\t\tstate.reset();\n\t\t\tbindingStates.reset();\n\n\t\t};\n\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\n\n\t\t}\n\n\t}\n\n\tget coordinateSystem() {\n\n\t\treturn WebGLCoordinateSystem;\n\n\t}\n\n\tget outputColorSpace() {\n\n\t\treturn this._outputColorSpace;\n\n\t}\n\n\tset outputColorSpace( colorSpace ) {\n\n\t\tthis._outputColorSpace = colorSpace;\n\n\t\tconst gl = this.getContext();\n\t\tgl.drawingBufferColorSpace = colorSpace === DisplayP3ColorSpace ? 'display-p3' : 'srgb';\n\t\tgl.unpackColorSpace = ColorManagement.workingColorSpace === LinearDisplayP3ColorSpace ? 'display-p3' : 'srgb';\n\n\t}\n\n}\n\nclass FogExp2 {\n\n\tconstructor( color, density = 0.00025 ) {\n\n\t\tthis.isFogExp2 = true;\n\n\t\tthis.name = '';\n\n\t\tthis.color = new Color( color );\n\t\tthis.density = density;\n\n\t}\n\n\tclone() {\n\n\t\treturn new FogExp2( this.color, this.density );\n\n\t}\n\n\ttoJSON( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'FogExp2',\n\t\t\tname: this.name,\n\t\t\tcolor: this.color.getHex(),\n\t\t\tdensity: this.density\n\t\t};\n\n\t}\n\n}\n\nclass Fog {\n\n\tconstructor( color, near = 1, far = 1000 ) {\n\n\t\tthis.isFog = true;\n\n\t\tthis.name = '';\n\n\t\tthis.color = new Color( color );\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Fog( this.color, this.near, this.far );\n\n\t}\n\n\ttoJSON( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'Fog',\n\t\t\tname: this.name,\n\t\t\tcolor: this.color.getHex(),\n\t\t\tnear: this.near,\n\t\t\tfar: this.far\n\t\t};\n\n\t}\n\n}\n\nclass Scene extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isScene = true;\n\n\t\tthis.type = 'Scene';\n\n\t\tthis.background = null;\n\t\tthis.environment = null;\n\t\tthis.fog = null;\n\n\t\tthis.backgroundBlurriness = 0;\n\t\tthis.backgroundIntensity = 1;\n\t\tthis.backgroundRotation = new Euler();\n\n\t\tthis.environmentIntensity = 1;\n\t\tthis.environmentRotation = new Euler();\n\n\t\tthis.overrideMaterial = null;\n\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.background !== null ) this.background = source.background.clone();\n\t\tif ( source.environment !== null ) this.environment = source.environment.clone();\n\t\tif ( source.fog !== null ) this.fog = source.fog.clone();\n\n\t\tthis.backgroundBlurriness = source.backgroundBlurriness;\n\t\tthis.backgroundIntensity = source.backgroundIntensity;\n\t\tthis.backgroundRotation.copy( source.backgroundRotation );\n\n\t\tthis.environmentIntensity = source.environmentIntensity;\n\t\tthis.environmentRotation.copy( source.environmentRotation );\n\n\t\tif ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.fog !== null ) data.object.fog = this.fog.toJSON();\n\n\t\tif ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;\n\t\tif ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;\n\t\tdata.object.backgroundRotation = this.backgroundRotation.toArray();\n\n\t\tif ( this.environmentIntensity !== 1 ) data.object.environmentIntensity = this.environmentIntensity;\n\t\tdata.object.environmentRotation = this.environmentRotation.toArray();\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass InterleavedBuffer {\n\n\tconstructor( array, stride ) {\n\n\t\tthis.isInterleavedBuffer = true;\n\n\t\tthis.array = array;\n\t\tthis.stride = stride;\n\t\tthis.count = array !== undefined ? array.length / stride : 0;\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis._updateRange = { offset: 0, count: - 1 };\n\t\tthis.updateRanges = [];\n\n\t\tthis.version = 0;\n\n\t\tthis.uuid = generateUUID();\n\n\t}\n\n\tonUploadCallback() {}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tget updateRange() {\n\n\t\twarnOnce( 'THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159\n\t\treturn this._updateRange;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\taddUpdateRange( start, count ) {\n\n\t\tthis.updateRanges.push( { start, count } );\n\n\t}\n\n\tclearUpdateRanges() {\n\n\t\tthis.updateRanges.length = 0;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.count = source.count;\n\t\tthis.stride = source.stride;\n\t\tthis.usage = source.usage;\n\n\t\treturn this;\n\n\t}\n\n\tcopyAt( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.stride;\n\t\tindex2 *= attribute.stride;\n\n\t\tfor ( let i = 0, l = this.stride; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tset( value, offset = 0 ) {\n\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tif ( data.arrayBuffers === undefined ) {\n\n\t\t\tdata.arrayBuffers = {};\n\n\t\t}\n\n\t\tif ( this.array.buffer._uuid === undefined ) {\n\n\t\t\tthis.array.buffer._uuid = generateUUID();\n\n\t\t}\n\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\n\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = this.array.slice( 0 ).buffer;\n\n\t\t}\n\n\t\tconst array = new this.array.constructor( data.arrayBuffers[ this.array.buffer._uuid ] );\n\n\t\tconst ib = new this.constructor( array, this.stride );\n\t\tib.setUsage( this.usage );\n\n\t\treturn ib;\n\n\t}\n\n\tonUpload( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tif ( data.arrayBuffers === undefined ) {\n\n\t\t\tdata.arrayBuffers = {};\n\n\t\t}\n\n\t\t// generate UUID for array buffer if necessary\n\n\t\tif ( this.array.buffer._uuid === undefined ) {\n\n\t\t\tthis.array.buffer._uuid = generateUUID();\n\n\t\t}\n\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\n\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = Array.from( new Uint32Array( this.array.buffer ) );\n\n\t\t}\n\n\t\t//\n\n\t\treturn {\n\t\t\tuuid: this.uuid,\n\t\t\tbuffer: this.array.buffer._uuid,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tstride: this.stride\n\t\t};\n\n\t}\n\n}\n\nconst _vector$6 = /*@__PURE__*/ new Vector3();\n\nclass InterleavedBufferAttribute {\n\n\tconstructor( interleavedBuffer, itemSize, offset, normalized = false ) {\n\n\t\tthis.isInterleavedBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.data = interleavedBuffer;\n\t\tthis.itemSize = itemSize;\n\t\tthis.offset = offset;\n\n\t\tthis.normalized = normalized;\n\n\t}\n\n\tget count() {\n\n\t\treturn this.data.count;\n\n\t}\n\n\tget array() {\n\n\t\treturn this.data.array;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tthis.data.needsUpdate = value;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tfor ( let i = 0, l = this.data.count; i < l; i ++ ) {\n\n\t\t\t_vector$6.fromBufferAttribute( this, i );\n\n\t\t\t_vector$6.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$6.fromBufferAttribute( this, i );\n\n\t\t\t_vector$6.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$6.fromBufferAttribute( this, i );\n\n\t\t\t_vector$6.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index, component ) {\n\n\t\tlet value = this.array[ index * this.data.stride + this.offset + component ];\n\n\t\tif ( this.normalized ) value = denormalize( value, this.array );\n\n\t\treturn value;\n\n\t}\n\n\tsetComponent( index, component, value ) {\n\n\t\tif ( this.normalized ) value = normalize( value, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + component ] = value;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset ] = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = this.data.array[ index * this.data.stride + this.offset ];\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = this.data.array[ index * this.data.stride + this.offset + 1 ];\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = this.data.array[ index * this.data.stride + this.offset + 2 ];\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = this.data.array[ index * this.data.stride + this.offset + 3 ];\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\t\tthis.data.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tif ( data === undefined ) {\n\n\t\t\tconsole.log( 'THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.' );\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\n\n\t\t\t\tconst index = i * this.data.stride + this.offset;\n\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\n\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( new this.array.constructor( array ), this.itemSize, this.normalized );\n\n\t\t} else {\n\n\t\t\tif ( data.interleavedBuffers === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers = {};\n\n\t\t\t}\n\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.clone( data );\n\n\t\t\t}\n\n\t\t\treturn new InterleavedBufferAttribute( data.interleavedBuffers[ this.data.uuid ], this.itemSize, this.offset, this.normalized );\n\n\t\t}\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tif ( data === undefined ) {\n\n\t\t\tconsole.log( 'THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.' );\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\n\n\t\t\t\tconst index = i * this.data.stride + this.offset;\n\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\n\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// de-interleave data and save it as an ordinary buffer attribute for now\n\n\t\t\treturn {\n\t\t\t\titemSize: this.itemSize,\n\t\t\t\ttype: this.array.constructor.name,\n\t\t\t\tarray: array,\n\t\t\t\tnormalized: this.normalized\n\t\t\t};\n\n\t\t} else {\n\n\t\t\t// save as true interleaved attribute\n\n\t\t\tif ( data.interleavedBuffers === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers = {};\n\n\t\t\t}\n\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.toJSON( data );\n\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tisInterleavedBufferAttribute: true,\n\t\t\t\titemSize: this.itemSize,\n\t\t\t\tdata: this.data.uuid,\n\t\t\t\toffset: this.offset,\n\t\t\t\tnormalized: this.normalized\n\t\t\t};\n\n\t\t}\n\n\t}\n\n}\n\nclass SpriteMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isSpriteMaterial = true;\n\n\t\tthis.type = 'SpriteMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.rotation = 0;\n\n\t\tthis.sizeAttenuation = true;\n\n\t\tthis.transparent = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nlet _geometry;\n\nconst _intersectPoint = /*@__PURE__*/ new Vector3();\nconst _worldScale = /*@__PURE__*/ new Vector3();\nconst _mvPosition = /*@__PURE__*/ new Vector3();\n\nconst _alignedPosition = /*@__PURE__*/ new Vector2();\nconst _rotatedPosition = /*@__PURE__*/ new Vector2();\nconst _viewWorldMatrix = /*@__PURE__*/ new Matrix4();\n\nconst _vA = /*@__PURE__*/ new Vector3();\nconst _vB = /*@__PURE__*/ new Vector3();\nconst _vC = /*@__PURE__*/ new Vector3();\n\nconst _uvA = /*@__PURE__*/ new Vector2();\nconst _uvB = /*@__PURE__*/ new Vector2();\nconst _uvC = /*@__PURE__*/ new Vector2();\n\nclass Sprite extends Object3D {\n\n\tconstructor( material = new SpriteMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isSprite = true;\n\n\t\tthis.type = 'Sprite';\n\n\t\tif ( _geometry === undefined ) {\n\n\t\t\t_geometry = new BufferGeometry();\n\n\t\t\tconst float32Array = new Float32Array( [\n\t\t\t\t- 0.5, - 0.5, 0, 0, 0,\n\t\t\t\t0.5, - 0.5, 0, 1, 0,\n\t\t\t\t0.5, 0.5, 0, 1, 1,\n\t\t\t\t- 0.5, 0.5, 0, 0, 1\n\t\t\t] );\n\n\t\t\tconst interleavedBuffer = new InterleavedBuffer( float32Array, 5 );\n\n\t\t\t_geometry.setIndex( [ 0, 1, 2,\t0, 2, 3 ] );\n\t\t\t_geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );\n\t\t\t_geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );\n\n\t\t}\n\n\t\tthis.geometry = _geometry;\n\t\tthis.material = material;\n\n\t\tthis.center = new Vector2( 0.5, 0.5 );\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tif ( raycaster.camera === null ) {\n\n\t\t\tconsole.error( 'THREE.Sprite: \"Raycaster.camera\" needs to be set in order to raycast against sprites.' );\n\n\t\t}\n\n\t\t_worldScale.setFromMatrixScale( this.matrixWorld );\n\n\t\t_viewWorldMatrix.copy( raycaster.camera.matrixWorld );\n\t\tthis.modelViewMatrix.multiplyMatrices( raycaster.camera.matrixWorldInverse, this.matrixWorld );\n\n\t\t_mvPosition.setFromMatrixPosition( this.modelViewMatrix );\n\n\t\tif ( raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false ) {\n\n\t\t\t_worldScale.multiplyScalar( - _mvPosition.z );\n\n\t\t}\n\n\t\tconst rotation = this.material.rotation;\n\t\tlet sin, cos;\n\n\t\tif ( rotation !== 0 ) {\n\n\t\t\tcos = Math.cos( rotation );\n\t\t\tsin = Math.sin( rotation );\n\n\t\t}\n\n\t\tconst center = this.center;\n\n\t\ttransformVertex( _vA.set( - 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vB.set( 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vC.set( 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\n\t\t_uvA.set( 0, 0 );\n\t\t_uvB.set( 1, 0 );\n\t\t_uvC.set( 1, 1 );\n\n\t\t// check first triangle\n\t\tlet intersect = raycaster.ray.intersectTriangle( _vA, _vB, _vC, false, _intersectPoint );\n\n\t\tif ( intersect === null ) {\n\n\t\t\t// check second triangle\n\t\t\ttransformVertex( _vB.set( - 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\t\t_uvB.set( 0, 1 );\n\n\t\t\tintersect = raycaster.ray.intersectTriangle( _vA, _vC, _vB, false, _intersectPoint );\n\t\t\tif ( intersect === null ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst distance = raycaster.ray.origin.distanceTo( _intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tpoint: _intersectPoint.clone(),\n\t\t\tuv: Triangle.getInterpolation( _intersectPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() ),\n\t\t\tface: null,\n\t\t\tobject: this\n\n\t\t} );\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.center !== undefined ) this.center.copy( source.center );\n\n\t\tthis.material = source.material;\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) {\n\n\t// compute position in camera space\n\t_alignedPosition.subVectors( vertexPosition, center ).addScalar( 0.5 ).multiply( scale );\n\n\t// to check if rotation is not zero\n\tif ( sin !== undefined ) {\n\n\t\t_rotatedPosition.x = ( cos * _alignedPosition.x ) - ( sin * _alignedPosition.y );\n\t\t_rotatedPosition.y = ( sin * _alignedPosition.x ) + ( cos * _alignedPosition.y );\n\n\t} else {\n\n\t\t_rotatedPosition.copy( _alignedPosition );\n\n\t}\n\n\n\tvertexPosition.copy( mvPosition );\n\tvertexPosition.x += _rotatedPosition.x;\n\tvertexPosition.y += _rotatedPosition.y;\n\n\t// transform to world space\n\tvertexPosition.applyMatrix4( _viewWorldMatrix );\n\n}\n\nconst _v1$2 = /*@__PURE__*/ new Vector3();\nconst _v2$1 = /*@__PURE__*/ new Vector3();\n\nclass LOD extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis._currentLevel = 0;\n\n\t\tthis.type = 'LOD';\n\n\t\tObject.defineProperties( this, {\n\t\t\tlevels: {\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: []\n\t\t\t},\n\t\t\tisLOD: {\n\t\t\t\tvalue: true,\n\t\t\t}\n\t\t} );\n\n\t\tthis.autoUpdate = true;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source, false );\n\n\t\tconst levels = source.levels;\n\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tconst level = levels[ i ];\n\n\t\t\tthis.addLevel( level.object.clone(), level.distance, level.hysteresis );\n\n\t\t}\n\n\t\tthis.autoUpdate = source.autoUpdate;\n\n\t\treturn this;\n\n\t}\n\n\taddLevel( object, distance = 0, hysteresis = 0 ) {\n\n\t\tdistance = Math.abs( distance );\n\n\t\tconst levels = this.levels;\n\n\t\tlet l;\n\n\t\tfor ( l = 0; l < levels.length; l ++ ) {\n\n\t\t\tif ( distance < levels[ l ].distance ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlevels.splice( l, 0, { distance: distance, hysteresis: hysteresis, object: object } );\n\n\t\tthis.add( object );\n\n\t\treturn this;\n\n\t}\n\n\tgetCurrentLevel() {\n\n\t\treturn this._currentLevel;\n\n\t}\n\n\n\n\tgetObjectForDistance( distance ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\tlet i, l;\n\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tlet levelDistance = levels[ i ].distance;\n\n\t\t\t\tif ( levels[ i ].object.visible ) {\n\n\t\t\t\t\tlevelDistance -= levelDistance * levels[ i ].hysteresis;\n\n\t\t\t\t}\n\n\t\t\t\tif ( distance < levelDistance ) {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn levels[ i - 1 ].object;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\t_v1$2.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tconst distance = raycaster.ray.origin.distanceTo( _v1$2 );\n\n\t\t\tthis.getObjectForDistance( distance ).raycast( raycaster, intersects );\n\n\t\t}\n\n\t}\n\n\tupdate( camera ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 1 ) {\n\n\t\t\t_v1$2.setFromMatrixPosition( camera.matrixWorld );\n\t\t\t_v2$1.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tconst distance = _v1$2.distanceTo( _v2$1 ) / camera.zoom;\n\n\t\t\tlevels[ 0 ].object.visible = true;\n\n\t\t\tlet i, l;\n\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tlet levelDistance = levels[ i ].distance;\n\n\t\t\t\tif ( levels[ i ].object.visible ) {\n\n\t\t\t\t\tlevelDistance -= levelDistance * levels[ i ].hysteresis;\n\n\t\t\t\t}\n\n\t\t\t\tif ( distance >= levelDistance ) {\n\n\t\t\t\t\tlevels[ i - 1 ].object.visible = false;\n\t\t\t\t\tlevels[ i ].object.visible = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._currentLevel = i - 1;\n\n\t\t\tfor ( ; i < l; i ++ ) {\n\n\t\t\t\tlevels[ i ].object.visible = false;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.autoUpdate === false ) data.object.autoUpdate = false;\n\n\t\tdata.object.levels = [];\n\n\t\tconst levels = this.levels;\n\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tconst level = levels[ i ];\n\n\t\t\tdata.object.levels.push( {\n\t\t\t\tobject: level.object.uuid,\n\t\t\t\tdistance: level.distance,\n\t\t\t\thysteresis: level.hysteresis\n\t\t\t} );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst _basePosition = /*@__PURE__*/ new Vector3();\n\nconst _skinIndex = /*@__PURE__*/ new Vector4();\nconst _skinWeight = /*@__PURE__*/ new Vector4();\n\nconst _vector3 = /*@__PURE__*/ new Vector3();\nconst _matrix4 = /*@__PURE__*/ new Matrix4();\nconst _vertex = /*@__PURE__*/ new Vector3();\n\nconst _sphere$4 = /*@__PURE__*/ new Sphere();\nconst _inverseMatrix$2 = /*@__PURE__*/ new Matrix4();\nconst _ray$2 = /*@__PURE__*/ new Ray();\n\nclass SkinnedMesh extends Mesh {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isSkinnedMesh = true;\n\n\t\tthis.type = 'SkinnedMesh';\n\n\t\tthis.bindMode = AttachedBindMode;\n\t\tthis.bindMatrix = new Matrix4();\n\t\tthis.bindMatrixInverse = new Matrix4();\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tthis.boundingBox.makeEmpty();\n\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\n\n\t\t\tthis.getVertexPosition( i, _vertex );\n\t\t\tthis.boundingBox.expandByPoint( _vertex );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tthis.boundingSphere.makeEmpty();\n\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\n\n\t\t\tthis.getVertexPosition( i, _vertex );\n\t\t\tthis.boundingSphere.expandByPoint( _vertex );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.bindMode = source.bindMode;\n\t\tthis.bindMatrix.copy( source.bindMatrix );\n\t\tthis.bindMatrixInverse.copy( source.bindMatrixInverse );\n\n\t\tthis.skeleton = source.skeleton;\n\n\t\tif ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();\n\t\tif ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst material = this.material;\n\t\tconst matrixWorld = this.matrixWorld;\n\n\t\tif ( material === undefined ) return;\n\n\t\t// test with bounding sphere in world space\n\n\t\tif ( this.boundingSphere === null ) this.computeBoundingSphere();\n\n\t\t_sphere$4.copy( this.boundingSphere );\n\t\t_sphere$4.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$4 ) === false ) return;\n\n\t\t// convert ray to local space of skinned mesh\n\n\t\t_inverseMatrix$2.copy( matrixWorld ).invert();\n\t\t_ray$2.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$2 );\n\n\t\t// test with bounding box in local space\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tif ( _ray$2.intersectsBox( this.boundingBox ) === false ) return;\n\n\t\t}\n\n\t\t// test for intersections with geometry\n\n\t\tthis._computeIntersections( raycaster, intersects, _ray$2 );\n\n\t}\n\n\tgetVertexPosition( index, target ) {\n\n\t\tsuper.getVertexPosition( index, target );\n\n\t\tthis.applyBoneTransform( index, target );\n\n\t\treturn target;\n\n\t}\n\n\tbind( skeleton, bindMatrix ) {\n\n\t\tthis.skeleton = skeleton;\n\n\t\tif ( bindMatrix === undefined ) {\n\n\t\t\tthis.updateMatrixWorld( true );\n\n\t\t\tthis.skeleton.calculateInverses();\n\n\t\t\tbindMatrix = this.matrixWorld;\n\n\t\t}\n\n\t\tthis.bindMatrix.copy( bindMatrix );\n\t\tthis.bindMatrixInverse.copy( bindMatrix ).invert();\n\n\t}\n\n\tpose() {\n\n\t\tthis.skeleton.pose();\n\n\t}\n\n\tnormalizeSkinWeights() {\n\n\t\tconst vector = new Vector4();\n\n\t\tconst skinWeight = this.geometry.attributes.skinWeight;\n\n\t\tfor ( let i = 0, l = skinWeight.count; i < l; i ++ ) {\n\n\t\t\tvector.fromBufferAttribute( skinWeight, i );\n\n\t\t\tconst scale = 1.0 / vector.manhattanLength();\n\n\t\t\tif ( scale !== Infinity ) {\n\n\t\t\t\tvector.multiplyScalar( scale );\n\n\t\t\t} else {\n\n\t\t\t\tvector.set( 1, 0, 0, 0 ); // do something reasonable\n\n\t\t\t}\n\n\t\t\tskinWeight.setXYZW( i, vector.x, vector.y, vector.z, vector.w );\n\n\t\t}\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tif ( this.bindMode === AttachedBindMode ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.matrixWorld ).invert();\n\n\t\t} else if ( this.bindMode === DetachedBindMode ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.bindMatrix ).invert();\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.SkinnedMesh: Unrecognized bindMode: ' + this.bindMode );\n\n\t\t}\n\n\t}\n\n\tapplyBoneTransform( index, vector ) {\n\n\t\tconst skeleton = this.skeleton;\n\t\tconst geometry = this.geometry;\n\n\t\t_skinIndex.fromBufferAttribute( geometry.attributes.skinIndex, index );\n\t\t_skinWeight.fromBufferAttribute( geometry.attributes.skinWeight, index );\n\n\t\t_basePosition.copy( vector ).applyMatrix4( this.bindMatrix );\n\n\t\tvector.set( 0, 0, 0 );\n\n\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\tconst weight = _skinWeight.getComponent( i );\n\n\t\t\tif ( weight !== 0 ) {\n\n\t\t\t\tconst boneIndex = _skinIndex.getComponent( i );\n\n\t\t\t\t_matrix4.multiplyMatrices( skeleton.bones[ boneIndex ].matrixWorld, skeleton.boneInverses[ boneIndex ] );\n\n\t\t\t\tvector.addScaledVector( _vector3.copy( _basePosition ).applyMatrix4( _matrix4 ), weight );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn vector.applyMatrix4( this.bindMatrixInverse );\n\n\t}\n\n}\n\nclass Bone extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isBone = true;\n\n\t\tthis.type = 'Bone';\n\n\t}\n\n}\n\nclass DataTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, colorSpace ) {\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isDataTexture = true;\n\n\t\tthis.image = { data: data, width: width, height: height };\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nconst _offsetMatrix = /*@__PURE__*/ new Matrix4();\nconst _identityMatrix$1 = /*@__PURE__*/ new Matrix4();\n\nclass Skeleton {\n\n\tconstructor( bones = [], boneInverses = [] ) {\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.bones = bones.slice( 0 );\n\t\tthis.boneInverses = boneInverses;\n\t\tthis.boneMatrices = null;\n\n\t\tthis.boneTexture = null;\n\n\t\tthis.init();\n\n\t}\n\n\tinit() {\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\n\t\tthis.boneMatrices = new Float32Array( bones.length * 16 );\n\n\t\t// calculate inverse bone matrices if necessary\n\n\t\tif ( boneInverses.length === 0 ) {\n\n\t\t\tthis.calculateInverses();\n\n\t\t} else {\n\n\t\t\t// handle special case\n\n\t\t\tif ( bones.length !== boneInverses.length ) {\n\n\t\t\t\tconsole.warn( 'THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.' );\n\n\t\t\t\tthis.boneInverses = [];\n\n\t\t\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\t\t\tthis.boneInverses.push( new Matrix4() );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcalculateInverses() {\n\n\t\tthis.boneInverses.length = 0;\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst inverse = new Matrix4();\n\n\t\t\tif ( this.bones[ i ] ) {\n\n\t\t\t\tinverse.copy( this.bones[ i ].matrixWorld ).invert();\n\n\t\t\t}\n\n\t\t\tthis.boneInverses.push( inverse );\n\n\t\t}\n\n\t}\n\n\tpose() {\n\n\t\t// recover the bind-time world matrices\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tbone.matrixWorld.copy( this.boneInverses[ i ] ).invert();\n\n\t\t\t}\n\n\t\t}\n\n\t\t// compute the local matrices, positions, rotations and scales\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\t\tbone.matrix.copy( bone.parent.matrixWorld ).invert();\n\t\t\t\t\tbone.matrix.multiply( bone.matrixWorld );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbone.matrix.copy( bone.matrixWorld );\n\n\t\t\t\t}\n\n\t\t\t\tbone.matrix.decompose( bone.position, bone.quaternion, bone.scale );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdate() {\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\t\tconst boneMatrices = this.boneMatrices;\n\t\tconst boneTexture = this.boneTexture;\n\n\t\t// flatten bone matrices to array\n\n\t\tfor ( let i = 0, il = bones.length; i < il; i ++ ) {\n\n\t\t\t// compute the offset between the current and the original transform\n\n\t\t\tconst matrix = bones[ i ] ? bones[ i ].matrixWorld : _identityMatrix$1;\n\n\t\t\t_offsetMatrix.multiplyMatrices( matrix, boneInverses[ i ] );\n\t\t\t_offsetMatrix.toArray( boneMatrices, i * 16 );\n\n\t\t}\n\n\t\tif ( boneTexture !== null ) {\n\n\t\t\tboneTexture.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new Skeleton( this.bones, this.boneInverses );\n\n\t}\n\n\tcomputeBoneTexture() {\n\n\t\t// layout (1 matrix = 4 pixels)\n\t\t// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n\t\t// with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8)\n\t\t// 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16)\n\t\t// 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32)\n\t\t// 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)\n\n\t\tlet size = Math.sqrt( this.bones.length * 4 ); // 4 pixels needed for 1 matrix\n\t\tsize = Math.ceil( size / 4 ) * 4;\n\t\tsize = Math.max( size, 4 );\n\n\t\tconst boneMatrices = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel\n\t\tboneMatrices.set( this.boneMatrices ); // copy current values\n\n\t\tconst boneTexture = new DataTexture( boneMatrices, size, size, RGBAFormat, FloatType );\n\t\tboneTexture.needsUpdate = true;\n\n\t\tthis.boneMatrices = boneMatrices;\n\t\tthis.boneTexture = boneTexture;\n\n\t\treturn this;\n\n\t}\n\n\tgetBoneByName( name ) {\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone.name === name ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n\tdispose( ) {\n\n\t\tif ( this.boneTexture !== null ) {\n\n\t\t\tthis.boneTexture.dispose();\n\n\t\t\tthis.boneTexture = null;\n\n\t\t}\n\n\t}\n\n\tfromJSON( json, bones ) {\n\n\t\tthis.uuid = json.uuid;\n\n\t\tfor ( let i = 0, l = json.bones.length; i < l; i ++ ) {\n\n\t\t\tconst uuid = json.bones[ i ];\n\t\t\tlet bone = bones[ uuid ];\n\n\t\t\tif ( bone === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.Skeleton: No bone found with UUID:', uuid );\n\t\t\t\tbone = new Bone();\n\n\t\t\t}\n\n\t\t\tthis.bones.push( bone );\n\t\t\tthis.boneInverses.push( new Matrix4().fromArray( json.boneInverses[ i ] ) );\n\n\t\t}\n\n\t\tthis.init();\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Skeleton',\n\t\t\t\tgenerator: 'Skeleton.toJSON'\n\t\t\t},\n\t\t\tbones: [],\n\t\t\tboneInverses: []\n\t\t};\n\n\t\tdata.uuid = this.uuid;\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\n\t\tfor ( let i = 0, l = bones.length; i < l; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\t\t\tdata.bones.push( bone.uuid );\n\n\t\t\tconst boneInverse = boneInverses[ i ];\n\t\t\tdata.boneInverses.push( boneInverse.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass InstancedBufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized, meshPerAttribute = 1 ) {\n\n\t\tsuper( array, itemSize, normalized );\n\n\t\tthis.isInstancedBufferAttribute = true;\n\n\t\tthis.meshPerAttribute = meshPerAttribute;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.meshPerAttribute = this.meshPerAttribute;\n\n\t\tdata.isInstancedBufferAttribute = true;\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst _instanceLocalMatrix = /*@__PURE__*/ new Matrix4();\nconst _instanceWorldMatrix = /*@__PURE__*/ new Matrix4();\n\nconst _instanceIntersects = [];\n\nconst _box3 = /*@__PURE__*/ new Box3();\nconst _identity = /*@__PURE__*/ new Matrix4();\nconst _mesh$1 = /*@__PURE__*/ new Mesh();\nconst _sphere$3 = /*@__PURE__*/ new Sphere();\n\nclass InstancedMesh extends Mesh {\n\n\tconstructor( geometry, material, count ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isInstancedMesh = true;\n\n\t\tthis.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );\n\t\tthis.instanceColor = null;\n\t\tthis.morphTexture = null;\n\n\t\tthis.count = count;\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.setMatrixAt( i, _identity );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst count = this.count;\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\tgeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tthis.boundingBox.makeEmpty();\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\n\n\t\t\t_box3.copy( geometry.boundingBox ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingBox.union( _box3 );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst count = this.count;\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tif ( geometry.boundingSphere === null ) {\n\n\t\t\tgeometry.computeBoundingSphere();\n\n\t\t}\n\n\t\tthis.boundingSphere.makeEmpty();\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\n\n\t\t\t_sphere$3.copy( geometry.boundingSphere ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingSphere.union( _sphere$3 );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.instanceMatrix.copy( source.instanceMatrix );\n\n\t\tif ( source.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();\n\t\tif ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();\n\n\t\tthis.count = source.count;\n\n\t\tif ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();\n\t\tif ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();\n\n\t\treturn this;\n\n\t}\n\n\tgetColorAt( index, color ) {\n\n\t\tcolor.fromArray( this.instanceColor.array, index * 3 );\n\n\t}\n\n\tgetMatrixAt( index, matrix ) {\n\n\t\tmatrix.fromArray( this.instanceMatrix.array, index * 16 );\n\n\t}\n\n\tgetMorphAt( index, object ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\tconst array = this.morphTexture.source.data.data;\n\n\t\tconst len = objectInfluences.length + 1; // All influences + the baseInfluenceSum\n\n\t\tconst dataIndex = index * len + 1; // Skip the baseInfluenceSum at the beginning\n\n\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\tobjectInfluences[ i ] = array[ dataIndex + i ];\n\n\t\t}\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst raycastTimes = this.count;\n\n\t\t_mesh$1.geometry = this.geometry;\n\t\t_mesh$1.material = this.material;\n\n\t\tif ( _mesh$1.material === undefined ) return;\n\n\t\t// test with bounding sphere first\n\n\t\tif ( this.boundingSphere === null ) this.computeBoundingSphere();\n\n\t\t_sphere$3.copy( this.boundingSphere );\n\t\t_sphere$3.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$3 ) === false ) return;\n\n\t\t// now test each instance\n\n\t\tfor ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {\n\n\t\t\t// calculate the world matrix for each instance\n\n\t\t\tthis.getMatrixAt( instanceId, _instanceLocalMatrix );\n\n\t\t\t_instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix );\n\n\t\t\t// the mesh represents this single instance\n\n\t\t\t_mesh$1.matrixWorld = _instanceWorldMatrix;\n\n\t\t\t_mesh$1.raycast( raycaster, _instanceIntersects );\n\n\t\t\t// process the result of raycast\n\n\t\t\tfor ( let i = 0, l = _instanceIntersects.length; i < l; i ++ ) {\n\n\t\t\t\tconst intersect = _instanceIntersects[ i ];\n\t\t\t\tintersect.instanceId = instanceId;\n\t\t\t\tintersect.object = this;\n\t\t\t\tintersects.push( intersect );\n\n\t\t\t}\n\n\t\t\t_instanceIntersects.length = 0;\n\n\t\t}\n\n\t}\n\n\tsetColorAt( index, color ) {\n\n\t\tif ( this.instanceColor === null ) {\n\n\t\t\tthis.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ).fill( 1 ), 3 );\n\n\t\t}\n\n\t\tcolor.toArray( this.instanceColor.array, index * 3 );\n\n\t}\n\n\tsetMatrixAt( index, matrix ) {\n\n\t\tmatrix.toArray( this.instanceMatrix.array, index * 16 );\n\n\t}\n\n\tsetMorphAt( index, object ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\tconst len = objectInfluences.length + 1; // morphBaseInfluence + all influences\n\n\t\tif ( this.morphTexture === null ) {\n\n\t\t\tthis.morphTexture = new DataTexture( new Float32Array( len * this.count ), len, this.count, RedFormat, FloatType );\n\n\t\t}\n\n\t\tconst array = this.morphTexture.source.data.data;\n\n\t\tlet morphInfluencesSum = 0;\n\n\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\tmorphInfluencesSum += objectInfluences[ i ];\n\n\t\t}\n\n\t\tconst morphBaseInfluence = this.geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\t\tconst dataIndex = len * index;\n\n\t\tarray[ dataIndex ] = morphBaseInfluence;\n\n\t\tarray.set( objectInfluences, dataIndex + 1 );\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t\tif ( this.morphTexture !== null ) {\n\n\t\t\tthis.morphTexture.dispose();\n\t\t\tthis.morphTexture = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction sortOpaque( a, b ) {\n\n\treturn a.z - b.z;\n\n}\n\nfunction sortTransparent( a, b ) {\n\n\treturn b.z - a.z;\n\n}\n\nclass MultiDrawRenderList {\n\n\tconstructor() {\n\n\t\tthis.index = 0;\n\t\tthis.pool = [];\n\t\tthis.list = [];\n\n\t}\n\n\tpush( drawRange, z, index ) {\n\n\t\tconst pool = this.pool;\n\t\tconst list = this.list;\n\t\tif ( this.index >= pool.length ) {\n\n\t\t\tpool.push( {\n\n\t\t\t\tstart: - 1,\n\t\t\t\tcount: - 1,\n\t\t\t\tz: - 1,\n\t\t\t\tindex: - 1,\n\n\t\t\t} );\n\n\t\t}\n\n\t\tconst item = pool[ this.index ];\n\t\tlist.push( item );\n\t\tthis.index ++;\n\n\t\titem.start = drawRange.start;\n\t\titem.count = drawRange.count;\n\t\titem.z = z;\n\t\titem.index = index;\n\n\t}\n\n\treset() {\n\n\t\tthis.list.length = 0;\n\t\tthis.index = 0;\n\n\t}\n\n}\n\nconst _matrix$1 = /*@__PURE__*/ new Matrix4();\nconst _invMatrixWorld = /*@__PURE__*/ new Matrix4();\nconst _identityMatrix = /*@__PURE__*/ new Matrix4();\nconst _whiteColor = /*@__PURE__*/ new Color( 1, 1, 1 );\nconst _projScreenMatrix$2 = /*@__PURE__*/ new Matrix4();\nconst _frustum = /*@__PURE__*/ new Frustum();\nconst _box$1 = /*@__PURE__*/ new Box3();\nconst _sphere$2 = /*@__PURE__*/ new Sphere();\nconst _vector$5 = /*@__PURE__*/ new Vector3();\nconst _forward = /*@__PURE__*/ new Vector3();\nconst _temp = /*@__PURE__*/ new Vector3();\nconst _renderList = /*@__PURE__*/ new MultiDrawRenderList();\nconst _mesh = /*@__PURE__*/ new Mesh();\nconst _batchIntersects = [];\n\n// @TODO: SkinnedMesh support?\n// @TODO: geometry.groups support?\n// @TODO: geometry.drawRange support?\n// @TODO: geometry.morphAttributes support?\n// @TODO: Support uniform parameter per geometry\n// @TODO: Add an \"optimize\" function to pack geometry and remove data gaps\n\n// copies data from attribute \"src\" into \"target\" starting at \"targetOffset\"\nfunction copyAttributeData( src, target, targetOffset = 0 ) {\n\n\tconst itemSize = target.itemSize;\n\tif ( src.isInterleavedBufferAttribute || src.array.constructor !== target.array.constructor ) {\n\n\t\t// use the component getters and setters if the array data cannot\n\t\t// be copied directly\n\t\tconst vertexCount = src.count;\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\n\n\t\t\tfor ( let c = 0; c < itemSize; c ++ ) {\n\n\t\t\t\ttarget.setComponent( i + targetOffset, c, src.getComponent( i, c ) );\n\n\t\t\t}\n\n\t\t}\n\n\t} else {\n\n\t\t// faster copy approach using typed array set function\n\t\ttarget.array.set( src.array, targetOffset * itemSize );\n\n\t}\n\n\ttarget.needsUpdate = true;\n\n}\n\nclass BatchedMesh extends Mesh {\n\n\tget maxInstanceCount() {\n\n\t\treturn this._maxInstanceCount;\n\n\t}\n\n\tconstructor( maxInstanceCount, maxVertexCount, maxIndexCount = maxVertexCount * 2, material ) {\n\n\t\tsuper( new BufferGeometry(), material );\n\n\t\tthis.isBatchedMesh = true;\n\t\tthis.perObjectFrustumCulled = true;\n\t\tthis.sortObjects = true;\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\t\tthis.customSort = null;\n\n\t\t// stores visible, active, and geometry id per object\n\t\tthis._drawInfo = [];\n\n\t\t// geometry information\n\t\tthis._drawRanges = [];\n\t\tthis._reservedRanges = [];\n\t\tthis._bounds = [];\n\n\t\tthis._maxInstanceCount = maxInstanceCount;\n\t\tthis._maxVertexCount = maxVertexCount;\n\t\tthis._maxIndexCount = maxIndexCount;\n\n\t\tthis._geometryInitialized = false;\n\t\tthis._geometryCount = 0;\n\t\tthis._multiDrawCounts = new Int32Array( maxInstanceCount );\n\t\tthis._multiDrawStarts = new Int32Array( maxInstanceCount );\n\t\tthis._multiDrawCount = 0;\n\t\tthis._multiDrawInstances = null;\n\t\tthis._visibilityChanged = true;\n\n\t\t// Local matrix per geometry by using data texture\n\t\tthis._matricesTexture = null;\n\t\tthis._indirectTexture = null;\n\t\tthis._colorsTexture = null;\n\n\t\tthis._initMatricesTexture();\n\t\tthis._initIndirectTexture();\n\n\t}\n\n\t_initMatricesTexture() {\n\n\t\t// layout (1 matrix = 4 pixels)\n\t\t// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n\t\t// with 8x8 pixel texture max 16 matrices * 4 pixels = (8 * 8)\n\t\t// 16x16 pixel texture max 64 matrices * 4 pixels = (16 * 16)\n\t\t// 32x32 pixel texture max 256 matrices * 4 pixels = (32 * 32)\n\t\t// 64x64 pixel texture max 1024 matrices * 4 pixels = (64 * 64)\n\n\t\tlet size = Math.sqrt( this._maxInstanceCount * 4 ); // 4 pixels needed for 1 matrix\n\t\tsize = Math.ceil( size / 4 ) * 4;\n\t\tsize = Math.max( size, 4 );\n\n\t\tconst matricesArray = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel\n\t\tconst matricesTexture = new DataTexture( matricesArray, size, size, RGBAFormat, FloatType );\n\n\t\tthis._matricesTexture = matricesTexture;\n\n\t}\n\n\t_initIndirectTexture() {\n\n\t\tlet size = Math.sqrt( this._maxInstanceCount );\n\t\tsize = Math.ceil( size );\n\n\t\tconst indirectArray = new Uint32Array( size * size );\n\t\tconst indirectTexture = new DataTexture( indirectArray, size, size, RedIntegerFormat, UnsignedIntType );\n\n\t\tthis._indirectTexture = indirectTexture;\n\n\t}\n\n\t_initColorsTexture() {\n\n\t\tlet size = Math.sqrt( this._maxInstanceCount );\n\t\tsize = Math.ceil( size );\n\n\t\t// 4 floats per RGBA pixel initialized to white\n\t\tconst colorsArray = new Float32Array( size * size * 4 ).fill( 1 );\n\t\tconst colorsTexture = new DataTexture( colorsArray, size, size, RGBAFormat, FloatType );\n\t\tcolorsTexture.colorSpace = ColorManagement.workingColorSpace;\n\n\t\tthis._colorsTexture = colorsTexture;\n\n\t}\n\n\t_initializeGeometry( reference ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst maxVertexCount = this._maxVertexCount;\n\t\tconst maxIndexCount = this._maxIndexCount;\n\t\tif ( this._geometryInitialized === false ) {\n\n\t\t\tfor ( const attributeName in reference.attributes ) {\n\n\t\t\t\tconst srcAttribute = reference.getAttribute( attributeName );\n\t\t\t\tconst { array, itemSize, normalized } = srcAttribute;\n\n\t\t\t\tconst dstArray = new array.constructor( maxVertexCount * itemSize );\n\t\t\t\tconst dstAttribute = new BufferAttribute( dstArray, itemSize, normalized );\n\n\t\t\t\tgeometry.setAttribute( attributeName, dstAttribute );\n\n\t\t\t}\n\n\t\t\tif ( reference.getIndex() !== null ) {\n\n\t\t\t\t// Reserve last u16 index for primitive restart.\n\t\t\t\tconst indexArray = maxVertexCount > 65535\n\t\t\t\t\t? new Uint32Array( maxIndexCount )\n\t\t\t\t\t: new Uint16Array( maxIndexCount );\n\n\t\t\t\tgeometry.setIndex( new BufferAttribute( indexArray, 1 ) );\n\n\t\t\t}\n\n\t\t\tthis._geometryInitialized = true;\n\n\t\t}\n\n\t}\n\n\t// Make sure the geometry is compatible with the existing combined geometry attributes\n\t_validateGeometry( geometry ) {\n\n\t\t// check to ensure the geometries are using consistent attributes and indices\n\t\tconst batchGeometry = this.geometry;\n\t\tif ( Boolean( geometry.getIndex() ) !== Boolean( batchGeometry.getIndex() ) ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: All geometries must consistently have \"index\".' );\n\n\t\t}\n\n\t\tfor ( const attributeName in batchGeometry.attributes ) {\n\n\t\t\tif ( ! geometry.hasAttribute( attributeName ) ) {\n\n\t\t\t\tthrow new Error( `BatchedMesh: Added geometry missing \"${ attributeName }\". All geometries must have consistent attributes.` );\n\n\t\t\t}\n\n\t\t\tconst srcAttribute = geometry.getAttribute( attributeName );\n\t\t\tconst dstAttribute = batchGeometry.getAttribute( attributeName );\n\t\t\tif ( srcAttribute.itemSize !== dstAttribute.itemSize || srcAttribute.normalized !== dstAttribute.normalized ) {\n\n\t\t\t\tthrow new Error( 'BatchedMesh: All attributes must have a consistent itemSize and normalized value.' );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tsetCustomSort( func ) {\n\n\t\tthis.customSort = func;\n\t\treturn this;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tconst boundingBox = this.boundingBox;\n\t\tconst drawInfo = this._drawInfo;\n\n\t\tboundingBox.makeEmpty();\n\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\n\n\t\t\tif ( drawInfo[ i ].active === false ) continue;\n\n\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\n\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\tthis.getBoundingBoxAt( geometryId, _box$1 ).applyMatrix4( _matrix$1 );\n\t\t\tboundingBox.union( _box$1 );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tconst boundingSphere = this.boundingSphere;\n\t\tconst drawInfo = this._drawInfo;\n\n\t\tboundingSphere.makeEmpty();\n\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\n\n\t\t\tif ( drawInfo[ i ].active === false ) continue;\n\n\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\n\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\tthis.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );\n\t\t\tboundingSphere.union( _sphere$2 );\n\n\t\t}\n\n\t}\n\n\taddInstance( geometryId ) {\n\n\t\t// ensure we're not over geometry\n\t\tif ( this._drawInfo.length >= this._maxInstanceCount ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Maximum item count reached.' );\n\n\t\t}\n\n\t\tthis._drawInfo.push( {\n\n\t\t\tvisible: true,\n\t\t\tactive: true,\n\t\t\tgeometryIndex: geometryId,\n\n\t\t} );\n\n\t\t// initialize the matrix\n\t\tconst drawId = this._drawInfo.length - 1;\n\t\tconst matricesTexture = this._matricesTexture;\n\t\tconst matricesArray = matricesTexture.image.data;\n\t\t_identityMatrix.toArray( matricesArray, drawId * 16 );\n\t\tmatricesTexture.needsUpdate = true;\n\n\t\tconst colorsTexture = this._colorsTexture;\n\t\tif ( colorsTexture ) {\n\n\t\t\t_whiteColor.toArray( colorsTexture.image.data, drawId * 4 );\n\t\t\tcolorsTexture.needsUpdate = true;\n\n\t\t}\n\n\t\treturn drawId;\n\n\t}\n\n\taddGeometry( geometry, vertexCount = - 1, indexCount = - 1 ) {\n\n\t\tthis._initializeGeometry( geometry );\n\n\t\tthis._validateGeometry( geometry );\n\n\t\t// ensure we're not over geometry\n\t\tif ( this._drawInfo.length >= this._maxInstanceCount ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Maximum item count reached.' );\n\n\t\t}\n\n\t\t// get the necessary range fo the geometry\n\t\tconst reservedRange = {\n\t\t\tvertexStart: - 1,\n\t\t\tvertexCount: - 1,\n\t\t\tindexStart: - 1,\n\t\t\tindexCount: - 1,\n\t\t};\n\n\t\tlet lastRange = null;\n\t\tconst reservedRanges = this._reservedRanges;\n\t\tconst drawRanges = this._drawRanges;\n\t\tconst bounds = this._bounds;\n\t\tif ( this._geometryCount !== 0 ) {\n\n\t\t\tlastRange = reservedRanges[ reservedRanges.length - 1 ];\n\n\t\t}\n\n\t\tif ( vertexCount === - 1 ) {\n\n\t\t\treservedRange.vertexCount = geometry.getAttribute( 'position' ).count;\n\n\t\t} else {\n\n\t\t\treservedRange.vertexCount = vertexCount;\n\n\t\t}\n\n\t\tif ( lastRange === null ) {\n\n\t\t\treservedRange.vertexStart = 0;\n\n\t\t} else {\n\n\t\t\treservedRange.vertexStart = lastRange.vertexStart + lastRange.vertexCount;\n\n\t\t}\n\n\t\tconst index = geometry.getIndex();\n\t\tconst hasIndex = index !== null;\n\t\tif ( hasIndex ) {\n\n\t\t\tif ( indexCount\t=== - 1 ) {\n\n\t\t\t\treservedRange.indexCount = index.count;\n\n\t\t\t} else {\n\n\t\t\t\treservedRange.indexCount = indexCount;\n\n\t\t\t}\n\n\t\t\tif ( lastRange === null ) {\n\n\t\t\t\treservedRange.indexStart = 0;\n\n\t\t\t} else {\n\n\t\t\t\treservedRange.indexStart = lastRange.indexStart + lastRange.indexCount;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif (\n\t\t\treservedRange.indexStart !== - 1 &&\n\t\t\treservedRange.indexStart + reservedRange.indexCount > this._maxIndexCount ||\n\t\t\treservedRange.vertexStart + reservedRange.vertexCount > this._maxVertexCount\n\t\t) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Reserved space request exceeds the maximum buffer size.' );\n\n\t\t}\n\n\t\t// update id\n\t\tconst geometryId = this._geometryCount;\n\t\tthis._geometryCount ++;\n\n\t\t// add the reserved range and draw range objects\n\t\treservedRanges.push( reservedRange );\n\t\tdrawRanges.push( {\n\t\t\tstart: hasIndex ? reservedRange.indexStart : reservedRange.vertexStart,\n\t\t\tcount: - 1\n\t\t} );\n\t\tbounds.push( {\n\t\t\tboxInitialized: false,\n\t\t\tbox: new Box3(),\n\n\t\t\tsphereInitialized: false,\n\t\t\tsphere: new Sphere()\n\t\t} );\n\n\t\t// update the geometry\n\t\tthis.setGeometryAt( geometryId, geometry );\n\n\t\treturn geometryId;\n\n\t}\n\n\tsetGeometryAt( geometryId, geometry ) {\n\n\t\tif ( geometryId >= this._geometryCount ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Maximum geometry count reached.' );\n\n\t\t}\n\n\t\tthis._validateGeometry( geometry );\n\n\t\tconst batchGeometry = this.geometry;\n\t\tconst hasIndex = batchGeometry.getIndex() !== null;\n\t\tconst dstIndex = batchGeometry.getIndex();\n\t\tconst srcIndex = geometry.getIndex();\n\t\tconst reservedRange = this._reservedRanges[ geometryId ];\n\t\tif (\n\t\t\thasIndex &&\n\t\t\tsrcIndex.count > reservedRange.indexCount ||\n\t\t\tgeometry.attributes.position.count > reservedRange.vertexCount\n\t\t) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Reserved space not large enough for provided geometry.' );\n\n\t\t}\n\n\t\t// copy geometry over\n\t\tconst vertexStart = reservedRange.vertexStart;\n\t\tconst vertexCount = reservedRange.vertexCount;\n\t\tfor ( const attributeName in batchGeometry.attributes ) {\n\n\t\t\t// copy attribute data\n\t\t\tconst srcAttribute = geometry.getAttribute( attributeName );\n\t\t\tconst dstAttribute = batchGeometry.getAttribute( attributeName );\n\t\t\tcopyAttributeData( srcAttribute, dstAttribute, vertexStart );\n\n\t\t\t// fill the rest in with zeroes\n\t\t\tconst itemSize = srcAttribute.itemSize;\n\t\t\tfor ( let i = srcAttribute.count, l = vertexCount; i < l; i ++ ) {\n\n\t\t\t\tconst index = vertexStart + i;\n\t\t\t\tfor ( let c = 0; c < itemSize; c ++ ) {\n\n\t\t\t\t\tdstAttribute.setComponent( index, c, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tdstAttribute.needsUpdate = true;\n\t\t\tdstAttribute.addUpdateRange( vertexStart * itemSize, vertexCount * itemSize );\n\n\t\t}\n\n\t\t// copy index\n\t\tif ( hasIndex ) {\n\n\t\t\tconst indexStart = reservedRange.indexStart;\n\n\t\t\t// copy index data over\n\t\t\tfor ( let i = 0; i < srcIndex.count; i ++ ) {\n\n\t\t\t\tdstIndex.setX( indexStart + i, vertexStart + srcIndex.getX( i ) );\n\n\t\t\t}\n\n\t\t\t// fill the rest in with zeroes\n\t\t\tfor ( let i = srcIndex.count, l = reservedRange.indexCount; i < l; i ++ ) {\n\n\t\t\t\tdstIndex.setX( indexStart + i, vertexStart );\n\n\t\t\t}\n\n\t\t\tdstIndex.needsUpdate = true;\n\t\t\tdstIndex.addUpdateRange( indexStart, reservedRange.indexCount );\n\n\t\t}\n\n\t\t// store the bounding boxes\n\t\tconst bound = this._bounds[ geometryId ];\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tbound.box.copy( geometry.boundingBox );\n\t\t\tbound.boxInitialized = true;\n\n\t\t} else {\n\n\t\t\tbound.boxInitialized = false;\n\n\t\t}\n\n\t\tif ( geometry.boundingSphere !== null ) {\n\n\t\t\tbound.sphere.copy( geometry.boundingSphere );\n\t\t\tbound.sphereInitialized = true;\n\n\t\t} else {\n\n\t\t\tbound.sphereInitialized = false;\n\n\t\t}\n\n\t\t// set drawRange count\n\t\tconst drawRange = this._drawRanges[ geometryId ];\n\t\tconst posAttr = geometry.getAttribute( 'position' );\n\t\tdrawRange.count = hasIndex ? srcIndex.count : posAttr.count;\n\t\tthis._visibilityChanged = true;\n\n\t\treturn geometryId;\n\n\t}\n\n\t/*\n\tdeleteGeometry( geometryId ) {\n\n\t\t// TODO: delete geometry and associated instances\n\n\t}\n\t*/\n\n\t/*\n\tdeleteInstance( instanceId ) {\n\n\t\t// Note: User needs to call optimize() afterward to pack the data.\n\n\t\tconst drawInfo = this._drawInfo;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tdrawInfo[ instanceId ].active = false;\n\t\tthis._visibilityChanged = true;\n\n\t\treturn this;\n\n\t}\n\t*/\n\n\t// get bounding box and compute it if it doesn't exist\n\tgetBoundingBoxAt( geometryId, target ) {\n\n\t\tif ( geometryId >= this._geometryCount ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// compute bounding box\n\t\tconst bound = this._bounds[ geometryId ];\n\t\tconst box = bound.box;\n\t\tconst geometry = this.geometry;\n\t\tif ( bound.boxInitialized === false ) {\n\n\t\t\tbox.makeEmpty();\n\n\t\t\tconst index = geometry.index;\n\t\t\tconst position = geometry.attributes.position;\n\t\t\tconst drawRange = this._drawRanges[ geometryId ];\n\t\t\tfor ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {\n\n\t\t\t\tlet iv = i;\n\t\t\t\tif ( index ) {\n\n\t\t\t\t\tiv = index.getX( iv );\n\n\t\t\t\t}\n\n\t\t\t\tbox.expandByPoint( _vector$5.fromBufferAttribute( position, iv ) );\n\n\t\t\t}\n\n\t\t\tbound.boxInitialized = true;\n\n\t\t}\n\n\t\ttarget.copy( box );\n\t\treturn target;\n\n\t}\n\n\t// get bounding sphere and compute it if it doesn't exist\n\tgetBoundingSphereAt( geometryId, target ) {\n\n\t\tif ( geometryId >= this._geometryCount ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// compute bounding sphere\n\t\tconst bound = this._bounds[ geometryId ];\n\t\tconst sphere = bound.sphere;\n\t\tconst geometry = this.geometry;\n\t\tif ( bound.sphereInitialized === false ) {\n\n\t\t\tsphere.makeEmpty();\n\n\t\t\tthis.getBoundingBoxAt( geometryId, _box$1 );\n\t\t\t_box$1.getCenter( sphere.center );\n\n\t\t\tconst index = geometry.index;\n\t\t\tconst position = geometry.attributes.position;\n\t\t\tconst drawRange = this._drawRanges[ geometryId ];\n\n\t\t\tlet maxRadiusSq = 0;\n\t\t\tfor ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {\n\n\t\t\t\tlet iv = i;\n\t\t\t\tif ( index ) {\n\n\t\t\t\t\tiv = index.getX( iv );\n\n\t\t\t\t}\n\n\t\t\t\t_vector$5.fromBufferAttribute( position, iv );\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, sphere.center.distanceToSquared( _vector$5 ) );\n\n\t\t\t}\n\n\t\t\tsphere.radius = Math.sqrt( maxRadiusSq );\n\t\t\tbound.sphereInitialized = true;\n\n\t\t}\n\n\t\ttarget.copy( sphere );\n\t\treturn target;\n\n\t}\n\n\tsetMatrixAt( instanceId, matrix ) {\n\n\t\t// @TODO: Map geometryId to index of the arrays because\n\t\t// optimize() can make geometryId mismatch the index\n\n\t\tconst drawInfo = this._drawInfo;\n\t\tconst matricesTexture = this._matricesTexture;\n\t\tconst matricesArray = this._matricesTexture.image.data;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tmatrix.toArray( matricesArray, instanceId * 16 );\n\t\tmatricesTexture.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\tgetMatrixAt( instanceId, matrix ) {\n\n\t\tconst drawInfo = this._drawInfo;\n\t\tconst matricesArray = this._matricesTexture.image.data;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn matrix.fromArray( matricesArray, instanceId * 16 );\n\n\t}\n\n\tsetColorAt( instanceId, color ) {\n\n\t\tif ( this._colorsTexture === null ) {\n\n\t\t\tthis._initColorsTexture();\n\n\t\t}\n\n\t\t// @TODO: Map id to index of the arrays because\n\t\t// optimize() can make id mismatch the index\n\n\t\tconst colorsTexture = this._colorsTexture;\n\t\tconst colorsArray = this._colorsTexture.image.data;\n\t\tconst drawInfo = this._drawInfo;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tcolor.toArray( colorsArray, instanceId * 4 );\n\t\tcolorsTexture.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\tgetColorAt( instanceId, color ) {\n\n\t\tconst colorsArray = this._colorsTexture.image.data;\n\t\tconst drawInfo = this._drawInfo;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn color.fromArray( colorsArray, instanceId * 4 );\n\n\t}\n\n\tsetVisibleAt( instanceId, value ) {\n\n\t\t// if the geometry is out of range, not active, or visibility state\n\t\t// does not change then return early\n\t\tconst drawInfo = this._drawInfo;\n\t\tif (\n\t\t\tinstanceId >= drawInfo.length ||\n\t\t\tdrawInfo[ instanceId ].active === false ||\n\t\t\tdrawInfo[ instanceId ].visible === value\n\t\t) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tdrawInfo[ instanceId ].visible = value;\n\t\tthis._visibilityChanged = true;\n\n\t\treturn this;\n\n\t}\n\n\tgetVisibleAt( instanceId ) {\n\n\t\t// return early if the geometry is out of range or not active\n\t\tconst drawInfo = this._drawInfo;\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn drawInfo[ instanceId ].visible;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst drawInfo = this._drawInfo;\n\t\tconst drawRanges = this._drawRanges;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst batchGeometry = this.geometry;\n\n\t\t// iterate over each geometry\n\t\t_mesh.material = this.material;\n\t\t_mesh.geometry.index = batchGeometry.index;\n\t\t_mesh.geometry.attributes = batchGeometry.attributes;\n\t\tif ( _mesh.geometry.boundingBox === null ) {\n\n\t\t\t_mesh.geometry.boundingBox = new Box3();\n\n\t\t}\n\n\t\tif ( _mesh.geometry.boundingSphere === null ) {\n\n\t\t\t_mesh.geometry.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\n\n\t\t\tif ( ! drawInfo[ i ].visible || ! drawInfo[ i ].active ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\n\t\t\tconst drawRange = drawRanges[ geometryId ];\n\t\t\t_mesh.geometry.setDrawRange( drawRange.start, drawRange.count );\n\n\t\t\t// ge the intersects\n\t\t\tthis.getMatrixAt( i, _mesh.matrixWorld ).premultiply( matrixWorld );\n\t\t\tthis.getBoundingBoxAt( geometryId, _mesh.geometry.boundingBox );\n\t\t\tthis.getBoundingSphereAt( geometryId, _mesh.geometry.boundingSphere );\n\t\t\t_mesh.raycast( raycaster, _batchIntersects );\n\n\t\t\t// add batch id to the intersects\n\t\t\tfor ( let j = 0, l = _batchIntersects.length; j < l; j ++ ) {\n\n\t\t\t\tconst intersect = _batchIntersects[ j ];\n\t\t\t\tintersect.object = this;\n\t\t\t\tintersect.batchId = i;\n\t\t\t\tintersects.push( intersect );\n\n\t\t\t}\n\n\t\t\t_batchIntersects.length = 0;\n\n\t\t}\n\n\t\t_mesh.material = null;\n\t\t_mesh.geometry.index = null;\n\t\t_mesh.geometry.attributes = {};\n\t\t_mesh.geometry.setDrawRange( 0, Infinity );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.geometry = source.geometry.clone();\n\t\tthis.perObjectFrustumCulled = source.perObjectFrustumCulled;\n\t\tthis.sortObjects = source.sortObjects;\n\t\tthis.boundingBox = source.boundingBox !== null ? source.boundingBox.clone() : null;\n\t\tthis.boundingSphere = source.boundingSphere !== null ? source.boundingSphere.clone() : null;\n\n\t\tthis._drawRanges = source._drawRanges.map( range => ( { ...range } ) );\n\t\tthis._reservedRanges = source._reservedRanges.map( range => ( { ...range } ) );\n\n\t\tthis._drawInfo = source._drawInfo.map( inf => ( { ...inf } ) );\n\t\tthis._bounds = source._bounds.map( bound => ( {\n\t\t\tboxInitialized: bound.boxInitialized,\n\t\t\tbox: bound.box.clone(),\n\n\t\t\tsphereInitialized: bound.sphereInitialized,\n\t\t\tsphere: bound.sphere.clone()\n\t\t} ) );\n\n\t\tthis._maxInstanceCount = source._maxInstanceCount;\n\t\tthis._maxVertexCount = source._maxVertexCount;\n\t\tthis._maxIndexCount = source._maxIndexCount;\n\n\t\tthis._geometryInitialized = source._geometryInitialized;\n\t\tthis._geometryCount = source._geometryCount;\n\t\tthis._multiDrawCounts = source._multiDrawCounts.slice();\n\t\tthis._multiDrawStarts = source._multiDrawStarts.slice();\n\n\t\tthis._matricesTexture = source._matricesTexture.clone();\n\t\tthis._matricesTexture.image.data = this._matricesTexture.image.data.slice();\n\n\t\tif ( this._colorsTexture !== null ) {\n\n\t\t\tthis._colorsTexture = source._colorsTexture.clone();\n\t\t\tthis._colorsTexture.image.data = this._colorsTexture.image.data.slice();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\t// Assuming the geometry is not shared with other meshes\n\t\tthis.geometry.dispose();\n\n\t\tthis._matricesTexture.dispose();\n\t\tthis._matricesTexture = null;\n\n\t\tthis._indirectTexture.dispose();\n\t\tthis._indirectTexture = null;\n\n\t\tif ( this._colorsTexture !== null ) {\n\n\t\t\tthis._colorsTexture.dispose();\n\t\t\tthis._colorsTexture = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tonBeforeRender( renderer, scene, camera, geometry, material/*, _group*/ ) {\n\n\t\t// if visibility has not changed and frustum culling and object sorting is not required\n\t\t// then skip iterating over all items\n\t\tif ( ! this._visibilityChanged && ! this.perObjectFrustumCulled && ! this.sortObjects ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// the indexed version of the multi draw function requires specifying the start\n\t\t// offset in bytes.\n\t\tconst index = geometry.getIndex();\n\t\tconst bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;\n\n\t\tconst drawInfo = this._drawInfo;\n\t\tconst multiDrawStarts = this._multiDrawStarts;\n\t\tconst multiDrawCounts = this._multiDrawCounts;\n\t\tconst drawRanges = this._drawRanges;\n\t\tconst perObjectFrustumCulled = this.perObjectFrustumCulled;\n\t\tconst indirectTexture = this._indirectTexture;\n\t\tconst indirectArray = indirectTexture.image.data;\n\n\t\t// prepare the frustum in the local frame\n\t\tif ( perObjectFrustumCulled ) {\n\n\t\t\t_projScreenMatrix$2\n\t\t\t\t.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )\n\t\t\t\t.multiply( this.matrixWorld );\n\t\t\t_frustum.setFromProjectionMatrix(\n\t\t\t\t_projScreenMatrix$2,\n\t\t\t\trenderer.coordinateSystem\n\t\t\t);\n\n\t\t}\n\n\t\tlet count = 0;\n\t\tif ( this.sortObjects ) {\n\n\t\t\t// get the camera position in the local frame\n\t\t\t_invMatrixWorld.copy( this.matrixWorld ).invert();\n\t\t\t_vector$5.setFromMatrixPosition( camera.matrixWorld ).applyMatrix4( _invMatrixWorld );\n\t\t\t_forward.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld ).transformDirection( _invMatrixWorld );\n\n\t\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\n\n\t\t\t\tif ( drawInfo[ i ].visible && drawInfo[ i ].active ) {\n\n\t\t\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\n\n\t\t\t\t\t// get the bounds in world space\n\t\t\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\t\t\tthis.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );\n\n\t\t\t\t\t// determine whether the batched geometry is within the frustum\n\t\t\t\t\tlet culled = false;\n\t\t\t\t\tif ( perObjectFrustumCulled ) {\n\n\t\t\t\t\t\tculled = ! _frustum.intersectsSphere( _sphere$2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! culled ) {\n\n\t\t\t\t\t\t// get the distance from camera used for sorting\n\t\t\t\t\t\tconst z = _temp.subVectors( _sphere$2.center, _vector$5 ).dot( _forward );\n\t\t\t\t\t\t_renderList.push( drawRanges[ geometryId ], z, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Sort the draw ranges and prep for rendering\n\t\t\tconst list = _renderList.list;\n\t\t\tconst customSort = this.customSort;\n\t\t\tif ( customSort === null ) {\n\n\t\t\t\tlist.sort( material.transparent ? sortTransparent : sortOpaque );\n\n\t\t\t} else {\n\n\t\t\t\tcustomSort.call( this, list, camera );\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = list.length; i < l; i ++ ) {\n\n\t\t\t\tconst item = list[ i ];\n\t\t\t\tmultiDrawStarts[ count ] = item.start * bytesPerElement;\n\t\t\t\tmultiDrawCounts[ count ] = item.count;\n\t\t\t\tindirectArray[ count ] = item.index;\n\t\t\t\tcount ++;\n\n\t\t\t}\n\n\t\t\t_renderList.reset();\n\n\t\t} else {\n\n\t\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\n\n\t\t\t\tif ( drawInfo[ i ].visible && drawInfo[ i ].active ) {\n\n\t\t\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\n\n\t\t\t\t\t// determine whether the batched geometry is within the frustum\n\t\t\t\t\tlet culled = false;\n\t\t\t\t\tif ( perObjectFrustumCulled ) {\n\n\t\t\t\t\t\t// get the bounds in world space\n\t\t\t\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\t\t\t\tthis.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );\n\t\t\t\t\t\tculled = ! _frustum.intersectsSphere( _sphere$2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! culled ) {\n\n\t\t\t\t\t\tconst range = drawRanges[ geometryId ];\n\t\t\t\t\t\tmultiDrawStarts[ count ] = range.start * bytesPerElement;\n\t\t\t\t\t\tmultiDrawCounts[ count ] = range.count;\n\t\t\t\t\t\tindirectArray[ count ] = i;\n\t\t\t\t\t\tcount ++;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tindirectTexture.needsUpdate = true;\n\t\tthis._multiDrawCount = count;\n\t\tthis._visibilityChanged = false;\n\n\t}\n\n\tonBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial/* , group */ ) {\n\n\t\tthis.onBeforeRender( renderer, null, shadowCamera, geometry, depthMaterial );\n\n\t}\n\n}\n\nclass LineBasicMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isLineBasicMaterial = true;\n\n\t\tthis.type = 'LineBasicMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.linewidth = 1;\n\t\tthis.linecap = 'round';\n\t\tthis.linejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.linewidth = source.linewidth;\n\t\tthis.linecap = source.linecap;\n\t\tthis.linejoin = source.linejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _vStart = /*@__PURE__*/ new Vector3();\nconst _vEnd = /*@__PURE__*/ new Vector3();\n\nconst _inverseMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _ray$1 = /*@__PURE__*/ new Ray();\nconst _sphere$1 = /*@__PURE__*/ new Sphere();\n\nconst _intersectPointOnRay = /*@__PURE__*/ new Vector3();\nconst _intersectPointOnSegment = /*@__PURE__*/ new Vector3();\n\nclass Line extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isLine = true;\n\n\t\tthis.type = 'Line';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\t// we assume non-indexed geometry\n\n\t\tif ( geometry.index === null ) {\n\n\t\t\tconst positionAttribute = geometry.attributes.position;\n\t\t\tconst lineDistances = [ 0 ];\n\n\t\t\tfor ( let i = 1, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t_vStart.fromBufferAttribute( positionAttribute, i - 1 );\n\t\t\t\t_vEnd.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\tlineDistances[ i ] = lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i ] += _vStart.distanceTo( _vEnd );\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Line.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$1.copy( geometry.boundingSphere );\n\t\t_sphere$1.applyMatrix4( matrixWorld );\n\t\t_sphere$1.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$1 ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix$1.copy( matrixWorld ).invert();\n\t\t_ray$1.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$1 );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tconst step = this.isLineSegments ? 2 : 1;\n\n\t\tconst index = geometry.index;\n\t\tconst attributes = geometry.attributes;\n\t\tconst positionAttribute = attributes.position;\n\n\t\tif ( index !== null ) {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\tconst a = index.getX( i );\n\t\t\t\tconst b = index.getX( i + 1 );\n\n\t\t\t\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b );\n\n\t\t\t\tif ( intersect ) {\n\n\t\t\t\t\tintersects.push( intersect );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( this.isLineLoop ) {\n\n\t\t\t\tconst a = index.getX( end - 1 );\n\t\t\t\tconst b = index.getX( start );\n\n\t\t\t\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b );\n\n\t\t\t\tif ( intersect ) {\n\n\t\t\t\t\tintersects.push( intersect );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, i, i + 1 );\n\n\t\t\t\tif ( intersect ) {\n\n\t\t\t\t\tintersects.push( intersect );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( this.isLineLoop ) {\n\n\t\t\t\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, end - 1, start );\n\n\t\t\t\tif ( intersect ) {\n\n\t\t\t\t\tintersects.push( intersect );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {\n\n\tconst positionAttribute = object.geometry.attributes.position;\n\n\t_vStart.fromBufferAttribute( positionAttribute, a );\n\t_vEnd.fromBufferAttribute( positionAttribute, b );\n\n\tconst distSq = ray.distanceSqToSegment( _vStart, _vEnd, _intersectPointOnRay, _intersectPointOnSegment );\n\n\tif ( distSq > thresholdSq ) return;\n\n\t_intersectPointOnRay.applyMatrix4( object.matrixWorld ); // Move back to world space for distance calculation\n\n\tconst distance = raycaster.ray.origin.distanceTo( _intersectPointOnRay );\n\n\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\treturn {\n\n\t\tdistance: distance,\n\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t// point: raycaster.ray.at( distance ),\n\t\tpoint: _intersectPointOnSegment.clone().applyMatrix4( object.matrixWorld ),\n\t\tindex: a,\n\t\tface: null,\n\t\tfaceIndex: null,\n\t\tobject: object\n\n\t};\n\n}\n\nconst _start = /*@__PURE__*/ new Vector3();\nconst _end = /*@__PURE__*/ new Vector3();\n\nclass LineSegments extends Line {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isLineSegments = true;\n\n\t\tthis.type = 'LineSegments';\n\n\t}\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\t// we assume non-indexed geometry\n\n\t\tif ( geometry.index === null ) {\n\n\t\t\tconst positionAttribute = geometry.attributes.position;\n\t\t\tconst lineDistances = [];\n\n\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i += 2 ) {\n\n\t\t\t\t_start.fromBufferAttribute( positionAttribute, i );\n\t\t\t\t_end.fromBufferAttribute( positionAttribute, i + 1 );\n\n\t\t\t\tlineDistances[ i ] = ( i === 0 ) ? 0 : lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i + 1 ] = lineDistances[ i ] + _start.distanceTo( _end );\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineLoop extends Line {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isLineLoop = true;\n\n\t\tthis.type = 'LineLoop';\n\n\t}\n\n}\n\nclass PointsMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isPointsMaterial = true;\n\n\t\tthis.type = 'PointsMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.size = 1;\n\t\tthis.sizeAttenuation = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.size = source.size;\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _inverseMatrix = /*@__PURE__*/ new Matrix4();\nconst _ray = /*@__PURE__*/ new Ray();\nconst _sphere = /*@__PURE__*/ new Sphere();\nconst _position$2 = /*@__PURE__*/ new Vector3();\n\nclass Points extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new PointsMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isPoints = true;\n\n\t\tthis.type = 'Points';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Points.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere.copy( geometry.boundingSphere );\n\t\t_sphere.applyMatrix4( matrixWorld );\n\t\t_sphere.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix.copy( matrixWorld ).invert();\n\t\t_ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tconst index = geometry.index;\n\t\tconst attributes = geometry.attributes;\n\t\tconst positionAttribute = attributes.position;\n\n\t\tif ( index !== null ) {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, il = end; i < il; i ++ ) {\n\n\t\t\t\tconst a = index.getX( i );\n\n\t\t\t\t_position$2.fromBufferAttribute( positionAttribute, a );\n\n\t\t\t\ttestPoint( _position$2, a, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end; i < l; i ++ ) {\n\n\t\t\t\t_position$2.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\ttestPoint( _position$2, i, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction testPoint( point, index, localThresholdSq, matrixWorld, raycaster, intersects, object ) {\n\n\tconst rayPointDistanceSq = _ray.distanceSqToPoint( point );\n\n\tif ( rayPointDistanceSq < localThresholdSq ) {\n\n\t\tconst intersectPoint = new Vector3();\n\n\t\t_ray.closestPointToPoint( point, intersectPoint );\n\t\tintersectPoint.applyMatrix4( matrixWorld );\n\n\t\tconst distance = raycaster.ray.origin.distanceTo( intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tdistanceToRay: Math.sqrt( rayPointDistanceSq ),\n\t\t\tpoint: intersectPoint,\n\t\t\tindex: index,\n\t\t\tface: null,\n\t\t\tobject: object\n\n\t\t} );\n\n\t}\n\n}\n\nclass VideoTexture extends Texture {\n\n\tconstructor( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\t\tsuper( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isVideoTexture = true;\n\n\t\tthis.minFilter = minFilter !== undefined ? minFilter : LinearFilter;\n\t\tthis.magFilter = magFilter !== undefined ? magFilter : LinearFilter;\n\n\t\tthis.generateMipmaps = false;\n\n\t\tconst scope = this;\n\n\t\tfunction updateVideo() {\n\n\t\t\tscope.needsUpdate = true;\n\t\t\tvideo.requestVideoFrameCallback( updateVideo );\n\n\t\t}\n\n\t\tif ( 'requestVideoFrameCallback' in video ) {\n\n\t\t\tvideo.requestVideoFrameCallback( updateVideo );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.image ).copy( this );\n\n\t}\n\n\tupdate() {\n\n\t\tconst video = this.image;\n\t\tconst hasVideoFrameCallback = 'requestVideoFrameCallback' in video;\n\n\t\tif ( hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA ) {\n\n\t\t\tthis.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n}\n\nclass FramebufferTexture extends Texture {\n\n\tconstructor( width, height ) {\n\n\t\tsuper( { width, height } );\n\n\t\tthis.isFramebufferTexture = true;\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.generateMipmaps = false;\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\nclass CompressedTexture extends Texture {\n\n\tconstructor( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, colorSpace ) {\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isCompressedTexture = true;\n\n\t\tthis.image = { width: width, height: height };\n\t\tthis.mipmaps = mipmaps;\n\n\t\t// no flipping for cube textures\n\t\t// (also flipping doesn't work for compressed textures )\n\n\t\tthis.flipY = false;\n\n\t\t// can't generate mipmaps for compressed textures\n\t\t// mips must be embedded in DDS files\n\n\t\tthis.generateMipmaps = false;\n\n\t}\n\n}\n\nclass CompressedArrayTexture extends CompressedTexture {\n\n\tconstructor( mipmaps, width, height, depth, format, type ) {\n\n\t\tsuper( mipmaps, width, height, format, type );\n\n\t\tthis.isCompressedArrayTexture = true;\n\t\tthis.image.depth = depth;\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\tthis.layerUpdates = new Set();\n\n\t}\n\n\taddLayerUpdate( layerIndex ) {\n\n\t\tthis.layerUpdates.add( layerIndex );\n\n\t}\n\n\tclearLayerUpdates() {\n\n\t\tthis.layerUpdates.clear();\n\n\t}\n\n}\n\nclass CompressedCubeTexture extends CompressedTexture {\n\n\tconstructor( images, format, type ) {\n\n\t\tsuper( undefined, images[ 0 ].width, images[ 0 ].height, format, type, CubeReflectionMapping );\n\n\t\tthis.isCompressedCubeTexture = true;\n\t\tthis.isCubeTexture = true;\n\n\t\tthis.image = images;\n\n\t}\n\n}\n\nclass CanvasTexture extends Texture {\n\n\tconstructor( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\t\tsuper( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isCanvasTexture = true;\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\n/**\n * Extensible curve object.\n *\n * Some common of curve methods:\n * .getPoint( t, optionalTarget ), .getTangent( t, optionalTarget )\n * .getPointAt( u, optionalTarget ), .getTangentAt( u, optionalTarget )\n * .getPoints(), .getSpacedPoints()\n * .getLength()\n * .updateArcLengths()\n *\n * This following curves inherit from THREE.Curve:\n *\n * -- 2D curves --\n * THREE.ArcCurve\n * THREE.CubicBezierCurve\n * THREE.EllipseCurve\n * THREE.LineCurve\n * THREE.QuadraticBezierCurve\n * THREE.SplineCurve\n *\n * -- 3D curves --\n * THREE.CatmullRomCurve3\n * THREE.CubicBezierCurve3\n * THREE.LineCurve3\n * THREE.QuadraticBezierCurve3\n *\n * A series of curves can be represented as a THREE.CurvePath.\n *\n **/\n\nclass Curve {\n\n\tconstructor() {\n\n\t\tthis.type = 'Curve';\n\n\t\tthis.arcLengthDivisions = 200;\n\n\t}\n\n\t// Virtual base class method to overwrite and implement in subclasses\n\t//\t- t [0 .. 1]\n\n\tgetPoint( /* t, optionalTarget */ ) {\n\n\t\tconsole.warn( 'THREE.Curve: .getPoint() not implemented.' );\n\t\treturn null;\n\n\t}\n\n\t// Get point at relative position in curve according to arc length\n\t// - u [0 .. 1]\n\n\tgetPointAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getPoint( t, optionalTarget );\n\n\t}\n\n\t// Get sequence of points using getPoint( t )\n\n\tgetPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPoint( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t// Get sequence of points using getPointAt( u )\n\n\tgetSpacedPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPointAt( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t// Get total curve arc length\n\n\tgetLength() {\n\n\t\tconst lengths = this.getLengths();\n\t\treturn lengths[ lengths.length - 1 ];\n\n\t}\n\n\t// Get list of cumulative segment lengths\n\n\tgetLengths( divisions = this.arcLengthDivisions ) {\n\n\t\tif ( this.cacheArcLengths &&\n\t\t\t( this.cacheArcLengths.length === divisions + 1 ) &&\n\t\t\t! this.needsUpdate ) {\n\n\t\t\treturn this.cacheArcLengths;\n\n\t\t}\n\n\t\tthis.needsUpdate = false;\n\n\t\tconst cache = [];\n\t\tlet current, last = this.getPoint( 0 );\n\t\tlet sum = 0;\n\n\t\tcache.push( 0 );\n\n\t\tfor ( let p = 1; p <= divisions; p ++ ) {\n\n\t\t\tcurrent = this.getPoint( p / divisions );\n\t\t\tsum += current.distanceTo( last );\n\t\t\tcache.push( sum );\n\t\t\tlast = current;\n\n\t\t}\n\n\t\tthis.cacheArcLengths = cache;\n\n\t\treturn cache; // { sums: cache, sum: sum }; Sum is in the last element.\n\n\t}\n\n\tupdateArcLengths() {\n\n\t\tthis.needsUpdate = true;\n\t\tthis.getLengths();\n\n\t}\n\n\t// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant\n\n\tgetUtoTmapping( u, distance ) {\n\n\t\tconst arcLengths = this.getLengths();\n\n\t\tlet i = 0;\n\t\tconst il = arcLengths.length;\n\n\t\tlet targetArcLength; // The targeted u distance value to get\n\n\t\tif ( distance ) {\n\n\t\t\ttargetArcLength = distance;\n\n\t\t} else {\n\n\t\t\ttargetArcLength = u * arcLengths[ il - 1 ];\n\n\t\t}\n\n\t\t// binary search for the index with largest value smaller than target u distance\n\n\t\tlet low = 0, high = il - 1, comparison;\n\n\t\twhile ( low <= high ) {\n\n\t\t\ti = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats\n\n\t\t\tcomparison = arcLengths[ i ] - targetArcLength;\n\n\t\t\tif ( comparison < 0 ) {\n\n\t\t\t\tlow = i + 1;\n\n\t\t\t} else if ( comparison > 0 ) {\n\n\t\t\t\thigh = i - 1;\n\n\t\t\t} else {\n\n\t\t\t\thigh = i;\n\t\t\t\tbreak;\n\n\t\t\t\t// DONE\n\n\t\t\t}\n\n\t\t}\n\n\t\ti = high;\n\n\t\tif ( arcLengths[ i ] === targetArcLength ) {\n\n\t\t\treturn i / ( il - 1 );\n\n\t\t}\n\n\t\t// we could get finer grain at lengths, or use simple interpolation between two points\n\n\t\tconst lengthBefore = arcLengths[ i ];\n\t\tconst lengthAfter = arcLengths[ i + 1 ];\n\n\t\tconst segmentLength = lengthAfter - lengthBefore;\n\n\t\t// determine where we are between the 'before' and 'after' points\n\n\t\tconst segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength;\n\n\t\t// add that fractional amount to t\n\n\t\tconst t = ( i + segmentFraction ) / ( il - 1 );\n\n\t\treturn t;\n\n\t}\n\n\t// Returns a unit vector tangent at t\n\t// In case any sub curve does not implement its tangent derivation,\n\t// 2 points a small delta apart will be used to find its gradient\n\t// which seems to give a reasonable approximation\n\n\tgetTangent( t, optionalTarget ) {\n\n\t\tconst delta = 0.0001;\n\t\tlet t1 = t - delta;\n\t\tlet t2 = t + delta;\n\n\t\t// Capping in case of danger\n\n\t\tif ( t1 < 0 ) t1 = 0;\n\t\tif ( t2 > 1 ) t2 = 1;\n\n\t\tconst pt1 = this.getPoint( t1 );\n\t\tconst pt2 = this.getPoint( t2 );\n\n\t\tconst tangent = optionalTarget || ( ( pt1.isVector2 ) ? new Vector2() : new Vector3() );\n\n\t\ttangent.copy( pt2 ).sub( pt1 ).normalize();\n\n\t\treturn tangent;\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getTangent( t, optionalTarget );\n\n\t}\n\n\tcomputeFrenetFrames( segments, closed ) {\n\n\t\t// see http://www.cs.indiana.edu/pub/techreports/TR425.pdf\n\n\t\tconst normal = new Vector3();\n\n\t\tconst tangents = [];\n\t\tconst normals = [];\n\t\tconst binormals = [];\n\n\t\tconst vec = new Vector3();\n\t\tconst mat = new Matrix4();\n\n\t\t// compute the tangent vectors for each segment on the curve\n\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\n\n\t\t\tconst u = i / segments;\n\n\t\t\ttangents[ i ] = this.getTangentAt( u, new Vector3() );\n\n\t\t}\n\n\t\t// select an initial normal vector perpendicular to the first tangent vector,\n\t\t// and in the direction of the minimum tangent xyz component\n\n\t\tnormals[ 0 ] = new Vector3();\n\t\tbinormals[ 0 ] = new Vector3();\n\t\tlet min = Number.MAX_VALUE;\n\t\tconst tx = Math.abs( tangents[ 0 ].x );\n\t\tconst ty = Math.abs( tangents[ 0 ].y );\n\t\tconst tz = Math.abs( tangents[ 0 ].z );\n\n\t\tif ( tx <= min ) {\n\n\t\t\tmin = tx;\n\t\t\tnormal.set( 1, 0, 0 );\n\n\t\t}\n\n\t\tif ( ty <= min ) {\n\n\t\t\tmin = ty;\n\t\t\tnormal.set( 0, 1, 0 );\n\n\t\t}\n\n\t\tif ( tz <= min ) {\n\n\t\t\tnormal.set( 0, 0, 1 );\n\n\t\t}\n\n\t\tvec.crossVectors( tangents[ 0 ], normal ).normalize();\n\n\t\tnormals[ 0 ].crossVectors( tangents[ 0 ], vec );\n\t\tbinormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] );\n\n\n\t\t// compute the slowly-varying normal and binormal vectors for each segment on the curve\n\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\tnormals[ i ] = normals[ i - 1 ].clone();\n\n\t\t\tbinormals[ i ] = binormals[ i - 1 ].clone();\n\n\t\t\tvec.crossVectors( tangents[ i - 1 ], tangents[ i ] );\n\n\t\t\tif ( vec.length() > Number.EPSILON ) {\n\n\t\t\t\tvec.normalize();\n\n\t\t\t\tconst theta = Math.acos( clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors\n\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );\n\n\t\t\t}\n\n\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t}\n\n\t\t// if the curve is closed, postprocess the vectors so the first and last normal vectors are the same\n\n\t\tif ( closed === true ) {\n\n\t\t\tlet theta = Math.acos( clamp( normals[ 0 ].dot( normals[ segments ] ), - 1, 1 ) );\n\t\t\ttheta /= segments;\n\n\t\t\tif ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ segments ] ) ) > 0 ) {\n\n\t\t\t\ttheta = - theta;\n\n\t\t\t}\n\n\t\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\t\t// twist a little...\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) );\n\t\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn {\n\t\t\ttangents: tangents,\n\t\t\tnormals: normals,\n\t\t\tbinormals: binormals\n\t\t};\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.arcLengthDivisions = source.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Curve',\n\t\t\t\tgenerator: 'Curve.toJSON'\n\t\t\t}\n\t\t};\n\n\t\tdata.arcLengthDivisions = this.arcLengthDivisions;\n\t\tdata.type = this.type;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tthis.arcLengthDivisions = json.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass EllipseCurve extends Curve {\n\n\tconstructor( aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0 ) {\n\n\t\tsuper();\n\n\t\tthis.isEllipseCurve = true;\n\n\t\tthis.type = 'EllipseCurve';\n\n\t\tthis.aX = aX;\n\t\tthis.aY = aY;\n\n\t\tthis.xRadius = xRadius;\n\t\tthis.yRadius = yRadius;\n\n\t\tthis.aStartAngle = aStartAngle;\n\t\tthis.aEndAngle = aEndAngle;\n\n\t\tthis.aClockwise = aClockwise;\n\n\t\tthis.aRotation = aRotation;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst twoPi = Math.PI * 2;\n\t\tlet deltaAngle = this.aEndAngle - this.aStartAngle;\n\t\tconst samePoints = Math.abs( deltaAngle ) < Number.EPSILON;\n\n\t\t// ensures that deltaAngle is 0 .. 2 PI\n\t\twhile ( deltaAngle < 0 ) deltaAngle += twoPi;\n\t\twhile ( deltaAngle > twoPi ) deltaAngle -= twoPi;\n\n\t\tif ( deltaAngle < Number.EPSILON ) {\n\n\t\t\tif ( samePoints ) {\n\n\t\t\t\tdeltaAngle = 0;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.aClockwise === true && ! samePoints ) {\n\n\t\t\tif ( deltaAngle === twoPi ) {\n\n\t\t\t\tdeltaAngle = - twoPi;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = deltaAngle - twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst angle = this.aStartAngle + t * deltaAngle;\n\t\tlet x = this.aX + this.xRadius * Math.cos( angle );\n\t\tlet y = this.aY + this.yRadius * Math.sin( angle );\n\n\t\tif ( this.aRotation !== 0 ) {\n\n\t\t\tconst cos = Math.cos( this.aRotation );\n\t\t\tconst sin = Math.sin( this.aRotation );\n\n\t\t\tconst tx = x - this.aX;\n\t\t\tconst ty = y - this.aY;\n\n\t\t\t// Rotate the point about the center of the ellipse.\n\t\t\tx = tx * cos - ty * sin + this.aX;\n\t\t\ty = tx * sin + ty * cos + this.aY;\n\n\t\t}\n\n\t\treturn point.set( x, y );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.aX = source.aX;\n\t\tthis.aY = source.aY;\n\n\t\tthis.xRadius = source.xRadius;\n\t\tthis.yRadius = source.yRadius;\n\n\t\tthis.aStartAngle = source.aStartAngle;\n\t\tthis.aEndAngle = source.aEndAngle;\n\n\t\tthis.aClockwise = source.aClockwise;\n\n\t\tthis.aRotation = source.aRotation;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.aX = this.aX;\n\t\tdata.aY = this.aY;\n\n\t\tdata.xRadius = this.xRadius;\n\t\tdata.yRadius = this.yRadius;\n\n\t\tdata.aStartAngle = this.aStartAngle;\n\t\tdata.aEndAngle = this.aEndAngle;\n\n\t\tdata.aClockwise = this.aClockwise;\n\n\t\tdata.aRotation = this.aRotation;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.aX = json.aX;\n\t\tthis.aY = json.aY;\n\n\t\tthis.xRadius = json.xRadius;\n\t\tthis.yRadius = json.yRadius;\n\n\t\tthis.aStartAngle = json.aStartAngle;\n\t\tthis.aEndAngle = json.aEndAngle;\n\n\t\tthis.aClockwise = json.aClockwise;\n\n\t\tthis.aRotation = json.aRotation;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass ArcCurve extends EllipseCurve {\n\n\tconstructor( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tsuper( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\tthis.isArcCurve = true;\n\n\t\tthis.type = 'ArcCurve';\n\n\t}\n\n}\n\n/**\n * Centripetal CatmullRom Curve - which is useful for avoiding\n * cusps and self-intersections in non-uniform catmull rom curves.\n * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf\n *\n * curve.type accepts centripetal(default), chordal and catmullrom\n * curve.tension is used for catmullrom which defaults to 0.5\n */\n\n\n/*\nBased on an optimized c++ solution in\n - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/\n - http://ideone.com/NoEbVM\n\nThis CubicPoly class could be used for reusing some variables and calculations,\nbut for three.js curve use, it could be possible inlined and flatten into a single function call\nwhich can be placed in CurveUtils.\n*/\n\nfunction CubicPoly() {\n\n\tlet c0 = 0, c1 = 0, c2 = 0, c3 = 0;\n\n\t/*\n\t * Compute coefficients for a cubic polynomial\n\t * p(s) = c0 + c1*s + c2*s^2 + c3*s^3\n\t * such that\n\t * p(0) = x0, p(1) = x1\n\t * and\n\t * p'(0) = t0, p'(1) = t1.\n\t */\n\tfunction init( x0, x1, t0, t1 ) {\n\n\t\tc0 = x0;\n\t\tc1 = t0;\n\t\tc2 = - 3 * x0 + 3 * x1 - 2 * t0 - t1;\n\t\tc3 = 2 * x0 - 2 * x1 + t0 + t1;\n\n\t}\n\n\treturn {\n\n\t\tinitCatmullRom: function ( x0, x1, x2, x3, tension ) {\n\n\t\t\tinit( x1, x2, tension * ( x2 - x0 ), tension * ( x3 - x1 ) );\n\n\t\t},\n\n\t\tinitNonuniformCatmullRom: function ( x0, x1, x2, x3, dt0, dt1, dt2 ) {\n\n\t\t\t// compute tangents when parameterized in [t1,t2]\n\t\t\tlet t1 = ( x1 - x0 ) / dt0 - ( x2 - x0 ) / ( dt0 + dt1 ) + ( x2 - x1 ) / dt1;\n\t\t\tlet t2 = ( x2 - x1 ) / dt1 - ( x3 - x1 ) / ( dt1 + dt2 ) + ( x3 - x2 ) / dt2;\n\n\t\t\t// rescale tangents for parametrization in [0,1]\n\t\t\tt1 *= dt1;\n\t\t\tt2 *= dt1;\n\n\t\t\tinit( x1, x2, t1, t2 );\n\n\t\t},\n\n\t\tcalc: function ( t ) {\n\n\t\t\tconst t2 = t * t;\n\t\t\tconst t3 = t2 * t;\n\t\t\treturn c0 + c1 * t + c2 * t2 + c3 * t3;\n\n\t\t}\n\n\t};\n\n}\n\n//\n\nconst tmp = /*@__PURE__*/ new Vector3();\nconst px = /*@__PURE__*/ new CubicPoly();\nconst py = /*@__PURE__*/ new CubicPoly();\nconst pz = /*@__PURE__*/ new CubicPoly();\n\nclass CatmullRomCurve3 extends Curve {\n\n\tconstructor( points = [], closed = false, curveType = 'centripetal', tension = 0.5 ) {\n\n\t\tsuper();\n\n\t\tthis.isCatmullRomCurve3 = true;\n\n\t\tthis.type = 'CatmullRomCurve3';\n\n\t\tthis.points = points;\n\t\tthis.closed = closed;\n\t\tthis.curveType = curveType;\n\t\tthis.tension = tension;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst l = points.length;\n\n\t\tconst p = ( l - ( this.closed ? 0 : 1 ) ) * t;\n\t\tlet intPoint = Math.floor( p );\n\t\tlet weight = p - intPoint;\n\n\t\tif ( this.closed ) {\n\n\t\t\tintPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / l ) + 1 ) * l;\n\n\t\t} else if ( weight === 0 && intPoint === l - 1 ) {\n\n\t\t\tintPoint = l - 2;\n\t\t\tweight = 1;\n\n\t\t}\n\n\t\tlet p0, p3; // 4 points (p1 & p2 defined below)\n\n\t\tif ( this.closed || intPoint > 0 ) {\n\n\t\t\tp0 = points[ ( intPoint - 1 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate first point\n\t\t\ttmp.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] );\n\t\t\tp0 = tmp;\n\n\t\t}\n\n\t\tconst p1 = points[ intPoint % l ];\n\t\tconst p2 = points[ ( intPoint + 1 ) % l ];\n\n\t\tif ( this.closed || intPoint + 2 < l ) {\n\n\t\t\tp3 = points[ ( intPoint + 2 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate last point\n\t\t\ttmp.subVectors( points[ l - 1 ], points[ l - 2 ] ).add( points[ l - 1 ] );\n\t\t\tp3 = tmp;\n\n\t\t}\n\n\t\tif ( this.curveType === 'centripetal' || this.curveType === 'chordal' ) {\n\n\t\t\t// init Centripetal / Chordal Catmull-Rom\n\t\t\tconst pow = this.curveType === 'chordal' ? 0.5 : 0.25;\n\t\t\tlet dt0 = Math.pow( p0.distanceToSquared( p1 ), pow );\n\t\t\tlet dt1 = Math.pow( p1.distanceToSquared( p2 ), pow );\n\t\t\tlet dt2 = Math.pow( p2.distanceToSquared( p3 ), pow );\n\n\t\t\t// safety check for repeated points\n\t\t\tif ( dt1 < 1e-4 ) dt1 = 1.0;\n\t\t\tif ( dt0 < 1e-4 ) dt0 = dt1;\n\t\t\tif ( dt2 < 1e-4 ) dt2 = dt1;\n\n\t\t\tpx.initNonuniformCatmullRom( p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2 );\n\t\t\tpy.initNonuniformCatmullRom( p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2 );\n\t\t\tpz.initNonuniformCatmullRom( p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2 );\n\n\t\t} else if ( this.curveType === 'catmullrom' ) {\n\n\t\t\tpx.initCatmullRom( p0.x, p1.x, p2.x, p3.x, this.tension );\n\t\t\tpy.initCatmullRom( p0.y, p1.y, p2.y, p3.y, this.tension );\n\t\t\tpz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, this.tension );\n\n\t\t}\n\n\t\tpoint.set(\n\t\t\tpx.calc( weight ),\n\t\t\tpy.calc( weight ),\n\t\t\tpz.calc( weight )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\tthis.closed = source.closed;\n\t\tthis.curveType = source.curveType;\n\t\tthis.tension = source.tension;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\tdata.closed = this.closed;\n\t\tdata.curveType = this.curveType;\n\t\tdata.tension = this.tension;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector3().fromArray( point ) );\n\n\t\t}\n\n\t\tthis.closed = json.closed;\n\t\tthis.curveType = json.curveType;\n\t\tthis.tension = json.tension;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Bezier Curves formulas obtained from\n * https://en.wikipedia.org/wiki/B%C3%A9zier_curve\n */\n\nfunction CatmullRom( t, p0, p1, p2, p3 ) {\n\n\tconst v0 = ( p2 - p0 ) * 0.5;\n\tconst v1 = ( p3 - p1 ) * 0.5;\n\tconst t2 = t * t;\n\tconst t3 = t * t2;\n\treturn ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;\n\n}\n\n//\n\nfunction QuadraticBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * p;\n\n}\n\nfunction QuadraticBezierP1( t, p ) {\n\n\treturn 2 * ( 1 - t ) * t * p;\n\n}\n\nfunction QuadraticBezierP2( t, p ) {\n\n\treturn t * t * p;\n\n}\n\nfunction QuadraticBezier( t, p0, p1, p2 ) {\n\n\treturn QuadraticBezierP0( t, p0 ) + QuadraticBezierP1( t, p1 ) +\n\t\tQuadraticBezierP2( t, p2 );\n\n}\n\n//\n\nfunction CubicBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * k * p;\n\n}\n\nfunction CubicBezierP1( t, p ) {\n\n\tconst k = 1 - t;\n\treturn 3 * k * k * t * p;\n\n}\n\nfunction CubicBezierP2( t, p ) {\n\n\treturn 3 * ( 1 - t ) * t * t * p;\n\n}\n\nfunction CubicBezierP3( t, p ) {\n\n\treturn t * t * t * p;\n\n}\n\nfunction CubicBezier( t, p0, p1, p2, p3 ) {\n\n\treturn CubicBezierP0( t, p0 ) + CubicBezierP1( t, p1 ) + CubicBezierP2( t, p2 ) +\n\t\tCubicBezierP3( t, p3 );\n\n}\n\nclass CubicBezierCurve extends Curve {\n\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2(), v3 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isCubicBezierCurve = true;\n\n\t\tthis.type = 'CubicBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass CubicBezierCurve3 extends Curve {\n\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3(), v3 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isCubicBezierCurve3 = true;\n\n\t\tthis.type = 'CubicBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y ),\n\t\t\tCubicBezier( t, v0.z, v1.z, v2.z, v3.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineCurve extends Curve {\n\n\tconstructor( v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isLineCurve = true;\n\n\t\tthis.type = 'LineCurve';\n\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\n\tgetTangent( t, optionalTarget = new Vector2() ) {\n\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\treturn this.getTangent( u, optionalTarget );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineCurve3 extends Curve {\n\n\tconstructor( v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isLineCurve3 = true;\n\n\t\tthis.type = 'LineCurve3';\n\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\n\tgetTangent( t, optionalTarget = new Vector3() ) {\n\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\treturn this.getTangent( u, optionalTarget );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass QuadraticBezierCurve extends Curve {\n\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isQuadraticBezierCurve = true;\n\n\t\tthis.type = 'QuadraticBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass QuadraticBezierCurve3 extends Curve {\n\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isQuadraticBezierCurve3 = true;\n\n\t\tthis.type = 'QuadraticBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y ),\n\t\t\tQuadraticBezier( t, v0.z, v1.z, v2.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass SplineCurve extends Curve {\n\n\tconstructor( points = [] ) {\n\n\t\tsuper();\n\n\t\tthis.isSplineCurve = true;\n\n\t\tthis.type = 'SplineCurve';\n\n\t\tthis.points = points;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst p = ( points.length - 1 ) * t;\n\n\t\tconst intPoint = Math.floor( p );\n\t\tconst weight = p - intPoint;\n\n\t\tconst p0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ];\n\t\tconst p1 = points[ intPoint ];\n\t\tconst p2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];\n\t\tconst p3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];\n\n\t\tpoint.set(\n\t\t\tCatmullRom( weight, p0.x, p1.x, p2.x, p3.x ),\n\t\t\tCatmullRom( weight, p0.y, p1.y, p2.y, p3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector2().fromArray( point ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nvar Curves = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tArcCurve: ArcCurve,\n\tCatmullRomCurve3: CatmullRomCurve3,\n\tCubicBezierCurve: CubicBezierCurve,\n\tCubicBezierCurve3: CubicBezierCurve3,\n\tEllipseCurve: EllipseCurve,\n\tLineCurve: LineCurve,\n\tLineCurve3: LineCurve3,\n\tQuadraticBezierCurve: QuadraticBezierCurve,\n\tQuadraticBezierCurve3: QuadraticBezierCurve3,\n\tSplineCurve: SplineCurve\n});\n\n/**************************************************************\n *\tCurved Path - a curve path is simply a array of connected\n * curves, but retains the api of a curve\n **************************************************************/\n\nclass CurvePath extends Curve {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'CurvePath';\n\n\t\tthis.curves = [];\n\t\tthis.autoClose = false; // Automatically closes the path\n\n\t}\n\n\tadd( curve ) {\n\n\t\tthis.curves.push( curve );\n\n\t}\n\n\tclosePath() {\n\n\t\t// Add a line curve if start and end of lines are not connected\n\t\tconst startPoint = this.curves[ 0 ].getPoint( 0 );\n\t\tconst endPoint = this.curves[ this.curves.length - 1 ].getPoint( 1 );\n\n\t\tif ( ! startPoint.equals( endPoint ) ) {\n\n\t\t\tconst lineType = ( startPoint.isVector2 === true ) ? 'LineCurve' : 'LineCurve3';\n\t\t\tthis.curves.push( new Curves[ lineType ]( endPoint, startPoint ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// To get accurate point with reference to\n\t// entire path distance at time t,\n\t// following has to be done:\n\n\t// 1. Length of each sub path have to be known\n\t// 2. Locate and identify type of curve\n\t// 3. Get t for the curve\n\t// 4. Return curve.getPointAt(t')\n\n\tgetPoint( t, optionalTarget ) {\n\n\t\tconst d = t * this.getLength();\n\t\tconst curveLengths = this.getCurveLengths();\n\t\tlet i = 0;\n\n\t\t// To think about boundaries points.\n\n\t\twhile ( i < curveLengths.length ) {\n\n\t\t\tif ( curveLengths[ i ] >= d ) {\n\n\t\t\t\tconst diff = curveLengths[ i ] - d;\n\t\t\t\tconst curve = this.curves[ i ];\n\n\t\t\t\tconst segmentLength = curve.getLength();\n\t\t\t\tconst u = segmentLength === 0 ? 0 : 1 - diff / segmentLength;\n\n\t\t\t\treturn curve.getPointAt( u, optionalTarget );\n\n\t\t\t}\n\n\t\t\ti ++;\n\n\t\t}\n\n\t\treturn null;\n\n\t\t// loop where sum != 0, sum > d , sum+1 1 && ! points[ points.length - 1 ].equals( points[ 0 ] ) ) {\n\n\t\t\tpoints.push( points[ 0 ] );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = source.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = source.curves[ i ];\n\n\t\t\tthis.curves.push( curve.clone() );\n\n\t\t}\n\n\t\tthis.autoClose = source.autoClose;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.autoClose = this.autoClose;\n\t\tdata.curves = [];\n\n\t\tfor ( let i = 0, l = this.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = this.curves[ i ];\n\t\t\tdata.curves.push( curve.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.autoClose = json.autoClose;\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = json.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = json.curves[ i ];\n\t\t\tthis.curves.push( new Curves[ curve.type ]().fromJSON( curve ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Path extends CurvePath {\n\n\tconstructor( points ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Path';\n\n\t\tthis.currentPoint = new Vector2();\n\n\t\tif ( points ) {\n\n\t\t\tthis.setFromPoints( points );\n\n\t\t}\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.moveTo( points[ 0 ].x, points[ 0 ].y );\n\n\t\tfor ( let i = 1, l = points.length; i < l; i ++ ) {\n\n\t\t\tthis.lineTo( points[ i ].x, points[ i ].y );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPoint.set( x, y ); // TODO consider referencing vectors instead of copying?\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tconst curve = new LineCurve( this.currentPoint.clone(), new Vector2( x, y ) );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tconst curve = new QuadraticBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCPx, aCPy ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tconst curve = new CubicBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCP1x, aCP1y ),\n\t\t\tnew Vector2( aCP2x, aCP2y ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts /*Array of Vector*/ ) {\n\n\t\tconst npts = [ this.currentPoint.clone() ].concat( pts );\n\n\t\tconst curve = new SplineCurve( npts );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.copy( pts[ pts.length - 1 ] );\n\n\t\treturn this;\n\n\t}\n\n\tarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absarc( aX + x0, aY + y0, aRadius,\n\t\t\taStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tabsarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tthis.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absellipse( aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\treturn this;\n\n\t}\n\n\tabsellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst curve = new EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\tif ( this.curves.length > 0 ) {\n\n\t\t\t// if a previous curve is present, attempt to join\n\t\t\tconst firstPoint = curve.getPoint( 0 );\n\n\t\t\tif ( ! firstPoint.equals( this.currentPoint ) ) {\n\n\t\t\t\tthis.lineTo( firstPoint.x, firstPoint.y );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.curves.push( curve );\n\n\t\tconst lastPoint = curve.getPoint( 1 );\n\t\tthis.currentPoint.copy( lastPoint );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.currentPoint.copy( source.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.currentPoint = this.currentPoint.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.currentPoint.fromArray( json.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LatheGeometry extends BufferGeometry {\n\n\tconstructor( points = [ new Vector2( 0, - 0.5 ), new Vector2( 0.5, 0 ), new Vector2( 0, 0.5 ) ], segments = 12, phiStart = 0, phiLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'LatheGeometry';\n\n\t\tthis.parameters = {\n\t\t\tpoints: points,\n\t\t\tsegments: segments,\n\t\t\tphiStart: phiStart,\n\t\t\tphiLength: phiLength\n\t\t};\n\n\t\tsegments = Math.floor( segments );\n\n\t\t// clamp phiLength so it's in range of [ 0, 2PI ]\n\n\t\tphiLength = clamp( phiLength, 0, Math.PI * 2 );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst uvs = [];\n\t\tconst initNormals = [];\n\t\tconst normals = [];\n\n\t\t// helper variables\n\n\t\tconst inverseSegments = 1.0 / segments;\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\t\tconst normal = new Vector3();\n\t\tconst curNormal = new Vector3();\n\t\tconst prevNormal = new Vector3();\n\t\tlet dx = 0;\n\t\tlet dy = 0;\n\n\t\t// pre-compute normals for initial \"meridian\"\n\n\t\tfor ( let j = 0; j <= ( points.length - 1 ); j ++ ) {\n\n\t\t\tswitch ( j ) {\n\n\t\t\t\tcase 0:\t\t\t\t// special handling for 1st vertex on path\n\n\t\t\t\t\tdx = points[ j + 1 ].x - points[ j ].x;\n\t\t\t\t\tdy = points[ j + 1 ].y - points[ j ].y;\n\n\t\t\t\t\tnormal.x = dy * 1.0;\n\t\t\t\t\tnormal.y = - dx;\n\t\t\t\t\tnormal.z = dy * 0.0;\n\n\t\t\t\t\tprevNormal.copy( normal );\n\n\t\t\t\t\tnormal.normalize();\n\n\t\t\t\t\tinitNormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ( points.length - 1 ):\t// special handling for last Vertex on path\n\n\t\t\t\t\tinitNormals.push( prevNormal.x, prevNormal.y, prevNormal.z );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\t\t\t// default handling for all vertices in between\n\n\t\t\t\t\tdx = points[ j + 1 ].x - points[ j ].x;\n\t\t\t\t\tdy = points[ j + 1 ].y - points[ j ].y;\n\n\t\t\t\t\tnormal.x = dy * 1.0;\n\t\t\t\t\tnormal.y = - dx;\n\t\t\t\t\tnormal.z = dy * 0.0;\n\n\t\t\t\t\tcurNormal.copy( normal );\n\n\t\t\t\t\tnormal.x += prevNormal.x;\n\t\t\t\t\tnormal.y += prevNormal.y;\n\t\t\t\t\tnormal.z += prevNormal.z;\n\n\t\t\t\t\tnormal.normalize();\n\n\t\t\t\t\tinitNormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\tprevNormal.copy( curNormal );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate vertices, uvs and normals\n\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\n\n\t\t\tconst phi = phiStart + i * inverseSegments * phiLength;\n\n\t\t\tconst sin = Math.sin( phi );\n\t\t\tconst cos = Math.cos( phi );\n\n\t\t\tfor ( let j = 0; j <= ( points.length - 1 ); j ++ ) {\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = points[ j ].x * sin;\n\t\t\t\tvertex.y = points[ j ].y;\n\t\t\t\tvertex.z = points[ j ].x * cos;\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = i / segments;\n\t\t\t\tuv.y = j / ( points.length - 1 );\n\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t// normal\n\n\t\t\t\tconst x = initNormals[ 3 * j + 0 ] * sin;\n\t\t\t\tconst y = initNormals[ 3 * j + 1 ];\n\t\t\t\tconst z = initNormals[ 3 * j + 0 ] * cos;\n\n\t\t\t\tnormals.push( x, y, z );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let i = 0; i < segments; i ++ ) {\n\n\t\t\tfor ( let j = 0; j < ( points.length - 1 ); j ++ ) {\n\n\t\t\t\tconst base = j + i * points.length;\n\n\t\t\t\tconst a = base;\n\t\t\t\tconst b = base + points.length;\n\t\t\t\tconst c = base + points.length + 1;\n\t\t\t\tconst d = base + 1;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( c, d, b );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new LatheGeometry( data.points, data.segments, data.phiStart, data.phiLength );\n\n\t}\n\n}\n\nclass CapsuleGeometry extends LatheGeometry {\n\n\tconstructor( radius = 1, length = 1, capSegments = 4, radialSegments = 8 ) {\n\n\t\tconst path = new Path();\n\t\tpath.absarc( 0, - length / 2, radius, Math.PI * 1.5, 0 );\n\t\tpath.absarc( 0, length / 2, radius, 0, Math.PI * 0.5 );\n\n\t\tsuper( path.getPoints( capSegments ), radialSegments );\n\n\t\tthis.type = 'CapsuleGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tlength: length,\n\t\t\tcapSegments: capSegments,\n\t\t\tradialSegments: radialSegments,\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CapsuleGeometry( data.radius, data.length, data.capSegments, data.radialSegments );\n\n\t}\n\n}\n\nclass CircleGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, segments = 32, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CircleGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tsegments: segments,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tsegments = Math.max( 3, segments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\n\t\t// center point\n\n\t\tvertices.push( 0, 0, 0 );\n\t\tnormals.push( 0, 0, 1 );\n\t\tuvs.push( 0.5, 0.5 );\n\n\t\tfor ( let s = 0, i = 3; s <= segments; s ++, i += 3 ) {\n\n\t\t\tconst segment = thetaStart + s / segments * thetaLength;\n\n\t\t\t// vertex\n\n\t\t\tvertex.x = radius * Math.cos( segment );\n\t\t\tvertex.y = radius * Math.sin( segment );\n\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t// normal\n\n\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t// uvs\n\n\t\t\tuv.x = ( vertices[ i ] / radius + 1 ) / 2;\n\t\t\tuv.y = ( vertices[ i + 1 ] / radius + 1 ) / 2;\n\n\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\tindices.push( i, i + 1, 0 );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CircleGeometry( data.radius, data.segments, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass CylinderGeometry extends BufferGeometry {\n\n\tconstructor( radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CylinderGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradiusTop: radiusTop,\n\t\t\tradiusBottom: radiusBottom,\n\t\t\theight: height,\n\t\t\tradialSegments: radialSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\topenEnded: openEnded,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tconst scope = this;\n\n\t\tradialSegments = Math.floor( radialSegments );\n\t\theightSegments = Math.floor( heightSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet index = 0;\n\t\tconst indexArray = [];\n\t\tconst halfHeight = height / 2;\n\t\tlet groupStart = 0;\n\n\t\t// generate geometry\n\n\t\tgenerateTorso();\n\n\t\tif ( openEnded === false ) {\n\n\t\t\tif ( radiusTop > 0 ) generateCap( true );\n\t\t\tif ( radiusBottom > 0 ) generateCap( false );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction generateTorso() {\n\n\t\t\tconst normal = new Vector3();\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tlet groupCount = 0;\n\n\t\t\t// this will be used to calculate the normal\n\t\t\tconst slope = ( radiusBottom - radiusTop ) / height;\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( let y = 0; y <= heightSegments; y ++ ) {\n\n\t\t\t\tconst indexRow = [];\n\n\t\t\t\tconst v = y / heightSegments;\n\n\t\t\t\t// calculate the radius of the current row\n\n\t\t\t\tconst radius = v * ( radiusBottom - radiusTop ) + radiusTop;\n\n\t\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\t\t\tconst u = x / radialSegments;\n\n\t\t\t\t\tconst theta = u * thetaLength + thetaStart;\n\n\t\t\t\t\tconst sinTheta = Math.sin( theta );\n\t\t\t\t\tconst cosTheta = Math.cos( theta );\n\n\t\t\t\t\t// vertex\n\n\t\t\t\t\tvertex.x = radius * sinTheta;\n\t\t\t\t\tvertex.y = - v * height + halfHeight;\n\t\t\t\t\tvertex.z = radius * cosTheta;\n\t\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t\t// normal\n\n\t\t\t\t\tnormal.set( sinTheta, slope, cosTheta ).normalize();\n\t\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\t// uv\n\n\t\t\t\t\tuvs.push( u, 1 - v );\n\n\t\t\t\t\t// save index of vertex in respective row\n\n\t\t\t\t\tindexRow.push( index ++ );\n\n\t\t\t\t}\n\n\t\t\t\t// now save vertices of the row in our index array\n\n\t\t\t\tindexArray.push( indexRow );\n\n\t\t\t}\n\n\t\t\t// generate indices\n\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\n\n\t\t\t\tfor ( let y = 0; y < heightSegments; y ++ ) {\n\n\t\t\t\t\t// we use the index array to access the correct indices\n\n\t\t\t\t\tconst a = indexArray[ y ][ x ];\n\t\t\t\t\tconst b = indexArray[ y + 1 ][ x ];\n\t\t\t\t\tconst c = indexArray[ y + 1 ][ x + 1 ];\n\t\t\t\t\tconst d = indexArray[ y ][ x + 1 ];\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t\t// update group counter\n\n\t\t\t\t\tgroupCount += 6;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, 0 );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t}\n\n\t\tfunction generateCap( top ) {\n\n\t\t\t// save the index of the first center vertex\n\t\t\tconst centerIndexStart = index;\n\n\t\t\tconst uv = new Vector2();\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tlet groupCount = 0;\n\n\t\t\tconst radius = ( top === true ) ? radiusTop : radiusBottom;\n\t\t\tconst sign = ( top === true ) ? 1 : - 1;\n\n\t\t\t// first we generate the center vertex data of the cap.\n\t\t\t// because the geometry needs one set of uvs per face,\n\t\t\t// we must generate a center vertex per face/segment\n\n\t\t\tfor ( let x = 1; x <= radialSegments; x ++ ) {\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertices.push( 0, halfHeight * sign, 0 );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( 0.5, 0.5 );\n\n\t\t\t\t// increase index\n\n\t\t\t\tindex ++;\n\n\t\t\t}\n\n\t\t\t// save the index of the last center vertex\n\t\t\tconst centerIndexEnd = index;\n\n\t\t\t// now we generate the surrounding vertices, normals and uvs\n\n\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\t\tconst u = x / radialSegments;\n\t\t\t\tconst theta = u * thetaLength + thetaStart;\n\n\t\t\t\tconst cosTheta = Math.cos( theta );\n\t\t\t\tconst sinTheta = Math.sin( theta );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = radius * sinTheta;\n\t\t\t\tvertex.y = halfHeight * sign;\n\t\t\t\tvertex.z = radius * cosTheta;\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = ( cosTheta * 0.5 ) + 0.5;\n\t\t\t\tuv.y = ( sinTheta * 0.5 * sign ) + 0.5;\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t// increase index\n\n\t\t\t\tindex ++;\n\n\t\t\t}\n\n\t\t\t// generate indices\n\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\n\n\t\t\t\tconst c = centerIndexStart + x;\n\t\t\t\tconst i = centerIndexEnd + x;\n\n\t\t\t\tif ( top === true ) {\n\n\t\t\t\t\t// face top\n\n\t\t\t\t\tindices.push( i, i + 1, c );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// face bottom\n\n\t\t\t\t\tindices.push( i + 1, i, c );\n\n\t\t\t\t}\n\n\t\t\t\tgroupCount += 3;\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, top === true ? 1 : 2 );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CylinderGeometry( data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass ConeGeometry extends CylinderGeometry {\n\n\tconstructor( radius = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper( 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength );\n\n\t\tthis.type = 'ConeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\theight: height,\n\t\t\tradialSegments: radialSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\topenEnded: openEnded,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new ConeGeometry( data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass PolyhedronGeometry extends BufferGeometry {\n\n\tconstructor( vertices = [], indices = [], radius = 1, detail = 0 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PolyhedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tvertices: vertices,\n\t\t\tindices: indices,\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t\t// default buffer data\n\n\t\tconst vertexBuffer = [];\n\t\tconst uvBuffer = [];\n\n\t\t// the subdivision creates the vertex buffer data\n\n\t\tsubdivide( detail );\n\n\t\t// all vertices should lie on a conceptual sphere with a given radius\n\n\t\tapplyRadius( radius );\n\n\t\t// finally, create the uv data\n\n\t\tgenerateUVs();\n\n\t\t// build non-indexed geometry\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertexBuffer, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( vertexBuffer.slice(), 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvBuffer, 2 ) );\n\n\t\tif ( detail === 0 ) {\n\n\t\t\tthis.computeVertexNormals(); // flat normals\n\n\t\t} else {\n\n\t\t\tthis.normalizeNormals(); // smooth normals\n\n\t\t}\n\n\t\t// helper functions\n\n\t\tfunction subdivide( detail ) {\n\n\t\t\tconst a = new Vector3();\n\t\t\tconst b = new Vector3();\n\t\t\tconst c = new Vector3();\n\n\t\t\t// iterate over all faces and apply a subdivision with the given detail value\n\n\t\t\tfor ( let i = 0; i < indices.length; i += 3 ) {\n\n\t\t\t\t// get the vertices of the face\n\n\t\t\t\tgetVertexByIndex( indices[ i + 0 ], a );\n\t\t\t\tgetVertexByIndex( indices[ i + 1 ], b );\n\t\t\t\tgetVertexByIndex( indices[ i + 2 ], c );\n\n\t\t\t\t// perform subdivision\n\n\t\t\t\tsubdivideFace( a, b, c, detail );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction subdivideFace( a, b, c, detail ) {\n\n\t\t\tconst cols = detail + 1;\n\n\t\t\t// we use this multidimensional array as a data structure for creating the subdivision\n\n\t\t\tconst v = [];\n\n\t\t\t// construct all of the vertices for this subdivision\n\n\t\t\tfor ( let i = 0; i <= cols; i ++ ) {\n\n\t\t\t\tv[ i ] = [];\n\n\t\t\t\tconst aj = a.clone().lerp( c, i / cols );\n\t\t\t\tconst bj = b.clone().lerp( c, i / cols );\n\n\t\t\t\tconst rows = cols - i;\n\n\t\t\t\tfor ( let j = 0; j <= rows; j ++ ) {\n\n\t\t\t\t\tif ( j === 0 && i === cols ) {\n\n\t\t\t\t\t\tv[ i ][ j ] = aj;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tv[ i ][ j ] = aj.clone().lerp( bj, j / rows );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// construct all of the faces\n\n\t\t\tfor ( let i = 0; i < cols; i ++ ) {\n\n\t\t\t\tfor ( let j = 0; j < 2 * ( cols - i ) - 1; j ++ ) {\n\n\t\t\t\t\tconst k = Math.floor( j / 2 );\n\n\t\t\t\t\tif ( j % 2 === 0 ) {\n\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\t\t\t\t\t\tpushVertex( v[ i ][ k ] );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction applyRadius( radius ) {\n\n\t\t\tconst vertex = new Vector3();\n\n\t\t\t// iterate over the entire buffer and apply the radius to each vertex\n\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\t\tvertex.normalize().multiplyScalar( radius );\n\n\t\t\t\tvertexBuffer[ i + 0 ] = vertex.x;\n\t\t\t\tvertexBuffer[ i + 1 ] = vertex.y;\n\t\t\t\tvertexBuffer[ i + 2 ] = vertex.z;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateUVs() {\n\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\t\tconst u = azimuth( vertex ) / 2 / Math.PI + 0.5;\n\t\t\t\tconst v = inclination( vertex ) / Math.PI + 0.5;\n\t\t\t\tuvBuffer.push( u, 1 - v );\n\n\t\t\t}\n\n\t\t\tcorrectUVs();\n\n\t\t\tcorrectSeam();\n\n\t\t}\n\n\t\tfunction correctSeam() {\n\n\t\t\t// handle case when face straddles the seam, see #3269\n\n\t\t\tfor ( let i = 0; i < uvBuffer.length; i += 6 ) {\n\n\t\t\t\t// uv data of a single face\n\n\t\t\t\tconst x0 = uvBuffer[ i + 0 ];\n\t\t\t\tconst x1 = uvBuffer[ i + 2 ];\n\t\t\t\tconst x2 = uvBuffer[ i + 4 ];\n\n\t\t\t\tconst max = Math.max( x0, x1, x2 );\n\t\t\t\tconst min = Math.min( x0, x1, x2 );\n\n\t\t\t\t// 0.9 is somewhat arbitrary\n\n\t\t\t\tif ( max > 0.9 && min < 0.1 ) {\n\n\t\t\t\t\tif ( x0 < 0.2 ) uvBuffer[ i + 0 ] += 1;\n\t\t\t\t\tif ( x1 < 0.2 ) uvBuffer[ i + 2 ] += 1;\n\t\t\t\t\tif ( x2 < 0.2 ) uvBuffer[ i + 4 ] += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction pushVertex( vertex ) {\n\n\t\t\tvertexBuffer.push( vertex.x, vertex.y, vertex.z );\n\n\t\t}\n\n\t\tfunction getVertexByIndex( index, vertex ) {\n\n\t\t\tconst stride = index * 3;\n\n\t\t\tvertex.x = vertices[ stride + 0 ];\n\t\t\tvertex.y = vertices[ stride + 1 ];\n\t\t\tvertex.z = vertices[ stride + 2 ];\n\n\t\t}\n\n\t\tfunction correctUVs() {\n\n\t\t\tconst a = new Vector3();\n\t\t\tconst b = new Vector3();\n\t\t\tconst c = new Vector3();\n\n\t\t\tconst centroid = new Vector3();\n\n\t\t\tconst uvA = new Vector2();\n\t\t\tconst uvB = new Vector2();\n\t\t\tconst uvC = new Vector2();\n\n\t\t\tfor ( let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6 ) {\n\n\t\t\t\ta.set( vertexBuffer[ i + 0 ], vertexBuffer[ i + 1 ], vertexBuffer[ i + 2 ] );\n\t\t\t\tb.set( vertexBuffer[ i + 3 ], vertexBuffer[ i + 4 ], vertexBuffer[ i + 5 ] );\n\t\t\t\tc.set( vertexBuffer[ i + 6 ], vertexBuffer[ i + 7 ], vertexBuffer[ i + 8 ] );\n\n\t\t\t\tuvA.set( uvBuffer[ j + 0 ], uvBuffer[ j + 1 ] );\n\t\t\t\tuvB.set( uvBuffer[ j + 2 ], uvBuffer[ j + 3 ] );\n\t\t\t\tuvC.set( uvBuffer[ j + 4 ], uvBuffer[ j + 5 ] );\n\n\t\t\t\tcentroid.copy( a ).add( b ).add( c ).divideScalar( 3 );\n\n\t\t\t\tconst azi = azimuth( centroid );\n\n\t\t\t\tcorrectUV( uvA, j + 0, a, azi );\n\t\t\t\tcorrectUV( uvB, j + 2, b, azi );\n\t\t\t\tcorrectUV( uvC, j + 4, c, azi );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction correctUV( uv, stride, vector, azimuth ) {\n\n\t\t\tif ( ( azimuth < 0 ) && ( uv.x === 1 ) ) {\n\n\t\t\t\tuvBuffer[ stride ] = uv.x - 1;\n\n\t\t\t}\n\n\t\t\tif ( ( vector.x === 0 ) && ( vector.z === 0 ) ) {\n\n\t\t\t\tuvBuffer[ stride ] = azimuth / 2 / Math.PI + 0.5;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Angle around the Y axis, counter-clockwise when looking from above.\n\n\t\tfunction azimuth( vector ) {\n\n\t\t\treturn Math.atan2( vector.z, - vector.x );\n\n\t\t}\n\n\n\t\t// Angle above the XZ plane.\n\n\t\tfunction inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new PolyhedronGeometry( data.vertices, data.indices, data.radius, data.details );\n\n\t}\n\n}\n\nclass DodecahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\t\tconst r = 1 / t;\n\n\t\tconst vertices = [\n\n\t\t\t// (±1, ±1, ±1)\n\t\t\t- 1, - 1, - 1,\t- 1, - 1, 1,\n\t\t\t- 1, 1, - 1, - 1, 1, 1,\n\t\t\t1, - 1, - 1, 1, - 1, 1,\n\t\t\t1, 1, - 1, 1, 1, 1,\n\n\t\t\t// (0, ±1/φ, ±φ)\n\t\t\t0, - r, - t, 0, - r, t,\n\t\t\t0, r, - t, 0, r, t,\n\n\t\t\t// (±1/φ, ±φ, 0)\n\t\t\t- r, - t, 0, - r, t, 0,\n\t\t\tr, - t, 0, r, t, 0,\n\n\t\t\t// (±φ, 0, ±1/φ)\n\t\t\t- t, 0, - r, t, 0, - r,\n\t\t\t- t, 0, r, t, 0, r\n\t\t];\n\n\t\tconst indices = [\n\t\t\t3, 11, 7, \t3, 7, 15, \t3, 15, 13,\n\t\t\t7, 19, 17, \t7, 17, 6, \t7, 6, 15,\n\t\t\t17, 4, 8, \t17, 8, 10, \t17, 10, 6,\n\t\t\t8, 0, 16, \t8, 16, 2, \t8, 2, 10,\n\t\t\t0, 12, 1, \t0, 1, 18, \t0, 18, 16,\n\t\t\t6, 10, 2, \t6, 2, 13, \t6, 13, 15,\n\t\t\t2, 16, 18, \t2, 18, 3, \t2, 3, 13,\n\t\t\t18, 1, 9, \t18, 9, 11, \t18, 11, 3,\n\t\t\t4, 14, 12, \t4, 12, 0, \t4, 0, 8,\n\t\t\t11, 9, 5, \t11, 5, 19, \t11, 19, 7,\n\t\t\t19, 5, 14, \t19, 14, 4, \t19, 4, 17,\n\t\t\t1, 12, 14, \t1, 14, 5, \t1, 5, 9\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'DodecahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new DodecahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nconst _v0 = /*@__PURE__*/ new Vector3();\nconst _v1$1 = /*@__PURE__*/ new Vector3();\nconst _normal = /*@__PURE__*/ new Vector3();\nconst _triangle = /*@__PURE__*/ new Triangle();\n\nclass EdgesGeometry extends BufferGeometry {\n\n\tconstructor( geometry = null, thresholdAngle = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'EdgesGeometry';\n\n\t\tthis.parameters = {\n\t\t\tgeometry: geometry,\n\t\t\tthresholdAngle: thresholdAngle\n\t\t};\n\n\t\tif ( geometry !== null ) {\n\n\t\t\tconst precisionPoints = 4;\n\t\t\tconst precision = Math.pow( 10, precisionPoints );\n\t\t\tconst thresholdDot = Math.cos( DEG2RAD * thresholdAngle );\n\n\t\t\tconst indexAttr = geometry.getIndex();\n\t\t\tconst positionAttr = geometry.getAttribute( 'position' );\n\t\t\tconst indexCount = indexAttr ? indexAttr.count : positionAttr.count;\n\n\t\t\tconst indexArr = [ 0, 0, 0 ];\n\t\t\tconst vertKeys = [ 'a', 'b', 'c' ];\n\t\t\tconst hashes = new Array( 3 );\n\n\t\t\tconst edgeData = {};\n\t\t\tconst vertices = [];\n\t\t\tfor ( let i = 0; i < indexCount; i += 3 ) {\n\n\t\t\t\tif ( indexAttr ) {\n\n\t\t\t\t\tindexArr[ 0 ] = indexAttr.getX( i );\n\t\t\t\t\tindexArr[ 1 ] = indexAttr.getX( i + 1 );\n\t\t\t\t\tindexArr[ 2 ] = indexAttr.getX( i + 2 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tindexArr[ 0 ] = i;\n\t\t\t\t\tindexArr[ 1 ] = i + 1;\n\t\t\t\t\tindexArr[ 2 ] = i + 2;\n\n\t\t\t\t}\n\n\t\t\t\tconst { a, b, c } = _triangle;\n\t\t\t\ta.fromBufferAttribute( positionAttr, indexArr[ 0 ] );\n\t\t\t\tb.fromBufferAttribute( positionAttr, indexArr[ 1 ] );\n\t\t\t\tc.fromBufferAttribute( positionAttr, indexArr[ 2 ] );\n\t\t\t\t_triangle.getNormal( _normal );\n\n\t\t\t\t// create hashes for the edge from the vertices\n\t\t\t\thashes[ 0 ] = `${ Math.round( a.x * precision ) },${ Math.round( a.y * precision ) },${ Math.round( a.z * precision ) }`;\n\t\t\t\thashes[ 1 ] = `${ Math.round( b.x * precision ) },${ Math.round( b.y * precision ) },${ Math.round( b.z * precision ) }`;\n\t\t\t\thashes[ 2 ] = `${ Math.round( c.x * precision ) },${ Math.round( c.y * precision ) },${ Math.round( c.z * precision ) }`;\n\n\t\t\t\t// skip degenerate triangles\n\t\t\t\tif ( hashes[ 0 ] === hashes[ 1 ] || hashes[ 1 ] === hashes[ 2 ] || hashes[ 2 ] === hashes[ 0 ] ) {\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\t// iterate over every edge\n\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t// get the first and next vertex making up the edge\n\t\t\t\t\tconst jNext = ( j + 1 ) % 3;\n\t\t\t\t\tconst vecHash0 = hashes[ j ];\n\t\t\t\t\tconst vecHash1 = hashes[ jNext ];\n\t\t\t\t\tconst v0 = _triangle[ vertKeys[ j ] ];\n\t\t\t\t\tconst v1 = _triangle[ vertKeys[ jNext ] ];\n\n\t\t\t\t\tconst hash = `${ vecHash0 }_${ vecHash1 }`;\n\t\t\t\t\tconst reverseHash = `${ vecHash1 }_${ vecHash0 }`;\n\n\t\t\t\t\tif ( reverseHash in edgeData && edgeData[ reverseHash ] ) {\n\n\t\t\t\t\t\t// if we found a sibling edge add it into the vertex array if\n\t\t\t\t\t\t// it meets the angle threshold and delete the edge from the map.\n\t\t\t\t\t\tif ( _normal.dot( edgeData[ reverseHash ].normal ) <= thresholdDot ) {\n\n\t\t\t\t\t\t\tvertices.push( v0.x, v0.y, v0.z );\n\t\t\t\t\t\t\tvertices.push( v1.x, v1.y, v1.z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tedgeData[ reverseHash ] = null;\n\n\t\t\t\t\t} else if ( ! ( hash in edgeData ) ) {\n\n\t\t\t\t\t\t// if we've already got an edge here then skip adding a new one\n\t\t\t\t\t\tedgeData[ hash ] = {\n\n\t\t\t\t\t\t\tindex0: indexArr[ j ],\n\t\t\t\t\t\t\tindex1: indexArr[ jNext ],\n\t\t\t\t\t\t\tnormal: _normal.clone(),\n\n\t\t\t\t\t\t};\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// iterate over all remaining, unmatched edges and add them to the vertex array\n\t\t\tfor ( const key in edgeData ) {\n\n\t\t\t\tif ( edgeData[ key ] ) {\n\n\t\t\t\t\tconst { index0, index1 } = edgeData[ key ];\n\t\t\t\t\t_v0.fromBufferAttribute( positionAttr, index0 );\n\t\t\t\t\t_v1$1.fromBufferAttribute( positionAttr, index1 );\n\n\t\t\t\t\tvertices.push( _v0.x, _v0.y, _v0.z );\n\t\t\t\t\tvertices.push( _v1$1.x, _v1$1.y, _v1$1.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Shape extends Path {\n\n\tconstructor( points ) {\n\n\t\tsuper( points );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.type = 'Shape';\n\n\t\tthis.holes = [];\n\n\t}\n\n\tgetPointsHoles( divisions ) {\n\n\t\tconst holesPts = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tholesPts[ i ] = this.holes[ i ].getPoints( divisions );\n\n\t\t}\n\n\t\treturn holesPts;\n\n\t}\n\n\t// get points of shape and holes (keypoints based on segments parameter)\n\n\textractPoints( divisions ) {\n\n\t\treturn {\n\n\t\t\tshape: this.getPoints( divisions ),\n\t\t\tholes: this.getPointsHoles( divisions )\n\n\t\t};\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = source.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = source.holes[ i ];\n\n\t\t\tthis.holes.push( hole.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.holes = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = this.holes[ i ];\n\t\t\tdata.holes.push( hole.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.uuid = json.uuid;\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = json.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = json.holes[ i ];\n\t\t\tthis.holes.push( new Path().fromJSON( hole ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Port from https://github.com/mapbox/earcut (v2.2.4)\n */\n\nconst Earcut = {\n\n\ttriangulate: function ( data, holeIndices, dim = 2 ) {\n\n\t\tconst hasHoles = holeIndices && holeIndices.length;\n\t\tconst outerLen = hasHoles ? holeIndices[ 0 ] * dim : data.length;\n\t\tlet outerNode = linkedList( data, 0, outerLen, dim, true );\n\t\tconst triangles = [];\n\n\t\tif ( ! outerNode || outerNode.next === outerNode.prev ) return triangles;\n\n\t\tlet minX, minY, maxX, maxY, x, y, invSize;\n\n\t\tif ( hasHoles ) outerNode = eliminateHoles( data, holeIndices, outerNode, dim );\n\n\t\t// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n\t\tif ( data.length > 80 * dim ) {\n\n\t\t\tminX = maxX = data[ 0 ];\n\t\t\tminY = maxY = data[ 1 ];\n\n\t\t\tfor ( let i = dim; i < outerLen; i += dim ) {\n\n\t\t\t\tx = data[ i ];\n\t\t\t\ty = data[ i + 1 ];\n\t\t\t\tif ( x < minX ) minX = x;\n\t\t\t\tif ( y < minY ) minY = y;\n\t\t\t\tif ( x > maxX ) maxX = x;\n\t\t\t\tif ( y > maxY ) maxY = y;\n\n\t\t\t}\n\n\t\t\t// minX, minY and invSize are later used to transform coords into integers for z-order calculation\n\t\t\tinvSize = Math.max( maxX - minX, maxY - minY );\n\t\t\tinvSize = invSize !== 0 ? 32767 / invSize : 0;\n\n\t\t}\n\n\t\tearcutLinked( outerNode, triangles, dim, minX, minY, invSize, 0 );\n\n\t\treturn triangles;\n\n\t}\n\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\n\tlet i, last;\n\n\tif ( clockwise === ( signedArea( data, start, end, dim ) > 0 ) ) {\n\n\t\tfor ( i = start; i < end; i += dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t} else {\n\n\t\tfor ( i = end - dim; i >= start; i -= dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t}\n\n\tif ( last && equals( last, last.next ) ) {\n\n\t\tremoveNode( last );\n\t\tlast = last.next;\n\n\t}\n\n\treturn last;\n\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints( start, end ) {\n\n\tif ( ! start ) return start;\n\tif ( ! end ) end = start;\n\n\tlet p = start,\n\t\tagain;\n\tdo {\n\n\t\tagain = false;\n\n\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\tremoveNode( p );\n\t\t\tp = end = p.prev;\n\t\t\tif ( p === p.next ) break;\n\t\t\tagain = true;\n\n\t\t} else {\n\n\t\t\tp = p.next;\n\n\t\t}\n\n\t} while ( again || p !== end );\n\n\treturn end;\n\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\n\tif ( ! ear ) return;\n\n\t// interlink polygon nodes in z-order\n\tif ( ! pass && invSize ) indexCurve( ear, minX, minY, invSize );\n\n\tlet stop = ear,\n\t\tprev, next;\n\n\t// iterate through ears, slicing them one by one\n\twhile ( ear.prev !== ear.next ) {\n\n\t\tprev = ear.prev;\n\t\tnext = ear.next;\n\n\t\tif ( invSize ? isEarHashed( ear, minX, minY, invSize ) : isEar( ear ) ) {\n\n\t\t\t// cut off the triangle\n\t\t\ttriangles.push( prev.i / dim | 0 );\n\t\t\ttriangles.push( ear.i / dim | 0 );\n\t\t\ttriangles.push( next.i / dim | 0 );\n\n\t\t\tremoveNode( ear );\n\n\t\t\t// skipping the next vertex leads to less sliver triangles\n\t\t\tear = next.next;\n\t\t\tstop = next.next;\n\n\t\t\tcontinue;\n\n\t\t}\n\n\t\tear = next;\n\n\t\t// if we looped through the whole remaining polygon and can't find any more ears\n\t\tif ( ear === stop ) {\n\n\t\t\t// try filtering points and slicing again\n\t\t\tif ( ! pass ) {\n\n\t\t\t\tearcutLinked( filterPoints( ear ), triangles, dim, minX, minY, invSize, 1 );\n\n\t\t\t\t// if this didn't work, try curing all small self-intersections locally\n\n\t\t\t} else if ( pass === 1 ) {\n\n\t\t\t\tear = cureLocalIntersections( filterPoints( ear ), triangles, dim );\n\t\t\t\tearcutLinked( ear, triangles, dim, minX, minY, invSize, 2 );\n\n\t\t\t\t// as a last resort, try splitting the remaining polygon into two\n\n\t\t\t} else if ( pass === 2 ) {\n\n\t\t\t\tsplitEarcut( ear, triangles, dim, minX, minY, invSize );\n\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar( ear ) {\n\n\tconst a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\t// now make sure we don't have other points inside the potential ear\n\tconst ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n\t// triangle bbox; min & max are calculated like this for speed\n\tconst x0 = ax < bx ? ( ax < cx ? ax : cx ) : ( bx < cx ? bx : cx ),\n\t\ty0 = ay < by ? ( ay < cy ? ay : cy ) : ( by < cy ? by : cy ),\n\t\tx1 = ax > bx ? ( ax > cx ? ax : cx ) : ( bx > cx ? bx : cx ),\n\t\ty1 = ay > by ? ( ay > cy ? ay : cy ) : ( by > cy ? by : cy );\n\n\tlet p = c.next;\n\twhile ( p !== a ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) &&\n\t\t\tarea( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.next;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction isEarHashed( ear, minX, minY, invSize ) {\n\n\tconst a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\tconst ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n\t// triangle bbox; min & max are calculated like this for speed\n\tconst x0 = ax < bx ? ( ax < cx ? ax : cx ) : ( bx < cx ? bx : cx ),\n\t\ty0 = ay < by ? ( ay < cy ? ay : cy ) : ( by < cy ? by : cy ),\n\t\tx1 = ax > bx ? ( ax > cx ? ax : cx ) : ( bx > cx ? bx : cx ),\n\t\ty1 = ay > by ? ( ay > cy ? ay : cy ) : ( by > cy ? by : cy );\n\n\t// z-order range for the current triangle bbox;\n\tconst minZ = zOrder( x0, y0, minX, minY, invSize ),\n\t\tmaxZ = zOrder( x1, y1, minX, minY, invSize );\n\n\tlet p = ear.prevZ,\n\t\tn = ear.nextZ;\n\n\t// look for points inside the triangle in both directions\n\twhile ( p && p.z >= minZ && n && n.z <= maxZ ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) && area( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t\tif ( n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, n.x, n.y ) && area( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\t// look for remaining points in decreasing z-order\n\twhile ( p && p.z >= minZ ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) && area( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t}\n\n\t// look for remaining points in increasing z-order\n\twhile ( n && n.z <= maxZ ) {\n\n\t\tif ( n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, n.x, n.y ) && area( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\treturn true;\n\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections( start, triangles, dim ) {\n\n\tlet p = start;\n\tdo {\n\n\t\tconst a = p.prev,\n\t\t\tb = p.next.next;\n\n\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\n\n\t\t\ttriangles.push( a.i / dim | 0 );\n\t\t\ttriangles.push( p.i / dim | 0 );\n\t\t\ttriangles.push( b.i / dim | 0 );\n\n\t\t\t// remove two nodes involved\n\t\t\tremoveNode( p );\n\t\t\tremoveNode( p.next );\n\n\t\t\tp = start = b;\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn filterPoints( p );\n\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut( start, triangles, dim, minX, minY, invSize ) {\n\n\t// look for a valid diagonal that divides the polygon into two\n\tlet a = start;\n\tdo {\n\n\t\tlet b = a.next.next;\n\t\twhile ( b !== a.prev ) {\n\n\t\t\tif ( a.i !== b.i && isValidDiagonal( a, b ) ) {\n\n\t\t\t\t// split the polygon in two by the diagonal\n\t\t\t\tlet c = splitPolygon( a, b );\n\n\t\t\t\t// filter colinear points around the cuts\n\t\t\t\ta = filterPoints( a, a.next );\n\t\t\t\tc = filterPoints( c, c.next );\n\n\t\t\t\t// run earcut on each half\n\t\t\t\tearcutLinked( a, triangles, dim, minX, minY, invSize, 0 );\n\t\t\t\tearcutLinked( c, triangles, dim, minX, minY, invSize, 0 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tb = b.next;\n\n\t\t}\n\n\t\ta = a.next;\n\n\t} while ( a !== start );\n\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles( data, holeIndices, outerNode, dim ) {\n\n\tconst queue = [];\n\tlet i, len, start, end, list;\n\n\tfor ( i = 0, len = holeIndices.length; i < len; i ++ ) {\n\n\t\tstart = holeIndices[ i ] * dim;\n\t\tend = i < len - 1 ? holeIndices[ i + 1 ] * dim : data.length;\n\t\tlist = linkedList( data, start, end, dim, false );\n\t\tif ( list === list.next ) list.steiner = true;\n\t\tqueue.push( getLeftmost( list ) );\n\n\t}\n\n\tqueue.sort( compareX );\n\n\t// process holes from left to right\n\tfor ( i = 0; i < queue.length; i ++ ) {\n\n\t\touterNode = eliminateHole( queue[ i ], outerNode );\n\n\t}\n\n\treturn outerNode;\n\n}\n\nfunction compareX( a, b ) {\n\n\treturn a.x - b.x;\n\n}\n\n// find a bridge between vertices that connects hole with an outer ring and link it\nfunction eliminateHole( hole, outerNode ) {\n\n\tconst bridge = findHoleBridge( hole, outerNode );\n\tif ( ! bridge ) {\n\n\t\treturn outerNode;\n\n\t}\n\n\tconst bridgeReverse = splitPolygon( bridge, hole );\n\n\t// filter collinear points around the cuts\n\tfilterPoints( bridgeReverse, bridgeReverse.next );\n\treturn filterPoints( bridge, bridge.next );\n\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge( hole, outerNode ) {\n\n\tlet p = outerNode,\n\t\tqx = - Infinity,\n\t\tm;\n\n\tconst hx = hole.x, hy = hole.y;\n\n\t// find a segment intersected by a ray from the hole's leftmost point to the left;\n\t// segment's endpoint with lesser x will be potential connection point\n\tdo {\n\n\t\tif ( hy <= p.y && hy >= p.next.y && p.next.y !== p.y ) {\n\n\t\t\tconst x = p.x + ( hy - p.y ) * ( p.next.x - p.x ) / ( p.next.y - p.y );\n\t\t\tif ( x <= hx && x > qx ) {\n\n\t\t\t\tqx = x;\n\t\t\t\tm = p.x < p.next.x ? p : p.next;\n\t\t\t\tif ( x === hx ) return m; // hole touches outer segment; pick leftmost endpoint\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== outerNode );\n\n\tif ( ! m ) return null;\n\n\t// look for points inside the triangle of hole point, segment intersection and endpoint;\n\t// if there are no points found, we have a valid connection;\n\t// otherwise choose the point of the minimum angle with the ray as connection point\n\n\tconst stop = m,\n\t\tmx = m.x,\n\t\tmy = m.y;\n\tlet tanMin = Infinity, tan;\n\n\tp = m;\n\n\tdo {\n\n\t\tif ( hx >= p.x && p.x >= mx && hx !== p.x &&\n\t\t\t\tpointInTriangle( hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y ) ) {\n\n\t\t\ttan = Math.abs( hy - p.y ) / ( hx - p.x ); // tangential\n\n\t\t\tif ( locallyInside( p, hole ) && ( tan < tanMin || ( tan === tanMin && ( p.x > m.x || ( p.x === m.x && sectorContainsSector( m, p ) ) ) ) ) ) {\n\n\t\t\t\tm = p;\n\t\t\t\ttanMin = tan;\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== stop );\n\n\treturn m;\n\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector( m, p ) {\n\n\treturn area( m.prev, m, p.prev ) < 0 && area( p.next, m, m.next ) < 0;\n\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve( start, minX, minY, invSize ) {\n\n\tlet p = start;\n\tdo {\n\n\t\tif ( p.z === 0 ) p.z = zOrder( p.x, p.y, minX, minY, invSize );\n\t\tp.prevZ = p.prev;\n\t\tp.nextZ = p.next;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\tp.prevZ.nextZ = null;\n\tp.prevZ = null;\n\n\tsortLinked( p );\n\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\n\tlet i, p, q, e, tail, numMerges, pSize, qSize,\n\t\tinSize = 1;\n\n\tdo {\n\n\t\tp = list;\n\t\tlist = null;\n\t\ttail = null;\n\t\tnumMerges = 0;\n\n\t\twhile ( p ) {\n\n\t\t\tnumMerges ++;\n\t\t\tq = p;\n\t\t\tpSize = 0;\n\t\t\tfor ( i = 0; i < inSize; i ++ ) {\n\n\t\t\t\tpSize ++;\n\t\t\t\tq = q.nextZ;\n\t\t\t\tif ( ! q ) break;\n\n\t\t\t}\n\n\t\t\tqSize = inSize;\n\n\t\t\twhile ( pSize > 0 || ( qSize > 0 && q ) ) {\n\n\t\t\t\tif ( pSize !== 0 && ( qSize === 0 || ! q || p.z <= q.z ) ) {\n\n\t\t\t\t\te = p;\n\t\t\t\t\tp = p.nextZ;\n\t\t\t\t\tpSize --;\n\n\t\t\t\t} else {\n\n\t\t\t\t\te = q;\n\t\t\t\t\tq = q.nextZ;\n\t\t\t\t\tqSize --;\n\n\t\t\t\t}\n\n\t\t\t\tif ( tail ) tail.nextZ = e;\n\t\t\t\telse list = e;\n\n\t\t\t\te.prevZ = tail;\n\t\t\t\ttail = e;\n\n\t\t\t}\n\n\t\t\tp = q;\n\n\t\t}\n\n\t\ttail.nextZ = null;\n\t\tinSize *= 2;\n\n\t} while ( numMerges > 1 );\n\n\treturn list;\n\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\n\t// coords are transformed into non-negative 15-bit integer range\n\tx = ( x - minX ) * invSize | 0;\n\ty = ( y - minY ) * invSize | 0;\n\n\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\treturn x | ( y << 1 );\n\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost( start ) {\n\n\tlet p = start,\n\t\tleftmost = start;\n\tdo {\n\n\t\tif ( p.x < leftmost.x || ( p.x === leftmost.x && p.y < leftmost.y ) ) leftmost = p;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn leftmost;\n\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\treturn ( 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\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal( a, b ) {\n\n\treturn 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\n// signed area of a triangle\nfunction area( p, q, r ) {\n\n\treturn ( q.y - p.y ) * ( r.x - q.x ) - ( q.x - p.x ) * ( r.y - q.y );\n\n}\n\n// check if two points are equal\nfunction equals( p1, p2 ) {\n\n\treturn p1.x === p2.x && p1.y === p2.y;\n\n}\n\n// check if two segments intersect\nfunction intersects( p1, q1, p2, q2 ) {\n\n\tconst o1 = sign( area( p1, q1, p2 ) );\n\tconst o2 = sign( area( p1, q1, q2 ) );\n\tconst o3 = sign( area( p2, q2, p1 ) );\n\tconst o4 = sign( area( p2, q2, q1 ) );\n\n\tif ( o1 !== o2 && o3 !== o4 ) return true; // general case\n\n\tif ( o1 === 0 && onSegment( p1, p2, q1 ) ) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n\tif ( o2 === 0 && onSegment( p1, q2, q1 ) ) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n\tif ( o3 === 0 && onSegment( p2, p1, q2 ) ) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n\tif ( o4 === 0 && onSegment( p2, q1, q2 ) ) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n\treturn false;\n\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment( p, q, r ) {\n\n\treturn 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}\n\nfunction sign( num ) {\n\n\treturn num > 0 ? 1 : num < 0 ? - 1 : 0;\n\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon( a, b ) {\n\n\tlet p = a;\n\tdo {\n\n\t\tif ( p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n\t\t\tintersects( p, p.next, a, b ) ) return true;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn false;\n\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside( a, b ) {\n\n\treturn area( a.prev, a, a.next ) < 0 ?\n\t\tarea( a, b, a.next ) >= 0 && area( a, a.prev, b ) >= 0 :\n\t\tarea( a, b, a.prev ) < 0 || area( a, a.next, b ) < 0;\n\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside( a, b ) {\n\n\tlet p = a,\n\t\tinside = false;\n\tconst px = ( a.x + b.x ) / 2,\n\t\tpy = ( a.y + b.y ) / 2;\n\tdo {\n\n\t\tif ( ( ( p.y > py ) !== ( p.next.y > py ) ) && p.next.y !== p.y &&\n\t\t\t( px < ( p.next.x - p.x ) * ( py - p.y ) / ( p.next.y - p.y ) + p.x ) )\n\t\t\tinside = ! inside;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn inside;\n\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\n\tconst a2 = new Node( a.i, a.x, a.y ),\n\t\tb2 = new Node( b.i, b.x, b.y ),\n\t\tan = a.next,\n\t\tbp = b.prev;\n\n\ta.next = b;\n\tb.prev = a;\n\n\ta2.next = an;\n\tan.prev = a2;\n\n\tb2.next = a2;\n\ta2.prev = b2;\n\n\tbp.next = b2;\n\tb2.prev = bp;\n\n\treturn b2;\n\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\n\tconst p = new Node( i, x, y );\n\n\tif ( ! last ) {\n\n\t\tp.prev = p;\n\t\tp.next = p;\n\n\t} else {\n\n\t\tp.next = last.next;\n\t\tp.prev = last;\n\t\tlast.next.prev = p;\n\t\tlast.next = p;\n\n\t}\n\n\treturn p;\n\n}\n\nfunction removeNode( p ) {\n\n\tp.next.prev = p.prev;\n\tp.prev.next = p.next;\n\n\tif ( p.prevZ ) p.prevZ.nextZ = p.nextZ;\n\tif ( p.nextZ ) p.nextZ.prevZ = p.prevZ;\n\n}\n\nfunction Node( i, x, y ) {\n\n\t// vertex index in coordinates array\n\tthis.i = i;\n\n\t// vertex coordinates\n\tthis.x = x;\n\tthis.y = y;\n\n\t// previous and next vertex nodes in a polygon ring\n\tthis.prev = null;\n\tthis.next = null;\n\n\t// z-order curve value\n\tthis.z = 0;\n\n\t// previous and next nodes in z-order\n\tthis.prevZ = null;\n\tthis.nextZ = null;\n\n\t// indicates whether this is a steiner point\n\tthis.steiner = false;\n\n}\n\nfunction signedArea( data, start, end, dim ) {\n\n\tlet sum = 0;\n\tfor ( let i = start, j = end - dim; i < end; i += dim ) {\n\n\t\tsum += ( data[ j ] - data[ i ] ) * ( data[ i + 1 ] + data[ j + 1 ] );\n\t\tj = i;\n\n\t}\n\n\treturn sum;\n\n}\n\nclass ShapeUtils {\n\n\t// calculate area of the contour polygon\n\n\tstatic area( contour ) {\n\n\t\tconst n = contour.length;\n\t\tlet a = 0.0;\n\n\t\tfor ( let p = n - 1, q = 0; q < n; p = q ++ ) {\n\n\t\t\ta += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y;\n\n\t\t}\n\n\t\treturn a * 0.5;\n\n\t}\n\n\tstatic isClockWise( pts ) {\n\n\t\treturn ShapeUtils.area( pts ) < 0;\n\n\t}\n\n\tstatic triangulateShape( contour, holes ) {\n\n\t\tconst vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ]\n\t\tconst holeIndices = []; // array of hole indices\n\t\tconst faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ]\n\n\t\tremoveDupEndPts( contour );\n\t\taddContour( vertices, contour );\n\n\t\t//\n\n\t\tlet holeIndex = contour.length;\n\n\t\tholes.forEach( removeDupEndPts );\n\n\t\tfor ( let i = 0; i < holes.length; i ++ ) {\n\n\t\t\tholeIndices.push( holeIndex );\n\t\t\tholeIndex += holes[ i ].length;\n\t\t\taddContour( vertices, holes[ i ] );\n\n\t\t}\n\n\t\t//\n\n\t\tconst triangles = Earcut.triangulate( vertices, holeIndices );\n\n\t\t//\n\n\t\tfor ( let i = 0; i < triangles.length; i += 3 ) {\n\n\t\t\tfaces.push( triangles.slice( i, i + 3 ) );\n\n\t\t}\n\n\t\treturn faces;\n\n\t}\n\n}\n\nfunction removeDupEndPts( points ) {\n\n\tconst l = points.length;\n\n\tif ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) {\n\n\t\tpoints.pop();\n\n\t}\n\n}\n\nfunction addContour( vertices, contour ) {\n\n\tfor ( let i = 0; i < contour.length; i ++ ) {\n\n\t\tvertices.push( contour[ i ].x );\n\t\tvertices.push( contour[ i ].y );\n\n\t}\n\n}\n\n/**\n * Creates extruded geometry from a path shape.\n *\n * parameters = {\n *\n * curveSegments: , // number of points on the curves\n * steps: , // number of points for z-side extrusions / used for subdividing segments of extrude spline too\n * depth: , // Depth to extrude the shape\n *\n * bevelEnabled: , // turn on bevel\n * bevelThickness: , // how deep into the original shape bevel goes\n * bevelSize: , // how far from shape outline (including bevelOffset) is bevel\n * bevelOffset: , // how far from shape outline does bevel start\n * bevelSegments: , // number of bevel layers\n *\n * extrudePath: // curve to extrude shape along\n *\n * UVGenerator: // object that provides UV generator functions\n *\n * }\n */\n\n\nclass ExtrudeGeometry extends BufferGeometry {\n\n\tconstructor( shapes = new Shape( [ new Vector2( 0.5, 0.5 ), new Vector2( - 0.5, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), options = {} ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ExtrudeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\toptions: options\n\t\t};\n\n\t\tshapes = Array.isArray( shapes ) ? shapes : [ shapes ];\n\n\t\tconst scope = this;\n\n\t\tconst verticesArray = [];\n\t\tconst uvArray = [];\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\t\t\taddShape( shape );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( verticesArray, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvArray, 2 ) );\n\n\t\tthis.computeVertexNormals();\n\n\t\t// functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst placeholder = [];\n\n\t\t\t// options\n\n\t\t\tconst curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\n\t\t\tconst steps = options.steps !== undefined ? options.steps : 1;\n\t\t\tconst depth = options.depth !== undefined ? options.depth : 1;\n\n\t\t\tlet bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;\n\t\t\tlet bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 0.2;\n\t\t\tlet bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 0.1;\n\t\t\tlet bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;\n\t\t\tlet bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;\n\n\t\t\tconst extrudePath = options.extrudePath;\n\n\t\t\tconst uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator;\n\n\t\t\t//\n\n\t\t\tlet extrudePts, extrudeByPath = false;\n\t\t\tlet splineTube, binormal, normal, position2;\n\n\t\t\tif ( extrudePath ) {\n\n\t\t\t\textrudePts = extrudePath.getSpacedPoints( steps );\n\n\t\t\t\textrudeByPath = true;\n\t\t\t\tbevelEnabled = false; // bevels not supported for path extrusion\n\n\t\t\t\t// SETUP TNB variables\n\n\t\t\t\t// TODO1 - have a .isClosed in spline?\n\n\t\t\t\tsplineTube = extrudePath.computeFrenetFrames( steps, false );\n\n\t\t\t\t// console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);\n\n\t\t\t\tbinormal = new Vector3();\n\t\t\t\tnormal = new Vector3();\n\t\t\t\tposition2 = new Vector3();\n\n\t\t\t}\n\n\t\t\t// Safeguards if bevels are not enabled\n\n\t\t\tif ( ! bevelEnabled ) {\n\n\t\t\t\tbevelSegments = 0;\n\t\t\t\tbevelThickness = 0;\n\t\t\t\tbevelSize = 0;\n\t\t\t\tbevelOffset = 0;\n\n\t\t\t}\n\n\t\t\t// Variables initialization\n\n\t\t\tconst shapePoints = shape.extractPoints( curveSegments );\n\n\t\t\tlet vertices = shapePoints.shape;\n\t\t\tconst holes = shapePoints.holes;\n\n\t\t\tconst reverse = ! ShapeUtils.isClockWise( vertices );\n\n\t\t\tif ( reverse ) {\n\n\t\t\t\tvertices = vertices.reverse();\n\n\t\t\t\t// Maybe we should also check if holes are in the opposite direction, just to be safe ...\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\t\tif ( ShapeUtils.isClockWise( ahole ) ) {\n\n\t\t\t\t\t\tholes[ h ] = ahole.reverse();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\tconst faces = ShapeUtils.triangulateShape( vertices, holes );\n\n\t\t\t/* Vertices */\n\n\t\t\tconst contour = vertices; // vertices has all points but contour has only points of circumference\n\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\tvertices = vertices.concat( ahole );\n\n\t\t\t}\n\n\n\t\t\tfunction scalePt2( pt, vec, size ) {\n\n\t\t\t\tif ( ! vec ) console.error( 'THREE.ExtrudeGeometry: vec does not exist' );\n\n\t\t\t\treturn pt.clone().addScaledVector( vec, size );\n\n\t\t\t}\n\n\t\t\tconst vlen = vertices.length, flen = faces.length;\n\n\n\t\t\t// Find directions for point movement\n\n\n\t\t\tfunction getBevelVec( inPt, inPrev, inNext ) {\n\n\t\t\t\t// computes for inPt the corresponding point inPt' on a new contour\n\t\t\t\t// shifted by 1 unit (length of normalized vector) to the left\n\t\t\t\t// if we walk along contour clockwise, this new contour is outside the old one\n\t\t\t\t//\n\t\t\t\t// inPt' is the intersection of the two lines parallel to the two\n\t\t\t\t// adjacent edges of inPt at a distance of 1 unit on the left side.\n\n\t\t\t\tlet v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt\n\n\t\t\t\t// good reading for geometry algorithms (here: line-line intersection)\n\t\t\t\t// http://geomalgorithms.com/a05-_intersect-1.html\n\n\t\t\t\tconst v_prev_x = inPt.x - inPrev.x,\n\t\t\t\t\tv_prev_y = inPt.y - inPrev.y;\n\t\t\t\tconst v_next_x = inNext.x - inPt.x,\n\t\t\t\t\tv_next_y = inNext.y - inPt.y;\n\n\t\t\t\tconst v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y );\n\n\t\t\t\t// check for collinear edges\n\t\t\t\tconst collinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\tif ( Math.abs( collinear0 ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not collinear\n\n\t\t\t\t\t// length of vectors for normalizing\n\n\t\t\t\t\tconst v_prev_len = Math.sqrt( v_prev_lensq );\n\t\t\t\t\tconst v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y );\n\n\t\t\t\t\t// shift adjacent points by unit vectors to the left\n\n\t\t\t\t\tconst ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len );\n\t\t\t\t\tconst ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len );\n\n\t\t\t\t\tconst ptNextShift_x = ( inNext.x - v_next_y / v_next_len );\n\t\t\t\t\tconst ptNextShift_y = ( inNext.y + v_next_x / v_next_len );\n\n\t\t\t\t\t// scaling factor for v_prev to intersection point\n\n\t\t\t\t\tconst sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y -\n\t\t\t\t\t\t\t( ptNextShift_y - ptPrevShift_y ) * v_next_x ) /\n\t\t\t\t\t\t( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\t\t// vector from inPt to intersection point\n\n\t\t\t\t\tv_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x );\n\t\t\t\t\tv_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y );\n\n\t\t\t\t\t// Don't normalize!, otherwise sharp corners become ugly\n\t\t\t\t\t// but prevent crazy spikes\n\t\t\t\t\tconst v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y );\n\t\t\t\t\tif ( v_trans_lensq <= 2 ) {\n\n\t\t\t\t\t\treturn new Vector2( v_trans_x, v_trans_y );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_trans_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// handle special case of collinear edges\n\n\t\t\t\t\tlet direction_eq = false; // assumes: opposite\n\n\t\t\t\t\tif ( v_prev_x > Number.EPSILON ) {\n\n\t\t\t\t\t\tif ( v_next_x > Number.EPSILON ) {\n\n\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( v_prev_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\tif ( v_next_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( Math.sign( v_prev_y ) === Math.sign( v_next_y ) ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( direction_eq ) {\n\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight sequence\");\n\t\t\t\t\t\tv_trans_x = - v_prev_y;\n\t\t\t\t\t\tv_trans_y = v_prev_x;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight spike\");\n\t\t\t\t\t\tv_trans_x = v_prev_x;\n\t\t\t\t\t\tv_trans_y = v_prev_y;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn new Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by );\n\n\t\t\t}\n\n\n\t\t\tconst contourMovements = [];\n\n\t\t\tfor ( let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t// console.log('i,j,k', i, j , k)\n\n\t\t\t\tcontourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );\n\n\t\t\t}\n\n\t\t\tconst holesMovements = [];\n\t\t\tlet oneHoleMovements, verticesMovements = contourMovements.concat();\n\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\toneHoleMovements = [];\n\n\t\t\t\tfor ( let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t\toneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );\n\n\t\t\t\t}\n\n\t\t\t\tholesMovements.push( oneHoleMovements );\n\t\t\t\tverticesMovements = verticesMovements.concat( oneHoleMovements );\n\n\t\t\t}\n\n\n\t\t\t// Loop bevelSegments, 1 for the front, 1 for the back\n\n\t\t\tfor ( let b = 0; b < bevelSegments; b ++ ) {\n\n\t\t\t\t//for ( b = bevelSegments; b > 0; b -- ) {\n\n\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t// contract shape\n\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\n\t\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t\t}\n\n\t\t\t\t// expand holes\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst bs = bevelSize + bevelOffset;\n\n\t\t\t// Back facing vertices\n\n\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\tv( vert.x, vert.y, 0 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );\n\n\t\t\t\t\tnormal.copy( splineTube.normals[ 0 ] ).multiplyScalar( vert.x );\n\t\t\t\t\tbinormal.copy( splineTube.binormals[ 0 ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\tposition2.copy( extrudePts[ 0 ] ).add( normal ).add( binormal );\n\n\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Add stepped vertices...\n\t\t\t// Including front facing vertices\n\n\t\t\tfor ( let s = 1; s <= steps; s ++ ) {\n\n\t\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\tv( vert.x, vert.y, depth / steps * s );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );\n\n\t\t\t\t\t\tnormal.copy( splineTube.normals[ s ] ).multiplyScalar( vert.x );\n\t\t\t\t\t\tbinormal.copy( splineTube.binormals[ s ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\t\tposition2.copy( extrudePts[ s ] ).add( normal ).add( binormal );\n\n\t\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\t// Add bevel segments planes\n\n\t\t\t//for ( b = 1; b <= bevelSegments; b ++ ) {\n\t\t\tfor ( let b = bevelSegments - 1; b >= 0; b -- ) {\n\n\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t// contract shape\n\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t}\n\n\t\t\t\t// expand holes\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t/* Faces */\n\n\t\t\t// Top and bottom faces\n\n\t\t\tbuildLidFaces();\n\n\t\t\t// Sides faces\n\n\t\t\tbuildSideFaces();\n\n\n\t\t\t///// Internal functions\n\n\t\t\tfunction buildLidFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\n\t\t\t\tif ( bevelEnabled ) {\n\n\t\t\t\t\tlet layer = 0; // steps + 1\n\t\t\t\t\tlet offset = vlen * layer;\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlayer = steps + bevelSegments * 2;\n\t\t\t\t\toffset = vlen * layer;\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ], face[ 1 ], face[ 0 ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 0 );\n\n\t\t\t}\n\n\t\t\t// Create faces for the z-sides of the shape\n\n\t\t\tfunction buildSideFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\t\t\t\tlet layeroffset = 0;\n\t\t\t\tsidewalls( contour, layeroffset );\n\t\t\t\tlayeroffset += contour.length;\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t\t//, true\n\t\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t\t}\n\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t\t}\n\n\t\t\tfunction sidewalls( contour, layeroffset ) {\n\n\t\t\t\tlet i = contour.length;\n\n\t\t\t\twhile ( -- i >= 0 ) {\n\n\t\t\t\t\tconst j = i;\n\t\t\t\t\tlet k = i - 1;\n\t\t\t\t\tif ( k < 0 ) k = contour.length - 1;\n\n\t\t\t\t\t//console.log('b', i,j, i-1, k,vertices.length);\n\n\t\t\t\t\tfor ( let s = 0, sl = ( steps + bevelSegments * 2 ); s < sl; s ++ ) {\n\n\t\t\t\t\t\tconst slen1 = vlen * s;\n\t\t\t\t\t\tconst slen2 = vlen * ( s + 1 );\n\n\t\t\t\t\t\tconst a = layeroffset + j + slen1,\n\t\t\t\t\t\t\tb = layeroffset + k + slen1,\n\t\t\t\t\t\t\tc = layeroffset + k + slen2,\n\t\t\t\t\t\t\td = layeroffset + j + slen2;\n\n\t\t\t\t\t\tf4( a, b, c, d );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tfunction v( x, y, z ) {\n\n\t\t\t\tplaceholder.push( x );\n\t\t\t\tplaceholder.push( y );\n\t\t\t\tplaceholder.push( z );\n\n\t\t\t}\n\n\n\t\t\tfunction f3( a, b, c ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateTopUV( scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\n\t\t\t}\n\n\t\t\tfunction f4( a, b, c, d ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( d );\n\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\t\t\t\taddVertex( d );\n\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateSideWallUV( scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t}\n\n\t\t\tfunction addVertex( index ) {\n\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 0 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 1 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 2 ] );\n\n\t\t\t}\n\n\n\t\t\tfunction addUV( vector2 ) {\n\n\t\t\t\tuvArray.push( vector2.x );\n\t\t\t\tuvArray.push( vector2.y );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\t\tconst options = this.parameters.options;\n\n\t\treturn toJSON$1( shapes, options, data );\n\n\t}\n\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\tconst extrudePath = data.options.extrudePath;\n\n\t\tif ( extrudePath !== undefined ) {\n\n\t\t\tdata.options.extrudePath = new Curves[ extrudePath.type ]().fromJSON( extrudePath );\n\n\t\t}\n\n\t\treturn new ExtrudeGeometry( geometryShapes, data.options );\n\n\t}\n\n}\n\nconst WorldUVGenerator = {\n\n\tgenerateTopUV: function ( geometry, vertices, indexA, indexB, indexC ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\n\t\treturn [\n\t\t\tnew Vector2( a_x, a_y ),\n\t\t\tnew Vector2( b_x, b_y ),\n\t\t\tnew Vector2( c_x, c_y )\n\t\t];\n\n\t},\n\n\tgenerateSideWallUV: function ( geometry, vertices, indexA, indexB, indexC, indexD ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst a_z = vertices[ indexA * 3 + 2 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst b_z = vertices[ indexB * 3 + 2 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\t\tconst c_z = vertices[ indexC * 3 + 2 ];\n\t\tconst d_x = vertices[ indexD * 3 ];\n\t\tconst d_y = vertices[ indexD * 3 + 1 ];\n\t\tconst d_z = vertices[ indexD * 3 + 2 ];\n\n\t\tif ( Math.abs( a_y - b_y ) < Math.abs( a_x - b_x ) ) {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_x, 1 - a_z ),\n\t\t\t\tnew Vector2( b_x, 1 - b_z ),\n\t\t\t\tnew Vector2( c_x, 1 - c_z ),\n\t\t\t\tnew Vector2( d_x, 1 - d_z )\n\t\t\t];\n\n\t\t} else {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_y, 1 - a_z ),\n\t\t\t\tnew Vector2( b_y, 1 - b_z ),\n\t\t\t\tnew Vector2( c_y, 1 - c_z ),\n\t\t\t\tnew Vector2( d_y, 1 - d_z )\n\t\t\t];\n\n\t\t}\n\n\t}\n\n};\n\nfunction toJSON$1( shapes, options, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\tdata.options = Object.assign( {}, options );\n\n\tif ( options.extrudePath !== undefined ) data.options.extrudePath = options.extrudePath.toJSON();\n\n\treturn data;\n\n}\n\nclass IcosahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\n\t\tconst vertices = [\n\t\t\t- 1, t, 0, \t1, t, 0, \t- 1, - t, 0, \t1, - t, 0,\n\t\t\t0, - 1, t, \t0, 1, t,\t0, - 1, - t, \t0, 1, - t,\n\t\t\tt, 0, - 1, \tt, 0, 1, \t- t, 0, - 1, \t- t, 0, 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t0, 11, 5, \t0, 5, 1, \t0, 1, 7, \t0, 7, 10, \t0, 10, 11,\n\t\t\t1, 5, 9, \t5, 11, 4,\t11, 10, 2,\t10, 7, 6,\t7, 1, 8,\n\t\t\t3, 9, 4, \t3, 4, 2,\t3, 2, 6,\t3, 6, 8,\t3, 8, 9,\n\t\t\t4, 9, 5, \t2, 4, 11,\t6, 2, 10,\t8, 6, 7,\t9, 8, 1\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'IcosahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new IcosahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass OctahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst vertices = [\n\t\t\t1, 0, 0, \t- 1, 0, 0,\t0, 1, 0,\n\t\t\t0, - 1, 0, \t0, 0, 1,\t0, 0, - 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t0, 2, 4,\t0, 4, 3,\t0, 3, 5,\n\t\t\t0, 5, 2,\t1, 2, 5,\t1, 5, 3,\n\t\t\t1, 3, 4,\t1, 4, 2\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'OctahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new OctahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass RingGeometry extends BufferGeometry {\n\n\tconstructor( innerRadius = 0.5, outerRadius = 1, thetaSegments = 32, phiSegments = 1, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'RingGeometry';\n\n\t\tthis.parameters = {\n\t\t\tinnerRadius: innerRadius,\n\t\t\touterRadius: outerRadius,\n\t\t\tthetaSegments: thetaSegments,\n\t\t\tphiSegments: phiSegments,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tthetaSegments = Math.max( 3, thetaSegments );\n\t\tphiSegments = Math.max( 1, phiSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// some helper variables\n\n\t\tlet radius = innerRadius;\n\t\tconst radiusStep = ( ( outerRadius - innerRadius ) / phiSegments );\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let j = 0; j <= phiSegments; j ++ ) {\n\n\t\t\tfor ( let i = 0; i <= thetaSegments; i ++ ) {\n\n\t\t\t\t// values are generate from the inside of the ring to the outside\n\n\t\t\t\tconst segment = thetaStart + i / thetaSegments * thetaLength;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = radius * Math.cos( segment );\n\t\t\t\tvertex.y = radius * Math.sin( segment );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = ( vertex.x / outerRadius + 1 ) / 2;\n\t\t\t\tuv.y = ( vertex.y / outerRadius + 1 ) / 2;\n\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t}\n\n\t\t\t// increase the radius for next row of vertices\n\n\t\t\tradius += radiusStep;\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let j = 0; j < phiSegments; j ++ ) {\n\n\t\t\tconst thetaSegmentLevel = j * ( thetaSegments + 1 );\n\n\t\t\tfor ( let i = 0; i < thetaSegments; i ++ ) {\n\n\t\t\t\tconst segment = i + thetaSegmentLevel;\n\n\t\t\t\tconst a = segment;\n\t\t\t\tconst b = segment + thetaSegments + 1;\n\t\t\t\tconst c = segment + thetaSegments + 2;\n\t\t\t\tconst d = segment + 1;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new RingGeometry( data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass ShapeGeometry extends BufferGeometry {\n\n\tconstructor( shapes = new Shape( [ new Vector2( 0, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), curveSegments = 12 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ShapeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\tcurveSegments: curveSegments\n\t\t};\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet groupStart = 0;\n\t\tlet groupCount = 0;\n\n\t\t// allow single and array values for \"shapes\" parameter\n\n\t\tif ( Array.isArray( shapes ) === false ) {\n\n\t\t\taddShape( shapes );\n\n\t\t} else {\n\n\t\t\tfor ( let i = 0; i < shapes.length; i ++ ) {\n\n\t\t\t\taddShape( shapes[ i ] );\n\n\t\t\t\tthis.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support\n\n\t\t\t\tgroupStart += groupCount;\n\t\t\t\tgroupCount = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\n\t\t// helper functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst indexOffset = vertices.length / 3;\n\t\t\tconst points = shape.extractPoints( curveSegments );\n\n\t\t\tlet shapeVertices = points.shape;\n\t\t\tconst shapeHoles = points.holes;\n\n\t\t\t// check direction of vertices\n\n\t\t\tif ( ShapeUtils.isClockWise( shapeVertices ) === false ) {\n\n\t\t\t\tshapeVertices = shapeVertices.reverse();\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\n\t\t\t\tif ( ShapeUtils.isClockWise( shapeHole ) === true ) {\n\n\t\t\t\t\tshapeHoles[ i ] = shapeHole.reverse();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst faces = ShapeUtils.triangulateShape( shapeVertices, shapeHoles );\n\n\t\t\t// join vertices of inner and outer paths to a single array\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\t\t\t\tshapeVertices = shapeVertices.concat( shapeHole );\n\n\t\t\t}\n\n\t\t\t// vertices, normals, uvs\n\n\t\t\tfor ( let i = 0, l = shapeVertices.length; i < l; i ++ ) {\n\n\t\t\t\tconst vertex = shapeVertices[ i ];\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, 0 );\n\t\t\t\tnormals.push( 0, 0, 1 );\n\t\t\t\tuvs.push( vertex.x, vertex.y ); // world uvs\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\tfor ( let i = 0, l = faces.length; i < l; i ++ ) {\n\n\t\t\t\tconst face = faces[ i ];\n\n\t\t\t\tconst a = face[ 0 ] + indexOffset;\n\t\t\t\tconst b = face[ 1 ] + indexOffset;\n\t\t\t\tconst c = face[ 2 ] + indexOffset;\n\n\t\t\t\tindices.push( a, b, c );\n\t\t\t\tgroupCount += 3;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\n\t\treturn toJSON( shapes, data );\n\n\t}\n\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\treturn new ShapeGeometry( geometryShapes, data.curveSegments );\n\n\t}\n\n}\n\nfunction toJSON( shapes, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\treturn data;\n\n}\n\nclass SphereGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'SphereGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tphiStart: phiStart,\n\t\t\tphiLength: phiLength,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\twidthSegments = Math.max( 3, Math.floor( widthSegments ) );\n\t\theightSegments = Math.max( 2, Math.floor( heightSegments ) );\n\n\t\tconst thetaEnd = Math.min( thetaStart + thetaLength, Math.PI );\n\n\t\tlet index = 0;\n\t\tconst grid = [];\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let iy = 0; iy <= heightSegments; iy ++ ) {\n\n\t\t\tconst verticesRow = [];\n\n\t\t\tconst v = iy / heightSegments;\n\n\t\t\t// special case for the poles\n\n\t\t\tlet uOffset = 0;\n\n\t\t\tif ( iy === 0 && thetaStart === 0 ) {\n\n\t\t\t\tuOffset = 0.5 / widthSegments;\n\n\t\t\t} else if ( iy === heightSegments && thetaEnd === Math.PI ) {\n\n\t\t\t\tuOffset = - 0.5 / widthSegments;\n\n\t\t\t}\n\n\t\t\tfor ( let ix = 0; ix <= widthSegments; ix ++ ) {\n\n\t\t\t\tconst u = ix / widthSegments;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\t\t\t\tvertex.y = radius * Math.cos( thetaStart + v * thetaLength );\n\t\t\t\tvertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.copy( vertex ).normalize();\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( u + uOffset, 1 - v );\n\n\t\t\t\tverticesRow.push( index ++ );\n\n\t\t\t}\n\n\t\t\tgrid.push( verticesRow );\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let iy = 0; iy < heightSegments; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < widthSegments; ix ++ ) {\n\n\t\t\t\tconst a = grid[ iy ][ ix + 1 ];\n\t\t\t\tconst b = grid[ iy ][ ix ];\n\t\t\t\tconst c = grid[ iy + 1 ][ ix ];\n\t\t\t\tconst d = grid[ iy + 1 ][ ix + 1 ];\n\n\t\t\t\tif ( iy !== 0 || thetaStart > 0 ) indices.push( a, b, d );\n\t\t\t\tif ( iy !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new SphereGeometry( data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass TetrahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst vertices = [\n\t\t\t1, 1, 1, \t- 1, - 1, 1, \t- 1, 1, - 1, \t1, - 1, - 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t2, 1, 0, \t0, 3, 2,\t1, 3, 0,\t2, 3, 1\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'TetrahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TetrahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass TorusGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, tube = 0.4, radialSegments = 12, tubularSegments = 48, arc = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TorusGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\ttube: tube,\n\t\t\tradialSegments: radialSegments,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tarc: arc\n\t\t};\n\n\t\tradialSegments = Math.floor( radialSegments );\n\t\ttubularSegments = Math.floor( tubularSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst center = new Vector3();\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\t\tconst u = i / tubularSegments * arc;\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u );\n\t\t\t\tvertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u );\n\t\t\t\tvertex.z = tube * Math.sin( v );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tcenter.x = radius * Math.cos( u );\n\t\t\t\tcenter.y = radius * Math.sin( u );\n\t\t\t\tnormal.subVectors( vertex, center ).normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( i / tubularSegments );\n\t\t\t\tuvs.push( j / radialSegments );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( let j = 1; j <= radialSegments; j ++ ) {\n\n\t\t\tfor ( let i = 1; i <= tubularSegments; i ++ ) {\n\n\t\t\t\t// indices\n\n\t\t\t\tconst a = ( tubularSegments + 1 ) * j + i - 1;\n\t\t\t\tconst b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1;\n\t\t\t\tconst c = ( tubularSegments + 1 ) * ( j - 1 ) + i;\n\t\t\t\tconst d = ( tubularSegments + 1 ) * j + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TorusGeometry( data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc );\n\n\t}\n\n}\n\nclass TorusKnotGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TorusKnotGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\ttube: tube,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tradialSegments: radialSegments,\n\t\t\tp: p,\n\t\t\tq: q\n\t\t};\n\n\t\ttubularSegments = Math.floor( tubularSegments );\n\t\tradialSegments = Math.floor( radialSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\tconst P1 = new Vector3();\n\t\tconst P2 = new Vector3();\n\n\t\tconst B = new Vector3();\n\t\tconst T = new Vector3();\n\t\tconst N = new Vector3();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let i = 0; i <= tubularSegments; ++ i ) {\n\n\t\t\t// the radian \"u\" is used to calculate the position on the torus curve of the current tubular segment\n\n\t\t\tconst u = i / tubularSegments * p * Math.PI * 2;\n\n\t\t\t// now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead.\n\t\t\t// these points are used to create a special \"coordinate space\", which is necessary to calculate the correct vertex positions\n\n\t\t\tcalculatePositionOnCurve( u, p, q, radius, P1 );\n\t\t\tcalculatePositionOnCurve( u + 0.01, p, q, radius, P2 );\n\n\t\t\t// calculate orthonormal basis\n\n\t\t\tT.subVectors( P2, P1 );\n\t\t\tN.addVectors( P2, P1 );\n\t\t\tB.crossVectors( T, N );\n\t\t\tN.crossVectors( B, T );\n\n\t\t\t// normalize B, N. T can be ignored, we don't use it\n\n\t\t\tB.normalize();\n\t\t\tN.normalize();\n\n\t\t\tfor ( let j = 0; j <= radialSegments; ++ j ) {\n\n\t\t\t\t// now calculate the vertices. they are nothing more than an extrusion of the torus curve.\n\t\t\t\t// because we extrude a shape in the xy-plane, there is no need to calculate a z-value.\n\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\t\t\t\tconst cx = - tube * Math.cos( v );\n\t\t\t\tconst cy = tube * Math.sin( v );\n\n\t\t\t\t// now calculate the final vertex position.\n\t\t\t\t// first we orient the extrusion with our basis vectors, then we add it to the current position on the curve\n\n\t\t\t\tvertex.x = P1.x + ( cx * N.x + cy * B.x );\n\t\t\t\tvertex.y = P1.y + ( cx * N.y + cy * B.y );\n\t\t\t\tvertex.z = P1.z + ( cx * N.z + cy * B.z );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal)\n\n\t\t\t\tnormal.subVectors( vertex, P1 ).normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( i / tubularSegments );\n\t\t\t\tuvs.push( j / radialSegments );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\n\n\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t\t// indices\n\n\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\n\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\t// this function calculates the current position on the torus curve\n\n\t\tfunction calculatePositionOnCurve( u, p, q, radius, position ) {\n\n\t\t\tconst cu = Math.cos( u );\n\t\t\tconst su = Math.sin( u );\n\t\t\tconst quOverP = q / p * u;\n\t\t\tconst cs = Math.cos( quOverP );\n\n\t\t\tposition.x = radius * ( 2 + cs ) * 0.5 * cu;\n\t\t\tposition.y = radius * ( 2 + cs ) * su * 0.5;\n\t\t\tposition.z = radius * Math.sin( quOverP ) * 0.5;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TorusKnotGeometry( data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q );\n\n\t}\n\n}\n\nclass TubeGeometry extends BufferGeometry {\n\n\tconstructor( path = new QuadraticBezierCurve3( new Vector3( - 1, - 1, 0 ), new Vector3( - 1, 1, 0 ), new Vector3( 1, 1, 0 ) ), tubularSegments = 64, radius = 1, radialSegments = 8, closed = false ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TubeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tpath: path,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tradius: radius,\n\t\t\tradialSegments: radialSegments,\n\t\t\tclosed: closed\n\t\t};\n\n\t\tconst frames = path.computeFrenetFrames( tubularSegments, closed );\n\n\t\t// expose internals\n\n\t\tthis.tangents = frames.tangents;\n\t\tthis.normals = frames.normals;\n\t\tthis.binormals = frames.binormals;\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\t\tconst uv = new Vector2();\n\t\tlet P = new Vector3();\n\n\t\t// buffer\n\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\t\tconst indices = [];\n\n\t\t// create buffer data\n\n\t\tgenerateBufferData();\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\t// functions\n\n\t\tfunction generateBufferData() {\n\n\t\t\tfor ( let i = 0; i < tubularSegments; i ++ ) {\n\n\t\t\t\tgenerateSegment( i );\n\n\t\t\t}\n\n\t\t\t// if the geometry is not closed, generate the last row of vertices and normals\n\t\t\t// at the regular position on the given path\n\t\t\t//\n\t\t\t// if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ)\n\n\t\t\tgenerateSegment( ( closed === false ) ? tubularSegments : 0 );\n\n\t\t\t// uvs are generated in a separate function.\n\t\t\t// this makes it easy compute correct values for closed geometries\n\n\t\t\tgenerateUVs();\n\n\t\t\t// finally create faces\n\n\t\t\tgenerateIndices();\n\n\t\t}\n\n\t\tfunction generateSegment( i ) {\n\n\t\t\t// we use getPointAt to sample evenly distributed points from the given path\n\n\t\t\tP = path.getPointAt( i / tubularSegments, P );\n\n\t\t\t// retrieve corresponding normal and binormal\n\n\t\t\tconst N = frames.normals[ i ];\n\t\t\tconst B = frames.binormals[ i ];\n\n\t\t\t// generate normals and vertices for the current segment\n\n\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\n\t\t\t\tconst sin = Math.sin( v );\n\t\t\t\tconst cos = - Math.cos( v );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.x = ( cos * N.x + sin * B.x );\n\t\t\t\tnormal.y = ( cos * N.y + sin * B.y );\n\t\t\t\tnormal.z = ( cos * N.z + sin * B.z );\n\t\t\t\tnormal.normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = P.x + radius * normal.x;\n\t\t\t\tvertex.y = P.y + radius * normal.y;\n\t\t\t\tvertex.z = P.z + radius * normal.z;\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateIndices() {\n\n\t\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\n\n\t\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\n\t\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateUVs() {\n\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\t\t\tuv.x = i / tubularSegments;\n\t\t\t\t\tuv.y = j / radialSegments;\n\n\t\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.path = this.parameters.path.toJSON();\n\n\t\treturn data;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\t// This only works for built-in curves (e.g. CatmullRomCurve3).\n\t\t// User defined curves or instances of CurvePath will not be deserialized.\n\t\treturn new TubeGeometry(\n\t\t\tnew Curves[ data.path.type ]().fromJSON( data.path ),\n\t\t\tdata.tubularSegments,\n\t\t\tdata.radius,\n\t\t\tdata.radialSegments,\n\t\t\tdata.closed\n\t\t);\n\n\t}\n\n}\n\nclass WireframeGeometry extends BufferGeometry {\n\n\tconstructor( geometry = null ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'WireframeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tgeometry: geometry\n\t\t};\n\n\t\tif ( geometry !== null ) {\n\n\t\t\t// buffer\n\n\t\t\tconst vertices = [];\n\t\t\tconst edges = new Set();\n\n\t\t\t// helper variables\n\n\t\t\tconst start = new Vector3();\n\t\t\tconst end = new Vector3();\n\n\t\t\tif ( geometry.index !== null ) {\n\n\t\t\t\t// indexed BufferGeometry\n\n\t\t\t\tconst position = geometry.attributes.position;\n\t\t\t\tconst indices = geometry.index;\n\t\t\t\tlet groups = geometry.groups;\n\n\t\t\t\tif ( groups.length === 0 ) {\n\n\t\t\t\t\tgroups = [ { start: 0, count: indices.count, materialIndex: 0 } ];\n\n\t\t\t\t}\n\n\t\t\t\t// create a data structure that contains all edges without duplicates\n\n\t\t\t\tfor ( let o = 0, ol = groups.length; o < ol; ++ o ) {\n\n\t\t\t\t\tconst group = groups[ o ];\n\n\t\t\t\t\tconst groupStart = group.start;\n\t\t\t\t\tconst groupCount = group.count;\n\n\t\t\t\t\tfor ( let i = groupStart, l = ( groupStart + groupCount ); i < l; i += 3 ) {\n\n\t\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t\t\tconst index1 = indices.getX( i + j );\n\t\t\t\t\t\t\tconst index2 = indices.getX( i + ( j + 1 ) % 3 );\n\n\t\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\n\t\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\n\n\t\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\n\n\t\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\n\t\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed BufferGeometry\n\n\t\t\t\tconst position = geometry.attributes.position;\n\n\t\t\t\tfor ( let i = 0, l = ( position.count / 3 ); i < l; i ++ ) {\n\n\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t\t// three edges per triangle, an edge is represented as (index1, index2)\n\t\t\t\t\t\t// e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)\n\n\t\t\t\t\t\tconst index1 = 3 * i + j;\n\t\t\t\t\t\tconst index2 = 3 * i + ( ( j + 1 ) % 3 );\n\n\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\n\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\n\n\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\n\n\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\n\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// build geometry\n\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction isUniqueEdge( start, end, edges ) {\n\n\tconst hash1 = `${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}`;\n\tconst hash2 = `${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}`; // coincident edge\n\n\tif ( edges.has( hash1 ) === true || edges.has( hash2 ) === true ) {\n\n\t\treturn false;\n\n\t} else {\n\n\t\tedges.add( hash1 );\n\t\tedges.add( hash2 );\n\t\treturn true;\n\n\t}\n\n}\n\nvar Geometries = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tBoxGeometry: BoxGeometry,\n\tCapsuleGeometry: CapsuleGeometry,\n\tCircleGeometry: CircleGeometry,\n\tConeGeometry: ConeGeometry,\n\tCylinderGeometry: CylinderGeometry,\n\tDodecahedronGeometry: DodecahedronGeometry,\n\tEdgesGeometry: EdgesGeometry,\n\tExtrudeGeometry: ExtrudeGeometry,\n\tIcosahedronGeometry: IcosahedronGeometry,\n\tLatheGeometry: LatheGeometry,\n\tOctahedronGeometry: OctahedronGeometry,\n\tPlaneGeometry: PlaneGeometry,\n\tPolyhedronGeometry: PolyhedronGeometry,\n\tRingGeometry: RingGeometry,\n\tShapeGeometry: ShapeGeometry,\n\tSphereGeometry: SphereGeometry,\n\tTetrahedronGeometry: TetrahedronGeometry,\n\tTorusGeometry: TorusGeometry,\n\tTorusKnotGeometry: TorusKnotGeometry,\n\tTubeGeometry: TubeGeometry,\n\tWireframeGeometry: WireframeGeometry\n});\n\nclass ShadowMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isShadowMaterial = true;\n\n\t\tthis.type = 'ShadowMaterial';\n\n\t\tthis.color = new Color( 0x000000 );\n\t\tthis.transparent = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass RawShaderMaterial extends ShaderMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper( parameters );\n\n\t\tthis.isRawShaderMaterial = true;\n\n\t\tthis.type = 'RawShaderMaterial';\n\n\t}\n\n}\n\nclass MeshStandardMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshStandardMaterial = true;\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\tthis.type = 'MeshStandardMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\t\tthis.roughness = 1.0;\n\t\tthis.metalness = 0.0;\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.roughnessMap = null;\n\n\t\tthis.metalnessMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.envMapRotation = new Euler();\n\t\tthis.envMapIntensity = 1.0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\tthis.color.copy( source.color );\n\t\tthis.roughness = source.roughness;\n\t\tthis.metalness = source.metalness;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.roughnessMap = source.roughnessMap;\n\n\t\tthis.metalnessMap = source.metalnessMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapRotation.copy( source.envMapRotation );\n\t\tthis.envMapIntensity = source.envMapIntensity;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshPhysicalMaterial extends MeshStandardMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshPhysicalMaterial = true;\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.type = 'MeshPhysicalMaterial';\n\n\t\tthis.anisotropyRotation = 0;\n\t\tthis.anisotropyMap = null;\n\n\t\tthis.clearcoatMap = null;\n\t\tthis.clearcoatRoughness = 0.0;\n\t\tthis.clearcoatRoughnessMap = null;\n\t\tthis.clearcoatNormalScale = new Vector2( 1, 1 );\n\t\tthis.clearcoatNormalMap = null;\n\n\t\tthis.ior = 1.5;\n\n\t\tObject.defineProperty( this, 'reflectivity', {\n\t\t\tget: function () {\n\n\t\t\t\treturn ( clamp( 2.5 * ( this.ior - 1 ) / ( this.ior + 1 ), 0, 1 ) );\n\n\t\t\t},\n\t\t\tset: function ( reflectivity ) {\n\n\t\t\t\tthis.ior = ( 1 + 0.4 * reflectivity ) / ( 1 - 0.4 * reflectivity );\n\n\t\t\t}\n\t\t} );\n\n\t\tthis.iridescenceMap = null;\n\t\tthis.iridescenceIOR = 1.3;\n\t\tthis.iridescenceThicknessRange = [ 100, 400 ];\n\t\tthis.iridescenceThicknessMap = null;\n\n\t\tthis.sheenColor = new Color( 0x000000 );\n\t\tthis.sheenColorMap = null;\n\t\tthis.sheenRoughness = 1.0;\n\t\tthis.sheenRoughnessMap = null;\n\n\t\tthis.transmissionMap = null;\n\n\t\tthis.thickness = 0;\n\t\tthis.thicknessMap = null;\n\t\tthis.attenuationDistance = Infinity;\n\t\tthis.attenuationColor = new Color( 1, 1, 1 );\n\n\t\tthis.specularIntensity = 1.0;\n\t\tthis.specularIntensityMap = null;\n\t\tthis.specularColor = new Color( 1, 1, 1 );\n\t\tthis.specularColorMap = null;\n\n\t\tthis._anisotropy = 0;\n\t\tthis._clearcoat = 0;\n\t\tthis._dispersion = 0;\n\t\tthis._iridescence = 0;\n\t\tthis._sheen = 0.0;\n\t\tthis._transmission = 0;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tget anisotropy() {\n\n\t\treturn this._anisotropy;\n\n\t}\n\n\tset anisotropy( value ) {\n\n\t\tif ( this._anisotropy > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._anisotropy = value;\n\n\t}\n\n\tget clearcoat() {\n\n\t\treturn this._clearcoat;\n\n\t}\n\n\tset clearcoat( value ) {\n\n\t\tif ( this._clearcoat > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._clearcoat = value;\n\n\t}\n\n\tget iridescence() {\n\n\t\treturn this._iridescence;\n\n\t}\n\n\tset iridescence( value ) {\n\n\t\tif ( this._iridescence > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._iridescence = value;\n\n\t}\n\n\tget dispersion() {\n\n\t\treturn this._dispersion;\n\n\t}\n\n\tset dispersion( value ) {\n\n\t\tif ( this._dispersion > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._dispersion = value;\n\n\t}\n\n\tget sheen() {\n\n\t\treturn this._sheen;\n\n\t}\n\n\tset sheen( value ) {\n\n\t\tif ( this._sheen > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._sheen = value;\n\n\t}\n\n\tget transmission() {\n\n\t\treturn this._transmission;\n\n\t}\n\n\tset transmission( value ) {\n\n\t\tif ( this._transmission > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._transmission = value;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.anisotropy = source.anisotropy;\n\t\tthis.anisotropyRotation = source.anisotropyRotation;\n\t\tthis.anisotropyMap = source.anisotropyMap;\n\n\t\tthis.clearcoat = source.clearcoat;\n\t\tthis.clearcoatMap = source.clearcoatMap;\n\t\tthis.clearcoatRoughness = source.clearcoatRoughness;\n\t\tthis.clearcoatRoughnessMap = source.clearcoatRoughnessMap;\n\t\tthis.clearcoatNormalMap = source.clearcoatNormalMap;\n\t\tthis.clearcoatNormalScale.copy( source.clearcoatNormalScale );\n\n\t\tthis.dispersion = source.dispersion;\n\t\tthis.ior = source.ior;\n\n\t\tthis.iridescence = source.iridescence;\n\t\tthis.iridescenceMap = source.iridescenceMap;\n\t\tthis.iridescenceIOR = source.iridescenceIOR;\n\t\tthis.iridescenceThicknessRange = [ ...source.iridescenceThicknessRange ];\n\t\tthis.iridescenceThicknessMap = source.iridescenceThicknessMap;\n\n\t\tthis.sheen = source.sheen;\n\t\tthis.sheenColor.copy( source.sheenColor );\n\t\tthis.sheenColorMap = source.sheenColorMap;\n\t\tthis.sheenRoughness = source.sheenRoughness;\n\t\tthis.sheenRoughnessMap = source.sheenRoughnessMap;\n\n\t\tthis.transmission = source.transmission;\n\t\tthis.transmissionMap = source.transmissionMap;\n\n\t\tthis.thickness = source.thickness;\n\t\tthis.thicknessMap = source.thicknessMap;\n\t\tthis.attenuationDistance = source.attenuationDistance;\n\t\tthis.attenuationColor.copy( source.attenuationColor );\n\n\t\tthis.specularIntensity = source.specularIntensity;\n\t\tthis.specularIntensityMap = source.specularIntensityMap;\n\t\tthis.specularColor.copy( source.specularColor );\n\t\tthis.specularColorMap = source.specularColorMap;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshPhongMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshPhongMaterial = true;\n\n\t\tthis.type = 'MeshPhongMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\t\tthis.specular = new Color( 0x111111 );\n\t\tthis.shininess = 30;\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.envMapRotation = new Euler();\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.specular.copy( source.specular );\n\t\tthis.shininess = source.shininess;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapRotation.copy( source.envMapRotation );\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshToonMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshToonMaterial = true;\n\n\t\tthis.defines = { 'TOON': '' };\n\n\t\tthis.type = 'MeshToonMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\t\tthis.gradientMap = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\t\tthis.gradientMap = source.gradientMap;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshNormalMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshNormalMaterial = true;\n\n\t\tthis.type = 'MeshNormalMaterial';\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.flatShading = false;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshLambertMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshLambertMaterial = true;\n\n\t\tthis.type = 'MeshLambertMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.envMapRotation = new Euler();\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapRotation.copy( source.envMapRotation );\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshMatcapMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshMatcapMaterial = true;\n\n\t\tthis.defines = { 'MATCAP': '' };\n\n\t\tthis.type = 'MeshMatcapMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\tthis.matcap = null;\n\n\t\tthis.map = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = { 'MATCAP': '' };\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.matcap = source.matcap;\n\n\t\tthis.map = source.map;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineDashedMaterial extends LineBasicMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isLineDashedMaterial = true;\n\n\t\tthis.type = 'LineDashedMaterial';\n\n\t\tthis.scale = 1;\n\t\tthis.dashSize = 3;\n\t\tthis.gapSize = 1;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.scale = source.scale;\n\t\tthis.dashSize = source.dashSize;\n\t\tthis.gapSize = source.gapSize;\n\n\t\treturn this;\n\n\t}\n\n}\n\n// converts an array to a specific type\nfunction convertArray( array, type, forceClone ) {\n\n\tif ( ! array || // let 'undefined' and 'null' pass\n\t\t! forceClone && array.constructor === type ) return array;\n\n\tif ( typeof type.BYTES_PER_ELEMENT === 'number' ) {\n\n\t\treturn new type( array ); // create typed array\n\n\t}\n\n\treturn Array.prototype.slice.call( array ); // create Array\n\n}\n\nfunction isTypedArray( object ) {\n\n\treturn ArrayBuffer.isView( object ) &&\n\t\t! ( object instanceof DataView );\n\n}\n\n// returns an array by which times and values can be sorted\nfunction getKeyframeOrder( times ) {\n\n\tfunction compareTime( i, j ) {\n\n\t\treturn times[ i ] - times[ j ];\n\n\t}\n\n\tconst n = times.length;\n\tconst result = new Array( n );\n\tfor ( let i = 0; i !== n; ++ i ) result[ i ] = i;\n\n\tresult.sort( compareTime );\n\n\treturn result;\n\n}\n\n// uses the array previously returned by 'getKeyframeOrder' to sort data\nfunction sortedArray( values, stride, order ) {\n\n\tconst nValues = values.length;\n\tconst result = new values.constructor( nValues );\n\n\tfor ( let i = 0, dstOffset = 0; dstOffset !== nValues; ++ i ) {\n\n\t\tconst srcOffset = order[ i ] * stride;\n\n\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\tresult[ dstOffset ++ ] = values[ srcOffset + j ];\n\n\t\t}\n\n\t}\n\n\treturn result;\n\n}\n\n// function for parsing AOS keyframe formats\nfunction flattenJSON( jsonKeys, times, values, valuePropertyName ) {\n\n\tlet i = 1, key = jsonKeys[ 0 ];\n\n\twhile ( key !== undefined && key[ valuePropertyName ] === undefined ) {\n\n\t\tkey = jsonKeys[ i ++ ];\n\n\t}\n\n\tif ( key === undefined ) return; // no data\n\n\tlet value = key[ valuePropertyName ];\n\tif ( value === undefined ) return; // no data\n\n\tif ( Array.isArray( value ) ) {\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalues.push.apply( values, value ); // push all elements\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t} else if ( value.toArray !== undefined ) {\n\n\t\t// ...assume THREE.Math-ish\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalue.toArray( values, values.length );\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t} else {\n\n\t\t// otherwise push as-is\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalues.push( value );\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t}\n\n}\n\nfunction subclip( sourceClip, name, startFrame, endFrame, fps = 30 ) {\n\n\tconst clip = sourceClip.clone();\n\n\tclip.name = name;\n\n\tconst tracks = [];\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tconst track = clip.tracks[ i ];\n\t\tconst valueSize = track.getValueSize();\n\n\t\tconst times = [];\n\t\tconst values = [];\n\n\t\tfor ( let j = 0; j < track.times.length; ++ j ) {\n\n\t\t\tconst frame = track.times[ j ] * fps;\n\n\t\t\tif ( frame < startFrame || frame >= endFrame ) continue;\n\n\t\t\ttimes.push( track.times[ j ] );\n\n\t\t\tfor ( let k = 0; k < valueSize; ++ k ) {\n\n\t\t\t\tvalues.push( track.values[ j * valueSize + k ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( times.length === 0 ) continue;\n\n\t\ttrack.times = convertArray( times, track.times.constructor );\n\t\ttrack.values = convertArray( values, track.values.constructor );\n\n\t\ttracks.push( track );\n\n\t}\n\n\tclip.tracks = tracks;\n\n\t// find minimum .times value across all tracks in the trimmed clip\n\n\tlet minStartTime = Infinity;\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tif ( minStartTime > clip.tracks[ i ].times[ 0 ] ) {\n\n\t\t\tminStartTime = clip.tracks[ i ].times[ 0 ];\n\n\t\t}\n\n\t}\n\n\t// shift all tracks such that clip begins at t=0\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tclip.tracks[ i ].shift( - 1 * minStartTime );\n\n\t}\n\n\tclip.resetDuration();\n\n\treturn clip;\n\n}\n\nfunction makeClipAdditive( targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30 ) {\n\n\tif ( fps <= 0 ) fps = 30;\n\n\tconst numTracks = referenceClip.tracks.length;\n\tconst referenceTime = referenceFrame / fps;\n\n\t// Make each track's values relative to the values at the reference frame\n\tfor ( let i = 0; i < numTracks; ++ i ) {\n\n\t\tconst referenceTrack = referenceClip.tracks[ i ];\n\t\tconst referenceTrackType = referenceTrack.ValueTypeName;\n\n\t\t// Skip this track if it's non-numeric\n\t\tif ( referenceTrackType === 'bool' || referenceTrackType === 'string' ) continue;\n\n\t\t// Find the track in the target clip whose name and type matches the reference track\n\t\tconst targetTrack = targetClip.tracks.find( function ( track ) {\n\n\t\t\treturn track.name === referenceTrack.name\n\t\t\t\t&& track.ValueTypeName === referenceTrackType;\n\n\t\t} );\n\n\t\tif ( targetTrack === undefined ) continue;\n\n\t\tlet referenceOffset = 0;\n\t\tconst referenceValueSize = referenceTrack.getValueSize();\n\n\t\tif ( referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\n\n\t\t\treferenceOffset = referenceValueSize / 3;\n\n\t\t}\n\n\t\tlet targetOffset = 0;\n\t\tconst targetValueSize = targetTrack.getValueSize();\n\n\t\tif ( targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\n\n\t\t\ttargetOffset = targetValueSize / 3;\n\n\t\t}\n\n\t\tconst lastIndex = referenceTrack.times.length - 1;\n\t\tlet referenceValue;\n\n\t\t// Find the value to subtract out of the track\n\t\tif ( referenceTime <= referenceTrack.times[ 0 ] ) {\n\n\t\t\t// Reference frame is earlier than the first keyframe, so just use the first keyframe\n\t\t\tconst startIndex = referenceOffset;\n\t\t\tconst endIndex = referenceValueSize - referenceOffset;\n\t\t\treferenceValue = referenceTrack.values.slice( startIndex, endIndex );\n\n\t\t} else if ( referenceTime >= referenceTrack.times[ lastIndex ] ) {\n\n\t\t\t// Reference frame is after the last keyframe, so just use the last keyframe\n\t\t\tconst startIndex = lastIndex * referenceValueSize + referenceOffset;\n\t\t\tconst endIndex = startIndex + referenceValueSize - referenceOffset;\n\t\t\treferenceValue = referenceTrack.values.slice( startIndex, endIndex );\n\n\t\t} else {\n\n\t\t\t// Interpolate to the reference value\n\t\t\tconst interpolant = referenceTrack.createInterpolant();\n\t\t\tconst startIndex = referenceOffset;\n\t\t\tconst endIndex = referenceValueSize - referenceOffset;\n\t\t\tinterpolant.evaluate( referenceTime );\n\t\t\treferenceValue = interpolant.resultBuffer.slice( startIndex, endIndex );\n\n\t\t}\n\n\t\t// Conjugate the quaternion\n\t\tif ( referenceTrackType === 'quaternion' ) {\n\n\t\t\tconst referenceQuat = new Quaternion().fromArray( referenceValue ).normalize().conjugate();\n\t\t\treferenceQuat.toArray( referenceValue );\n\n\t\t}\n\n\t\t// Subtract the reference value from all of the track values\n\n\t\tconst numTimes = targetTrack.times.length;\n\t\tfor ( let j = 0; j < numTimes; ++ j ) {\n\n\t\t\tconst valueStart = j * targetValueSize + targetOffset;\n\n\t\t\tif ( referenceTrackType === 'quaternion' ) {\n\n\t\t\t\t// Multiply the conjugate for quaternion track types\n\t\t\t\tQuaternion.multiplyQuaternionsFlat(\n\t\t\t\t\ttargetTrack.values,\n\t\t\t\t\tvalueStart,\n\t\t\t\t\treferenceValue,\n\t\t\t\t\t0,\n\t\t\t\t\ttargetTrack.values,\n\t\t\t\t\tvalueStart\n\t\t\t\t);\n\n\t\t\t} else {\n\n\t\t\t\tconst valueEnd = targetValueSize - targetOffset * 2;\n\n\t\t\t\t// Subtract each value for all other numeric track types\n\t\t\t\tfor ( let k = 0; k < valueEnd; ++ k ) {\n\n\t\t\t\t\ttargetTrack.values[ valueStart + k ] -= referenceValue[ k ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttargetClip.blendMode = AdditiveAnimationBlendMode;\n\n\treturn targetClip;\n\n}\n\nconst AnimationUtils = {\n\tconvertArray: convertArray,\n\tisTypedArray: isTypedArray,\n\tgetKeyframeOrder: getKeyframeOrder,\n\tsortedArray: sortedArray,\n\tflattenJSON: flattenJSON,\n\tsubclip: subclip,\n\tmakeClipAdditive: makeClipAdditive\n};\n\n/**\n * Abstract base class of interpolants over parametric samples.\n *\n * The parameter domain is one dimensional, typically the time or a path\n * along a curve defined by the data.\n *\n * The sample values can have any dimensionality and derived classes may\n * apply special interpretations to the data.\n *\n * This class provides the interval seek in a Template Method, deferring\n * the actual interpolation to derived classes.\n *\n * Time complexity is O(1) for linear access crossing at most two points\n * and O(log N) for random access, where N is the number of positions.\n *\n * References:\n *\n * \t\thttp://www.oodesign.com/template-method-pattern.html\n *\n */\n\nclass Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tthis.parameterPositions = parameterPositions;\n\t\tthis._cachedIndex = 0;\n\n\t\tthis.resultBuffer = resultBuffer !== undefined ?\n\t\t\tresultBuffer : new sampleValues.constructor( sampleSize );\n\t\tthis.sampleValues = sampleValues;\n\t\tthis.valueSize = sampleSize;\n\n\t\tthis.settings = null;\n\t\tthis.DefaultSettings_ = {};\n\n\t}\n\n\tevaluate( t ) {\n\n\t\tconst pp = this.parameterPositions;\n\t\tlet i1 = this._cachedIndex,\n\t\t\tt1 = pp[ i1 ],\n\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\tvalidate_interval: {\n\n\t\t\tseek: {\n\n\t\t\t\tlet right;\n\n\t\t\t\tlinear_scan: {\n\n\t\t\t\t\t//- See http://jsperf.com/comparison-to-undefined/3\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\n\t\t\t\t\t//- \t\t\t\tif ( t >= t1 || t1 === undefined ) {\n\t\t\t\t\tforward_scan: if ( ! ( t < t1 ) ) {\n\n\t\t\t\t\t\tfor ( let giveUpAt = i1 + 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\t\t\t\tif ( t < t0 ) break forward_scan;\n\n\t\t\t\t\t\t\t\t// after end\n\n\t\t\t\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\t\t\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt0 = t1;\n\t\t\t\t\t\t\tt1 = pp[ ++ i1 ];\n\n\t\t\t\t\t\t\tif ( t < t1 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the right side of the index\n\t\t\t\t\t\tright = pp.length;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\t\t\t\t\tif ( t < t0 || t0 === undefined ) {\n\t\t\t\t\tif ( ! ( t >= t0 ) ) {\n\n\t\t\t\t\t\t// looping?\n\n\t\t\t\t\t\tconst t1global = pp[ 1 ];\n\n\t\t\t\t\t\tif ( t < t1global ) {\n\n\t\t\t\t\t\t\ti1 = 2; // + 1, using the scan for the details\n\t\t\t\t\t\t\tt0 = t1global;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// linear reverse scan\n\n\t\t\t\t\t\tfor ( let giveUpAt = i1 - 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\t\t\t\t// before start\n\n\t\t\t\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\t\t\t\treturn this.copySampleValue_( 0 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt1 = t0;\n\t\t\t\t\t\t\tt0 = pp[ -- i1 - 1 ];\n\n\t\t\t\t\t\t\tif ( t >= t0 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the left side of the index\n\t\t\t\t\t\tright = i1;\n\t\t\t\t\t\ti1 = 0;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the interval is valid\n\n\t\t\t\t\tbreak validate_interval;\n\n\t\t\t\t} // linear scan\n\n\t\t\t\t// binary search\n\n\t\t\t\twhile ( i1 < right ) {\n\n\t\t\t\t\tconst mid = ( i1 + right ) >>> 1;\n\n\t\t\t\t\tif ( t < pp[ mid ] ) {\n\n\t\t\t\t\t\tright = mid;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ti1 = mid + 1;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tt1 = pp[ i1 ];\n\t\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\t\t\t// check boundary cases, again\n\n\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\treturn this.copySampleValue_( 0 );\n\n\t\t\t\t}\n\n\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t\t\t\t}\n\n\t\t\t} // seek\n\n\t\t\tthis._cachedIndex = i1;\n\n\t\t\tthis.intervalChanged_( i1, t0, t1 );\n\n\t\t} // validate_interval\n\n\t\treturn this.interpolate_( i1, t0, t, t1 );\n\n\t}\n\n\tgetSettings_() {\n\n\t\treturn this.settings || this.DefaultSettings_;\n\n\t}\n\n\tcopySampleValue_( index ) {\n\n\t\t// copies a sample value to the result buffer\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = index * stride;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] = values[ offset + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t// Template methods for derived classes:\n\n\tinterpolate_( /* i1, t0, t, t1 */ ) {\n\n\t\tthrow new Error( 'call to abstract method' );\n\t\t// implementations shall return this.resultBuffer\n\n\t}\n\n\tintervalChanged_( /* i1, t0, t1 */ ) {\n\n\t\t// empty\n\n\t}\n\n}\n\n/**\n * Fast and simple cubic spline interpolant.\n *\n * It was derived from a Hermitian construction setting the first derivative\n * at each sample position to the linear slope between neighboring positions\n * over their parameter interval.\n */\n\nclass CubicInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t\tthis._weightPrev = - 0;\n\t\tthis._offsetPrev = - 0;\n\t\tthis._weightNext = - 0;\n\t\tthis._offsetNext = - 0;\n\n\t\tthis.DefaultSettings_ = {\n\n\t\t\tendingStart: ZeroCurvatureEnding,\n\t\t\tendingEnd: ZeroCurvatureEnding\n\n\t\t};\n\n\t}\n\n\tintervalChanged_( i1, t0, t1 ) {\n\n\t\tconst pp = this.parameterPositions;\n\t\tlet iPrev = i1 - 2,\n\t\t\tiNext = i1 + 1,\n\n\t\t\ttPrev = pp[ iPrev ],\n\t\t\ttNext = pp[ iNext ];\n\n\t\tif ( tPrev === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingStart ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(t0) = 0\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = 2 * t0 - t1;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiPrev = pp.length - 2;\n\t\t\t\t\ttPrev = t0 + pp[ iPrev ] - pp[ iPrev + 1 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(t0) = 0 a.k.a. Natural Spline\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = t1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tNext === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingEnd ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(tN) = 0\n\t\t\t\t\tiNext = i1;\n\t\t\t\t\ttNext = 2 * t1 - t0;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiNext = 1;\n\t\t\t\t\ttNext = t1 + pp[ 1 ] - pp[ 0 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(tN) = 0, a.k.a. Natural Spline\n\t\t\t\t\tiNext = i1 - 1;\n\t\t\t\t\ttNext = t0;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst halfDt = ( t1 - t0 ) * 0.5,\n\t\t\tstride = this.valueSize;\n\n\t\tthis._weightPrev = halfDt / ( t0 - tPrev );\n\t\tthis._weightNext = halfDt / ( tNext - t1 );\n\t\tthis._offsetPrev = iPrev * stride;\n\t\tthis._offsetNext = iNext * stride;\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\to1 = i1 * stride,\t\to0 = o1 - stride,\n\t\t\toP = this._offsetPrev, \toN = this._offsetNext,\n\t\t\twP = this._weightPrev,\twN = this._weightNext,\n\n\t\t\tp = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tpp = p * p,\n\t\t\tppp = pp * p;\n\n\t\t// evaluate polynomials\n\n\t\tconst sP = - wP * ppp + 2 * wP * pp - wP * p;\n\t\tconst s0 = ( 1 + wP ) * ppp + ( - 1.5 - 2 * wP ) * pp + ( - 0.5 + wP ) * p + 1;\n\t\tconst s1 = ( - 1 - wN ) * ppp + ( 1.5 + wN ) * pp + 0.5 * p;\n\t\tconst sN = wN * ppp - wN * pp;\n\n\t\t// combine data linearly\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tsP * values[ oP + i ] +\n\t\t\t\t\ts0 * values[ o0 + i ] +\n\t\t\t\t\ts1 * values[ o1 + i ] +\n\t\t\t\t\tsN * values[ oN + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\nclass LinearInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\toffset1 = i1 * stride,\n\t\t\toffset0 = offset1 - stride,\n\n\t\t\tweight1 = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tweight0 = 1 - weight1;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tvalues[ offset0 + i ] * weight0 +\n\t\t\t\t\tvalues[ offset1 + i ] * weight1;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n *\n * Interpolant that evaluates to the sample value at the position preceding\n * the parameter.\n */\n\nclass DiscreteInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1 /*, t0, t, t1 */ ) {\n\n\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t}\n\n}\n\nclass KeyframeTrack {\n\n\tconstructor( name, times, values, interpolation ) {\n\n\t\tif ( name === undefined ) throw new Error( 'THREE.KeyframeTrack: track name is undefined' );\n\t\tif ( times === undefined || times.length === 0 ) throw new Error( 'THREE.KeyframeTrack: no keyframes in track named ' + name );\n\n\t\tthis.name = name;\n\n\t\tthis.times = convertArray( times, this.TimeBufferType );\n\t\tthis.values = convertArray( values, this.ValueBufferType );\n\n\t\tthis.setInterpolation( interpolation || this.DefaultInterpolation );\n\n\t}\n\n\t// Serialization (in static context, because of constructor invocation\n\t// and automatic invocation of .toJSON):\n\n\tstatic toJSON( track ) {\n\n\t\tconst trackType = track.constructor;\n\n\t\tlet json;\n\n\t\t// derived classes can define a static toJSON method\n\t\tif ( trackType.toJSON !== this.toJSON ) {\n\n\t\t\tjson = trackType.toJSON( track );\n\n\t\t} else {\n\n\t\t\t// by default, we assume the data can be serialized as-is\n\t\t\tjson = {\n\n\t\t\t\t'name': track.name,\n\t\t\t\t'times': convertArray( track.times, Array ),\n\t\t\t\t'values': convertArray( track.values, Array )\n\n\t\t\t};\n\n\t\t\tconst interpolation = track.getInterpolation();\n\n\t\t\tif ( interpolation !== track.DefaultInterpolation ) {\n\n\t\t\t\tjson.interpolation = interpolation;\n\n\t\t\t}\n\n\t\t}\n\n\t\tjson.type = track.ValueTypeName; // mandatory\n\n\t\treturn json;\n\n\t}\n\n\tInterpolantFactoryMethodDiscrete( result ) {\n\n\t\treturn new DiscreteInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tInterpolantFactoryMethodLinear( result ) {\n\n\t\treturn new LinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tInterpolantFactoryMethodSmooth( result ) {\n\n\t\treturn new CubicInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tsetInterpolation( interpolation ) {\n\n\t\tlet factoryMethod;\n\n\t\tswitch ( interpolation ) {\n\n\t\t\tcase InterpolateDiscrete:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodDiscrete;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateLinear:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodLinear;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateSmooth:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodSmooth;\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tif ( factoryMethod === undefined ) {\n\n\t\t\tconst message = 'unsupported interpolation for ' +\n\t\t\t\tthis.ValueTypeName + ' keyframe track named ' + this.name;\n\n\t\t\tif ( this.createInterpolant === undefined ) {\n\n\t\t\t\t// fall back to default, unless the default itself is messed up\n\t\t\t\tif ( interpolation !== this.DefaultInterpolation ) {\n\n\t\t\t\t\tthis.setInterpolation( this.DefaultInterpolation );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( message ); // fatal, in this case\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconsole.warn( 'THREE.KeyframeTrack:', message );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tthis.createInterpolant = factoryMethod;\n\n\t\treturn this;\n\n\t}\n\n\tgetInterpolation() {\n\n\t\tswitch ( this.createInterpolant ) {\n\n\t\t\tcase this.InterpolantFactoryMethodDiscrete:\n\n\t\t\t\treturn InterpolateDiscrete;\n\n\t\t\tcase this.InterpolantFactoryMethodLinear:\n\n\t\t\t\treturn InterpolateLinear;\n\n\t\t\tcase this.InterpolantFactoryMethodSmooth:\n\n\t\t\t\treturn InterpolateSmooth;\n\n\t\t}\n\n\t}\n\n\tgetValueSize() {\n\n\t\treturn this.values.length / this.times.length;\n\n\t}\n\n\t// move all keyframes either forwards or backwards in time\n\tshift( timeOffset ) {\n\n\t\tif ( timeOffset !== 0.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] += timeOffset;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// scale all keyframe times by a factor (useful for frame <-> seconds conversions)\n\tscale( timeScale ) {\n\n\t\tif ( timeScale !== 1.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] *= timeScale;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// removes keyframes before and after animation without changing any values within the range [startTime, endTime].\n\t// IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values\n\ttrim( startTime, endTime ) {\n\n\t\tconst times = this.times,\n\t\t\tnKeys = times.length;\n\n\t\tlet from = 0,\n\t\t\tto = nKeys - 1;\n\n\t\twhile ( from !== nKeys && times[ from ] < startTime ) {\n\n\t\t\t++ from;\n\n\t\t}\n\n\t\twhile ( to !== - 1 && times[ to ] > endTime ) {\n\n\t\t\t-- to;\n\n\t\t}\n\n\t\t++ to; // inclusive -> exclusive bound\n\n\t\tif ( from !== 0 || to !== nKeys ) {\n\n\t\t\t// empty tracks are forbidden, so keep at least one keyframe\n\t\t\tif ( from >= to ) {\n\n\t\t\t\tto = Math.max( to, 1 );\n\t\t\t\tfrom = to - 1;\n\n\t\t\t}\n\n\t\t\tconst stride = this.getValueSize();\n\t\t\tthis.times = times.slice( from, to );\n\t\t\tthis.values = this.values.slice( from * stride, to * stride );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable\n\tvalidate() {\n\n\t\tlet valid = true;\n\n\t\tconst valueSize = this.getValueSize();\n\t\tif ( valueSize - Math.floor( valueSize ) !== 0 ) {\n\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Invalid value size in track.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tconst times = this.times,\n\t\t\tvalues = this.values,\n\n\t\t\tnKeys = times.length;\n\n\t\tif ( nKeys === 0 ) {\n\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Track is empty.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tlet prevTime = null;\n\n\t\tfor ( let i = 0; i !== nKeys; i ++ ) {\n\n\t\t\tconst currTime = times[ i ];\n\n\t\t\tif ( typeof currTime === 'number' && isNaN( currTime ) ) {\n\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tif ( prevTime !== null && prevTime > currTime ) {\n\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Out of order keys.', this, i, currTime, prevTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tprevTime = currTime;\n\n\t\t}\n\n\t\tif ( values !== undefined ) {\n\n\t\t\tif ( isTypedArray( values ) ) {\n\n\t\t\t\tfor ( let i = 0, n = values.length; i !== n; ++ i ) {\n\n\t\t\t\t\tconst value = values[ i ];\n\n\t\t\t\t\tif ( isNaN( value ) ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Value is not a valid number.', this, i, value );\n\t\t\t\t\t\tvalid = false;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn valid;\n\n\t}\n\n\t// removes equivalent sequential keys as common in morph target sequences\n\t// (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --\x3e (0,0,1,1,0,0)\n\toptimize() {\n\n\t\t// times or values may be shared with other tracks, so overwriting is unsafe\n\t\tconst times = this.times.slice(),\n\t\t\tvalues = this.values.slice(),\n\t\t\tstride = this.getValueSize(),\n\n\t\t\tsmoothInterpolation = this.getInterpolation() === InterpolateSmooth,\n\n\t\t\tlastIndex = times.length - 1;\n\n\t\tlet writeIndex = 1;\n\n\t\tfor ( let i = 1; i < lastIndex; ++ i ) {\n\n\t\t\tlet keep = false;\n\n\t\t\tconst time = times[ i ];\n\t\t\tconst timeNext = times[ i + 1 ];\n\n\t\t\t// remove adjacent keyframes scheduled at the same time\n\n\t\t\tif ( time !== timeNext && ( i !== 1 || time !== times[ 0 ] ) ) {\n\n\t\t\t\tif ( ! smoothInterpolation ) {\n\n\t\t\t\t\t// remove unnecessary keyframes same as their neighbors\n\n\t\t\t\t\tconst offset = i * stride,\n\t\t\t\t\t\toffsetP = offset - stride,\n\t\t\t\t\t\toffsetN = offset + stride;\n\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tconst value = values[ offset + j ];\n\n\t\t\t\t\t\tif ( value !== values[ offsetP + j ] ||\n\t\t\t\t\t\t\tvalue !== values[ offsetN + j ] ) {\n\n\t\t\t\t\t\t\tkeep = true;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tkeep = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// in-place compaction\n\n\t\t\tif ( keep ) {\n\n\t\t\t\tif ( i !== writeIndex ) {\n\n\t\t\t\t\ttimes[ writeIndex ] = times[ i ];\n\n\t\t\t\t\tconst readOffset = i * stride,\n\t\t\t\t\t\twriteOffset = writeIndex * stride;\n\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t++ writeIndex;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// flush last keyframe (compaction looks ahead)\n\n\t\tif ( lastIndex > 0 ) {\n\n\t\t\ttimes[ writeIndex ] = times[ lastIndex ];\n\n\t\t\tfor ( let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++ j ) {\n\n\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t}\n\n\t\t\t++ writeIndex;\n\n\t\t}\n\n\t\tif ( writeIndex !== times.length ) {\n\n\t\t\tthis.times = times.slice( 0, writeIndex );\n\t\t\tthis.values = values.slice( 0, writeIndex * stride );\n\n\t\t} else {\n\n\t\t\tthis.times = times;\n\t\t\tthis.values = values;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\tconst times = this.times.slice();\n\t\tconst values = this.values.slice();\n\n\t\tconst TypedKeyframeTrack = this.constructor;\n\t\tconst track = new TypedKeyframeTrack( this.name, times, values );\n\n\t\t// Interpolant argument to constructor is not saved, so copy the factory method directly.\n\t\ttrack.createInterpolant = this.createInterpolant;\n\n\t\treturn track;\n\n\t}\n\n}\n\nKeyframeTrack.prototype.TimeBufferType = Float32Array;\nKeyframeTrack.prototype.ValueBufferType = Float32Array;\nKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;\n\n/**\n * A Track of Boolean keyframe values.\n */\nclass BooleanKeyframeTrack extends KeyframeTrack {\n\n\t// No interpolation parameter because only InterpolateDiscrete is valid.\n\tconstructor( name, times, values ) {\n\n\t\tsuper( name, times, values );\n\n\t}\n\n}\n\nBooleanKeyframeTrack.prototype.ValueTypeName = 'bool';\nBooleanKeyframeTrack.prototype.ValueBufferType = Array;\nBooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track of keyframe values that represent color.\n */\nclass ColorKeyframeTrack extends KeyframeTrack {}\n\nColorKeyframeTrack.prototype.ValueTypeName = 'color';\n\n/**\n * A Track of numeric keyframe values.\n */\nclass NumberKeyframeTrack extends KeyframeTrack {}\n\nNumberKeyframeTrack.prototype.ValueTypeName = 'number';\n\n/**\n * Spherical linear unit quaternion interpolant.\n */\n\nclass QuaternionLinearInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\talpha = ( t - t0 ) / ( t1 - t0 );\n\n\t\tlet offset = i1 * stride;\n\n\t\tfor ( let end = offset + stride; offset !== end; offset += 4 ) {\n\n\t\t\tQuaternion.slerpFlat( result, 0, values, offset - stride, values, offset, alpha );\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n * A Track of quaternion keyframe values.\n */\nclass QuaternionKeyframeTrack extends KeyframeTrack {\n\n\tInterpolantFactoryMethodLinear( result ) {\n\n\t\treturn new QuaternionLinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n}\n\nQuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion';\n// ValueBufferType is inherited\n// DefaultInterpolation is inherited;\nQuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track that interpolates Strings\n */\nclass StringKeyframeTrack extends KeyframeTrack {\n\n\t// No interpolation parameter because only InterpolateDiscrete is valid.\n\tconstructor( name, times, values ) {\n\n\t\tsuper( name, times, values );\n\n\t}\n\n}\n\nStringKeyframeTrack.prototype.ValueTypeName = 'string';\nStringKeyframeTrack.prototype.ValueBufferType = Array;\nStringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track of vectored keyframe values.\n */\nclass VectorKeyframeTrack extends KeyframeTrack {}\n\nVectorKeyframeTrack.prototype.ValueTypeName = 'vector';\n\nclass AnimationClip {\n\n\tconstructor( name = '', duration = - 1, tracks = [], blendMode = NormalAnimationBlendMode ) {\n\n\t\tthis.name = name;\n\t\tthis.tracks = tracks;\n\t\tthis.duration = duration;\n\t\tthis.blendMode = blendMode;\n\n\t\tthis.uuid = generateUUID();\n\n\t\t// this means it should figure out its duration by scanning the tracks\n\t\tif ( this.duration < 0 ) {\n\n\t\t\tthis.resetDuration();\n\n\t\t}\n\n\t}\n\n\n\tstatic parse( json ) {\n\n\t\tconst tracks = [],\n\t\t\tjsonTracks = json.tracks,\n\t\t\tframeTime = 1.0 / ( json.fps || 1.0 );\n\n\t\tfor ( let i = 0, n = jsonTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( parseKeyframeTrack( jsonTracks[ i ] ).scale( frameTime ) );\n\n\t\t}\n\n\t\tconst clip = new this( json.name, json.duration, tracks, json.blendMode );\n\t\tclip.uuid = json.uuid;\n\n\t\treturn clip;\n\n\t}\n\n\tstatic toJSON( clip ) {\n\n\t\tconst tracks = [],\n\t\t\tclipTracks = clip.tracks;\n\n\t\tconst json = {\n\n\t\t\t'name': clip.name,\n\t\t\t'duration': clip.duration,\n\t\t\t'tracks': tracks,\n\t\t\t'uuid': clip.uuid,\n\t\t\t'blendMode': clip.blendMode\n\n\t\t};\n\n\t\tfor ( let i = 0, n = clipTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( KeyframeTrack.toJSON( clipTracks[ i ] ) );\n\n\t\t}\n\n\t\treturn json;\n\n\t}\n\n\tstatic CreateFromMorphTargetSequence( name, morphTargetSequence, fps, noLoop ) {\n\n\t\tconst numMorphTargets = morphTargetSequence.length;\n\t\tconst tracks = [];\n\n\t\tfor ( let i = 0; i < numMorphTargets; i ++ ) {\n\n\t\t\tlet times = [];\n\t\t\tlet values = [];\n\n\t\t\ttimes.push(\n\t\t\t\t( i + numMorphTargets - 1 ) % numMorphTargets,\n\t\t\t\ti,\n\t\t\t\t( i + 1 ) % numMorphTargets );\n\n\t\t\tvalues.push( 0, 1, 0 );\n\n\t\t\tconst order = getKeyframeOrder( times );\n\t\t\ttimes = sortedArray( times, 1, order );\n\t\t\tvalues = sortedArray( values, 1, order );\n\n\t\t\t// if there is a key at the first frame, duplicate it as the\n\t\t\t// last frame as well for perfect loop.\n\t\t\tif ( ! noLoop && times[ 0 ] === 0 ) {\n\n\t\t\t\ttimes.push( numMorphTargets );\n\t\t\t\tvalues.push( values[ 0 ] );\n\n\t\t\t}\n\n\t\t\ttracks.push(\n\t\t\t\tnew NumberKeyframeTrack(\n\t\t\t\t\t'.morphTargetInfluences[' + morphTargetSequence[ i ].name + ']',\n\t\t\t\t\ttimes, values\n\t\t\t\t).scale( 1.0 / fps ) );\n\n\t\t}\n\n\t\treturn new this( name, - 1, tracks );\n\n\t}\n\n\tstatic findByName( objectOrClipArray, name ) {\n\n\t\tlet clipArray = objectOrClipArray;\n\n\t\tif ( ! Array.isArray( objectOrClipArray ) ) {\n\n\t\t\tconst o = objectOrClipArray;\n\t\t\tclipArray = o.geometry && o.geometry.animations || o.animations;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < clipArray.length; i ++ ) {\n\n\t\t\tif ( clipArray[ i ].name === name ) {\n\n\t\t\t\treturn clipArray[ i ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\tstatic CreateClipsFromMorphTargetSequences( morphTargets, fps, noLoop ) {\n\n\t\tconst animationToMorphTargets = {};\n\n\t\t// tested with https://regex101.com/ on trick sequences\n\t\t// such flamingo_flyA_003, flamingo_run1_003, crdeath0059\n\t\tconst pattern = /^([\\w-]*?)([\\d]+)$/;\n\n\t\t// sort morph target names into animation groups based\n\t\t// patterns like Walk_001, Walk_002, Run_001, Run_002\n\t\tfor ( let i = 0, il = morphTargets.length; i < il; i ++ ) {\n\n\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\tconst parts = morphTarget.name.match( pattern );\n\n\t\t\tif ( parts && parts.length > 1 ) {\n\n\t\t\t\tconst name = parts[ 1 ];\n\n\t\t\t\tlet animationMorphTargets = animationToMorphTargets[ name ];\n\n\t\t\t\tif ( ! animationMorphTargets ) {\n\n\t\t\t\t\tanimationToMorphTargets[ name ] = animationMorphTargets = [];\n\n\t\t\t\t}\n\n\t\t\t\tanimationMorphTargets.push( morphTarget );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst clips = [];\n\n\t\tfor ( const name in animationToMorphTargets ) {\n\n\t\t\tclips.push( this.CreateFromMorphTargetSequence( name, animationToMorphTargets[ name ], fps, noLoop ) );\n\n\t\t}\n\n\t\treturn clips;\n\n\t}\n\n\t// parse the animation.hierarchy format\n\tstatic parseAnimation( animation, bones ) {\n\n\t\tif ( ! animation ) {\n\n\t\t\tconsole.error( 'THREE.AnimationClip: No animation in JSONLoader data.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) {\n\n\t\t\t// only return track if there are actually keys.\n\t\t\tif ( animationKeys.length !== 0 ) {\n\n\t\t\t\tconst times = [];\n\t\t\t\tconst values = [];\n\n\t\t\t\tflattenJSON( animationKeys, times, values, propertyName );\n\n\t\t\t\t// empty keys are filtered out, so check again\n\t\t\t\tif ( times.length !== 0 ) {\n\n\t\t\t\t\tdestTracks.push( new trackType( trackName, times, values ) );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tconst tracks = [];\n\n\t\tconst clipName = animation.name || 'default';\n\t\tconst fps = animation.fps || 30;\n\t\tconst blendMode = animation.blendMode;\n\n\t\t// automatic length determination in AnimationClip.\n\t\tlet duration = animation.length || - 1;\n\n\t\tconst hierarchyTracks = animation.hierarchy || [];\n\n\t\tfor ( let h = 0; h < hierarchyTracks.length; h ++ ) {\n\n\t\t\tconst animationKeys = hierarchyTracks[ h ].keys;\n\n\t\t\t// skip empty tracks\n\t\t\tif ( ! animationKeys || animationKeys.length === 0 ) continue;\n\n\t\t\t// process morph targets\n\t\t\tif ( animationKeys[ 0 ].morphTargets ) {\n\n\t\t\t\t// figure out all morph targets used in this track\n\t\t\t\tconst morphTargetNames = {};\n\n\t\t\t\tlet k;\n\n\t\t\t\tfor ( k = 0; k < animationKeys.length; k ++ ) {\n\n\t\t\t\t\tif ( animationKeys[ k ].morphTargets ) {\n\n\t\t\t\t\t\tfor ( let m = 0; m < animationKeys[ k ].morphTargets.length; m ++ ) {\n\n\t\t\t\t\t\t\tmorphTargetNames[ animationKeys[ k ].morphTargets[ m ] ] = - 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// create a track for each morph target with all zero\n\t\t\t\t// morphTargetInfluences except for the keys in which\n\t\t\t\t// the morphTarget is named.\n\t\t\t\tfor ( const morphTargetName in morphTargetNames ) {\n\n\t\t\t\t\tconst times = [];\n\t\t\t\t\tconst values = [];\n\n\t\t\t\t\tfor ( let m = 0; m !== animationKeys[ k ].morphTargets.length; ++ m ) {\n\n\t\t\t\t\t\tconst animationKey = animationKeys[ k ];\n\n\t\t\t\t\t\ttimes.push( animationKey.time );\n\t\t\t\t\t\tvalues.push( ( animationKey.morphTarget === morphTargetName ) ? 1 : 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttracks.push( new NumberKeyframeTrack( '.morphTargetInfluence[' + morphTargetName + ']', times, values ) );\n\n\t\t\t\t}\n\n\t\t\t\tduration = morphTargetNames.length * fps;\n\n\t\t\t} else {\n\n\t\t\t\t// ...assume skeletal animation\n\n\t\t\t\tconst boneName = '.bones[' + bones[ h ].name + ']';\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.position',\n\t\t\t\t\tanimationKeys, 'pos', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tQuaternionKeyframeTrack, boneName + '.quaternion',\n\t\t\t\t\tanimationKeys, 'rot', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.scale',\n\t\t\t\t\tanimationKeys, 'scl', tracks );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tracks.length === 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst clip = new this( clipName, duration, tracks, blendMode );\n\n\t\treturn clip;\n\n\t}\n\n\tresetDuration() {\n\n\t\tconst tracks = this.tracks;\n\t\tlet duration = 0;\n\n\t\tfor ( let i = 0, n = tracks.length; i !== n; ++ i ) {\n\n\t\t\tconst track = this.tracks[ i ];\n\n\t\t\tduration = Math.max( duration, track.times[ track.times.length - 1 ] );\n\n\t\t}\n\n\t\tthis.duration = duration;\n\n\t\treturn this;\n\n\t}\n\n\ttrim() {\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].trim( 0, this.duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tvalidate() {\n\n\t\tlet valid = true;\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tvalid = valid && this.tracks[ i ].validate();\n\n\t\t}\n\n\t\treturn valid;\n\n\t}\n\n\toptimize() {\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].optimize();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\tconst tracks = [];\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\ttracks.push( this.tracks[ i ].clone() );\n\n\t\t}\n\n\t\treturn new this.constructor( this.name, this.duration, tracks, this.blendMode );\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.constructor.toJSON( this );\n\n\t}\n\n}\n\nfunction getTrackTypeForValueTypeName( typeName ) {\n\n\tswitch ( typeName.toLowerCase() ) {\n\n\t\tcase 'scalar':\n\t\tcase 'double':\n\t\tcase 'float':\n\t\tcase 'number':\n\t\tcase 'integer':\n\n\t\t\treturn NumberKeyframeTrack;\n\n\t\tcase 'vector':\n\t\tcase 'vector2':\n\t\tcase 'vector3':\n\t\tcase 'vector4':\n\n\t\t\treturn VectorKeyframeTrack;\n\n\t\tcase 'color':\n\n\t\t\treturn ColorKeyframeTrack;\n\n\t\tcase 'quaternion':\n\n\t\t\treturn QuaternionKeyframeTrack;\n\n\t\tcase 'bool':\n\t\tcase 'boolean':\n\n\t\t\treturn BooleanKeyframeTrack;\n\n\t\tcase 'string':\n\n\t\t\treturn StringKeyframeTrack;\n\n\t}\n\n\tthrow new Error( 'THREE.KeyframeTrack: Unsupported typeName: ' + typeName );\n\n}\n\nfunction parseKeyframeTrack( json ) {\n\n\tif ( json.type === undefined ) {\n\n\t\tthrow new Error( 'THREE.KeyframeTrack: track type undefined, can not parse' );\n\n\t}\n\n\tconst trackType = getTrackTypeForValueTypeName( json.type );\n\n\tif ( json.times === undefined ) {\n\n\t\tconst times = [], values = [];\n\n\t\tflattenJSON( json.keys, times, values, 'value' );\n\n\t\tjson.times = times;\n\t\tjson.values = values;\n\n\t}\n\n\t// derived classes can define a static parse method\n\tif ( trackType.parse !== undefined ) {\n\n\t\treturn trackType.parse( json );\n\n\t} else {\n\n\t\t// by default, we assume a constructor compatible with the base\n\t\treturn new trackType( json.name, json.times, json.values, json.interpolation );\n\n\t}\n\n}\n\nconst Cache = {\n\n\tenabled: false,\n\n\tfiles: {},\n\n\tadd: function ( key, file ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Adding key:', key );\n\n\t\tthis.files[ key ] = file;\n\n\t},\n\n\tget: function ( key ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Checking key:', key );\n\n\t\treturn this.files[ key ];\n\n\t},\n\n\tremove: function ( key ) {\n\n\t\tdelete this.files[ key ];\n\n\t},\n\n\tclear: function () {\n\n\t\tthis.files = {};\n\n\t}\n\n};\n\nclass LoadingManager {\n\n\tconstructor( onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tlet isLoading = false;\n\t\tlet itemsLoaded = 0;\n\t\tlet itemsTotal = 0;\n\t\tlet urlModifier = undefined;\n\t\tconst handlers = [];\n\n\t\t// Refer to #5689 for the reason why we don't set .onStart\n\t\t// in the constructor\n\n\t\tthis.onStart = undefined;\n\t\tthis.onLoad = onLoad;\n\t\tthis.onProgress = onProgress;\n\t\tthis.onError = onError;\n\n\t\tthis.itemStart = function ( url ) {\n\n\t\t\titemsTotal ++;\n\n\t\t\tif ( isLoading === false ) {\n\n\t\t\t\tif ( scope.onStart !== undefined ) {\n\n\t\t\t\t\tscope.onStart( url, itemsLoaded, itemsTotal );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tisLoading = true;\n\n\t\t};\n\n\t\tthis.itemEnd = function ( url ) {\n\n\t\t\titemsLoaded ++;\n\n\t\t\tif ( scope.onProgress !== undefined ) {\n\n\t\t\t\tscope.onProgress( url, itemsLoaded, itemsTotal );\n\n\t\t\t}\n\n\t\t\tif ( itemsLoaded === itemsTotal ) {\n\n\t\t\t\tisLoading = false;\n\n\t\t\t\tif ( scope.onLoad !== undefined ) {\n\n\t\t\t\t\tscope.onLoad();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.itemError = function ( url ) {\n\n\t\t\tif ( scope.onError !== undefined ) {\n\n\t\t\t\tscope.onError( url );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.resolveURL = function ( url ) {\n\n\t\t\tif ( urlModifier ) {\n\n\t\t\t\treturn urlModifier( url );\n\n\t\t\t}\n\n\t\t\treturn url;\n\n\t\t};\n\n\t\tthis.setURLModifier = function ( transform ) {\n\n\t\t\turlModifier = transform;\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.addHandler = function ( regex, loader ) {\n\n\t\t\thandlers.push( regex, loader );\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.removeHandler = function ( regex ) {\n\n\t\t\tconst index = handlers.indexOf( regex );\n\n\t\t\tif ( index !== - 1 ) {\n\n\t\t\t\thandlers.splice( index, 2 );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.getHandler = function ( file ) {\n\n\t\t\tfor ( let i = 0, l = handlers.length; i < l; i += 2 ) {\n\n\t\t\t\tconst regex = handlers[ i ];\n\t\t\t\tconst loader = handlers[ i + 1 ];\n\n\t\t\t\tif ( regex.global ) regex.lastIndex = 0; // see #17920\n\n\t\t\t\tif ( regex.test( file ) ) {\n\n\t\t\t\t\treturn loader;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn null;\n\n\t\t};\n\n\t}\n\n}\n\nconst DefaultLoadingManager = /*@__PURE__*/ new LoadingManager();\n\nclass Loader {\n\n\tconstructor( manager ) {\n\n\t\tthis.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;\n\n\t\tthis.crossOrigin = 'anonymous';\n\t\tthis.withCredentials = false;\n\t\tthis.path = '';\n\t\tthis.resourcePath = '';\n\t\tthis.requestHeader = {};\n\n\t}\n\n\tload( /* url, onLoad, onProgress, onError */ ) {}\n\n\tloadAsync( url, onProgress ) {\n\n\t\tconst scope = this;\n\n\t\treturn new Promise( function ( resolve, reject ) {\n\n\t\t\tscope.load( url, resolve, onProgress, reject );\n\n\t\t} );\n\n\t}\n\n\tparse( /* data */ ) {}\n\n\tsetCrossOrigin( crossOrigin ) {\n\n\t\tthis.crossOrigin = crossOrigin;\n\t\treturn this;\n\n\t}\n\n\tsetWithCredentials( value ) {\n\n\t\tthis.withCredentials = value;\n\t\treturn this;\n\n\t}\n\n\tsetPath( path ) {\n\n\t\tthis.path = path;\n\t\treturn this;\n\n\t}\n\n\tsetResourcePath( resourcePath ) {\n\n\t\tthis.resourcePath = resourcePath;\n\t\treturn this;\n\n\t}\n\n\tsetRequestHeader( requestHeader ) {\n\n\t\tthis.requestHeader = requestHeader;\n\t\treturn this;\n\n\t}\n\n}\n\nLoader.DEFAULT_MATERIAL_NAME = '__DEFAULT';\n\nconst loading = {};\n\nclass HttpError extends Error {\n\n\tconstructor( message, response ) {\n\n\t\tsuper( message );\n\t\tthis.response = response;\n\n\t}\n\n}\n\nclass FileLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tthis.manager.itemStart( url );\n\n\t\t\tsetTimeout( () => {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tthis.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\t// Check if request is duplicate\n\n\t\tif ( loading[ url ] !== undefined ) {\n\n\t\t\tloading[ url ].push( {\n\n\t\t\t\tonLoad: onLoad,\n\t\t\t\tonProgress: onProgress,\n\t\t\t\tonError: onError\n\n\t\t\t} );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// Initialise array for duplicate requests\n\t\tloading[ url ] = [];\n\n\t\tloading[ url ].push( {\n\t\t\tonLoad: onLoad,\n\t\t\tonProgress: onProgress,\n\t\t\tonError: onError,\n\t\t} );\n\n\t\t// create request\n\t\tconst req = new Request( url, {\n\t\t\theaders: new Headers( this.requestHeader ),\n\t\t\tcredentials: this.withCredentials ? 'include' : 'same-origin',\n\t\t\t// An abort controller could be added within a future PR\n\t\t} );\n\n\t\t// record states ( avoid data race )\n\t\tconst mimeType = this.mimeType;\n\t\tconst responseType = this.responseType;\n\n\t\t// start the fetch\n\t\tfetch( req )\n\t\t\t.then( response => {\n\n\t\t\t\tif ( response.status === 200 || response.status === 0 ) {\n\n\t\t\t\t\t// Some browsers return HTTP Status 0 when using non-http protocol\n\t\t\t\t\t// e.g. 'file://' or 'data://'. Handle as success.\n\n\t\t\t\t\tif ( response.status === 0 ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.FileLoader: HTTP Status 0 received.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Workaround: Checking if response.body === undefined for Alipay browser #23548\n\n\t\t\t\t\tif ( typeof ReadableStream === 'undefined' || response.body === undefined || response.body.getReader === undefined ) {\n\n\t\t\t\t\t\treturn response;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst callbacks = loading[ url ];\n\t\t\t\t\tconst reader = response.body.getReader();\n\n\t\t\t\t\t// Nginx needs X-File-Size check\n\t\t\t\t\t// https://serverfault.com/questions/482875/why-does-nginx-remove-content-length-header-for-chunked-content\n\t\t\t\t\tconst contentLength = response.headers.get( 'X-File-Size' ) || response.headers.get( 'Content-Length' );\n\t\t\t\t\tconst total = contentLength ? parseInt( contentLength ) : 0;\n\t\t\t\t\tconst lengthComputable = total !== 0;\n\t\t\t\t\tlet loaded = 0;\n\n\t\t\t\t\t// periodically read data into the new stream tracking while download progress\n\t\t\t\t\tconst stream = new ReadableStream( {\n\t\t\t\t\t\tstart( controller ) {\n\n\t\t\t\t\t\t\treadData();\n\n\t\t\t\t\t\t\tfunction readData() {\n\n\t\t\t\t\t\t\t\treader.read().then( ( { done, value } ) => {\n\n\t\t\t\t\t\t\t\t\tif ( done ) {\n\n\t\t\t\t\t\t\t\t\t\tcontroller.close();\n\n\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\t\tloaded += value.byteLength;\n\n\t\t\t\t\t\t\t\t\t\tconst event = new ProgressEvent( 'progress', { lengthComputable, loaded, total } );\n\t\t\t\t\t\t\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\t\t\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\t\t\t\t\t\t\tif ( callback.onProgress ) callback.onProgress( event );\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tcontroller.enqueue( value );\n\t\t\t\t\t\t\t\t\t\treadData();\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}, ( e ) => {\n\n\t\t\t\t\t\t\t\t\tcontroller.error( e );\n\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn new Response( stream );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new HttpError( `fetch for \"${response.url}\" responded with ${response.status}: ${response.statusText}`, response );\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.then( response => {\n\n\t\t\t\tswitch ( responseType ) {\n\n\t\t\t\t\tcase 'arraybuffer':\n\n\t\t\t\t\t\treturn response.arrayBuffer();\n\n\t\t\t\t\tcase 'blob':\n\n\t\t\t\t\t\treturn response.blob();\n\n\t\t\t\t\tcase 'document':\n\n\t\t\t\t\t\treturn response.text()\n\t\t\t\t\t\t\t.then( text => {\n\n\t\t\t\t\t\t\t\tconst parser = new DOMParser();\n\t\t\t\t\t\t\t\treturn parser.parseFromString( text, mimeType );\n\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\tcase 'json':\n\n\t\t\t\t\t\treturn response.json();\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tif ( mimeType === undefined ) {\n\n\t\t\t\t\t\t\treturn response.text();\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// sniff encoding\n\t\t\t\t\t\t\tconst re = /charset=\"?([^;\"\\s]*)\"?/i;\n\t\t\t\t\t\t\tconst exec = re.exec( mimeType );\n\t\t\t\t\t\t\tconst label = exec && exec[ 1 ] ? exec[ 1 ].toLowerCase() : undefined;\n\t\t\t\t\t\t\tconst decoder = new TextDecoder( label );\n\t\t\t\t\t\t\treturn response.arrayBuffer().then( ab => decoder.decode( ab ) );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.then( data => {\n\n\t\t\t\t// Add to cache only on HTTP success, so that we do not cache\n\t\t\t\t// error response bodies as proper responses to requests.\n\t\t\t\tCache.add( url, data );\n\n\t\t\t\tconst callbacks = loading[ url ];\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onLoad ) callback.onLoad( data );\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.catch( err => {\n\n\t\t\t\t// Abort errors and other errors are handled the same\n\n\t\t\t\tconst callbacks = loading[ url ];\n\n\t\t\t\tif ( callbacks === undefined ) {\n\n\t\t\t\t\t// When onLoad was called and url was deleted in `loading`\n\t\t\t\t\tthis.manager.itemError( url );\n\t\t\t\t\tthrow err;\n\n\t\t\t\t}\n\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onError ) callback.onError( err );\n\n\t\t\t\t}\n\n\t\t\t\tthis.manager.itemError( url );\n\n\t\t\t} )\n\t\t\t.finally( () => {\n\n\t\t\t\tthis.manager.itemEnd( url );\n\n\t\t\t} );\n\n\t\tthis.manager.itemStart( url );\n\n\t}\n\n\tsetResponseType( value ) {\n\n\t\tthis.responseType = value;\n\t\treturn this;\n\n\t}\n\n\tsetMimeType( value ) {\n\n\t\tthis.mimeType = value;\n\t\treturn this;\n\n\t}\n\n}\n\nclass AnimationLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst animations = [];\n\n\t\tfor ( let i = 0; i < json.length; i ++ ) {\n\n\t\t\tconst clip = AnimationClip.parse( json[ i ] );\n\n\t\t\tanimations.push( clip );\n\n\t\t}\n\n\t\treturn animations;\n\n\t}\n\n}\n\n/**\n * Abstract Base class to block based textures loader (dds, pvr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\n\nclass CompressedTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst images = [];\n\n\t\tconst texture = new CompressedTexture();\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\n\t\tlet loaded = 0;\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( url[ i ], function ( buffer ) {\n\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\n\n\t\t\t\timages[ i ] = {\n\t\t\t\t\twidth: texDatas.width,\n\t\t\t\t\theight: texDatas.height,\n\t\t\t\t\tformat: texDatas.format,\n\t\t\t\t\tmipmaps: texDatas.mipmaps\n\t\t\t\t};\n\n\t\t\t\tloaded += 1;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\tif ( texDatas.mipmapCount === 1 ) texture.minFilter = LinearFilter;\n\n\t\t\t\t\ttexture.image = images;\n\t\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\tif ( Array.isArray( url ) ) {\n\n\t\t\tfor ( let i = 0, il = url.length; i < il; ++ i ) {\n\n\t\t\t\tloadTexture( i );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// compressed cubemap texture stored in a single DDS file\n\n\t\t\tloader.load( url, function ( buffer ) {\n\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\n\n\t\t\t\tif ( texDatas.isCubemap ) {\n\n\t\t\t\t\tconst faces = texDatas.mipmaps.length / texDatas.mipmapCount;\n\n\t\t\t\t\tfor ( let f = 0; f < faces; f ++ ) {\n\n\t\t\t\t\t\timages[ f ] = { mipmaps: [] };\n\n\t\t\t\t\t\tfor ( let i = 0; i < texDatas.mipmapCount; i ++ ) {\n\n\t\t\t\t\t\t\timages[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] );\n\t\t\t\t\t\t\timages[ f ].format = texDatas.format;\n\t\t\t\t\t\t\timages[ f ].width = texDatas.width;\n\t\t\t\t\t\t\timages[ f ].height = texDatas.height;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.image = images;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttexture.image.width = texDatas.width;\n\t\t\t\t\ttexture.image.height = texDatas.height;\n\t\t\t\t\ttexture.mipmaps = texDatas.mipmaps;\n\n\t\t\t\t}\n\n\t\t\t\tif ( texDatas.mipmapCount === 1 ) {\n\n\t\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t\t}\n\n\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass ImageLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst scope = this;\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tconst image = createElementNS( 'img' );\n\n\t\tfunction onImageLoad() {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tCache.add( url, this );\n\n\t\t\tif ( onLoad ) onLoad( this );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction onImageError( event ) {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tif ( onError ) onError( event );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction removeEventListeners() {\n\n\t\t\timage.removeEventListener( 'load', onImageLoad, false );\n\t\t\timage.removeEventListener( 'error', onImageError, false );\n\n\t\t}\n\n\t\timage.addEventListener( 'load', onImageLoad, false );\n\t\timage.addEventListener( 'error', onImageError, false );\n\n\t\tif ( url.slice( 0, 5 ) !== 'data:' ) {\n\n\t\t\tif ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;\n\n\t\t}\n\n\t\tscope.manager.itemStart( url );\n\n\t\timage.src = url;\n\n\t\treturn image;\n\n\t}\n\n}\n\nclass CubeTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( urls, onLoad, onProgress, onError ) {\n\n\t\tconst texture = new CubeTexture();\n\t\ttexture.colorSpace = SRGBColorSpace;\n\n\t\tconst loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tlet loaded = 0;\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( urls[ i ], function ( image ) {\n\n\t\t\t\ttexture.images[ i ] = image;\n\n\t\t\t\tloaded ++;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, undefined, onError );\n\n\t\t}\n\n\t\tfor ( let i = 0; i < urls.length; ++ i ) {\n\n\t\t\tloadTexture( i );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n}\n\n/**\n * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\n\nclass DataTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst texture = new DataTexture();\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setPath( this.path );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\tlet texData;\n\n\t\t\ttry {\n\n\t\t\t\ttexData = scope.parse( buffer );\n\n\t\t\t} catch ( error ) {\n\n\t\t\t\tif ( onError !== undefined ) {\n\n\t\t\t\t\tonError( error );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( error );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( texData.image !== undefined ) {\n\n\t\t\t\ttexture.image = texData.image;\n\n\t\t\t} else if ( texData.data !== undefined ) {\n\n\t\t\t\ttexture.image.width = texData.width;\n\t\t\t\ttexture.image.height = texData.height;\n\t\t\t\ttexture.image.data = texData.data;\n\n\t\t\t}\n\n\t\t\ttexture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;\n\t\t\ttexture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;\n\n\t\t\ttexture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;\n\t\t\ttexture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;\n\n\t\t\ttexture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;\n\n\t\t\tif ( texData.colorSpace !== undefined ) {\n\n\t\t\t\ttexture.colorSpace = texData.colorSpace;\n\n\t\t\t}\n\n\t\t\tif ( texData.flipY !== undefined ) {\n\n\t\t\t\ttexture.flipY = texData.flipY;\n\n\t\t\t}\n\n\t\t\tif ( texData.format !== undefined ) {\n\n\t\t\t\ttexture.format = texData.format;\n\n\t\t\t}\n\n\t\t\tif ( texData.type !== undefined ) {\n\n\t\t\t\ttexture.type = texData.type;\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmaps !== undefined ) {\n\n\t\t\t\ttexture.mipmaps = texData.mipmaps;\n\t\t\t\ttexture.minFilter = LinearMipmapLinearFilter; // presumably...\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmapCount === 1 ) {\n\n\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t}\n\n\t\t\tif ( texData.generateMipmaps !== undefined ) {\n\n\t\t\t\ttexture.generateMipmaps = texData.generateMipmaps;\n\n\t\t\t}\n\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad ) onLoad( texture, texData );\n\n\t\t}, onProgress, onError );\n\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass TextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst texture = new Texture();\n\n\t\tconst loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tloader.load( url, function ( image ) {\n\n\t\t\ttexture.image = image;\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad !== undefined ) {\n\n\t\t\t\tonLoad( texture );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass Light extends Object3D {\n\n\tconstructor( color, intensity = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.isLight = true;\n\n\t\tthis.type = 'Light';\n\n\t\tthis.color = new Color( color );\n\t\tthis.intensity = intensity;\n\n\t}\n\n\tdispose() {\n\n\t\t// Empty here in base class; some subclasses override.\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.intensity = source.intensity;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.color = this.color.getHex();\n\t\tdata.object.intensity = this.intensity;\n\n\t\tif ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex();\n\n\t\tif ( this.distance !== undefined ) data.object.distance = this.distance;\n\t\tif ( this.angle !== undefined ) data.object.angle = this.angle;\n\t\tif ( this.decay !== undefined ) data.object.decay = this.decay;\n\t\tif ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra;\n\n\t\tif ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON();\n\t\tif ( this.target !== undefined ) data.object.target = this.target.uuid;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass HemisphereLight extends Light {\n\n\tconstructor( skyColor, groundColor, intensity ) {\n\n\t\tsuper( skyColor, intensity );\n\n\t\tthis.isHemisphereLight = true;\n\n\t\tthis.type = 'HemisphereLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.groundColor = new Color( groundColor );\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.groundColor.copy( source.groundColor );\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _projScreenMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _lightPositionWorld$1 = /*@__PURE__*/ new Vector3();\nconst _lookTarget$1 = /*@__PURE__*/ new Vector3();\n\nclass LightShadow {\n\n\tconstructor( camera ) {\n\n\t\tthis.camera = camera;\n\n\t\tthis.intensity = 1;\n\n\t\tthis.bias = 0;\n\t\tthis.normalBias = 0;\n\t\tthis.radius = 1;\n\t\tthis.blurSamples = 8;\n\n\t\tthis.mapSize = new Vector2( 512, 512 );\n\n\t\tthis.map = null;\n\t\tthis.mapPass = null;\n\t\tthis.matrix = new Matrix4();\n\n\t\tthis.autoUpdate = true;\n\t\tthis.needsUpdate = false;\n\n\t\tthis._frustum = new Frustum();\n\t\tthis._frameExtents = new Vector2( 1, 1 );\n\n\t\tthis._viewportCount = 1;\n\n\t\tthis._viewports = [\n\n\t\t\tnew Vector4( 0, 0, 1, 1 )\n\n\t\t];\n\n\t}\n\n\tgetViewportCount() {\n\n\t\treturn this._viewportCount;\n\n\t}\n\n\tgetFrustum() {\n\n\t\treturn this._frustum;\n\n\t}\n\n\tupdateMatrices( light ) {\n\n\t\tconst shadowCamera = this.camera;\n\t\tconst shadowMatrix = this.matrix;\n\n\t\t_lightPositionWorld$1.setFromMatrixPosition( light.matrixWorld );\n\t\tshadowCamera.position.copy( _lightPositionWorld$1 );\n\n\t\t_lookTarget$1.setFromMatrixPosition( light.target.matrixWorld );\n\t\tshadowCamera.lookAt( _lookTarget$1 );\n\t\tshadowCamera.updateMatrixWorld();\n\n\t\t_projScreenMatrix$1.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );\n\t\tthis._frustum.setFromProjectionMatrix( _projScreenMatrix$1 );\n\n\t\tshadowMatrix.set(\n\t\t\t0.5, 0.0, 0.0, 0.5,\n\t\t\t0.0, 0.5, 0.0, 0.5,\n\t\t\t0.0, 0.0, 0.5, 0.5,\n\t\t\t0.0, 0.0, 0.0, 1.0\n\t\t);\n\n\t\tshadowMatrix.multiply( _projScreenMatrix$1 );\n\n\t}\n\n\tgetViewport( viewportIndex ) {\n\n\t\treturn this._viewports[ viewportIndex ];\n\n\t}\n\n\tgetFrameExtents() {\n\n\t\treturn this._frameExtents;\n\n\t}\n\n\tdispose() {\n\n\t\tif ( this.map ) {\n\n\t\t\tthis.map.dispose();\n\n\t\t}\n\n\t\tif ( this.mapPass ) {\n\n\t\t\tthis.mapPass.dispose();\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.camera = source.camera.clone();\n\n\t\tthis.intensity = source.intensity;\n\n\t\tthis.bias = source.bias;\n\t\tthis.radius = source.radius;\n\n\t\tthis.mapSize.copy( source.mapSize );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst object = {};\n\n\t\tif ( this.intensity !== 1 ) object.intensity = this.intensity;\n\t\tif ( this.bias !== 0 ) object.bias = this.bias;\n\t\tif ( this.normalBias !== 0 ) object.normalBias = this.normalBias;\n\t\tif ( this.radius !== 1 ) object.radius = this.radius;\n\t\tif ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray();\n\n\t\tobject.camera = this.camera.toJSON( false ).object;\n\t\tdelete object.camera.matrix;\n\n\t\treturn object;\n\n\t}\n\n}\n\nclass SpotLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new PerspectiveCamera( 50, 1, 0.5, 500 ) );\n\n\t\tthis.isSpotLightShadow = true;\n\n\t\tthis.focus = 1;\n\n\t}\n\n\tupdateMatrices( light ) {\n\n\t\tconst camera = this.camera;\n\n\t\tconst fov = RAD2DEG * 2 * light.angle * this.focus;\n\t\tconst aspect = this.mapSize.width / this.mapSize.height;\n\t\tconst far = light.distance || camera.far;\n\n\t\tif ( fov !== camera.fov || aspect !== camera.aspect || far !== camera.far ) {\n\n\t\t\tcamera.fov = fov;\n\t\t\tcamera.aspect = aspect;\n\t\t\tcamera.far = far;\n\t\t\tcamera.updateProjectionMatrix();\n\n\t\t}\n\n\t\tsuper.updateMatrices( light );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.focus = source.focus;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass SpotLight extends Light {\n\n\tconstructor( color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 2 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isSpotLight = true;\n\n\t\tthis.type = 'SpotLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.target = new Object3D();\n\n\t\tthis.distance = distance;\n\t\tthis.angle = angle;\n\t\tthis.penumbra = penumbra;\n\t\tthis.decay = decay;\n\n\t\tthis.map = null;\n\n\t\tthis.shadow = new SpotLightShadow();\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\n\t\t// by convention for a spotlight, luminous power (lm) = π * luminous intensity (cd)\n\t\treturn this.intensity * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / Math.PI;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.distance = source.distance;\n\t\tthis.angle = source.angle;\n\t\tthis.penumbra = source.penumbra;\n\t\tthis.decay = source.decay;\n\n\t\tthis.target = source.target.clone();\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _projScreenMatrix = /*@__PURE__*/ new Matrix4();\nconst _lightPositionWorld = /*@__PURE__*/ new Vector3();\nconst _lookTarget = /*@__PURE__*/ new Vector3();\n\nclass PointLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new PerspectiveCamera( 90, 1, 0.5, 500 ) );\n\n\t\tthis.isPointLightShadow = true;\n\n\t\tthis._frameExtents = new Vector2( 4, 2 );\n\n\t\tthis._viewportCount = 6;\n\n\t\tthis._viewports = [\n\t\t\t// These viewports map a cube-map onto a 2D texture with the\n\t\t\t// following orientation:\n\t\t\t//\n\t\t\t// xzXZ\n\t\t\t// y Y\n\t\t\t//\n\t\t\t// X - Positive x direction\n\t\t\t// x - Negative x direction\n\t\t\t// Y - Positive y direction\n\t\t\t// y - Negative y direction\n\t\t\t// Z - Positive z direction\n\t\t\t// z - Negative z direction\n\n\t\t\t// positive X\n\t\t\tnew Vector4( 2, 1, 1, 1 ),\n\t\t\t// negative X\n\t\t\tnew Vector4( 0, 1, 1, 1 ),\n\t\t\t// positive Z\n\t\t\tnew Vector4( 3, 1, 1, 1 ),\n\t\t\t// negative Z\n\t\t\tnew Vector4( 1, 1, 1, 1 ),\n\t\t\t// positive Y\n\t\t\tnew Vector4( 3, 0, 1, 1 ),\n\t\t\t// negative Y\n\t\t\tnew Vector4( 1, 0, 1, 1 )\n\t\t];\n\n\t\tthis._cubeDirections = [\n\t\t\tnew Vector3( 1, 0, 0 ), new Vector3( - 1, 0, 0 ), new Vector3( 0, 0, 1 ),\n\t\t\tnew Vector3( 0, 0, - 1 ), new Vector3( 0, 1, 0 ), new Vector3( 0, - 1, 0 )\n\t\t];\n\n\t\tthis._cubeUps = [\n\t\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ),\n\t\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 0, 1 ),\tnew Vector3( 0, 0, - 1 )\n\t\t];\n\n\t}\n\n\tupdateMatrices( light, viewportIndex = 0 ) {\n\n\t\tconst camera = this.camera;\n\t\tconst shadowMatrix = this.matrix;\n\n\t\tconst far = light.distance || camera.far;\n\n\t\tif ( far !== camera.far ) {\n\n\t\t\tcamera.far = far;\n\t\t\tcamera.updateProjectionMatrix();\n\n\t\t}\n\n\t\t_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );\n\t\tcamera.position.copy( _lightPositionWorld );\n\n\t\t_lookTarget.copy( camera.position );\n\t\t_lookTarget.add( this._cubeDirections[ viewportIndex ] );\n\t\tcamera.up.copy( this._cubeUps[ viewportIndex ] );\n\t\tcamera.lookAt( _lookTarget );\n\t\tcamera.updateMatrixWorld();\n\n\t\tshadowMatrix.makeTranslation( - _lightPositionWorld.x, - _lightPositionWorld.y, - _lightPositionWorld.z );\n\n\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\tthis._frustum.setFromProjectionMatrix( _projScreenMatrix );\n\n\t}\n\n}\n\nclass PointLight extends Light {\n\n\tconstructor( color, intensity, distance = 0, decay = 2 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isPointLight = true;\n\n\t\tthis.type = 'PointLight';\n\n\t\tthis.distance = distance;\n\t\tthis.decay = decay;\n\n\t\tthis.shadow = new PointLightShadow();\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\n\t\t// for an isotropic light source, luminous power (lm) = 4 π luminous intensity (cd)\n\t\treturn this.intensity * 4 * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / ( 4 * Math.PI );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.distance = source.distance;\n\t\tthis.decay = source.decay;\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass DirectionalLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) );\n\n\t\tthis.isDirectionalLightShadow = true;\n\n\t}\n\n}\n\nclass DirectionalLight extends Light {\n\n\tconstructor( color, intensity ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isDirectionalLight = true;\n\n\t\tthis.type = 'DirectionalLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.target = new Object3D();\n\n\t\tthis.shadow = new DirectionalLightShadow();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.target = source.target.clone();\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass AmbientLight extends Light {\n\n\tconstructor( color, intensity ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isAmbientLight = true;\n\n\t\tthis.type = 'AmbientLight';\n\n\t}\n\n}\n\nclass RectAreaLight extends Light {\n\n\tconstructor( color, intensity, width = 10, height = 10 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isRectAreaLight = true;\n\n\t\tthis.type = 'RectAreaLight';\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in nits)\n\t\treturn this.intensity * this.width * this.height * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in nits) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / ( this.width * this.height * Math.PI );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.width = this.width;\n\t\tdata.object.height = this.height;\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * Primary reference:\n * https://graphics.stanford.edu/papers/envmap/envmap.pdf\n *\n * Secondary reference:\n * https://www.ppsloan.org/publications/StupidSH36.pdf\n */\n\n// 3-band SH defined by 9 coefficients\n\nclass SphericalHarmonics3 {\n\n\tconstructor() {\n\n\t\tthis.isSphericalHarmonics3 = true;\n\n\t\tthis.coefficients = [];\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients.push( new Vector3() );\n\n\t\t}\n\n\t}\n\n\tset( coefficients ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].copy( coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tzero() {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].set( 0, 0, 0 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// get the radiance in the direction of the normal\n\t// target is a Vector3\n\tgetAt( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\tconst coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.282095 );\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 0.488603 * y );\n\t\ttarget.addScaledVector( coeff[ 2 ], 0.488603 * z );\n\t\ttarget.addScaledVector( coeff[ 3 ], 0.488603 * x );\n\n\t\t// band 2\n\t\ttarget.addScaledVector( coeff[ 4 ], 1.092548 * ( x * y ) );\n\t\ttarget.addScaledVector( coeff[ 5 ], 1.092548 * ( y * z ) );\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.315392 * ( 3.0 * z * z - 1.0 ) );\n\t\ttarget.addScaledVector( coeff[ 7 ], 1.092548 * ( x * z ) );\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.546274 * ( x * x - y * y ) );\n\n\t\treturn target;\n\n\t}\n\n\t// get the irradiance (radiance convolved with cosine lobe) in the direction of the normal\n\t// target is a Vector3\n\t// https://graphics.stanford.edu/papers/envmap/envmap.pdf\n\tgetIrradianceAt( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\tconst coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.886227 ); // π * 0.282095\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 2.0 * 0.511664 * y ); // ( 2 * π / 3 ) * 0.488603\n\t\ttarget.addScaledVector( coeff[ 2 ], 2.0 * 0.511664 * z );\n\t\ttarget.addScaledVector( coeff[ 3 ], 2.0 * 0.511664 * x );\n\n\t\t// band 2\n\t\ttarget.addScaledVector( coeff[ 4 ], 2.0 * 0.429043 * x * y ); // ( π / 4 ) * 1.092548\n\t\ttarget.addScaledVector( coeff[ 5 ], 2.0 * 0.429043 * y * z );\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.743125 * z * z - 0.247708 ); // ( π / 4 ) * 0.315392 * 3\n\t\ttarget.addScaledVector( coeff[ 7 ], 2.0 * 0.429043 * x * z );\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.429043 * ( x * x - y * y ) ); // ( π / 4 ) * 0.546274\n\n\t\treturn target;\n\n\t}\n\n\tadd( sh ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].add( sh.coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\taddScaledSH( sh, s ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].addScaledVector( sh.coefficients[ i ], s );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tscale( s ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].multiplyScalar( s );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tlerp( sh, alpha ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].lerp( sh.coefficients[ i ], alpha );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tequals( sh ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( ! this.coefficients[ i ].equals( sh.coefficients[ i ] ) ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tcopy( sh ) {\n\n\t\treturn this.set( sh.coefficients );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tconst coefficients = this.coefficients;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].fromArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst coefficients = this.coefficients;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].toArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn array;\n\n\t}\n\n\t// evaluate the basis functions\n\t// shBasis is an Array[ 9 ]\n\tstatic getBasisAt( normal, shBasis ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\t// band 0\n\t\tshBasis[ 0 ] = 0.282095;\n\n\t\t// band 1\n\t\tshBasis[ 1 ] = 0.488603 * y;\n\t\tshBasis[ 2 ] = 0.488603 * z;\n\t\tshBasis[ 3 ] = 0.488603 * x;\n\n\t\t// band 2\n\t\tshBasis[ 4 ] = 1.092548 * x * y;\n\t\tshBasis[ 5 ] = 1.092548 * y * z;\n\t\tshBasis[ 6 ] = 0.315392 * ( 3 * z * z - 1 );\n\t\tshBasis[ 7 ] = 1.092548 * x * z;\n\t\tshBasis[ 8 ] = 0.546274 * ( x * x - y * y );\n\n\t}\n\n}\n\nclass LightProbe extends Light {\n\n\tconstructor( sh = new SphericalHarmonics3(), intensity = 1 ) {\n\n\t\tsuper( undefined, intensity );\n\n\t\tthis.isLightProbe = true;\n\n\t\tthis.sh = sh;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.sh.copy( source.sh );\n\n\t\treturn this;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tthis.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();\n\t\tthis.sh.fromArray( json.sh );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.sh = this.sh.toArray();\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass MaterialLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\t\tthis.textures = {};\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.setRequestHeader( scope.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst textures = this.textures;\n\n\t\tfunction getTexture( name ) {\n\n\t\t\tif ( textures[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.MaterialLoader: Undefined texture', name );\n\n\t\t\t}\n\n\t\t\treturn textures[ name ];\n\n\t\t}\n\n\t\tconst material = MaterialLoader.createMaterialFromType( json.type );\n\n\t\tif ( json.uuid !== undefined ) material.uuid = json.uuid;\n\t\tif ( json.name !== undefined ) material.name = json.name;\n\t\tif ( json.color !== undefined && material.color !== undefined ) material.color.setHex( json.color );\n\t\tif ( json.roughness !== undefined ) material.roughness = json.roughness;\n\t\tif ( json.metalness !== undefined ) material.metalness = json.metalness;\n\t\tif ( json.sheen !== undefined ) material.sheen = json.sheen;\n\t\tif ( json.sheenColor !== undefined ) material.sheenColor = new Color().setHex( json.sheenColor );\n\t\tif ( json.sheenRoughness !== undefined ) material.sheenRoughness = json.sheenRoughness;\n\t\tif ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive );\n\t\tif ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular );\n\t\tif ( json.specularIntensity !== undefined ) material.specularIntensity = json.specularIntensity;\n\t\tif ( json.specularColor !== undefined && material.specularColor !== undefined ) material.specularColor.setHex( json.specularColor );\n\t\tif ( json.shininess !== undefined ) material.shininess = json.shininess;\n\t\tif ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;\n\t\tif ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;\n\t\tif ( json.dispersion !== undefined ) material.dispersion = json.dispersion;\n\t\tif ( json.iridescence !== undefined ) material.iridescence = json.iridescence;\n\t\tif ( json.iridescenceIOR !== undefined ) material.iridescenceIOR = json.iridescenceIOR;\n\t\tif ( json.iridescenceThicknessRange !== undefined ) material.iridescenceThicknessRange = json.iridescenceThicknessRange;\n\t\tif ( json.transmission !== undefined ) material.transmission = json.transmission;\n\t\tif ( json.thickness !== undefined ) material.thickness = json.thickness;\n\t\tif ( json.attenuationDistance !== undefined ) material.attenuationDistance = json.attenuationDistance;\n\t\tif ( json.attenuationColor !== undefined && material.attenuationColor !== undefined ) material.attenuationColor.setHex( json.attenuationColor );\n\t\tif ( json.anisotropy !== undefined ) material.anisotropy = json.anisotropy;\n\t\tif ( json.anisotropyRotation !== undefined ) material.anisotropyRotation = json.anisotropyRotation;\n\t\tif ( json.fog !== undefined ) material.fog = json.fog;\n\t\tif ( json.flatShading !== undefined ) material.flatShading = json.flatShading;\n\t\tif ( json.blending !== undefined ) material.blending = json.blending;\n\t\tif ( json.combine !== undefined ) material.combine = json.combine;\n\t\tif ( json.side !== undefined ) material.side = json.side;\n\t\tif ( json.shadowSide !== undefined ) material.shadowSide = json.shadowSide;\n\t\tif ( json.opacity !== undefined ) material.opacity = json.opacity;\n\t\tif ( json.transparent !== undefined ) material.transparent = json.transparent;\n\t\tif ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;\n\t\tif ( json.alphaHash !== undefined ) material.alphaHash = json.alphaHash;\n\t\tif ( json.depthFunc !== undefined ) material.depthFunc = json.depthFunc;\n\t\tif ( json.depthTest !== undefined ) material.depthTest = json.depthTest;\n\t\tif ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;\n\t\tif ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;\n\t\tif ( json.blendSrc !== undefined ) material.blendSrc = json.blendSrc;\n\t\tif ( json.blendDst !== undefined ) material.blendDst = json.blendDst;\n\t\tif ( json.blendEquation !== undefined ) material.blendEquation = json.blendEquation;\n\t\tif ( json.blendSrcAlpha !== undefined ) material.blendSrcAlpha = json.blendSrcAlpha;\n\t\tif ( json.blendDstAlpha !== undefined ) material.blendDstAlpha = json.blendDstAlpha;\n\t\tif ( json.blendEquationAlpha !== undefined ) material.blendEquationAlpha = json.blendEquationAlpha;\n\t\tif ( json.blendColor !== undefined && material.blendColor !== undefined ) material.blendColor.setHex( json.blendColor );\n\t\tif ( json.blendAlpha !== undefined ) material.blendAlpha = json.blendAlpha;\n\t\tif ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;\n\t\tif ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;\n\t\tif ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;\n\t\tif ( json.stencilFuncMask !== undefined ) material.stencilFuncMask = json.stencilFuncMask;\n\t\tif ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;\n\t\tif ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;\n\t\tif ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;\n\t\tif ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;\n\n\t\tif ( json.wireframe !== undefined ) material.wireframe = json.wireframe;\n\t\tif ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;\n\t\tif ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap;\n\t\tif ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin;\n\n\t\tif ( json.rotation !== undefined ) material.rotation = json.rotation;\n\n\t\tif ( json.linewidth !== undefined ) material.linewidth = json.linewidth;\n\t\tif ( json.dashSize !== undefined ) material.dashSize = json.dashSize;\n\t\tif ( json.gapSize !== undefined ) material.gapSize = json.gapSize;\n\t\tif ( json.scale !== undefined ) material.scale = json.scale;\n\n\t\tif ( json.polygonOffset !== undefined ) material.polygonOffset = json.polygonOffset;\n\t\tif ( json.polygonOffsetFactor !== undefined ) material.polygonOffsetFactor = json.polygonOffsetFactor;\n\t\tif ( json.polygonOffsetUnits !== undefined ) material.polygonOffsetUnits = json.polygonOffsetUnits;\n\n\t\tif ( json.dithering !== undefined ) material.dithering = json.dithering;\n\n\t\tif ( json.alphaToCoverage !== undefined ) material.alphaToCoverage = json.alphaToCoverage;\n\t\tif ( json.premultipliedAlpha !== undefined ) material.premultipliedAlpha = json.premultipliedAlpha;\n\t\tif ( json.forceSinglePass !== undefined ) material.forceSinglePass = json.forceSinglePass;\n\n\t\tif ( json.visible !== undefined ) material.visible = json.visible;\n\n\t\tif ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped;\n\n\t\tif ( json.userData !== undefined ) material.userData = json.userData;\n\n\t\tif ( json.vertexColors !== undefined ) {\n\n\t\t\tif ( typeof json.vertexColors === 'number' ) {\n\n\t\t\t\tmaterial.vertexColors = ( json.vertexColors > 0 ) ? true : false;\n\n\t\t\t} else {\n\n\t\t\t\tmaterial.vertexColors = json.vertexColors;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Shader Material\n\n\t\tif ( json.uniforms !== undefined ) {\n\n\t\t\tfor ( const name in json.uniforms ) {\n\n\t\t\t\tconst uniform = json.uniforms[ name ];\n\n\t\t\t\tmaterial.uniforms[ name ] = {};\n\n\t\t\t\tswitch ( uniform.type ) {\n\n\t\t\t\t\tcase 't':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = getTexture( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'c':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Color().setHex( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v2':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector2().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector3().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'm3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'm4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = uniform.value;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json.defines !== undefined ) material.defines = json.defines;\n\t\tif ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;\n\t\tif ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;\n\t\tif ( json.glslVersion !== undefined ) material.glslVersion = json.glslVersion;\n\n\t\tif ( json.extensions !== undefined ) {\n\n\t\t\tfor ( const key in json.extensions ) {\n\n\t\t\t\tmaterial.extensions[ key ] = json.extensions[ key ];\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json.lights !== undefined ) material.lights = json.lights;\n\t\tif ( json.clipping !== undefined ) material.clipping = json.clipping;\n\n\t\t// for PointsMaterial\n\n\t\tif ( json.size !== undefined ) material.size = json.size;\n\t\tif ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;\n\n\t\t// maps\n\n\t\tif ( json.map !== undefined ) material.map = getTexture( json.map );\n\t\tif ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap );\n\n\t\tif ( json.alphaMap !== undefined ) material.alphaMap = getTexture( json.alphaMap );\n\n\t\tif ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap );\n\t\tif ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale;\n\n\t\tif ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap );\n\t\tif ( json.normalMapType !== undefined ) material.normalMapType = json.normalMapType;\n\t\tif ( json.normalScale !== undefined ) {\n\n\t\t\tlet normalScale = json.normalScale;\n\n\t\t\tif ( Array.isArray( normalScale ) === false ) {\n\n\t\t\t\t// Blender exporter used to export a scalar. See #7459\n\n\t\t\t\tnormalScale = [ normalScale, normalScale ];\n\n\t\t\t}\n\n\t\t\tmaterial.normalScale = new Vector2().fromArray( normalScale );\n\n\t\t}\n\n\t\tif ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap );\n\t\tif ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;\n\t\tif ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;\n\n\t\tif ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap );\n\t\tif ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap );\n\n\t\tif ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap );\n\t\tif ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity;\n\n\t\tif ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );\n\t\tif ( json.specularIntensityMap !== undefined ) material.specularIntensityMap = getTexture( json.specularIntensityMap );\n\t\tif ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );\n\n\t\tif ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );\n\t\tif ( json.envMapRotation !== undefined ) material.envMapRotation.fromArray( json.envMapRotation );\n\t\tif ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;\n\n\t\tif ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;\n\t\tif ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio;\n\n\t\tif ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap );\n\t\tif ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;\n\n\t\tif ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap );\n\t\tif ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;\n\n\t\tif ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap );\n\n\t\tif ( json.clearcoatMap !== undefined ) material.clearcoatMap = getTexture( json.clearcoatMap );\n\t\tif ( json.clearcoatRoughnessMap !== undefined ) material.clearcoatRoughnessMap = getTexture( json.clearcoatRoughnessMap );\n\t\tif ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap );\n\t\tif ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );\n\n\t\tif ( json.iridescenceMap !== undefined ) material.iridescenceMap = getTexture( json.iridescenceMap );\n\t\tif ( json.iridescenceThicknessMap !== undefined ) material.iridescenceThicknessMap = getTexture( json.iridescenceThicknessMap );\n\n\t\tif ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap );\n\t\tif ( json.thicknessMap !== undefined ) material.thicknessMap = getTexture( json.thicknessMap );\n\n\t\tif ( json.anisotropyMap !== undefined ) material.anisotropyMap = getTexture( json.anisotropyMap );\n\n\t\tif ( json.sheenColorMap !== undefined ) material.sheenColorMap = getTexture( json.sheenColorMap );\n\t\tif ( json.sheenRoughnessMap !== undefined ) material.sheenRoughnessMap = getTexture( json.sheenRoughnessMap );\n\n\t\treturn material;\n\n\t}\n\n\tsetTextures( value ) {\n\n\t\tthis.textures = value;\n\t\treturn this;\n\n\t}\n\n\tstatic createMaterialFromType( type ) {\n\n\t\tconst materialLib = {\n\t\t\tShadowMaterial,\n\t\t\tSpriteMaterial,\n\t\t\tRawShaderMaterial,\n\t\t\tShaderMaterial,\n\t\t\tPointsMaterial,\n\t\t\tMeshPhysicalMaterial,\n\t\t\tMeshStandardMaterial,\n\t\t\tMeshPhongMaterial,\n\t\t\tMeshToonMaterial,\n\t\t\tMeshNormalMaterial,\n\t\t\tMeshLambertMaterial,\n\t\t\tMeshDepthMaterial,\n\t\t\tMeshDistanceMaterial,\n\t\t\tMeshBasicMaterial,\n\t\t\tMeshMatcapMaterial,\n\t\t\tLineDashedMaterial,\n\t\t\tLineBasicMaterial,\n\t\t\tMaterial\n\t\t};\n\n\t\treturn new materialLib[ type ]();\n\n\t}\n\n}\n\nclass LoaderUtils {\n\n\tstatic decodeText( array ) { // @deprecated, r165\n\n\t\tconsole.warn( 'THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead.' );\n\n\t\tif ( typeof TextDecoder !== 'undefined' ) {\n\n\t\t\treturn new TextDecoder().decode( array );\n\n\t\t}\n\n\t\t// Avoid the String.fromCharCode.apply(null, array) shortcut, which\n\t\t// throws a \"maximum call stack size exceeded\" error for large arrays.\n\n\t\tlet s = '';\n\n\t\tfor ( let i = 0, il = array.length; i < il; i ++ ) {\n\n\t\t\t// Implicitly assumes little-endian.\n\t\t\ts += String.fromCharCode( array[ i ] );\n\n\t\t}\n\n\t\ttry {\n\n\t\t\t// merges multi-byte utf-8 characters.\n\n\t\t\treturn decodeURIComponent( escape( s ) );\n\n\t\t} catch ( e ) { // see #16358\n\n\t\t\treturn s;\n\n\t\t}\n\n\t}\n\n\tstatic extractUrlBase( url ) {\n\n\t\tconst index = url.lastIndexOf( '/' );\n\n\t\tif ( index === - 1 ) return './';\n\n\t\treturn url.slice( 0, index + 1 );\n\n\t}\n\n\tstatic resolveURL( url, path ) {\n\n\t\t// Invalid URL\n\t\tif ( typeof url !== 'string' || url === '' ) return '';\n\n\t\t// Host Relative URL\n\t\tif ( /^https?:\\/\\//i.test( path ) && /^\\//.test( url ) ) {\n\n\t\t\tpath = path.replace( /(^https?:\\/\\/[^\\/]+).*/i, '$1' );\n\n\t\t}\n\n\t\t// Absolute URL http://,https://,//\n\t\tif ( /^(https?:)?\\/\\//i.test( url ) ) return url;\n\n\t\t// Data URI\n\t\tif ( /^data:.*,.*$/i.test( url ) ) return url;\n\n\t\t// Blob URL\n\t\tif ( /^blob:.*$/i.test( url ) ) return url;\n\n\t\t// Relative URL\n\t\treturn path + url;\n\n\t}\n\n}\n\nclass InstancedBufferGeometry extends BufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isInstancedBufferGeometry = true;\n\n\t\tthis.type = 'InstancedBufferGeometry';\n\t\tthis.instanceCount = Infinity;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.instanceCount = source.instanceCount;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.instanceCount = this.instanceCount;\n\n\t\tdata.isInstancedBufferGeometry = true;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass BufferGeometryLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.setRequestHeader( scope.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst interleavedBufferMap = {};\n\t\tconst arrayBufferMap = {};\n\n\t\tfunction getInterleavedBuffer( json, uuid ) {\n\n\t\t\tif ( interleavedBufferMap[ uuid ] !== undefined ) return interleavedBufferMap[ uuid ];\n\n\t\t\tconst interleavedBuffers = json.interleavedBuffers;\n\t\t\tconst interleavedBuffer = interleavedBuffers[ uuid ];\n\n\t\t\tconst buffer = getArrayBuffer( json, interleavedBuffer.buffer );\n\n\t\t\tconst array = getTypedArray( interleavedBuffer.type, buffer );\n\t\t\tconst ib = new InterleavedBuffer( array, interleavedBuffer.stride );\n\t\t\tib.uuid = interleavedBuffer.uuid;\n\n\t\t\tinterleavedBufferMap[ uuid ] = ib;\n\n\t\t\treturn ib;\n\n\t\t}\n\n\t\tfunction getArrayBuffer( json, uuid ) {\n\n\t\t\tif ( arrayBufferMap[ uuid ] !== undefined ) return arrayBufferMap[ uuid ];\n\n\t\t\tconst arrayBuffers = json.arrayBuffers;\n\t\t\tconst arrayBuffer = arrayBuffers[ uuid ];\n\n\t\t\tconst ab = new Uint32Array( arrayBuffer ).buffer;\n\n\t\t\tarrayBufferMap[ uuid ] = ab;\n\n\t\t\treturn ab;\n\n\t\t}\n\n\t\tconst geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry();\n\n\t\tconst index = json.data.index;\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tconst typedArray = getTypedArray( index.type, index.array );\n\t\t\tgeometry.setIndex( new BufferAttribute( typedArray, 1 ) );\n\n\t\t}\n\n\t\tconst attributes = json.data.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\t\t\tlet bufferAttribute;\n\n\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\n\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\n\n\t\t\t} else {\n\n\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\n\t\t\t\tconst bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute;\n\t\t\t\tbufferAttribute = new bufferAttributeConstr( typedArray, attribute.itemSize, attribute.normalized );\n\n\t\t\t}\n\n\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\tif ( attribute.usage !== undefined ) bufferAttribute.setUsage( attribute.usage );\n\n\t\t\tgeometry.setAttribute( key, bufferAttribute );\n\n\t\t}\n\n\t\tconst morphAttributes = json.data.morphAttributes;\n\n\t\tif ( morphAttributes ) {\n\n\t\t\tfor ( const key in morphAttributes ) {\n\n\t\t\t\tconst attributeArray = morphAttributes[ key ];\n\n\t\t\t\tconst array = [];\n\n\t\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst attribute = attributeArray[ i ];\n\t\t\t\t\tlet bufferAttribute;\n\n\t\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\n\t\t\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\n\t\t\t\t\t\tbufferAttribute = new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\t\t\tarray.push( bufferAttribute );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.morphAttributes[ key ] = array;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst morphTargetsRelative = json.data.morphTargetsRelative;\n\n\t\tif ( morphTargetsRelative ) {\n\n\t\t\tgeometry.morphTargetsRelative = true;\n\n\t\t}\n\n\t\tconst groups = json.data.groups || json.data.drawcalls || json.data.offsets;\n\n\t\tif ( groups !== undefined ) {\n\n\t\t\tfor ( let i = 0, n = groups.length; i !== n; ++ i ) {\n\n\t\t\t\tconst group = groups[ i ];\n\n\t\t\t\tgeometry.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst boundingSphere = json.data.boundingSphere;\n\n\t\tif ( boundingSphere !== undefined ) {\n\n\t\t\tconst center = new Vector3();\n\n\t\t\tif ( boundingSphere.center !== undefined ) {\n\n\t\t\t\tcenter.fromArray( boundingSphere.center );\n\n\t\t\t}\n\n\t\t\tgeometry.boundingSphere = new Sphere( center, boundingSphere.radius );\n\n\t\t}\n\n\t\tif ( json.name ) geometry.name = json.name;\n\t\tif ( json.userData ) geometry.userData = json.userData;\n\n\t\treturn geometry;\n\n\t}\n\n}\n\nclass ObjectLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\n\t\tthis.resourcePath = this.resourcePath || path;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\tlet json = null;\n\n\t\t\ttry {\n\n\t\t\t\tjson = JSON.parse( text );\n\n\t\t\t} catch ( error ) {\n\n\t\t\t\tif ( onError !== undefined ) onError( error );\n\n\t\t\t\tconsole.error( 'THREE:ObjectLoader: Can\\'t parse ' + url + '.', error.message );\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst metadata = json.metadata;\n\n\t\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\t\tif ( onError !== undefined ) onError( new Error( 'THREE.ObjectLoader: Can\\'t load ' + url ) );\n\n\t\t\t\tconsole.error( 'THREE.ObjectLoader: Can\\'t load ' + url );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tscope.parse( json, onLoad );\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tasync loadAsync( url, onProgress ) {\n\n\t\tconst scope = this;\n\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\n\t\tthis.resourcePath = this.resourcePath || path;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\n\t\tconst text = await loader.loadAsync( url, onProgress );\n\n\t\tconst json = JSON.parse( text );\n\n\t\tconst metadata = json.metadata;\n\n\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\tthrow new Error( 'THREE.ObjectLoader: Can\\'t load ' + url );\n\n\t\t}\n\n\t\treturn await scope.parseAsync( json );\n\n\t}\n\n\tparse( json, onLoad ) {\n\n\t\tconst animations = this.parseAnimations( json.animations );\n\t\tconst shapes = this.parseShapes( json.shapes );\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\n\n\t\tconst images = this.parseImages( json.images, function () {\n\n\t\t\tif ( onLoad !== undefined ) onLoad( object );\n\n\t\t} );\n\n\t\tconst textures = this.parseTextures( json.textures, images );\n\t\tconst materials = this.parseMaterials( json.materials, textures );\n\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\n\n\t\tthis.bindSkeletons( object, skeletons );\n\t\tthis.bindLightTargets( object );\n\n\t\t//\n\n\t\tif ( onLoad !== undefined ) {\n\n\t\t\tlet hasImages = false;\n\n\t\t\tfor ( const uuid in images ) {\n\n\t\t\t\tif ( images[ uuid ].data instanceof HTMLImageElement ) {\n\n\t\t\t\t\thasImages = true;\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( hasImages === false ) onLoad( object );\n\n\t\t}\n\n\t\treturn object;\n\n\t}\n\n\tasync parseAsync( json ) {\n\n\t\tconst animations = this.parseAnimations( json.animations );\n\t\tconst shapes = this.parseShapes( json.shapes );\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\n\n\t\tconst images = await this.parseImagesAsync( json.images );\n\n\t\tconst textures = this.parseTextures( json.textures, images );\n\t\tconst materials = this.parseMaterials( json.materials, textures );\n\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\n\n\t\tthis.bindSkeletons( object, skeletons );\n\t\tthis.bindLightTargets( object );\n\n\t\treturn object;\n\n\t}\n\n\tparseShapes( json ) {\n\n\t\tconst shapes = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst shape = new Shape().fromJSON( json[ i ] );\n\n\t\t\t\tshapes[ shape.uuid ] = shape;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn shapes;\n\n\t}\n\n\tparseSkeletons( json, object ) {\n\n\t\tconst skeletons = {};\n\t\tconst bones = {};\n\n\t\t// generate bone lookup table\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isBone ) bones[ child.uuid ] = child;\n\n\t\t} );\n\n\t\t// create skeletons\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst skeleton = new Skeleton().fromJSON( json[ i ], bones );\n\n\t\t\t\tskeletons[ skeleton.uuid ] = skeleton;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn skeletons;\n\n\t}\n\n\tparseGeometries( json, shapes ) {\n\n\t\tconst geometries = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst bufferGeometryLoader = new BufferGeometryLoader();\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tlet geometry;\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tswitch ( data.type ) {\n\n\t\t\t\t\tcase 'BufferGeometry':\n\t\t\t\t\tcase 'InstancedBufferGeometry':\n\n\t\t\t\t\t\tgeometry = bufferGeometryLoader.parse( data );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tif ( data.type in Geometries ) {\n\n\t\t\t\t\t\t\tgeometry = Geometries[ data.type ].fromJSON( data, shapes );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tconsole.warn( `THREE.ObjectLoader: Unsupported geometry type \"${ data.type }\"` );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) geometry.name = data.name;\n\t\t\t\tif ( data.userData !== undefined ) geometry.userData = data.userData;\n\n\t\t\t\tgeometries[ data.uuid ] = geometry;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn geometries;\n\n\t}\n\n\tparseMaterials( json, textures ) {\n\n\t\tconst cache = {}; // MultiMaterial\n\t\tconst materials = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst loader = new MaterialLoader();\n\t\t\tloader.setTextures( textures );\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tif ( cache[ data.uuid ] === undefined ) {\n\n\t\t\t\t\tcache[ data.uuid ] = loader.parse( data );\n\n\t\t\t\t}\n\n\t\t\t\tmaterials[ data.uuid ] = cache[ data.uuid ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn materials;\n\n\t}\n\n\tparseAnimations( json ) {\n\n\t\tconst animations = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0; i < json.length; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tconst clip = AnimationClip.parse( data );\n\n\t\t\t\tanimations[ clip.uuid ] = clip;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn animations;\n\n\t}\n\n\tparseImages( json, onLoad ) {\n\n\t\tconst scope = this;\n\t\tconst images = {};\n\n\t\tlet loader;\n\n\t\tfunction loadImage( url ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\treturn loader.load( url, function () {\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, undefined, function () {\n\n\t\t\t\tscope.manager.itemError( url );\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t} );\n\n\t\t}\n\n\t\tfunction deserializeImage( image ) {\n\n\t\t\tif ( typeof image === 'string' ) {\n\n\t\t\t\tconst url = image;\n\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\n\n\t\t\t\treturn loadImage( path );\n\n\t\t\t} else {\n\n\t\t\t\tif ( image.data ) {\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\n\t\t\t\t\t\twidth: image.width,\n\t\t\t\t\t\theight: image.height\n\t\t\t\t\t};\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json !== undefined && json.length > 0 ) {\n\n\t\t\tconst manager = new LoadingManager( onLoad );\n\n\t\t\tloader = new ImageLoader( manager );\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\n\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\n\n\t\t\t\tconst image = json[ i ];\n\t\t\t\tconst url = image.url;\n\n\t\t\t\tif ( Array.isArray( url ) ) {\n\n\t\t\t\t\t// load array of images e.g CubeTexture\n\n\t\t\t\t\tconst imageArray = [];\n\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tconst currentUrl = url[ j ];\n\n\t\t\t\t\t\tconst deserializedImage = deserializeImage( currentUrl );\n\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\n\n\t\t\t\t\t\t\t\timageArray.push( deserializedImage );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\n\n\t\t\t\t\t\t\t\timageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\timages[ image.uuid ] = new Source( imageArray );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// load single image\n\n\t\t\t\t\tconst deserializedImage = deserializeImage( image.url );\n\t\t\t\t\timages[ image.uuid ] = new Source( deserializedImage );\n\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn images;\n\n\t}\n\n\tasync parseImagesAsync( json ) {\n\n\t\tconst scope = this;\n\t\tconst images = {};\n\n\t\tlet loader;\n\n\t\tasync function deserializeImage( image ) {\n\n\t\t\tif ( typeof image === 'string' ) {\n\n\t\t\t\tconst url = image;\n\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\n\n\t\t\t\treturn await loader.loadAsync( path );\n\n\t\t\t} else {\n\n\t\t\t\tif ( image.data ) {\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\n\t\t\t\t\t\twidth: image.width,\n\t\t\t\t\t\theight: image.height\n\t\t\t\t\t};\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json !== undefined && json.length > 0 ) {\n\n\t\t\tloader = new ImageLoader( this.manager );\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\n\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\n\n\t\t\t\tconst image = json[ i ];\n\t\t\t\tconst url = image.url;\n\n\t\t\t\tif ( Array.isArray( url ) ) {\n\n\t\t\t\t\t// load array of images e.g CubeTexture\n\n\t\t\t\t\tconst imageArray = [];\n\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tconst currentUrl = url[ j ];\n\n\t\t\t\t\t\tconst deserializedImage = await deserializeImage( currentUrl );\n\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\n\n\t\t\t\t\t\t\t\timageArray.push( deserializedImage );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\n\n\t\t\t\t\t\t\t\timageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\timages[ image.uuid ] = new Source( imageArray );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// load single image\n\n\t\t\t\t\tconst deserializedImage = await deserializeImage( image.url );\n\t\t\t\t\timages[ image.uuid ] = new Source( deserializedImage );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn images;\n\n\t}\n\n\tparseTextures( json, images ) {\n\n\t\tfunction parseConstant( value, type ) {\n\n\t\t\tif ( typeof value === 'number' ) return value;\n\n\t\t\tconsole.warn( 'THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value );\n\n\t\t\treturn type[ value ];\n\n\t\t}\n\n\t\tconst textures = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tif ( data.image === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No \"image\" specified for', data.uuid );\n\n\t\t\t\t}\n\n\t\t\t\tif ( images[ data.image ] === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined image', data.image );\n\n\t\t\t\t}\n\n\t\t\t\tconst source = images[ data.image ];\n\t\t\t\tconst image = source.data;\n\n\t\t\t\tlet texture;\n\n\t\t\t\tif ( Array.isArray( image ) ) {\n\n\t\t\t\t\ttexture = new CubeTexture();\n\n\t\t\t\t\tif ( image.length === 6 ) texture.needsUpdate = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( image && image.data ) {\n\n\t\t\t\t\t\ttexture = new DataTexture();\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttexture = new Texture();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( image ) texture.needsUpdate = true; // textures can have undefined image data\n\n\t\t\t\t}\n\n\t\t\t\ttexture.source = source;\n\n\t\t\t\ttexture.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) texture.name = data.name;\n\n\t\t\t\tif ( data.mapping !== undefined ) texture.mapping = parseConstant( data.mapping, TEXTURE_MAPPING );\n\t\t\t\tif ( data.channel !== undefined ) texture.channel = data.channel;\n\n\t\t\t\tif ( data.offset !== undefined ) texture.offset.fromArray( data.offset );\n\t\t\t\tif ( data.repeat !== undefined ) texture.repeat.fromArray( data.repeat );\n\t\t\t\tif ( data.center !== undefined ) texture.center.fromArray( data.center );\n\t\t\t\tif ( data.rotation !== undefined ) texture.rotation = data.rotation;\n\n\t\t\t\tif ( data.wrap !== undefined ) {\n\n\t\t\t\t\ttexture.wrapS = parseConstant( data.wrap[ 0 ], TEXTURE_WRAPPING );\n\t\t\t\t\ttexture.wrapT = parseConstant( data.wrap[ 1 ], TEXTURE_WRAPPING );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.format !== undefined ) texture.format = data.format;\n\t\t\t\tif ( data.internalFormat !== undefined ) texture.internalFormat = data.internalFormat;\n\t\t\t\tif ( data.type !== undefined ) texture.type = data.type;\n\t\t\t\tif ( data.colorSpace !== undefined ) texture.colorSpace = data.colorSpace;\n\n\t\t\t\tif ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy;\n\n\t\t\t\tif ( data.flipY !== undefined ) texture.flipY = data.flipY;\n\n\t\t\t\tif ( data.generateMipmaps !== undefined ) texture.generateMipmaps = data.generateMipmaps;\n\t\t\t\tif ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;\n\t\t\t\tif ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;\n\t\t\t\tif ( data.compareFunction !== undefined ) texture.compareFunction = data.compareFunction;\n\n\t\t\t\tif ( data.userData !== undefined ) texture.userData = data.userData;\n\n\t\t\t\ttextures[ data.uuid ] = texture;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn textures;\n\n\t}\n\n\tparseObject( data, geometries, materials, textures, animations ) {\n\n\t\tlet object;\n\n\t\tfunction getGeometry( name ) {\n\n\t\t\tif ( geometries[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined geometry', name );\n\n\t\t\t}\n\n\t\t\treturn geometries[ name ];\n\n\t\t}\n\n\t\tfunction getMaterial( name ) {\n\n\t\t\tif ( name === undefined ) return undefined;\n\n\t\t\tif ( Array.isArray( name ) ) {\n\n\t\t\t\tconst array = [];\n\n\t\t\t\tfor ( let i = 0, l = name.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst uuid = name[ i ];\n\n\t\t\t\t\tif ( materials[ uuid ] === undefined ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', uuid );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tarray.push( materials[ uuid ] );\n\n\t\t\t\t}\n\n\t\t\t\treturn array;\n\n\t\t\t}\n\n\t\t\tif ( materials[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', name );\n\n\t\t\t}\n\n\t\t\treturn materials[ name ];\n\n\t\t}\n\n\t\tfunction getTexture( uuid ) {\n\n\t\t\tif ( textures[ uuid ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined texture', uuid );\n\n\t\t\t}\n\n\t\t\treturn textures[ uuid ];\n\n\t\t}\n\n\t\tlet geometry, material;\n\n\t\tswitch ( data.type ) {\n\n\t\t\tcase 'Scene':\n\n\t\t\t\tobject = new Scene();\n\n\t\t\t\tif ( data.background !== undefined ) {\n\n\t\t\t\t\tif ( Number.isInteger( data.background ) ) {\n\n\t\t\t\t\t\tobject.background = new Color( data.background );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tobject.background = getTexture( data.background );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.environment !== undefined ) {\n\n\t\t\t\t\tobject.environment = getTexture( data.environment );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.fog !== undefined ) {\n\n\t\t\t\t\tif ( data.fog.type === 'Fog' ) {\n\n\t\t\t\t\t\tobject.fog = new Fog( data.fog.color, data.fog.near, data.fog.far );\n\n\t\t\t\t\t} else if ( data.fog.type === 'FogExp2' ) {\n\n\t\t\t\t\t\tobject.fog = new FogExp2( data.fog.color, data.fog.density );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( data.fog.name !== '' ) {\n\n\t\t\t\t\t\tobject.fog.name = data.fog.name;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;\n\t\t\t\tif ( data.backgroundIntensity !== undefined ) object.backgroundIntensity = data.backgroundIntensity;\n\t\t\t\tif ( data.backgroundRotation !== undefined ) object.backgroundRotation.fromArray( data.backgroundRotation );\n\n\t\t\t\tif ( data.environmentIntensity !== undefined ) object.environmentIntensity = data.environmentIntensity;\n\t\t\t\tif ( data.environmentRotation !== undefined ) object.environmentRotation.fromArray( data.environmentRotation );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PerspectiveCamera':\n\n\t\t\t\tobject = new PerspectiveCamera( data.fov, data.aspect, data.near, data.far );\n\n\t\t\t\tif ( data.focus !== undefined ) object.focus = data.focus;\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.filmGauge !== undefined ) object.filmGauge = data.filmGauge;\n\t\t\t\tif ( data.filmOffset !== undefined ) object.filmOffset = data.filmOffset;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'OrthographicCamera':\n\n\t\t\t\tobject = new OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far );\n\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'AmbientLight':\n\n\t\t\t\tobject = new AmbientLight( data.color, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'DirectionalLight':\n\n\t\t\t\tobject = new DirectionalLight( data.color, data.intensity );\n\t\t\t\tobject.target = data.target || '';\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointLight':\n\n\t\t\t\tobject = new PointLight( data.color, data.intensity, data.distance, data.decay );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'RectAreaLight':\n\n\t\t\t\tobject = new RectAreaLight( data.color, data.intensity, data.width, data.height );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SpotLight':\n\n\t\t\t\tobject = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay );\n\t\t\t\tobject.target = data.target || '';\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'HemisphereLight':\n\n\t\t\t\tobject = new HemisphereLight( data.color, data.groundColor, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LightProbe':\n\n\t\t\t\tobject = new LightProbe().fromJSON( data );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SkinnedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t \tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new SkinnedMesh( geometry, material );\n\n\t\t\t\tif ( data.bindMode !== undefined ) object.bindMode = data.bindMode;\n\t\t\t\tif ( data.bindMatrix !== undefined ) object.bindMatrix.fromArray( data.bindMatrix );\n\t\t\t\tif ( data.skeleton !== undefined ) object.skeleton = data.skeleton;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Mesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new Mesh( geometry, material );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'InstancedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\t\t\t\tconst count = data.count;\n\t\t\t\tconst instanceMatrix = data.instanceMatrix;\n\t\t\t\tconst instanceColor = data.instanceColor;\n\n\t\t\t\tobject = new InstancedMesh( geometry, material, count );\n\t\t\t\tobject.instanceMatrix = new InstancedBufferAttribute( new Float32Array( instanceMatrix.array ), 16 );\n\t\t\t\tif ( instanceColor !== undefined ) object.instanceColor = new InstancedBufferAttribute( new Float32Array( instanceColor.array ), instanceColor.itemSize );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'BatchedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new BatchedMesh( data.maxInstanceCount, data.maxVertexCount, data.maxIndexCount, material );\n\t\t\t\tobject.geometry = geometry;\n\t\t\t\tobject.perObjectFrustumCulled = data.perObjectFrustumCulled;\n\t\t\t\tobject.sortObjects = data.sortObjects;\n\n\t\t\t\tobject._drawRanges = data.drawRanges;\n\t\t\t\tobject._reservedRanges = data.reservedRanges;\n\n\t\t\t\tobject._visibility = data.visibility;\n\t\t\t\tobject._active = data.active;\n\t\t\t\tobject._bounds = data.bounds.map( bound => {\n\n\t\t\t\t\tconst box = new Box3();\n\t\t\t\t\tbox.min.fromArray( bound.boxMin );\n\t\t\t\t\tbox.max.fromArray( bound.boxMax );\n\n\t\t\t\t\tconst sphere = new Sphere();\n\t\t\t\t\tsphere.radius = bound.sphereRadius;\n\t\t\t\t\tsphere.center.fromArray( bound.sphereCenter );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tboxInitialized: bound.boxInitialized,\n\t\t\t\t\t\tbox: box,\n\n\t\t\t\t\t\tsphereInitialized: bound.sphereInitialized,\n\t\t\t\t\t\tsphere: sphere\n\t\t\t\t\t};\n\n\t\t\t\t} );\n\n\t\t\t\tobject._maxInstanceCount = data.maxInstanceCount;\n\t\t\t\tobject._maxVertexCount = data.maxVertexCount;\n\t\t\t\tobject._maxIndexCount = data.maxIndexCount;\n\n\t\t\t\tobject._geometryInitialized = data.geometryInitialized;\n\t\t\t\tobject._geometryCount = data.geometryCount;\n\n\t\t\t\tobject._matricesTexture = getTexture( data.matricesTexture.uuid );\n\t\t\t\tif ( data.colorsTexture !== undefined ) object._colorsTexture = getTexture( data.colorsTexture.uuid );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LOD':\n\n\t\t\t\tobject = new LOD();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Line':\n\n\t\t\t\tobject = new Line( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineLoop':\n\n\t\t\t\tobject = new LineLoop( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineSegments':\n\n\t\t\t\tobject = new LineSegments( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointCloud':\n\t\t\tcase 'Points':\n\n\t\t\t\tobject = new Points( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Sprite':\n\n\t\t\t\tobject = new Sprite( getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Group':\n\n\t\t\t\tobject = new Group();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Bone':\n\n\t\t\t\tobject = new Bone();\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tobject = new Object3D();\n\n\t\t}\n\n\t\tobject.uuid = data.uuid;\n\n\t\tif ( data.name !== undefined ) object.name = data.name;\n\n\t\tif ( data.matrix !== undefined ) {\n\n\t\t\tobject.matrix.fromArray( data.matrix );\n\n\t\t\tif ( data.matrixAutoUpdate !== undefined ) object.matrixAutoUpdate = data.matrixAutoUpdate;\n\t\t\tif ( object.matrixAutoUpdate ) object.matrix.decompose( object.position, object.quaternion, object.scale );\n\n\t\t} else {\n\n\t\t\tif ( data.position !== undefined ) object.position.fromArray( data.position );\n\t\t\tif ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation );\n\t\t\tif ( data.quaternion !== undefined ) object.quaternion.fromArray( data.quaternion );\n\t\t\tif ( data.scale !== undefined ) object.scale.fromArray( data.scale );\n\n\t\t}\n\n\t\tif ( data.up !== undefined ) object.up.fromArray( data.up );\n\n\t\tif ( data.castShadow !== undefined ) object.castShadow = data.castShadow;\n\t\tif ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow;\n\n\t\tif ( data.shadow ) {\n\n\t\t\tif ( data.shadow.intensity !== undefined ) object.shadow.intensity = data.shadow.intensity;\n\t\t\tif ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;\n\t\t\tif ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;\n\t\t\tif ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;\n\t\t\tif ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize );\n\t\t\tif ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera );\n\n\t\t}\n\n\t\tif ( data.visible !== undefined ) object.visible = data.visible;\n\t\tif ( data.frustumCulled !== undefined ) object.frustumCulled = data.frustumCulled;\n\t\tif ( data.renderOrder !== undefined ) object.renderOrder = data.renderOrder;\n\t\tif ( data.userData !== undefined ) object.userData = data.userData;\n\t\tif ( data.layers !== undefined ) object.layers.mask = data.layers;\n\n\t\tif ( data.children !== undefined ) {\n\n\t\t\tconst children = data.children;\n\n\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\tobject.add( this.parseObject( children[ i ], geometries, materials, textures, animations ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( data.animations !== undefined ) {\n\n\t\t\tconst objectAnimations = data.animations;\n\n\t\t\tfor ( let i = 0; i < objectAnimations.length; i ++ ) {\n\n\t\t\t\tconst uuid = objectAnimations[ i ];\n\n\t\t\t\tobject.animations.push( animations[ uuid ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( data.type === 'LOD' ) {\n\n\t\t\tif ( data.autoUpdate !== undefined ) object.autoUpdate = data.autoUpdate;\n\n\t\t\tconst levels = data.levels;\n\n\t\t\tfor ( let l = 0; l < levels.length; l ++ ) {\n\n\t\t\t\tconst level = levels[ l ];\n\t\t\t\tconst child = object.getObjectByProperty( 'uuid', level.object );\n\n\t\t\t\tif ( child !== undefined ) {\n\n\t\t\t\t\tobject.addLevel( child, level.distance, level.hysteresis );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn object;\n\n\t}\n\n\tbindSkeletons( object, skeletons ) {\n\n\t\tif ( Object.keys( skeletons ).length === 0 ) return;\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isSkinnedMesh === true && child.skeleton !== undefined ) {\n\n\t\t\t\tconst skeleton = skeletons[ child.skeleton ];\n\n\t\t\t\tif ( skeleton === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No skeleton found with UUID:', child.skeleton );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tchild.bind( skeleton, child.bindMatrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} );\n\n\t}\n\n\tbindLightTargets( object ) {\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isDirectionalLight || child.isSpotLight ) {\n\n\t\t\t\tconst uuid = child.target;\n\n\t\t\t\tconst target = object.getObjectByProperty( 'uuid', uuid );\n\n\t\t\t\tif ( target !== undefined ) {\n\n\t\t\t\t\tchild.target = target;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tchild.target = new Object3D();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} );\n\n\t}\n\n}\n\nconst TEXTURE_MAPPING = {\n\tUVMapping: UVMapping,\n\tCubeReflectionMapping: CubeReflectionMapping,\n\tCubeRefractionMapping: CubeRefractionMapping,\n\tEquirectangularReflectionMapping: EquirectangularReflectionMapping,\n\tEquirectangularRefractionMapping: EquirectangularRefractionMapping,\n\tCubeUVReflectionMapping: CubeUVReflectionMapping\n};\n\nconst TEXTURE_WRAPPING = {\n\tRepeatWrapping: RepeatWrapping,\n\tClampToEdgeWrapping: ClampToEdgeWrapping,\n\tMirroredRepeatWrapping: MirroredRepeatWrapping\n};\n\nconst TEXTURE_FILTER = {\n\tNearestFilter: NearestFilter,\n\tNearestMipmapNearestFilter: NearestMipmapNearestFilter,\n\tNearestMipmapLinearFilter: NearestMipmapLinearFilter,\n\tLinearFilter: LinearFilter,\n\tLinearMipmapNearestFilter: LinearMipmapNearestFilter,\n\tLinearMipmapLinearFilter: LinearMipmapLinearFilter\n};\n\nclass ImageBitmapLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t\tthis.isImageBitmapLoader = true;\n\n\t\tif ( typeof createImageBitmap === 'undefined' ) {\n\n\t\t\tconsole.warn( 'THREE.ImageBitmapLoader: createImageBitmap() not supported.' );\n\n\t\t}\n\n\t\tif ( typeof fetch === 'undefined' ) {\n\n\t\t\tconsole.warn( 'THREE.ImageBitmapLoader: fetch() not supported.' );\n\n\t\t}\n\n\t\tthis.options = { premultiplyAlpha: 'none' };\n\n\t}\n\n\tsetOptions( options ) {\n\n\t\tthis.options = options;\n\n\t\treturn this;\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst scope = this;\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\t// If cached is a promise, wait for it to resolve\n\t\t\tif ( cached.then ) {\n\n\t\t\t\tcached.then( imageBitmap => {\n\n\t\t\t\t\tif ( onLoad ) onLoad( imageBitmap );\n\n\t\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t\t} ).catch( e => {\n\n\t\t\t\t\tif ( onError ) onError( e );\n\n\t\t\t\t} );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t// If cached is not a promise (i.e., it's already an imageBitmap)\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tconst fetchOptions = {};\n\t\tfetchOptions.credentials = ( this.crossOrigin === 'anonymous' ) ? 'same-origin' : 'include';\n\t\tfetchOptions.headers = this.requestHeader;\n\n\t\tconst promise = fetch( url, fetchOptions ).then( function ( res ) {\n\n\t\t\treturn res.blob();\n\n\t\t} ).then( function ( blob ) {\n\n\t\t\treturn createImageBitmap( blob, Object.assign( scope.options, { colorSpaceConversion: 'none' } ) );\n\n\t\t} ).then( function ( imageBitmap ) {\n\n\t\t\tCache.add( url, imageBitmap );\n\n\t\t\tif ( onLoad ) onLoad( imageBitmap );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t\treturn imageBitmap;\n\n\t\t} ).catch( function ( e ) {\n\n\t\t\tif ( onError ) onError( e );\n\n\t\t\tCache.remove( url );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t} );\n\n\t\tCache.add( url, promise );\n\t\tscope.manager.itemStart( url );\n\n\t}\n\n}\n\nlet _context;\n\nclass AudioContext {\n\n\tstatic getContext() {\n\n\t\tif ( _context === undefined ) {\n\n\t\t\t_context = new ( window.AudioContext || window.webkitAudioContext )();\n\n\t\t}\n\n\t\treturn _context;\n\n\t}\n\n\tstatic setContext( value ) {\n\n\t\t_context = value;\n\n\t}\n\n}\n\nclass AudioLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\ttry {\n\n\t\t\t\t// Create a copy of the buffer. The `decodeAudioData` method\n\t\t\t\t// detaches the buffer when complete, preventing reuse.\n\t\t\t\tconst bufferCopy = buffer.slice( 0 );\n\n\t\t\t\tconst context = AudioContext.getContext();\n\t\t\t\tcontext.decodeAudioData( bufferCopy, function ( audioBuffer ) {\n\n\t\t\t\t\tonLoad( audioBuffer );\n\n\t\t\t\t} ).catch( handleError );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\thandleError( e );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t\tfunction handleError( e ) {\n\n\t\t\tif ( onError ) {\n\n\t\t\t\tonError( e );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( e );\n\n\t\t\t}\n\n\t\t\tscope.manager.itemError( url );\n\n\t\t}\n\n\t}\n\n}\n\nconst _eyeRight = /*@__PURE__*/ new Matrix4();\nconst _eyeLeft = /*@__PURE__*/ new Matrix4();\nconst _projectionMatrix = /*@__PURE__*/ new Matrix4();\n\nclass StereoCamera {\n\n\tconstructor() {\n\n\t\tthis.type = 'StereoCamera';\n\n\t\tthis.aspect = 1;\n\n\t\tthis.eyeSep = 0.064;\n\n\t\tthis.cameraL = new PerspectiveCamera();\n\t\tthis.cameraL.layers.enable( 1 );\n\t\tthis.cameraL.matrixAutoUpdate = false;\n\n\t\tthis.cameraR = new PerspectiveCamera();\n\t\tthis.cameraR.layers.enable( 2 );\n\t\tthis.cameraR.matrixAutoUpdate = false;\n\n\t\tthis._cache = {\n\t\t\tfocus: null,\n\t\t\tfov: null,\n\t\t\taspect: null,\n\t\t\tnear: null,\n\t\t\tfar: null,\n\t\t\tzoom: null,\n\t\t\teyeSep: null\n\t\t};\n\n\t}\n\n\tupdate( camera ) {\n\n\t\tconst cache = this._cache;\n\n\t\tconst needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov ||\n\t\t\tcache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near ||\n\t\t\tcache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep;\n\n\t\tif ( needsUpdate ) {\n\n\t\t\tcache.focus = camera.focus;\n\t\t\tcache.fov = camera.fov;\n\t\t\tcache.aspect = camera.aspect * this.aspect;\n\t\t\tcache.near = camera.near;\n\t\t\tcache.far = camera.far;\n\t\t\tcache.zoom = camera.zoom;\n\t\t\tcache.eyeSep = this.eyeSep;\n\n\t\t\t// Off-axis stereoscopic effect based on\n\t\t\t// http://paulbourke.net/stereographics/stereorender/\n\n\t\t\t_projectionMatrix.copy( camera.projectionMatrix );\n\t\t\tconst eyeSepHalf = cache.eyeSep / 2;\n\t\t\tconst eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;\n\t\t\tconst ymax = ( cache.near * Math.tan( DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;\n\t\t\tlet xmin, xmax;\n\n\t\t\t// translate xOffset\n\n\t\t\t_eyeLeft.elements[ 12 ] = - eyeSepHalf;\n\t\t\t_eyeRight.elements[ 12 ] = eyeSepHalf;\n\n\t\t\t// for left eye\n\n\t\t\txmin = - ymax * cache.aspect + eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect + eyeSepOnProjection;\n\n\t\t\t_projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\t_projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraL.projectionMatrix.copy( _projectionMatrix );\n\n\t\t\t// for right eye\n\n\t\t\txmin = - ymax * cache.aspect - eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect - eyeSepOnProjection;\n\n\t\t\t_projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\t_projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraR.projectionMatrix.copy( _projectionMatrix );\n\n\t\t}\n\n\t\tthis.cameraL.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeLeft );\n\t\tthis.cameraR.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeRight );\n\n\t}\n\n}\n\nclass Clock {\n\n\tconstructor( autoStart = true ) {\n\n\t\tthis.autoStart = autoStart;\n\n\t\tthis.startTime = 0;\n\t\tthis.oldTime = 0;\n\t\tthis.elapsedTime = 0;\n\n\t\tthis.running = false;\n\n\t}\n\n\tstart() {\n\n\t\tthis.startTime = now();\n\n\t\tthis.oldTime = this.startTime;\n\t\tthis.elapsedTime = 0;\n\t\tthis.running = true;\n\n\t}\n\n\tstop() {\n\n\t\tthis.getElapsedTime();\n\t\tthis.running = false;\n\t\tthis.autoStart = false;\n\n\t}\n\n\tgetElapsedTime() {\n\n\t\tthis.getDelta();\n\t\treturn this.elapsedTime;\n\n\t}\n\n\tgetDelta() {\n\n\t\tlet diff = 0;\n\n\t\tif ( this.autoStart && ! this.running ) {\n\n\t\t\tthis.start();\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tif ( this.running ) {\n\n\t\t\tconst newTime = now();\n\n\t\t\tdiff = ( newTime - this.oldTime ) / 1000;\n\t\t\tthis.oldTime = newTime;\n\n\t\t\tthis.elapsedTime += diff;\n\n\t\t}\n\n\t\treturn diff;\n\n\t}\n\n}\n\nfunction now() {\n\n\treturn ( typeof performance === 'undefined' ? Date : performance ).now(); // see #10732\n\n}\n\nconst _position$1 = /*@__PURE__*/ new Vector3();\nconst _quaternion$1 = /*@__PURE__*/ new Quaternion();\nconst _scale$1 = /*@__PURE__*/ new Vector3();\nconst _orientation$1 = /*@__PURE__*/ new Vector3();\n\nclass AudioListener extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'AudioListener';\n\n\t\tthis.context = AudioContext.getContext();\n\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( this.context.destination );\n\n\t\tthis.filter = null;\n\n\t\tthis.timeDelta = 0;\n\n\t\t// private\n\n\t\tthis._clock = new Clock();\n\n\t}\n\n\tgetInput() {\n\n\t\treturn this.gain;\n\n\t}\n\n\tremoveFilter() {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\t\t\tthis.gain.connect( this.context.destination );\n\t\t\tthis.filter = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetFilter() {\n\n\t\treturn this.filter;\n\n\t}\n\n\tsetFilter( value ) {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\n\t\t} else {\n\n\t\t\tthis.gain.disconnect( this.context.destination );\n\n\t\t}\n\n\t\tthis.filter = value;\n\t\tthis.gain.connect( this.filter );\n\t\tthis.filter.connect( this.context.destination );\n\n\t\treturn this;\n\n\t}\n\n\tgetMasterVolume() {\n\n\t\treturn this.gain.gain.value;\n\n\t}\n\n\tsetMasterVolume( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tconst listener = this.context.listener;\n\t\tconst up = this.up;\n\n\t\tthis.timeDelta = this._clock.getDelta();\n\n\t\tthis.matrixWorld.decompose( _position$1, _quaternion$1, _scale$1 );\n\n\t\t_orientation$1.set( 0, 0, - 1 ).applyQuaternion( _quaternion$1 );\n\n\t\tif ( listener.positionX ) {\n\n\t\t\t// code path for Chrome (see #14393)\n\n\t\t\tconst endTime = this.context.currentTime + this.timeDelta;\n\n\t\t\tlistener.positionX.linearRampToValueAtTime( _position$1.x, endTime );\n\t\t\tlistener.positionY.linearRampToValueAtTime( _position$1.y, endTime );\n\t\t\tlistener.positionZ.linearRampToValueAtTime( _position$1.z, endTime );\n\t\t\tlistener.forwardX.linearRampToValueAtTime( _orientation$1.x, endTime );\n\t\t\tlistener.forwardY.linearRampToValueAtTime( _orientation$1.y, endTime );\n\t\t\tlistener.forwardZ.linearRampToValueAtTime( _orientation$1.z, endTime );\n\t\t\tlistener.upX.linearRampToValueAtTime( up.x, endTime );\n\t\t\tlistener.upY.linearRampToValueAtTime( up.y, endTime );\n\t\t\tlistener.upZ.linearRampToValueAtTime( up.z, endTime );\n\n\t\t} else {\n\n\t\t\tlistener.setPosition( _position$1.x, _position$1.y, _position$1.z );\n\t\t\tlistener.setOrientation( _orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z );\n\n\t\t}\n\n\t}\n\n}\n\nclass Audio extends Object3D {\n\n\tconstructor( listener ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Audio';\n\n\t\tthis.listener = listener;\n\t\tthis.context = listener.context;\n\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( listener.getInput() );\n\n\t\tthis.autoplay = false;\n\n\t\tthis.buffer = null;\n\t\tthis.detune = 0;\n\t\tthis.loop = false;\n\t\tthis.loopStart = 0;\n\t\tthis.loopEnd = 0;\n\t\tthis.offset = 0;\n\t\tthis.duration = undefined;\n\t\tthis.playbackRate = 1;\n\t\tthis.isPlaying = false;\n\t\tthis.hasPlaybackControl = true;\n\t\tthis.source = null;\n\t\tthis.sourceType = 'empty';\n\n\t\tthis._startedAt = 0;\n\t\tthis._progress = 0;\n\t\tthis._connected = false;\n\n\t\tthis.filters = [];\n\n\t}\n\n\tgetOutput() {\n\n\t\treturn this.gain;\n\n\t}\n\n\tsetNodeSource( audioNode ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'audioNode';\n\t\tthis.source = audioNode;\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetMediaElementSource( mediaElement ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaNode';\n\t\tthis.source = this.context.createMediaElementSource( mediaElement );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetMediaStreamSource( mediaStream ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaStreamNode';\n\t\tthis.source = this.context.createMediaStreamSource( mediaStream );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetBuffer( audioBuffer ) {\n\n\t\tthis.buffer = audioBuffer;\n\t\tthis.sourceType = 'buffer';\n\n\t\tif ( this.autoplay ) this.play();\n\n\t\treturn this;\n\n\t}\n\n\tplay( delay = 0 ) {\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: Audio is already playing.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._startedAt = this.context.currentTime + delay;\n\n\t\tconst source = this.context.createBufferSource();\n\t\tsource.buffer = this.buffer;\n\t\tsource.loop = this.loop;\n\t\tsource.loopStart = this.loopStart;\n\t\tsource.loopEnd = this.loopEnd;\n\t\tsource.onended = this.onEnded.bind( this );\n\t\tsource.start( this._startedAt, this._progress + this.offset, this.duration );\n\n\t\tthis.isPlaying = true;\n\n\t\tthis.source = source;\n\n\t\tthis.setDetune( this.detune );\n\t\tthis.setPlaybackRate( this.playbackRate );\n\n\t\treturn this.connect();\n\n\t}\n\n\tpause() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\t// update current progress\n\n\t\t\tthis._progress += Math.max( this.context.currentTime - this._startedAt, 0 ) * this.playbackRate;\n\n\t\t\tif ( this.loop === true ) {\n\n\t\t\t\t// ensure _progress does not exceed duration with looped audios\n\n\t\t\t\tthis._progress = this._progress % ( this.duration || this.buffer.duration );\n\n\t\t\t}\n\n\t\t\tthis.source.stop();\n\t\t\tthis.source.onended = null;\n\n\t\t\tthis.isPlaying = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tstop() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._progress = 0;\n\n\t\tif ( this.source !== null ) {\n\n\t\t\tthis.source.stop();\n\t\t\tthis.source.onended = null;\n\n\t\t}\n\n\t\tthis.isPlaying = false;\n\n\t\treturn this;\n\n\t}\n\n\tconnect() {\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.connect( this.filters[ 0 ] );\n\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].connect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].connect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.connect( this.getOutput() );\n\n\t\t}\n\n\t\tthis._connected = true;\n\n\t\treturn this;\n\n\t}\n\n\tdisconnect() {\n\n\t\tif ( this._connected === false ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.disconnect( this.filters[ 0 ] );\n\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].disconnect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].disconnect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.disconnect( this.getOutput() );\n\n\t\t}\n\n\t\tthis._connected = false;\n\n\t\treturn this;\n\n\t}\n\n\tgetFilters() {\n\n\t\treturn this.filters;\n\n\t}\n\n\tsetFilters( value ) {\n\n\t\tif ( ! value ) value = [];\n\n\t\tif ( this._connected === true ) {\n\n\t\t\tthis.disconnect();\n\t\t\tthis.filters = value.slice();\n\t\t\tthis.connect();\n\n\t\t} else {\n\n\t\t\tthis.filters = value.slice();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetDetune( value ) {\n\n\t\tthis.detune = value;\n\n\t\tif ( this.isPlaying === true && this.source.detune !== undefined ) {\n\n\t\t\tthis.source.detune.setTargetAtTime( this.detune, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetDetune() {\n\n\t\treturn this.detune;\n\n\t}\n\n\tgetFilter() {\n\n\t\treturn this.getFilters()[ 0 ];\n\n\t}\n\n\tsetFilter( filter ) {\n\n\t\treturn this.setFilters( filter ? [ filter ] : [] );\n\n\t}\n\n\tsetPlaybackRate( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.playbackRate = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.playbackRate.setTargetAtTime( this.playbackRate, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetPlaybackRate() {\n\n\t\treturn this.playbackRate;\n\n\t}\n\n\tonEnded() {\n\n\t\tthis.isPlaying = false;\n\n\t}\n\n\tgetLoop() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn this.loop;\n\n\t}\n\n\tsetLoop( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.loop = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.loop = this.loop;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetLoopStart( value ) {\n\n\t\tthis.loopStart = value;\n\n\t\treturn this;\n\n\t}\n\n\tsetLoopEnd( value ) {\n\n\t\tthis.loopEnd = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetVolume() {\n\n\t\treturn this.gain.gain.value;\n\n\t}\n\n\tsetVolume( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _position = /*@__PURE__*/ new Vector3();\nconst _quaternion = /*@__PURE__*/ new Quaternion();\nconst _scale = /*@__PURE__*/ new Vector3();\nconst _orientation = /*@__PURE__*/ new Vector3();\n\nclass PositionalAudio extends Audio {\n\n\tconstructor( listener ) {\n\n\t\tsuper( listener );\n\n\t\tthis.panner = this.context.createPanner();\n\t\tthis.panner.panningModel = 'HRTF';\n\t\tthis.panner.connect( this.gain );\n\n\t}\n\n\tconnect() {\n\n\t\tsuper.connect();\n\n\t\tthis.panner.connect( this.gain );\n\n\t}\n\n\tdisconnect() {\n\n\t\tsuper.disconnect();\n\n\t\tthis.panner.disconnect( this.gain );\n\n\t}\n\n\tgetOutput() {\n\n\t\treturn this.panner;\n\n\t}\n\n\tgetRefDistance() {\n\n\t\treturn this.panner.refDistance;\n\n\t}\n\n\tsetRefDistance( value ) {\n\n\t\tthis.panner.refDistance = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetRolloffFactor() {\n\n\t\treturn this.panner.rolloffFactor;\n\n\t}\n\n\tsetRolloffFactor( value ) {\n\n\t\tthis.panner.rolloffFactor = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetDistanceModel() {\n\n\t\treturn this.panner.distanceModel;\n\n\t}\n\n\tsetDistanceModel( value ) {\n\n\t\tthis.panner.distanceModel = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetMaxDistance() {\n\n\t\treturn this.panner.maxDistance;\n\n\t}\n\n\tsetMaxDistance( value ) {\n\n\t\tthis.panner.maxDistance = value;\n\n\t\treturn this;\n\n\t}\n\n\tsetDirectionalCone( coneInnerAngle, coneOuterAngle, coneOuterGain ) {\n\n\t\tthis.panner.coneInnerAngle = coneInnerAngle;\n\t\tthis.panner.coneOuterAngle = coneOuterAngle;\n\t\tthis.panner.coneOuterGain = coneOuterGain;\n\n\t\treturn this;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tif ( this.hasPlaybackControl === true && this.isPlaying === false ) return;\n\n\t\tthis.matrixWorld.decompose( _position, _quaternion, _scale );\n\n\t\t_orientation.set( 0, 0, 1 ).applyQuaternion( _quaternion );\n\n\t\tconst panner = this.panner;\n\n\t\tif ( panner.positionX ) {\n\n\t\t\t// code path for Chrome and Firefox (see #14393)\n\n\t\t\tconst endTime = this.context.currentTime + this.listener.timeDelta;\n\n\t\t\tpanner.positionX.linearRampToValueAtTime( _position.x, endTime );\n\t\t\tpanner.positionY.linearRampToValueAtTime( _position.y, endTime );\n\t\t\tpanner.positionZ.linearRampToValueAtTime( _position.z, endTime );\n\t\t\tpanner.orientationX.linearRampToValueAtTime( _orientation.x, endTime );\n\t\t\tpanner.orientationY.linearRampToValueAtTime( _orientation.y, endTime );\n\t\t\tpanner.orientationZ.linearRampToValueAtTime( _orientation.z, endTime );\n\n\t\t} else {\n\n\t\t\tpanner.setPosition( _position.x, _position.y, _position.z );\n\t\t\tpanner.setOrientation( _orientation.x, _orientation.y, _orientation.z );\n\n\t\t}\n\n\t}\n\n}\n\nclass AudioAnalyser {\n\n\tconstructor( audio, fftSize = 2048 ) {\n\n\t\tthis.analyser = audio.context.createAnalyser();\n\t\tthis.analyser.fftSize = fftSize;\n\n\t\tthis.data = new Uint8Array( this.analyser.frequencyBinCount );\n\n\t\taudio.getOutput().connect( this.analyser );\n\n\t}\n\n\n\tgetFrequencyData() {\n\n\t\tthis.analyser.getByteFrequencyData( this.data );\n\n\t\treturn this.data;\n\n\t}\n\n\tgetAverageFrequency() {\n\n\t\tlet value = 0;\n\t\tconst data = this.getFrequencyData();\n\n\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\tvalue += data[ i ];\n\n\t\t}\n\n\t\treturn value / data.length;\n\n\t}\n\n}\n\nclass PropertyMixer {\n\n\tconstructor( binding, typeName, valueSize ) {\n\n\t\tthis.binding = binding;\n\t\tthis.valueSize = valueSize;\n\n\t\tlet mixFunction,\n\t\t\tmixFunctionAdditive,\n\t\t\tsetIdentity;\n\n\t\t// buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ]\n\t\t//\n\t\t// interpolators can use .buffer as their .result\n\t\t// the data then goes to 'incoming'\n\t\t//\n\t\t// 'accu0' and 'accu1' are used frame-interleaved for\n\t\t// the cumulative result and are compared to detect\n\t\t// changes\n\t\t//\n\t\t// 'orig' stores the original state of the property\n\t\t//\n\t\t// 'add' is used for additive cumulative results\n\t\t//\n\t\t// 'work' is optional and is only present for quaternion types. It is used\n\t\t// to store intermediate quaternion multiplication results\n\n\t\tswitch ( typeName ) {\n\n\t\t\tcase 'quaternion':\n\t\t\t\tmixFunction = this._slerp;\n\t\t\t\tmixFunctionAdditive = this._slerpAdditive;\n\t\t\t\tsetIdentity = this._setAdditiveIdentityQuaternion;\n\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 6 );\n\t\t\t\tthis._workIndex = 5;\n\t\t\t\tbreak;\n\n\t\t\tcase 'string':\n\t\t\tcase 'bool':\n\t\t\t\tmixFunction = this._select;\n\n\t\t\t\t// Use the regular mix function and for additive on these types,\n\t\t\t\t// additive is not relevant for non-numeric types\n\t\t\t\tmixFunctionAdditive = this._select;\n\n\t\t\t\tsetIdentity = this._setAdditiveIdentityOther;\n\n\t\t\t\tthis.buffer = new Array( valueSize * 5 );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tmixFunction = this._lerp;\n\t\t\t\tmixFunctionAdditive = this._lerpAdditive;\n\t\t\t\tsetIdentity = this._setAdditiveIdentityNumeric;\n\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 5 );\n\n\t\t}\n\n\t\tthis._mixBufferRegion = mixFunction;\n\t\tthis._mixBufferRegionAdditive = mixFunctionAdditive;\n\t\tthis._setIdentity = setIdentity;\n\t\tthis._origIndex = 3;\n\t\tthis._addIndex = 4;\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t\tthis.useCount = 0;\n\t\tthis.referenceCount = 0;\n\n\t}\n\n\t// accumulate data in the 'incoming' region into 'accu'\n\taccumulate( accuIndex, weight ) {\n\n\t\t// note: happily accumulating nothing when weight = 0, the caller knows\n\t\t// the weight and shouldn't have made the call in the first place\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = accuIndex * stride + stride;\n\n\t\tlet currentWeight = this.cumulativeWeight;\n\n\t\tif ( currentWeight === 0 ) {\n\n\t\t\t// accuN := incoming * weight\n\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ offset + i ] = buffer[ i ];\n\n\t\t\t}\n\n\t\t\tcurrentWeight = weight;\n\n\t\t} else {\n\n\t\t\t// accuN := accuN + incoming * weight\n\n\t\t\tcurrentWeight += weight;\n\t\t\tconst mix = weight / currentWeight;\n\t\t\tthis._mixBufferRegion( buffer, offset, 0, mix, stride );\n\n\t\t}\n\n\t\tthis.cumulativeWeight = currentWeight;\n\n\t}\n\n\t// accumulate data in the 'incoming' region into 'add'\n\taccumulateAdditive( weight ) {\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = stride * this._addIndex;\n\n\t\tif ( this.cumulativeWeightAdditive === 0 ) {\n\n\t\t\t// add = identity\n\n\t\t\tthis._setIdentity();\n\n\t\t}\n\n\t\t// add := add + incoming * weight\n\n\t\tthis._mixBufferRegionAdditive( buffer, offset, 0, weight, stride );\n\t\tthis.cumulativeWeightAdditive += weight;\n\n\t}\n\n\t// apply the state of 'accu' to the binding when accus differ\n\tapply( accuIndex ) {\n\n\t\tconst stride = this.valueSize,\n\t\t\tbuffer = this.buffer,\n\t\t\toffset = accuIndex * stride + stride,\n\n\t\t\tweight = this.cumulativeWeight,\n\t\t\tweightAdditive = this.cumulativeWeightAdditive,\n\n\t\t\tbinding = this.binding;\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t\tif ( weight < 1 ) {\n\n\t\t\t// accuN := accuN + original * ( 1 - cumulativeWeight )\n\n\t\t\tconst originalValueOffset = stride * this._origIndex;\n\n\t\t\tthis._mixBufferRegion(\n\t\t\t\tbuffer, offset, originalValueOffset, 1 - weight, stride );\n\n\t\t}\n\n\t\tif ( weightAdditive > 0 ) {\n\n\t\t\t// accuN := accuN + additive accuN\n\n\t\t\tthis._mixBufferRegionAdditive( buffer, offset, this._addIndex * stride, 1, stride );\n\n\t\t}\n\n\t\tfor ( let i = stride, e = stride + stride; i !== e; ++ i ) {\n\n\t\t\tif ( buffer[ i ] !== buffer[ i + stride ] ) {\n\n\t\t\t\t// value has changed -> update scene graph\n\n\t\t\t\tbinding.setValue( buffer, offset );\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// remember the state of the bound property and copy it to both accus\n\tsaveOriginalState() {\n\n\t\tconst binding = this.binding;\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\n\t\t\toriginalValueOffset = stride * this._origIndex;\n\n\t\tbinding.getValue( buffer, originalValueOffset );\n\n\t\t// accu[0..1] := orig -- initially detect changes against the original\n\t\tfor ( let i = stride, e = originalValueOffset; i !== e; ++ i ) {\n\n\t\t\tbuffer[ i ] = buffer[ originalValueOffset + ( i % stride ) ];\n\n\t\t}\n\n\t\t// Add to identity for additive\n\t\tthis._setIdentity();\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t}\n\n\t// apply the state previously taken via 'saveOriginalState' to the binding\n\trestoreOriginalState() {\n\n\t\tconst originalValueOffset = this.valueSize * 3;\n\t\tthis.binding.setValue( this.buffer, originalValueOffset );\n\n\t}\n\n\t_setAdditiveIdentityNumeric() {\n\n\t\tconst startIndex = this._addIndex * this.valueSize;\n\t\tconst endIndex = startIndex + this.valueSize;\n\n\t\tfor ( let i = startIndex; i < endIndex; i ++ ) {\n\n\t\t\tthis.buffer[ i ] = 0;\n\n\t\t}\n\n\t}\n\n\t_setAdditiveIdentityQuaternion() {\n\n\t\tthis._setAdditiveIdentityNumeric();\n\t\tthis.buffer[ this._addIndex * this.valueSize + 3 ] = 1;\n\n\t}\n\n\t_setAdditiveIdentityOther() {\n\n\t\tconst startIndex = this._origIndex * this.valueSize;\n\t\tconst targetIndex = this._addIndex * this.valueSize;\n\n\t\tfor ( let i = 0; i < this.valueSize; i ++ ) {\n\n\t\t\tthis.buffer[ targetIndex + i ] = this.buffer[ startIndex + i ];\n\n\t\t}\n\n\t}\n\n\n\t// mix functions\n\n\t_select( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tif ( t >= 0.5 ) {\n\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ dstOffset + i ] = buffer[ srcOffset + i ];\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_slerp( buffer, dstOffset, srcOffset, t ) {\n\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t );\n\n\t}\n\n\t_slerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tconst workOffset = this._workIndex * stride;\n\n\t\t// Store result in intermediate buffer offset\n\t\tQuaternion.multiplyQuaternionsFlat( buffer, workOffset, buffer, dstOffset, buffer, srcOffset );\n\n\t\t// Slerp to the intermediate result\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t );\n\n\t}\n\n\t_lerp( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tconst s = 1 - t;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tconst j = dstOffset + i;\n\n\t\t\tbuffer[ j ] = buffer[ j ] * s + buffer[ srcOffset + i ] * t;\n\n\t\t}\n\n\t}\n\n\t_lerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tconst j = dstOffset + i;\n\n\t\t\tbuffer[ j ] = buffer[ j ] + buffer[ srcOffset + i ] * t;\n\n\t\t}\n\n\t}\n\n}\n\n// Characters [].:/ are reserved for track binding syntax.\nconst _RESERVED_CHARS_RE = '\\\\[\\\\]\\\\.:\\\\/';\nconst _reservedRe = new RegExp( '[' + _RESERVED_CHARS_RE + ']', 'g' );\n\n// Attempts to allow node names from any language. ES5's `\\w` regexp matches\n// only latin characters, and the unicode \\p{L} is not yet supported. So\n// instead, we exclude reserved characters and match everything else.\nconst _wordChar = '[^' + _RESERVED_CHARS_RE + ']';\nconst _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace( '\\\\.', '' ) + ']';\n\n// Parent directories, delimited by '/' or ':'. Currently unused, but must\n// be matched to parse the rest of the track name.\nconst _directoryRe = /*@__PURE__*/ /((?:WC+[\\/:])*)/.source.replace( 'WC', _wordChar );\n\n// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.\nconst _nodeRe = /*@__PURE__*/ /(WCOD+)?/.source.replace( 'WCOD', _wordCharOrDot );\n\n// Object on target node, and accessor. May not contain reserved\n// characters. Accessor may contain any character except closing bracket.\nconst _objectRe = /*@__PURE__*/ /(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace( 'WC', _wordChar );\n\n// Property and accessor. May not contain reserved characters. Accessor may\n// contain any non-bracket characters.\nconst _propertyRe = /*@__PURE__*/ /\\.(WC+)(?:\\[(.+)\\])?/.source.replace( 'WC', _wordChar );\n\nconst _trackRe = new RegExp( ''\n\t+ '^'\n\t+ _directoryRe\n\t+ _nodeRe\n\t+ _objectRe\n\t+ _propertyRe\n\t+ '$'\n);\n\nconst _supportedObjectNames = [ 'material', 'materials', 'bones', 'map' ];\n\nclass Composite {\n\n\tconstructor( targetGroup, path, optionalParsedPath ) {\n\n\t\tconst parsedPath = optionalParsedPath || PropertyBinding.parseTrackName( path );\n\n\t\tthis._targetGroup = targetGroup;\n\t\tthis._bindings = targetGroup.subscribe_( path, parsedPath );\n\n\t}\n\n\tgetValue( array, offset ) {\n\n\t\tthis.bind(); // bind all binding\n\n\t\tconst firstValidIndex = this._targetGroup.nCachedObjects_,\n\t\t\tbinding = this._bindings[ firstValidIndex ];\n\n\t\t// and only call .getValue on the first\n\t\tif ( binding !== undefined ) binding.getValue( array, offset );\n\n\t}\n\n\tsetValue( array, offset ) {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].setValue( array, offset );\n\n\t\t}\n\n\t}\n\n\tbind() {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].bind();\n\n\t\t}\n\n\t}\n\n\tunbind() {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].unbind();\n\n\t\t}\n\n\t}\n\n}\n\n// Note: This class uses a State pattern on a per-method basis:\n// 'bind' sets 'this.getValue' / 'setValue' and shadows the\n// prototype version of these methods with one that represents\n// the bound state. When the property is not found, the methods\n// become no-ops.\nclass PropertyBinding {\n\n\tconstructor( rootNode, path, parsedPath ) {\n\n\t\tthis.path = path;\n\t\tthis.parsedPath = parsedPath || PropertyBinding.parseTrackName( path );\n\n\t\tthis.node = PropertyBinding.findNode( rootNode, this.parsedPath.nodeName );\n\n\t\tthis.rootNode = rootNode;\n\n\t\t// initial state of these methods that calls 'bind'\n\t\tthis.getValue = this._getValue_unbound;\n\t\tthis.setValue = this._setValue_unbound;\n\n\t}\n\n\n\tstatic create( root, path, parsedPath ) {\n\n\t\tif ( ! ( root && root.isAnimationObjectGroup ) ) {\n\n\t\t\treturn new PropertyBinding( root, path, parsedPath );\n\n\t\t} else {\n\n\t\t\treturn new PropertyBinding.Composite( root, path, parsedPath );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Replaces spaces with underscores and removes unsupported characters from\n\t * node names, to ensure compatibility with parseTrackName().\n\t *\n\t * @param {string} name Node name to be sanitized.\n\t * @return {string}\n\t */\n\tstatic sanitizeNodeName( name ) {\n\n\t\treturn name.replace( /\\s/g, '_' ).replace( _reservedRe, '' );\n\n\t}\n\n\tstatic parseTrackName( trackName ) {\n\n\t\tconst matches = _trackRe.exec( trackName );\n\n\t\tif ( matches === null ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );\n\n\t\t}\n\n\t\tconst results = {\n\t\t\t// directoryName: matches[ 1 ], // (tschw) currently unused\n\t\t\tnodeName: matches[ 2 ],\n\t\t\tobjectName: matches[ 3 ],\n\t\t\tobjectIndex: matches[ 4 ],\n\t\t\tpropertyName: matches[ 5 ], // required\n\t\t\tpropertyIndex: matches[ 6 ]\n\t\t};\n\n\t\tconst lastDot = results.nodeName && results.nodeName.lastIndexOf( '.' );\n\n\t\tif ( lastDot !== undefined && lastDot !== - 1 ) {\n\n\t\t\tconst objectName = results.nodeName.substring( lastDot + 1 );\n\n\t\t\t// Object names must be checked against an allowlist. Otherwise, there\n\t\t\t// is no way to parse 'foo.bar.baz': 'baz' must be a property, but\n\t\t\t// 'bar' could be the objectName, or part of a nodeName (which can\n\t\t\t// include '.' characters).\n\t\t\tif ( _supportedObjectNames.indexOf( objectName ) !== - 1 ) {\n\n\t\t\t\tresults.nodeName = results.nodeName.substring( 0, lastDot );\n\t\t\t\tresults.objectName = objectName;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( results.propertyName === null || results.propertyName.length === 0 ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: can not parse propertyName from trackName: ' + trackName );\n\n\t\t}\n\n\t\treturn results;\n\n\t}\n\n\tstatic findNode( root, nodeName ) {\n\n\t\tif ( nodeName === undefined || nodeName === '' || nodeName === '.' || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) {\n\n\t\t\treturn root;\n\n\t\t}\n\n\t\t// search into skeleton bones.\n\t\tif ( root.skeleton ) {\n\n\t\t\tconst bone = root.skeleton.getBoneByName( nodeName );\n\n\t\t\tif ( bone !== undefined ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// search into node subtree.\n\t\tif ( root.children ) {\n\n\t\t\tconst searchNodeSubtree = function ( children ) {\n\n\t\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\t\tconst childNode = children[ i ];\n\n\t\t\t\t\tif ( childNode.name === nodeName || childNode.uuid === nodeName ) {\n\n\t\t\t\t\t\treturn childNode;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst result = searchNodeSubtree( childNode.children );\n\n\t\t\t\t\tif ( result ) return result;\n\n\t\t\t\t}\n\n\t\t\t\treturn null;\n\n\t\t\t};\n\n\t\t\tconst subTreeNode = searchNodeSubtree( root.children );\n\n\t\t\tif ( subTreeNode ) {\n\n\t\t\t\treturn subTreeNode;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t// these are used to \"bind\" a nonexistent property\n\t_getValue_unavailable() {}\n\t_setValue_unavailable() {}\n\n\t// Getters\n\n\t_getValue_direct( buffer, offset ) {\n\n\t\tbuffer[ offset ] = this.targetObject[ this.propertyName ];\n\n\t}\n\n\t_getValue_array( buffer, offset ) {\n\n\t\tconst source = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = source.length; i !== n; ++ i ) {\n\n\t\t\tbuffer[ offset ++ ] = source[ i ];\n\n\t\t}\n\n\t}\n\n\t_getValue_arrayElement( buffer, offset ) {\n\n\t\tbuffer[ offset ] = this.resolvedProperty[ this.propertyIndex ];\n\n\t}\n\n\t_getValue_toArray( buffer, offset ) {\n\n\t\tthis.resolvedProperty.toArray( buffer, offset );\n\n\t}\n\n\t// Direct\n\n\t_setValue_direct( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\n\t}\n\n\t_setValue_direct_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_direct_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// EntireArray\n\n\t_setValue_array( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t}\n\n\t_setValue_array_setNeedsUpdate( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_array_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// ArrayElement\n\n\t_setValue_arrayElement( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\n\t}\n\n\t_setValue_arrayElement_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_arrayElement_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// HasToFromArray\n\n\t_setValue_fromArray( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\n\t}\n\n\t_setValue_fromArray_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_fromArray_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t_getValue_unbound( targetArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.getValue( targetArray, offset );\n\n\t}\n\n\t_setValue_unbound( sourceArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.setValue( sourceArray, offset );\n\n\t}\n\n\t// create getter / setter pair for a property in the scene graph\n\tbind() {\n\n\t\tlet targetObject = this.node;\n\t\tconst parsedPath = this.parsedPath;\n\n\t\tconst objectName = parsedPath.objectName;\n\t\tconst propertyName = parsedPath.propertyName;\n\t\tlet propertyIndex = parsedPath.propertyIndex;\n\n\t\tif ( ! targetObject ) {\n\n\t\t\ttargetObject = PropertyBinding.findNode( this.rootNode, parsedPath.nodeName );\n\n\t\t\tthis.node = targetObject;\n\n\t\t}\n\n\t\t// set fail state so we can just 'return' on error\n\t\tthis.getValue = this._getValue_unavailable;\n\t\tthis.setValue = this._setValue_unavailable;\n\n\t\t// ensure there is a value node\n\t\tif ( ! targetObject ) {\n\n\t\t\tconsole.warn( 'THREE.PropertyBinding: No target node found for track: ' + this.path + '.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( objectName ) {\n\n\t\t\tlet objectIndex = parsedPath.objectIndex;\n\n\t\t\t// special cases were we need to reach deeper into the hierarchy to get the face materials....\n\t\t\tswitch ( objectName ) {\n\n\t\t\t\tcase 'materials':\n\n\t\t\t\t\tif ( ! targetObject.material ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material.materials ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject.material.materials;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'bones':\n\n\t\t\t\t\tif ( ! targetObject.skeleton ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// potential future optimization: skip this if propertyIndex is already an integer\n\t\t\t\t\t// and convert the integer string to a true integer.\n\n\t\t\t\t\ttargetObject = targetObject.skeleton.bones;\n\n\t\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\t\tfor ( let i = 0; i < targetObject.length; i ++ ) {\n\n\t\t\t\t\t\tif ( targetObject[ i ].name === objectIndex ) {\n\n\t\t\t\t\t\t\tobjectIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'map':\n\n\t\t\t\t\tif ( 'map' in targetObject ) {\n\n\t\t\t\t\t\ttargetObject = targetObject.map;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material.map ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject.material.map;\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tif ( targetObject[ objectName ] === undefined ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to objectName of node undefined.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject[ objectName ];\n\n\t\t\t}\n\n\n\t\t\tif ( objectIndex !== undefined ) {\n\n\t\t\t\tif ( targetObject[ objectIndex ] === undefined ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\ttargetObject = targetObject[ objectIndex ];\n\n\t\t\t}\n\n\t\t}\n\n\t\t// resolve property\n\t\tconst nodeProperty = targetObject[ propertyName ];\n\n\t\tif ( nodeProperty === undefined ) {\n\n\t\t\tconst nodeName = parsedPath.nodeName;\n\n\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to update property for track: ' + nodeName +\n\t\t\t\t'.' + propertyName + ' but it wasn\\'t found.', targetObject );\n\t\t\treturn;\n\n\t\t}\n\n\t\t// determine versioning scheme\n\t\tlet versioning = this.Versioning.None;\n\n\t\tthis.targetObject = targetObject;\n\n\t\tif ( targetObject.needsUpdate !== undefined ) { // material\n\n\t\t\tversioning = this.Versioning.NeedsUpdate;\n\n\t\t} else if ( targetObject.matrixWorldNeedsUpdate !== undefined ) { // node transform\n\n\t\t\tversioning = this.Versioning.MatrixWorldNeedsUpdate;\n\n\t\t}\n\n\t\t// determine how the property gets bound\n\t\tlet bindingType = this.BindingType.Direct;\n\n\t\tif ( propertyIndex !== undefined ) {\n\n\t\t\t// access a sub element of the property array (only primitives are supported right now)\n\n\t\t\tif ( propertyName === 'morphTargetInfluences' ) {\n\n\t\t\t\t// potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.\n\n\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\tif ( ! targetObject.geometry ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( ! targetObject.geometry.morphAttributes ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( targetObject.morphTargetDictionary[ propertyIndex ] !== undefined ) {\n\n\t\t\t\t\tpropertyIndex = targetObject.morphTargetDictionary[ propertyIndex ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tbindingType = this.BindingType.ArrayElement;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\t\t\tthis.propertyIndex = propertyIndex;\n\n\t\t} else if ( nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined ) {\n\n\t\t\t// must use copy for Object3D.Euler/Quaternion\n\n\t\t\tbindingType = this.BindingType.HasFromToArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else if ( Array.isArray( nodeProperty ) ) {\n\n\t\t\tbindingType = this.BindingType.EntireArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else {\n\n\t\t\tthis.propertyName = propertyName;\n\n\t\t}\n\n\t\t// select getter / setter\n\t\tthis.getValue = this.GetterByBindingType[ bindingType ];\n\t\tthis.setValue = this.SetterByBindingTypeAndVersioning[ bindingType ][ versioning ];\n\n\t}\n\n\tunbind() {\n\n\t\tthis.node = null;\n\n\t\t// back to the prototype version of getValue / setValue\n\t\t// note: avoiding to mutate the shape of 'this' via 'delete'\n\t\tthis.getValue = this._getValue_unbound;\n\t\tthis.setValue = this._setValue_unbound;\n\n\t}\n\n}\n\nPropertyBinding.Composite = Composite;\n\nPropertyBinding.prototype.BindingType = {\n\tDirect: 0,\n\tEntireArray: 1,\n\tArrayElement: 2,\n\tHasFromToArray: 3\n};\n\nPropertyBinding.prototype.Versioning = {\n\tNone: 0,\n\tNeedsUpdate: 1,\n\tMatrixWorldNeedsUpdate: 2\n};\n\nPropertyBinding.prototype.GetterByBindingType = [\n\n\tPropertyBinding.prototype._getValue_direct,\n\tPropertyBinding.prototype._getValue_array,\n\tPropertyBinding.prototype._getValue_arrayElement,\n\tPropertyBinding.prototype._getValue_toArray,\n\n];\n\nPropertyBinding.prototype.SetterByBindingTypeAndVersioning = [\n\n\t[\n\t\t// Direct\n\t\tPropertyBinding.prototype._setValue_direct,\n\t\tPropertyBinding.prototype._setValue_direct_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// EntireArray\n\n\t\tPropertyBinding.prototype._setValue_array,\n\t\tPropertyBinding.prototype._setValue_array_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// ArrayElement\n\t\tPropertyBinding.prototype._setValue_arrayElement,\n\t\tPropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// HasToFromArray\n\t\tPropertyBinding.prototype._setValue_fromArray,\n\t\tPropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate,\n\n\t]\n\n];\n\n/**\n *\n * A group of objects that receives a shared animation state.\n *\n * Usage:\n *\n * - Add objects you would otherwise pass as 'root' to the\n * constructor or the .clipAction method of AnimationMixer.\n *\n * - Instead pass this object as 'root'.\n *\n * - You can also add and remove objects later when the mixer\n * is running.\n *\n * Note:\n *\n * Objects of this class appear as one object to the mixer,\n * so cache control of the individual objects must be done\n * on the group.\n *\n * Limitation:\n *\n * - The animated properties must be compatible among the\n * all objects in the group.\n *\n * - A single property can either be controlled through a\n * target group or directly, but not both.\n */\n\nclass AnimationObjectGroup {\n\n\tconstructor() {\n\n\t\tthis.isAnimationObjectGroup = true;\n\n\t\tthis.uuid = generateUUID();\n\n\t\t// cached objects followed by the active ones\n\t\tthis._objects = Array.prototype.slice.call( arguments );\n\n\t\tthis.nCachedObjects_ = 0; // threshold\n\t\t// note: read by PropertyBinding.Composite\n\n\t\tconst indices = {};\n\t\tthis._indicesByUUID = indices; // for bookkeeping\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tindices[ arguments[ i ].uuid ] = i;\n\n\t\t}\n\n\t\tthis._paths = []; // inside: string\n\t\tthis._parsedPaths = []; // inside: { we don't care, here }\n\t\tthis._bindings = []; // inside: Array< PropertyBinding >\n\t\tthis._bindingsIndicesByPath = {}; // inside: indices in these arrays\n\n\t\tconst scope = this;\n\n\t\tthis.stats = {\n\n\t\t\tobjects: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._objects.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn this.total - scope.nCachedObjects_;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tget bindingsPerObject() {\n\n\t\t\t\treturn scope._bindings.length;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tadd() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tpaths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet knownObject = undefined,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid;\n\t\t\tlet index = indicesByUUID[ uuid ];\n\n\t\t\tif ( index === undefined ) {\n\n\t\t\t\t// unknown object -> add it to the ACTIVE region\n\n\t\t\t\tindex = nObjects ++;\n\t\t\t\tindicesByUUID[ uuid ] = index;\n\t\t\t\tobjects.push( object );\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tbindings[ j ].push( new PropertyBinding( object, paths[ j ], parsedPaths[ j ] ) );\n\n\t\t\t\t}\n\n\t\t\t} else if ( index < nCachedObjects ) {\n\n\t\t\t\tknownObject = objects[ index ];\n\n\t\t\t\t// move existing object to the ACTIVE region\n\n\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ];\n\n\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = firstActiveIndex;\n\t\t\t\tobjects[ firstActiveIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ];\n\n\t\t\t\t\tlet binding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\n\t\t\t\t\tif ( binding === undefined ) {\n\n\t\t\t\t\t\t// since we do not bother to create new bindings\n\t\t\t\t\t\t// for objects that are cached, the binding may\n\t\t\t\t\t\t// or may not exist\n\n\t\t\t\t\t\tbinding = new PropertyBinding( object, paths[ j ], parsedPaths[ j ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t} else if ( objects[ index ] !== knownObject ) {\n\n\t\t\t\tconsole.error( 'THREE.AnimationObjectGroup: Different objects with the same UUID ' +\n\t\t\t\t\t'detected. Clean the caches or recreate your infrastructure when reloading scenes.' );\n\n\t\t\t} // else the object is already where we want it to be\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\tremove() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet nCachedObjects = this.nCachedObjects_;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined && index >= nCachedObjects ) {\n\n\t\t\t\t// move existing object into the CACHED region\n\n\t\t\t\tconst lastCachedIndex = nCachedObjects ++,\n\t\t\t\t\tfirstActiveObject = objects[ lastCachedIndex ];\n\n\t\t\t\tindicesByUUID[ firstActiveObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = firstActiveObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = lastCachedIndex;\n\t\t\t\tobjects[ lastCachedIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tfirstActive = bindingsForPath[ lastCachedIndex ],\n\t\t\t\t\t\tbinding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = firstActive;\n\t\t\t\t\tbindingsForPath[ lastCachedIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\t// remove & forget\n\tuncache() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet nCachedObjects = this.nCachedObjects_,\n\t\t\tnObjects = objects.length;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined ) {\n\n\t\t\t\tdelete indicesByUUID[ uuid ];\n\n\t\t\t\tif ( index < nCachedObjects ) {\n\n\t\t\t\t\t// object is cached, shrink the CACHED region\n\n\t\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ],\n\t\t\t\t\t\tlastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\t// last cached object takes this object's place\n\t\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\t\t// last object goes to the activated slot and pop\n\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = firstActiveIndex;\n\t\t\t\t\tobjects[ firstActiveIndex ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ],\n\t\t\t\t\t\t\tlast = bindingsForPath[ lastIndex ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\t\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = last;\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// object is active, just swap with the last and pop\n\n\t\t\t\t\tconst lastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\tif ( lastIndex > 0 ) {\n\n\t\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = index;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tobjects[ index ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = bindingsForPath[ lastIndex ];\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} // cached or active\n\n\t\t\t} // if object is known\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\t// Internal interface used by befriended PropertyBinding.Composite:\n\n\tsubscribe_( path, parsedPath ) {\n\n\t\t// returns an array of bindings for the given path that is changed\n\t\t// according to the contained objects in the group\n\n\t\tconst indicesByPath = this._bindingsIndicesByPath;\n\t\tlet index = indicesByPath[ path ];\n\t\tconst bindings = this._bindings;\n\n\t\tif ( index !== undefined ) return bindings[ index ];\n\n\t\tconst paths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tobjects = this._objects,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_,\n\t\t\tbindingsForPath = new Array( nObjects );\n\n\t\tindex = bindings.length;\n\n\t\tindicesByPath[ path ] = index;\n\n\t\tpaths.push( path );\n\t\tparsedPaths.push( parsedPath );\n\t\tbindings.push( bindingsForPath );\n\n\t\tfor ( let i = nCachedObjects, n = objects.length; i !== n; ++ i ) {\n\n\t\t\tconst object = objects[ i ];\n\t\t\tbindingsForPath[ i ] = new PropertyBinding( object, path, parsedPath );\n\n\t\t}\n\n\t\treturn bindingsForPath;\n\n\t}\n\n\tunsubscribe_( path ) {\n\n\t\t// tells the group to forget about a property path and no longer\n\t\t// update the array previously obtained with 'subscribe_'\n\n\t\tconst indicesByPath = this._bindingsIndicesByPath,\n\t\t\tindex = indicesByPath[ path ];\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tconst paths = this._paths,\n\t\t\t\tparsedPaths = this._parsedPaths,\n\t\t\t\tbindings = this._bindings,\n\t\t\t\tlastBindingsIndex = bindings.length - 1,\n\t\t\t\tlastBindings = bindings[ lastBindingsIndex ],\n\t\t\t\tlastBindingsPath = path[ lastBindingsIndex ];\n\n\t\t\tindicesByPath[ lastBindingsPath ] = index;\n\n\t\t\tbindings[ index ] = lastBindings;\n\t\t\tbindings.pop();\n\n\t\t\tparsedPaths[ index ] = parsedPaths[ lastBindingsIndex ];\n\t\t\tparsedPaths.pop();\n\n\t\t\tpaths[ index ] = paths[ lastBindingsIndex ];\n\t\t\tpaths.pop();\n\n\t\t}\n\n\t}\n\n}\n\nclass AnimationAction {\n\n\tconstructor( mixer, clip, localRoot = null, blendMode = clip.blendMode ) {\n\n\t\tthis._mixer = mixer;\n\t\tthis._clip = clip;\n\t\tthis._localRoot = localRoot;\n\t\tthis.blendMode = blendMode;\n\n\t\tconst tracks = clip.tracks,\n\t\t\tnTracks = tracks.length,\n\t\t\tinterpolants = new Array( nTracks );\n\n\t\tconst interpolantSettings = {\n\t\t\tendingStart: ZeroCurvatureEnding,\n\t\t\tendingEnd: ZeroCurvatureEnding\n\t\t};\n\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\n\n\t\t\tconst interpolant = tracks[ i ].createInterpolant( null );\n\t\t\tinterpolants[ i ] = interpolant;\n\t\t\tinterpolant.settings = interpolantSettings;\n\n\t\t}\n\n\t\tthis._interpolantSettings = interpolantSettings;\n\n\t\tthis._interpolants = interpolants; // bound by the mixer\n\n\t\t// inside: PropertyMixer (managed by the mixer)\n\t\tthis._propertyBindings = new Array( nTracks );\n\n\t\tthis._cacheIndex = null; // for the memory manager\n\t\tthis._byClipCacheIndex = null; // for the memory manager\n\n\t\tthis._timeScaleInterpolant = null;\n\t\tthis._weightInterpolant = null;\n\n\t\tthis.loop = LoopRepeat;\n\t\tthis._loopCount = - 1;\n\n\t\t// global mixer time when the action is to be started\n\t\t// it's set back to 'null' upon start of the action\n\t\tthis._startTime = null;\n\n\t\t// scaled local time of the action\n\t\t// gets clamped or wrapped to 0..clip.duration according to loop\n\t\tthis.time = 0;\n\n\t\tthis.timeScale = 1;\n\t\tthis._effectiveTimeScale = 1;\n\n\t\tthis.weight = 1;\n\t\tthis._effectiveWeight = 1;\n\n\t\tthis.repetitions = Infinity; // no. of repetitions when looping\n\n\t\tthis.paused = false; // true -> zero effective time scale\n\t\tthis.enabled = true; // false -> zero effective weight\n\n\t\tthis.clampWhenFinished = false;// keep feeding the last frame?\n\n\t\tthis.zeroSlopeAtStart = true;// for smooth interpolation w/o separate\n\t\tthis.zeroSlopeAtEnd = true;// clips for start, loop and end\n\n\t}\n\n\t// State & Scheduling\n\n\tplay() {\n\n\t\tthis._mixer._activateAction( this );\n\n\t\treturn this;\n\n\t}\n\n\tstop() {\n\n\t\tthis._mixer._deactivateAction( this );\n\n\t\treturn this.reset();\n\n\t}\n\n\treset() {\n\n\t\tthis.paused = false;\n\t\tthis.enabled = true;\n\n\t\tthis.time = 0; // restart clip\n\t\tthis._loopCount = - 1;// forget previous loops\n\t\tthis._startTime = null;// forget scheduling\n\n\t\treturn this.stopFading().stopWarping();\n\n\t}\n\n\tisRunning() {\n\n\t\treturn this.enabled && ! this.paused && this.timeScale !== 0 &&\n\t\t\tthis._startTime === null && this._mixer._isActiveAction( this );\n\n\t}\n\n\t// return true when play has been called\n\tisScheduled() {\n\n\t\treturn this._mixer._isActiveAction( this );\n\n\t}\n\n\tstartAt( time ) {\n\n\t\tthis._startTime = time;\n\n\t\treturn this;\n\n\t}\n\n\tsetLoop( mode, repetitions ) {\n\n\t\tthis.loop = mode;\n\t\tthis.repetitions = repetitions;\n\n\t\treturn this;\n\n\t}\n\n\t// Weight\n\n\t// set the weight stopping any scheduled fading\n\t// although .enabled = false yields an effective weight of zero, this\n\t// method does *not* change .enabled, because it would be confusing\n\tsetEffectiveWeight( weight ) {\n\n\t\tthis.weight = weight;\n\n\t\t// note: same logic as when updated at runtime\n\t\tthis._effectiveWeight = this.enabled ? weight : 0;\n\n\t\treturn this.stopFading();\n\n\t}\n\n\t// return the weight considering fading and .enabled\n\tgetEffectiveWeight() {\n\n\t\treturn this._effectiveWeight;\n\n\t}\n\n\tfadeIn( duration ) {\n\n\t\treturn this._scheduleFading( duration, 0, 1 );\n\n\t}\n\n\tfadeOut( duration ) {\n\n\t\treturn this._scheduleFading( duration, 1, 0 );\n\n\t}\n\n\tcrossFadeFrom( fadeOutAction, duration, warp ) {\n\n\t\tfadeOutAction.fadeOut( duration );\n\t\tthis.fadeIn( duration );\n\n\t\tif ( warp ) {\n\n\t\t\tconst fadeInDuration = this._clip.duration,\n\t\t\t\tfadeOutDuration = fadeOutAction._clip.duration,\n\n\t\t\t\tstartEndRatio = fadeOutDuration / fadeInDuration,\n\t\t\t\tendStartRatio = fadeInDuration / fadeOutDuration;\n\n\t\t\tfadeOutAction.warp( 1.0, startEndRatio, duration );\n\t\t\tthis.warp( endStartRatio, 1.0, duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcrossFadeTo( fadeInAction, duration, warp ) {\n\n\t\treturn fadeInAction.crossFadeFrom( this, duration, warp );\n\n\t}\n\n\tstopFading() {\n\n\t\tconst weightInterpolant = this._weightInterpolant;\n\n\t\tif ( weightInterpolant !== null ) {\n\n\t\t\tthis._weightInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( weightInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Time Scale Control\n\n\t// set the time scale stopping any scheduled warping\n\t// although .paused = true yields an effective time scale of zero, this\n\t// method does *not* change .paused, because it would be confusing\n\tsetEffectiveTimeScale( timeScale ) {\n\n\t\tthis.timeScale = timeScale;\n\t\tthis._effectiveTimeScale = this.paused ? 0 : timeScale;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\t// return the time scale considering warping and .paused\n\tgetEffectiveTimeScale() {\n\n\t\treturn this._effectiveTimeScale;\n\n\t}\n\n\tsetDuration( duration ) {\n\n\t\tthis.timeScale = this._clip.duration / duration;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\tsyncWith( action ) {\n\n\t\tthis.time = action.time;\n\t\tthis.timeScale = action.timeScale;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\thalt( duration ) {\n\n\t\treturn this.warp( this._effectiveTimeScale, 0, duration );\n\n\t}\n\n\twarp( startTimeScale, endTimeScale, duration ) {\n\n\t\tconst mixer = this._mixer,\n\t\t\tnow = mixer.time,\n\t\t\ttimeScale = this.timeScale;\n\n\t\tlet interpolant = this._timeScaleInterpolant;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._timeScaleInterpolant = interpolant;\n\n\t\t}\n\n\t\tconst times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\ttimes[ 1 ] = now + duration;\n\n\t\tvalues[ 0 ] = startTimeScale / timeScale;\n\t\tvalues[ 1 ] = endTimeScale / timeScale;\n\n\t\treturn this;\n\n\t}\n\n\tstopWarping() {\n\n\t\tconst timeScaleInterpolant = this._timeScaleInterpolant;\n\n\t\tif ( timeScaleInterpolant !== null ) {\n\n\t\t\tthis._timeScaleInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( timeScaleInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Object Accessors\n\n\tgetMixer() {\n\n\t\treturn this._mixer;\n\n\t}\n\n\tgetClip() {\n\n\t\treturn this._clip;\n\n\t}\n\n\tgetRoot() {\n\n\t\treturn this._localRoot || this._mixer._root;\n\n\t}\n\n\t// Interna\n\n\t_update( time, deltaTime, timeDirection, accuIndex ) {\n\n\t\t// called by the mixer\n\n\t\tif ( ! this.enabled ) {\n\n\t\t\t// call ._updateWeight() to update ._effectiveWeight\n\n\t\t\tthis._updateWeight( time );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst startTime = this._startTime;\n\n\t\tif ( startTime !== null ) {\n\n\t\t\t// check for scheduled start of action\n\n\t\t\tconst timeRunning = ( time - startTime ) * timeDirection;\n\t\t\tif ( timeRunning < 0 || timeDirection === 0 ) {\n\n\t\t\t\tdeltaTime = 0;\n\n\t\t\t} else {\n\n\n\t\t\t\tthis._startTime = null; // unschedule\n\t\t\t\tdeltaTime = timeDirection * timeRunning;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// apply time scale and advance time\n\n\t\tdeltaTime *= this._updateTimeScale( time );\n\t\tconst clipTime = this._updateTime( deltaTime );\n\n\t\t// note: _updateTime may disable the action resulting in\n\t\t// an effective weight of 0\n\n\t\tconst weight = this._updateWeight( time );\n\n\t\tif ( weight > 0 ) {\n\n\t\t\tconst interpolants = this._interpolants;\n\t\t\tconst propertyMixers = this._propertyBindings;\n\n\t\t\tswitch ( this.blendMode ) {\n\n\t\t\t\tcase AdditiveAnimationBlendMode:\n\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\n\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\n\t\t\t\t\t\tpropertyMixers[ j ].accumulateAdditive( weight );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase NormalAnimationBlendMode:\n\t\t\t\tdefault:\n\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\n\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\n\t\t\t\t\t\tpropertyMixers[ j ].accumulate( accuIndex, weight );\n\n\t\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_updateWeight( time ) {\n\n\t\tlet weight = 0;\n\n\t\tif ( this.enabled ) {\n\n\t\t\tweight = this.weight;\n\t\t\tconst interpolant = this._weightInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\tweight *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopFading();\n\n\t\t\t\t\tif ( interpolantValue === 0 ) {\n\n\t\t\t\t\t\t// faded out, disable\n\t\t\t\t\t\tthis.enabled = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveWeight = weight;\n\t\treturn weight;\n\n\t}\n\n\t_updateTimeScale( time ) {\n\n\t\tlet timeScale = 0;\n\n\t\tif ( ! this.paused ) {\n\n\t\t\ttimeScale = this.timeScale;\n\n\t\t\tconst interpolant = this._timeScaleInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\ttimeScale *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopWarping();\n\n\t\t\t\t\tif ( timeScale === 0 ) {\n\n\t\t\t\t\t\t// motion has halted, pause\n\t\t\t\t\t\tthis.paused = true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// warp done - apply final time scale\n\t\t\t\t\t\tthis.timeScale = timeScale;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveTimeScale = timeScale;\n\t\treturn timeScale;\n\n\t}\n\n\t_updateTime( deltaTime ) {\n\n\t\tconst duration = this._clip.duration;\n\t\tconst loop = this.loop;\n\n\t\tlet time = this.time + deltaTime;\n\t\tlet loopCount = this._loopCount;\n\n\t\tconst pingPong = ( loop === LoopPingPong );\n\n\t\tif ( deltaTime === 0 ) {\n\n\t\t\tif ( loopCount === - 1 ) return time;\n\n\t\t\treturn ( pingPong && ( loopCount & 1 ) === 1 ) ? duration - time : time;\n\n\t\t}\n\n\t\tif ( loop === LoopOnce ) {\n\n\t\t\tif ( loopCount === - 1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tthis._loopCount = 0;\n\t\t\t\tthis._setEndings( true, true, false );\n\n\t\t\t}\n\n\t\t\thandle_stop: {\n\n\t\t\t\tif ( time >= duration ) {\n\n\t\t\t\t\ttime = duration;\n\n\t\t\t\t} else if ( time < 0 ) {\n\n\t\t\t\t\ttime = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tbreak handle_stop;\n\n\t\t\t\t}\n\n\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\telse this.enabled = false;\n\n\t\t\t\tthis.time = time;\n\n\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\tdirection: deltaTime < 0 ? - 1 : 1\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t} else { // repetitive Repeat or PingPong\n\n\t\t\tif ( loopCount === - 1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tif ( deltaTime >= 0 ) {\n\n\t\t\t\t\tloopCount = 0;\n\n\t\t\t\t\tthis._setEndings( true, this.repetitions === 0, pingPong );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// when looping in reverse direction, the initial\n\t\t\t\t\t// transition through zero counts as a repetition,\n\t\t\t\t\t// so leave loopCount at -1\n\n\t\t\t\t\tthis._setEndings( this.repetitions === 0, true, pingPong );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( time >= duration || time < 0 ) {\n\n\t\t\t\t// wrap around\n\n\t\t\t\tconst loopDelta = Math.floor( time / duration ); // signed\n\t\t\t\ttime -= duration * loopDelta;\n\n\t\t\t\tloopCount += Math.abs( loopDelta );\n\n\t\t\t\tconst pending = this.repetitions - loopCount;\n\n\t\t\t\tif ( pending <= 0 ) {\n\n\t\t\t\t\t// have to stop (switch state, clamp time, fire event)\n\n\t\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\t\telse this.enabled = false;\n\n\t\t\t\t\ttime = deltaTime > 0 ? duration : 0;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\t\tdirection: deltaTime > 0 ? 1 : - 1\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// keep running\n\n\t\t\t\t\tif ( pending === 1 ) {\n\n\t\t\t\t\t\t// entering the last round\n\n\t\t\t\t\t\tconst atStart = deltaTime < 0;\n\t\t\t\t\t\tthis._setEndings( atStart, ! atStart, pingPong );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis._setEndings( false, false, pingPong );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._loopCount = loopCount;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'loop', action: this, loopDelta: loopDelta\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tthis.time = time;\n\n\t\t\t}\n\n\t\t\tif ( pingPong && ( loopCount & 1 ) === 1 ) {\n\n\t\t\t\t// invert time for the \"pong round\"\n\n\t\t\t\treturn duration - time;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn time;\n\n\t}\n\n\t_setEndings( atStart, atEnd, pingPong ) {\n\n\t\tconst settings = this._interpolantSettings;\n\n\t\tif ( pingPong ) {\n\n\t\t\tsettings.endingStart = ZeroSlopeEnding;\n\t\t\tsettings.endingEnd = ZeroSlopeEnding;\n\n\t\t} else {\n\n\t\t\t// assuming for LoopOnce atStart == atEnd == true\n\n\t\t\tif ( atStart ) {\n\n\t\t\t\tsettings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingStart = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t\tif ( atEnd ) {\n\n\t\t\t\tsettings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingEnd \t = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_scheduleFading( duration, weightNow, weightThen ) {\n\n\t\tconst mixer = this._mixer, now = mixer.time;\n\t\tlet interpolant = this._weightInterpolant;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._weightInterpolant = interpolant;\n\n\t\t}\n\n\t\tconst times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\tvalues[ 0 ] = weightNow;\n\t\ttimes[ 1 ] = now + duration;\n\t\tvalues[ 1 ] = weightThen;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _controlInterpolantsResultBuffer = new Float32Array( 1 );\n\n\nclass AnimationMixer extends EventDispatcher {\n\n\tconstructor( root ) {\n\n\t\tsuper();\n\n\t\tthis._root = root;\n\t\tthis._initMemoryManager();\n\t\tthis._accuIndex = 0;\n\t\tthis.time = 0;\n\t\tthis.timeScale = 1.0;\n\n\t}\n\n\t_bindAction( action, prototypeAction ) {\n\n\t\tconst root = action._localRoot || this._root,\n\t\t\ttracks = action._clip.tracks,\n\t\t\tnTracks = tracks.length,\n\t\t\tbindings = action._propertyBindings,\n\t\t\tinterpolants = action._interpolants,\n\t\t\trootUuid = root.uuid,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName;\n\n\t\tlet bindingsByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingsByName === undefined ) {\n\n\t\t\tbindingsByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingsByName;\n\n\t\t}\n\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\n\n\t\t\tconst track = tracks[ i ],\n\t\t\t\ttrackName = track.name;\n\n\t\t\tlet binding = bindingsByName[ trackName ];\n\n\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\t++ binding.referenceCount;\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t} else {\n\n\t\t\t\tbinding = bindings[ i ];\n\n\t\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\t\t// existing binding, make sure the cache knows\n\n\t\t\t\t\tif ( binding._cacheIndex === null ) {\n\n\t\t\t\t\t\t++ binding.referenceCount;\n\t\t\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\tconst path = prototypeAction && prototypeAction.\n\t\t\t\t\t_propertyBindings[ i ].binding.parsedPath;\n\n\t\t\t\tbinding = new PropertyMixer(\n\t\t\t\t\tPropertyBinding.create( root, trackName, path ),\n\t\t\t\t\ttrack.ValueTypeName, track.getValueSize() );\n\n\t\t\t\t++ binding.referenceCount;\n\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t}\n\n\t\t\tinterpolants[ i ].resultBuffer = binding.buffer;\n\n\t\t}\n\n\t}\n\n\t_activateAction( action ) {\n\n\t\tif ( ! this._isActiveAction( action ) ) {\n\n\t\t\tif ( action._cacheIndex === null ) {\n\n\t\t\t\t// this action has been forgotten by the cache, but the user\n\t\t\t\t// appears to be still using it -> rebind\n\n\t\t\t\tconst rootUuid = ( action._localRoot || this._root ).uuid,\n\t\t\t\t\tclipUuid = action._clip.uuid,\n\t\t\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\t\t\tthis._bindAction( action,\n\t\t\t\t\tactionsForClip && actionsForClip.knownActions[ 0 ] );\n\n\t\t\t\tthis._addInactiveAction( action, clipUuid, rootUuid );\n\n\t\t\t}\n\n\t\t\tconst bindings = action._propertyBindings;\n\n\t\t\t// increment reference counts / sort out state\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tconst binding = bindings[ i ];\n\n\t\t\t\tif ( binding.useCount ++ === 0 ) {\n\n\t\t\t\t\tthis._lendBinding( binding );\n\t\t\t\t\tbinding.saveOriginalState();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._lendAction( action );\n\n\t\t}\n\n\t}\n\n\t_deactivateAction( action ) {\n\n\t\tif ( this._isActiveAction( action ) ) {\n\n\t\t\tconst bindings = action._propertyBindings;\n\n\t\t\t// decrement reference counts / sort out state\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tconst binding = bindings[ i ];\n\n\t\t\t\tif ( -- binding.useCount === 0 ) {\n\n\t\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\t\tthis._takeBackBinding( binding );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._takeBackAction( action );\n\n\t\t}\n\n\t}\n\n\t// Memory manager\n\n\t_initMemoryManager() {\n\n\t\tthis._actions = []; // 'nActiveActions' followed by inactive ones\n\t\tthis._nActiveActions = 0;\n\n\t\tthis._actionsByClip = {};\n\t\t// inside:\n\t\t// {\n\t\t// \tknownActions: Array< AnimationAction > - used as prototypes\n\t\t// \tactionByRoot: AnimationAction - lookup\n\t\t// }\n\n\n\t\tthis._bindings = []; // 'nActiveBindings' followed by inactive ones\n\t\tthis._nActiveBindings = 0;\n\n\t\tthis._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer >\n\n\n\t\tthis._controlInterpolants = []; // same game as above\n\t\tthis._nActiveControlInterpolants = 0;\n\n\t\tconst scope = this;\n\n\t\tthis.stats = {\n\n\t\t\tactions: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._actions.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveActions;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tbindings: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._bindings.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveBindings;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tcontrolInterpolants: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._controlInterpolants.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveControlInterpolants;\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t// Memory management for AnimationAction objects\n\n\t_isActiveAction( action ) {\n\n\t\tconst index = action._cacheIndex;\n\t\treturn index !== null && index < this._nActiveActions;\n\n\t}\n\n\t_addInactiveAction( action, clipUuid, rootUuid ) {\n\n\t\tconst actions = this._actions,\n\t\t\tactionsByClip = this._actionsByClip;\n\n\t\tlet actionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip === undefined ) {\n\n\t\t\tactionsForClip = {\n\n\t\t\t\tknownActions: [ action ],\n\t\t\t\tactionByRoot: {}\n\n\t\t\t};\n\n\t\t\taction._byClipCacheIndex = 0;\n\n\t\t\tactionsByClip[ clipUuid ] = actionsForClip;\n\n\t\t} else {\n\n\t\t\tconst knownActions = actionsForClip.knownActions;\n\n\t\t\taction._byClipCacheIndex = knownActions.length;\n\t\t\tknownActions.push( action );\n\n\t\t}\n\n\t\taction._cacheIndex = actions.length;\n\t\tactions.push( action );\n\n\t\tactionsForClip.actionByRoot[ rootUuid ] = action;\n\n\t}\n\n\t_removeInactiveAction( action ) {\n\n\t\tconst actions = this._actions,\n\t\t\tlastInactiveAction = actions[ actions.length - 1 ],\n\t\t\tcacheIndex = action._cacheIndex;\n\n\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\tactions.pop();\n\n\t\taction._cacheIndex = null;\n\n\n\t\tconst clipUuid = action._clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ],\n\t\t\tknownActionsForClip = actionsForClip.knownActions,\n\n\t\t\tlastKnownAction =\n\t\t\t\tknownActionsForClip[ knownActionsForClip.length - 1 ],\n\n\t\t\tbyClipCacheIndex = action._byClipCacheIndex;\n\n\t\tlastKnownAction._byClipCacheIndex = byClipCacheIndex;\n\t\tknownActionsForClip[ byClipCacheIndex ] = lastKnownAction;\n\t\tknownActionsForClip.pop();\n\n\t\taction._byClipCacheIndex = null;\n\n\n\t\tconst actionByRoot = actionsForClip.actionByRoot,\n\t\t\trootUuid = ( action._localRoot || this._root ).uuid;\n\n\t\tdelete actionByRoot[ rootUuid ];\n\n\t\tif ( knownActionsForClip.length === 0 ) {\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t\tthis._removeInactiveBindingsForAction( action );\n\n\t}\n\n\t_removeInactiveBindingsForAction( action ) {\n\n\t\tconst bindings = action._propertyBindings;\n\n\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tconst binding = bindings[ i ];\n\n\t\t\tif ( -- binding.referenceCount === 0 ) {\n\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_lendAction( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions >| inactive actions ]\n\t\t// s a\n\t\t// <-swap->\n\t\t// a s\n\n\t\tconst actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveActions ++,\n\n\t\t\tfirstInactiveAction = actions[ lastActiveIndex ];\n\n\t\taction._cacheIndex = lastActiveIndex;\n\t\tactions[ lastActiveIndex ] = action;\n\n\t\tfirstInactiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = firstInactiveAction;\n\n\t}\n\n\t_takeBackAction( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions |< inactive actions ]\n\t\t// a s\n\t\t// <-swap->\n\t\t// s a\n\n\t\tconst actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveActions,\n\n\t\t\tlastActiveAction = actions[ firstInactiveIndex ];\n\n\t\taction._cacheIndex = firstInactiveIndex;\n\t\tactions[ firstInactiveIndex ] = action;\n\n\t\tlastActiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = lastActiveAction;\n\n\t}\n\n\t// Memory management for PropertyMixer objects\n\n\t_addInactiveBinding( binding, rootUuid, trackName ) {\n\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindings = this._bindings;\n\n\t\tlet bindingByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingByName === undefined ) {\n\n\t\t\tbindingByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingByName;\n\n\t\t}\n\n\t\tbindingByName[ trackName ] = binding;\n\n\t\tbinding._cacheIndex = bindings.length;\n\t\tbindings.push( binding );\n\n\t}\n\n\t_removeInactiveBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tpropBinding = binding.binding,\n\t\t\trootUuid = propBinding.rootNode.uuid,\n\t\t\ttrackName = propBinding.path,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ],\n\n\t\t\tlastInactiveBinding = bindings[ bindings.length - 1 ],\n\t\t\tcacheIndex = binding._cacheIndex;\n\n\t\tlastInactiveBinding._cacheIndex = cacheIndex;\n\t\tbindings[ cacheIndex ] = lastInactiveBinding;\n\t\tbindings.pop();\n\n\t\tdelete bindingByName[ trackName ];\n\n\t\tif ( Object.keys( bindingByName ).length === 0 ) {\n\n\t\t\tdelete bindingsByRoot[ rootUuid ];\n\n\t\t}\n\n\t}\n\n\t_lendBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveBindings ++,\n\n\t\t\tfirstInactiveBinding = bindings[ lastActiveIndex ];\n\n\t\tbinding._cacheIndex = lastActiveIndex;\n\t\tbindings[ lastActiveIndex ] = binding;\n\n\t\tfirstInactiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = firstInactiveBinding;\n\n\t}\n\n\t_takeBackBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveBindings,\n\n\t\t\tlastActiveBinding = bindings[ firstInactiveIndex ];\n\n\t\tbinding._cacheIndex = firstInactiveIndex;\n\t\tbindings[ firstInactiveIndex ] = binding;\n\n\t\tlastActiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = lastActiveBinding;\n\n\t}\n\n\n\t// Memory management of Interpolants for weight and time scale\n\n\t_lendControlInterpolant() {\n\n\t\tconst interpolants = this._controlInterpolants,\n\t\t\tlastActiveIndex = this._nActiveControlInterpolants ++;\n\n\t\tlet interpolant = interpolants[ lastActiveIndex ];\n\n\t\tif ( interpolant === undefined ) {\n\n\t\t\tinterpolant = new LinearInterpolant(\n\t\t\t\tnew Float32Array( 2 ), new Float32Array( 2 ),\n\t\t\t\t1, _controlInterpolantsResultBuffer );\n\n\t\t\tinterpolant.__cacheIndex = lastActiveIndex;\n\t\t\tinterpolants[ lastActiveIndex ] = interpolant;\n\n\t\t}\n\n\t\treturn interpolant;\n\n\t}\n\n\t_takeBackControlInterpolant( interpolant ) {\n\n\t\tconst interpolants = this._controlInterpolants,\n\t\t\tprevIndex = interpolant.__cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveControlInterpolants,\n\n\t\t\tlastActiveInterpolant = interpolants[ firstInactiveIndex ];\n\n\t\tinterpolant.__cacheIndex = firstInactiveIndex;\n\t\tinterpolants[ firstInactiveIndex ] = interpolant;\n\n\t\tlastActiveInterpolant.__cacheIndex = prevIndex;\n\t\tinterpolants[ prevIndex ] = lastActiveInterpolant;\n\n\t}\n\n\t// return an action for a clip optionally using a custom root target\n\t// object (this method allocates a lot of dynamic memory in case a\n\t// previously unknown clip/root combination is specified)\n\tclipAction( clip, optionalRoot, blendMode ) {\n\n\t\tconst root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid;\n\n\t\tlet clipObject = typeof clip === 'string' ? AnimationClip.findByName( root, clip ) : clip;\n\n\t\tconst clipUuid = clipObject !== null ? clipObject.uuid : clip;\n\n\t\tconst actionsForClip = this._actionsByClip[ clipUuid ];\n\t\tlet prototypeAction = null;\n\n\t\tif ( blendMode === undefined ) {\n\n\t\t\tif ( clipObject !== null ) {\n\n\t\t\t\tblendMode = clipObject.blendMode;\n\n\t\t\t} else {\n\n\t\t\t\tblendMode = NormalAnimationBlendMode;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\tconst existingAction = actionsForClip.actionByRoot[ rootUuid ];\n\n\t\t\tif ( existingAction !== undefined && existingAction.blendMode === blendMode ) {\n\n\t\t\t\treturn existingAction;\n\n\t\t\t}\n\n\t\t\t// we know the clip, so we don't have to parse all\n\t\t\t// the bindings again but can just copy\n\t\t\tprototypeAction = actionsForClip.knownActions[ 0 ];\n\n\t\t\t// also, take the clip from the prototype action\n\t\t\tif ( clipObject === null )\n\t\t\t\tclipObject = prototypeAction._clip;\n\n\t\t}\n\n\t\t// clip must be known when specified via string\n\t\tif ( clipObject === null ) return null;\n\n\t\t// allocate all resources required to run it\n\t\tconst newAction = new AnimationAction( this, clipObject, optionalRoot, blendMode );\n\n\t\tthis._bindAction( newAction, prototypeAction );\n\n\t\t// and make the action known to the memory manager\n\t\tthis._addInactiveAction( newAction, clipUuid, rootUuid );\n\n\t\treturn newAction;\n\n\t}\n\n\t// get an existing action\n\texistingAction( clip, optionalRoot ) {\n\n\t\tconst root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid,\n\n\t\t\tclipObject = typeof clip === 'string' ?\n\t\t\t\tAnimationClip.findByName( root, clip ) : clip,\n\n\t\t\tclipUuid = clipObject ? clipObject.uuid : clip,\n\n\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\treturn actionsForClip.actionByRoot[ rootUuid ] || null;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t// deactivates all previously scheduled actions\n\tstopAllAction() {\n\n\t\tconst actions = this._actions,\n\t\t\tnActions = this._nActiveActions;\n\n\t\tfor ( let i = nActions - 1; i >= 0; -- i ) {\n\n\t\t\tactions[ i ].stop();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// advance the time and update apply the animation\n\tupdate( deltaTime ) {\n\n\t\tdeltaTime *= this.timeScale;\n\n\t\tconst actions = this._actions,\n\t\t\tnActions = this._nActiveActions,\n\n\t\t\ttime = this.time += deltaTime,\n\t\t\ttimeDirection = Math.sign( deltaTime ),\n\n\t\t\taccuIndex = this._accuIndex ^= 1;\n\n\t\t// run active actions\n\n\t\tfor ( let i = 0; i !== nActions; ++ i ) {\n\n\t\t\tconst action = actions[ i ];\n\n\t\t\taction._update( time, deltaTime, timeDirection, accuIndex );\n\n\t\t}\n\n\t\t// update scene graph\n\n\t\tconst bindings = this._bindings,\n\t\t\tnBindings = this._nActiveBindings;\n\n\t\tfor ( let i = 0; i !== nBindings; ++ i ) {\n\n\t\t\tbindings[ i ].apply( accuIndex );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Allows you to seek to a specific time in an animation.\n\tsetTime( timeInSeconds ) {\n\n\t\tthis.time = 0; // Zero out time attribute for AnimationMixer object;\n\t\tfor ( let i = 0; i < this._actions.length; i ++ ) {\n\n\t\t\tthis._actions[ i ].time = 0; // Zero out time attribute for all associated AnimationAction objects.\n\n\t\t}\n\n\t\treturn this.update( timeInSeconds ); // Update used to set exact time. Returns \"this\" AnimationMixer object.\n\n\t}\n\n\t// return this mixer's root target object\n\tgetRoot() {\n\n\t\treturn this._root;\n\n\t}\n\n\t// free all resources specific to a particular clip\n\tuncacheClip( clip ) {\n\n\t\tconst actions = this._actions,\n\t\t\tclipUuid = clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\t// note: just calling _removeInactiveAction would mess up the\n\t\t\t// iteration state and also require updating the state we can\n\t\t\t// just throw away\n\n\t\t\tconst actionsToRemove = actionsForClip.knownActions;\n\n\t\t\tfor ( let i = 0, n = actionsToRemove.length; i !== n; ++ i ) {\n\n\t\t\t\tconst action = actionsToRemove[ i ];\n\n\t\t\t\tthis._deactivateAction( action );\n\n\t\t\t\tconst cacheIndex = action._cacheIndex,\n\t\t\t\t\tlastInactiveAction = actions[ actions.length - 1 ];\n\n\t\t\t\taction._cacheIndex = null;\n\t\t\t\taction._byClipCacheIndex = null;\n\n\t\t\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\t\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\t\t\tactions.pop();\n\n\t\t\t\tthis._removeInactiveBindingsForAction( action );\n\n\t\t\t}\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t}\n\n\t// free all resources specific to a particular root target object\n\tuncacheRoot( root ) {\n\n\t\tconst rootUuid = root.uuid,\n\t\t\tactionsByClip = this._actionsByClip;\n\n\t\tfor ( const clipUuid in actionsByClip ) {\n\n\t\t\tconst actionByRoot = actionsByClip[ clipUuid ].actionByRoot,\n\t\t\t\taction = actionByRoot[ rootUuid ];\n\n\t\t\tif ( action !== undefined ) {\n\n\t\t\t\tthis._deactivateAction( action );\n\t\t\t\tthis._removeInactiveAction( action );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingByName !== undefined ) {\n\n\t\t\tfor ( const trackName in bindingByName ) {\n\n\t\t\t\tconst binding = bindingByName[ trackName ];\n\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// remove a targeted clip from the cache\n\tuncacheAction( clip, optionalRoot ) {\n\n\t\tconst action = this.existingAction( clip, optionalRoot );\n\n\t\tif ( action !== null ) {\n\n\t\t\tthis._deactivateAction( action );\n\t\t\tthis._removeInactiveAction( action );\n\n\t\t}\n\n\t}\n\n}\n\nclass Uniform {\n\n\tconstructor( value ) {\n\n\t\tthis.value = value;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Uniform( this.value.clone === undefined ? this.value : this.value.clone() );\n\n\t}\n\n}\n\nlet _id = 0;\n\nclass UniformsGroup extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isUniformsGroup = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _id ++ } );\n\n\t\tthis.name = '';\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis.uniforms = [];\n\n\t}\n\n\tadd( uniform ) {\n\n\t\tthis.uniforms.push( uniform );\n\n\t\treturn this;\n\n\t}\n\n\tremove( uniform ) {\n\n\t\tconst index = this.uniforms.indexOf( uniform );\n\n\t\tif ( index !== - 1 ) this.uniforms.splice( index, 1 );\n\n\t\treturn this;\n\n\t}\n\n\tsetName( name ) {\n\n\t\tthis.name = name;\n\n\t\treturn this;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\t\tthis.usage = source.usage;\n\n\t\tconst uniformsSource = source.uniforms;\n\n\t\tthis.uniforms.length = 0;\n\n\t\tfor ( let i = 0, l = uniformsSource.length; i < l; i ++ ) {\n\n\t\t\tconst uniforms = Array.isArray( uniformsSource[ i ] ) ? uniformsSource[ i ] : [ uniformsSource[ i ] ];\n\n\t\t\tfor ( let j = 0; j < uniforms.length; j ++ ) {\n\n\t\t\t\tthis.uniforms.push( uniforms[ j ].clone() );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass InstancedInterleavedBuffer extends InterleavedBuffer {\n\n\tconstructor( array, stride, meshPerAttribute = 1 ) {\n\n\t\tsuper( array, stride );\n\n\t\tthis.isInstancedInterleavedBuffer = true;\n\n\t\tthis.meshPerAttribute = meshPerAttribute;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tconst ib = super.clone( data );\n\n\t\tib.meshPerAttribute = this.meshPerAttribute;\n\n\t\treturn ib;\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tconst json = super.toJSON( data );\n\n\t\tjson.isInstancedInterleavedBuffer = true;\n\t\tjson.meshPerAttribute = this.meshPerAttribute;\n\n\t\treturn json;\n\n\t}\n\n}\n\nclass GLBufferAttribute {\n\n\tconstructor( buffer, type, itemSize, elementSize, count ) {\n\n\t\tthis.isGLBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.buffer = buffer;\n\t\tthis.type = type;\n\t\tthis.itemSize = itemSize;\n\t\tthis.elementSize = elementSize;\n\t\tthis.count = count;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tsetBuffer( buffer ) {\n\n\t\tthis.buffer = buffer;\n\n\t\treturn this;\n\n\t}\n\n\tsetType( type, elementSize ) {\n\n\t\tthis.type = type;\n\t\tthis.elementSize = elementSize;\n\n\t\treturn this;\n\n\t}\n\n\tsetItemSize( itemSize ) {\n\n\t\tthis.itemSize = itemSize;\n\n\t\treturn this;\n\n\t}\n\n\tsetCount( count ) {\n\n\t\tthis.count = count;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _matrix = /*@__PURE__*/ new Matrix4();\n\nclass Raycaster {\n\n\tconstructor( origin, direction, near = 0, far = Infinity ) {\n\n\t\tthis.ray = new Ray( origin, direction );\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\t\tthis.camera = null;\n\t\tthis.layers = new Layers();\n\n\t\tthis.params = {\n\t\t\tMesh: {},\n\t\t\tLine: { threshold: 1 },\n\t\t\tLOD: {},\n\t\t\tPoints: { threshold: 1 },\n\t\t\tSprite: {}\n\t\t};\n\n\t}\n\n\tset( origin, direction ) {\n\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\n\n\t\tthis.ray.set( origin, direction );\n\n\t}\n\n\tsetFromCamera( coords, camera ) {\n\n\t\tif ( camera.isPerspectiveCamera ) {\n\n\t\t\tthis.ray.origin.setFromMatrixPosition( camera.matrixWorld );\n\t\t\tthis.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize();\n\t\t\tthis.camera = camera;\n\n\t\t} else if ( camera.isOrthographicCamera ) {\n\n\t\t\tthis.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera\n\t\t\tthis.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );\n\t\t\tthis.camera = camera;\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.Raycaster: Unsupported camera type: ' + camera.type );\n\n\t\t}\n\n\t}\n\n\tsetFromXRController( controller ) {\n\n\t\t_matrix.identity().extractRotation( controller.matrixWorld );\n\n\t\tthis.ray.origin.setFromMatrixPosition( controller.matrixWorld );\n\t\tthis.ray.direction.set( 0, 0, - 1 ).applyMatrix4( _matrix );\n\n\t\treturn this;\n\n\t}\n\n\tintersectObject( object, recursive = true, intersects = [] ) {\n\n\t\tintersect( object, this, intersects, recursive );\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t}\n\n\tintersectObjects( objects, recursive = true, intersects = [] ) {\n\n\t\tfor ( let i = 0, l = objects.length; i < l; i ++ ) {\n\n\t\t\tintersect( objects[ i ], this, intersects, recursive );\n\n\t\t}\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t}\n\n}\n\nfunction ascSort( a, b ) {\n\n\treturn a.distance - b.distance;\n\n}\n\nfunction intersect( object, raycaster, intersects, recursive ) {\n\n\tlet propagate = true;\n\n\tif ( object.layers.test( raycaster.layers ) ) {\n\n\t\tconst result = object.raycast( raycaster, intersects );\n\n\t\tif ( result === false ) propagate = false;\n\n\t}\n\n\tif ( propagate === true && recursive === true ) {\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tintersect( children[ i ], raycaster, intersects, true );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system\n *\n * phi (the polar angle) is measured from the positive y-axis. The positive y-axis is up.\n * theta (the azimuthal angle) is measured from the positive z-axis.\n */\nclass Spherical {\n\n\tconstructor( radius = 1, phi = 0, theta = 0 ) {\n\n\t\tthis.radius = radius;\n\t\tthis.phi = phi; // polar angle\n\t\tthis.theta = theta; // azimuthal angle\n\n\t\treturn this;\n\n\t}\n\n\tset( radius, phi, theta ) {\n\n\t\tthis.radius = radius;\n\t\tthis.phi = phi;\n\t\tthis.theta = theta;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.phi = other.phi;\n\t\tthis.theta = other.theta;\n\n\t\treturn this;\n\n\t}\n\n\t// restrict phi to be between EPS and PI-EPS\n\tmakeSafe() {\n\n\t\tconst EPS = 0.000001;\n\t\tthis.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t}\n\n\tsetFromCartesianCoords( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + y * y + z * z );\n\n\t\tif ( this.radius === 0 ) {\n\n\t\t\tthis.theta = 0;\n\t\t\tthis.phi = 0;\n\n\t\t} else {\n\n\t\t\tthis.theta = Math.atan2( x, z );\n\t\t\tthis.phi = Math.acos( clamp( y / this.radius, - 1, 1 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\n/**\n * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system\n */\n\nclass Cylindrical {\n\n\tconstructor( radius = 1, theta = 0, y = 0 ) {\n\n\t\tthis.radius = radius; // distance from the origin to a point in the x-z plane\n\t\tthis.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis\n\t\tthis.y = y; // height above the x-z plane\n\n\t\treturn this;\n\n\t}\n\n\tset( radius, theta, y ) {\n\n\t\tthis.radius = radius;\n\t\tthis.theta = theta;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.theta = other.theta;\n\t\tthis.y = other.y;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t}\n\n\tsetFromCartesianCoords( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + z * z );\n\t\tthis.theta = Math.atan2( x, z );\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass Matrix2 {\n\n\tconstructor( n11, n12, n21, n22 ) {\n\n\t\tMatrix2.prototype.isMatrix2 = true;\n\n\t\tthis.elements = [\n\t\t\t1, 0,\n\t\t\t0, 1,\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n21, n22 );\n\n\t\t}\n\n\t}\n\n\tidentity() {\n\n\t\tthis.set(\n\t\t\t1, 0,\n\t\t\t0, 1,\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tset( n11, n12, n21, n22 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 2 ] = n12;\n\t\tte[ 1 ] = n21; te[ 3 ] = n22;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _vector$4 = /*@__PURE__*/ new Vector2();\n\nclass Box2 {\n\n\tconstructor( min = new Vector2( + Infinity, + Infinity ), max = new Vector2( - Infinity, - Infinity ) ) {\n\n\t\tthis.isBox2 = true;\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tset( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCenterAndSize( center, size ) {\n\n\t\tconst halfSize = _vector$4.copy( size ).multiplyScalar( 0.5 );\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.min.x = this.min.y = + Infinity;\n\t\tthis.max.x = this.max.y = - Infinity;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y );\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t}\n\n\tgetSize( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t}\n\n\texpandByVector( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t}\n\n\texpandByScalar( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn point.x >= this.min.x && point.x <= this.max.x &&\n\t\t\tpoint.y >= this.min.y && point.y <= this.max.y;\n\n\t}\n\n\tcontainsBox( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y;\n\n\t}\n\n\tgetParameter( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y )\n\t\t);\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\t// using 4 splitting planes to rule out intersections\n\n\t\treturn box.max.x >= this.min.x && box.min.x <= this.max.x &&\n\t\t\tbox.max.y >= this.min.y && box.min.y <= this.max.y;\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.clampPoint( point, _vector$4 ).distanceTo( point );\n\n\t}\n\n\tintersect( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\tif ( this.isEmpty() ) this.makeEmpty();\n\n\t\treturn this;\n\n\t}\n\n\tunion( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\tequals( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n}\n\nconst _startP = /*@__PURE__*/ new Vector3();\nconst _startEnd = /*@__PURE__*/ new Vector3();\n\nclass Line3 {\n\n\tconstructor( start = new Vector3(), end = new Vector3() ) {\n\n\t\tthis.start = start;\n\t\tthis.end = end;\n\n\t}\n\n\tset( start, end ) {\n\n\t\tthis.start.copy( start );\n\t\tthis.end.copy( end );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( line ) {\n\n\t\tthis.start.copy( line.start );\n\t\tthis.end.copy( line.end );\n\n\t\treturn this;\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn target.addVectors( this.start, this.end ).multiplyScalar( 0.5 );\n\n\t}\n\n\tdelta( target ) {\n\n\t\treturn target.subVectors( this.end, this.start );\n\n\t}\n\n\tdistanceSq() {\n\n\t\treturn this.start.distanceToSquared( this.end );\n\n\t}\n\n\tdistance() {\n\n\t\treturn this.start.distanceTo( this.end );\n\n\t}\n\n\tat( t, target ) {\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t}\n\n\tclosestPointToPointParameter( point, clampToLine ) {\n\n\t\t_startP.subVectors( point, this.start );\n\t\t_startEnd.subVectors( this.end, this.start );\n\n\t\tconst startEnd2 = _startEnd.dot( _startEnd );\n\t\tconst startEnd_startP = _startEnd.dot( _startP );\n\n\t\tlet t = startEnd_startP / startEnd2;\n\n\t\tif ( clampToLine ) {\n\n\t\t\tt = clamp( t, 0, 1 );\n\n\t\t}\n\n\t\treturn t;\n\n\t}\n\n\tclosestPointToPoint( point, clampToLine, target ) {\n\n\t\tconst t = this.closestPointToPointParameter( point, clampToLine );\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tthis.start.applyMatrix4( matrix );\n\t\tthis.end.applyMatrix4( matrix );\n\n\t\treturn this;\n\n\t}\n\n\tequals( line ) {\n\n\t\treturn line.start.equals( this.start ) && line.end.equals( this.end );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$3 = /*@__PURE__*/ new Vector3();\n\nclass SpotLightHelper extends Object3D {\n\n\tconstructor( light, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'SpotLightHelper';\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tconst positions = [\n\t\t\t0, 0, 0, \t0, 0, 1,\n\t\t\t0, 0, 0, \t1, 0, 1,\n\t\t\t0, 0, 0,\t- 1, 0, 1,\n\t\t\t0, 0, 0, \t0, 1, 1,\n\t\t\t0, 0, 0, \t0, - 1, 1\n\t\t];\n\n\t\tfor ( let i = 0, j = 1, l = 32; i < l; i ++, j ++ ) {\n\n\t\t\tconst p1 = ( i / l ) * Math.PI * 2;\n\t\t\tconst p2 = ( j / l ) * Math.PI * 2;\n\n\t\t\tpositions.push(\n\t\t\t\tMath.cos( p1 ), Math.sin( p1 ), 1,\n\t\t\t\tMath.cos( p2 ), Math.sin( p2 ), 1\n\t\t\t);\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\n\n\t\tthis.cone = new LineSegments( geometry, material );\n\t\tthis.add( this.cone );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.cone.geometry.dispose();\n\t\tthis.cone.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\t\tthis.light.target.updateWorldMatrix( true, false );\n\n\t\t// update the local matrix based on the parent and light target transforms\n\t\tif ( this.parent ) {\n\n\t\t\tthis.parent.updateWorldMatrix( true );\n\n\t\t\tthis.matrix\n\t\t\t\t.copy( this.parent.matrixWorld )\n\t\t\t\t.invert()\n\t\t\t\t.multiply( this.light.matrixWorld );\n\n\t\t} else {\n\n\t\t\tthis.matrix.copy( this.light.matrixWorld );\n\n\t\t}\n\n\t\tthis.matrixWorld.copy( this.light.matrixWorld );\n\n\t\tconst coneLength = this.light.distance ? this.light.distance : 1000;\n\t\tconst coneWidth = coneLength * Math.tan( this.light.angle );\n\n\t\tthis.cone.scale.set( coneWidth, coneWidth, coneLength );\n\n\t\t_vector$3.setFromMatrixPosition( this.light.target.matrixWorld );\n\n\t\tthis.cone.lookAt( _vector$3 );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.cone.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.cone.material.color.copy( this.light.color );\n\n\t\t}\n\n\t}\n\n}\n\nconst _vector$2 = /*@__PURE__*/ new Vector3();\nconst _boneMatrix = /*@__PURE__*/ new Matrix4();\nconst _matrixWorldInv = /*@__PURE__*/ new Matrix4();\n\n\nclass SkeletonHelper extends LineSegments {\n\n\tconstructor( object ) {\n\n\t\tconst bones = getBoneList( object );\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\tconst color1 = new Color( 0, 0, 1 );\n\t\tconst color2 = new Color( 0, 1, 0 );\n\n\t\tfor ( let i = 0; i < bones.length; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tcolors.push( color1.r, color1.g, color1.b );\n\t\t\t\tcolors.push( color2.r, color2.g, color2.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isSkeletonHelper = true;\n\n\t\tthis.type = 'SkeletonHelper';\n\n\t\tthis.root = object;\n\t\tthis.bones = bones;\n\n\t\tthis.matrix = object.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tconst bones = this.bones;\n\n\t\tconst geometry = this.geometry;\n\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\t_matrixWorldInv.copy( this.root.matrixWorld ).invert();\n\n\t\tfor ( let i = 0, j = 0; i < bones.length; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.matrixWorld );\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\n\t\t\t\tposition.setXYZ( j, _vector$2.x, _vector$2.y, _vector$2.z );\n\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.parent.matrixWorld );\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\n\t\t\t\tposition.setXYZ( j + 1, _vector$2.x, _vector$2.y, _vector$2.z );\n\n\t\t\t\tj += 2;\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n\nfunction getBoneList( object ) {\n\n\tconst boneList = [];\n\n\tif ( object.isBone === true ) {\n\n\t\tboneList.push( object );\n\n\t}\n\n\tfor ( let i = 0; i < object.children.length; i ++ ) {\n\n\t\tboneList.push.apply( boneList, getBoneList( object.children[ i ] ) );\n\n\t}\n\n\treturn boneList;\n\n}\n\nclass PointLightHelper extends Mesh {\n\n\tconstructor( light, sphereSize, color ) {\n\n\t\tconst geometry = new SphereGeometry( sphereSize, 4, 2 );\n\t\tconst material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.light = light;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'PointLightHelper';\n\n\t\tthis.matrix = this.light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.update();\n\n\n\t\t/*\n\t// TODO: delete this comment?\n\tconst distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );\n\tconst distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );\n\n\tthis.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );\n\tthis.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );\n\n\tconst d = light.distance;\n\n\tif ( d === 0.0 ) {\n\n\t\tthis.lightDistance.visible = false;\n\n\t} else {\n\n\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t}\n\n\tthis.add( this.lightDistance );\n\t*/\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.material.color.copy( this.light.color );\n\n\t\t}\n\n\t\t/*\n\t\tconst d = this.light.distance;\n\n\t\tif ( d === 0.0 ) {\n\n\t\t\tthis.lightDistance.visible = false;\n\n\t\t} else {\n\n\t\t\tthis.lightDistance.visible = true;\n\t\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t\t}\n\t\t*/\n\n\t}\n\n}\n\nconst _vector$1 = /*@__PURE__*/ new Vector3();\nconst _color1 = /*@__PURE__*/ new Color();\nconst _color2 = /*@__PURE__*/ new Color();\n\nclass HemisphereLightHelper extends Object3D {\n\n\tconstructor( light, size, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'HemisphereLightHelper';\n\n\t\tconst geometry = new OctahedronGeometry( size );\n\t\tgeometry.rotateY( Math.PI * 0.5 );\n\n\t\tthis.material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\n\t\tif ( this.color === undefined ) this.material.vertexColors = true;\n\n\t\tconst position = geometry.getAttribute( 'position' );\n\t\tconst colors = new Float32Array( position.count * 3 );\n\n\t\tgeometry.setAttribute( 'color', new BufferAttribute( colors, 3 ) );\n\n\t\tthis.add( new Mesh( geometry, this.material ) );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.children[ 0 ].geometry.dispose();\n\t\tthis.children[ 0 ].material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tconst mesh = this.children[ 0 ];\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tconst colors = mesh.geometry.getAttribute( 'color' );\n\n\t\t\t_color1.copy( this.light.color );\n\t\t\t_color2.copy( this.light.groundColor );\n\n\t\t\tfor ( let i = 0, l = colors.count; i < l; i ++ ) {\n\n\t\t\t\tconst color = ( i < ( l / 2 ) ) ? _color1 : _color2;\n\n\t\t\t\tcolors.setXYZ( i, color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t\tcolors.needsUpdate = true;\n\n\t\t}\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\n\t\tmesh.lookAt( _vector$1.setFromMatrixPosition( this.light.matrixWorld ).negate() );\n\n\t}\n\n}\n\nclass GridHelper extends LineSegments {\n\n\tconstructor( size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888 ) {\n\n\t\tcolor1 = new Color( color1 );\n\t\tcolor2 = new Color( color2 );\n\n\t\tconst center = divisions / 2;\n\t\tconst step = size / divisions;\n\t\tconst halfSize = size / 2;\n\n\t\tconst vertices = [], colors = [];\n\n\t\tfor ( let i = 0, j = 0, k = - halfSize; i <= divisions; i ++, k += step ) {\n\n\t\t\tvertices.push( - halfSize, 0, k, halfSize, 0, k );\n\t\t\tvertices.push( k, 0, - halfSize, k, 0, halfSize );\n\n\t\t\tconst color = i === center ? color1 : color2;\n\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\n\t\t}\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'GridHelper';\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass PolarGridHelper extends LineSegments {\n\n\tconstructor( radius = 10, sectors = 16, rings = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888 ) {\n\n\t\tcolor1 = new Color( color1 );\n\t\tcolor2 = new Color( color2 );\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\t// create the sectors\n\n\t\tif ( sectors > 1 ) {\n\n\t\t\tfor ( let i = 0; i < sectors; i ++ ) {\n\n\t\t\t\tconst v = ( i / sectors ) * ( Math.PI * 2 );\n\n\t\t\t\tconst x = Math.sin( v ) * radius;\n\t\t\t\tconst z = Math.cos( v ) * radius;\n\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tvertices.push( x, 0, z );\n\n\t\t\t\tconst color = ( i & 1 ) ? color1 : color2;\n\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// create the rings\n\n\t\tfor ( let i = 0; i < rings; i ++ ) {\n\n\t\t\tconst color = ( i & 1 ) ? color1 : color2;\n\n\t\t\tconst r = radius - ( radius / rings * i );\n\n\t\t\tfor ( let j = 0; j < divisions; j ++ ) {\n\n\t\t\t\t// first vertex\n\n\t\t\t\tlet v = ( j / divisions ) * ( Math.PI * 2 );\n\n\t\t\t\tlet x = Math.sin( v ) * r;\n\t\t\t\tlet z = Math.cos( v ) * r;\n\n\t\t\t\tvertices.push( x, 0, z );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t\t// second vertex\n\n\t\t\t\tv = ( ( j + 1 ) / divisions ) * ( Math.PI * 2 );\n\n\t\t\t\tx = Math.sin( v ) * r;\n\t\t\t\tz = Math.cos( v ) * r;\n\n\t\t\t\tvertices.push( x, 0, z );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'PolarGridHelper';\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nconst _v1 = /*@__PURE__*/ new Vector3();\nconst _v2 = /*@__PURE__*/ new Vector3();\nconst _v3 = /*@__PURE__*/ new Vector3();\n\nclass DirectionalLightHelper extends Object3D {\n\n\tconstructor( light, size, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'DirectionalLightHelper';\n\n\t\tif ( size === undefined ) size = 1;\n\n\t\tlet geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [\n\t\t\t- size, size, 0,\n\t\t\tsize, size, 0,\n\t\t\tsize, - size, 0,\n\t\t\t- size, - size, 0,\n\t\t\t- size, size, 0\n\t\t], 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\n\n\t\tthis.lightPlane = new Line( geometry, material );\n\t\tthis.add( this.lightPlane );\n\n\t\tgeometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 0, 1 ], 3 ) );\n\n\t\tthis.targetLine = new Line( geometry, material );\n\t\tthis.add( this.targetLine );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.lightPlane.geometry.dispose();\n\t\tthis.lightPlane.material.dispose();\n\t\tthis.targetLine.geometry.dispose();\n\t\tthis.targetLine.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\t\tthis.light.target.updateWorldMatrix( true, false );\n\n\t\t_v1.setFromMatrixPosition( this.light.matrixWorld );\n\t\t_v2.setFromMatrixPosition( this.light.target.matrixWorld );\n\t\t_v3.subVectors( _v2, _v1 );\n\n\t\tthis.lightPlane.lookAt( _v2 );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.lightPlane.material.color.set( this.color );\n\t\t\tthis.targetLine.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.lightPlane.material.color.copy( this.light.color );\n\t\t\tthis.targetLine.material.color.copy( this.light.color );\n\n\t\t}\n\n\t\tthis.targetLine.lookAt( _v2 );\n\t\tthis.targetLine.scale.z = _v3.length();\n\n\t}\n\n}\n\nconst _vector = /*@__PURE__*/ new Vector3();\nconst _camera = /*@__PURE__*/ new Camera();\n\n/**\n *\t- shows frustum, line of sight and up of the camera\n *\t- suitable for fast updates\n * \t- based on frustum visualization in lightgl.js shadowmap example\n *\t\thttps://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html\n */\n\nclass CameraHelper extends LineSegments {\n\n\tconstructor( camera ) {\n\n\t\tconst geometry = new BufferGeometry();\n\t\tconst material = new LineBasicMaterial( { color: 0xffffff, vertexColors: true, toneMapped: false } );\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\tconst pointMap = {};\n\n\t\t// near\n\n\t\taddLine( 'n1', 'n2' );\n\t\taddLine( 'n2', 'n4' );\n\t\taddLine( 'n4', 'n3' );\n\t\taddLine( 'n3', 'n1' );\n\n\t\t// far\n\n\t\taddLine( 'f1', 'f2' );\n\t\taddLine( 'f2', 'f4' );\n\t\taddLine( 'f4', 'f3' );\n\t\taddLine( 'f3', 'f1' );\n\n\t\t// sides\n\n\t\taddLine( 'n1', 'f1' );\n\t\taddLine( 'n2', 'f2' );\n\t\taddLine( 'n3', 'f3' );\n\t\taddLine( 'n4', 'f4' );\n\n\t\t// cone\n\n\t\taddLine( 'p', 'n1' );\n\t\taddLine( 'p', 'n2' );\n\t\taddLine( 'p', 'n3' );\n\t\taddLine( 'p', 'n4' );\n\n\t\t// up\n\n\t\taddLine( 'u1', 'u2' );\n\t\taddLine( 'u2', 'u3' );\n\t\taddLine( 'u3', 'u1' );\n\n\t\t// target\n\n\t\taddLine( 'c', 't' );\n\t\taddLine( 'p', 'c' );\n\n\t\t// cross\n\n\t\taddLine( 'cn1', 'cn2' );\n\t\taddLine( 'cn3', 'cn4' );\n\n\t\taddLine( 'cf1', 'cf2' );\n\t\taddLine( 'cf3', 'cf4' );\n\n\t\tfunction addLine( a, b ) {\n\n\t\t\taddPoint( a );\n\t\t\taddPoint( b );\n\n\t\t}\n\n\t\tfunction addPoint( id ) {\n\n\t\t\tvertices.push( 0, 0, 0 );\n\t\t\tcolors.push( 0, 0, 0 );\n\n\t\t\tif ( pointMap[ id ] === undefined ) {\n\n\t\t\t\tpointMap[ id ] = [];\n\n\t\t\t}\n\n\t\t\tpointMap[ id ].push( ( vertices.length / 3 ) - 1 );\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'CameraHelper';\n\n\t\tthis.camera = camera;\n\t\tif ( this.camera.updateProjectionMatrix ) this.camera.updateProjectionMatrix();\n\n\t\tthis.matrix = camera.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.pointMap = pointMap;\n\n\t\tthis.update();\n\n\t\t// colors\n\n\t\tconst colorFrustum = new Color( 0xffaa00 );\n\t\tconst colorCone = new Color( 0xff0000 );\n\t\tconst colorUp = new Color( 0x00aaff );\n\t\tconst colorTarget = new Color( 0xffffff );\n\t\tconst colorCross = new Color( 0x333333 );\n\n\t\tthis.setColors( colorFrustum, colorCone, colorUp, colorTarget, colorCross );\n\n\t}\n\n\tsetColors( frustum, cone, up, target, cross ) {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst colorAttribute = geometry.getAttribute( 'color' );\n\n\t\t// near\n\n\t\tcolorAttribute.setXYZ( 0, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 1, frustum.r, frustum.g, frustum.b ); // n1, n2\n\t\tcolorAttribute.setXYZ( 2, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 3, frustum.r, frustum.g, frustum.b ); // n2, n4\n\t\tcolorAttribute.setXYZ( 4, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 5, frustum.r, frustum.g, frustum.b ); // n4, n3\n\t\tcolorAttribute.setXYZ( 6, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 7, frustum.r, frustum.g, frustum.b ); // n3, n1\n\n\t\t// far\n\n\t\tcolorAttribute.setXYZ( 8, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 9, frustum.r, frustum.g, frustum.b ); // f1, f2\n\t\tcolorAttribute.setXYZ( 10, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 11, frustum.r, frustum.g, frustum.b ); // f2, f4\n\t\tcolorAttribute.setXYZ( 12, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 13, frustum.r, frustum.g, frustum.b ); // f4, f3\n\t\tcolorAttribute.setXYZ( 14, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 15, frustum.r, frustum.g, frustum.b ); // f3, f1\n\n\t\t// sides\n\n\t\tcolorAttribute.setXYZ( 16, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 17, frustum.r, frustum.g, frustum.b ); // n1, f1\n\t\tcolorAttribute.setXYZ( 18, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 19, frustum.r, frustum.g, frustum.b ); // n2, f2\n\t\tcolorAttribute.setXYZ( 20, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 21, frustum.r, frustum.g, frustum.b ); // n3, f3\n\t\tcolorAttribute.setXYZ( 22, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 23, frustum.r, frustum.g, frustum.b ); // n4, f4\n\n\t\t// cone\n\n\t\tcolorAttribute.setXYZ( 24, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 25, cone.r, cone.g, cone.b ); // p, n1\n\t\tcolorAttribute.setXYZ( 26, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 27, cone.r, cone.g, cone.b ); // p, n2\n\t\tcolorAttribute.setXYZ( 28, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 29, cone.r, cone.g, cone.b ); // p, n3\n\t\tcolorAttribute.setXYZ( 30, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 31, cone.r, cone.g, cone.b ); // p, n4\n\n\t\t// up\n\n\t\tcolorAttribute.setXYZ( 32, up.r, up.g, up.b ); colorAttribute.setXYZ( 33, up.r, up.g, up.b ); // u1, u2\n\t\tcolorAttribute.setXYZ( 34, up.r, up.g, up.b ); colorAttribute.setXYZ( 35, up.r, up.g, up.b ); // u2, u3\n\t\tcolorAttribute.setXYZ( 36, up.r, up.g, up.b ); colorAttribute.setXYZ( 37, up.r, up.g, up.b ); // u3, u1\n\n\t\t// target\n\n\t\tcolorAttribute.setXYZ( 38, target.r, target.g, target.b ); colorAttribute.setXYZ( 39, target.r, target.g, target.b ); // c, t\n\t\tcolorAttribute.setXYZ( 40, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 41, cross.r, cross.g, cross.b ); // p, c\n\n\t\t// cross\n\n\t\tcolorAttribute.setXYZ( 42, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 43, cross.r, cross.g, cross.b ); // cn1, cn2\n\t\tcolorAttribute.setXYZ( 44, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 45, cross.r, cross.g, cross.b ); // cn3, cn4\n\n\t\tcolorAttribute.setXYZ( 46, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 47, cross.r, cross.g, cross.b ); // cf1, cf2\n\t\tcolorAttribute.setXYZ( 48, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 49, cross.r, cross.g, cross.b ); // cf3, cf4\n\n\t\tcolorAttribute.needsUpdate = true;\n\n\t}\n\n\tupdate() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst pointMap = this.pointMap;\n\n\t\tconst w = 1, h = 1;\n\n\t\t// we need just camera projection matrix inverse\n\t\t// world matrix must be identity\n\n\t\t_camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );\n\n\t\t// center / target\n\n\t\tsetPoint( 'c', pointMap, geometry, _camera, 0, 0, - 1 );\n\t\tsetPoint( 't', pointMap, geometry, _camera, 0, 0, 1 );\n\n\t\t// near\n\n\t\tsetPoint( 'n1', pointMap, geometry, _camera, - w, - h, - 1 );\n\t\tsetPoint( 'n2', pointMap, geometry, _camera, w, - h, - 1 );\n\t\tsetPoint( 'n3', pointMap, geometry, _camera, - w, h, - 1 );\n\t\tsetPoint( 'n4', pointMap, geometry, _camera, w, h, - 1 );\n\n\t\t// far\n\n\t\tsetPoint( 'f1', pointMap, geometry, _camera, - w, - h, 1 );\n\t\tsetPoint( 'f2', pointMap, geometry, _camera, w, - h, 1 );\n\t\tsetPoint( 'f3', pointMap, geometry, _camera, - w, h, 1 );\n\t\tsetPoint( 'f4', pointMap, geometry, _camera, w, h, 1 );\n\n\t\t// up\n\n\t\tsetPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, - 1 );\n\t\tsetPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1, - 1 );\n\t\tsetPoint( 'u3', pointMap, geometry, _camera, 0, h * 2, - 1 );\n\n\t\t// cross\n\n\t\tsetPoint( 'cf1', pointMap, geometry, _camera, - w, 0, 1 );\n\t\tsetPoint( 'cf2', pointMap, geometry, _camera, w, 0, 1 );\n\t\tsetPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 );\n\t\tsetPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 );\n\n\t\tsetPoint( 'cn1', pointMap, geometry, _camera, - w, 0, - 1 );\n\t\tsetPoint( 'cn2', pointMap, geometry, _camera, w, 0, - 1 );\n\t\tsetPoint( 'cn3', pointMap, geometry, _camera, 0, - h, - 1 );\n\t\tsetPoint( 'cn4', pointMap, geometry, _camera, 0, h, - 1 );\n\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n\nfunction setPoint( point, pointMap, geometry, camera, x, y, z ) {\n\n\t_vector.set( x, y, z ).unproject( camera );\n\n\tconst points = pointMap[ point ];\n\n\tif ( points !== undefined ) {\n\n\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tposition.setXYZ( points[ i ], _vector.x, _vector.y, _vector.z );\n\n\t\t}\n\n\t}\n\n}\n\nconst _box = /*@__PURE__*/ new Box3();\n\nclass BoxHelper extends LineSegments {\n\n\tconstructor( object, color = 0xffff00 ) {\n\n\t\tconst indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\t\tconst positions = new Float32Array( 8 * 3 );\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\t\tgeometry.setAttribute( 'position', new BufferAttribute( positions, 3 ) );\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.object = object;\n\t\tthis.type = 'BoxHelper';\n\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.update();\n\n\t}\n\n\tupdate( object ) {\n\n\t\tif ( object !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.BoxHelper: .update() has no longer arguments.' );\n\n\t\t}\n\n\t\tif ( this.object !== undefined ) {\n\n\t\t\t_box.setFromObject( this.object );\n\n\t\t}\n\n\t\tif ( _box.isEmpty() ) return;\n\n\t\tconst min = _box.min;\n\t\tconst max = _box.max;\n\n\t\t/*\n\t\t\t5____4\n\t\t1/___0/|\n\t\t| 6__|_7\n\t\t2/___3/\n\n\t\t0: max.x, max.y, max.z\n\t\t1: min.x, max.y, max.z\n\t\t2: min.x, min.y, max.z\n\t\t3: max.x, min.y, max.z\n\t\t4: max.x, max.y, min.z\n\t\t5: min.x, max.y, min.z\n\t\t6: min.x, min.y, min.z\n\t\t7: max.x, min.y, min.z\n\t\t*/\n\n\t\tconst position = this.geometry.attributes.position;\n\t\tconst array = position.array;\n\n\t\tarray[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z;\n\t\tarray[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z;\n\t\tarray[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z;\n\t\tarray[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z;\n\t\tarray[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z;\n\t\tarray[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z;\n\t\tarray[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z;\n\t\tarray[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z;\n\n\t\tposition.needsUpdate = true;\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t}\n\n\tsetFromObject( object ) {\n\n\t\tthis.object = object;\n\t\tthis.update();\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.object = source.object;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass Box3Helper extends LineSegments {\n\n\tconstructor( box, color = 0xffff00 ) {\n\n\t\tconst indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\n\t\tconst positions = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 1, - 1, 1, - 1, - 1 ];\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.box = box;\n\n\t\tthis.type = 'Box3Helper';\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tconst box = this.box;\n\n\t\tif ( box.isEmpty() ) return;\n\n\t\tbox.getCenter( this.position );\n\n\t\tbox.getSize( this.scale );\n\n\t\tthis.scale.multiplyScalar( 0.5 );\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass PlaneHelper extends Line {\n\n\tconstructor( plane, size = 1, hex = 0xffff00 ) {\n\n\t\tconst color = hex;\n\n\t\tconst positions = [ 1, - 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, - 1, 0, 1, 1, 0 ];\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\t\tgeometry.computeBoundingSphere();\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.type = 'PlaneHelper';\n\n\t\tthis.plane = plane;\n\n\t\tthis.size = size;\n\n\t\tconst positions2 = [ 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, - 1, 0 ];\n\n\t\tconst geometry2 = new BufferGeometry();\n\t\tgeometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) );\n\t\tgeometry2.computeBoundingSphere();\n\n\t\tthis.add( new Mesh( geometry2, new MeshBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false, toneMapped: false } ) ) );\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tthis.position.set( 0, 0, 0 );\n\n\t\tthis.scale.set( 0.5 * this.size, 0.5 * this.size, 1 );\n\n\t\tthis.lookAt( this.plane.normal );\n\n\t\tthis.translateZ( - this.plane.constant );\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\t\tthis.children[ 0 ].geometry.dispose();\n\t\tthis.children[ 0 ].material.dispose();\n\n\t}\n\n}\n\nconst _axis = /*@__PURE__*/ new Vector3();\nlet _lineGeometry, _coneGeometry;\n\nclass ArrowHelper extends Object3D {\n\n\t// dir is assumed to be normalized\n\n\tconstructor( dir = new Vector3( 0, 0, 1 ), origin = new Vector3( 0, 0, 0 ), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ArrowHelper';\n\n\t\tif ( _lineGeometry === undefined ) {\n\n\t\t\t_lineGeometry = new BufferGeometry();\n\t\t\t_lineGeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );\n\n\t\t\t_coneGeometry = new CylinderGeometry( 0, 0.5, 1, 5, 1 );\n\t\t\t_coneGeometry.translate( 0, - 0.5, 0 );\n\n\t\t}\n\n\t\tthis.position.copy( origin );\n\n\t\tthis.line = new Line( _lineGeometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\t\tthis.line.matrixAutoUpdate = false;\n\t\tthis.add( this.line );\n\n\t\tthis.cone = new Mesh( _coneGeometry, new MeshBasicMaterial( { color: color, toneMapped: false } ) );\n\t\tthis.cone.matrixAutoUpdate = false;\n\t\tthis.add( this.cone );\n\n\t\tthis.setDirection( dir );\n\t\tthis.setLength( length, headLength, headWidth );\n\n\t}\n\n\tsetDirection( dir ) {\n\n\t\t// dir is assumed to be normalized\n\n\t\tif ( dir.y > 0.99999 ) {\n\n\t\t\tthis.quaternion.set( 0, 0, 0, 1 );\n\n\t\t} else if ( dir.y < - 0.99999 ) {\n\n\t\t\tthis.quaternion.set( 1, 0, 0, 0 );\n\n\t\t} else {\n\n\t\t\t_axis.set( dir.z, 0, - dir.x ).normalize();\n\n\t\t\tconst radians = Math.acos( dir.y );\n\n\t\t\tthis.quaternion.setFromAxisAngle( _axis, radians );\n\n\t\t}\n\n\t}\n\n\tsetLength( length, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\n\n\t\tthis.line.scale.set( 1, Math.max( 0.0001, length - headLength ), 1 ); // see #17458\n\t\tthis.line.updateMatrix();\n\n\t\tthis.cone.scale.set( headWidth, headLength, headWidth );\n\t\tthis.cone.position.y = length;\n\t\tthis.cone.updateMatrix();\n\n\t}\n\n\tsetColor( color ) {\n\n\t\tthis.line.material.color.set( color );\n\t\tthis.cone.material.color.set( color );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source, false );\n\n\t\tthis.line.copy( source.line );\n\t\tthis.cone.copy( source.cone );\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.line.geometry.dispose();\n\t\tthis.line.material.dispose();\n\t\tthis.cone.geometry.dispose();\n\t\tthis.cone.material.dispose();\n\n\t}\n\n}\n\nclass AxesHelper extends LineSegments {\n\n\tconstructor( size = 1 ) {\n\n\t\tconst vertices = [\n\t\t\t0, 0, 0,\tsize, 0, 0,\n\t\t\t0, 0, 0,\t0, size, 0,\n\t\t\t0, 0, 0,\t0, 0, size\n\t\t];\n\n\t\tconst colors = [\n\t\t\t1, 0, 0,\t1, 0.6, 0,\n\t\t\t0, 1, 0,\t0.6, 1, 0,\n\t\t\t0, 0, 1,\t0, 0.6, 1\n\t\t];\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'AxesHelper';\n\n\t}\n\n\tsetColors( xAxisColor, yAxisColor, zAxisColor ) {\n\n\t\tconst color = new Color();\n\t\tconst array = this.geometry.attributes.color.array;\n\n\t\tcolor.set( xAxisColor );\n\t\tcolor.toArray( array, 0 );\n\t\tcolor.toArray( array, 3 );\n\n\t\tcolor.set( yAxisColor );\n\t\tcolor.toArray( array, 6 );\n\t\tcolor.toArray( array, 9 );\n\n\t\tcolor.set( zAxisColor );\n\t\tcolor.toArray( array, 12 );\n\t\tcolor.toArray( array, 15 );\n\n\t\tthis.geometry.attributes.color.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass ShapePath {\n\n\tconstructor() {\n\n\t\tthis.type = 'ShapePath';\n\n\t\tthis.color = new Color();\n\n\t\tthis.subPaths = [];\n\t\tthis.currentPath = null;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPath = new Path();\n\t\tthis.subPaths.push( this.currentPath );\n\t\tthis.currentPath.moveTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tthis.currentPath.lineTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tthis.currentPath.quadraticCurveTo( aCPx, aCPy, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tthis.currentPath.bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts ) {\n\n\t\tthis.currentPath.splineThru( pts );\n\n\t\treturn this;\n\n\t}\n\n\ttoShapes( isCCW ) {\n\n\t\tfunction toShapesNoHoles( inSubpaths ) {\n\n\t\t\tconst shapes = [];\n\n\t\t\tfor ( let i = 0, l = inSubpaths.length; i < l; i ++ ) {\n\n\t\t\t\tconst tmpPath = inSubpaths[ i ];\n\n\t\t\t\tconst tmpShape = new Shape();\n\t\t\t\ttmpShape.curves = tmpPath.curves;\n\n\t\t\t\tshapes.push( tmpShape );\n\n\t\t\t}\n\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tfunction isPointInsidePolygon( inPt, inPolygon ) {\n\n\t\t\tconst polyLen = inPolygon.length;\n\n\t\t\t// inPt on polygon contour => immediate success or\n\t\t\t// toggling of inside/outside at every single! intersection point of an edge\n\t\t\t// with the horizontal line through inPt, left of inPt\n\t\t\t// not counting lowerY endpoints of edges and whole edges on that line\n\t\t\tlet inside = false;\n\t\t\tfor ( let p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {\n\n\t\t\t\tlet edgeLowPt = inPolygon[ p ];\n\t\t\t\tlet edgeHighPt = inPolygon[ q ];\n\n\t\t\t\tlet edgeDx = edgeHighPt.x - edgeLowPt.x;\n\t\t\t\tlet edgeDy = edgeHighPt.y - edgeLowPt.y;\n\n\t\t\t\tif ( Math.abs( edgeDy ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not parallel\n\t\t\t\t\tif ( edgeDy < 0 ) {\n\n\t\t\t\t\t\tedgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;\n\t\t\t\t\t\tedgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) \t\tcontinue;\n\n\t\t\t\t\tif ( inPt.y === edgeLowPt.y ) {\n\n\t\t\t\t\t\tif ( inPt.x === edgeLowPt.x )\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\t// continue;\t\t\t\t// no intersection or edgeLowPt => doesn't count !!!\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y );\n\t\t\t\t\t\tif ( perpEdge === 0 )\t\t\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\tif ( perpEdge < 0 ) \t\t\t\tcontinue;\n\t\t\t\t\t\tinside = ! inside;\t\t// true intersection left of inPt\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// parallel or collinear\n\t\t\t\t\tif ( inPt.y !== edgeLowPt.y ) \t\tcontinue;\t\t\t// parallel\n\t\t\t\t\t// edge lies on the same horizontal line as inPt\n\t\t\t\t\tif ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||\n\t\t\t\t\t\t ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) )\t\treturn\ttrue;\t// inPt: Point on contour !\n\t\t\t\t\t// continue;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn\tinside;\n\n\t\t}\n\n\t\tconst isClockWise = ShapeUtils.isClockWise;\n\n\t\tconst subPaths = this.subPaths;\n\t\tif ( subPaths.length === 0 ) return [];\n\n\t\tlet solid, tmpPath, tmpShape;\n\t\tconst shapes = [];\n\n\t\tif ( subPaths.length === 1 ) {\n\n\t\t\ttmpPath = subPaths[ 0 ];\n\t\t\ttmpShape = new Shape();\n\t\t\ttmpShape.curves = tmpPath.curves;\n\t\t\tshapes.push( tmpShape );\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tlet holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() );\n\t\tholesFirst = isCCW ? ! holesFirst : holesFirst;\n\n\t\t// console.log(\"Holes first\", holesFirst);\n\n\t\tconst betterShapeHoles = [];\n\t\tconst newShapes = [];\n\t\tlet newShapeHoles = [];\n\t\tlet mainIdx = 0;\n\t\tlet tmpPoints;\n\n\t\tnewShapes[ mainIdx ] = undefined;\n\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\tfor ( let i = 0, l = subPaths.length; i < l; i ++ ) {\n\n\t\t\ttmpPath = subPaths[ i ];\n\t\t\ttmpPoints = tmpPath.getPoints();\n\t\t\tsolid = isClockWise( tmpPoints );\n\t\t\tsolid = isCCW ? ! solid : solid;\n\n\t\t\tif ( solid ) {\n\n\t\t\t\tif ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) )\tmainIdx ++;\n\n\t\t\t\tnewShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints };\n\t\t\t\tnewShapes[ mainIdx ].s.curves = tmpPath.curves;\n\n\t\t\t\tif ( holesFirst )\tmainIdx ++;\n\t\t\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\t\t\t//console.log('cw', i);\n\n\t\t\t} else {\n\n\t\t\t\tnewShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );\n\n\t\t\t\t//console.log('ccw', i);\n\n\t\t\t}\n\n\t\t}\n\n\t\t// only Holes? -> probably all Shapes with wrong orientation\n\t\tif ( ! newShapes[ 0 ] )\treturn\ttoShapesNoHoles( subPaths );\n\n\n\t\tif ( newShapes.length > 1 ) {\n\n\t\t\tlet ambiguous = false;\n\t\t\tlet toChange = 0;\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tbetterShapeHoles[ sIdx ] = [];\n\n\t\t\t}\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tconst sho = newShapeHoles[ sIdx ];\n\n\t\t\t\tfor ( let hIdx = 0; hIdx < sho.length; hIdx ++ ) {\n\n\t\t\t\t\tconst ho = sho[ hIdx ];\n\t\t\t\t\tlet hole_unassigned = true;\n\n\t\t\t\t\tfor ( let s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {\n\n\t\t\t\t\t\tif ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {\n\n\t\t\t\t\t\t\tif ( sIdx !== s2Idx )\ttoChange ++;\n\n\t\t\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\t\t\thole_unassigned = false;\n\t\t\t\t\t\t\t\tbetterShapeHoles[ s2Idx ].push( ho );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tambiguous = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\tbetterShapeHoles[ sIdx ].push( ho );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( toChange > 0 && ambiguous === false ) {\n\n\t\t\t\tnewShapeHoles = betterShapeHoles;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet tmpHoles;\n\n\t\tfor ( let i = 0, il = newShapes.length; i < il; i ++ ) {\n\n\t\t\ttmpShape = newShapes[ i ].s;\n\t\t\tshapes.push( tmpShape );\n\t\t\ttmpHoles = newShapeHoles[ i ];\n\n\t\t\tfor ( let j = 0, jl = tmpHoles.length; j < jl; j ++ ) {\n\n\t\t\t\ttmpShape.holes.push( tmpHoles[ j ].h );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//console.log(\"shape\", shapes);\n\n\t\treturn shapes;\n\n\t}\n\n}\n\nclass Controls extends EventDispatcher {\n\n\tconstructor( object, domElement ) {\n\n\t\tsuper();\n\n\t\tthis.object = object;\n\t\tthis.domElement = domElement;\n\n\t\tthis.enabled = true;\n\n\t\tthis.state = - 1;\n\n\t\tthis.keys = {};\n\t\tthis.mouseButtons = { LEFT: null, MIDDLE: null, RIGHT: null };\n\t\tthis.touches = { ONE: null, TWO: null };\n\n\t}\n\n\tconnect() {}\n\n\tdisconnect() {}\n\n\tdispose() {}\n\n\tupdate( /* delta */ ) {}\n\n}\n\nclass WebGLMultipleRenderTargets extends WebGLRenderTarget { // @deprecated, r162\n\n\tconstructor( width = 1, height = 1, count = 1, options = {} ) {\n\n\t\tconsole.warn( 'THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the \"count\" parameter to enable MRT.' );\n\n\t\tsuper( width, height, { ...options, count } );\n\n\t\tthis.isWebGLMultipleRenderTargets = true;\n\n\t}\n\n\tget texture() {\n\n\t\treturn this.textures;\n\n\t}\n\n}\n\nif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {\n\t\trevision: REVISION,\n\t} } ) );\n\n}\n\nif ( typeof window !== 'undefined' ) {\n\n\tif ( window.__THREE__ ) {\n\n\t\tconsole.warn( 'WARNING: Multiple instances of Three.js being imported.' );\n\n\t} else {\n\n\t\twindow.__THREE__ = REVISION;\n\n\t}\n\n}\n\n\n\n\n//# sourceURL=webpack://3d_game/./node_modules/three/build/three.module.js?")},"./node_modules/three/examples/jsm/controls/PointerLockControls.js":function _node_modules_three_examples_jsm_controls_PointerLockControlsJs(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__){eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PointerLockControls: () => (/* binding */ PointerLockControls)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\nconst _euler = new three__WEBPACK_IMPORTED_MODULE_0__.Euler( 0, 0, 0, 'YXZ' );\nconst _vector = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\nconst _changeEvent = { type: 'change' };\nconst _lockEvent = { type: 'lock' };\nconst _unlockEvent = { type: 'unlock' };\n\nconst _PI_2 = Math.PI / 2;\n\nclass PointerLockControls extends three__WEBPACK_IMPORTED_MODULE_0__.Controls {\n\n\tconstructor( camera, domElement = null ) {\n\n\t\tsuper( camera, domElement );\n\n\t\tthis.isLocked = false;\n\n\t\t// Set to constrain the pitch of the camera\n\t\t// Range is 0 to Math.PI radians\n\t\tthis.minPolarAngle = 0; // radians\n\t\tthis.maxPolarAngle = Math.PI; // radians\n\n\t\tthis.pointerSpeed = 1.0;\n\n\t\t// event listeners\n\n\t\tthis._onMouseMove = onMouseMove.bind( this );\n\t\tthis._onPointerlockChange = onPointerlockChange.bind( this );\n\t\tthis._onPointerlockError = onPointerlockError.bind( this );\n\n\t\tif ( this.domElement !== null ) {\n\n\t\t\tthis.connect();\n\n\t\t}\n\n\t}\n\n\tconnect() {\n\n\t\tthis.domElement.ownerDocument.addEventListener( 'mousemove', this._onMouseMove );\n\t\tthis.domElement.ownerDocument.addEventListener( 'pointerlockchange', this._onPointerlockChange );\n\t\tthis.domElement.ownerDocument.addEventListener( 'pointerlockerror', this._onPointerlockError );\n\n\t}\n\n\tdisconnect() {\n\n\t\tthis.domElement.ownerDocument.removeEventListener( 'mousemove', this._onMouseMove );\n\t\tthis.domElement.ownerDocument.removeEventListener( 'pointerlockchange', this._onPointerlockChange );\n\t\tthis.domElement.ownerDocument.removeEventListener( 'pointerlockerror', this._onPointerlockError );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.disconnect();\n\n\t}\n\n\tgetObject() {\n\n\t\tconsole.warn( 'THREE.PointerLockControls: getObject() has been deprecated. Use controls.object instead.' ); // @deprecated r169\n\n\t\treturn this.object;\n\n\t}\n\n\tgetDirection( v ) {\n\n\t\treturn v.set( 0, 0, - 1 ).applyQuaternion( this.object.quaternion );\n\n\t}\n\n\tmoveForward( distance ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// move forward parallel to the xz-plane\n\t\t// assumes camera.up is y-up\n\n\t\tconst camera = this.object;\n\n\t\t_vector.setFromMatrixColumn( camera.matrix, 0 );\n\n\t\t_vector.crossVectors( camera.up, _vector );\n\n\t\tcamera.position.addScaledVector( _vector, distance );\n\n\t}\n\n\tmoveRight( distance ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\tconst camera = this.object;\n\n\t\t_vector.setFromMatrixColumn( camera.matrix, 0 );\n\n\t\tcamera.position.addScaledVector( _vector, distance );\n\n\t}\n\n\tlock() {\n\n\t\tthis.domElement.requestPointerLock();\n\n\t}\n\n\tunlock() {\n\n\t\tthis.domElement.ownerDocument.exitPointerLock();\n\n\t}\n\n}\n\n// event listeners\n\nfunction onMouseMove( event ) {\n\n\tif ( this.enabled === false || this.isLocked === false ) return;\n\n\tconst movementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0;\n\tconst movementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0;\n\n\tconst camera = this.object;\n\t_euler.setFromQuaternion( camera.quaternion );\n\n\t_euler.y -= movementX * 0.002 * this.pointerSpeed;\n\t_euler.x -= movementY * 0.002 * this.pointerSpeed;\n\n\t_euler.x = Math.max( _PI_2 - this.maxPolarAngle, Math.min( _PI_2 - this.minPolarAngle, _euler.x ) );\n\n\tcamera.quaternion.setFromEuler( _euler );\n\n\tthis.dispatchEvent( _changeEvent );\n\n}\n\nfunction onPointerlockChange() {\n\n\tif ( this.domElement.ownerDocument.pointerLockElement === this.domElement ) {\n\n\t\tthis.dispatchEvent( _lockEvent );\n\n\t\tthis.isLocked = true;\n\n\t} else {\n\n\t\tthis.dispatchEvent( _unlockEvent );\n\n\t\tthis.isLocked = false;\n\n\t}\n\n}\n\nfunction onPointerlockError() {\n\n\tconsole.error( 'THREE.PointerLockControls: Unable to use Pointer Lock API' );\n\n}\n\n\n\n\n//# sourceURL=webpack://3d_game/./node_modules/three/examples/jsm/controls/PointerLockControls.js?")},"./node_modules/three/examples/jsm/libs/stats.module.js":function _node_modules_three_examples_jsm_libs_statsModuleJs(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__){eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nvar Stats = function () {\n\n\tvar mode = 0;\n\n\tvar container = document.createElement( 'div' );\n\tcontainer.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000';\n\tcontainer.addEventListener( 'click', function ( event ) {\n\n\t\tevent.preventDefault();\n\t\tshowPanel( ++ mode % container.children.length );\n\n\t}, false );\n\n\t//\n\n\tfunction addPanel( panel ) {\n\n\t\tcontainer.appendChild( panel.dom );\n\t\treturn panel;\n\n\t}\n\n\tfunction showPanel( id ) {\n\n\t\tfor ( var i = 0; i < container.children.length; i ++ ) {\n\n\t\t\tcontainer.children[ i ].style.display = i === id ? 'block' : 'none';\n\n\t\t}\n\n\t\tmode = id;\n\n\t}\n\n\t//\n\n\tvar beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0;\n\n\tvar fpsPanel = addPanel( new Stats.Panel( 'FPS', '#0ff', '#002' ) );\n\tvar msPanel = addPanel( new Stats.Panel( 'MS', '#0f0', '#020' ) );\n\n\tif ( self.performance && self.performance.memory ) {\n\n\t\tvar memPanel = addPanel( new Stats.Panel( 'MB', '#f08', '#201' ) );\n\n\t}\n\n\tshowPanel( 0 );\n\n\treturn {\n\n\t\tREVISION: 16,\n\n\t\tdom: container,\n\n\t\taddPanel: addPanel,\n\t\tshowPanel: showPanel,\n\n\t\tbegin: function () {\n\n\t\t\tbeginTime = ( performance || Date ).now();\n\n\t\t},\n\n\t\tend: function () {\n\n\t\t\tframes ++;\n\n\t\t\tvar time = ( performance || Date ).now();\n\n\t\t\tmsPanel.update( time - beginTime, 200 );\n\n\t\t\tif ( time >= prevTime + 1000 ) {\n\n\t\t\t\tfpsPanel.update( ( frames * 1000 ) / ( time - prevTime ), 100 );\n\n\t\t\t\tprevTime = time;\n\t\t\t\tframes = 0;\n\n\t\t\t\tif ( memPanel ) {\n\n\t\t\t\t\tvar memory = performance.memory;\n\t\t\t\t\tmemPanel.update( memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn time;\n\n\t\t},\n\n\t\tupdate: function () {\n\n\t\t\tbeginTime = this.end();\n\n\t\t},\n\n\t\t// Backwards Compatibility\n\n\t\tdomElement: container,\n\t\tsetMode: showPanel\n\n\t};\n\n};\n\nStats.Panel = function ( name, fg, bg ) {\n\n\tvar min = Infinity, max = 0, round = Math.round;\n\tvar PR = round( window.devicePixelRatio || 1 );\n\n\tvar WIDTH = 80 * PR, HEIGHT = 48 * PR,\n\t\tTEXT_X = 3 * PR, TEXT_Y = 2 * PR,\n\t\tGRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,\n\t\tGRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;\n\n\tvar canvas = document.createElement( 'canvas' );\n\tcanvas.width = WIDTH;\n\tcanvas.height = HEIGHT;\n\tcanvas.style.cssText = 'width:80px;height:48px';\n\n\tvar context = canvas.getContext( '2d' );\n\tcontext.font = 'bold ' + ( 9 * PR ) + 'px Helvetica,Arial,sans-serif';\n\tcontext.textBaseline = 'top';\n\n\tcontext.fillStyle = bg;\n\tcontext.fillRect( 0, 0, WIDTH, HEIGHT );\n\n\tcontext.fillStyle = fg;\n\tcontext.fillText( name, TEXT_X, TEXT_Y );\n\tcontext.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );\n\n\tcontext.fillStyle = bg;\n\tcontext.globalAlpha = 0.9;\n\tcontext.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );\n\n\treturn {\n\n\t\tdom: canvas,\n\n\t\tupdate: function ( value, maxValue ) {\n\n\t\t\tmin = Math.min( min, value );\n\t\t\tmax = Math.max( max, value );\n\n\t\t\tcontext.fillStyle = bg;\n\t\t\tcontext.globalAlpha = 1;\n\t\t\tcontext.fillRect( 0, 0, WIDTH, GRAPH_Y );\n\t\t\tcontext.fillStyle = fg;\n\t\t\tcontext.fillText( round( value ) + ' ' + name + ' (' + round( min ) + '-' + round( max ) + ')', TEXT_X, TEXT_Y );\n\n\t\t\tcontext.drawImage( canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT );\n\n\t\t\tcontext.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT );\n\n\t\t\tcontext.fillStyle = bg;\n\t\t\tcontext.globalAlpha = 0.9;\n\t\t\tcontext.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round( ( 1 - ( value / maxValue ) ) * GRAPH_HEIGHT ) );\n\n\t\t}\n\n\t};\n\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Stats);\n\n\n//# sourceURL=webpack://3d_game/./node_modules/three/examples/jsm/libs/stats.module.js?")}},__webpack_module_cache__={};function __webpack_require__(t){var n=__webpack_module_cache__[t];if(void 0!==n)return n.exports;var e=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t](e,e.exports,__webpack_require__),e.exports}__webpack_require__.d=function(t,n){for(var e in n)__webpack_require__.o(n,e)&&!__webpack_require__.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},__webpack_require__.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},__webpack_require__.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__("./src/index.js")})(); \ No newline at end of file diff --git a/dist/a708c87fa8616c003655.js.LICENSE.txt b/dist/a708c87fa8616c003655.js.LICENSE.txt new file mode 100644 index 0000000..2de306a --- /dev/null +++ b/dist/a708c87fa8616c003655.js.LICENSE.txt @@ -0,0 +1,19 @@ +/*!**********************!*\ + !*** ./src/index.js ***! + \**********************/ + +/*!**************************************************!*\ + !*** ./node_modules/cannon-es/dist/cannon-es.js ***! + \**************************************************/ + +/*!**************************************************!*\ + !*** ./node_modules/three/build/three.module.js ***! + \**************************************************/ + +/*!**************************************************************!*\ + !*** ./node_modules/three/examples/jsm/libs/stats.module.js ***! + \**************************************************************/ + +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/controls/PointerLockControls.js ***! + \*************************************************************************/ diff --git a/dist/bundle.js b/dist/bundle.js index 2faacb5..b94a359 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -1,126 +1,2 @@ -/* - * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). - * This devtool is neither made for production nor for readable output files. - * It uses "eval()" calls to create a separate source file in the browser devtools. - * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) - * or disable the default devtool with "devtool: false". - * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). - */ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./node_modules/cannon-es/dist/cannon-es.js": -/*!**************************************************!*\ - !*** ./node_modules/cannon-es/dist/cannon-es.js ***! - \**************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AABB: () => (/* binding */ AABB),\n/* harmony export */ ArrayCollisionMatrix: () => (/* binding */ ArrayCollisionMatrix),\n/* harmony export */ BODY_SLEEP_STATES: () => (/* binding */ BODY_SLEEP_STATES),\n/* harmony export */ BODY_TYPES: () => (/* binding */ BODY_TYPES),\n/* harmony export */ Body: () => (/* binding */ Body),\n/* harmony export */ Box: () => (/* binding */ Box),\n/* harmony export */ Broadphase: () => (/* binding */ Broadphase),\n/* harmony export */ COLLISION_TYPES: () => (/* binding */ COLLISION_TYPES),\n/* harmony export */ ConeTwistConstraint: () => (/* binding */ ConeTwistConstraint),\n/* harmony export */ Constraint: () => (/* binding */ Constraint),\n/* harmony export */ ContactEquation: () => (/* binding */ ContactEquation),\n/* harmony export */ ContactMaterial: () => (/* binding */ ContactMaterial),\n/* harmony export */ ConvexPolyhedron: () => (/* binding */ ConvexPolyhedron),\n/* harmony export */ Cylinder: () => (/* binding */ Cylinder),\n/* harmony export */ DistanceConstraint: () => (/* binding */ DistanceConstraint),\n/* harmony export */ Equation: () => (/* binding */ Equation),\n/* harmony export */ EventTarget: () => (/* binding */ EventTarget),\n/* harmony export */ FrictionEquation: () => (/* binding */ FrictionEquation),\n/* harmony export */ GSSolver: () => (/* binding */ GSSolver),\n/* harmony export */ GridBroadphase: () => (/* binding */ GridBroadphase),\n/* harmony export */ Heightfield: () => (/* binding */ Heightfield),\n/* harmony export */ HingeConstraint: () => (/* binding */ HingeConstraint),\n/* harmony export */ JacobianElement: () => (/* binding */ JacobianElement),\n/* harmony export */ LockConstraint: () => (/* binding */ LockConstraint),\n/* harmony export */ Mat3: () => (/* binding */ Mat3),\n/* harmony export */ Material: () => (/* binding */ Material),\n/* harmony export */ NaiveBroadphase: () => (/* binding */ NaiveBroadphase),\n/* harmony export */ Narrowphase: () => (/* binding */ Narrowphase),\n/* harmony export */ ObjectCollisionMatrix: () => (/* binding */ ObjectCollisionMatrix),\n/* harmony export */ Particle: () => (/* binding */ Particle),\n/* harmony export */ Plane: () => (/* binding */ Plane),\n/* harmony export */ PointToPointConstraint: () => (/* binding */ PointToPointConstraint),\n/* harmony export */ Pool: () => (/* binding */ Pool),\n/* harmony export */ Quaternion: () => (/* binding */ Quaternion),\n/* harmony export */ RAY_MODES: () => (/* binding */ RAY_MODES),\n/* harmony export */ Ray: () => (/* binding */ Ray),\n/* harmony export */ RaycastResult: () => (/* binding */ RaycastResult),\n/* harmony export */ RaycastVehicle: () => (/* binding */ RaycastVehicle),\n/* harmony export */ RigidVehicle: () => (/* binding */ RigidVehicle),\n/* harmony export */ RotationalEquation: () => (/* binding */ RotationalEquation),\n/* harmony export */ RotationalMotorEquation: () => (/* binding */ RotationalMotorEquation),\n/* harmony export */ SAPBroadphase: () => (/* binding */ SAPBroadphase),\n/* harmony export */ SHAPE_TYPES: () => (/* binding */ SHAPE_TYPES),\n/* harmony export */ SPHSystem: () => (/* binding */ SPHSystem),\n/* harmony export */ Shape: () => (/* binding */ Shape),\n/* harmony export */ Solver: () => (/* binding */ Solver),\n/* harmony export */ Sphere: () => (/* binding */ Sphere),\n/* harmony export */ SplitSolver: () => (/* binding */ SplitSolver),\n/* harmony export */ Spring: () => (/* binding */ Spring),\n/* harmony export */ Transform: () => (/* binding */ Transform),\n/* harmony export */ Trimesh: () => (/* binding */ Trimesh),\n/* harmony export */ Vec3: () => (/* binding */ Vec3),\n/* harmony export */ Vec3Pool: () => (/* binding */ Vec3Pool),\n/* harmony export */ WheelInfo: () => (/* binding */ WheelInfo),\n/* harmony export */ World: () => (/* binding */ World)\n/* harmony export */ });\n/**\n * Records what objects are colliding with each other\n */\nclass ObjectCollisionMatrix {\n /**\n * The matrix storage.\n */\n\n /**\n * @todo Remove useless constructor\n */\n constructor() {\n this.matrix = void 0;\n this.matrix = {};\n }\n /**\n * get\n */\n\n\n get(bi, bj) {\n let {\n id: i\n } = bi;\n let {\n id: j\n } = bj;\n\n if (j > i) {\n const temp = j;\n j = i;\n i = temp;\n }\n\n return i + \"-\" + j in this.matrix;\n }\n /**\n * set\n */\n\n\n set(bi, bj, value) {\n let {\n id: i\n } = bi;\n let {\n id: j\n } = bj;\n\n if (j > i) {\n const temp = j;\n j = i;\n i = temp;\n }\n\n if (value) {\n this.matrix[i + \"-\" + j] = true;\n } else {\n delete this.matrix[i + \"-\" + j];\n }\n }\n /**\n * Empty the matrix\n */\n\n\n reset() {\n this.matrix = {};\n }\n /**\n * Set max number of objects\n */\n\n\n setNumObjects(n) {}\n\n}\n\n/**\n * A 3x3 matrix.\n * Authored by {@link http://github.com/schteppe/ schteppe}\n */\nclass Mat3 {\n /**\n * A vector of length 9, containing all matrix elements.\n */\n\n /**\n * @param elements A vector of length 9, containing all matrix elements.\n */\n constructor(elements = [0, 0, 0, 0, 0, 0, 0, 0, 0]) {\n this.elements = void 0;\n this.elements = elements;\n }\n /**\n * Sets the matrix to identity\n * @todo Should perhaps be renamed to `setIdentity()` to be more clear.\n * @todo Create another function that immediately creates an identity matrix eg. `eye()`\n */\n\n\n identity() {\n const e = this.elements;\n e[0] = 1;\n e[1] = 0;\n e[2] = 0;\n e[3] = 0;\n e[4] = 1;\n e[5] = 0;\n e[6] = 0;\n e[7] = 0;\n e[8] = 1;\n }\n /**\n * Set all elements to zero\n */\n\n\n setZero() {\n const e = this.elements;\n e[0] = 0;\n e[1] = 0;\n e[2] = 0;\n e[3] = 0;\n e[4] = 0;\n e[5] = 0;\n e[6] = 0;\n e[7] = 0;\n e[8] = 0;\n }\n /**\n * Sets the matrix diagonal elements from a Vec3\n */\n\n\n setTrace(vector) {\n const e = this.elements;\n e[0] = vector.x;\n e[4] = vector.y;\n e[8] = vector.z;\n }\n /**\n * Gets the matrix diagonal elements\n */\n\n\n getTrace(target = new Vec3()) {\n const e = this.elements;\n target.x = e[0];\n target.y = e[4];\n target.z = e[8];\n return target;\n }\n /**\n * Matrix-Vector multiplication\n * @param v The vector to multiply with\n * @param target Optional, target to save the result in.\n */\n\n\n vmult(v, target = new Vec3()) {\n const e = this.elements;\n const x = v.x;\n const y = v.y;\n const z = v.z;\n target.x = e[0] * x + e[1] * y + e[2] * z;\n target.y = e[3] * x + e[4] * y + e[5] * z;\n target.z = e[6] * x + e[7] * y + e[8] * z;\n return target;\n }\n /**\n * Matrix-scalar multiplication\n */\n\n\n smult(s) {\n for (let i = 0; i < this.elements.length; i++) {\n this.elements[i] *= s;\n }\n }\n /**\n * Matrix multiplication\n * @param matrix Matrix to multiply with from left side.\n */\n\n\n mmult(matrix, target = new Mat3()) {\n const A = this.elements;\n const B = matrix.elements;\n const T = target.elements;\n const a11 = A[0],\n a12 = A[1],\n a13 = A[2],\n a21 = A[3],\n a22 = A[4],\n a23 = A[5],\n a31 = A[6],\n a32 = A[7],\n a33 = A[8];\n const b11 = B[0],\n b12 = B[1],\n b13 = B[2],\n b21 = B[3],\n b22 = B[4],\n b23 = B[5],\n b31 = B[6],\n b32 = B[7],\n b33 = B[8];\n T[0] = a11 * b11 + a12 * b21 + a13 * b31;\n T[1] = a11 * b12 + a12 * b22 + a13 * b32;\n T[2] = a11 * b13 + a12 * b23 + a13 * b33;\n T[3] = a21 * b11 + a22 * b21 + a23 * b31;\n T[4] = a21 * b12 + a22 * b22 + a23 * b32;\n T[5] = a21 * b13 + a22 * b23 + a23 * b33;\n T[6] = a31 * b11 + a32 * b21 + a33 * b31;\n T[7] = a31 * b12 + a32 * b22 + a33 * b32;\n T[8] = a31 * b13 + a32 * b23 + a33 * b33;\n return target;\n }\n /**\n * Scale each column of the matrix\n */\n\n\n scale(vector, target = new Mat3()) {\n const e = this.elements;\n const t = target.elements;\n\n for (let i = 0; i !== 3; i++) {\n t[3 * i + 0] = vector.x * e[3 * i + 0];\n t[3 * i + 1] = vector.y * e[3 * i + 1];\n t[3 * i + 2] = vector.z * e[3 * i + 2];\n }\n\n return target;\n }\n /**\n * Solve Ax=b\n * @param b The right hand side\n * @param target Optional. Target vector to save in.\n * @return The solution x\n * @todo should reuse arrays\n */\n\n\n solve(b, target = new Vec3()) {\n // Construct equations\n const nr = 3; // num rows\n\n const nc = 4; // num cols\n\n const eqns = [];\n let i;\n let j;\n\n for (i = 0; i < nr * nc; i++) {\n eqns.push(0);\n }\n\n for (i = 0; i < 3; i++) {\n for (j = 0; j < 3; j++) {\n eqns[i + nc * j] = this.elements[i + 3 * j];\n }\n }\n\n eqns[3 + 4 * 0] = b.x;\n eqns[3 + 4 * 1] = b.y;\n eqns[3 + 4 * 2] = b.z; // Compute right upper triangular version of the matrix - Gauss elimination\n\n let n = 3;\n const k = n;\n let np;\n const kp = 4; // num rows\n\n let p;\n\n do {\n i = k - n;\n\n if (eqns[i + nc * i] === 0) {\n // the pivot is null, swap lines\n for (j = i + 1; j < k; j++) {\n if (eqns[i + nc * j] !== 0) {\n np = kp;\n\n do {\n // do ligne( i ) = ligne( i ) + ligne( k )\n p = kp - np;\n eqns[p + nc * i] += eqns[p + nc * j];\n } while (--np);\n\n break;\n }\n }\n }\n\n if (eqns[i + nc * i] !== 0) {\n for (j = i + 1; j < k; j++) {\n const multiplier = eqns[i + nc * j] / eqns[i + nc * i];\n np = kp;\n\n do {\n // do ligne( k ) = ligne( k ) - multiplier * ligne( i )\n p = kp - np;\n eqns[p + nc * j] = p <= i ? 0 : eqns[p + nc * j] - eqns[p + nc * i] * multiplier;\n } while (--np);\n }\n }\n } while (--n); // Get the solution\n\n\n target.z = eqns[2 * nc + 3] / eqns[2 * nc + 2];\n target.y = (eqns[1 * nc + 3] - eqns[1 * nc + 2] * target.z) / eqns[1 * nc + 1];\n target.x = (eqns[0 * nc + 3] - eqns[0 * nc + 2] * target.z - eqns[0 * nc + 1] * target.y) / eqns[0 * nc + 0];\n\n if (isNaN(target.x) || isNaN(target.y) || isNaN(target.z) || target.x === Infinity || target.y === Infinity || target.z === Infinity) {\n throw \"Could not solve equation! Got x=[\" + target.toString() + \"], b=[\" + b.toString() + \"], A=[\" + this.toString() + \"]\";\n }\n\n return target;\n }\n /**\n * Get an element in the matrix by index. Index starts at 0, not 1!!!\n * @param value If provided, the matrix element will be set to this value.\n */\n\n\n e(row, column, value) {\n if (value === undefined) {\n return this.elements[column + 3 * row];\n } else {\n // Set value\n this.elements[column + 3 * row] = value;\n }\n }\n /**\n * Copy another matrix into this matrix object.\n */\n\n\n copy(matrix) {\n for (let i = 0; i < matrix.elements.length; i++) {\n this.elements[i] = matrix.elements[i];\n }\n\n return this;\n }\n /**\n * Returns a string representation of the matrix.\n */\n\n\n toString() {\n let r = '';\n const sep = ',';\n\n for (let i = 0; i < 9; i++) {\n r += this.elements[i] + sep;\n }\n\n return r;\n }\n /**\n * reverse the matrix\n * @param target Target matrix to save in.\n * @return The solution x\n */\n\n\n reverse(target = new Mat3()) {\n // Construct equations\n const nr = 3; // num rows\n\n const nc = 6; // num cols\n\n const eqns = reverse_eqns;\n let i;\n let j;\n\n for (i = 0; i < 3; i++) {\n for (j = 0; j < 3; j++) {\n eqns[i + nc * j] = this.elements[i + 3 * j];\n }\n }\n\n eqns[3 + 6 * 0] = 1;\n eqns[3 + 6 * 1] = 0;\n eqns[3 + 6 * 2] = 0;\n eqns[4 + 6 * 0] = 0;\n eqns[4 + 6 * 1] = 1;\n eqns[4 + 6 * 2] = 0;\n eqns[5 + 6 * 0] = 0;\n eqns[5 + 6 * 1] = 0;\n eqns[5 + 6 * 2] = 1; // Compute right upper triangular version of the matrix - Gauss elimination\n\n let n = 3;\n const k = n;\n let np;\n const kp = nc; // num rows\n\n let p;\n\n do {\n i = k - n;\n\n if (eqns[i + nc * i] === 0) {\n // the pivot is null, swap lines\n for (j = i + 1; j < k; j++) {\n if (eqns[i + nc * j] !== 0) {\n np = kp;\n\n do {\n // do line( i ) = line( i ) + line( k )\n p = kp - np;\n eqns[p + nc * i] += eqns[p + nc * j];\n } while (--np);\n\n break;\n }\n }\n }\n\n if (eqns[i + nc * i] !== 0) {\n for (j = i + 1; j < k; j++) {\n const multiplier = eqns[i + nc * j] / eqns[i + nc * i];\n np = kp;\n\n do {\n // do line( k ) = line( k ) - multiplier * line( i )\n p = kp - np;\n eqns[p + nc * j] = p <= i ? 0 : eqns[p + nc * j] - eqns[p + nc * i] * multiplier;\n } while (--np);\n }\n }\n } while (--n); // eliminate the upper left triangle of the matrix\n\n\n i = 2;\n\n do {\n j = i - 1;\n\n do {\n const multiplier = eqns[i + nc * j] / eqns[i + nc * i];\n np = nc;\n\n do {\n p = nc - np;\n eqns[p + nc * j] = eqns[p + nc * j] - eqns[p + nc * i] * multiplier;\n } while (--np);\n } while (j--);\n } while (--i); // operations on the diagonal\n\n\n i = 2;\n\n do {\n const multiplier = 1 / eqns[i + nc * i];\n np = nc;\n\n do {\n p = nc - np;\n eqns[p + nc * i] = eqns[p + nc * i] * multiplier;\n } while (--np);\n } while (i--);\n\n i = 2;\n\n do {\n j = 2;\n\n do {\n p = eqns[nr + j + nc * i];\n\n if (isNaN(p) || p === Infinity) {\n throw \"Could not reverse! A=[\" + this.toString() + \"]\";\n }\n\n target.e(i, j, p);\n } while (j--);\n } while (i--);\n\n return target;\n }\n /**\n * Set the matrix from a quaterion\n */\n\n\n setRotationFromQuaternion(q) {\n const x = q.x;\n const y = q.y;\n const z = q.z;\n const w = q.w;\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const xy = x * y2;\n const xz = x * z2;\n const yy = y * y2;\n const yz = y * z2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n const e = this.elements;\n e[3 * 0 + 0] = 1 - (yy + zz);\n e[3 * 0 + 1] = xy - wz;\n e[3 * 0 + 2] = xz + wy;\n e[3 * 1 + 0] = xy + wz;\n e[3 * 1 + 1] = 1 - (xx + zz);\n e[3 * 1 + 2] = yz - wx;\n e[3 * 2 + 0] = xz - wy;\n e[3 * 2 + 1] = yz + wx;\n e[3 * 2 + 2] = 1 - (xx + yy);\n return this;\n }\n /**\n * Transpose the matrix\n * @param target Optional. Where to store the result.\n * @return The target Mat3, or a new Mat3 if target was omitted.\n */\n\n\n transpose(target = new Mat3()) {\n const M = this.elements;\n const T = target.elements;\n let tmp; //Set diagonals\n\n T[0] = M[0];\n T[4] = M[4];\n T[8] = M[8];\n tmp = M[1];\n T[1] = M[3];\n T[3] = tmp;\n tmp = M[2];\n T[2] = M[6];\n T[6] = tmp;\n tmp = M[5];\n T[5] = M[7];\n T[7] = tmp;\n return target;\n }\n\n}\nconst reverse_eqns = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n\n/**\n * 3-dimensional vector\n * @example\n * const v = new Vec3(1, 2, 3)\n * console.log('x=' + v.x) // x=1\n */\n\nclass Vec3 {\n constructor(x = 0.0, y = 0.0, z = 0.0) {\n this.x = void 0;\n this.y = void 0;\n this.z = void 0;\n this.x = x;\n this.y = y;\n this.z = z;\n }\n /**\n * Vector cross product\n * @param target Optional target to save in.\n */\n\n\n cross(vector, target = new Vec3()) {\n const vx = vector.x;\n const vy = vector.y;\n const vz = vector.z;\n const x = this.x;\n const y = this.y;\n const z = this.z;\n target.x = y * vz - z * vy;\n target.y = z * vx - x * vz;\n target.z = x * vy - y * vx;\n return target;\n }\n /**\n * Set the vectors' 3 elements\n */\n\n\n set(x, y, z) {\n this.x = x;\n this.y = y;\n this.z = z;\n return this;\n }\n /**\n * Set all components of the vector to zero.\n */\n\n\n setZero() {\n this.x = this.y = this.z = 0;\n }\n /**\n * Vector addition\n */\n\n\n vadd(vector, target) {\n if (target) {\n target.x = vector.x + this.x;\n target.y = vector.y + this.y;\n target.z = vector.z + this.z;\n } else {\n return new Vec3(this.x + vector.x, this.y + vector.y, this.z + vector.z);\n }\n }\n /**\n * Vector subtraction\n * @param target Optional target to save in.\n */\n\n\n vsub(vector, target) {\n if (target) {\n target.x = this.x - vector.x;\n target.y = this.y - vector.y;\n target.z = this.z - vector.z;\n } else {\n return new Vec3(this.x - vector.x, this.y - vector.y, this.z - vector.z);\n }\n }\n /**\n * Get the cross product matrix a_cross from a vector, such that a x b = a_cross * b = c\n *\n * See {@link https://www8.cs.umu.se/kurser/TDBD24/VT06/lectures/Lecture6.pdf Umeå University Lecture}\n */\n\n\n crossmat() {\n return new Mat3([0, -this.z, this.y, this.z, 0, -this.x, -this.y, this.x, 0]);\n }\n /**\n * Normalize the vector. Note that this changes the values in the vector.\n * @return Returns the norm of the vector\n */\n\n\n normalize() {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n const n = Math.sqrt(x * x + y * y + z * z);\n\n if (n > 0.0) {\n const invN = 1 / n;\n this.x *= invN;\n this.y *= invN;\n this.z *= invN;\n } else {\n // Make something up\n this.x = 0;\n this.y = 0;\n this.z = 0;\n }\n\n return n;\n }\n /**\n * Get the version of this vector that is of length 1.\n * @param target Optional target to save in\n * @return Returns the unit vector\n */\n\n\n unit(target = new Vec3()) {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n let ninv = Math.sqrt(x * x + y * y + z * z);\n\n if (ninv > 0.0) {\n ninv = 1.0 / ninv;\n target.x = x * ninv;\n target.y = y * ninv;\n target.z = z * ninv;\n } else {\n target.x = 1;\n target.y = 0;\n target.z = 0;\n }\n\n return target;\n }\n /**\n * Get the length of the vector\n */\n\n\n length() {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n return Math.sqrt(x * x + y * y + z * z);\n }\n /**\n * Get the squared length of the vector.\n */\n\n\n lengthSquared() {\n return this.dot(this);\n }\n /**\n * Get distance from this point to another point\n */\n\n\n distanceTo(p) {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n const px = p.x;\n const py = p.y;\n const pz = p.z;\n return Math.sqrt((px - x) * (px - x) + (py - y) * (py - y) + (pz - z) * (pz - z));\n }\n /**\n * Get squared distance from this point to another point\n */\n\n\n distanceSquared(p) {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n const px = p.x;\n const py = p.y;\n const pz = p.z;\n return (px - x) * (px - x) + (py - y) * (py - y) + (pz - z) * (pz - z);\n }\n /**\n * Multiply all the components of the vector with a scalar.\n * @param target The vector to save the result in.\n */\n\n\n scale(scalar, target = new Vec3()) {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n target.x = scalar * x;\n target.y = scalar * y;\n target.z = scalar * z;\n return target;\n }\n /**\n * Multiply the vector with an other vector, component-wise.\n * @param target The vector to save the result in.\n */\n\n\n vmul(vector, target = new Vec3()) {\n target.x = vector.x * this.x;\n target.y = vector.y * this.y;\n target.z = vector.z * this.z;\n return target;\n }\n /**\n * Scale a vector and add it to this vector. Save the result in \"target\". (target = this + vector * scalar)\n * @param target The vector to save the result in.\n */\n\n\n addScaledVector(scalar, vector, target = new Vec3()) {\n target.x = this.x + scalar * vector.x;\n target.y = this.y + scalar * vector.y;\n target.z = this.z + scalar * vector.z;\n return target;\n }\n /**\n * Calculate dot product\n * @param vector\n */\n\n\n dot(vector) {\n return this.x * vector.x + this.y * vector.y + this.z * vector.z;\n }\n\n isZero() {\n return this.x === 0 && this.y === 0 && this.z === 0;\n }\n /**\n * Make the vector point in the opposite direction.\n * @param target Optional target to save in\n */\n\n\n negate(target = new Vec3()) {\n target.x = -this.x;\n target.y = -this.y;\n target.z = -this.z;\n return target;\n }\n /**\n * Compute two artificial tangents to the vector\n * @param t1 Vector object to save the first tangent in\n * @param t2 Vector object to save the second tangent in\n */\n\n\n tangents(t1, t2) {\n const norm = this.length();\n\n if (norm > 0.0) {\n const n = Vec3_tangents_n;\n const inorm = 1 / norm;\n n.set(this.x * inorm, this.y * inorm, this.z * inorm);\n const randVec = Vec3_tangents_randVec;\n\n if (Math.abs(n.x) < 0.9) {\n randVec.set(1, 0, 0);\n n.cross(randVec, t1);\n } else {\n randVec.set(0, 1, 0);\n n.cross(randVec, t1);\n }\n\n n.cross(t1, t2);\n } else {\n // The normal length is zero, make something up\n t1.set(1, 0, 0);\n t2.set(0, 1, 0);\n }\n }\n /**\n * Converts to a more readable format\n */\n\n\n toString() {\n return this.x + \",\" + this.y + \",\" + this.z;\n }\n /**\n * Converts to an array\n */\n\n\n toArray() {\n return [this.x, this.y, this.z];\n }\n /**\n * Copies value of source to this vector.\n */\n\n\n copy(vector) {\n this.x = vector.x;\n this.y = vector.y;\n this.z = vector.z;\n return this;\n }\n /**\n * Do a linear interpolation between two vectors\n * @param t A number between 0 and 1. 0 will make this function return u, and 1 will make it return v. Numbers in between will generate a vector in between them.\n */\n\n\n lerp(vector, t, target) {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n target.x = x + (vector.x - x) * t;\n target.y = y + (vector.y - y) * t;\n target.z = z + (vector.z - z) * t;\n }\n /**\n * Check if a vector equals is almost equal to another one.\n */\n\n\n almostEquals(vector, precision = 1e-6) {\n if (Math.abs(this.x - vector.x) > precision || Math.abs(this.y - vector.y) > precision || Math.abs(this.z - vector.z) > precision) {\n return false;\n }\n\n return true;\n }\n /**\n * Check if a vector is almost zero\n */\n\n\n almostZero(precision = 1e-6) {\n if (Math.abs(this.x) > precision || Math.abs(this.y) > precision || Math.abs(this.z) > precision) {\n return false;\n }\n\n return true;\n }\n /**\n * Check if the vector is anti-parallel to another vector.\n * @param precision Set to zero for exact comparisons\n */\n\n\n isAntiparallelTo(vector, precision) {\n this.negate(antip_neg);\n return antip_neg.almostEquals(vector, precision);\n }\n /**\n * Clone the vector\n */\n\n\n clone() {\n return new Vec3(this.x, this.y, this.z);\n }\n\n}\nVec3.ZERO = void 0;\nVec3.UNIT_X = void 0;\nVec3.UNIT_Y = void 0;\nVec3.UNIT_Z = void 0;\nVec3.ZERO = new Vec3(0, 0, 0);\nVec3.UNIT_X = new Vec3(1, 0, 0);\nVec3.UNIT_Y = new Vec3(0, 1, 0);\nVec3.UNIT_Z = new Vec3(0, 0, 1);\nconst Vec3_tangents_n = new Vec3();\nconst Vec3_tangents_randVec = new Vec3();\nconst antip_neg = new Vec3();\n\n/**\n * Axis aligned bounding box class.\n */\nclass AABB {\n /**\n * The lower bound of the bounding box\n */\n\n /**\n * The upper bound of the bounding box\n */\n constructor(options = {}) {\n this.lowerBound = void 0;\n this.upperBound = void 0;\n this.lowerBound = new Vec3();\n this.upperBound = new Vec3();\n\n if (options.lowerBound) {\n this.lowerBound.copy(options.lowerBound);\n }\n\n if (options.upperBound) {\n this.upperBound.copy(options.upperBound);\n }\n }\n /**\n * Set the AABB bounds from a set of points.\n * @param points An array of Vec3's.\n * @return The self object\n */\n\n\n setFromPoints(points, position, quaternion, skinSize) {\n const l = this.lowerBound;\n const u = this.upperBound;\n const q = quaternion; // Set to the first point\n\n l.copy(points[0]);\n\n if (q) {\n q.vmult(l, l);\n }\n\n u.copy(l);\n\n for (let i = 1; i < points.length; i++) {\n let p = points[i];\n\n if (q) {\n q.vmult(p, tmp$1);\n p = tmp$1;\n }\n\n if (p.x > u.x) {\n u.x = p.x;\n }\n\n if (p.x < l.x) {\n l.x = p.x;\n }\n\n if (p.y > u.y) {\n u.y = p.y;\n }\n\n if (p.y < l.y) {\n l.y = p.y;\n }\n\n if (p.z > u.z) {\n u.z = p.z;\n }\n\n if (p.z < l.z) {\n l.z = p.z;\n }\n } // Add offset\n\n\n if (position) {\n position.vadd(l, l);\n position.vadd(u, u);\n }\n\n if (skinSize) {\n l.x -= skinSize;\n l.y -= skinSize;\n l.z -= skinSize;\n u.x += skinSize;\n u.y += skinSize;\n u.z += skinSize;\n }\n\n return this;\n }\n /**\n * Copy bounds from an AABB to this AABB\n * @param aabb Source to copy from\n * @return The this object, for chainability\n */\n\n\n copy(aabb) {\n this.lowerBound.copy(aabb.lowerBound);\n this.upperBound.copy(aabb.upperBound);\n return this;\n }\n /**\n * Clone an AABB\n */\n\n\n clone() {\n return new AABB().copy(this);\n }\n /**\n * Extend this AABB so that it covers the given AABB too.\n */\n\n\n extend(aabb) {\n this.lowerBound.x = Math.min(this.lowerBound.x, aabb.lowerBound.x);\n this.upperBound.x = Math.max(this.upperBound.x, aabb.upperBound.x);\n this.lowerBound.y = Math.min(this.lowerBound.y, aabb.lowerBound.y);\n this.upperBound.y = Math.max(this.upperBound.y, aabb.upperBound.y);\n this.lowerBound.z = Math.min(this.lowerBound.z, aabb.lowerBound.z);\n this.upperBound.z = Math.max(this.upperBound.z, aabb.upperBound.z);\n }\n /**\n * Returns true if the given AABB overlaps this AABB.\n */\n\n\n overlaps(aabb) {\n const l1 = this.lowerBound;\n const u1 = this.upperBound;\n const l2 = aabb.lowerBound;\n const u2 = aabb.upperBound; // l2 u2\n // |---------|\n // |--------|\n // l1 u1\n\n const overlapsX = l2.x <= u1.x && u1.x <= u2.x || l1.x <= u2.x && u2.x <= u1.x;\n const overlapsY = l2.y <= u1.y && u1.y <= u2.y || l1.y <= u2.y && u2.y <= u1.y;\n const overlapsZ = l2.z <= u1.z && u1.z <= u2.z || l1.z <= u2.z && u2.z <= u1.z;\n return overlapsX && overlapsY && overlapsZ;\n } // Mostly for debugging\n\n\n volume() {\n const l = this.lowerBound;\n const u = this.upperBound;\n return (u.x - l.x) * (u.y - l.y) * (u.z - l.z);\n }\n /**\n * Returns true if the given AABB is fully contained in this AABB.\n */\n\n\n contains(aabb) {\n const l1 = this.lowerBound;\n const u1 = this.upperBound;\n const l2 = aabb.lowerBound;\n const u2 = aabb.upperBound; // l2 u2\n // |---------|\n // |---------------|\n // l1 u1\n\n return l1.x <= l2.x && u1.x >= u2.x && l1.y <= l2.y && u1.y >= u2.y && l1.z <= l2.z && u1.z >= u2.z;\n }\n\n getCorners(a, b, c, d, e, f, g, h) {\n const l = this.lowerBound;\n const u = this.upperBound;\n a.copy(l);\n b.set(u.x, l.y, l.z);\n c.set(u.x, u.y, l.z);\n d.set(l.x, u.y, u.z);\n e.set(u.x, l.y, u.z);\n f.set(l.x, u.y, l.z);\n g.set(l.x, l.y, u.z);\n h.copy(u);\n }\n /**\n * Get the representation of an AABB in another frame.\n * @return The \"target\" AABB object.\n */\n\n\n toLocalFrame(frame, target) {\n const corners = transformIntoFrame_corners;\n const a = corners[0];\n const b = corners[1];\n const c = corners[2];\n const d = corners[3];\n const e = corners[4];\n const f = corners[5];\n const g = corners[6];\n const h = corners[7]; // Get corners in current frame\n\n this.getCorners(a, b, c, d, e, f, g, h); // Transform them to new local frame\n\n for (let i = 0; i !== 8; i++) {\n const corner = corners[i];\n frame.pointToLocal(corner, corner);\n }\n\n return target.setFromPoints(corners);\n }\n /**\n * Get the representation of an AABB in the global frame.\n * @return The \"target\" AABB object.\n */\n\n\n toWorldFrame(frame, target) {\n const corners = transformIntoFrame_corners;\n const a = corners[0];\n const b = corners[1];\n const c = corners[2];\n const d = corners[3];\n const e = corners[4];\n const f = corners[5];\n const g = corners[6];\n const h = corners[7]; // Get corners in current frame\n\n this.getCorners(a, b, c, d, e, f, g, h); // Transform them to new local frame\n\n for (let i = 0; i !== 8; i++) {\n const corner = corners[i];\n frame.pointToWorld(corner, corner);\n }\n\n return target.setFromPoints(corners);\n }\n /**\n * Check if the AABB is hit by a ray.\n */\n\n\n overlapsRay(ray) {\n const {\n direction,\n from\n } = ray; // const t = 0\n // ray.direction is unit direction vector of ray\n\n const dirFracX = 1 / direction.x;\n const dirFracY = 1 / direction.y;\n const dirFracZ = 1 / direction.z; // this.lowerBound is the corner of AABB with minimal coordinates - left bottom, rt is maximal corner\n\n const t1 = (this.lowerBound.x - from.x) * dirFracX;\n const t2 = (this.upperBound.x - from.x) * dirFracX;\n const t3 = (this.lowerBound.y - from.y) * dirFracY;\n const t4 = (this.upperBound.y - from.y) * dirFracY;\n const t5 = (this.lowerBound.z - from.z) * dirFracZ;\n const t6 = (this.upperBound.z - from.z) * dirFracZ; // const tmin = Math.max(Math.max(Math.min(t1, t2), Math.min(t3, t4)));\n // const tmax = Math.min(Math.min(Math.max(t1, t2), Math.max(t3, t4)));\n\n const tmin = Math.max(Math.max(Math.min(t1, t2), Math.min(t3, t4)), Math.min(t5, t6));\n const tmax = Math.min(Math.min(Math.max(t1, t2), Math.max(t3, t4)), Math.max(t5, t6)); // if tmax < 0, ray (line) is intersecting AABB, but whole AABB is behing us\n\n if (tmax < 0) {\n //t = tmax;\n return false;\n } // if tmin > tmax, ray doesn't intersect AABB\n\n\n if (tmin > tmax) {\n //t = tmax;\n return false;\n }\n\n return true;\n }\n\n}\nconst tmp$1 = new Vec3();\nconst transformIntoFrame_corners = [new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3()];\n\n/**\n * Collision \"matrix\".\n * It's actually a triangular-shaped array of whether two bodies are touching this step, for reference next step\n */\nclass ArrayCollisionMatrix {\n /**\n * The matrix storage.\n */\n constructor() {\n this.matrix = void 0;\n this.matrix = [];\n }\n /**\n * Get an element\n */\n\n\n get(bi, bj) {\n let {\n index: i\n } = bi;\n let {\n index: j\n } = bj;\n\n if (j > i) {\n const temp = j;\n j = i;\n i = temp;\n }\n\n return this.matrix[(i * (i + 1) >> 1) + j - 1];\n }\n /**\n * Set an element\n */\n\n\n set(bi, bj, value) {\n let {\n index: i\n } = bi;\n let {\n index: j\n } = bj;\n\n if (j > i) {\n const temp = j;\n j = i;\n i = temp;\n }\n\n this.matrix[(i * (i + 1) >> 1) + j - 1] = value ? 1 : 0;\n }\n /**\n * Sets all elements to zero\n */\n\n\n reset() {\n for (let i = 0, l = this.matrix.length; i !== l; i++) {\n this.matrix[i] = 0;\n }\n }\n /**\n * Sets the max number of objects\n */\n\n\n setNumObjects(n) {\n this.matrix.length = n * (n - 1) >> 1;\n }\n\n}\n\n/**\n * Base class for objects that dispatches events.\n */\nclass EventTarget {\n constructor() {\n this._listeners = void 0;\n }\n\n /**\n * Add an event listener\n * @return The self object, for chainability.\n */\n addEventListener(type, listener) {\n if (this._listeners === undefined) {\n this._listeners = {};\n }\n\n const listeners = this._listeners;\n\n if (listeners[type] === undefined) {\n listeners[type] = [];\n }\n\n if (!listeners[type].includes(listener)) {\n listeners[type].push(listener);\n }\n\n return this;\n }\n /**\n * Check if an event listener is added\n */\n\n\n hasEventListener(type, listener) {\n if (this._listeners === undefined) {\n return false;\n }\n\n const listeners = this._listeners;\n\n if (listeners[type] !== undefined && listeners[type].includes(listener)) {\n return true;\n }\n\n return false;\n }\n /**\n * Check if any event listener of the given type is added\n */\n\n\n hasAnyEventListener(type) {\n if (this._listeners === undefined) {\n return false;\n }\n\n const listeners = this._listeners;\n return listeners[type] !== undefined;\n }\n /**\n * Remove an event listener\n * @return The self object, for chainability.\n */\n\n\n removeEventListener(type, listener) {\n if (this._listeners === undefined) {\n return this;\n }\n\n const listeners = this._listeners;\n\n if (listeners[type] === undefined) {\n return this;\n }\n\n const index = listeners[type].indexOf(listener);\n\n if (index !== -1) {\n listeners[type].splice(index, 1);\n }\n\n return this;\n }\n /**\n * Emit an event.\n * @return The self object, for chainability.\n */\n\n\n dispatchEvent(event) {\n if (this._listeners === undefined) {\n return this;\n }\n\n const listeners = this._listeners;\n const listenerArray = listeners[event.type];\n\n if (listenerArray !== undefined) {\n event.target = this;\n\n for (let i = 0, l = listenerArray.length; i < l; i++) {\n listenerArray[i].call(this, event);\n }\n }\n\n return this;\n }\n\n}\n\n/**\n * A Quaternion describes a rotation in 3D space. The Quaternion is mathematically defined as Q = x*i + y*j + z*k + w, where (i,j,k) are imaginary basis vectors. (x,y,z) can be seen as a vector related to the axis of rotation, while the real multiplier, w, is related to the amount of rotation.\n * @param x Multiplier of the imaginary basis vector i.\n * @param y Multiplier of the imaginary basis vector j.\n * @param z Multiplier of the imaginary basis vector k.\n * @param w Multiplier of the real part.\n * @see http://en.wikipedia.org/wiki/Quaternion\n */\n\nclass Quaternion {\n constructor(x = 0, y = 0, z = 0, w = 1) {\n this.x = void 0;\n this.y = void 0;\n this.z = void 0;\n this.w = void 0;\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n }\n /**\n * Set the value of the quaternion.\n */\n\n\n set(x, y, z, w) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n return this;\n }\n /**\n * Convert to a readable format\n * @return \"x,y,z,w\"\n */\n\n\n toString() {\n return this.x + \",\" + this.y + \",\" + this.z + \",\" + this.w;\n }\n /**\n * Convert to an Array\n * @return [x, y, z, w]\n */\n\n\n toArray() {\n return [this.x, this.y, this.z, this.w];\n }\n /**\n * Set the quaternion components given an axis and an angle in radians.\n */\n\n\n setFromAxisAngle(vector, angle) {\n const s = Math.sin(angle * 0.5);\n this.x = vector.x * s;\n this.y = vector.y * s;\n this.z = vector.z * s;\n this.w = Math.cos(angle * 0.5);\n return this;\n }\n /**\n * Converts the quaternion to [ axis, angle ] representation.\n * @param targetAxis A vector object to reuse for storing the axis.\n * @return An array, first element is the axis and the second is the angle in radians.\n */\n\n\n toAxisAngle(targetAxis = new Vec3()) {\n this.normalize(); // if w>1 acos and sqrt will produce errors, this cant happen if quaternion is normalised\n\n const angle = 2 * Math.acos(this.w);\n const s = Math.sqrt(1 - this.w * this.w); // assuming quaternion normalised then w is less than 1, so term always positive.\n\n if (s < 0.001) {\n // test to avoid divide by zero, s is always positive due to sqrt\n // if s close to zero then direction of axis not important\n targetAxis.x = this.x; // if it is important that axis is normalised then replace with x=1; y=z=0;\n\n targetAxis.y = this.y;\n targetAxis.z = this.z;\n } else {\n targetAxis.x = this.x / s; // normalise axis\n\n targetAxis.y = this.y / s;\n targetAxis.z = this.z / s;\n }\n\n return [targetAxis, angle];\n }\n /**\n * Set the quaternion value given two vectors. The resulting rotation will be the needed rotation to rotate u to v.\n */\n\n\n setFromVectors(u, v) {\n if (u.isAntiparallelTo(v)) {\n const t1 = sfv_t1;\n const t2 = sfv_t2;\n u.tangents(t1, t2);\n this.setFromAxisAngle(t1, Math.PI);\n } else {\n const a = u.cross(v);\n this.x = a.x;\n this.y = a.y;\n this.z = a.z;\n this.w = Math.sqrt(u.length() ** 2 * v.length() ** 2) + u.dot(v);\n this.normalize();\n }\n\n return this;\n }\n /**\n * Multiply the quaternion with an other quaternion.\n */\n\n\n mult(quat, target = new Quaternion()) {\n const ax = this.x;\n const ay = this.y;\n const az = this.z;\n const aw = this.w;\n const bx = quat.x;\n const by = quat.y;\n const bz = quat.z;\n const bw = quat.w;\n target.x = ax * bw + aw * bx + ay * bz - az * by;\n target.y = ay * bw + aw * by + az * bx - ax * bz;\n target.z = az * bw + aw * bz + ax * by - ay * bx;\n target.w = aw * bw - ax * bx - ay * by - az * bz;\n return target;\n }\n /**\n * Get the inverse quaternion rotation.\n */\n\n\n inverse(target = new Quaternion()) {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n const w = this.w;\n this.conjugate(target);\n const inorm2 = 1 / (x * x + y * y + z * z + w * w);\n target.x *= inorm2;\n target.y *= inorm2;\n target.z *= inorm2;\n target.w *= inorm2;\n return target;\n }\n /**\n * Get the quaternion conjugate\n */\n\n\n conjugate(target = new Quaternion()) {\n target.x = -this.x;\n target.y = -this.y;\n target.z = -this.z;\n target.w = this.w;\n return target;\n }\n /**\n * Normalize the quaternion. Note that this changes the values of the quaternion.\n */\n\n\n normalize() {\n let l = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);\n\n if (l === 0) {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n this.w = 0;\n } else {\n l = 1 / l;\n this.x *= l;\n this.y *= l;\n this.z *= l;\n this.w *= l;\n }\n\n return this;\n }\n /**\n * Approximation of quaternion normalization. Works best when quat is already almost-normalized.\n * @author unphased, https://github.com/unphased\n */\n\n\n normalizeFast() {\n const f = (3.0 - (this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w)) / 2.0;\n\n if (f === 0) {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n this.w = 0;\n } else {\n this.x *= f;\n this.y *= f;\n this.z *= f;\n this.w *= f;\n }\n\n return this;\n }\n /**\n * Multiply the quaternion by a vector\n */\n\n\n vmult(v, target = new Vec3()) {\n const x = v.x;\n const y = v.y;\n const z = v.z;\n const qx = this.x;\n const qy = this.y;\n const qz = this.z;\n const qw = this.w; // q*v\n\n const ix = qw * x + qy * z - qz * y;\n const iy = qw * y + qz * x - qx * z;\n const iz = qw * z + qx * y - qy * x;\n const iw = -qx * x - qy * y - qz * z;\n target.x = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n target.y = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n target.z = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n return target;\n }\n /**\n * Copies value of source to this quaternion.\n * @return this\n */\n\n\n copy(quat) {\n this.x = quat.x;\n this.y = quat.y;\n this.z = quat.z;\n this.w = quat.w;\n return this;\n }\n /**\n * Convert the quaternion to euler angle representation. Order: YZX, as this page describes: https://www.euclideanspace.com/maths/standards/index.htm\n * @param order Three-character string, defaults to \"YZX\"\n */\n\n\n toEuler(target, order = 'YZX') {\n let heading;\n let attitude;\n let bank;\n const x = this.x;\n const y = this.y;\n const z = this.z;\n const w = this.w;\n\n switch (order) {\n case 'YZX':\n const test = x * y + z * w;\n\n if (test > 0.499) {\n // singularity at north pole\n heading = 2 * Math.atan2(x, w);\n attitude = Math.PI / 2;\n bank = 0;\n }\n\n if (test < -0.499) {\n // singularity at south pole\n heading = -2 * Math.atan2(x, w);\n attitude = -Math.PI / 2;\n bank = 0;\n }\n\n if (heading === undefined) {\n const sqx = x * x;\n const sqy = y * y;\n const sqz = z * z;\n heading = Math.atan2(2 * y * w - 2 * x * z, 1 - 2 * sqy - 2 * sqz); // Heading\n\n attitude = Math.asin(2 * test); // attitude\n\n bank = Math.atan2(2 * x * w - 2 * y * z, 1 - 2 * sqx - 2 * sqz); // bank\n }\n\n break;\n\n default:\n throw new Error(\"Euler order \" + order + \" not supported yet.\");\n }\n\n target.y = heading;\n target.z = attitude;\n target.x = bank;\n }\n /**\n * @param order The order to apply angles: 'XYZ' or 'YXZ' or any other combination.\n *\n * See {@link https://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors MathWorks} reference\n */\n\n\n setFromEuler(x, y, z, order = 'XYZ') {\n const c1 = Math.cos(x / 2);\n const c2 = Math.cos(y / 2);\n const c3 = Math.cos(z / 2);\n const s1 = Math.sin(x / 2);\n const s2 = Math.sin(y / 2);\n const s3 = Math.sin(z / 2);\n\n if (order === 'XYZ') {\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 + s1 * s2 * c3;\n this.w = c1 * c2 * c3 - s1 * s2 * s3;\n } else if (order === 'YXZ') {\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 - s1 * s2 * c3;\n this.w = c1 * c2 * c3 + s1 * s2 * s3;\n } else if (order === 'ZXY') {\n this.x = s1 * c2 * c3 - c1 * s2 * s3;\n this.y = c1 * s2 * c3 + s1 * c2 * s3;\n this.z = c1 * c2 * s3 + s1 * s2 * c3;\n this.w = c1 * c2 * c3 - s1 * s2 * s3;\n } else if (order === 'ZYX') {\n this.x = s1 * c2 * c3 - c1 * s2 * s3;\n this.y = c1 * s2 * c3 + s1 * c2 * s3;\n this.z = c1 * c2 * s3 - s1 * s2 * c3;\n this.w = c1 * c2 * c3 + s1 * s2 * s3;\n } else if (order === 'YZX') {\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 + s1 * c2 * s3;\n this.z = c1 * c2 * s3 - s1 * s2 * c3;\n this.w = c1 * c2 * c3 - s1 * s2 * s3;\n } else if (order === 'XZY') {\n this.x = s1 * c2 * c3 - c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 + s1 * s2 * c3;\n this.w = c1 * c2 * c3 + s1 * s2 * s3;\n }\n\n return this;\n }\n\n clone() {\n return new Quaternion(this.x, this.y, this.z, this.w);\n }\n /**\n * Performs a spherical linear interpolation between two quat\n *\n * @param toQuat second operand\n * @param t interpolation amount between the self quaternion and toQuat\n * @param target A quaternion to store the result in. If not provided, a new one will be created.\n * @returns {Quaternion} The \"target\" object\n */\n\n\n slerp(toQuat, t, target = new Quaternion()) {\n const ax = this.x;\n const ay = this.y;\n const az = this.z;\n const aw = this.w;\n let bx = toQuat.x;\n let by = toQuat.y;\n let bz = toQuat.z;\n let bw = toQuat.w;\n let omega;\n let cosom;\n let sinom;\n let scale0;\n let scale1; // calc cosine\n\n cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary)\n\n if (cosom < 0.0) {\n cosom = -cosom;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n } // calculate coefficients\n\n\n if (1.0 - cosom > 0.000001) {\n // standard case (slerp)\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else {\n // \"from\" and \"to\" quaternions are very close\n // ... so we can do a linear interpolation\n scale0 = 1.0 - t;\n scale1 = t;\n } // calculate final values\n\n\n target.x = scale0 * ax + scale1 * bx;\n target.y = scale0 * ay + scale1 * by;\n target.z = scale0 * az + scale1 * bz;\n target.w = scale0 * aw + scale1 * bw;\n return target;\n }\n /**\n * Rotate an absolute orientation quaternion given an angular velocity and a time step.\n */\n\n\n integrate(angularVelocity, dt, angularFactor, target = new Quaternion()) {\n const ax = angularVelocity.x * angularFactor.x,\n ay = angularVelocity.y * angularFactor.y,\n az = angularVelocity.z * angularFactor.z,\n bx = this.x,\n by = this.y,\n bz = this.z,\n bw = this.w;\n const half_dt = dt * 0.5;\n target.x += half_dt * (ax * bw + ay * bz - az * by);\n target.y += half_dt * (ay * bw + az * bx - ax * bz);\n target.z += half_dt * (az * bw + ax * by - ay * bx);\n target.w += half_dt * (-ax * bx - ay * by - az * bz);\n return target;\n }\n\n}\nconst sfv_t1 = new Vec3();\nconst sfv_t2 = new Vec3();\n\n/**\n * The available shape types.\n */\nconst SHAPE_TYPES = {\n /** SPHERE */\n SPHERE: 1,\n\n /** PLANE */\n PLANE: 2,\n\n /** BOX */\n BOX: 4,\n\n /** COMPOUND */\n COMPOUND: 8,\n\n /** CONVEXPOLYHEDRON */\n CONVEXPOLYHEDRON: 16,\n\n /** HEIGHTFIELD */\n HEIGHTFIELD: 32,\n\n /** PARTICLE */\n PARTICLE: 64,\n\n /** CYLINDER */\n CYLINDER: 128,\n\n /** TRIMESH */\n TRIMESH: 256\n};\n/**\n * ShapeType\n */\n\n/**\n * Base class for shapes\n */\nclass Shape {\n /**\n * Identifier of the Shape.\n */\n\n /**\n * The type of this shape. Must be set to an int > 0 by subclasses.\n */\n\n /**\n * The local bounding sphere radius of this shape.\n */\n\n /**\n * Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled.\n * @default true\n */\n\n /**\n * @default 1\n */\n\n /**\n * @default -1\n */\n\n /**\n * Optional material of the shape that regulates contact properties.\n */\n\n /**\n * The body to which the shape is added to.\n */\n\n /**\n * All the Shape types.\n */\n constructor(options = {}) {\n this.id = void 0;\n this.type = void 0;\n this.boundingSphereRadius = void 0;\n this.collisionResponse = void 0;\n this.collisionFilterGroup = void 0;\n this.collisionFilterMask = void 0;\n this.material = void 0;\n this.body = void 0;\n this.id = Shape.idCounter++;\n this.type = options.type || 0;\n this.boundingSphereRadius = 0;\n this.collisionResponse = options.collisionResponse ? options.collisionResponse : true;\n this.collisionFilterGroup = options.collisionFilterGroup !== undefined ? options.collisionFilterGroup : 1;\n this.collisionFilterMask = options.collisionFilterMask !== undefined ? options.collisionFilterMask : -1;\n this.material = options.material ? options.material : null;\n this.body = null;\n }\n /**\n * Computes the bounding sphere radius.\n * The result is stored in the property `.boundingSphereRadius`\n */\n\n\n updateBoundingSphereRadius() {\n throw \"computeBoundingSphereRadius() not implemented for shape type \" + this.type;\n }\n /**\n * Get the volume of this shape\n */\n\n\n volume() {\n throw \"volume() not implemented for shape type \" + this.type;\n }\n /**\n * Calculates the inertia in the local frame for this shape.\n * @see http://en.wikipedia.org/wiki/List_of_moments_of_inertia\n */\n\n\n calculateLocalInertia(mass, target) {\n throw \"calculateLocalInertia() not implemented for shape type \" + this.type;\n }\n /**\n * @todo use abstract for these kind of methods\n */\n\n\n calculateWorldAABB(pos, quat, min, max) {\n throw \"calculateWorldAABB() not implemented for shape type \" + this.type;\n }\n\n}\nShape.idCounter = 0;\nShape.types = SHAPE_TYPES;\n\n/**\n * Transformation utilities.\n */\nclass Transform {\n /**\n * position\n */\n\n /**\n * quaternion\n */\n constructor(options = {}) {\n this.position = void 0;\n this.quaternion = void 0;\n this.position = new Vec3();\n this.quaternion = new Quaternion();\n\n if (options.position) {\n this.position.copy(options.position);\n }\n\n if (options.quaternion) {\n this.quaternion.copy(options.quaternion);\n }\n }\n /**\n * Get a global point in local transform coordinates.\n */\n\n\n pointToLocal(worldPoint, result) {\n return Transform.pointToLocalFrame(this.position, this.quaternion, worldPoint, result);\n }\n /**\n * Get a local point in global transform coordinates.\n */\n\n\n pointToWorld(localPoint, result) {\n return Transform.pointToWorldFrame(this.position, this.quaternion, localPoint, result);\n }\n /**\n * vectorToWorldFrame\n */\n\n\n vectorToWorldFrame(localVector, result = new Vec3()) {\n this.quaternion.vmult(localVector, result);\n return result;\n }\n /**\n * pointToLocalFrame\n */\n\n\n static pointToLocalFrame(position, quaternion, worldPoint, result = new Vec3()) {\n worldPoint.vsub(position, result);\n quaternion.conjugate(tmpQuat$1);\n tmpQuat$1.vmult(result, result);\n return result;\n }\n /**\n * pointToWorldFrame\n */\n\n\n static pointToWorldFrame(position, quaternion, localPoint, result = new Vec3()) {\n quaternion.vmult(localPoint, result);\n result.vadd(position, result);\n return result;\n }\n /**\n * vectorToWorldFrame\n */\n\n\n static vectorToWorldFrame(quaternion, localVector, result = new Vec3()) {\n quaternion.vmult(localVector, result);\n return result;\n }\n /**\n * vectorToLocalFrame\n */\n\n\n static vectorToLocalFrame(position, quaternion, worldVector, result = new Vec3()) {\n quaternion.w *= -1;\n quaternion.vmult(worldVector, result);\n quaternion.w *= -1;\n return result;\n }\n\n}\nconst tmpQuat$1 = new Quaternion();\n\n/**\n * A set of polygons describing a convex shape.\n *\n * The shape MUST be convex for the code to work properly. No polygons may be coplanar (contained\n * in the same 3D plane), instead these should be merged into one polygon.\n *\n * @author qiao / https://github.com/qiao (original author, see https://github.com/qiao/three.js/commit/85026f0c769e4000148a67d45a9e9b9c5108836f)\n * @author schteppe / https://github.com/schteppe\n * @see https://www.altdevblogaday.com/2011/05/13/contact-generation-between-3d-convex-meshes/\n *\n * @todo Move the clipping functions to ContactGenerator?\n * @todo Automatically merge coplanar polygons in constructor.\n * @example\n * const convexShape = new CANNON.ConvexPolyhedron({ vertices, faces })\n * const convexBody = new CANNON.Body({ mass: 1, shape: convexShape })\n * world.addBody(convexBody)\n */\nclass ConvexPolyhedron extends Shape {\n /** vertices */\n\n /**\n * Array of integer arrays, indicating which vertices each face consists of\n */\n\n /** faceNormals */\n\n /** worldVertices */\n\n /** worldVerticesNeedsUpdate */\n\n /** worldFaceNormals */\n\n /** worldFaceNormalsNeedsUpdate */\n\n /**\n * If given, these locally defined, normalized axes are the only ones being checked when doing separating axis check.\n */\n\n /** uniqueEdges */\n\n /**\n * @param vertices An array of Vec3's\n * @param faces Array of integer arrays, describing which vertices that is included in each face.\n */\n constructor(props = {}) {\n const {\n vertices = [],\n faces = [],\n normals = [],\n axes,\n boundingSphereRadius\n } = props;\n super({\n type: Shape.types.CONVEXPOLYHEDRON\n });\n this.vertices = void 0;\n this.faces = void 0;\n this.faceNormals = void 0;\n this.worldVertices = void 0;\n this.worldVerticesNeedsUpdate = void 0;\n this.worldFaceNormals = void 0;\n this.worldFaceNormalsNeedsUpdate = void 0;\n this.uniqueAxes = void 0;\n this.uniqueEdges = void 0;\n this.vertices = vertices;\n this.faces = faces;\n this.faceNormals = normals;\n\n if (this.faceNormals.length === 0) {\n this.computeNormals();\n }\n\n if (!boundingSphereRadius) {\n this.updateBoundingSphereRadius();\n } else {\n this.boundingSphereRadius = boundingSphereRadius;\n }\n\n this.worldVertices = []; // World transformed version of .vertices\n\n this.worldVerticesNeedsUpdate = true;\n this.worldFaceNormals = []; // World transformed version of .faceNormals\n\n this.worldFaceNormalsNeedsUpdate = true;\n this.uniqueAxes = axes ? axes.slice() : null;\n this.uniqueEdges = [];\n this.computeEdges();\n }\n /**\n * Computes uniqueEdges\n */\n\n\n computeEdges() {\n const faces = this.faces;\n const vertices = this.vertices;\n const edges = this.uniqueEdges;\n edges.length = 0;\n const edge = new Vec3();\n\n for (let i = 0; i !== faces.length; i++) {\n const face = faces[i];\n const numVertices = face.length;\n\n for (let j = 0; j !== numVertices; j++) {\n const k = (j + 1) % numVertices;\n vertices[face[j]].vsub(vertices[face[k]], edge);\n edge.normalize();\n let found = false;\n\n for (let p = 0; p !== edges.length; p++) {\n if (edges[p].almostEquals(edge) || edges[p].almostEquals(edge)) {\n found = true;\n break;\n }\n }\n\n if (!found) {\n edges.push(edge.clone());\n }\n }\n }\n }\n /**\n * Compute the normals of the faces.\n * Will reuse existing Vec3 objects in the `faceNormals` array if they exist.\n */\n\n\n computeNormals() {\n this.faceNormals.length = this.faces.length; // Generate normals\n\n for (let i = 0; i < this.faces.length; i++) {\n // Check so all vertices exists for this face\n for (let j = 0; j < this.faces[i].length; j++) {\n if (!this.vertices[this.faces[i][j]]) {\n throw new Error(\"Vertex \" + this.faces[i][j] + \" not found!\");\n }\n }\n\n const n = this.faceNormals[i] || new Vec3();\n this.getFaceNormal(i, n);\n n.negate(n);\n this.faceNormals[i] = n;\n const vertex = this.vertices[this.faces[i][0]];\n\n if (n.dot(vertex) < 0) {\n console.error(\".faceNormals[\" + i + \"] = Vec3(\" + n.toString() + \") looks like it points into the shape? The vertices follow. Make sure they are ordered CCW around the normal, using the right hand rule.\");\n\n for (let j = 0; j < this.faces[i].length; j++) {\n console.warn(\".vertices[\" + this.faces[i][j] + \"] = Vec3(\" + this.vertices[this.faces[i][j]].toString() + \")\");\n }\n }\n }\n }\n /**\n * Compute the normal of a face from its vertices\n */\n\n\n getFaceNormal(i, target) {\n const f = this.faces[i];\n const va = this.vertices[f[0]];\n const vb = this.vertices[f[1]];\n const vc = this.vertices[f[2]];\n ConvexPolyhedron.computeNormal(va, vb, vc, target);\n }\n /**\n * Get face normal given 3 vertices\n */\n\n\n static computeNormal(va, vb, vc, target) {\n const cb = new Vec3();\n const ab = new Vec3();\n vb.vsub(va, ab);\n vc.vsub(vb, cb);\n cb.cross(ab, target);\n\n if (!target.isZero()) {\n target.normalize();\n }\n }\n /**\n * @param minDist Clamp distance\n * @param result The an array of contact point objects, see clipFaceAgainstHull\n */\n\n\n clipAgainstHull(posA, quatA, hullB, posB, quatB, separatingNormal, minDist, maxDist, result) {\n const WorldNormal = new Vec3();\n let closestFaceB = -1;\n let dmax = -Number.MAX_VALUE;\n\n for (let face = 0; face < hullB.faces.length; face++) {\n WorldNormal.copy(hullB.faceNormals[face]);\n quatB.vmult(WorldNormal, WorldNormal);\n const d = WorldNormal.dot(separatingNormal);\n\n if (d > dmax) {\n dmax = d;\n closestFaceB = face;\n }\n }\n\n const worldVertsB1 = [];\n\n for (let i = 0; i < hullB.faces[closestFaceB].length; i++) {\n const b = hullB.vertices[hullB.faces[closestFaceB][i]];\n const worldb = new Vec3();\n worldb.copy(b);\n quatB.vmult(worldb, worldb);\n posB.vadd(worldb, worldb);\n worldVertsB1.push(worldb);\n }\n\n if (closestFaceB >= 0) {\n this.clipFaceAgainstHull(separatingNormal, posA, quatA, worldVertsB1, minDist, maxDist, result);\n }\n }\n /**\n * Find the separating axis between this hull and another\n * @param target The target vector to save the axis in\n * @return Returns false if a separation is found, else true\n */\n\n\n findSeparatingAxis(hullB, posA, quatA, posB, quatB, target, faceListA, faceListB) {\n const faceANormalWS3 = new Vec3();\n const Worldnormal1 = new Vec3();\n const deltaC = new Vec3();\n const worldEdge0 = new Vec3();\n const worldEdge1 = new Vec3();\n const Cross = new Vec3();\n let dmin = Number.MAX_VALUE;\n const hullA = this;\n\n if (!hullA.uniqueAxes) {\n const numFacesA = faceListA ? faceListA.length : hullA.faces.length; // Test face normals from hullA\n\n for (let i = 0; i < numFacesA; i++) {\n const fi = faceListA ? faceListA[i] : i; // Get world face normal\n\n faceANormalWS3.copy(hullA.faceNormals[fi]);\n quatA.vmult(faceANormalWS3, faceANormalWS3);\n const d = hullA.testSepAxis(faceANormalWS3, hullB, posA, quatA, posB, quatB);\n\n if (d === false) {\n return false;\n }\n\n if (d < dmin) {\n dmin = d;\n target.copy(faceANormalWS3);\n }\n }\n } else {\n // Test unique axes\n for (let i = 0; i !== hullA.uniqueAxes.length; i++) {\n // Get world axis\n quatA.vmult(hullA.uniqueAxes[i], faceANormalWS3);\n const d = hullA.testSepAxis(faceANormalWS3, hullB, posA, quatA, posB, quatB);\n\n if (d === false) {\n return false;\n }\n\n if (d < dmin) {\n dmin = d;\n target.copy(faceANormalWS3);\n }\n }\n }\n\n if (!hullB.uniqueAxes) {\n // Test face normals from hullB\n const numFacesB = faceListB ? faceListB.length : hullB.faces.length;\n\n for (let i = 0; i < numFacesB; i++) {\n const fi = faceListB ? faceListB[i] : i;\n Worldnormal1.copy(hullB.faceNormals[fi]);\n quatB.vmult(Worldnormal1, Worldnormal1);\n const d = hullA.testSepAxis(Worldnormal1, hullB, posA, quatA, posB, quatB);\n\n if (d === false) {\n return false;\n }\n\n if (d < dmin) {\n dmin = d;\n target.copy(Worldnormal1);\n }\n }\n } else {\n // Test unique axes in B\n for (let i = 0; i !== hullB.uniqueAxes.length; i++) {\n quatB.vmult(hullB.uniqueAxes[i], Worldnormal1);\n const d = hullA.testSepAxis(Worldnormal1, hullB, posA, quatA, posB, quatB);\n\n if (d === false) {\n return false;\n }\n\n if (d < dmin) {\n dmin = d;\n target.copy(Worldnormal1);\n }\n }\n } // Test edges\n\n\n for (let e0 = 0; e0 !== hullA.uniqueEdges.length; e0++) {\n // Get world edge\n quatA.vmult(hullA.uniqueEdges[e0], worldEdge0);\n\n for (let e1 = 0; e1 !== hullB.uniqueEdges.length; e1++) {\n // Get world edge 2\n quatB.vmult(hullB.uniqueEdges[e1], worldEdge1);\n worldEdge0.cross(worldEdge1, Cross);\n\n if (!Cross.almostZero()) {\n Cross.normalize();\n const dist = hullA.testSepAxis(Cross, hullB, posA, quatA, posB, quatB);\n\n if (dist === false) {\n return false;\n }\n\n if (dist < dmin) {\n dmin = dist;\n target.copy(Cross);\n }\n }\n }\n }\n\n posB.vsub(posA, deltaC);\n\n if (deltaC.dot(target) > 0.0) {\n target.negate(target);\n }\n\n return true;\n }\n /**\n * Test separating axis against two hulls. Both hulls are projected onto the axis and the overlap size is returned if there is one.\n * @return The overlap depth, or FALSE if no penetration.\n */\n\n\n testSepAxis(axis, hullB, posA, quatA, posB, quatB) {\n const hullA = this;\n ConvexPolyhedron.project(hullA, axis, posA, quatA, maxminA);\n ConvexPolyhedron.project(hullB, axis, posB, quatB, maxminB);\n const maxA = maxminA[0];\n const minA = maxminA[1];\n const maxB = maxminB[0];\n const minB = maxminB[1];\n\n if (maxA < minB || maxB < minA) {\n return false; // Separated\n }\n\n const d0 = maxA - minB;\n const d1 = maxB - minA;\n const depth = d0 < d1 ? d0 : d1;\n return depth;\n }\n /**\n * calculateLocalInertia\n */\n\n\n calculateLocalInertia(mass, target) {\n // Approximate with box inertia\n // Exact inertia calculation is overkill, but see http://geometrictools.com/Documentation/PolyhedralMassProperties.pdf for the correct way to do it\n const aabbmax = new Vec3();\n const aabbmin = new Vec3();\n this.computeLocalAABB(aabbmin, aabbmax);\n const x = aabbmax.x - aabbmin.x;\n const y = aabbmax.y - aabbmin.y;\n const z = aabbmax.z - aabbmin.z;\n target.x = 1.0 / 12.0 * mass * (2 * y * 2 * y + 2 * z * 2 * z);\n target.y = 1.0 / 12.0 * mass * (2 * x * 2 * x + 2 * z * 2 * z);\n target.z = 1.0 / 12.0 * mass * (2 * y * 2 * y + 2 * x * 2 * x);\n }\n /**\n * @param face_i Index of the face\n */\n\n\n getPlaneConstantOfFace(face_i) {\n const f = this.faces[face_i];\n const n = this.faceNormals[face_i];\n const v = this.vertices[f[0]];\n const c = -n.dot(v);\n return c;\n }\n /**\n * Clip a face against a hull.\n * @param worldVertsB1 An array of Vec3 with vertices in the world frame.\n * @param minDist Distance clamping\n * @param Array result Array to store resulting contact points in. Will be objects with properties: point, depth, normal. These are represented in world coordinates.\n */\n\n\n clipFaceAgainstHull(separatingNormal, posA, quatA, worldVertsB1, minDist, maxDist, result) {\n const faceANormalWS = new Vec3();\n const edge0 = new Vec3();\n const WorldEdge0 = new Vec3();\n const worldPlaneAnormal1 = new Vec3();\n const planeNormalWS1 = new Vec3();\n const worldA1 = new Vec3();\n const localPlaneNormal = new Vec3();\n const planeNormalWS = new Vec3();\n const hullA = this;\n const worldVertsB2 = [];\n const pVtxIn = worldVertsB1;\n const pVtxOut = worldVertsB2;\n let closestFaceA = -1;\n let dmin = Number.MAX_VALUE; // Find the face with normal closest to the separating axis\n\n for (let face = 0; face < hullA.faces.length; face++) {\n faceANormalWS.copy(hullA.faceNormals[face]);\n quatA.vmult(faceANormalWS, faceANormalWS);\n const d = faceANormalWS.dot(separatingNormal);\n\n if (d < dmin) {\n dmin = d;\n closestFaceA = face;\n }\n }\n\n if (closestFaceA < 0) {\n return;\n } // Get the face and construct connected faces\n\n\n const polyA = hullA.faces[closestFaceA];\n polyA.connectedFaces = [];\n\n for (let i = 0; i < hullA.faces.length; i++) {\n for (let j = 0; j < hullA.faces[i].length; j++) {\n if (\n /* Sharing a vertex*/\n polyA.indexOf(hullA.faces[i][j]) !== -1 &&\n /* Not the one we are looking for connections from */\n i !== closestFaceA &&\n /* Not already added */\n polyA.connectedFaces.indexOf(i) === -1) {\n polyA.connectedFaces.push(i);\n }\n }\n } // Clip the polygon to the back of the planes of all faces of hull A,\n // that are adjacent to the witness face\n\n\n const numVerticesA = polyA.length;\n\n for (let i = 0; i < numVerticesA; i++) {\n const a = hullA.vertices[polyA[i]];\n const b = hullA.vertices[polyA[(i + 1) % numVerticesA]];\n a.vsub(b, edge0);\n WorldEdge0.copy(edge0);\n quatA.vmult(WorldEdge0, WorldEdge0);\n posA.vadd(WorldEdge0, WorldEdge0);\n worldPlaneAnormal1.copy(this.faceNormals[closestFaceA]);\n quatA.vmult(worldPlaneAnormal1, worldPlaneAnormal1);\n posA.vadd(worldPlaneAnormal1, worldPlaneAnormal1);\n WorldEdge0.cross(worldPlaneAnormal1, planeNormalWS1);\n planeNormalWS1.negate(planeNormalWS1);\n worldA1.copy(a);\n quatA.vmult(worldA1, worldA1);\n posA.vadd(worldA1, worldA1);\n const otherFace = polyA.connectedFaces[i];\n localPlaneNormal.copy(this.faceNormals[otherFace]);\n const localPlaneEq = this.getPlaneConstantOfFace(otherFace);\n planeNormalWS.copy(localPlaneNormal);\n quatA.vmult(planeNormalWS, planeNormalWS);\n const planeEqWS = localPlaneEq - planeNormalWS.dot(posA); // Clip face against our constructed plane\n\n this.clipFaceAgainstPlane(pVtxIn, pVtxOut, planeNormalWS, planeEqWS); // Throw away all clipped points, but save the remaining until next clip\n\n while (pVtxIn.length) {\n pVtxIn.shift();\n }\n\n while (pVtxOut.length) {\n pVtxIn.push(pVtxOut.shift());\n }\n } // only keep contact points that are behind the witness face\n\n\n localPlaneNormal.copy(this.faceNormals[closestFaceA]);\n const localPlaneEq = this.getPlaneConstantOfFace(closestFaceA);\n planeNormalWS.copy(localPlaneNormal);\n quatA.vmult(planeNormalWS, planeNormalWS);\n const planeEqWS = localPlaneEq - planeNormalWS.dot(posA);\n\n for (let i = 0; i < pVtxIn.length; i++) {\n let depth = planeNormalWS.dot(pVtxIn[i]) + planeEqWS; // ???\n\n if (depth <= minDist) {\n console.log(\"clamped: depth=\" + depth + \" to minDist=\" + minDist);\n depth = minDist;\n }\n\n if (depth <= maxDist) {\n const point = pVtxIn[i];\n\n if (depth <= 1e-6) {\n const p = {\n point,\n normal: planeNormalWS,\n depth\n };\n result.push(p);\n }\n }\n }\n }\n /**\n * Clip a face in a hull against the back of a plane.\n * @param planeConstant The constant in the mathematical plane equation\n */\n\n\n clipFaceAgainstPlane(inVertices, outVertices, planeNormal, planeConstant) {\n let n_dot_first;\n let n_dot_last;\n const numVerts = inVertices.length;\n\n if (numVerts < 2) {\n return outVertices;\n }\n\n let firstVertex = inVertices[inVertices.length - 1];\n let lastVertex = inVertices[0];\n n_dot_first = planeNormal.dot(firstVertex) + planeConstant;\n\n for (let vi = 0; vi < numVerts; vi++) {\n lastVertex = inVertices[vi];\n n_dot_last = planeNormal.dot(lastVertex) + planeConstant;\n\n if (n_dot_first < 0) {\n if (n_dot_last < 0) {\n // Start < 0, end < 0, so output lastVertex\n const newv = new Vec3();\n newv.copy(lastVertex);\n outVertices.push(newv);\n } else {\n // Start < 0, end >= 0, so output intersection\n const newv = new Vec3();\n firstVertex.lerp(lastVertex, n_dot_first / (n_dot_first - n_dot_last), newv);\n outVertices.push(newv);\n }\n } else {\n if (n_dot_last < 0) {\n // Start >= 0, end < 0 so output intersection and end\n const newv = new Vec3();\n firstVertex.lerp(lastVertex, n_dot_first / (n_dot_first - n_dot_last), newv);\n outVertices.push(newv);\n outVertices.push(lastVertex);\n }\n }\n\n firstVertex = lastVertex;\n n_dot_first = n_dot_last;\n }\n\n return outVertices;\n }\n /**\n * Updates `.worldVertices` and sets `.worldVerticesNeedsUpdate` to false.\n */\n\n\n computeWorldVertices(position, quat) {\n while (this.worldVertices.length < this.vertices.length) {\n this.worldVertices.push(new Vec3());\n }\n\n const verts = this.vertices;\n const worldVerts = this.worldVertices;\n\n for (let i = 0; i !== this.vertices.length; i++) {\n quat.vmult(verts[i], worldVerts[i]);\n position.vadd(worldVerts[i], worldVerts[i]);\n }\n\n this.worldVerticesNeedsUpdate = false;\n }\n\n computeLocalAABB(aabbmin, aabbmax) {\n const vertices = this.vertices;\n aabbmin.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n aabbmax.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\n\n for (let i = 0; i < this.vertices.length; i++) {\n const v = vertices[i];\n\n if (v.x < aabbmin.x) {\n aabbmin.x = v.x;\n } else if (v.x > aabbmax.x) {\n aabbmax.x = v.x;\n }\n\n if (v.y < aabbmin.y) {\n aabbmin.y = v.y;\n } else if (v.y > aabbmax.y) {\n aabbmax.y = v.y;\n }\n\n if (v.z < aabbmin.z) {\n aabbmin.z = v.z;\n } else if (v.z > aabbmax.z) {\n aabbmax.z = v.z;\n }\n }\n }\n /**\n * Updates `worldVertices` and sets `worldVerticesNeedsUpdate` to false.\n */\n\n\n computeWorldFaceNormals(quat) {\n const N = this.faceNormals.length;\n\n while (this.worldFaceNormals.length < N) {\n this.worldFaceNormals.push(new Vec3());\n }\n\n const normals = this.faceNormals;\n const worldNormals = this.worldFaceNormals;\n\n for (let i = 0; i !== N; i++) {\n quat.vmult(normals[i], worldNormals[i]);\n }\n\n this.worldFaceNormalsNeedsUpdate = false;\n }\n /**\n * updateBoundingSphereRadius\n */\n\n\n updateBoundingSphereRadius() {\n // Assume points are distributed with local (0,0,0) as center\n let max2 = 0;\n const verts = this.vertices;\n\n for (let i = 0; i !== verts.length; i++) {\n const norm2 = verts[i].lengthSquared();\n\n if (norm2 > max2) {\n max2 = norm2;\n }\n }\n\n this.boundingSphereRadius = Math.sqrt(max2);\n }\n /**\n * calculateWorldAABB\n */\n\n\n calculateWorldAABB(pos, quat, min, max) {\n const verts = this.vertices;\n let minx;\n let miny;\n let minz;\n let maxx;\n let maxy;\n let maxz;\n let tempWorldVertex = new Vec3();\n\n for (let i = 0; i < verts.length; i++) {\n tempWorldVertex.copy(verts[i]);\n quat.vmult(tempWorldVertex, tempWorldVertex);\n pos.vadd(tempWorldVertex, tempWorldVertex);\n const v = tempWorldVertex;\n\n if (minx === undefined || v.x < minx) {\n minx = v.x;\n }\n\n if (maxx === undefined || v.x > maxx) {\n maxx = v.x;\n }\n\n if (miny === undefined || v.y < miny) {\n miny = v.y;\n }\n\n if (maxy === undefined || v.y > maxy) {\n maxy = v.y;\n }\n\n if (minz === undefined || v.z < minz) {\n minz = v.z;\n }\n\n if (maxz === undefined || v.z > maxz) {\n maxz = v.z;\n }\n }\n\n min.set(minx, miny, minz);\n max.set(maxx, maxy, maxz);\n }\n /**\n * Get approximate convex volume\n */\n\n\n volume() {\n return 4.0 * Math.PI * this.boundingSphereRadius / 3.0;\n }\n /**\n * Get an average of all the vertices positions\n */\n\n\n getAveragePointLocal(target = new Vec3()) {\n const verts = this.vertices;\n\n for (let i = 0; i < verts.length; i++) {\n target.vadd(verts[i], target);\n }\n\n target.scale(1 / verts.length, target);\n return target;\n }\n /**\n * Transform all local points. Will change the .vertices\n */\n\n\n transformAllPoints(offset, quat) {\n const n = this.vertices.length;\n const verts = this.vertices; // Apply rotation\n\n if (quat) {\n // Rotate vertices\n for (let i = 0; i < n; i++) {\n const v = verts[i];\n quat.vmult(v, v);\n } // Rotate face normals\n\n\n for (let i = 0; i < this.faceNormals.length; i++) {\n const v = this.faceNormals[i];\n quat.vmult(v, v);\n }\n /*\n // Rotate edges\n for(let i=0; i 0 || r1 > 0 && r2 < 0) {\n return false; // Encountered some other sign. Exit.\n }\n } // If we got here, all dot products were of the same sign.\n\n\n return -1;\n }\n /**\n * Get max and min dot product of a convex hull at position (pos,quat) projected onto an axis.\n * Results are saved in the array maxmin.\n * @param result result[0] and result[1] will be set to maximum and minimum, respectively.\n */\n\n\n static project(shape, axis, pos, quat, result) {\n const n = shape.vertices.length;\n const localAxis = project_localAxis;\n let max = 0;\n let min = 0;\n const localOrigin = project_localOrigin;\n const vs = shape.vertices;\n localOrigin.setZero(); // Transform the axis to local\n\n Transform.vectorToLocalFrame(pos, quat, axis, localAxis);\n Transform.pointToLocalFrame(pos, quat, localOrigin, localOrigin);\n const add = localOrigin.dot(localAxis);\n min = max = vs[0].dot(localAxis);\n\n for (let i = 1; i < n; i++) {\n const val = vs[i].dot(localAxis);\n\n if (val > max) {\n max = val;\n }\n\n if (val < min) {\n min = val;\n }\n }\n\n min -= add;\n max -= add;\n\n if (min > max) {\n // Inconsistent - swap\n const temp = min;\n min = max;\n max = temp;\n } // Output\n\n\n result[0] = max;\n result[1] = min;\n }\n\n}\nconst maxminA = [];\nconst maxminB = [];\nconst project_localAxis = new Vec3();\nconst project_localOrigin = new Vec3();\n\n/**\n * A 3d box shape.\n * @example\n * const size = 1\n * const halfExtents = new CANNON.Vec3(size, size, size)\n * const boxShape = new CANNON.Box(halfExtents)\n * const boxBody = new CANNON.Body({ mass: 1, shape: boxShape })\n * world.addBody(boxBody)\n */\nclass Box extends Shape {\n /**\n * The half extents of the box.\n */\n\n /**\n * Used by the contact generator to make contacts with other convex polyhedra for example.\n */\n constructor(halfExtents) {\n super({\n type: Shape.types.BOX\n });\n this.halfExtents = void 0;\n this.convexPolyhedronRepresentation = void 0;\n this.halfExtents = halfExtents;\n this.convexPolyhedronRepresentation = null;\n this.updateConvexPolyhedronRepresentation();\n this.updateBoundingSphereRadius();\n }\n /**\n * Updates the local convex polyhedron representation used for some collisions.\n */\n\n\n updateConvexPolyhedronRepresentation() {\n const sx = this.halfExtents.x;\n const sy = this.halfExtents.y;\n const sz = this.halfExtents.z;\n const V = Vec3;\n const vertices = [new V(-sx, -sy, -sz), new V(sx, -sy, -sz), new V(sx, sy, -sz), new V(-sx, sy, -sz), new V(-sx, -sy, sz), new V(sx, -sy, sz), new V(sx, sy, sz), new V(-sx, sy, sz)];\n const faces = [[3, 2, 1, 0], // -z\n [4, 5, 6, 7], // +z\n [5, 4, 0, 1], // -y\n [2, 3, 7, 6], // +y\n [0, 4, 7, 3], // -x\n [1, 2, 6, 5] // +x\n ];\n const axes = [new V(0, 0, 1), new V(0, 1, 0), new V(1, 0, 0)];\n const h = new ConvexPolyhedron({\n vertices,\n faces,\n axes\n });\n this.convexPolyhedronRepresentation = h;\n h.material = this.material;\n }\n /**\n * Calculate the inertia of the box.\n */\n\n\n calculateLocalInertia(mass, target = new Vec3()) {\n Box.calculateInertia(this.halfExtents, mass, target);\n return target;\n }\n\n static calculateInertia(halfExtents, mass, target) {\n const e = halfExtents;\n target.x = 1.0 / 12.0 * mass * (2 * e.y * 2 * e.y + 2 * e.z * 2 * e.z);\n target.y = 1.0 / 12.0 * mass * (2 * e.x * 2 * e.x + 2 * e.z * 2 * e.z);\n target.z = 1.0 / 12.0 * mass * (2 * e.y * 2 * e.y + 2 * e.x * 2 * e.x);\n }\n /**\n * Get the box 6 side normals\n * @param sixTargetVectors An array of 6 vectors, to store the resulting side normals in.\n * @param quat Orientation to apply to the normal vectors. If not provided, the vectors will be in respect to the local frame.\n */\n\n\n getSideNormals(sixTargetVectors, quat) {\n const sides = sixTargetVectors;\n const ex = this.halfExtents;\n sides[0].set(ex.x, 0, 0);\n sides[1].set(0, ex.y, 0);\n sides[2].set(0, 0, ex.z);\n sides[3].set(-ex.x, 0, 0);\n sides[4].set(0, -ex.y, 0);\n sides[5].set(0, 0, -ex.z);\n\n if (quat !== undefined) {\n for (let i = 0; i !== sides.length; i++) {\n quat.vmult(sides[i], sides[i]);\n }\n }\n\n return sides;\n }\n /**\n * Returns the volume of the box.\n */\n\n\n volume() {\n return 8.0 * this.halfExtents.x * this.halfExtents.y * this.halfExtents.z;\n }\n /**\n * updateBoundingSphereRadius\n */\n\n\n updateBoundingSphereRadius() {\n this.boundingSphereRadius = this.halfExtents.length();\n }\n /**\n * forEachWorldCorner\n */\n\n\n forEachWorldCorner(pos, quat, callback) {\n const e = this.halfExtents;\n const corners = [[e.x, e.y, e.z], [-e.x, e.y, e.z], [-e.x, -e.y, e.z], [-e.x, -e.y, -e.z], [e.x, -e.y, -e.z], [e.x, e.y, -e.z], [-e.x, e.y, -e.z], [e.x, -e.y, e.z]];\n\n for (let i = 0; i < corners.length; i++) {\n worldCornerTempPos.set(corners[i][0], corners[i][1], corners[i][2]);\n quat.vmult(worldCornerTempPos, worldCornerTempPos);\n pos.vadd(worldCornerTempPos, worldCornerTempPos);\n callback(worldCornerTempPos.x, worldCornerTempPos.y, worldCornerTempPos.z);\n }\n }\n /**\n * calculateWorldAABB\n */\n\n\n calculateWorldAABB(pos, quat, min, max) {\n const e = this.halfExtents;\n worldCornersTemp[0].set(e.x, e.y, e.z);\n worldCornersTemp[1].set(-e.x, e.y, e.z);\n worldCornersTemp[2].set(-e.x, -e.y, e.z);\n worldCornersTemp[3].set(-e.x, -e.y, -e.z);\n worldCornersTemp[4].set(e.x, -e.y, -e.z);\n worldCornersTemp[5].set(e.x, e.y, -e.z);\n worldCornersTemp[6].set(-e.x, e.y, -e.z);\n worldCornersTemp[7].set(e.x, -e.y, e.z);\n const wc = worldCornersTemp[0];\n quat.vmult(wc, wc);\n pos.vadd(wc, wc);\n max.copy(wc);\n min.copy(wc);\n\n for (let i = 1; i < 8; i++) {\n const wc = worldCornersTemp[i];\n quat.vmult(wc, wc);\n pos.vadd(wc, wc);\n const x = wc.x;\n const y = wc.y;\n const z = wc.z;\n\n if (x > max.x) {\n max.x = x;\n }\n\n if (y > max.y) {\n max.y = y;\n }\n\n if (z > max.z) {\n max.z = z;\n }\n\n if (x < min.x) {\n min.x = x;\n }\n\n if (y < min.y) {\n min.y = y;\n }\n\n if (z < min.z) {\n min.z = z;\n }\n } // Get each axis max\n // min.set(Infinity,Infinity,Infinity);\n // max.set(-Infinity,-Infinity,-Infinity);\n // this.forEachWorldCorner(pos,quat,function(x,y,z){\n // if(x > max.x){\n // max.x = x;\n // }\n // if(y > max.y){\n // max.y = y;\n // }\n // if(z > max.z){\n // max.z = z;\n // }\n // if(x < min.x){\n // min.x = x;\n // }\n // if(y < min.y){\n // min.y = y;\n // }\n // if(z < min.z){\n // min.z = z;\n // }\n // });\n\n }\n\n}\nconst worldCornerTempPos = new Vec3();\nconst worldCornersTemp = [new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3()];\n\n/**\n * BODY_TYPES\n */\nconst BODY_TYPES = {\n /** DYNAMIC */\n DYNAMIC: 1,\n\n /** STATIC */\n STATIC: 2,\n\n /** KINEMATIC */\n KINEMATIC: 4\n};\n/**\n * BodyType\n */\n\n/**\n * BODY_SLEEP_STATES\n */\nconst BODY_SLEEP_STATES = {\n /** AWAKE */\n AWAKE: 0,\n\n /** SLEEPY */\n SLEEPY: 1,\n\n /** SLEEPING */\n SLEEPING: 2\n};\n/**\n * BodySleepState\n */\n\n/**\n * Base class for all body types.\n * @example\n * const shape = new CANNON.Sphere(1)\n * const body = new CANNON.Body({\n * mass: 1,\n * shape,\n * })\n * world.addBody(body)\n */\nclass Body extends EventTarget {\n /**\n * Dispatched after two bodies collide. This event is dispatched on each\n * of the two bodies involved in the collision.\n * @event collide\n * @param body The body that was involved in the collision.\n * @param contact The details of the collision.\n */\n\n /**\n * A dynamic body is fully simulated. Can be moved manually by the user, but normally they move according to forces. A dynamic body can collide with all body types. A dynamic body always has finite, non-zero mass.\n */\n\n /**\n * A static body does not move during simulation and behaves as if it has infinite mass. Static bodies can be moved manually by setting the position of the body. The velocity of a static body is always zero. Static bodies do not collide with other static or kinematic bodies.\n */\n\n /**\n * A kinematic body moves under simulation according to its velocity. They do not respond to forces. They can be moved manually, but normally a kinematic body is moved by setting its velocity. A kinematic body behaves as if it has infinite mass. Kinematic bodies do not collide with other static or kinematic bodies.\n */\n\n /**\n * AWAKE\n */\n\n /**\n * SLEEPY\n */\n\n /**\n * SLEEPING\n */\n\n /**\n * Dispatched after a sleeping body has woken up.\n * @event wakeup\n */\n\n /**\n * Dispatched after a body has gone in to the sleepy state.\n * @event sleepy\n */\n\n /**\n * Dispatched after a body has fallen asleep.\n * @event sleep\n */\n\n /**\n * Identifier of the body.\n */\n\n /**\n * Position of body in World.bodies. Updated by World and used in ArrayCollisionMatrix.\n */\n\n /**\n * Reference to the world the body is living in.\n */\n\n /**\n * Callback function that is used BEFORE stepping the system. Use it to apply forces, for example. Inside the function, \"this\" will refer to this Body object. Deprecated - use World events instead.\n * @deprecated Use World events instead\n */\n\n /**\n * Callback function that is used AFTER stepping the system. Inside the function, \"this\" will refer to this Body object. Deprecated - use World events instead.\n * @deprecated Use World events instead\n */\n\n /**\n * The collision group the body belongs to.\n * @default 1\n */\n\n /**\n * The collision group the body can collide with.\n * @default -1\n */\n\n /**\n * Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled - i.e. \"collide\" events will be raised, but forces will not be altered.\n */\n\n /**\n * World space position of the body.\n */\n\n /**\n * Interpolated position of the body.\n */\n\n /**\n * Initial position of the body.\n */\n\n /**\n * World space velocity of the body.\n */\n\n /**\n * Initial velocity of the body.\n */\n\n /**\n * Linear force on the body in world space.\n */\n\n /**\n * The mass of the body.\n * @default 0\n */\n\n /**\n * The physics material of the body. It defines the body interaction with other bodies.\n */\n\n /**\n * How much to damp the body velocity each step. It can go from 0 to 1.\n * @default 0.01\n */\n\n /**\n * One of: `Body.DYNAMIC`, `Body.STATIC` and `Body.KINEMATIC`.\n */\n\n /**\n * If true, the body will automatically fall to sleep.\n * @default true\n */\n\n /**\n * Current sleep state.\n */\n\n /**\n * If the speed (the norm of the velocity) is smaller than this value, the body is considered sleepy.\n * @default 0.1\n */\n\n /**\n * If the body has been sleepy for this sleepTimeLimit seconds, it is considered sleeping.\n * @default 1\n */\n\n /**\n * World space rotational force on the body, around center of mass.\n */\n\n /**\n * World space orientation of the body.\n */\n\n /**\n * Initial quaternion of the body.\n */\n\n /**\n * Interpolated orientation of the body.\n */\n\n /**\n * Angular velocity of the body, in world space. Think of the angular velocity as a vector, which the body rotates around. The length of this vector determines how fast (in radians per second) the body rotates.\n */\n\n /**\n * Initial angular velocity of the body.\n */\n\n /**\n * List of Shapes that have been added to the body.\n */\n\n /**\n * Position of each Shape in the body, given in local Body space.\n */\n\n /**\n * Orientation of each Shape, given in local Body space.\n */\n\n /**\n * The inertia of the body.\n */\n\n /**\n * Set to true if you don't want the body to rotate. Make sure to run .updateMassProperties() if you change this after the body creation.\n * @default false\n */\n\n /**\n * How much to damp the body angular velocity each step. It can go from 0 to 1.\n * @default 0.01\n */\n\n /**\n * Use this property to limit the motion along any world axis. (1,1,1) will allow motion along all axes while (0,0,0) allows none.\n */\n\n /**\n * Use this property to limit the rotational motion along any world axis. (1,1,1) will allow rotation along all axes while (0,0,0) allows none.\n */\n\n /**\n * World space bounding box of the body and its shapes.\n */\n\n /**\n * Indicates if the AABB needs to be updated before use.\n */\n\n /**\n * Total bounding radius of the Body including its shapes, relative to body.position.\n */\n\n /**\n * When true the body behaves like a trigger. It does not collide\n * with other bodies but collision events are still triggered.\n * @default false\n */\n constructor(options = {}) {\n super();\n this.id = void 0;\n this.index = void 0;\n this.world = void 0;\n this.preStep = void 0;\n this.postStep = void 0;\n this.vlambda = void 0;\n this.collisionFilterGroup = void 0;\n this.collisionFilterMask = void 0;\n this.collisionResponse = void 0;\n this.position = void 0;\n this.previousPosition = void 0;\n this.interpolatedPosition = void 0;\n this.initPosition = void 0;\n this.velocity = void 0;\n this.initVelocity = void 0;\n this.force = void 0;\n this.mass = void 0;\n this.invMass = void 0;\n this.material = void 0;\n this.linearDamping = void 0;\n this.type = void 0;\n this.allowSleep = void 0;\n this.sleepState = void 0;\n this.sleepSpeedLimit = void 0;\n this.sleepTimeLimit = void 0;\n this.timeLastSleepy = void 0;\n this.wakeUpAfterNarrowphase = void 0;\n this.torque = void 0;\n this.quaternion = void 0;\n this.initQuaternion = void 0;\n this.previousQuaternion = void 0;\n this.interpolatedQuaternion = void 0;\n this.angularVelocity = void 0;\n this.initAngularVelocity = void 0;\n this.shapes = void 0;\n this.shapeOffsets = void 0;\n this.shapeOrientations = void 0;\n this.inertia = void 0;\n this.invInertia = void 0;\n this.invInertiaWorld = void 0;\n this.invMassSolve = void 0;\n this.invInertiaSolve = void 0;\n this.invInertiaWorldSolve = void 0;\n this.fixedRotation = void 0;\n this.angularDamping = void 0;\n this.linearFactor = void 0;\n this.angularFactor = void 0;\n this.aabb = void 0;\n this.aabbNeedsUpdate = void 0;\n this.boundingRadius = void 0;\n this.wlambda = void 0;\n this.isTrigger = void 0;\n this.id = Body.idCounter++;\n this.index = -1;\n this.world = null;\n this.preStep = null;\n this.postStep = null;\n this.vlambda = new Vec3();\n this.collisionFilterGroup = typeof options.collisionFilterGroup === 'number' ? options.collisionFilterGroup : 1;\n this.collisionFilterMask = typeof options.collisionFilterMask === 'number' ? options.collisionFilterMask : -1;\n this.collisionResponse = typeof options.collisionResponse === 'boolean' ? options.collisionResponse : true;\n this.position = new Vec3();\n this.previousPosition = new Vec3();\n this.interpolatedPosition = new Vec3();\n this.initPosition = new Vec3();\n\n if (options.position) {\n this.position.copy(options.position);\n this.previousPosition.copy(options.position);\n this.interpolatedPosition.copy(options.position);\n this.initPosition.copy(options.position);\n }\n\n this.velocity = new Vec3();\n\n if (options.velocity) {\n this.velocity.copy(options.velocity);\n }\n\n this.initVelocity = new Vec3();\n this.force = new Vec3();\n const mass = typeof options.mass === 'number' ? options.mass : 0;\n this.mass = mass;\n this.invMass = mass > 0 ? 1.0 / mass : 0;\n this.material = options.material || null;\n this.linearDamping = typeof options.linearDamping === 'number' ? options.linearDamping : 0.01;\n this.type = mass <= 0.0 ? Body.STATIC : Body.DYNAMIC;\n\n if (typeof options.type === typeof Body.STATIC) {\n this.type = options.type;\n }\n\n this.allowSleep = typeof options.allowSleep !== 'undefined' ? options.allowSleep : true;\n this.sleepState = Body.AWAKE;\n this.sleepSpeedLimit = typeof options.sleepSpeedLimit !== 'undefined' ? options.sleepSpeedLimit : 0.1;\n this.sleepTimeLimit = typeof options.sleepTimeLimit !== 'undefined' ? options.sleepTimeLimit : 1;\n this.timeLastSleepy = 0;\n this.wakeUpAfterNarrowphase = false;\n this.torque = new Vec3();\n this.quaternion = new Quaternion();\n this.initQuaternion = new Quaternion();\n this.previousQuaternion = new Quaternion();\n this.interpolatedQuaternion = new Quaternion();\n\n if (options.quaternion) {\n this.quaternion.copy(options.quaternion);\n this.initQuaternion.copy(options.quaternion);\n this.previousQuaternion.copy(options.quaternion);\n this.interpolatedQuaternion.copy(options.quaternion);\n }\n\n this.angularVelocity = new Vec3();\n\n if (options.angularVelocity) {\n this.angularVelocity.copy(options.angularVelocity);\n }\n\n this.initAngularVelocity = new Vec3();\n this.shapes = [];\n this.shapeOffsets = [];\n this.shapeOrientations = [];\n this.inertia = new Vec3();\n this.invInertia = new Vec3();\n this.invInertiaWorld = new Mat3();\n this.invMassSolve = 0;\n this.invInertiaSolve = new Vec3();\n this.invInertiaWorldSolve = new Mat3();\n this.fixedRotation = typeof options.fixedRotation !== 'undefined' ? options.fixedRotation : false;\n this.angularDamping = typeof options.angularDamping !== 'undefined' ? options.angularDamping : 0.01;\n this.linearFactor = new Vec3(1, 1, 1);\n\n if (options.linearFactor) {\n this.linearFactor.copy(options.linearFactor);\n }\n\n this.angularFactor = new Vec3(1, 1, 1);\n\n if (options.angularFactor) {\n this.angularFactor.copy(options.angularFactor);\n }\n\n this.aabb = new AABB();\n this.aabbNeedsUpdate = true;\n this.boundingRadius = 0;\n this.wlambda = new Vec3();\n this.isTrigger = Boolean(options.isTrigger);\n\n if (options.shape) {\n this.addShape(options.shape);\n }\n\n this.updateMassProperties();\n }\n /**\n * Wake the body up.\n */\n\n\n wakeUp() {\n const prevState = this.sleepState;\n this.sleepState = Body.AWAKE;\n this.wakeUpAfterNarrowphase = false;\n\n if (prevState === Body.SLEEPING) {\n this.dispatchEvent(Body.wakeupEvent);\n }\n }\n /**\n * Force body sleep\n */\n\n\n sleep() {\n this.sleepState = Body.SLEEPING;\n this.velocity.set(0, 0, 0);\n this.angularVelocity.set(0, 0, 0);\n this.wakeUpAfterNarrowphase = false;\n }\n /**\n * Called every timestep to update internal sleep timer and change sleep state if needed.\n * @param time The world time in seconds\n */\n\n\n sleepTick(time) {\n if (this.allowSleep) {\n const sleepState = this.sleepState;\n const speedSquared = this.velocity.lengthSquared() + this.angularVelocity.lengthSquared();\n const speedLimitSquared = this.sleepSpeedLimit ** 2;\n\n if (sleepState === Body.AWAKE && speedSquared < speedLimitSquared) {\n this.sleepState = Body.SLEEPY; // Sleepy\n\n this.timeLastSleepy = time;\n this.dispatchEvent(Body.sleepyEvent);\n } else if (sleepState === Body.SLEEPY && speedSquared > speedLimitSquared) {\n this.wakeUp(); // Wake up\n } else if (sleepState === Body.SLEEPY && time - this.timeLastSleepy > this.sleepTimeLimit) {\n this.sleep(); // Sleeping\n\n this.dispatchEvent(Body.sleepEvent);\n }\n }\n }\n /**\n * If the body is sleeping, it should be immovable / have infinite mass during solve. We solve it by having a separate \"solve mass\".\n */\n\n\n updateSolveMassProperties() {\n if (this.sleepState === Body.SLEEPING || this.type === Body.KINEMATIC) {\n this.invMassSolve = 0;\n this.invInertiaSolve.setZero();\n this.invInertiaWorldSolve.setZero();\n } else {\n this.invMassSolve = this.invMass;\n this.invInertiaSolve.copy(this.invInertia);\n this.invInertiaWorldSolve.copy(this.invInertiaWorld);\n }\n }\n /**\n * Convert a world point to local body frame.\n */\n\n\n pointToLocalFrame(worldPoint, result = new Vec3()) {\n worldPoint.vsub(this.position, result);\n this.quaternion.conjugate().vmult(result, result);\n return result;\n }\n /**\n * Convert a world vector to local body frame.\n */\n\n\n vectorToLocalFrame(worldVector, result = new Vec3()) {\n this.quaternion.conjugate().vmult(worldVector, result);\n return result;\n }\n /**\n * Convert a local body point to world frame.\n */\n\n\n pointToWorldFrame(localPoint, result = new Vec3()) {\n this.quaternion.vmult(localPoint, result);\n result.vadd(this.position, result);\n return result;\n }\n /**\n * Convert a local body point to world frame.\n */\n\n\n vectorToWorldFrame(localVector, result = new Vec3()) {\n this.quaternion.vmult(localVector, result);\n return result;\n }\n /**\n * Add a shape to the body with a local offset and orientation.\n * @return The body object, for chainability.\n */\n\n\n addShape(shape, _offset, _orientation) {\n const offset = new Vec3();\n const orientation = new Quaternion();\n\n if (_offset) {\n offset.copy(_offset);\n }\n\n if (_orientation) {\n orientation.copy(_orientation);\n }\n\n this.shapes.push(shape);\n this.shapeOffsets.push(offset);\n this.shapeOrientations.push(orientation);\n this.updateMassProperties();\n this.updateBoundingRadius();\n this.aabbNeedsUpdate = true;\n shape.body = this;\n return this;\n }\n /**\n * Remove a shape from the body.\n * @return The body object, for chainability.\n */\n\n\n removeShape(shape) {\n const index = this.shapes.indexOf(shape);\n\n if (index === -1) {\n console.warn('Shape does not belong to the body');\n return this;\n }\n\n this.shapes.splice(index, 1);\n this.shapeOffsets.splice(index, 1);\n this.shapeOrientations.splice(index, 1);\n this.updateMassProperties();\n this.updateBoundingRadius();\n this.aabbNeedsUpdate = true;\n shape.body = null;\n return this;\n }\n /**\n * Update the bounding radius of the body. Should be done if any of the shapes are changed.\n */\n\n\n updateBoundingRadius() {\n const shapes = this.shapes;\n const shapeOffsets = this.shapeOffsets;\n const N = shapes.length;\n let radius = 0;\n\n for (let i = 0; i !== N; i++) {\n const shape = shapes[i];\n shape.updateBoundingSphereRadius();\n const offset = shapeOffsets[i].length();\n const r = shape.boundingSphereRadius;\n\n if (offset + r > radius) {\n radius = offset + r;\n }\n }\n\n this.boundingRadius = radius;\n }\n /**\n * Updates the .aabb\n */\n\n\n updateAABB() {\n const shapes = this.shapes;\n const shapeOffsets = this.shapeOffsets;\n const shapeOrientations = this.shapeOrientations;\n const N = shapes.length;\n const offset = tmpVec;\n const orientation = tmpQuat;\n const bodyQuat = this.quaternion;\n const aabb = this.aabb;\n const shapeAABB = updateAABB_shapeAABB;\n\n for (let i = 0; i !== N; i++) {\n const shape = shapes[i]; // Get shape world position\n\n bodyQuat.vmult(shapeOffsets[i], offset);\n offset.vadd(this.position, offset); // Get shape world quaternion\n\n bodyQuat.mult(shapeOrientations[i], orientation); // Get shape AABB\n\n shape.calculateWorldAABB(offset, orientation, shapeAABB.lowerBound, shapeAABB.upperBound);\n\n if (i === 0) {\n aabb.copy(shapeAABB);\n } else {\n aabb.extend(shapeAABB);\n }\n }\n\n this.aabbNeedsUpdate = false;\n }\n /**\n * Update `.inertiaWorld` and `.invInertiaWorld`\n */\n\n\n updateInertiaWorld(force) {\n const I = this.invInertia;\n\n if (I.x === I.y && I.y === I.z && !force) ; else {\n const m1 = uiw_m1;\n const m2 = uiw_m2;\n m1.setRotationFromQuaternion(this.quaternion);\n m1.transpose(m2);\n m1.scale(I, m1);\n m1.mmult(m2, this.invInertiaWorld);\n }\n }\n /**\n * Apply force to a point of the body. This could for example be a point on the Body surface.\n * Applying force this way will add to Body.force and Body.torque.\n * @param force The amount of force to add.\n * @param relativePoint A point relative to the center of mass to apply the force on.\n */\n\n\n applyForce(force, relativePoint = new Vec3()) {\n // Needed?\n if (this.type !== Body.DYNAMIC) {\n return;\n }\n\n if (this.sleepState === Body.SLEEPING) {\n this.wakeUp();\n } // Compute produced rotational force\n\n\n const rotForce = Body_applyForce_rotForce;\n relativePoint.cross(force, rotForce); // Add linear force\n\n this.force.vadd(force, this.force); // Add rotational force\n\n this.torque.vadd(rotForce, this.torque);\n }\n /**\n * Apply force to a local point in the body.\n * @param force The force vector to apply, defined locally in the body frame.\n * @param localPoint A local point in the body to apply the force on.\n */\n\n\n applyLocalForce(localForce, localPoint = new Vec3()) {\n if (this.type !== Body.DYNAMIC) {\n return;\n }\n\n const worldForce = Body_applyLocalForce_worldForce;\n const relativePointWorld = Body_applyLocalForce_relativePointWorld; // Transform the force vector to world space\n\n this.vectorToWorldFrame(localForce, worldForce);\n this.vectorToWorldFrame(localPoint, relativePointWorld);\n this.applyForce(worldForce, relativePointWorld);\n }\n /**\n * Apply torque to the body.\n * @param torque The amount of torque to add.\n */\n\n\n applyTorque(torque) {\n if (this.type !== Body.DYNAMIC) {\n return;\n }\n\n if (this.sleepState === Body.SLEEPING) {\n this.wakeUp();\n } // Add rotational force\n\n\n this.torque.vadd(torque, this.torque);\n }\n /**\n * Apply impulse to a point of the body. This could for example be a point on the Body surface.\n * An impulse is a force added to a body during a short period of time (impulse = force * time).\n * Impulses will be added to Body.velocity and Body.angularVelocity.\n * @param impulse The amount of impulse to add.\n * @param relativePoint A point relative to the center of mass to apply the force on.\n */\n\n\n applyImpulse(impulse, relativePoint = new Vec3()) {\n if (this.type !== Body.DYNAMIC) {\n return;\n }\n\n if (this.sleepState === Body.SLEEPING) {\n this.wakeUp();\n } // Compute point position relative to the body center\n\n\n const r = relativePoint; // Compute produced central impulse velocity\n\n const velo = Body_applyImpulse_velo;\n velo.copy(impulse);\n velo.scale(this.invMass, velo); // Add linear impulse\n\n this.velocity.vadd(velo, this.velocity); // Compute produced rotational impulse velocity\n\n const rotVelo = Body_applyImpulse_rotVelo;\n r.cross(impulse, rotVelo);\n /*\n rotVelo.x *= this.invInertia.x;\n rotVelo.y *= this.invInertia.y;\n rotVelo.z *= this.invInertia.z;\n */\n\n this.invInertiaWorld.vmult(rotVelo, rotVelo); // Add rotational Impulse\n\n this.angularVelocity.vadd(rotVelo, this.angularVelocity);\n }\n /**\n * Apply locally-defined impulse to a local point in the body.\n * @param force The force vector to apply, defined locally in the body frame.\n * @param localPoint A local point in the body to apply the force on.\n */\n\n\n applyLocalImpulse(localImpulse, localPoint = new Vec3()) {\n if (this.type !== Body.DYNAMIC) {\n return;\n }\n\n const worldImpulse = Body_applyLocalImpulse_worldImpulse;\n const relativePointWorld = Body_applyLocalImpulse_relativePoint; // Transform the force vector to world space\n\n this.vectorToWorldFrame(localImpulse, worldImpulse);\n this.vectorToWorldFrame(localPoint, relativePointWorld);\n this.applyImpulse(worldImpulse, relativePointWorld);\n }\n /**\n * Should be called whenever you change the body shape or mass.\n */\n\n\n updateMassProperties() {\n const halfExtents = Body_updateMassProperties_halfExtents;\n this.invMass = this.mass > 0 ? 1.0 / this.mass : 0;\n const I = this.inertia;\n const fixed = this.fixedRotation; // Approximate with AABB box\n\n this.updateAABB();\n halfExtents.set((this.aabb.upperBound.x - this.aabb.lowerBound.x) / 2, (this.aabb.upperBound.y - this.aabb.lowerBound.y) / 2, (this.aabb.upperBound.z - this.aabb.lowerBound.z) / 2);\n Box.calculateInertia(halfExtents, this.mass, I);\n this.invInertia.set(I.x > 0 && !fixed ? 1.0 / I.x : 0, I.y > 0 && !fixed ? 1.0 / I.y : 0, I.z > 0 && !fixed ? 1.0 / I.z : 0);\n this.updateInertiaWorld(true);\n }\n /**\n * Get world velocity of a point in the body.\n * @param worldPoint\n * @param result\n * @return The result vector.\n */\n\n\n getVelocityAtWorldPoint(worldPoint, result) {\n const r = new Vec3();\n worldPoint.vsub(this.position, r);\n this.angularVelocity.cross(r, result);\n this.velocity.vadd(result, result);\n return result;\n }\n /**\n * Move the body forward in time.\n * @param dt Time step\n * @param quatNormalize Set to true to normalize the body quaternion\n * @param quatNormalizeFast If the quaternion should be normalized using \"fast\" quaternion normalization\n */\n\n\n integrate(dt, quatNormalize, quatNormalizeFast) {\n // Save previous position\n this.previousPosition.copy(this.position);\n this.previousQuaternion.copy(this.quaternion);\n\n if (!(this.type === Body.DYNAMIC || this.type === Body.KINEMATIC) || this.sleepState === Body.SLEEPING) {\n // Only for dynamic\n return;\n }\n\n const velo = this.velocity;\n const angularVelo = this.angularVelocity;\n const pos = this.position;\n const force = this.force;\n const torque = this.torque;\n const quat = this.quaternion;\n const invMass = this.invMass;\n const invInertia = this.invInertiaWorld;\n const linearFactor = this.linearFactor;\n const iMdt = invMass * dt;\n velo.x += force.x * iMdt * linearFactor.x;\n velo.y += force.y * iMdt * linearFactor.y;\n velo.z += force.z * iMdt * linearFactor.z;\n const e = invInertia.elements;\n const angularFactor = this.angularFactor;\n const tx = torque.x * angularFactor.x;\n const ty = torque.y * angularFactor.y;\n const tz = torque.z * angularFactor.z;\n angularVelo.x += dt * (e[0] * tx + e[1] * ty + e[2] * tz);\n angularVelo.y += dt * (e[3] * tx + e[4] * ty + e[5] * tz);\n angularVelo.z += dt * (e[6] * tx + e[7] * ty + e[8] * tz); // Use new velocity - leap frog\n\n pos.x += velo.x * dt;\n pos.y += velo.y * dt;\n pos.z += velo.z * dt;\n quat.integrate(this.angularVelocity, dt, this.angularFactor, quat);\n\n if (quatNormalize) {\n if (quatNormalizeFast) {\n quat.normalizeFast();\n } else {\n quat.normalize();\n }\n }\n\n this.aabbNeedsUpdate = true; // Update world inertia\n\n this.updateInertiaWorld();\n }\n\n}\nBody.idCounter = 0;\nBody.COLLIDE_EVENT_NAME = 'collide';\nBody.DYNAMIC = BODY_TYPES.DYNAMIC;\nBody.STATIC = BODY_TYPES.STATIC;\nBody.KINEMATIC = BODY_TYPES.KINEMATIC;\nBody.AWAKE = BODY_SLEEP_STATES.AWAKE;\nBody.SLEEPY = BODY_SLEEP_STATES.SLEEPY;\nBody.SLEEPING = BODY_SLEEP_STATES.SLEEPING;\nBody.wakeupEvent = {\n type: 'wakeup'\n};\nBody.sleepyEvent = {\n type: 'sleepy'\n};\nBody.sleepEvent = {\n type: 'sleep'\n};\nconst tmpVec = new Vec3();\nconst tmpQuat = new Quaternion();\nconst updateAABB_shapeAABB = new AABB();\nconst uiw_m1 = new Mat3();\nconst uiw_m2 = new Mat3();\nconst Body_applyForce_rotForce = new Vec3();\nconst Body_applyLocalForce_worldForce = new Vec3();\nconst Body_applyLocalForce_relativePointWorld = new Vec3();\nconst Body_applyImpulse_velo = new Vec3();\nconst Body_applyImpulse_rotVelo = new Vec3();\nconst Body_applyLocalImpulse_worldImpulse = new Vec3();\nconst Body_applyLocalImpulse_relativePoint = new Vec3();\nconst Body_updateMassProperties_halfExtents = new Vec3();\n\n/**\n * Base class for broadphase implementations\n * @author schteppe\n */\nclass Broadphase {\n /**\n * The world to search for collisions in.\n */\n\n /**\n * If set to true, the broadphase uses bounding boxes for intersection tests, else it uses bounding spheres.\n */\n\n /**\n * Set to true if the objects in the world moved.\n */\n constructor() {\n this.world = void 0;\n this.useBoundingBoxes = void 0;\n this.dirty = void 0;\n this.world = null;\n this.useBoundingBoxes = false;\n this.dirty = true;\n }\n /**\n * Get the collision pairs from the world\n * @param world The world to search in\n * @param p1 Empty array to be filled with body objects\n * @param p2 Empty array to be filled with body objects\n */\n\n\n collisionPairs(world, p1, p2) {\n throw new Error('collisionPairs not implemented for this BroadPhase class!');\n }\n /**\n * Check if a body pair needs to be intersection tested at all.\n */\n\n\n needBroadphaseCollision(bodyA, bodyB) {\n // Check collision filter masks\n if ((bodyA.collisionFilterGroup & bodyB.collisionFilterMask) === 0 || (bodyB.collisionFilterGroup & bodyA.collisionFilterMask) === 0) {\n return false;\n } // Check types\n\n\n if (((bodyA.type & Body.STATIC) !== 0 || bodyA.sleepState === Body.SLEEPING) && ((bodyB.type & Body.STATIC) !== 0 || bodyB.sleepState === Body.SLEEPING)) {\n // Both bodies are static or sleeping. Skip.\n return false;\n }\n\n return true;\n }\n /**\n * Check if the bounding volumes of two bodies intersect.\n */\n\n\n intersectionTest(bodyA, bodyB, pairs1, pairs2) {\n if (this.useBoundingBoxes) {\n this.doBoundingBoxBroadphase(bodyA, bodyB, pairs1, pairs2);\n } else {\n this.doBoundingSphereBroadphase(bodyA, bodyB, pairs1, pairs2);\n }\n }\n /**\n * Check if the bounding spheres of two bodies are intersecting.\n * @param pairs1 bodyA is appended to this array if intersection\n * @param pairs2 bodyB is appended to this array if intersection\n */\n\n\n doBoundingSphereBroadphase(bodyA, bodyB, pairs1, pairs2) {\n const r = Broadphase_collisionPairs_r;\n bodyB.position.vsub(bodyA.position, r);\n const boundingRadiusSum2 = (bodyA.boundingRadius + bodyB.boundingRadius) ** 2;\n const norm2 = r.lengthSquared();\n\n if (norm2 < boundingRadiusSum2) {\n pairs1.push(bodyA);\n pairs2.push(bodyB);\n }\n }\n /**\n * Check if the bounding boxes of two bodies are intersecting.\n */\n\n\n doBoundingBoxBroadphase(bodyA, bodyB, pairs1, pairs2) {\n if (bodyA.aabbNeedsUpdate) {\n bodyA.updateAABB();\n }\n\n if (bodyB.aabbNeedsUpdate) {\n bodyB.updateAABB();\n } // Check AABB / AABB\n\n\n if (bodyA.aabb.overlaps(bodyB.aabb)) {\n pairs1.push(bodyA);\n pairs2.push(bodyB);\n }\n }\n /**\n * Removes duplicate pairs from the pair arrays.\n */\n\n\n makePairsUnique(pairs1, pairs2) {\n const t = Broadphase_makePairsUnique_temp;\n const p1 = Broadphase_makePairsUnique_p1;\n const p2 = Broadphase_makePairsUnique_p2;\n const N = pairs1.length;\n\n for (let i = 0; i !== N; i++) {\n p1[i] = pairs1[i];\n p2[i] = pairs2[i];\n }\n\n pairs1.length = 0;\n pairs2.length = 0;\n\n for (let i = 0; i !== N; i++) {\n const id1 = p1[i].id;\n const id2 = p2[i].id;\n const key = id1 < id2 ? id1 + \",\" + id2 : id2 + \",\" + id1;\n t[key] = i;\n t.keys.push(key);\n }\n\n for (let i = 0; i !== t.keys.length; i++) {\n const key = t.keys.pop();\n const pairIndex = t[key];\n pairs1.push(p1[pairIndex]);\n pairs2.push(p2[pairIndex]);\n delete t[key];\n }\n }\n /**\n * To be implemented by subcasses\n */\n\n\n setWorld(world) {}\n /**\n * Check if the bounding spheres of two bodies overlap.\n */\n\n\n static boundingSphereCheck(bodyA, bodyB) {\n const dist = new Vec3(); // bsc_dist;\n\n bodyA.position.vsub(bodyB.position, dist);\n const sa = bodyA.shapes[0];\n const sb = bodyB.shapes[0];\n return Math.pow(sa.boundingSphereRadius + sb.boundingSphereRadius, 2) > dist.lengthSquared();\n }\n /**\n * Returns all the bodies within the AABB.\n */\n\n\n aabbQuery(world, aabb, result) {\n console.warn('.aabbQuery is not implemented in this Broadphase subclass.');\n return [];\n }\n\n} // Temp objects\n\nconst Broadphase_collisionPairs_r = new Vec3();\nconst Broadphase_makePairsUnique_temp = {\n keys: []\n};\nconst Broadphase_makePairsUnique_p1 = [];\nconst Broadphase_makePairsUnique_p2 = [];\n\n/**\n * Axis aligned uniform grid broadphase.\n * @todo Needs support for more than just planes and spheres.\n */\nclass GridBroadphase extends Broadphase {\n /**\n * Number of boxes along x\n */\n\n /**\n * Number of boxes along y\n */\n\n /**\n * Number of boxes along z\n */\n\n /**\n * aabbMin\n */\n\n /**\n * aabbMax\n */\n\n /**\n * bins\n */\n\n /**\n * binLengths\n */\n\n /**\n * @param nx Number of boxes along x.\n * @param ny Number of boxes along y.\n * @param nz Number of boxes along z.\n */\n constructor(aabbMin = new Vec3(100, 100, 100), aabbMax = new Vec3(-100, -100, -100), nx = 10, ny = 10, nz = 10) {\n super();\n this.nx = void 0;\n this.ny = void 0;\n this.nz = void 0;\n this.aabbMin = void 0;\n this.aabbMax = void 0;\n this.bins = void 0;\n this.binLengths = void 0;\n this.nx = nx;\n this.ny = ny;\n this.nz = nz;\n this.aabbMin = aabbMin;\n this.aabbMax = aabbMax;\n const nbins = this.nx * this.ny * this.nz;\n\n if (nbins <= 0) {\n throw \"GridBroadphase: Each dimension's n must be >0\";\n }\n\n this.bins = [];\n this.binLengths = []; // Rather than continually resizing arrays (thrashing the memory), just record length and allow them to grow\n\n this.bins.length = nbins;\n this.binLengths.length = nbins;\n\n for (let i = 0; i < nbins; i++) {\n this.bins[i] = [];\n this.binLengths[i] = 0;\n }\n }\n /**\n * Get all the collision pairs in the physics world\n */\n\n\n collisionPairs(world, pairs1, pairs2) {\n const N = world.numObjects();\n const bodies = world.bodies;\n const max = this.aabbMax;\n const min = this.aabbMin;\n const nx = this.nx;\n const ny = this.ny;\n const nz = this.nz;\n const xstep = ny * nz;\n const ystep = nz;\n const zstep = 1;\n const xmax = max.x;\n const ymax = max.y;\n const zmax = max.z;\n const xmin = min.x;\n const ymin = min.y;\n const zmin = min.z;\n const xmult = nx / (xmax - xmin);\n const ymult = ny / (ymax - ymin);\n const zmult = nz / (zmax - zmin);\n const binsizeX = (xmax - xmin) / nx;\n const binsizeY = (ymax - ymin) / ny;\n const binsizeZ = (zmax - zmin) / nz;\n const binRadius = Math.sqrt(binsizeX * binsizeX + binsizeY * binsizeY + binsizeZ * binsizeZ) * 0.5;\n const types = Shape.types;\n const SPHERE = types.SPHERE;\n const PLANE = types.PLANE;\n types.BOX;\n types.COMPOUND;\n types.CONVEXPOLYHEDRON;\n const bins = this.bins;\n const binLengths = this.binLengths;\n const Nbins = this.bins.length; // Reset bins\n\n for (let i = 0; i !== Nbins; i++) {\n binLengths[i] = 0;\n }\n\n const ceil = Math.ceil;\n\n function addBoxToBins(x0, y0, z0, x1, y1, z1, bi) {\n let xoff0 = (x0 - xmin) * xmult | 0;\n let yoff0 = (y0 - ymin) * ymult | 0;\n let zoff0 = (z0 - zmin) * zmult | 0;\n let xoff1 = ceil((x1 - xmin) * xmult);\n let yoff1 = ceil((y1 - ymin) * ymult);\n let zoff1 = ceil((z1 - zmin) * zmult);\n\n if (xoff0 < 0) {\n xoff0 = 0;\n } else if (xoff0 >= nx) {\n xoff0 = nx - 1;\n }\n\n if (yoff0 < 0) {\n yoff0 = 0;\n } else if (yoff0 >= ny) {\n yoff0 = ny - 1;\n }\n\n if (zoff0 < 0) {\n zoff0 = 0;\n } else if (zoff0 >= nz) {\n zoff0 = nz - 1;\n }\n\n if (xoff1 < 0) {\n xoff1 = 0;\n } else if (xoff1 >= nx) {\n xoff1 = nx - 1;\n }\n\n if (yoff1 < 0) {\n yoff1 = 0;\n } else if (yoff1 >= ny) {\n yoff1 = ny - 1;\n }\n\n if (zoff1 < 0) {\n zoff1 = 0;\n } else if (zoff1 >= nz) {\n zoff1 = nz - 1;\n }\n\n xoff0 *= xstep;\n yoff0 *= ystep;\n zoff0 *= zstep;\n xoff1 *= xstep;\n yoff1 *= ystep;\n zoff1 *= zstep;\n\n for (let xoff = xoff0; xoff <= xoff1; xoff += xstep) {\n for (let yoff = yoff0; yoff <= yoff1; yoff += ystep) {\n for (let zoff = zoff0; zoff <= zoff1; zoff += zstep) {\n const idx = xoff + yoff + zoff;\n bins[idx][binLengths[idx]++] = bi;\n }\n }\n }\n } // Put all bodies into the bins\n\n\n for (let i = 0; i !== N; i++) {\n const bi = bodies[i];\n const si = bi.shapes[0];\n\n switch (si.type) {\n case SPHERE:\n {\n const shape = si; // Put in bin\n // check if overlap with other bins\n\n const x = bi.position.x;\n const y = bi.position.y;\n const z = bi.position.z;\n const r = shape.radius;\n addBoxToBins(x - r, y - r, z - r, x + r, y + r, z + r, bi);\n break;\n }\n\n case PLANE:\n {\n const shape = si;\n\n if (shape.worldNormalNeedsUpdate) {\n shape.computeWorldNormal(bi.quaternion);\n }\n\n const planeNormal = shape.worldNormal; //Relative position from origin of plane object to the first bin\n //Incremented as we iterate through the bins\n\n const xreset = xmin + binsizeX * 0.5 - bi.position.x;\n const yreset = ymin + binsizeY * 0.5 - bi.position.y;\n const zreset = zmin + binsizeZ * 0.5 - bi.position.z;\n const d = GridBroadphase_collisionPairs_d;\n d.set(xreset, yreset, zreset);\n\n for (let xi = 0, xoff = 0; xi !== nx; xi++, xoff += xstep, d.y = yreset, d.x += binsizeX) {\n for (let yi = 0, yoff = 0; yi !== ny; yi++, yoff += ystep, d.z = zreset, d.y += binsizeY) {\n for (let zi = 0, zoff = 0; zi !== nz; zi++, zoff += zstep, d.z += binsizeZ) {\n if (d.dot(planeNormal) < binRadius) {\n const idx = xoff + yoff + zoff;\n bins[idx][binLengths[idx]++] = bi;\n }\n }\n }\n }\n\n break;\n }\n\n default:\n {\n if (bi.aabbNeedsUpdate) {\n bi.updateAABB();\n }\n\n addBoxToBins(bi.aabb.lowerBound.x, bi.aabb.lowerBound.y, bi.aabb.lowerBound.z, bi.aabb.upperBound.x, bi.aabb.upperBound.y, bi.aabb.upperBound.z, bi);\n break;\n }\n }\n } // Check each bin\n\n\n for (let i = 0; i !== Nbins; i++) {\n const binLength = binLengths[i]; //Skip bins with no potential collisions\n\n if (binLength > 1) {\n const bin = bins[i]; // Do N^2 broadphase inside\n\n for (let xi = 0; xi !== binLength; xi++) {\n const bi = bin[xi];\n\n for (let yi = 0; yi !== xi; yi++) {\n const bj = bin[yi];\n\n if (this.needBroadphaseCollision(bi, bj)) {\n this.intersectionTest(bi, bj, pairs1, pairs2);\n }\n }\n }\n }\n } //\tfor (let zi = 0, zoff=0; zi < nz; zi++, zoff+= zstep) {\n //\t\tconsole.log(\"layer \"+zi);\n //\t\tfor (let yi = 0, yoff=0; yi < ny; yi++, yoff += ystep) {\n //\t\t\tconst row = '';\n //\t\t\tfor (let xi = 0, xoff=0; xi < nx; xi++, xoff += xstep) {\n //\t\t\t\tconst idx = xoff + yoff + zoff;\n //\t\t\t\trow += ' ' + binLengths[idx];\n //\t\t\t}\n //\t\t\tconsole.log(row);\n //\t\t}\n //\t}\n\n\n this.makePairsUnique(pairs1, pairs2);\n }\n\n}\nconst GridBroadphase_collisionPairs_d = new Vec3();\n\n/**\n * Naive broadphase implementation, used in lack of better ones.\n *\n * The naive broadphase looks at all possible pairs without restriction, therefore it has complexity N^2 _(which is bad)_\n */\nclass NaiveBroadphase extends Broadphase {\n /**\n * @todo Remove useless constructor\n */\n constructor() {\n super();\n }\n /**\n * Get all the collision pairs in the physics world\n */\n\n\n collisionPairs(world, pairs1, pairs2) {\n const bodies = world.bodies;\n const n = bodies.length;\n let bi;\n let bj; // Naive N^2 ftw!\n\n for (let i = 0; i !== n; i++) {\n for (let j = 0; j !== i; j++) {\n bi = bodies[i];\n bj = bodies[j];\n\n if (!this.needBroadphaseCollision(bi, bj)) {\n continue;\n }\n\n this.intersectionTest(bi, bj, pairs1, pairs2);\n }\n }\n }\n /**\n * Returns all the bodies within an AABB.\n * @param result An array to store resulting bodies in.\n */\n\n\n aabbQuery(world, aabb, result = []) {\n for (let i = 0; i < world.bodies.length; i++) {\n const b = world.bodies[i];\n\n if (b.aabbNeedsUpdate) {\n b.updateAABB();\n } // Ugly hack until Body gets aabb\n\n\n if (b.aabb.overlaps(aabb)) {\n result.push(b);\n }\n }\n\n return result;\n }\n\n}\n\n/**\n * Storage for Ray casting data\n */\nclass RaycastResult {\n /**\n * rayFromWorld\n */\n\n /**\n * rayToWorld\n */\n\n /**\n * hitNormalWorld\n */\n\n /**\n * hitPointWorld\n */\n\n /**\n * hasHit\n */\n\n /**\n * shape\n */\n\n /**\n * body\n */\n\n /**\n * The index of the hit triangle, if the hit shape was a trimesh\n */\n\n /**\n * Distance to the hit. Will be set to -1 if there was no hit\n */\n\n /**\n * If the ray should stop traversing the bodies\n */\n constructor() {\n this.rayFromWorld = void 0;\n this.rayToWorld = void 0;\n this.hitNormalWorld = void 0;\n this.hitPointWorld = void 0;\n this.hasHit = void 0;\n this.shape = void 0;\n this.body = void 0;\n this.hitFaceIndex = void 0;\n this.distance = void 0;\n this.shouldStop = void 0;\n this.rayFromWorld = new Vec3();\n this.rayToWorld = new Vec3();\n this.hitNormalWorld = new Vec3();\n this.hitPointWorld = new Vec3();\n this.hasHit = false;\n this.shape = null;\n this.body = null;\n this.hitFaceIndex = -1;\n this.distance = -1;\n this.shouldStop = false;\n }\n /**\n * Reset all result data.\n */\n\n\n reset() {\n this.rayFromWorld.setZero();\n this.rayToWorld.setZero();\n this.hitNormalWorld.setZero();\n this.hitPointWorld.setZero();\n this.hasHit = false;\n this.shape = null;\n this.body = null;\n this.hitFaceIndex = -1;\n this.distance = -1;\n this.shouldStop = false;\n }\n /**\n * abort\n */\n\n\n abort() {\n this.shouldStop = true;\n }\n /**\n * Set result data.\n */\n\n\n set(rayFromWorld, rayToWorld, hitNormalWorld, hitPointWorld, shape, body, distance) {\n this.rayFromWorld.copy(rayFromWorld);\n this.rayToWorld.copy(rayToWorld);\n this.hitNormalWorld.copy(hitNormalWorld);\n this.hitPointWorld.copy(hitPointWorld);\n this.shape = shape;\n this.body = body;\n this.distance = distance;\n }\n\n}\n\nlet _Shape$types$SPHERE, _Shape$types$PLANE, _Shape$types$BOX, _Shape$types$CYLINDER, _Shape$types$CONVEXPO, _Shape$types$HEIGHTFI, _Shape$types$TRIMESH;\n\n/**\n * RAY_MODES\n */\nconst RAY_MODES = {\n /** CLOSEST */\n CLOSEST: 1,\n\n /** ANY */\n ANY: 2,\n\n /** ALL */\n ALL: 4\n};\n/**\n * RayMode\n */\n\n_Shape$types$SPHERE = Shape.types.SPHERE;\n_Shape$types$PLANE = Shape.types.PLANE;\n_Shape$types$BOX = Shape.types.BOX;\n_Shape$types$CYLINDER = Shape.types.CYLINDER;\n_Shape$types$CONVEXPO = Shape.types.CONVEXPOLYHEDRON;\n_Shape$types$HEIGHTFI = Shape.types.HEIGHTFIELD;\n_Shape$types$TRIMESH = Shape.types.TRIMESH;\n\n/**\n * A line in 3D space that intersects bodies and return points.\n */\nclass Ray {\n /**\n * from\n */\n\n /**\n * to\n */\n\n /**\n * direction\n */\n\n /**\n * The precision of the ray. Used when checking parallelity etc.\n * @default 0.0001\n */\n\n /**\n * Set to `false` if you don't want the Ray to take `collisionResponse` flags into account on bodies and shapes.\n * @default true\n */\n\n /**\n * If set to `true`, the ray skips any hits with normal.dot(rayDirection) < 0.\n * @default false\n */\n\n /**\n * collisionFilterMask\n * @default -1\n */\n\n /**\n * collisionFilterGroup\n * @default -1\n */\n\n /**\n * The intersection mode. Should be Ray.ANY, Ray.ALL or Ray.CLOSEST.\n * @default RAY.ANY\n */\n\n /**\n * Current result object.\n */\n\n /**\n * Will be set to `true` during intersectWorld() if the ray hit anything.\n */\n\n /**\n * User-provided result callback. Will be used if mode is Ray.ALL.\n */\n\n /**\n * CLOSEST\n */\n\n /**\n * ANY\n */\n\n /**\n * ALL\n */\n get [_Shape$types$SPHERE]() {\n return this._intersectSphere;\n }\n\n get [_Shape$types$PLANE]() {\n return this._intersectPlane;\n }\n\n get [_Shape$types$BOX]() {\n return this._intersectBox;\n }\n\n get [_Shape$types$CYLINDER]() {\n return this._intersectConvex;\n }\n\n get [_Shape$types$CONVEXPO]() {\n return this._intersectConvex;\n }\n\n get [_Shape$types$HEIGHTFI]() {\n return this._intersectHeightfield;\n }\n\n get [_Shape$types$TRIMESH]() {\n return this._intersectTrimesh;\n }\n\n constructor(from = new Vec3(), to = new Vec3()) {\n this.from = void 0;\n this.to = void 0;\n this.direction = void 0;\n this.precision = void 0;\n this.checkCollisionResponse = void 0;\n this.skipBackfaces = void 0;\n this.collisionFilterMask = void 0;\n this.collisionFilterGroup = void 0;\n this.mode = void 0;\n this.result = void 0;\n this.hasHit = void 0;\n this.callback = void 0;\n this.from = from.clone();\n this.to = to.clone();\n this.direction = new Vec3();\n this.precision = 0.0001;\n this.checkCollisionResponse = true;\n this.skipBackfaces = false;\n this.collisionFilterMask = -1;\n this.collisionFilterGroup = -1;\n this.mode = Ray.ANY;\n this.result = new RaycastResult();\n this.hasHit = false;\n\n this.callback = result => {};\n }\n /**\n * Do itersection against all bodies in the given World.\n * @return True if the ray hit anything, otherwise false.\n */\n\n\n intersectWorld(world, options) {\n this.mode = options.mode || Ray.ANY;\n this.result = options.result || new RaycastResult();\n this.skipBackfaces = !!options.skipBackfaces;\n this.collisionFilterMask = typeof options.collisionFilterMask !== 'undefined' ? options.collisionFilterMask : -1;\n this.collisionFilterGroup = typeof options.collisionFilterGroup !== 'undefined' ? options.collisionFilterGroup : -1;\n this.checkCollisionResponse = typeof options.checkCollisionResponse !== 'undefined' ? options.checkCollisionResponse : true;\n\n if (options.from) {\n this.from.copy(options.from);\n }\n\n if (options.to) {\n this.to.copy(options.to);\n }\n\n this.callback = options.callback || (() => {});\n\n this.hasHit = false;\n this.result.reset();\n this.updateDirection();\n this.getAABB(tmpAABB$1);\n tmpArray.length = 0;\n world.broadphase.aabbQuery(world, tmpAABB$1, tmpArray);\n this.intersectBodies(tmpArray);\n return this.hasHit;\n }\n /**\n * Shoot a ray at a body, get back information about the hit.\n * @deprecated @param result set the result property of the Ray instead.\n */\n\n\n intersectBody(body, result) {\n if (result) {\n this.result = result;\n this.updateDirection();\n }\n\n const checkCollisionResponse = this.checkCollisionResponse;\n\n if (checkCollisionResponse && !body.collisionResponse) {\n return;\n }\n\n if ((this.collisionFilterGroup & body.collisionFilterMask) === 0 || (body.collisionFilterGroup & this.collisionFilterMask) === 0) {\n return;\n }\n\n const xi = intersectBody_xi;\n const qi = intersectBody_qi;\n\n for (let i = 0, N = body.shapes.length; i < N; i++) {\n const shape = body.shapes[i];\n\n if (checkCollisionResponse && !shape.collisionResponse) {\n continue; // Skip\n }\n\n body.quaternion.mult(body.shapeOrientations[i], qi);\n body.quaternion.vmult(body.shapeOffsets[i], xi);\n xi.vadd(body.position, xi);\n this.intersectShape(shape, qi, xi, body);\n\n if (this.result.shouldStop) {\n break;\n }\n }\n }\n /**\n * Shoot a ray at an array bodies, get back information about the hit.\n * @param bodies An array of Body objects.\n * @deprecated @param result set the result property of the Ray instead.\n *\n */\n\n\n intersectBodies(bodies, result) {\n if (result) {\n this.result = result;\n this.updateDirection();\n }\n\n for (let i = 0, l = bodies.length; !this.result.shouldStop && i < l; i++) {\n this.intersectBody(bodies[i]);\n }\n }\n /**\n * Updates the direction vector.\n */\n\n\n updateDirection() {\n this.to.vsub(this.from, this.direction);\n this.direction.normalize();\n }\n\n intersectShape(shape, quat, position, body) {\n const from = this.from; // Checking boundingSphere\n\n const distance = distanceFromIntersection(from, this.direction, position);\n\n if (distance > shape.boundingSphereRadius) {\n return;\n }\n\n const intersectMethod = this[shape.type];\n\n if (intersectMethod) {\n intersectMethod.call(this, shape, quat, position, body, shape);\n }\n }\n\n _intersectBox(box, quat, position, body, reportedShape) {\n return this._intersectConvex(box.convexPolyhedronRepresentation, quat, position, body, reportedShape);\n }\n\n _intersectPlane(shape, quat, position, body, reportedShape) {\n const from = this.from;\n const to = this.to;\n const direction = this.direction; // Get plane normal\n\n const worldNormal = new Vec3(0, 0, 1);\n quat.vmult(worldNormal, worldNormal);\n const len = new Vec3();\n from.vsub(position, len);\n const planeToFrom = len.dot(worldNormal);\n to.vsub(position, len);\n const planeToTo = len.dot(worldNormal);\n\n if (planeToFrom * planeToTo > 0) {\n // \"from\" and \"to\" are on the same side of the plane... bail out\n return;\n }\n\n if (from.distanceTo(to) < planeToFrom) {\n return;\n }\n\n const n_dot_dir = worldNormal.dot(direction);\n\n if (Math.abs(n_dot_dir) < this.precision) {\n // No intersection\n return;\n }\n\n const planePointToFrom = new Vec3();\n const dir_scaled_with_t = new Vec3();\n const hitPointWorld = new Vec3();\n from.vsub(position, planePointToFrom);\n const t = -worldNormal.dot(planePointToFrom) / n_dot_dir;\n direction.scale(t, dir_scaled_with_t);\n from.vadd(dir_scaled_with_t, hitPointWorld);\n this.reportIntersection(worldNormal, hitPointWorld, reportedShape, body, -1);\n }\n /**\n * Get the world AABB of the ray.\n */\n\n\n getAABB(aabb) {\n const {\n lowerBound,\n upperBound\n } = aabb;\n const to = this.to;\n const from = this.from;\n lowerBound.x = Math.min(to.x, from.x);\n lowerBound.y = Math.min(to.y, from.y);\n lowerBound.z = Math.min(to.z, from.z);\n upperBound.x = Math.max(to.x, from.x);\n upperBound.y = Math.max(to.y, from.y);\n upperBound.z = Math.max(to.z, from.z);\n }\n\n _intersectHeightfield(shape, quat, position, body, reportedShape) {\n shape.data;\n shape.elementSize; // Convert the ray to local heightfield coordinates\n\n const localRay = intersectHeightfield_localRay; //new Ray(this.from, this.to);\n\n localRay.from.copy(this.from);\n localRay.to.copy(this.to);\n Transform.pointToLocalFrame(position, quat, localRay.from, localRay.from);\n Transform.pointToLocalFrame(position, quat, localRay.to, localRay.to);\n localRay.updateDirection(); // Get the index of the data points to test against\n\n const index = intersectHeightfield_index;\n let iMinX;\n let iMinY;\n let iMaxX;\n let iMaxY; // Set to max\n\n iMinX = iMinY = 0;\n iMaxX = iMaxY = shape.data.length - 1;\n const aabb = new AABB();\n localRay.getAABB(aabb);\n shape.getIndexOfPosition(aabb.lowerBound.x, aabb.lowerBound.y, index, true);\n iMinX = Math.max(iMinX, index[0]);\n iMinY = Math.max(iMinY, index[1]);\n shape.getIndexOfPosition(aabb.upperBound.x, aabb.upperBound.y, index, true);\n iMaxX = Math.min(iMaxX, index[0] + 1);\n iMaxY = Math.min(iMaxY, index[1] + 1);\n\n for (let i = iMinX; i < iMaxX; i++) {\n for (let j = iMinY; j < iMaxY; j++) {\n if (this.result.shouldStop) {\n return;\n }\n\n shape.getAabbAtIndex(i, j, aabb);\n\n if (!aabb.overlapsRay(localRay)) {\n continue;\n } // Lower triangle\n\n\n shape.getConvexTrianglePillar(i, j, false);\n Transform.pointToWorldFrame(position, quat, shape.pillarOffset, worldPillarOffset);\n\n this._intersectConvex(shape.pillarConvex, quat, worldPillarOffset, body, reportedShape, intersectConvexOptions);\n\n if (this.result.shouldStop) {\n return;\n } // Upper triangle\n\n\n shape.getConvexTrianglePillar(i, j, true);\n Transform.pointToWorldFrame(position, quat, shape.pillarOffset, worldPillarOffset);\n\n this._intersectConvex(shape.pillarConvex, quat, worldPillarOffset, body, reportedShape, intersectConvexOptions);\n }\n }\n }\n\n _intersectSphere(sphere, quat, position, body, reportedShape) {\n const from = this.from;\n const to = this.to;\n const r = sphere.radius;\n const a = (to.x - from.x) ** 2 + (to.y - from.y) ** 2 + (to.z - from.z) ** 2;\n const b = 2 * ((to.x - from.x) * (from.x - position.x) + (to.y - from.y) * (from.y - position.y) + (to.z - from.z) * (from.z - position.z));\n const c = (from.x - position.x) ** 2 + (from.y - position.y) ** 2 + (from.z - position.z) ** 2 - r ** 2;\n const delta = b ** 2 - 4 * a * c;\n const intersectionPoint = Ray_intersectSphere_intersectionPoint;\n const normal = Ray_intersectSphere_normal;\n\n if (delta < 0) {\n // No intersection\n return;\n } else if (delta === 0) {\n // single intersection point\n from.lerp(to, delta, intersectionPoint);\n intersectionPoint.vsub(position, normal);\n normal.normalize();\n this.reportIntersection(normal, intersectionPoint, reportedShape, body, -1);\n } else {\n const d1 = (-b - Math.sqrt(delta)) / (2 * a);\n const d2 = (-b + Math.sqrt(delta)) / (2 * a);\n\n if (d1 >= 0 && d1 <= 1) {\n from.lerp(to, d1, intersectionPoint);\n intersectionPoint.vsub(position, normal);\n normal.normalize();\n this.reportIntersection(normal, intersectionPoint, reportedShape, body, -1);\n }\n\n if (this.result.shouldStop) {\n return;\n }\n\n if (d2 >= 0 && d2 <= 1) {\n from.lerp(to, d2, intersectionPoint);\n intersectionPoint.vsub(position, normal);\n normal.normalize();\n this.reportIntersection(normal, intersectionPoint, reportedShape, body, -1);\n }\n }\n }\n\n _intersectConvex(shape, quat, position, body, reportedShape, options) {\n const normal = intersectConvex_normal;\n const vector = intersectConvex_vector;\n const faceList = options && options.faceList || null; // Checking faces\n\n const faces = shape.faces;\n const vertices = shape.vertices;\n const normals = shape.faceNormals;\n const direction = this.direction;\n const from = this.from;\n const to = this.to;\n const fromToDistance = from.distanceTo(to);\n const Nfaces = faceList ? faceList.length : faces.length;\n const result = this.result;\n\n for (let j = 0; !result.shouldStop && j < Nfaces; j++) {\n const fi = faceList ? faceList[j] : j;\n const face = faces[fi];\n const faceNormal = normals[fi];\n const q = quat;\n const x = position; // determine if ray intersects the plane of the face\n // note: this works regardless of the direction of the face normal\n // Get plane point in world coordinates...\n\n vector.copy(vertices[face[0]]);\n q.vmult(vector, vector);\n vector.vadd(x, vector); // ...but make it relative to the ray from. We'll fix this later.\n\n vector.vsub(from, vector); // Get plane normal\n\n q.vmult(faceNormal, normal); // If this dot product is negative, we have something interesting\n\n const dot = direction.dot(normal); // Bail out if ray and plane are parallel\n\n if (Math.abs(dot) < this.precision) {\n continue;\n } // calc distance to plane\n\n\n const scalar = normal.dot(vector) / dot; // if negative distance, then plane is behind ray\n\n if (scalar < 0) {\n continue;\n } // if (dot < 0) {\n // Intersection point is from + direction * scalar\n\n\n direction.scale(scalar, intersectPoint);\n intersectPoint.vadd(from, intersectPoint); // a is the point we compare points b and c with.\n\n a.copy(vertices[face[0]]);\n q.vmult(a, a);\n x.vadd(a, a);\n\n for (let i = 1; !result.shouldStop && i < face.length - 1; i++) {\n // Transform 3 vertices to world coords\n b.copy(vertices[face[i]]);\n c.copy(vertices[face[i + 1]]);\n q.vmult(b, b);\n q.vmult(c, c);\n x.vadd(b, b);\n x.vadd(c, c);\n const distance = intersectPoint.distanceTo(from);\n\n if (!(Ray.pointInTriangle(intersectPoint, a, b, c) || Ray.pointInTriangle(intersectPoint, b, a, c)) || distance > fromToDistance) {\n continue;\n }\n\n this.reportIntersection(normal, intersectPoint, reportedShape, body, fi);\n } // }\n\n }\n }\n /**\n * @todo Optimize by transforming the world to local space first.\n * @todo Use Octree lookup\n */\n\n\n _intersectTrimesh(mesh, quat, position, body, reportedShape, options) {\n const normal = intersectTrimesh_normal;\n const triangles = intersectTrimesh_triangles;\n const treeTransform = intersectTrimesh_treeTransform;\n const vector = intersectConvex_vector;\n const localDirection = intersectTrimesh_localDirection;\n const localFrom = intersectTrimesh_localFrom;\n const localTo = intersectTrimesh_localTo;\n const worldIntersectPoint = intersectTrimesh_worldIntersectPoint;\n const worldNormal = intersectTrimesh_worldNormal; // Checking faces\n\n const indices = mesh.indices;\n mesh.vertices; // const normals = mesh.faceNormals\n\n const from = this.from;\n const to = this.to;\n const direction = this.direction;\n treeTransform.position.copy(position);\n treeTransform.quaternion.copy(quat); // Transform ray to local space!\n\n Transform.vectorToLocalFrame(position, quat, direction, localDirection);\n Transform.pointToLocalFrame(position, quat, from, localFrom);\n Transform.pointToLocalFrame(position, quat, to, localTo);\n localTo.x *= mesh.scale.x;\n localTo.y *= mesh.scale.y;\n localTo.z *= mesh.scale.z;\n localFrom.x *= mesh.scale.x;\n localFrom.y *= mesh.scale.y;\n localFrom.z *= mesh.scale.z;\n localTo.vsub(localFrom, localDirection);\n localDirection.normalize();\n const fromToDistanceSquared = localFrom.distanceSquared(localTo);\n mesh.tree.rayQuery(this, treeTransform, triangles);\n\n for (let i = 0, N = triangles.length; !this.result.shouldStop && i !== N; i++) {\n const trianglesIndex = triangles[i];\n mesh.getNormal(trianglesIndex, normal); // determine if ray intersects the plane of the face\n // note: this works regardless of the direction of the face normal\n // Get plane point in world coordinates...\n\n mesh.getVertex(indices[trianglesIndex * 3], a); // ...but make it relative to the ray from. We'll fix this later.\n\n a.vsub(localFrom, vector); // If this dot product is negative, we have something interesting\n\n const dot = localDirection.dot(normal); // Bail out if ray and plane are parallel\n // if (Math.abs( dot ) < this.precision){\n // continue;\n // }\n // calc distance to plane\n\n const scalar = normal.dot(vector) / dot; // if negative distance, then plane is behind ray\n\n if (scalar < 0) {\n continue;\n } // Intersection point is from + direction * scalar\n\n\n localDirection.scale(scalar, intersectPoint);\n intersectPoint.vadd(localFrom, intersectPoint); // Get triangle vertices\n\n mesh.getVertex(indices[trianglesIndex * 3 + 1], b);\n mesh.getVertex(indices[trianglesIndex * 3 + 2], c);\n const squaredDistance = intersectPoint.distanceSquared(localFrom);\n\n if (!(Ray.pointInTriangle(intersectPoint, b, a, c) || Ray.pointInTriangle(intersectPoint, a, b, c)) || squaredDistance > fromToDistanceSquared) {\n continue;\n } // transform intersectpoint and normal to world\n\n\n Transform.vectorToWorldFrame(quat, normal, worldNormal);\n Transform.pointToWorldFrame(position, quat, intersectPoint, worldIntersectPoint);\n this.reportIntersection(worldNormal, worldIntersectPoint, reportedShape, body, trianglesIndex);\n }\n\n triangles.length = 0;\n }\n /**\n * @return True if the intersections should continue\n */\n\n\n reportIntersection(normal, hitPointWorld, shape, body, hitFaceIndex) {\n const from = this.from;\n const to = this.to;\n const distance = from.distanceTo(hitPointWorld);\n const result = this.result; // Skip back faces?\n\n if (this.skipBackfaces && normal.dot(this.direction) > 0) {\n return;\n }\n\n result.hitFaceIndex = typeof hitFaceIndex !== 'undefined' ? hitFaceIndex : -1;\n\n switch (this.mode) {\n case Ray.ALL:\n this.hasHit = true;\n result.set(from, to, normal, hitPointWorld, shape, body, distance);\n result.hasHit = true;\n this.callback(result);\n break;\n\n case Ray.CLOSEST:\n // Store if closer than current closest\n if (distance < result.distance || !result.hasHit) {\n this.hasHit = true;\n result.hasHit = true;\n result.set(from, to, normal, hitPointWorld, shape, body, distance);\n }\n\n break;\n\n case Ray.ANY:\n // Report and stop.\n this.hasHit = true;\n result.hasHit = true;\n result.set(from, to, normal, hitPointWorld, shape, body, distance);\n result.shouldStop = true;\n break;\n }\n }\n /**\n * As per \"Barycentric Technique\" as named\n * {@link https://www.blackpawn.com/texts/pointinpoly/default.html here} but without the division\n */\n\n\n static pointInTriangle(p, a, b, c) {\n c.vsub(a, v0);\n b.vsub(a, v1);\n p.vsub(a, v2);\n const dot00 = v0.dot(v0);\n const dot01 = v0.dot(v1);\n const dot02 = v0.dot(v2);\n const dot11 = v1.dot(v1);\n const dot12 = v1.dot(v2);\n let u;\n let v;\n return (u = dot11 * dot02 - dot01 * dot12) >= 0 && (v = dot00 * dot12 - dot01 * dot02) >= 0 && u + v < dot00 * dot11 - dot01 * dot01;\n }\n\n}\nRay.CLOSEST = RAY_MODES.CLOSEST;\nRay.ANY = RAY_MODES.ANY;\nRay.ALL = RAY_MODES.ALL;\nconst tmpAABB$1 = new AABB();\nconst tmpArray = [];\nconst v1 = new Vec3();\nconst v2 = new Vec3();\nconst intersectBody_xi = new Vec3();\nconst intersectBody_qi = new Quaternion();\nconst intersectPoint = new Vec3();\nconst a = new Vec3();\nconst b = new Vec3();\nconst c = new Vec3();\nconst intersectConvexOptions = {\n faceList: [0]\n};\nconst worldPillarOffset = new Vec3();\nconst intersectHeightfield_localRay = new Ray();\nconst intersectHeightfield_index = [];\nconst Ray_intersectSphere_intersectionPoint = new Vec3();\nconst Ray_intersectSphere_normal = new Vec3();\nconst intersectConvex_normal = new Vec3();\nconst intersectConvex_vector = new Vec3();\nconst intersectTrimesh_normal = new Vec3();\nconst intersectTrimesh_localDirection = new Vec3();\nconst intersectTrimesh_localFrom = new Vec3();\nconst intersectTrimesh_localTo = new Vec3();\nconst intersectTrimesh_worldNormal = new Vec3();\nconst intersectTrimesh_worldIntersectPoint = new Vec3();\nnew AABB();\nconst intersectTrimesh_triangles = [];\nconst intersectTrimesh_treeTransform = new Transform();\nconst v0 = new Vec3();\nconst intersect = new Vec3();\n\nfunction distanceFromIntersection(from, direction, position) {\n // v0 is vector from from to position\n position.vsub(from, v0);\n const dot = v0.dot(direction); // intersect = direction*dot + from\n\n direction.scale(dot, intersect);\n intersect.vadd(from, intersect);\n const distance = position.distanceTo(intersect);\n return distance;\n}\n\n/**\n * Sweep and prune broadphase along one axis.\n */\nclass SAPBroadphase extends Broadphase {\n /**\n * List of bodies currently in the broadphase.\n */\n\n /**\n * The world to search in.\n */\n\n /**\n * Axis to sort the bodies along.\n * Set to 0 for x axis, and 1 for y axis.\n * For best performance, pick the axis where bodies are most distributed.\n */\n\n /**\n * Check if the bounds of two bodies overlap, along the given SAP axis.\n */\n static checkBounds(bi, bj, axisIndex) {\n let biPos;\n let bjPos;\n\n if (axisIndex === 0) {\n biPos = bi.position.x;\n bjPos = bj.position.x;\n } else if (axisIndex === 1) {\n biPos = bi.position.y;\n bjPos = bj.position.y;\n } else if (axisIndex === 2) {\n biPos = bi.position.z;\n bjPos = bj.position.z;\n }\n\n const ri = bi.boundingRadius,\n rj = bj.boundingRadius,\n boundA2 = biPos + ri,\n boundB1 = bjPos - rj;\n return boundB1 < boundA2;\n } // Note: these are identical, save for x/y/z lowerbound\n\n /**\n * insertionSortX\n */\n\n\n static insertionSortX(a) {\n for (let i = 1, l = a.length; i < l; i++) {\n const v = a[i];\n let j;\n\n for (j = i - 1; j >= 0; j--) {\n if (a[j].aabb.lowerBound.x <= v.aabb.lowerBound.x) {\n break;\n }\n\n a[j + 1] = a[j];\n }\n\n a[j + 1] = v;\n }\n\n return a;\n }\n /**\n * insertionSortY\n */\n\n\n static insertionSortY(a) {\n for (let i = 1, l = a.length; i < l; i++) {\n const v = a[i];\n let j;\n\n for (j = i - 1; j >= 0; j--) {\n if (a[j].aabb.lowerBound.y <= v.aabb.lowerBound.y) {\n break;\n }\n\n a[j + 1] = a[j];\n }\n\n a[j + 1] = v;\n }\n\n return a;\n }\n /**\n * insertionSortZ\n */\n\n\n static insertionSortZ(a) {\n for (let i = 1, l = a.length; i < l; i++) {\n const v = a[i];\n let j;\n\n for (j = i - 1; j >= 0; j--) {\n if (a[j].aabb.lowerBound.z <= v.aabb.lowerBound.z) {\n break;\n }\n\n a[j + 1] = a[j];\n }\n\n a[j + 1] = v;\n }\n\n return a;\n }\n\n constructor(world) {\n super();\n this.axisList = void 0;\n this.world = void 0;\n this.axisIndex = void 0;\n this._addBodyHandler = void 0;\n this._removeBodyHandler = void 0;\n this.axisList = [];\n this.world = null;\n this.axisIndex = 0;\n const axisList = this.axisList;\n\n this._addBodyHandler = event => {\n axisList.push(event.body);\n };\n\n this._removeBodyHandler = event => {\n const idx = axisList.indexOf(event.body);\n\n if (idx !== -1) {\n axisList.splice(idx, 1);\n }\n };\n\n if (world) {\n this.setWorld(world);\n }\n }\n /**\n * Change the world\n */\n\n\n setWorld(world) {\n // Clear the old axis array\n this.axisList.length = 0; // Add all bodies from the new world\n\n for (let i = 0; i < world.bodies.length; i++) {\n this.axisList.push(world.bodies[i]);\n } // Remove old handlers, if any\n\n\n world.removeEventListener('addBody', this._addBodyHandler);\n world.removeEventListener('removeBody', this._removeBodyHandler); // Add handlers to update the list of bodies.\n\n world.addEventListener('addBody', this._addBodyHandler);\n world.addEventListener('removeBody', this._removeBodyHandler);\n this.world = world;\n this.dirty = true;\n }\n /**\n * Collect all collision pairs\n */\n\n\n collisionPairs(world, p1, p2) {\n const bodies = this.axisList;\n const N = bodies.length;\n const axisIndex = this.axisIndex;\n let i;\n let j;\n\n if (this.dirty) {\n this.sortList();\n this.dirty = false;\n } // Look through the list\n\n\n for (i = 0; i !== N; i++) {\n const bi = bodies[i];\n\n for (j = i + 1; j < N; j++) {\n const bj = bodies[j];\n\n if (!this.needBroadphaseCollision(bi, bj)) {\n continue;\n }\n\n if (!SAPBroadphase.checkBounds(bi, bj, axisIndex)) {\n break;\n }\n\n this.intersectionTest(bi, bj, p1, p2);\n }\n }\n }\n\n sortList() {\n const axisList = this.axisList;\n const axisIndex = this.axisIndex;\n const N = axisList.length; // Update AABBs\n\n for (let i = 0; i !== N; i++) {\n const bi = axisList[i];\n\n if (bi.aabbNeedsUpdate) {\n bi.updateAABB();\n }\n } // Sort the list\n\n\n if (axisIndex === 0) {\n SAPBroadphase.insertionSortX(axisList);\n } else if (axisIndex === 1) {\n SAPBroadphase.insertionSortY(axisList);\n } else if (axisIndex === 2) {\n SAPBroadphase.insertionSortZ(axisList);\n }\n }\n /**\n * Computes the variance of the body positions and estimates the best axis to use.\n * Will automatically set property `axisIndex`.\n */\n\n\n autoDetectAxis() {\n let sumX = 0;\n let sumX2 = 0;\n let sumY = 0;\n let sumY2 = 0;\n let sumZ = 0;\n let sumZ2 = 0;\n const bodies = this.axisList;\n const N = bodies.length;\n const invN = 1 / N;\n\n for (let i = 0; i !== N; i++) {\n const b = bodies[i];\n const centerX = b.position.x;\n sumX += centerX;\n sumX2 += centerX * centerX;\n const centerY = b.position.y;\n sumY += centerY;\n sumY2 += centerY * centerY;\n const centerZ = b.position.z;\n sumZ += centerZ;\n sumZ2 += centerZ * centerZ;\n }\n\n const varianceX = sumX2 - sumX * sumX * invN;\n const varianceY = sumY2 - sumY * sumY * invN;\n const varianceZ = sumZ2 - sumZ * sumZ * invN;\n\n if (varianceX > varianceY) {\n if (varianceX > varianceZ) {\n this.axisIndex = 0;\n } else {\n this.axisIndex = 2;\n }\n } else if (varianceY > varianceZ) {\n this.axisIndex = 1;\n } else {\n this.axisIndex = 2;\n }\n }\n /**\n * Returns all the bodies within an AABB.\n * @param result An array to store resulting bodies in.\n */\n\n\n aabbQuery(world, aabb, result = []) {\n if (this.dirty) {\n this.sortList();\n this.dirty = false;\n }\n\n const axisIndex = this.axisIndex;\n let axis = 'x';\n\n if (axisIndex === 1) {\n axis = 'y';\n }\n\n if (axisIndex === 2) {\n axis = 'z';\n }\n\n const axisList = this.axisList;\n aabb.lowerBound[axis];\n aabb.upperBound[axis];\n\n for (let i = 0; i < axisList.length; i++) {\n const b = axisList[i];\n\n if (b.aabbNeedsUpdate) {\n b.updateAABB();\n }\n\n if (b.aabb.overlaps(aabb)) {\n result.push(b);\n }\n }\n\n return result;\n }\n\n}\n\nclass Utils {\n /**\n * Extend an options object with default values.\n * @param options The options object. May be falsy: in this case, a new object is created and returned.\n * @param defaults An object containing default values.\n * @return The modified options object.\n */\n static defaults(options = {}, defaults) {\n for (let key in defaults) {\n if (!(key in options)) {\n options[key] = defaults[key];\n }\n }\n\n return options;\n }\n\n}\n\n/**\n * Constraint base class\n */\nclass Constraint {\n /**\n * Equations to be solved in this constraint.\n */\n\n /**\n * Body A.\n */\n\n /**\n * Body B.\n */\n\n /**\n * Set to false if you don't want the bodies to collide when they are connected.\n */\n constructor(bodyA, bodyB, options = {}) {\n this.equations = void 0;\n this.bodyA = void 0;\n this.bodyB = void 0;\n this.id = void 0;\n this.collideConnected = void 0;\n options = Utils.defaults(options, {\n collideConnected: true,\n wakeUpBodies: true\n });\n this.equations = [];\n this.bodyA = bodyA;\n this.bodyB = bodyB;\n this.id = Constraint.idCounter++;\n this.collideConnected = options.collideConnected;\n\n if (options.wakeUpBodies) {\n if (bodyA) {\n bodyA.wakeUp();\n }\n\n if (bodyB) {\n bodyB.wakeUp();\n }\n }\n }\n /**\n * Update all the equations with data.\n */\n\n\n update() {\n throw new Error('method update() not implmemented in this Constraint subclass!');\n }\n /**\n * Enables all equations in the constraint.\n */\n\n\n enable() {\n const eqs = this.equations;\n\n for (let i = 0; i < eqs.length; i++) {\n eqs[i].enabled = true;\n }\n }\n /**\n * Disables all equations in the constraint.\n */\n\n\n disable() {\n const eqs = this.equations;\n\n for (let i = 0; i < eqs.length; i++) {\n eqs[i].enabled = false;\n }\n }\n\n}\nConstraint.idCounter = 0;\n\n/**\n * An element containing 6 entries, 3 spatial and 3 rotational degrees of freedom.\n */\n\nclass JacobianElement {\n /**\n * spatial\n */\n\n /**\n * rotational\n */\n constructor() {\n this.spatial = void 0;\n this.rotational = void 0;\n this.spatial = new Vec3();\n this.rotational = new Vec3();\n }\n /**\n * Multiply with other JacobianElement\n */\n\n\n multiplyElement(element) {\n return element.spatial.dot(this.spatial) + element.rotational.dot(this.rotational);\n }\n /**\n * Multiply with two vectors\n */\n\n\n multiplyVectors(spatial, rotational) {\n return spatial.dot(this.spatial) + rotational.dot(this.rotational);\n }\n\n}\n\n/**\n * Equation base class.\n *\n * `a`, `b` and `eps` are {@link https://www8.cs.umu.se/kurser/5DV058/VT15/lectures/SPOOKlabnotes.pdf SPOOK} parameters that default to `0.0`. See {@link https://github.com/schteppe/cannon.js/issues/238#issuecomment-147172327 this exchange} for more details on Cannon's physics implementation.\n */\nclass Equation {\n /**\n * Minimum (read: negative max) force to be applied by the constraint.\n */\n\n /**\n * Maximum (read: positive max) force to be applied by the constraint.\n */\n\n /**\n * SPOOK parameter\n */\n\n /**\n * SPOOK parameter\n */\n\n /**\n * SPOOK parameter\n */\n\n /**\n * A number, proportional to the force added to the bodies.\n */\n constructor(bi, bj, minForce = -1e6, maxForce = 1e6) {\n this.id = void 0;\n this.minForce = void 0;\n this.maxForce = void 0;\n this.bi = void 0;\n this.bj = void 0;\n this.si = void 0;\n this.sj = void 0;\n this.a = void 0;\n this.b = void 0;\n this.eps = void 0;\n this.jacobianElementA = void 0;\n this.jacobianElementB = void 0;\n this.enabled = void 0;\n this.multiplier = void 0;\n this.id = Equation.idCounter++;\n this.minForce = minForce;\n this.maxForce = maxForce;\n this.bi = bi;\n this.bj = bj;\n this.a = 0.0; // SPOOK parameter\n\n this.b = 0.0; // SPOOK parameter\n\n this.eps = 0.0; // SPOOK parameter\n\n this.jacobianElementA = new JacobianElement();\n this.jacobianElementB = new JacobianElement();\n this.enabled = true;\n this.multiplier = 0;\n this.setSpookParams(1e7, 4, 1 / 60); // Set typical spook params\n }\n /**\n * Recalculates a, b, and eps.\n *\n * The Equation constructor sets typical SPOOK parameters as such:\n * * `stiffness` = 1e7\n * * `relaxation` = 4\n * * `timeStep`= 1 / 60, _note the hardcoded refresh rate._\n */\n\n\n setSpookParams(stiffness, relaxation, timeStep) {\n const d = relaxation;\n const k = stiffness;\n const h = timeStep;\n this.a = 4.0 / (h * (1 + 4 * d));\n this.b = 4.0 * d / (1 + 4 * d);\n this.eps = 4.0 / (h * h * k * (1 + 4 * d));\n }\n /**\n * Computes the right hand side of the SPOOK equation\n */\n\n\n computeB(a, b, h) {\n const GW = this.computeGW();\n const Gq = this.computeGq();\n const GiMf = this.computeGiMf();\n return -Gq * a - GW * b - GiMf * h;\n }\n /**\n * Computes G*q, where q are the generalized body coordinates\n */\n\n\n computeGq() {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const xi = bi.position;\n const xj = bj.position;\n return GA.spatial.dot(xi) + GB.spatial.dot(xj);\n }\n /**\n * Computes G*W, where W are the body velocities\n */\n\n\n computeGW() {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const vi = bi.velocity;\n const vj = bj.velocity;\n const wi = bi.angularVelocity;\n const wj = bj.angularVelocity;\n return GA.multiplyVectors(vi, wi) + GB.multiplyVectors(vj, wj);\n }\n /**\n * Computes G*Wlambda, where W are the body velocities\n */\n\n\n computeGWlambda() {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const vi = bi.vlambda;\n const vj = bj.vlambda;\n const wi = bi.wlambda;\n const wj = bj.wlambda;\n return GA.multiplyVectors(vi, wi) + GB.multiplyVectors(vj, wj);\n }\n /**\n * Computes G*inv(M)*f, where M is the mass matrix with diagonal blocks for each body, and f are the forces on the bodies.\n */\n\n\n computeGiMf() {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const fi = bi.force;\n const ti = bi.torque;\n const fj = bj.force;\n const tj = bj.torque;\n const invMassi = bi.invMassSolve;\n const invMassj = bj.invMassSolve;\n fi.scale(invMassi, iMfi);\n fj.scale(invMassj, iMfj);\n bi.invInertiaWorldSolve.vmult(ti, invIi_vmult_taui);\n bj.invInertiaWorldSolve.vmult(tj, invIj_vmult_tauj);\n return GA.multiplyVectors(iMfi, invIi_vmult_taui) + GB.multiplyVectors(iMfj, invIj_vmult_tauj);\n }\n /**\n * Computes G*inv(M)*G'\n */\n\n\n computeGiMGt() {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const invMassi = bi.invMassSolve;\n const invMassj = bj.invMassSolve;\n const invIi = bi.invInertiaWorldSolve;\n const invIj = bj.invInertiaWorldSolve;\n let result = invMassi + invMassj;\n invIi.vmult(GA.rotational, tmp);\n result += tmp.dot(GA.rotational);\n invIj.vmult(GB.rotational, tmp);\n result += tmp.dot(GB.rotational);\n return result;\n }\n /**\n * Add constraint velocity to the bodies.\n */\n\n\n addToWlambda(deltalambda) {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const temp = addToWlambda_temp; // Add to linear velocity\n // v_lambda += inv(M) * delta_lamba * G\n\n bi.vlambda.addScaledVector(bi.invMassSolve * deltalambda, GA.spatial, bi.vlambda);\n bj.vlambda.addScaledVector(bj.invMassSolve * deltalambda, GB.spatial, bj.vlambda); // Add to angular velocity\n\n bi.invInertiaWorldSolve.vmult(GA.rotational, temp);\n bi.wlambda.addScaledVector(deltalambda, temp, bi.wlambda);\n bj.invInertiaWorldSolve.vmult(GB.rotational, temp);\n bj.wlambda.addScaledVector(deltalambda, temp, bj.wlambda);\n }\n /**\n * Compute the denominator part of the SPOOK equation: C = G*inv(M)*G' + eps\n */\n\n\n computeC() {\n return this.computeGiMGt() + this.eps;\n }\n\n}\nEquation.idCounter = 0;\nconst iMfi = new Vec3();\nconst iMfj = new Vec3();\nconst invIi_vmult_taui = new Vec3();\nconst invIj_vmult_tauj = new Vec3();\nconst tmp = new Vec3();\nconst addToWlambda_temp = new Vec3();\n\n/**\n * Contact/non-penetration constraint equation\n */\nclass ContactEquation extends Equation {\n /**\n * \"bounciness\": u1 = -e*u0\n */\n\n /**\n * World-oriented vector that goes from the center of bi to the contact point.\n */\n\n /**\n * World-oriented vector that starts in body j position and goes to the contact point.\n */\n\n /**\n * Contact normal, pointing out of body i.\n */\n constructor(bodyA, bodyB, maxForce = 1e6) {\n super(bodyA, bodyB, 0, maxForce);\n this.restitution = void 0;\n this.ri = void 0;\n this.rj = void 0;\n this.ni = void 0;\n this.restitution = 0.0;\n this.ri = new Vec3();\n this.rj = new Vec3();\n this.ni = new Vec3();\n }\n\n computeB(h) {\n const a = this.a;\n const b = this.b;\n const bi = this.bi;\n const bj = this.bj;\n const ri = this.ri;\n const rj = this.rj;\n const rixn = ContactEquation_computeB_temp1;\n const rjxn = ContactEquation_computeB_temp2;\n const vi = bi.velocity;\n const wi = bi.angularVelocity;\n bi.force;\n bi.torque;\n const vj = bj.velocity;\n const wj = bj.angularVelocity;\n bj.force;\n bj.torque;\n const penetrationVec = ContactEquation_computeB_temp3;\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const n = this.ni; // Caluclate cross products\n\n ri.cross(n, rixn);\n rj.cross(n, rjxn); // g = xj+rj -(xi+ri)\n // G = [ -ni -rixn ni rjxn ]\n\n n.negate(GA.spatial);\n rixn.negate(GA.rotational);\n GB.spatial.copy(n);\n GB.rotational.copy(rjxn); // Calculate the penetration vector\n\n penetrationVec.copy(bj.position);\n penetrationVec.vadd(rj, penetrationVec);\n penetrationVec.vsub(bi.position, penetrationVec);\n penetrationVec.vsub(ri, penetrationVec);\n const g = n.dot(penetrationVec); // Compute iteration\n\n const ePlusOne = this.restitution + 1;\n const GW = ePlusOne * vj.dot(n) - ePlusOne * vi.dot(n) + wj.dot(rjxn) - wi.dot(rixn);\n const GiMf = this.computeGiMf();\n const B = -g * a - GW * b - h * GiMf;\n return B;\n }\n /**\n * Get the current relative velocity in the contact point.\n */\n\n\n getImpactVelocityAlongNormal() {\n const vi = ContactEquation_getImpactVelocityAlongNormal_vi;\n const vj = ContactEquation_getImpactVelocityAlongNormal_vj;\n const xi = ContactEquation_getImpactVelocityAlongNormal_xi;\n const xj = ContactEquation_getImpactVelocityAlongNormal_xj;\n const relVel = ContactEquation_getImpactVelocityAlongNormal_relVel;\n this.bi.position.vadd(this.ri, xi);\n this.bj.position.vadd(this.rj, xj);\n this.bi.getVelocityAtWorldPoint(xi, vi);\n this.bj.getVelocityAtWorldPoint(xj, vj);\n vi.vsub(vj, relVel);\n return this.ni.dot(relVel);\n }\n\n}\nconst ContactEquation_computeB_temp1 = new Vec3(); // Temp vectors\n\nconst ContactEquation_computeB_temp2 = new Vec3();\nconst ContactEquation_computeB_temp3 = new Vec3();\nconst ContactEquation_getImpactVelocityAlongNormal_vi = new Vec3();\nconst ContactEquation_getImpactVelocityAlongNormal_vj = new Vec3();\nconst ContactEquation_getImpactVelocityAlongNormal_xi = new Vec3();\nconst ContactEquation_getImpactVelocityAlongNormal_xj = new Vec3();\nconst ContactEquation_getImpactVelocityAlongNormal_relVel = new Vec3();\n\n/**\n * Connects two bodies at given offset points.\n * @example\n * const bodyA = new Body({ mass: 1 })\n * const bodyB = new Body({ mass: 1 })\n * bodyA.position.set(-1, 0, 0)\n * bodyB.position.set(1, 0, 0)\n * bodyA.addShape(shapeA)\n * bodyB.addShape(shapeB)\n * world.addBody(bodyA)\n * world.addBody(bodyB)\n * const localPivotA = new Vec3(1, 0, 0)\n * const localPivotB = new Vec3(-1, 0, 0)\n * const constraint = new PointToPointConstraint(bodyA, localPivotA, bodyB, localPivotB)\n * world.addConstraint(constraint)\n */\nclass PointToPointConstraint extends Constraint {\n /**\n * Pivot, defined locally in bodyA.\n */\n\n /**\n * Pivot, defined locally in bodyB.\n */\n\n /**\n * @param pivotA The point relative to the center of mass of bodyA which bodyA is constrained to.\n * @param bodyB Body that will be constrained in a similar way to the same point as bodyA. We will therefore get a link between bodyA and bodyB. If not specified, bodyA will be constrained to a static point.\n * @param pivotB The point relative to the center of mass of bodyB which bodyB is constrained to.\n * @param maxForce The maximum force that should be applied to constrain the bodies.\n */\n constructor(bodyA, pivotA = new Vec3(), bodyB, pivotB = new Vec3(), maxForce = 1e6) {\n super(bodyA, bodyB);\n this.pivotA = void 0;\n this.pivotB = void 0;\n this.equationX = void 0;\n this.equationY = void 0;\n this.equationZ = void 0;\n this.pivotA = pivotA.clone();\n this.pivotB = pivotB.clone();\n const x = this.equationX = new ContactEquation(bodyA, bodyB);\n const y = this.equationY = new ContactEquation(bodyA, bodyB);\n const z = this.equationZ = new ContactEquation(bodyA, bodyB); // Equations to be fed to the solver\n\n this.equations.push(x, y, z); // Make the equations bidirectional\n\n x.minForce = y.minForce = z.minForce = -maxForce;\n x.maxForce = y.maxForce = z.maxForce = maxForce;\n x.ni.set(1, 0, 0);\n y.ni.set(0, 1, 0);\n z.ni.set(0, 0, 1);\n }\n\n update() {\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n const x = this.equationX;\n const y = this.equationY;\n const z = this.equationZ; // Rotate the pivots to world space\n\n bodyA.quaternion.vmult(this.pivotA, x.ri);\n bodyB.quaternion.vmult(this.pivotB, x.rj);\n y.ri.copy(x.ri);\n y.rj.copy(x.rj);\n z.ri.copy(x.ri);\n z.rj.copy(x.rj);\n }\n\n}\n\n/**\n * Cone equation. Works to keep the given body world vectors aligned, or tilted within a given angle from each other.\n */\nclass ConeEquation extends Equation {\n /**\n * Local axis in A\n */\n\n /**\n * Local axis in B\n */\n\n /**\n * The \"cone angle\" to keep\n */\n constructor(bodyA, bodyB, options = {}) {\n const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6;\n super(bodyA, bodyB, -maxForce, maxForce);\n this.axisA = void 0;\n this.axisB = void 0;\n this.angle = void 0;\n this.axisA = options.axisA ? options.axisA.clone() : new Vec3(1, 0, 0);\n this.axisB = options.axisB ? options.axisB.clone() : new Vec3(0, 1, 0);\n this.angle = typeof options.angle !== 'undefined' ? options.angle : 0;\n }\n\n computeB(h) {\n const a = this.a;\n const b = this.b;\n const ni = this.axisA;\n const nj = this.axisB;\n const nixnj = tmpVec1$2;\n const njxni = tmpVec2$2;\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB; // Caluclate cross products\n\n ni.cross(nj, nixnj);\n nj.cross(ni, njxni); // The angle between two vector is:\n // cos(theta) = a * b / (length(a) * length(b) = { len(a) = len(b) = 1 } = a * b\n // g = a * b\n // gdot = (b x a) * wi + (a x b) * wj\n // G = [0 bxa 0 axb]\n // W = [vi wi vj wj]\n\n GA.rotational.copy(njxni);\n GB.rotational.copy(nixnj);\n const g = Math.cos(this.angle) - ni.dot(nj);\n const GW = this.computeGW();\n const GiMf = this.computeGiMf();\n const B = -g * a - GW * b - h * GiMf;\n return B;\n }\n\n}\nconst tmpVec1$2 = new Vec3();\nconst tmpVec2$2 = new Vec3();\n\n/**\n * Rotational constraint. Works to keep the local vectors orthogonal to each other in world space.\n */\nclass RotationalEquation extends Equation {\n /**\n * World oriented rotational axis.\n */\n\n /**\n * World oriented rotational axis.\n */\n\n /**\n * maxAngle\n */\n constructor(bodyA, bodyB, options = {}) {\n const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6;\n super(bodyA, bodyB, -maxForce, maxForce);\n this.axisA = void 0;\n this.axisB = void 0;\n this.maxAngle = void 0;\n this.axisA = options.axisA ? options.axisA.clone() : new Vec3(1, 0, 0);\n this.axisB = options.axisB ? options.axisB.clone() : new Vec3(0, 1, 0);\n this.maxAngle = Math.PI / 2;\n }\n\n computeB(h) {\n const a = this.a;\n const b = this.b;\n const ni = this.axisA;\n const nj = this.axisB;\n const nixnj = tmpVec1$1;\n const njxni = tmpVec2$1;\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB; // Caluclate cross products\n\n ni.cross(nj, nixnj);\n nj.cross(ni, njxni); // g = ni * nj\n // gdot = (nj x ni) * wi + (ni x nj) * wj\n // G = [0 njxni 0 nixnj]\n // W = [vi wi vj wj]\n\n GA.rotational.copy(njxni);\n GB.rotational.copy(nixnj);\n const g = Math.cos(this.maxAngle) - ni.dot(nj);\n const GW = this.computeGW();\n const GiMf = this.computeGiMf();\n const B = -g * a - GW * b - h * GiMf;\n return B;\n }\n\n}\nconst tmpVec1$1 = new Vec3();\nconst tmpVec2$1 = new Vec3();\n\n/**\n * A Cone Twist constraint, useful for ragdolls.\n */\nclass ConeTwistConstraint extends PointToPointConstraint {\n /**\n * The axis direction for the constraint of the body A.\n */\n\n /**\n * The axis direction for the constraint of the body B.\n */\n\n /**\n * The aperture angle of the cone.\n */\n\n /**\n * The twist angle of the joint.\n */\n constructor(bodyA, bodyB, options = {}) {\n const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6; // Set pivot point in between\n\n const pivotA = options.pivotA ? options.pivotA.clone() : new Vec3();\n const pivotB = options.pivotB ? options.pivotB.clone() : new Vec3();\n super(bodyA, pivotA, bodyB, pivotB, maxForce);\n this.axisA = void 0;\n this.axisB = void 0;\n this.angle = void 0;\n this.twistAngle = void 0;\n this.coneEquation = void 0;\n this.twistEquation = void 0;\n this.axisA = options.axisA ? options.axisA.clone() : new Vec3();\n this.axisB = options.axisB ? options.axisB.clone() : new Vec3();\n this.collideConnected = !!options.collideConnected;\n this.angle = typeof options.angle !== 'undefined' ? options.angle : 0;\n const c = this.coneEquation = new ConeEquation(bodyA, bodyB, options);\n const t = this.twistEquation = new RotationalEquation(bodyA, bodyB, options);\n this.twistAngle = typeof options.twistAngle !== 'undefined' ? options.twistAngle : 0; // Make the cone equation push the bodies toward the cone axis, not outward\n\n c.maxForce = 0;\n c.minForce = -maxForce; // Make the twist equation add torque toward the initial position\n\n t.maxForce = 0;\n t.minForce = -maxForce;\n this.equations.push(c, t);\n }\n\n update() {\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n const cone = this.coneEquation;\n const twist = this.twistEquation;\n super.update(); // Update the axes to the cone constraint\n\n bodyA.vectorToWorldFrame(this.axisA, cone.axisA);\n bodyB.vectorToWorldFrame(this.axisB, cone.axisB); // Update the world axes in the twist constraint\n\n this.axisA.tangents(twist.axisA, twist.axisA);\n bodyA.vectorToWorldFrame(twist.axisA, twist.axisA);\n this.axisB.tangents(twist.axisB, twist.axisB);\n bodyB.vectorToWorldFrame(twist.axisB, twist.axisB);\n cone.angle = this.angle;\n twist.maxAngle = this.twistAngle;\n }\n\n}\n\n/**\n * Constrains two bodies to be at a constant distance from each others center of mass.\n */\nclass DistanceConstraint extends Constraint {\n /**\n * The distance to keep. If undefined, it will be set to the current distance between bodyA and bodyB\n */\n\n /**\n * @param distance The distance to keep. If undefined, it will be set to the current distance between bodyA and bodyB.\n * @param maxForce The maximum force that should be applied to constrain the bodies.\n */\n constructor(bodyA, bodyB, distance, maxForce = 1e6) {\n super(bodyA, bodyB);\n this.distance = void 0;\n this.distanceEquation = void 0;\n\n if (typeof distance === 'undefined') {\n distance = bodyA.position.distanceTo(bodyB.position);\n }\n\n this.distance = distance;\n const eq = this.distanceEquation = new ContactEquation(bodyA, bodyB);\n this.equations.push(eq); // Make it bidirectional\n\n eq.minForce = -maxForce;\n eq.maxForce = maxForce;\n }\n /**\n * update\n */\n\n\n update() {\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n const eq = this.distanceEquation;\n const halfDist = this.distance * 0.5;\n const normal = eq.ni;\n bodyB.position.vsub(bodyA.position, normal);\n normal.normalize();\n normal.scale(halfDist, eq.ri);\n normal.scale(-halfDist, eq.rj);\n }\n\n}\n\n/**\n * Lock constraint. Will remove all degrees of freedom between the bodies.\n */\nclass LockConstraint extends PointToPointConstraint {\n constructor(bodyA, bodyB, options = {}) {\n const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6; // Set pivot point in between\n\n const pivotA = new Vec3();\n const pivotB = new Vec3();\n const halfWay = new Vec3();\n bodyA.position.vadd(bodyB.position, halfWay);\n halfWay.scale(0.5, halfWay);\n bodyB.pointToLocalFrame(halfWay, pivotB);\n bodyA.pointToLocalFrame(halfWay, pivotA); // The point-to-point constraint will keep a point shared between the bodies\n\n super(bodyA, pivotA, bodyB, pivotB, maxForce); // Store initial rotation of the bodies as unit vectors in the local body spaces\n\n this.xA = void 0;\n this.xB = void 0;\n this.yA = void 0;\n this.yB = void 0;\n this.zA = void 0;\n this.zB = void 0;\n this.rotationalEquation1 = void 0;\n this.rotationalEquation2 = void 0;\n this.rotationalEquation3 = void 0;\n this.motorEquation = void 0;\n this.xA = bodyA.vectorToLocalFrame(Vec3.UNIT_X);\n this.xB = bodyB.vectorToLocalFrame(Vec3.UNIT_X);\n this.yA = bodyA.vectorToLocalFrame(Vec3.UNIT_Y);\n this.yB = bodyB.vectorToLocalFrame(Vec3.UNIT_Y);\n this.zA = bodyA.vectorToLocalFrame(Vec3.UNIT_Z);\n this.zB = bodyB.vectorToLocalFrame(Vec3.UNIT_Z); // ...and the following rotational equations will keep all rotational DOF's in place\n\n const r1 = this.rotationalEquation1 = new RotationalEquation(bodyA, bodyB, options);\n const r2 = this.rotationalEquation2 = new RotationalEquation(bodyA, bodyB, options);\n const r3 = this.rotationalEquation3 = new RotationalEquation(bodyA, bodyB, options);\n this.equations.push(r1, r2, r3);\n }\n /**\n * update\n */\n\n\n update() {\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n this.motorEquation;\n const r1 = this.rotationalEquation1;\n const r2 = this.rotationalEquation2;\n const r3 = this.rotationalEquation3;\n super.update(); // These vector pairs must be orthogonal\n\n bodyA.vectorToWorldFrame(this.xA, r1.axisA);\n bodyB.vectorToWorldFrame(this.yB, r1.axisB);\n bodyA.vectorToWorldFrame(this.yA, r2.axisA);\n bodyB.vectorToWorldFrame(this.zB, r2.axisB);\n bodyA.vectorToWorldFrame(this.zA, r3.axisA);\n bodyB.vectorToWorldFrame(this.xB, r3.axisB);\n }\n\n}\n\n/**\n * Rotational motor constraint. Tries to keep the relative angular velocity of the bodies to a given value.\n */\nclass RotationalMotorEquation extends Equation {\n /**\n * World oriented rotational axis.\n */\n\n /**\n * World oriented rotational axis.\n */\n\n /**\n * Motor velocity.\n */\n constructor(bodyA, bodyB, maxForce = 1e6) {\n super(bodyA, bodyB, -maxForce, maxForce);\n this.axisA = void 0;\n this.axisB = void 0;\n this.targetVelocity = void 0;\n this.axisA = new Vec3();\n this.axisB = new Vec3();\n this.targetVelocity = 0;\n }\n\n computeB(h) {\n this.a;\n const b = this.b;\n this.bi;\n this.bj;\n const axisA = this.axisA;\n const axisB = this.axisB;\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB; // g = 0\n // gdot = axisA * wi - axisB * wj\n // gdot = G * W = G * [vi wi vj wj]\n // =>\n // G = [0 axisA 0 -axisB]\n\n GA.rotational.copy(axisA);\n axisB.negate(GB.rotational);\n const GW = this.computeGW() - this.targetVelocity;\n const GiMf = this.computeGiMf();\n const B = -GW * b - h * GiMf;\n return B;\n }\n\n}\n\n/**\n * Hinge constraint. Think of it as a door hinge. It tries to keep the door in the correct place and with the correct orientation.\n */\nclass HingeConstraint extends PointToPointConstraint {\n /**\n * Rotation axis, defined locally in bodyA.\n */\n\n /**\n * Rotation axis, defined locally in bodyB.\n */\n constructor(bodyA, bodyB, options = {}) {\n const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6;\n const pivotA = options.pivotA ? options.pivotA.clone() : new Vec3();\n const pivotB = options.pivotB ? options.pivotB.clone() : new Vec3();\n super(bodyA, pivotA, bodyB, pivotB, maxForce);\n this.axisA = void 0;\n this.axisB = void 0;\n this.rotationalEquation1 = void 0;\n this.rotationalEquation2 = void 0;\n this.motorEquation = void 0;\n const axisA = this.axisA = options.axisA ? options.axisA.clone() : new Vec3(1, 0, 0);\n axisA.normalize();\n const axisB = this.axisB = options.axisB ? options.axisB.clone() : new Vec3(1, 0, 0);\n axisB.normalize();\n this.collideConnected = !!options.collideConnected;\n const rotational1 = this.rotationalEquation1 = new RotationalEquation(bodyA, bodyB, options);\n const rotational2 = this.rotationalEquation2 = new RotationalEquation(bodyA, bodyB, options);\n const motor = this.motorEquation = new RotationalMotorEquation(bodyA, bodyB, maxForce);\n motor.enabled = false; // Not enabled by default\n // Equations to be fed to the solver\n\n this.equations.push(rotational1, rotational2, motor);\n }\n /**\n * enableMotor\n */\n\n\n enableMotor() {\n this.motorEquation.enabled = true;\n }\n /**\n * disableMotor\n */\n\n\n disableMotor() {\n this.motorEquation.enabled = false;\n }\n /**\n * setMotorSpeed\n */\n\n\n setMotorSpeed(speed) {\n this.motorEquation.targetVelocity = speed;\n }\n /**\n * setMotorMaxForce\n */\n\n\n setMotorMaxForce(maxForce) {\n this.motorEquation.maxForce = maxForce;\n this.motorEquation.minForce = -maxForce;\n }\n /**\n * update\n */\n\n\n update() {\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n const motor = this.motorEquation;\n const r1 = this.rotationalEquation1;\n const r2 = this.rotationalEquation2;\n const worldAxisA = HingeConstraint_update_tmpVec1;\n const worldAxisB = HingeConstraint_update_tmpVec2;\n const axisA = this.axisA;\n const axisB = this.axisB;\n super.update(); // Get world axes\n\n bodyA.quaternion.vmult(axisA, worldAxisA);\n bodyB.quaternion.vmult(axisB, worldAxisB);\n worldAxisA.tangents(r1.axisA, r2.axisA);\n r1.axisB.copy(worldAxisB);\n r2.axisB.copy(worldAxisB);\n\n if (this.motorEquation.enabled) {\n bodyA.quaternion.vmult(this.axisA, motor.axisA);\n bodyB.quaternion.vmult(this.axisB, motor.axisB);\n }\n }\n\n}\nconst HingeConstraint_update_tmpVec1 = new Vec3();\nconst HingeConstraint_update_tmpVec2 = new Vec3();\n\n/**\n * Constrains the slipping in a contact along a tangent\n */\nclass FrictionEquation extends Equation {\n // Tangent\n\n /**\n * @param slipForce should be +-F_friction = +-mu * F_normal = +-mu * m * g\n */\n constructor(bodyA, bodyB, slipForce) {\n super(bodyA, bodyB, -slipForce, slipForce);\n this.ri = void 0;\n this.rj = void 0;\n this.t = void 0;\n this.ri = new Vec3();\n this.rj = new Vec3();\n this.t = new Vec3();\n }\n\n computeB(h) {\n this.a;\n const b = this.b;\n this.bi;\n this.bj;\n const ri = this.ri;\n const rj = this.rj;\n const rixt = FrictionEquation_computeB_temp1;\n const rjxt = FrictionEquation_computeB_temp2;\n const t = this.t; // Caluclate cross products\n\n ri.cross(t, rixt);\n rj.cross(t, rjxt); // G = [-t -rixt t rjxt]\n // And remember, this is a pure velocity constraint, g is always zero!\n\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n t.negate(GA.spatial);\n rixt.negate(GA.rotational);\n GB.spatial.copy(t);\n GB.rotational.copy(rjxt);\n const GW = this.computeGW();\n const GiMf = this.computeGiMf();\n const B = -GW * b - h * GiMf;\n return B;\n }\n\n}\nconst FrictionEquation_computeB_temp1 = new Vec3();\nconst FrictionEquation_computeB_temp2 = new Vec3();\n\n/**\n * Defines what happens when two materials meet.\n * @todo Refactor materials to materialA and materialB\n */\nclass ContactMaterial {\n /**\n * Identifier of this material.\n */\n\n /**\n * Participating materials.\n */\n\n /**\n * Friction coefficient.\n * @default 0.3\n */\n\n /**\n * Restitution coefficient.\n * @default 0.3\n */\n\n /**\n * Stiffness of the produced contact equations.\n * @default 1e7\n */\n\n /**\n * Relaxation time of the produced contact equations.\n * @default 3\n */\n\n /**\n * Stiffness of the produced friction equations.\n * @default 1e7\n */\n\n /**\n * Relaxation time of the produced friction equations\n * @default 3\n */\n constructor(m1, m2, options) {\n this.id = void 0;\n this.materials = void 0;\n this.friction = void 0;\n this.restitution = void 0;\n this.contactEquationStiffness = void 0;\n this.contactEquationRelaxation = void 0;\n this.frictionEquationStiffness = void 0;\n this.frictionEquationRelaxation = void 0;\n options = Utils.defaults(options, {\n friction: 0.3,\n restitution: 0.3,\n contactEquationStiffness: 1e7,\n contactEquationRelaxation: 3,\n frictionEquationStiffness: 1e7,\n frictionEquationRelaxation: 3\n });\n this.id = ContactMaterial.idCounter++;\n this.materials = [m1, m2];\n this.friction = options.friction;\n this.restitution = options.restitution;\n this.contactEquationStiffness = options.contactEquationStiffness;\n this.contactEquationRelaxation = options.contactEquationRelaxation;\n this.frictionEquationStiffness = options.frictionEquationStiffness;\n this.frictionEquationRelaxation = options.frictionEquationRelaxation;\n }\n\n}\nContactMaterial.idCounter = 0;\n\n/**\n * Defines a physics material.\n */\nclass Material {\n /**\n * Material name.\n * If options is a string, name will be set to that string.\n * @todo Deprecate this\n */\n\n /** Material id. */\n\n /**\n * Friction for this material.\n * If non-negative, it will be used instead of the friction given by ContactMaterials. If there's no matching ContactMaterial, the value from `defaultContactMaterial` in the World will be used.\n */\n\n /**\n * Restitution for this material.\n * If non-negative, it will be used instead of the restitution given by ContactMaterials. If there's no matching ContactMaterial, the value from `defaultContactMaterial` in the World will be used.\n */\n constructor(options = {}) {\n this.name = void 0;\n this.id = void 0;\n this.friction = void 0;\n this.restitution = void 0;\n let name = ''; // Backwards compatibility fix\n\n if (typeof options === 'string') {\n //console.warn(`Passing a string to MaterialOptions is deprecated, and has no effect`)\n name = options;\n options = {};\n }\n\n this.name = name;\n this.id = Material.idCounter++;\n this.friction = typeof options.friction !== 'undefined' ? options.friction : -1;\n this.restitution = typeof options.restitution !== 'undefined' ? options.restitution : -1;\n }\n\n}\nMaterial.idCounter = 0;\n\n/**\n * A spring, connecting two bodies.\n * @example\n * const spring = new Spring(boxBody, sphereBody, {\n * restLength: 0,\n * stiffness: 50,\n * damping: 1,\n * })\n *\n * // Compute the force after each step\n * world.addEventListener('postStep', (event) => {\n * spring.applyForce()\n * })\n */\nclass Spring {\n /**\n * Rest length of the spring. A number > 0.\n * @default 1\n */\n\n /**\n * Stiffness of the spring. A number >= 0.\n * @default 100\n */\n\n /**\n * Damping of the spring. A number >= 0.\n * @default 1\n */\n\n /**\n * First connected body.\n */\n\n /**\n * Second connected body.\n */\n\n /**\n * Anchor for bodyA in local bodyA coordinates.\n * Where to hook the spring to body A, in local body coordinates.\n * @default new Vec3()\n */\n\n /**\n * Anchor for bodyB in local bodyB coordinates.\n * Where to hook the spring to body B, in local body coordinates.\n * @default new Vec3()\n */\n constructor(bodyA, bodyB, options = {}) {\n this.restLength = void 0;\n this.stiffness = void 0;\n this.damping = void 0;\n this.bodyA = void 0;\n this.bodyB = void 0;\n this.localAnchorA = void 0;\n this.localAnchorB = void 0;\n this.restLength = typeof options.restLength === 'number' ? options.restLength : 1;\n this.stiffness = options.stiffness || 100;\n this.damping = options.damping || 1;\n this.bodyA = bodyA;\n this.bodyB = bodyB;\n this.localAnchorA = new Vec3();\n this.localAnchorB = new Vec3();\n\n if (options.localAnchorA) {\n this.localAnchorA.copy(options.localAnchorA);\n }\n\n if (options.localAnchorB) {\n this.localAnchorB.copy(options.localAnchorB);\n }\n\n if (options.worldAnchorA) {\n this.setWorldAnchorA(options.worldAnchorA);\n }\n\n if (options.worldAnchorB) {\n this.setWorldAnchorB(options.worldAnchorB);\n }\n }\n /**\n * Set the anchor point on body A, using world coordinates.\n */\n\n\n setWorldAnchorA(worldAnchorA) {\n this.bodyA.pointToLocalFrame(worldAnchorA, this.localAnchorA);\n }\n /**\n * Set the anchor point on body B, using world coordinates.\n */\n\n\n setWorldAnchorB(worldAnchorB) {\n this.bodyB.pointToLocalFrame(worldAnchorB, this.localAnchorB);\n }\n /**\n * Get the anchor point on body A, in world coordinates.\n * @param result The vector to store the result in.\n */\n\n\n getWorldAnchorA(result) {\n this.bodyA.pointToWorldFrame(this.localAnchorA, result);\n }\n /**\n * Get the anchor point on body B, in world coordinates.\n * @param result The vector to store the result in.\n */\n\n\n getWorldAnchorB(result) {\n this.bodyB.pointToWorldFrame(this.localAnchorB, result);\n }\n /**\n * Apply the spring force to the connected bodies.\n */\n\n\n applyForce() {\n const k = this.stiffness;\n const d = this.damping;\n const l = this.restLength;\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n const r = applyForce_r;\n const r_unit = applyForce_r_unit;\n const u = applyForce_u;\n const f = applyForce_f;\n const tmp = applyForce_tmp;\n const worldAnchorA = applyForce_worldAnchorA;\n const worldAnchorB = applyForce_worldAnchorB;\n const ri = applyForce_ri;\n const rj = applyForce_rj;\n const ri_x_f = applyForce_ri_x_f;\n const rj_x_f = applyForce_rj_x_f; // Get world anchors\n\n this.getWorldAnchorA(worldAnchorA);\n this.getWorldAnchorB(worldAnchorB); // Get offset points\n\n worldAnchorA.vsub(bodyA.position, ri);\n worldAnchorB.vsub(bodyB.position, rj); // Compute distance vector between world anchor points\n\n worldAnchorB.vsub(worldAnchorA, r);\n const rlen = r.length();\n r_unit.copy(r);\n r_unit.normalize(); // Compute relative velocity of the anchor points, u\n\n bodyB.velocity.vsub(bodyA.velocity, u); // Add rotational velocity\n\n bodyB.angularVelocity.cross(rj, tmp);\n u.vadd(tmp, u);\n bodyA.angularVelocity.cross(ri, tmp);\n u.vsub(tmp, u); // F = - k * ( x - L ) - D * ( u )\n\n r_unit.scale(-k * (rlen - l) - d * u.dot(r_unit), f); // Add forces to bodies\n\n bodyA.force.vsub(f, bodyA.force);\n bodyB.force.vadd(f, bodyB.force); // Angular force\n\n ri.cross(f, ri_x_f);\n rj.cross(f, rj_x_f);\n bodyA.torque.vsub(ri_x_f, bodyA.torque);\n bodyB.torque.vadd(rj_x_f, bodyB.torque);\n }\n\n}\nconst applyForce_r = new Vec3();\nconst applyForce_r_unit = new Vec3();\nconst applyForce_u = new Vec3();\nconst applyForce_f = new Vec3();\nconst applyForce_worldAnchorA = new Vec3();\nconst applyForce_worldAnchorB = new Vec3();\nconst applyForce_ri = new Vec3();\nconst applyForce_rj = new Vec3();\nconst applyForce_ri_x_f = new Vec3();\nconst applyForce_rj_x_f = new Vec3();\nconst applyForce_tmp = new Vec3();\n\n/**\n * WheelInfo\n */\nclass WheelInfo {\n /**\n * Max travel distance of the suspension, in meters.\n * @default 1\n */\n\n /**\n * Speed to apply to the wheel rotation when the wheel is sliding.\n * @default -0.1\n */\n\n /**\n * If the customSlidingRotationalSpeed should be used.\n * @default false\n */\n\n /**\n * sliding\n */\n\n /**\n * Connection point, defined locally in the chassis body frame.\n */\n\n /**\n * chassisConnectionPointWorld\n */\n\n /**\n * directionLocal\n */\n\n /**\n * directionWorld\n */\n\n /**\n * axleLocal\n */\n\n /**\n * axleWorld\n */\n\n /**\n * suspensionRestLength\n * @default 1\n */\n\n /**\n * suspensionMaxLength\n * @default 2\n */\n\n /**\n * radius\n * @default 1\n */\n\n /**\n * suspensionStiffness\n * @default 100\n */\n\n /**\n * dampingCompression\n * @default 10\n */\n\n /**\n * dampingRelaxation\n * @default 10\n */\n\n /**\n * frictionSlip\n * @default 10.5\n */\n\n /** forwardAcceleration */\n\n /** sideAcceleration */\n\n /**\n * steering\n * @default 0\n */\n\n /**\n * Rotation value, in radians.\n * @default 0\n */\n\n /**\n * deltaRotation\n * @default 0\n */\n\n /**\n * rollInfluence\n * @default 0.01\n */\n\n /**\n * maxSuspensionForce\n */\n\n /**\n * engineForce\n */\n\n /**\n * brake\n */\n\n /**\n * isFrontWheel\n * @default true\n */\n\n /**\n * clippedInvContactDotSuspension\n * @default 1\n */\n\n /**\n * suspensionRelativeVelocity\n * @default 0\n */\n\n /**\n * suspensionForce\n * @default 0\n */\n\n /**\n * slipInfo\n */\n\n /**\n * skidInfo\n * @default 0\n */\n\n /**\n * suspensionLength\n * @default 0\n */\n\n /**\n * sideImpulse\n */\n\n /**\n * forwardImpulse\n */\n\n /**\n * The result from raycasting.\n */\n\n /**\n * Wheel world transform.\n */\n\n /**\n * isInContact\n */\n constructor(options = {}) {\n this.maxSuspensionTravel = void 0;\n this.customSlidingRotationalSpeed = void 0;\n this.useCustomSlidingRotationalSpeed = void 0;\n this.sliding = void 0;\n this.chassisConnectionPointLocal = void 0;\n this.chassisConnectionPointWorld = void 0;\n this.directionLocal = void 0;\n this.directionWorld = void 0;\n this.axleLocal = void 0;\n this.axleWorld = void 0;\n this.suspensionRestLength = void 0;\n this.suspensionMaxLength = void 0;\n this.radius = void 0;\n this.suspensionStiffness = void 0;\n this.dampingCompression = void 0;\n this.dampingRelaxation = void 0;\n this.frictionSlip = void 0;\n this.forwardAcceleration = void 0;\n this.sideAcceleration = void 0;\n this.steering = void 0;\n this.rotation = void 0;\n this.deltaRotation = void 0;\n this.rollInfluence = void 0;\n this.maxSuspensionForce = void 0;\n this.engineForce = void 0;\n this.brake = void 0;\n this.isFrontWheel = void 0;\n this.clippedInvContactDotSuspension = void 0;\n this.suspensionRelativeVelocity = void 0;\n this.suspensionForce = void 0;\n this.slipInfo = void 0;\n this.skidInfo = void 0;\n this.suspensionLength = void 0;\n this.sideImpulse = void 0;\n this.forwardImpulse = void 0;\n this.raycastResult = void 0;\n this.worldTransform = void 0;\n this.isInContact = void 0;\n options = Utils.defaults(options, {\n chassisConnectionPointLocal: new Vec3(),\n chassisConnectionPointWorld: new Vec3(),\n directionLocal: new Vec3(),\n directionWorld: new Vec3(),\n axleLocal: new Vec3(),\n axleWorld: new Vec3(),\n suspensionRestLength: 1,\n suspensionMaxLength: 2,\n radius: 1,\n suspensionStiffness: 100,\n dampingCompression: 10,\n dampingRelaxation: 10,\n frictionSlip: 10.5,\n forwardAcceleration: 1,\n sideAcceleration: 1,\n steering: 0,\n rotation: 0,\n deltaRotation: 0,\n rollInfluence: 0.01,\n maxSuspensionForce: Number.MAX_VALUE,\n isFrontWheel: true,\n clippedInvContactDotSuspension: 1,\n suspensionRelativeVelocity: 0,\n suspensionForce: 0,\n slipInfo: 0,\n skidInfo: 0,\n suspensionLength: 0,\n maxSuspensionTravel: 1,\n useCustomSlidingRotationalSpeed: false,\n customSlidingRotationalSpeed: -0.1\n });\n this.maxSuspensionTravel = options.maxSuspensionTravel;\n this.customSlidingRotationalSpeed = options.customSlidingRotationalSpeed;\n this.useCustomSlidingRotationalSpeed = options.useCustomSlidingRotationalSpeed;\n this.sliding = false;\n this.chassisConnectionPointLocal = options.chassisConnectionPointLocal.clone();\n this.chassisConnectionPointWorld = options.chassisConnectionPointWorld.clone();\n this.directionLocal = options.directionLocal.clone();\n this.directionWorld = options.directionWorld.clone();\n this.axleLocal = options.axleLocal.clone();\n this.axleWorld = options.axleWorld.clone();\n this.suspensionRestLength = options.suspensionRestLength;\n this.suspensionMaxLength = options.suspensionMaxLength;\n this.radius = options.radius;\n this.suspensionStiffness = options.suspensionStiffness;\n this.dampingCompression = options.dampingCompression;\n this.dampingRelaxation = options.dampingRelaxation;\n this.frictionSlip = options.frictionSlip;\n this.forwardAcceleration = options.forwardAcceleration;\n this.sideAcceleration = options.sideAcceleration;\n this.steering = 0;\n this.rotation = 0;\n this.deltaRotation = 0;\n this.rollInfluence = options.rollInfluence;\n this.maxSuspensionForce = options.maxSuspensionForce;\n this.engineForce = 0;\n this.brake = 0;\n this.isFrontWheel = options.isFrontWheel;\n this.clippedInvContactDotSuspension = 1;\n this.suspensionRelativeVelocity = 0;\n this.suspensionForce = 0;\n this.slipInfo = 0;\n this.skidInfo = 0;\n this.suspensionLength = 0;\n this.sideImpulse = 0;\n this.forwardImpulse = 0;\n this.raycastResult = new RaycastResult();\n this.worldTransform = new Transform();\n this.isInContact = false;\n }\n\n updateWheel(chassis) {\n const raycastResult = this.raycastResult;\n\n if (this.isInContact) {\n const project = raycastResult.hitNormalWorld.dot(raycastResult.directionWorld);\n raycastResult.hitPointWorld.vsub(chassis.position, relpos);\n chassis.getVelocityAtWorldPoint(relpos, chassis_velocity_at_contactPoint);\n const projVel = raycastResult.hitNormalWorld.dot(chassis_velocity_at_contactPoint);\n\n if (project >= -0.1) {\n this.suspensionRelativeVelocity = 0.0;\n this.clippedInvContactDotSuspension = 1.0 / 0.1;\n } else {\n const inv = -1 / project;\n this.suspensionRelativeVelocity = projVel * inv;\n this.clippedInvContactDotSuspension = inv;\n }\n } else {\n // Not in contact : position wheel in a nice (rest length) position\n raycastResult.suspensionLength = this.suspensionRestLength;\n this.suspensionRelativeVelocity = 0.0;\n raycastResult.directionWorld.scale(-1, raycastResult.hitNormalWorld);\n this.clippedInvContactDotSuspension = 1.0;\n }\n }\n\n}\nconst chassis_velocity_at_contactPoint = new Vec3();\nconst relpos = new Vec3();\n\n/**\n * Vehicle helper class that casts rays from the wheel positions towards the ground and applies forces.\n */\nclass RaycastVehicle {\n /** The car chassis body. */\n\n /** The wheels. */\n\n /** Will be set to true if the car is sliding. */\n\n /** Index of the right axis. x=0, y=1, z=2 */\n\n /** Index of the forward axis. x=0, y=1, z=2 */\n\n /** Index of the up axis. x=0, y=1, z=2 */\n\n /** The constraints. */\n\n /** Optional pre-step callback. */\n\n /** Number of wheels on the ground. */\n constructor(options) {\n this.chassisBody = void 0;\n this.wheelInfos = void 0;\n this.sliding = void 0;\n this.world = void 0;\n this.indexRightAxis = void 0;\n this.indexForwardAxis = void 0;\n this.indexUpAxis = void 0;\n this.constraints = void 0;\n this.preStepCallback = void 0;\n this.currentVehicleSpeedKmHour = void 0;\n this.numWheelsOnGround = void 0;\n this.chassisBody = options.chassisBody;\n this.wheelInfos = [];\n this.sliding = false;\n this.world = null;\n this.indexRightAxis = typeof options.indexRightAxis !== 'undefined' ? options.indexRightAxis : 2;\n this.indexForwardAxis = typeof options.indexForwardAxis !== 'undefined' ? options.indexForwardAxis : 0;\n this.indexUpAxis = typeof options.indexUpAxis !== 'undefined' ? options.indexUpAxis : 1;\n this.constraints = [];\n\n this.preStepCallback = () => {};\n\n this.currentVehicleSpeedKmHour = 0;\n this.numWheelsOnGround = 0;\n }\n /**\n * Add a wheel. For information about the options, see `WheelInfo`.\n */\n\n\n addWheel(options = {}) {\n const info = new WheelInfo(options);\n const index = this.wheelInfos.length;\n this.wheelInfos.push(info);\n return index;\n }\n /**\n * Set the steering value of a wheel.\n */\n\n\n setSteeringValue(value, wheelIndex) {\n const wheel = this.wheelInfos[wheelIndex];\n wheel.steering = value;\n }\n /**\n * Set the wheel force to apply on one of the wheels each time step\n */\n\n\n applyEngineForce(value, wheelIndex) {\n this.wheelInfos[wheelIndex].engineForce = value;\n }\n /**\n * Set the braking force of a wheel\n */\n\n\n setBrake(brake, wheelIndex) {\n this.wheelInfos[wheelIndex].brake = brake;\n }\n /**\n * Add the vehicle including its constraints to the world.\n */\n\n\n addToWorld(world) {\n world.addBody(this.chassisBody);\n const that = this;\n\n this.preStepCallback = () => {\n that.updateVehicle(world.dt);\n };\n\n world.addEventListener('preStep', this.preStepCallback);\n this.world = world;\n }\n /**\n * Get one of the wheel axles, world-oriented.\n */\n\n\n getVehicleAxisWorld(axisIndex, result) {\n result.set(axisIndex === 0 ? 1 : 0, axisIndex === 1 ? 1 : 0, axisIndex === 2 ? 1 : 0);\n this.chassisBody.vectorToWorldFrame(result, result);\n }\n\n updateVehicle(timeStep) {\n const wheelInfos = this.wheelInfos;\n const numWheels = wheelInfos.length;\n const chassisBody = this.chassisBody;\n\n for (let i = 0; i < numWheels; i++) {\n this.updateWheelTransform(i);\n }\n\n this.currentVehicleSpeedKmHour = 3.6 * chassisBody.velocity.length();\n const forwardWorld = new Vec3();\n this.getVehicleAxisWorld(this.indexForwardAxis, forwardWorld);\n\n if (forwardWorld.dot(chassisBody.velocity) < 0) {\n this.currentVehicleSpeedKmHour *= -1;\n } // simulate suspension\n\n\n for (let i = 0; i < numWheels; i++) {\n this.castRay(wheelInfos[i]);\n }\n\n this.updateSuspension(timeStep);\n const impulse = new Vec3();\n const relpos = new Vec3();\n\n for (let i = 0; i < numWheels; i++) {\n //apply suspension force\n const wheel = wheelInfos[i];\n let suspensionForce = wheel.suspensionForce;\n\n if (suspensionForce > wheel.maxSuspensionForce) {\n suspensionForce = wheel.maxSuspensionForce;\n }\n\n wheel.raycastResult.hitNormalWorld.scale(suspensionForce * timeStep, impulse);\n wheel.raycastResult.hitPointWorld.vsub(chassisBody.position, relpos);\n chassisBody.applyImpulse(impulse, relpos);\n }\n\n this.updateFriction(timeStep);\n const hitNormalWorldScaledWithProj = new Vec3();\n const fwd = new Vec3();\n const vel = new Vec3();\n\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i]; //const relpos = new Vec3();\n //wheel.chassisConnectionPointWorld.vsub(chassisBody.position, relpos);\n\n chassisBody.getVelocityAtWorldPoint(wheel.chassisConnectionPointWorld, vel); // Hack to get the rotation in the correct direction\n\n let m = 1;\n\n switch (this.indexUpAxis) {\n case 1:\n m = -1;\n break;\n }\n\n if (wheel.isInContact) {\n this.getVehicleAxisWorld(this.indexForwardAxis, fwd);\n const proj = fwd.dot(wheel.raycastResult.hitNormalWorld);\n wheel.raycastResult.hitNormalWorld.scale(proj, hitNormalWorldScaledWithProj);\n fwd.vsub(hitNormalWorldScaledWithProj, fwd);\n const proj2 = fwd.dot(vel);\n wheel.deltaRotation = m * proj2 * timeStep / wheel.radius;\n }\n\n if ((wheel.sliding || !wheel.isInContact) && wheel.engineForce !== 0 && wheel.useCustomSlidingRotationalSpeed) {\n // Apply custom rotation when accelerating and sliding\n wheel.deltaRotation = (wheel.engineForce > 0 ? 1 : -1) * wheel.customSlidingRotationalSpeed * timeStep;\n } // Lock wheels\n\n\n if (Math.abs(wheel.brake) > Math.abs(wheel.engineForce)) {\n wheel.deltaRotation = 0;\n }\n\n wheel.rotation += wheel.deltaRotation; // Use the old value\n\n wheel.deltaRotation *= 0.99; // damping of rotation when not in contact\n }\n }\n\n updateSuspension(deltaTime) {\n const chassisBody = this.chassisBody;\n const chassisMass = chassisBody.mass;\n const wheelInfos = this.wheelInfos;\n const numWheels = wheelInfos.length;\n\n for (let w_it = 0; w_it < numWheels; w_it++) {\n const wheel = wheelInfos[w_it];\n\n if (wheel.isInContact) {\n let force; // Spring\n\n const susp_length = wheel.suspensionRestLength;\n const current_length = wheel.suspensionLength;\n const length_diff = susp_length - current_length;\n force = wheel.suspensionStiffness * length_diff * wheel.clippedInvContactDotSuspension; // Damper\n\n const projected_rel_vel = wheel.suspensionRelativeVelocity;\n let susp_damping;\n\n if (projected_rel_vel < 0) {\n susp_damping = wheel.dampingCompression;\n } else {\n susp_damping = wheel.dampingRelaxation;\n }\n\n force -= susp_damping * projected_rel_vel;\n wheel.suspensionForce = force * chassisMass;\n\n if (wheel.suspensionForce < 0) {\n wheel.suspensionForce = 0;\n }\n } else {\n wheel.suspensionForce = 0;\n }\n }\n }\n /**\n * Remove the vehicle including its constraints from the world.\n */\n\n\n removeFromWorld(world) {\n this.constraints;\n world.removeBody(this.chassisBody);\n world.removeEventListener('preStep', this.preStepCallback);\n this.world = null;\n }\n\n castRay(wheel) {\n const rayvector = castRay_rayvector;\n const target = castRay_target;\n this.updateWheelTransformWorld(wheel);\n const chassisBody = this.chassisBody;\n let depth = -1;\n const raylen = wheel.suspensionRestLength + wheel.radius;\n wheel.directionWorld.scale(raylen, rayvector);\n const source = wheel.chassisConnectionPointWorld;\n source.vadd(rayvector, target);\n const raycastResult = wheel.raycastResult;\n raycastResult.reset(); // Turn off ray collision with the chassis temporarily\n\n const oldState = chassisBody.collisionResponse;\n chassisBody.collisionResponse = false; // Cast ray against world\n\n this.world.rayTest(source, target, raycastResult);\n chassisBody.collisionResponse = oldState;\n const object = raycastResult.body;\n wheel.raycastResult.groundObject = 0;\n\n if (object) {\n depth = raycastResult.distance;\n wheel.raycastResult.hitNormalWorld = raycastResult.hitNormalWorld;\n wheel.isInContact = true;\n const hitDistance = raycastResult.distance;\n wheel.suspensionLength = hitDistance - wheel.radius; // clamp on max suspension travel\n\n const minSuspensionLength = wheel.suspensionRestLength - wheel.maxSuspensionTravel;\n const maxSuspensionLength = wheel.suspensionRestLength + wheel.maxSuspensionTravel;\n\n if (wheel.suspensionLength < minSuspensionLength) {\n wheel.suspensionLength = minSuspensionLength;\n }\n\n if (wheel.suspensionLength > maxSuspensionLength) {\n wheel.suspensionLength = maxSuspensionLength;\n wheel.raycastResult.reset();\n }\n\n const denominator = wheel.raycastResult.hitNormalWorld.dot(wheel.directionWorld);\n const chassis_velocity_at_contactPoint = new Vec3();\n chassisBody.getVelocityAtWorldPoint(wheel.raycastResult.hitPointWorld, chassis_velocity_at_contactPoint);\n const projVel = wheel.raycastResult.hitNormalWorld.dot(chassis_velocity_at_contactPoint);\n\n if (denominator >= -0.1) {\n wheel.suspensionRelativeVelocity = 0;\n wheel.clippedInvContactDotSuspension = 1 / 0.1;\n } else {\n const inv = -1 / denominator;\n wheel.suspensionRelativeVelocity = projVel * inv;\n wheel.clippedInvContactDotSuspension = inv;\n }\n } else {\n //put wheel info as in rest position\n wheel.suspensionLength = wheel.suspensionRestLength + 0 * wheel.maxSuspensionTravel;\n wheel.suspensionRelativeVelocity = 0.0;\n wheel.directionWorld.scale(-1, wheel.raycastResult.hitNormalWorld);\n wheel.clippedInvContactDotSuspension = 1.0;\n }\n\n return depth;\n }\n\n updateWheelTransformWorld(wheel) {\n wheel.isInContact = false;\n const chassisBody = this.chassisBody;\n chassisBody.pointToWorldFrame(wheel.chassisConnectionPointLocal, wheel.chassisConnectionPointWorld);\n chassisBody.vectorToWorldFrame(wheel.directionLocal, wheel.directionWorld);\n chassisBody.vectorToWorldFrame(wheel.axleLocal, wheel.axleWorld);\n }\n /**\n * Update one of the wheel transform.\n * Note when rendering wheels: during each step, wheel transforms are updated BEFORE the chassis; ie. their position becomes invalid after the step. Thus when you render wheels, you must update wheel transforms before rendering them. See raycastVehicle demo for an example.\n * @param wheelIndex The wheel index to update.\n */\n\n\n updateWheelTransform(wheelIndex) {\n const up = tmpVec4;\n const right = tmpVec5;\n const fwd = tmpVec6;\n const wheel = this.wheelInfos[wheelIndex];\n this.updateWheelTransformWorld(wheel);\n wheel.directionLocal.scale(-1, up);\n right.copy(wheel.axleLocal);\n up.cross(right, fwd);\n fwd.normalize();\n right.normalize(); // Rotate around steering over the wheelAxle\n\n const steering = wheel.steering;\n const steeringOrn = new Quaternion();\n steeringOrn.setFromAxisAngle(up, steering);\n const rotatingOrn = new Quaternion();\n rotatingOrn.setFromAxisAngle(right, wheel.rotation); // World rotation of the wheel\n\n const q = wheel.worldTransform.quaternion;\n this.chassisBody.quaternion.mult(steeringOrn, q);\n q.mult(rotatingOrn, q);\n q.normalize(); // world position of the wheel\n\n const p = wheel.worldTransform.position;\n p.copy(wheel.directionWorld);\n p.scale(wheel.suspensionLength, p);\n p.vadd(wheel.chassisConnectionPointWorld, p);\n }\n /**\n * Get the world transform of one of the wheels\n */\n\n\n getWheelTransformWorld(wheelIndex) {\n return this.wheelInfos[wheelIndex].worldTransform;\n }\n\n updateFriction(timeStep) {\n const surfNormalWS_scaled_proj = updateFriction_surfNormalWS_scaled_proj; //calculate the impulse, so that the wheels don't move sidewards\n\n const wheelInfos = this.wheelInfos;\n const numWheels = wheelInfos.length;\n const chassisBody = this.chassisBody;\n const forwardWS = updateFriction_forwardWS;\n const axle = updateFriction_axle;\n this.numWheelsOnGround = 0;\n\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i];\n const groundObject = wheel.raycastResult.body;\n\n if (groundObject) {\n this.numWheelsOnGround++;\n }\n\n wheel.sideImpulse = 0;\n wheel.forwardImpulse = 0;\n\n if (!forwardWS[i]) {\n forwardWS[i] = new Vec3();\n }\n\n if (!axle[i]) {\n axle[i] = new Vec3();\n }\n }\n\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i];\n const groundObject = wheel.raycastResult.body;\n\n if (groundObject) {\n const axlei = axle[i];\n const wheelTrans = this.getWheelTransformWorld(i); // Get world axle\n\n wheelTrans.vectorToWorldFrame(directions[this.indexRightAxis], axlei);\n const surfNormalWS = wheel.raycastResult.hitNormalWorld;\n const proj = axlei.dot(surfNormalWS);\n surfNormalWS.scale(proj, surfNormalWS_scaled_proj);\n axlei.vsub(surfNormalWS_scaled_proj, axlei);\n axlei.normalize();\n surfNormalWS.cross(axlei, forwardWS[i]);\n forwardWS[i].normalize();\n wheel.sideImpulse = resolveSingleBilateral(chassisBody, wheel.raycastResult.hitPointWorld, groundObject, wheel.raycastResult.hitPointWorld, axlei);\n wheel.sideImpulse *= sideFrictionStiffness2;\n }\n }\n\n const sideFactor = 1;\n const fwdFactor = 0.5;\n this.sliding = false;\n\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i];\n const groundObject = wheel.raycastResult.body;\n let rollingFriction = 0;\n wheel.slipInfo = 1;\n\n if (groundObject) {\n const defaultRollingFrictionImpulse = 0;\n const maxImpulse = wheel.brake ? wheel.brake : defaultRollingFrictionImpulse; // btWheelContactPoint contactPt(chassisBody,groundObject,wheelInfraycastInfo.hitPointWorld,forwardWS[wheel],maxImpulse);\n // rollingFriction = calcRollingFriction(contactPt);\n\n rollingFriction = calcRollingFriction(chassisBody, groundObject, wheel.raycastResult.hitPointWorld, forwardWS[i], maxImpulse);\n rollingFriction += wheel.engineForce * timeStep; // rollingFriction = 0;\n\n const factor = maxImpulse / rollingFriction;\n wheel.slipInfo *= factor;\n } //switch between active rolling (throttle), braking and non-active rolling friction (nthrottle/break)\n\n\n wheel.forwardImpulse = 0;\n wheel.skidInfo = 1;\n\n if (groundObject) {\n wheel.skidInfo = 1;\n const maximp = wheel.suspensionForce * timeStep * wheel.frictionSlip;\n const maximpSide = maximp;\n const maximpSquared = maximp * maximpSide;\n wheel.forwardImpulse = rollingFriction; //wheelInfo.engineForce* timeStep;\n\n const x = wheel.forwardImpulse * fwdFactor / wheel.forwardAcceleration;\n const y = wheel.sideImpulse * sideFactor / wheel.sideAcceleration;\n const impulseSquared = x * x + y * y;\n wheel.sliding = false;\n\n if (impulseSquared > maximpSquared) {\n this.sliding = true;\n wheel.sliding = true;\n const factor = maximp / Math.sqrt(impulseSquared);\n wheel.skidInfo *= factor;\n }\n }\n }\n\n if (this.sliding) {\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i];\n\n if (wheel.sideImpulse !== 0) {\n if (wheel.skidInfo < 1) {\n wheel.forwardImpulse *= wheel.skidInfo;\n wheel.sideImpulse *= wheel.skidInfo;\n }\n }\n }\n } // apply the impulses\n\n\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i];\n const rel_pos = new Vec3();\n wheel.raycastResult.hitPointWorld.vsub(chassisBody.position, rel_pos); // cannons applyimpulse is using world coord for the position\n //rel_pos.copy(wheel.raycastResult.hitPointWorld);\n\n if (wheel.forwardImpulse !== 0) {\n const impulse = new Vec3();\n forwardWS[i].scale(wheel.forwardImpulse, impulse);\n chassisBody.applyImpulse(impulse, rel_pos);\n }\n\n if (wheel.sideImpulse !== 0) {\n const groundObject = wheel.raycastResult.body;\n const rel_pos2 = new Vec3();\n wheel.raycastResult.hitPointWorld.vsub(groundObject.position, rel_pos2); //rel_pos2.copy(wheel.raycastResult.hitPointWorld);\n\n const sideImp = new Vec3();\n axle[i].scale(wheel.sideImpulse, sideImp); // Scale the relative position in the up direction with rollInfluence.\n // If rollInfluence is 1, the impulse will be applied on the hitPoint (easy to roll over), if it is zero it will be applied in the same plane as the center of mass (not easy to roll over).\n\n chassisBody.vectorToLocalFrame(rel_pos, rel_pos);\n rel_pos['xyz'[this.indexUpAxis]] *= wheel.rollInfluence;\n chassisBody.vectorToWorldFrame(rel_pos, rel_pos);\n chassisBody.applyImpulse(sideImp, rel_pos); //apply friction impulse on the ground\n\n sideImp.scale(-1, sideImp);\n groundObject.applyImpulse(sideImp, rel_pos2);\n }\n }\n }\n\n}\nconst tmpVec4 = new Vec3();\nconst tmpVec5 = new Vec3();\nconst tmpVec6 = new Vec3();\nnew Ray();\nconst castRay_rayvector = new Vec3();\nconst castRay_target = new Vec3();\nconst directions = [new Vec3(1, 0, 0), new Vec3(0, 1, 0), new Vec3(0, 0, 1)];\nconst updateFriction_surfNormalWS_scaled_proj = new Vec3();\nconst updateFriction_axle = [];\nconst updateFriction_forwardWS = [];\nconst sideFrictionStiffness2 = 1;\nconst calcRollingFriction_vel1 = new Vec3();\nconst calcRollingFriction_vel2 = new Vec3();\nconst calcRollingFriction_vel = new Vec3();\n\nfunction calcRollingFriction(body0, body1, frictionPosWorld, frictionDirectionWorld, maxImpulse) {\n let j1 = 0;\n const contactPosWorld = frictionPosWorld; // const rel_pos1 = new Vec3();\n // const rel_pos2 = new Vec3();\n\n const vel1 = calcRollingFriction_vel1;\n const vel2 = calcRollingFriction_vel2;\n const vel = calcRollingFriction_vel; // contactPosWorld.vsub(body0.position, rel_pos1);\n // contactPosWorld.vsub(body1.position, rel_pos2);\n\n body0.getVelocityAtWorldPoint(contactPosWorld, vel1);\n body1.getVelocityAtWorldPoint(contactPosWorld, vel2);\n vel1.vsub(vel2, vel);\n const vrel = frictionDirectionWorld.dot(vel);\n const denom0 = computeImpulseDenominator(body0, frictionPosWorld, frictionDirectionWorld);\n const denom1 = computeImpulseDenominator(body1, frictionPosWorld, frictionDirectionWorld);\n const relaxation = 1;\n const jacDiagABInv = relaxation / (denom0 + denom1); // calculate j that moves us to zero relative velocity\n\n j1 = -vrel * jacDiagABInv;\n\n if (maxImpulse < j1) {\n j1 = maxImpulse;\n }\n\n if (j1 < -maxImpulse) {\n j1 = -maxImpulse;\n }\n\n return j1;\n}\n\nconst computeImpulseDenominator_r0 = new Vec3();\nconst computeImpulseDenominator_c0 = new Vec3();\nconst computeImpulseDenominator_vec = new Vec3();\nconst computeImpulseDenominator_m = new Vec3();\n\nfunction computeImpulseDenominator(body, pos, normal) {\n const r0 = computeImpulseDenominator_r0;\n const c0 = computeImpulseDenominator_c0;\n const vec = computeImpulseDenominator_vec;\n const m = computeImpulseDenominator_m;\n pos.vsub(body.position, r0);\n r0.cross(normal, c0);\n body.invInertiaWorld.vmult(c0, m);\n m.cross(r0, vec);\n return body.invMass + normal.dot(vec);\n}\n\nconst resolveSingleBilateral_vel1 = new Vec3();\nconst resolveSingleBilateral_vel2 = new Vec3();\nconst resolveSingleBilateral_vel = new Vec3(); // bilateral constraint between two dynamic objects\n\nfunction resolveSingleBilateral(body1, pos1, body2, pos2, normal) {\n const normalLenSqr = normal.lengthSquared();\n\n if (normalLenSqr > 1.1) {\n return 0; // no impulse\n } // const rel_pos1 = new Vec3();\n // const rel_pos2 = new Vec3();\n // pos1.vsub(body1.position, rel_pos1);\n // pos2.vsub(body2.position, rel_pos2);\n\n\n const vel1 = resolveSingleBilateral_vel1;\n const vel2 = resolveSingleBilateral_vel2;\n const vel = resolveSingleBilateral_vel;\n body1.getVelocityAtWorldPoint(pos1, vel1);\n body2.getVelocityAtWorldPoint(pos2, vel2);\n vel1.vsub(vel2, vel);\n const rel_vel = normal.dot(vel);\n const contactDamping = 0.2;\n const massTerm = 1 / (body1.invMass + body2.invMass);\n const impulse = -contactDamping * rel_vel * massTerm;\n return impulse;\n}\n\n/**\n * Spherical shape\n * @example\n * const radius = 1\n * const sphereShape = new CANNON.Sphere(radius)\n * const sphereBody = new CANNON.Body({ mass: 1, shape: sphereShape })\n * world.addBody(sphereBody)\n */\nclass Sphere extends Shape {\n /**\n * The radius of the sphere.\n */\n\n /**\n *\n * @param radius The radius of the sphere, a non-negative number.\n */\n constructor(radius) {\n super({\n type: Shape.types.SPHERE\n });\n this.radius = void 0;\n this.radius = radius !== undefined ? radius : 1.0;\n\n if (this.radius < 0) {\n throw new Error('The sphere radius cannot be negative.');\n }\n\n this.updateBoundingSphereRadius();\n }\n /** calculateLocalInertia */\n\n\n calculateLocalInertia(mass, target = new Vec3()) {\n const I = 2.0 * mass * this.radius * this.radius / 5.0;\n target.x = I;\n target.y = I;\n target.z = I;\n return target;\n }\n /** volume */\n\n\n volume() {\n return 4.0 * Math.PI * Math.pow(this.radius, 3) / 3.0;\n }\n\n updateBoundingSphereRadius() {\n this.boundingSphereRadius = this.radius;\n }\n\n calculateWorldAABB(pos, quat, min, max) {\n const r = this.radius;\n const axes = ['x', 'y', 'z'];\n\n for (let i = 0; i < axes.length; i++) {\n const ax = axes[i];\n min[ax] = pos[ax] - r;\n max[ax] = pos[ax] + r;\n }\n }\n\n}\n\n/**\n * Simple vehicle helper class with spherical rigid body wheels.\n */\nclass RigidVehicle {\n /**\n * The bodies of the wheels.\n */\n\n /**\n * The chassis body.\n */\n\n /**\n * The constraints.\n */\n\n /**\n * The wheel axes.\n */\n\n /**\n * The wheel forces.\n */\n constructor(options = {}) {\n this.wheelBodies = void 0;\n this.coordinateSystem = void 0;\n this.chassisBody = void 0;\n this.constraints = void 0;\n this.wheelAxes = void 0;\n this.wheelForces = void 0;\n this.wheelBodies = [];\n this.coordinateSystem = typeof options.coordinateSystem !== 'undefined' ? options.coordinateSystem.clone() : new Vec3(1, 2, 3);\n\n if (options.chassisBody) {\n this.chassisBody = options.chassisBody;\n } else {\n // No chassis body given. Create it!\n this.chassisBody = new Body({\n mass: 1,\n shape: new Box(new Vec3(5, 0.5, 2))\n });\n }\n\n this.constraints = [];\n this.wheelAxes = [];\n this.wheelForces = [];\n }\n /**\n * Add a wheel\n */\n\n\n addWheel(options = {}) {\n let wheelBody;\n\n if (options.body) {\n wheelBody = options.body;\n } else {\n // No wheel body given. Create it!\n wheelBody = new Body({\n mass: 1,\n shape: new Sphere(1.2)\n });\n }\n\n this.wheelBodies.push(wheelBody);\n this.wheelForces.push(0); // Position constrain wheels\n\n const position = typeof options.position !== 'undefined' ? options.position.clone() : new Vec3(); // Set position locally to the chassis\n\n const worldPosition = new Vec3();\n this.chassisBody.pointToWorldFrame(position, worldPosition);\n wheelBody.position.set(worldPosition.x, worldPosition.y, worldPosition.z); // Constrain wheel\n\n const axis = typeof options.axis !== 'undefined' ? options.axis.clone() : new Vec3(0, 0, 1);\n this.wheelAxes.push(axis);\n const hingeConstraint = new HingeConstraint(this.chassisBody, wheelBody, {\n pivotA: position,\n axisA: axis,\n pivotB: Vec3.ZERO,\n axisB: axis,\n collideConnected: false\n });\n this.constraints.push(hingeConstraint);\n return this.wheelBodies.length - 1;\n }\n /**\n * Set the steering value of a wheel.\n * @todo check coordinateSystem\n */\n\n\n setSteeringValue(value, wheelIndex) {\n // Set angle of the hinge axis\n const axis = this.wheelAxes[wheelIndex];\n const c = Math.cos(value);\n const s = Math.sin(value);\n const x = axis.x;\n const z = axis.z;\n this.constraints[wheelIndex].axisA.set(-c * x + s * z, 0, s * x + c * z);\n }\n /**\n * Set the target rotational speed of the hinge constraint.\n */\n\n\n setMotorSpeed(value, wheelIndex) {\n const hingeConstraint = this.constraints[wheelIndex];\n hingeConstraint.enableMotor();\n hingeConstraint.motorTargetVelocity = value;\n }\n /**\n * Set the target rotational speed of the hinge constraint.\n */\n\n\n disableMotor(wheelIndex) {\n const hingeConstraint = this.constraints[wheelIndex];\n hingeConstraint.disableMotor();\n }\n /**\n * Set the wheel force to apply on one of the wheels each time step\n */\n\n\n setWheelForce(value, wheelIndex) {\n this.wheelForces[wheelIndex] = value;\n }\n /**\n * Apply a torque on one of the wheels.\n */\n\n\n applyWheelForce(value, wheelIndex) {\n const axis = this.wheelAxes[wheelIndex];\n const wheelBody = this.wheelBodies[wheelIndex];\n const bodyTorque = wheelBody.torque;\n axis.scale(value, torque);\n wheelBody.vectorToWorldFrame(torque, torque);\n bodyTorque.vadd(torque, bodyTorque);\n }\n /**\n * Add the vehicle including its constraints to the world.\n */\n\n\n addToWorld(world) {\n const constraints = this.constraints;\n const bodies = this.wheelBodies.concat([this.chassisBody]);\n\n for (let i = 0; i < bodies.length; i++) {\n world.addBody(bodies[i]);\n }\n\n for (let i = 0; i < constraints.length; i++) {\n world.addConstraint(constraints[i]);\n }\n\n world.addEventListener('preStep', this._update.bind(this));\n }\n\n _update() {\n const wheelForces = this.wheelForces;\n\n for (let i = 0; i < wheelForces.length; i++) {\n this.applyWheelForce(wheelForces[i], i);\n }\n }\n /**\n * Remove the vehicle including its constraints from the world.\n */\n\n\n removeFromWorld(world) {\n const constraints = this.constraints;\n const bodies = this.wheelBodies.concat([this.chassisBody]);\n\n for (let i = 0; i < bodies.length; i++) {\n world.removeBody(bodies[i]);\n }\n\n for (let i = 0; i < constraints.length; i++) {\n world.removeConstraint(constraints[i]);\n }\n }\n /**\n * Get current rotational velocity of a wheel\n */\n\n\n getWheelSpeed(wheelIndex) {\n const axis = this.wheelAxes[wheelIndex];\n const wheelBody = this.wheelBodies[wheelIndex];\n const w = wheelBody.angularVelocity;\n this.chassisBody.vectorToWorldFrame(axis, worldAxis);\n return w.dot(worldAxis);\n }\n\n}\nconst torque = new Vec3();\nconst worldAxis = new Vec3();\n\n/**\n * Smoothed-particle hydrodynamics system\n * @todo Make parameters customizable in the constructor\n */\nclass SPHSystem {\n /**\n * The particles array.\n */\n\n /**\n * Density of the system (kg/m3).\n * @default 1\n */\n\n /**\n * Distance below which two particles are considered to be neighbors.\n * It should be adjusted so there are about 15-20 neighbor particles within this radius.\n * @default 1\n */\n\n /**\n * @default 1\n */\n\n /**\n * Viscosity of the system.\n * @default 0.01\n */\n\n /**\n * @default 0.000001\n */\n constructor() {\n this.particles = void 0;\n this.density = void 0;\n this.smoothingRadius = void 0;\n this.speedOfSound = void 0;\n this.viscosity = void 0;\n this.eps = void 0;\n this.pressures = void 0;\n this.densities = void 0;\n this.neighbors = void 0;\n this.particles = [];\n this.density = 1;\n this.smoothingRadius = 1;\n this.speedOfSound = 1;\n this.viscosity = 0.01;\n this.eps = 0.000001; // Stuff Computed per particle\n\n this.pressures = [];\n this.densities = [];\n this.neighbors = [];\n }\n /**\n * Add a particle to the system.\n */\n\n\n add(particle) {\n this.particles.push(particle);\n\n if (this.neighbors.length < this.particles.length) {\n this.neighbors.push([]);\n }\n }\n /**\n * Remove a particle from the system.\n */\n\n\n remove(particle) {\n const idx = this.particles.indexOf(particle);\n\n if (idx !== -1) {\n this.particles.splice(idx, 1);\n\n if (this.neighbors.length > this.particles.length) {\n this.neighbors.pop();\n }\n }\n }\n /**\n * Get neighbors within smoothing volume, save in the array neighbors\n */\n\n\n getNeighbors(particle, neighbors) {\n const N = this.particles.length;\n const id = particle.id;\n const R2 = this.smoothingRadius * this.smoothingRadius;\n const dist = SPHSystem_getNeighbors_dist;\n\n for (let i = 0; i !== N; i++) {\n const p = this.particles[i];\n p.position.vsub(particle.position, dist);\n\n if (id !== p.id && dist.lengthSquared() < R2) {\n neighbors.push(p);\n }\n }\n }\n\n update() {\n const N = this.particles.length;\n const dist = SPHSystem_update_dist;\n const cs = this.speedOfSound;\n const eps = this.eps;\n\n for (let i = 0; i !== N; i++) {\n const p = this.particles[i]; // Current particle\n\n const neighbors = this.neighbors[i]; // Get neighbors\n\n neighbors.length = 0;\n this.getNeighbors(p, neighbors);\n neighbors.push(this.particles[i]); // Add current too\n\n const numNeighbors = neighbors.length; // Accumulate density for the particle\n\n let sum = 0.0;\n\n for (let j = 0; j !== numNeighbors; j++) {\n //printf(\"Current particle has position %f %f %f\\n\",objects[id].pos.x(),objects[id].pos.y(),objects[id].pos.z());\n p.position.vsub(neighbors[j].position, dist);\n const len = dist.length();\n const weight = this.w(len);\n sum += neighbors[j].mass * weight;\n } // Save\n\n\n this.densities[i] = sum;\n this.pressures[i] = cs * cs * (this.densities[i] - this.density);\n } // Add forces\n // Sum to these accelerations\n\n\n const a_pressure = SPHSystem_update_a_pressure;\n const a_visc = SPHSystem_update_a_visc;\n const gradW = SPHSystem_update_gradW;\n const r_vec = SPHSystem_update_r_vec;\n const u = SPHSystem_update_u;\n\n for (let i = 0; i !== N; i++) {\n const particle = this.particles[i];\n a_pressure.set(0, 0, 0);\n a_visc.set(0, 0, 0); // Init vars\n\n let Pij;\n let nabla;\n\n const neighbors = this.neighbors[i];\n const numNeighbors = neighbors.length; //printf(\"Neighbors: \");\n\n for (let j = 0; j !== numNeighbors; j++) {\n const neighbor = neighbors[j]; //printf(\"%d \",nj);\n // Get r once for all..\n\n particle.position.vsub(neighbor.position, r_vec);\n const r = r_vec.length(); // Pressure contribution\n\n Pij = -neighbor.mass * (this.pressures[i] / (this.densities[i] * this.densities[i] + eps) + this.pressures[j] / (this.densities[j] * this.densities[j] + eps));\n this.gradw(r_vec, gradW); // Add to pressure acceleration\n\n gradW.scale(Pij, gradW);\n a_pressure.vadd(gradW, a_pressure); // Viscosity contribution\n\n neighbor.velocity.vsub(particle.velocity, u);\n u.scale(1.0 / (0.0001 + this.densities[i] * this.densities[j]) * this.viscosity * neighbor.mass, u);\n nabla = this.nablaw(r);\n u.scale(nabla, u); // Add to viscosity acceleration\n\n a_visc.vadd(u, a_visc);\n } // Calculate force\n\n\n a_visc.scale(particle.mass, a_visc);\n a_pressure.scale(particle.mass, a_pressure); // Add force to particles\n\n particle.force.vadd(a_visc, particle.force);\n particle.force.vadd(a_pressure, particle.force);\n }\n } // Calculate the weight using the W(r) weightfunction\n\n\n w(r) {\n // 315\n const h = this.smoothingRadius;\n return 315.0 / (64.0 * Math.PI * h ** 9) * (h * h - r * r) ** 3;\n } // calculate gradient of the weight function\n\n\n gradw(rVec, resultVec) {\n const r = rVec.length();\n const h = this.smoothingRadius;\n rVec.scale(945.0 / (32.0 * Math.PI * h ** 9) * (h * h - r * r) ** 2, resultVec);\n } // Calculate nabla(W)\n\n\n nablaw(r) {\n const h = this.smoothingRadius;\n const nabla = 945.0 / (32.0 * Math.PI * h ** 9) * (h * h - r * r) * (7 * r * r - 3 * h * h);\n return nabla;\n }\n\n}\nconst SPHSystem_getNeighbors_dist = new Vec3(); // Temp vectors for calculation\n\nconst SPHSystem_update_dist = new Vec3(); // Relative velocity\n\nconst SPHSystem_update_a_pressure = new Vec3();\nconst SPHSystem_update_a_visc = new Vec3();\nconst SPHSystem_update_gradW = new Vec3();\nconst SPHSystem_update_r_vec = new Vec3();\nconst SPHSystem_update_u = new Vec3();\n\n/**\n * Cylinder class.\n * @example\n * const radiusTop = 0.5\n * const radiusBottom = 0.5\n * const height = 2\n * const numSegments = 12\n * const cylinderShape = new CANNON.Cylinder(radiusTop, radiusBottom, height, numSegments)\n * const cylinderBody = new CANNON.Body({ mass: 1, shape: cylinderShape })\n * world.addBody(cylinderBody)\n */\n\nclass Cylinder extends ConvexPolyhedron {\n /** The radius of the top of the Cylinder. */\n\n /** The radius of the bottom of the Cylinder. */\n\n /** The height of the Cylinder. */\n\n /** The number of segments to build the cylinder out of. */\n\n /**\n * @param radiusTop The radius of the top of the Cylinder.\n * @param radiusBottom The radius of the bottom of the Cylinder.\n * @param height The height of the Cylinder.\n * @param numSegments The number of segments to build the cylinder out of.\n */\n constructor(radiusTop = 1, radiusBottom = 1, height = 1, numSegments = 8) {\n if (radiusTop < 0) {\n throw new Error('The cylinder radiusTop cannot be negative.');\n }\n\n if (radiusBottom < 0) {\n throw new Error('The cylinder radiusBottom cannot be negative.');\n }\n\n const N = numSegments;\n const vertices = [];\n const axes = [];\n const faces = [];\n const bottomface = [];\n const topface = [];\n const cos = Math.cos;\n const sin = Math.sin; // First bottom point\n\n vertices.push(new Vec3(-radiusBottom * sin(0), -height * 0.5, radiusBottom * cos(0)));\n bottomface.push(0); // First top point\n\n vertices.push(new Vec3(-radiusTop * sin(0), height * 0.5, radiusTop * cos(0)));\n topface.push(1);\n\n for (let i = 0; i < N; i++) {\n const theta = 2 * Math.PI / N * (i + 1);\n const thetaN = 2 * Math.PI / N * (i + 0.5);\n\n if (i < N - 1) {\n // Bottom\n vertices.push(new Vec3(-radiusBottom * sin(theta), -height * 0.5, radiusBottom * cos(theta)));\n bottomface.push(2 * i + 2); // Top\n\n vertices.push(new Vec3(-radiusTop * sin(theta), height * 0.5, radiusTop * cos(theta)));\n topface.push(2 * i + 3); // Face\n\n faces.push([2 * i, 2 * i + 1, 2 * i + 3, 2 * i + 2]);\n } else {\n faces.push([2 * i, 2 * i + 1, 1, 0]); // Connect\n } // Axis: we can cut off half of them if we have even number of segments\n\n\n if (N % 2 === 1 || i < N / 2) {\n axes.push(new Vec3(-sin(thetaN), 0, cos(thetaN)));\n }\n }\n\n faces.push(bottomface);\n axes.push(new Vec3(0, 1, 0)); // Reorder top face\n\n const temp = [];\n\n for (let i = 0; i < topface.length; i++) {\n temp.push(topface[topface.length - i - 1]);\n }\n\n faces.push(temp);\n super({\n vertices,\n faces,\n axes\n });\n this.radiusTop = void 0;\n this.radiusBottom = void 0;\n this.height = void 0;\n this.numSegments = void 0;\n this.type = Shape.types.CYLINDER;\n this.radiusTop = radiusTop;\n this.radiusBottom = radiusBottom;\n this.height = height;\n this.numSegments = numSegments;\n }\n\n}\n\n/**\n * Particle shape.\n * @example\n * const particleShape = new CANNON.Particle()\n * const particleBody = new CANNON.Body({ mass: 1, shape: particleShape })\n * world.addBody(particleBody)\n */\nclass Particle extends Shape {\n constructor() {\n super({\n type: Shape.types.PARTICLE\n });\n }\n /**\n * calculateLocalInertia\n */\n\n\n calculateLocalInertia(mass, target = new Vec3()) {\n target.set(0, 0, 0);\n return target;\n }\n\n volume() {\n return 0;\n }\n\n updateBoundingSphereRadius() {\n this.boundingSphereRadius = 0;\n }\n\n calculateWorldAABB(pos, quat, min, max) {\n // Get each axis max\n min.copy(pos);\n max.copy(pos);\n }\n\n}\n\n/**\n * A plane, facing in the Z direction. The plane has its surface at z=0 and everything below z=0 is assumed to be solid plane. To make the plane face in some other direction than z, you must put it inside a Body and rotate that body. See the demos.\n * @example\n * const planeShape = new CANNON.Plane()\n * const planeBody = new CANNON.Body({ mass: 0, shape: planeShape })\n * planeBody.quaternion.setFromEuler(-Math.PI / 2, 0, 0) // make it face up\n * world.addBody(planeBody)\n */\nclass Plane extends Shape {\n /** worldNormal */\n\n /** worldNormalNeedsUpdate */\n constructor() {\n super({\n type: Shape.types.PLANE\n }); // World oriented normal\n\n this.worldNormal = void 0;\n this.worldNormalNeedsUpdate = void 0;\n this.boundingSphereRadius = void 0;\n this.worldNormal = new Vec3();\n this.worldNormalNeedsUpdate = true;\n this.boundingSphereRadius = Number.MAX_VALUE;\n }\n /** computeWorldNormal */\n\n\n computeWorldNormal(quat) {\n const n = this.worldNormal;\n n.set(0, 0, 1);\n quat.vmult(n, n);\n this.worldNormalNeedsUpdate = false;\n }\n\n calculateLocalInertia(mass, target = new Vec3()) {\n return target;\n }\n\n volume() {\n return (// The plane is infinite...\n Number.MAX_VALUE\n );\n }\n\n calculateWorldAABB(pos, quat, min, max) {\n // The plane AABB is infinite, except if the normal is pointing along any axis\n tempNormal.set(0, 0, 1); // Default plane normal is z\n\n quat.vmult(tempNormal, tempNormal);\n const maxVal = Number.MAX_VALUE;\n min.set(-maxVal, -maxVal, -maxVal);\n max.set(maxVal, maxVal, maxVal);\n\n if (tempNormal.x === 1) {\n max.x = pos.x;\n } else if (tempNormal.x === -1) {\n min.x = pos.x;\n }\n\n if (tempNormal.y === 1) {\n max.y = pos.y;\n } else if (tempNormal.y === -1) {\n min.y = pos.y;\n }\n\n if (tempNormal.z === 1) {\n max.z = pos.z;\n } else if (tempNormal.z === -1) {\n min.z = pos.z;\n }\n }\n\n updateBoundingSphereRadius() {\n this.boundingSphereRadius = Number.MAX_VALUE;\n }\n\n}\nconst tempNormal = new Vec3();\n\n/**\n * Heightfield shape class. Height data is given as an array. These data points are spread out evenly with a given distance.\n * @todo Should be possible to use along all axes, not just y\n * @todo should be possible to scale along all axes\n * @todo Refactor elementSize to elementSizeX and elementSizeY\n *\n * @example\n * // Generate some height data (y-values).\n * const data = []\n * for (let i = 0; i < 1000; i++) {\n * const y = 0.5 * Math.cos(0.2 * i)\n * data.push(y)\n * }\n *\n * // Create the heightfield shape\n * const heightfieldShape = new CANNON.Heightfield(data, {\n * elementSize: 1 // Distance between the data points in X and Y directions\n * })\n * const heightfieldBody = new CANNON.Body({ shape: heightfieldShape })\n * world.addBody(heightfieldBody)\n */\nclass Heightfield extends Shape {\n /**\n * An array of numbers, or height values, that are spread out along the x axis.\n */\n\n /**\n * Max value of the data points in the data array.\n */\n\n /**\n * Minimum value of the data points in the data array.\n */\n\n /**\n * World spacing between the data points in X and Y direction.\n * @todo elementSizeX and Y\n * @default 1\n */\n\n /**\n * @default true\n */\n\n /**\n * @param data An array of numbers, or height values, that are spread out along the x axis.\n */\n constructor(data, options = {}) {\n options = Utils.defaults(options, {\n maxValue: null,\n minValue: null,\n elementSize: 1\n });\n super({\n type: Shape.types.HEIGHTFIELD\n });\n this.data = void 0;\n this.maxValue = void 0;\n this.minValue = void 0;\n this.elementSize = void 0;\n this.cacheEnabled = void 0;\n this.pillarConvex = void 0;\n this.pillarOffset = void 0;\n this._cachedPillars = void 0;\n this.data = data;\n this.maxValue = options.maxValue;\n this.minValue = options.minValue;\n this.elementSize = options.elementSize;\n\n if (options.minValue === null) {\n this.updateMinValue();\n }\n\n if (options.maxValue === null) {\n this.updateMaxValue();\n }\n\n this.cacheEnabled = true;\n this.pillarConvex = new ConvexPolyhedron();\n this.pillarOffset = new Vec3();\n this.updateBoundingSphereRadius(); // \"i_j_isUpper\" => { convex: ..., offset: ... }\n // for example:\n // _cachedPillars[\"0_2_1\"]\n\n this._cachedPillars = {};\n }\n /**\n * Call whenever you change the data array.\n */\n\n\n update() {\n this._cachedPillars = {};\n }\n /**\n * Update the `minValue` property\n */\n\n\n updateMinValue() {\n const data = this.data;\n let minValue = data[0][0];\n\n for (let i = 0; i !== data.length; i++) {\n for (let j = 0; j !== data[i].length; j++) {\n const v = data[i][j];\n\n if (v < minValue) {\n minValue = v;\n }\n }\n }\n\n this.minValue = minValue;\n }\n /**\n * Update the `maxValue` property\n */\n\n\n updateMaxValue() {\n const data = this.data;\n let maxValue = data[0][0];\n\n for (let i = 0; i !== data.length; i++) {\n for (let j = 0; j !== data[i].length; j++) {\n const v = data[i][j];\n\n if (v > maxValue) {\n maxValue = v;\n }\n }\n }\n\n this.maxValue = maxValue;\n }\n /**\n * Set the height value at an index. Don't forget to update maxValue and minValue after you're done.\n */\n\n\n setHeightValueAtIndex(xi, yi, value) {\n const data = this.data;\n data[xi][yi] = value; // Invalidate cache\n\n this.clearCachedConvexTrianglePillar(xi, yi, false);\n\n if (xi > 0) {\n this.clearCachedConvexTrianglePillar(xi - 1, yi, true);\n this.clearCachedConvexTrianglePillar(xi - 1, yi, false);\n }\n\n if (yi > 0) {\n this.clearCachedConvexTrianglePillar(xi, yi - 1, true);\n this.clearCachedConvexTrianglePillar(xi, yi - 1, false);\n }\n\n if (yi > 0 && xi > 0) {\n this.clearCachedConvexTrianglePillar(xi - 1, yi - 1, true);\n }\n }\n /**\n * Get max/min in a rectangle in the matrix data\n * @param result An array to store the results in.\n * @return The result array, if it was passed in. Minimum will be at position 0 and max at 1.\n */\n\n\n getRectMinMax(iMinX, iMinY, iMaxX, iMaxY, result = []) {\n // Get max and min of the data\n const data = this.data; // Set first value\n\n let max = this.minValue;\n\n for (let i = iMinX; i <= iMaxX; i++) {\n for (let j = iMinY; j <= iMaxY; j++) {\n const height = data[i][j];\n\n if (height > max) {\n max = height;\n }\n }\n }\n\n result[0] = this.minValue;\n result[1] = max;\n }\n /**\n * Get the index of a local position on the heightfield. The indexes indicate the rectangles, so if your terrain is made of N x N height data points, you will have rectangle indexes ranging from 0 to N-1.\n * @param result Two-element array\n * @param clamp If the position should be clamped to the heightfield edge.\n */\n\n\n getIndexOfPosition(x, y, result, clamp) {\n // Get the index of the data points to test against\n const w = this.elementSize;\n const data = this.data;\n let xi = Math.floor(x / w);\n let yi = Math.floor(y / w);\n result[0] = xi;\n result[1] = yi;\n\n if (clamp) {\n // Clamp index to edges\n if (xi < 0) {\n xi = 0;\n }\n\n if (yi < 0) {\n yi = 0;\n }\n\n if (xi >= data.length - 1) {\n xi = data.length - 1;\n }\n\n if (yi >= data[0].length - 1) {\n yi = data[0].length - 1;\n }\n } // Bail out if we are out of the terrain\n\n\n if (xi < 0 || yi < 0 || xi >= data.length - 1 || yi >= data[0].length - 1) {\n return false;\n }\n\n return true;\n }\n\n getTriangleAt(x, y, edgeClamp, a, b, c) {\n const idx = getHeightAt_idx;\n this.getIndexOfPosition(x, y, idx, edgeClamp);\n let xi = idx[0];\n let yi = idx[1];\n const data = this.data;\n\n if (edgeClamp) {\n xi = Math.min(data.length - 2, Math.max(0, xi));\n yi = Math.min(data[0].length - 2, Math.max(0, yi));\n }\n\n const elementSize = this.elementSize;\n const lowerDist2 = (x / elementSize - xi) ** 2 + (y / elementSize - yi) ** 2;\n const upperDist2 = (x / elementSize - (xi + 1)) ** 2 + (y / elementSize - (yi + 1)) ** 2;\n const upper = lowerDist2 > upperDist2;\n this.getTriangle(xi, yi, upper, a, b, c);\n return upper;\n }\n\n getNormalAt(x, y, edgeClamp, result) {\n const a = getNormalAt_a;\n const b = getNormalAt_b;\n const c = getNormalAt_c;\n const e0 = getNormalAt_e0;\n const e1 = getNormalAt_e1;\n this.getTriangleAt(x, y, edgeClamp, a, b, c);\n b.vsub(a, e0);\n c.vsub(a, e1);\n e0.cross(e1, result);\n result.normalize();\n }\n /**\n * Get an AABB of a square in the heightfield\n * @param xi\n * @param yi\n * @param result\n */\n\n\n getAabbAtIndex(xi, yi, {\n lowerBound,\n upperBound\n }) {\n const data = this.data;\n const elementSize = this.elementSize;\n lowerBound.set(xi * elementSize, yi * elementSize, data[xi][yi]);\n upperBound.set((xi + 1) * elementSize, (yi + 1) * elementSize, data[xi + 1][yi + 1]);\n }\n /**\n * Get the height in the heightfield at a given position\n */\n\n\n getHeightAt(x, y, edgeClamp) {\n const data = this.data;\n const a = getHeightAt_a;\n const b = getHeightAt_b;\n const c = getHeightAt_c;\n const idx = getHeightAt_idx;\n this.getIndexOfPosition(x, y, idx, edgeClamp);\n let xi = idx[0];\n let yi = idx[1];\n\n if (edgeClamp) {\n xi = Math.min(data.length - 2, Math.max(0, xi));\n yi = Math.min(data[0].length - 2, Math.max(0, yi));\n }\n\n const upper = this.getTriangleAt(x, y, edgeClamp, a, b, c);\n barycentricWeights(x, y, a.x, a.y, b.x, b.y, c.x, c.y, getHeightAt_weights);\n const w = getHeightAt_weights;\n\n if (upper) {\n // Top triangle verts\n return data[xi + 1][yi + 1] * w.x + data[xi][yi + 1] * w.y + data[xi + 1][yi] * w.z;\n } else {\n // Top triangle verts\n return data[xi][yi] * w.x + data[xi + 1][yi] * w.y + data[xi][yi + 1] * w.z;\n }\n }\n\n getCacheConvexTrianglePillarKey(xi, yi, getUpperTriangle) {\n return xi + \"_\" + yi + \"_\" + (getUpperTriangle ? 1 : 0);\n }\n\n getCachedConvexTrianglePillar(xi, yi, getUpperTriangle) {\n return this._cachedPillars[this.getCacheConvexTrianglePillarKey(xi, yi, getUpperTriangle)];\n }\n\n setCachedConvexTrianglePillar(xi, yi, getUpperTriangle, convex, offset) {\n this._cachedPillars[this.getCacheConvexTrianglePillarKey(xi, yi, getUpperTriangle)] = {\n convex,\n offset\n };\n }\n\n clearCachedConvexTrianglePillar(xi, yi, getUpperTriangle) {\n delete this._cachedPillars[this.getCacheConvexTrianglePillarKey(xi, yi, getUpperTriangle)];\n }\n /**\n * Get a triangle from the heightfield\n */\n\n\n getTriangle(xi, yi, upper, a, b, c) {\n const data = this.data;\n const elementSize = this.elementSize;\n\n if (upper) {\n // Top triangle verts\n a.set((xi + 1) * elementSize, (yi + 1) * elementSize, data[xi + 1][yi + 1]);\n b.set(xi * elementSize, (yi + 1) * elementSize, data[xi][yi + 1]);\n c.set((xi + 1) * elementSize, yi * elementSize, data[xi + 1][yi]);\n } else {\n // Top triangle verts\n a.set(xi * elementSize, yi * elementSize, data[xi][yi]);\n b.set((xi + 1) * elementSize, yi * elementSize, data[xi + 1][yi]);\n c.set(xi * elementSize, (yi + 1) * elementSize, data[xi][yi + 1]);\n }\n }\n /**\n * Get a triangle in the terrain in the form of a triangular convex shape.\n */\n\n\n getConvexTrianglePillar(xi, yi, getUpperTriangle) {\n let result = this.pillarConvex;\n let offsetResult = this.pillarOffset;\n\n if (this.cacheEnabled) {\n const data = this.getCachedConvexTrianglePillar(xi, yi, getUpperTriangle);\n\n if (data) {\n this.pillarConvex = data.convex;\n this.pillarOffset = data.offset;\n return;\n }\n\n result = new ConvexPolyhedron();\n offsetResult = new Vec3();\n this.pillarConvex = result;\n this.pillarOffset = offsetResult;\n }\n\n const data = this.data;\n const elementSize = this.elementSize;\n const faces = result.faces; // Reuse verts if possible\n\n result.vertices.length = 6;\n\n for (let i = 0; i < 6; i++) {\n if (!result.vertices[i]) {\n result.vertices[i] = new Vec3();\n }\n } // Reuse faces if possible\n\n\n faces.length = 5;\n\n for (let i = 0; i < 5; i++) {\n if (!faces[i]) {\n faces[i] = [];\n }\n }\n\n const verts = result.vertices;\n const h = (Math.min(data[xi][yi], data[xi + 1][yi], data[xi][yi + 1], data[xi + 1][yi + 1]) - this.minValue) / 2 + this.minValue;\n\n if (!getUpperTriangle) {\n // Center of the triangle pillar - all polygons are given relative to this one\n offsetResult.set((xi + 0.25) * elementSize, // sort of center of a triangle\n (yi + 0.25) * elementSize, h // vertical center\n ); // Top triangle verts\n\n verts[0].set(-0.25 * elementSize, -0.25 * elementSize, data[xi][yi] - h);\n verts[1].set(0.75 * elementSize, -0.25 * elementSize, data[xi + 1][yi] - h);\n verts[2].set(-0.25 * elementSize, 0.75 * elementSize, data[xi][yi + 1] - h); // bottom triangle verts\n\n verts[3].set(-0.25 * elementSize, -0.25 * elementSize, -Math.abs(h) - 1);\n verts[4].set(0.75 * elementSize, -0.25 * elementSize, -Math.abs(h) - 1);\n verts[5].set(-0.25 * elementSize, 0.75 * elementSize, -Math.abs(h) - 1); // top triangle\n\n faces[0][0] = 0;\n faces[0][1] = 1;\n faces[0][2] = 2; // bottom triangle\n\n faces[1][0] = 5;\n faces[1][1] = 4;\n faces[1][2] = 3; // -x facing quad\n\n faces[2][0] = 0;\n faces[2][1] = 2;\n faces[2][2] = 5;\n faces[2][3] = 3; // -y facing quad\n\n faces[3][0] = 1;\n faces[3][1] = 0;\n faces[3][2] = 3;\n faces[3][3] = 4; // +xy facing quad\n\n faces[4][0] = 4;\n faces[4][1] = 5;\n faces[4][2] = 2;\n faces[4][3] = 1;\n } else {\n // Center of the triangle pillar - all polygons are given relative to this one\n offsetResult.set((xi + 0.75) * elementSize, // sort of center of a triangle\n (yi + 0.75) * elementSize, h // vertical center\n ); // Top triangle verts\n\n verts[0].set(0.25 * elementSize, 0.25 * elementSize, data[xi + 1][yi + 1] - h);\n verts[1].set(-0.75 * elementSize, 0.25 * elementSize, data[xi][yi + 1] - h);\n verts[2].set(0.25 * elementSize, -0.75 * elementSize, data[xi + 1][yi] - h); // bottom triangle verts\n\n verts[3].set(0.25 * elementSize, 0.25 * elementSize, -Math.abs(h) - 1);\n verts[4].set(-0.75 * elementSize, 0.25 * elementSize, -Math.abs(h) - 1);\n verts[5].set(0.25 * elementSize, -0.75 * elementSize, -Math.abs(h) - 1); // Top triangle\n\n faces[0][0] = 0;\n faces[0][1] = 1;\n faces[0][2] = 2; // bottom triangle\n\n faces[1][0] = 5;\n faces[1][1] = 4;\n faces[1][2] = 3; // +x facing quad\n\n faces[2][0] = 2;\n faces[2][1] = 5;\n faces[2][2] = 3;\n faces[2][3] = 0; // +y facing quad\n\n faces[3][0] = 3;\n faces[3][1] = 4;\n faces[3][2] = 1;\n faces[3][3] = 0; // -xy facing quad\n\n faces[4][0] = 1;\n faces[4][1] = 4;\n faces[4][2] = 5;\n faces[4][3] = 2;\n }\n\n result.computeNormals();\n result.computeEdges();\n result.updateBoundingSphereRadius();\n this.setCachedConvexTrianglePillar(xi, yi, getUpperTriangle, result, offsetResult);\n }\n\n calculateLocalInertia(mass, target = new Vec3()) {\n target.set(0, 0, 0);\n return target;\n }\n\n volume() {\n return (// The terrain is infinite\n Number.MAX_VALUE\n );\n }\n\n calculateWorldAABB(pos, quat, min, max) {\n /** @TODO do it properly */\n min.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\n max.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n }\n\n updateBoundingSphereRadius() {\n // Use the bounding box of the min/max values\n const data = this.data;\n const s = this.elementSize;\n this.boundingSphereRadius = new Vec3(data.length * s, data[0].length * s, Math.max(Math.abs(this.maxValue), Math.abs(this.minValue))).length();\n }\n /**\n * Sets the height values from an image. Currently only supported in browser.\n */\n\n\n setHeightsFromImage(image, scale) {\n const {\n x,\n z,\n y\n } = scale;\n const canvas = document.createElement('canvas');\n canvas.width = image.width;\n canvas.height = image.height;\n const context = canvas.getContext('2d');\n context.drawImage(image, 0, 0);\n const imageData = context.getImageData(0, 0, image.width, image.height);\n const matrix = this.data;\n matrix.length = 0;\n this.elementSize = Math.abs(x) / imageData.width;\n\n for (let i = 0; i < imageData.height; i++) {\n const row = [];\n\n for (let j = 0; j < imageData.width; j++) {\n const a = imageData.data[(i * imageData.height + j) * 4];\n const b = imageData.data[(i * imageData.height + j) * 4 + 1];\n const c = imageData.data[(i * imageData.height + j) * 4 + 2];\n const height = (a + b + c) / 4 / 255 * z;\n\n if (x < 0) {\n row.push(height);\n } else {\n row.unshift(height);\n }\n }\n\n if (y < 0) {\n matrix.unshift(row);\n } else {\n matrix.push(row);\n }\n }\n\n this.updateMaxValue();\n this.updateMinValue();\n this.update();\n }\n\n}\nconst getHeightAt_idx = [];\nconst getHeightAt_weights = new Vec3();\nconst getHeightAt_a = new Vec3();\nconst getHeightAt_b = new Vec3();\nconst getHeightAt_c = new Vec3();\nconst getNormalAt_a = new Vec3();\nconst getNormalAt_b = new Vec3();\nconst getNormalAt_c = new Vec3();\nconst getNormalAt_e0 = new Vec3();\nconst getNormalAt_e1 = new Vec3(); // from https://en.wikipedia.org/wiki/Barycentric_coordinate_system\n\nfunction barycentricWeights(x, y, ax, ay, bx, by, cx, cy, result) {\n result.x = ((by - cy) * (x - cx) + (cx - bx) * (y - cy)) / ((by - cy) * (ax - cx) + (cx - bx) * (ay - cy));\n result.y = ((cy - ay) * (x - cx) + (ax - cx) * (y - cy)) / ((by - cy) * (ax - cx) + (cx - bx) * (ay - cy));\n result.z = 1 - result.x - result.y;\n}\n\n/**\n * OctreeNode\n */\nclass OctreeNode {\n /** The root node */\n\n /** Boundary of this node */\n\n /** Contained data at the current node level */\n\n /** Children to this node */\n constructor(options = {}) {\n this.root = void 0;\n this.aabb = void 0;\n this.data = void 0;\n this.children = void 0;\n this.root = options.root || null;\n this.aabb = options.aabb ? options.aabb.clone() : new AABB();\n this.data = [];\n this.children = [];\n }\n /**\n * reset\n */\n\n\n reset() {\n this.children.length = this.data.length = 0;\n }\n /**\n * Insert data into this node\n * @return True if successful, otherwise false\n */\n\n\n insert(aabb, elementData, level = 0) {\n const nodeData = this.data; // Ignore objects that do not belong in this node\n\n if (!this.aabb.contains(aabb)) {\n return false; // object cannot be added\n }\n\n const children = this.children;\n const maxDepth = this.maxDepth || this.root.maxDepth;\n\n if (level < maxDepth) {\n // Subdivide if there are no children yet\n let subdivided = false;\n\n if (!children.length) {\n this.subdivide();\n subdivided = true;\n } // add to whichever node will accept it\n\n\n for (let i = 0; i !== 8; i++) {\n if (children[i].insert(aabb, elementData, level + 1)) {\n return true;\n }\n }\n\n if (subdivided) {\n // No children accepted! Might as well just remove em since they contain none\n children.length = 0;\n }\n } // Too deep, or children didnt want it. add it in current node\n\n\n nodeData.push(elementData);\n return true;\n }\n /**\n * Create 8 equally sized children nodes and put them in the `children` array.\n */\n\n\n subdivide() {\n const aabb = this.aabb;\n const l = aabb.lowerBound;\n const u = aabb.upperBound;\n const children = this.children;\n children.push(new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(0, 0, 0)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(1, 0, 0)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(1, 1, 0)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(1, 1, 1)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(0, 1, 1)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(0, 0, 1)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(1, 0, 1)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(0, 1, 0)\n })\n }));\n u.vsub(l, halfDiagonal);\n halfDiagonal.scale(0.5, halfDiagonal);\n const root = this.root || this;\n\n for (let i = 0; i !== 8; i++) {\n const child = children[i]; // Set current node as root\n\n child.root = root; // Compute bounds\n\n const lowerBound = child.aabb.lowerBound;\n lowerBound.x *= halfDiagonal.x;\n lowerBound.y *= halfDiagonal.y;\n lowerBound.z *= halfDiagonal.z;\n lowerBound.vadd(l, lowerBound); // Upper bound is always lower bound + halfDiagonal\n\n lowerBound.vadd(halfDiagonal, child.aabb.upperBound);\n }\n }\n /**\n * Get all data, potentially within an AABB\n * @return The \"result\" object\n */\n\n\n aabbQuery(aabb, result) {\n this.data; // abort if the range does not intersect this node\n // if (!this.aabb.overlaps(aabb)){\n // return result;\n // }\n // Add objects at this level\n // Array.prototype.push.apply(result, nodeData);\n // Add child data\n // @todo unwrap recursion into a queue / loop, that's faster in JS\n\n this.children; // for (let i = 0, N = this.children.length; i !== N; i++) {\n // children[i].aabbQuery(aabb, result);\n // }\n\n const queue = [this];\n\n while (queue.length) {\n const node = queue.pop();\n\n if (node.aabb.overlaps(aabb)) {\n Array.prototype.push.apply(result, node.data);\n }\n\n Array.prototype.push.apply(queue, node.children);\n }\n\n return result;\n }\n /**\n * Get all data, potentially intersected by a ray.\n * @return The \"result\" object\n */\n\n\n rayQuery(ray, treeTransform, result) {\n // Use aabb query for now.\n\n /** @todo implement real ray query which needs less lookups */\n ray.getAABB(tmpAABB);\n tmpAABB.toLocalFrame(treeTransform, tmpAABB);\n this.aabbQuery(tmpAABB, result);\n return result;\n }\n /**\n * removeEmptyNodes\n */\n\n\n removeEmptyNodes() {\n for (let i = this.children.length - 1; i >= 0; i--) {\n this.children[i].removeEmptyNodes();\n\n if (!this.children[i].children.length && !this.children[i].data.length) {\n this.children.splice(i, 1);\n }\n }\n }\n\n}\n/**\n * Octree\n */\n\n\nclass Octree extends OctreeNode {\n /**\n * Maximum subdivision depth\n * @default 8\n */\n\n /**\n * @param aabb The total AABB of the tree\n */\n constructor(aabb, options = {}) {\n super({\n root: null,\n aabb\n });\n this.maxDepth = void 0;\n this.maxDepth = typeof options.maxDepth !== 'undefined' ? options.maxDepth : 8;\n }\n\n}\nconst halfDiagonal = new Vec3();\nconst tmpAABB = new AABB();\n\n/**\n * Trimesh.\n * @example\n * // How to make a mesh with a single triangle\n * const vertices = [\n * 0, 0, 0, // vertex 0\n * 1, 0, 0, // vertex 1\n * 0, 1, 0 // vertex 2\n * ]\n * const indices = [\n * 0, 1, 2 // triangle 0\n * ]\n * const trimeshShape = new CANNON.Trimesh(vertices, indices)\n */\nclass Trimesh extends Shape {\n /**\n * vertices\n */\n\n /**\n * Array of integers, indicating which vertices each triangle consists of. The length of this array is thus 3 times the number of triangles.\n */\n\n /**\n * The normals data.\n */\n\n /**\n * The local AABB of the mesh.\n */\n\n /**\n * References to vertex pairs, making up all unique edges in the trimesh.\n */\n\n /**\n * Local scaling of the mesh. Use .setScale() to set it.\n */\n\n /**\n * The indexed triangles. Use .updateTree() to update it.\n */\n constructor(vertices, indices) {\n super({\n type: Shape.types.TRIMESH\n });\n this.vertices = void 0;\n this.indices = void 0;\n this.normals = void 0;\n this.aabb = void 0;\n this.edges = void 0;\n this.scale = void 0;\n this.tree = void 0;\n this.vertices = new Float32Array(vertices);\n this.indices = new Int16Array(indices);\n this.normals = new Float32Array(indices.length);\n this.aabb = new AABB();\n this.edges = null;\n this.scale = new Vec3(1, 1, 1);\n this.tree = new Octree();\n this.updateEdges();\n this.updateNormals();\n this.updateAABB();\n this.updateBoundingSphereRadius();\n this.updateTree();\n }\n /**\n * updateTree\n */\n\n\n updateTree() {\n const tree = this.tree;\n tree.reset();\n tree.aabb.copy(this.aabb);\n const scale = this.scale; // The local mesh AABB is scaled, but the octree AABB should be unscaled\n\n tree.aabb.lowerBound.x *= 1 / scale.x;\n tree.aabb.lowerBound.y *= 1 / scale.y;\n tree.aabb.lowerBound.z *= 1 / scale.z;\n tree.aabb.upperBound.x *= 1 / scale.x;\n tree.aabb.upperBound.y *= 1 / scale.y;\n tree.aabb.upperBound.z *= 1 / scale.z; // Insert all triangles\n\n const triangleAABB = new AABB();\n const a = new Vec3();\n const b = new Vec3();\n const c = new Vec3();\n const points = [a, b, c];\n\n for (let i = 0; i < this.indices.length / 3; i++) {\n //this.getTriangleVertices(i, a, b, c);\n // Get unscaled triangle verts\n const i3 = i * 3;\n\n this._getUnscaledVertex(this.indices[i3], a);\n\n this._getUnscaledVertex(this.indices[i3 + 1], b);\n\n this._getUnscaledVertex(this.indices[i3 + 2], c);\n\n triangleAABB.setFromPoints(points);\n tree.insert(triangleAABB, i);\n }\n\n tree.removeEmptyNodes();\n }\n /**\n * Get triangles in a local AABB from the trimesh.\n * @param result An array of integers, referencing the queried triangles.\n */\n\n\n getTrianglesInAABB(aabb, result) {\n unscaledAABB.copy(aabb); // Scale it to local\n\n const scale = this.scale;\n const isx = scale.x;\n const isy = scale.y;\n const isz = scale.z;\n const l = unscaledAABB.lowerBound;\n const u = unscaledAABB.upperBound;\n l.x /= isx;\n l.y /= isy;\n l.z /= isz;\n u.x /= isx;\n u.y /= isy;\n u.z /= isz;\n return this.tree.aabbQuery(unscaledAABB, result);\n }\n /**\n * setScale\n */\n\n\n setScale(scale) {\n const wasUniform = this.scale.x === this.scale.y && this.scale.y === this.scale.z;\n const isUniform = scale.x === scale.y && scale.y === scale.z;\n\n if (!(wasUniform && isUniform)) {\n // Non-uniform scaling. Need to update normals.\n this.updateNormals();\n }\n\n this.scale.copy(scale);\n this.updateAABB();\n this.updateBoundingSphereRadius();\n }\n /**\n * Compute the normals of the faces. Will save in the `.normals` array.\n */\n\n\n updateNormals() {\n const n = computeNormals_n; // Generate normals\n\n const normals = this.normals;\n\n for (let i = 0; i < this.indices.length / 3; i++) {\n const i3 = i * 3;\n const a = this.indices[i3];\n const b = this.indices[i3 + 1];\n const c = this.indices[i3 + 2];\n this.getVertex(a, va);\n this.getVertex(b, vb);\n this.getVertex(c, vc);\n Trimesh.computeNormal(vb, va, vc, n);\n normals[i3] = n.x;\n normals[i3 + 1] = n.y;\n normals[i3 + 2] = n.z;\n }\n }\n /**\n * Update the `.edges` property\n */\n\n\n updateEdges() {\n const edges = {};\n\n const add = (a, b) => {\n const key = a < b ? a + \"_\" + b : b + \"_\" + a;\n edges[key] = true;\n };\n\n for (let i = 0; i < this.indices.length / 3; i++) {\n const i3 = i * 3;\n const a = this.indices[i3];\n const b = this.indices[i3 + 1];\n const c = this.indices[i3 + 2];\n add(a, b);\n add(b, c);\n add(c, a);\n }\n\n const keys = Object.keys(edges);\n this.edges = new Int16Array(keys.length * 2);\n\n for (let i = 0; i < keys.length; i++) {\n const indices = keys[i].split('_');\n this.edges[2 * i] = parseInt(indices[0], 10);\n this.edges[2 * i + 1] = parseInt(indices[1], 10);\n }\n }\n /**\n * Get an edge vertex\n * @param firstOrSecond 0 or 1, depending on which one of the vertices you need.\n * @param vertexStore Where to store the result\n */\n\n\n getEdgeVertex(edgeIndex, firstOrSecond, vertexStore) {\n const vertexIndex = this.edges[edgeIndex * 2 + (firstOrSecond ? 1 : 0)];\n this.getVertex(vertexIndex, vertexStore);\n }\n /**\n * Get a vector along an edge.\n */\n\n\n getEdgeVector(edgeIndex, vectorStore) {\n const va = getEdgeVector_va;\n const vb = getEdgeVector_vb;\n this.getEdgeVertex(edgeIndex, 0, va);\n this.getEdgeVertex(edgeIndex, 1, vb);\n vb.vsub(va, vectorStore);\n }\n /**\n * Get face normal given 3 vertices\n */\n\n\n static computeNormal(va, vb, vc, target) {\n vb.vsub(va, ab);\n vc.vsub(vb, cb);\n cb.cross(ab, target);\n\n if (!target.isZero()) {\n target.normalize();\n }\n }\n /**\n * Get vertex i.\n * @return The \"out\" vector object\n */\n\n\n getVertex(i, out) {\n const scale = this.scale;\n\n this._getUnscaledVertex(i, out);\n\n out.x *= scale.x;\n out.y *= scale.y;\n out.z *= scale.z;\n return out;\n }\n /**\n * Get raw vertex i\n * @return The \"out\" vector object\n */\n\n\n _getUnscaledVertex(i, out) {\n const i3 = i * 3;\n const vertices = this.vertices;\n return out.set(vertices[i3], vertices[i3 + 1], vertices[i3 + 2]);\n }\n /**\n * Get a vertex from the trimesh,transformed by the given position and quaternion.\n * @return The \"out\" vector object\n */\n\n\n getWorldVertex(i, pos, quat, out) {\n this.getVertex(i, out);\n Transform.pointToWorldFrame(pos, quat, out, out);\n return out;\n }\n /**\n * Get the three vertices for triangle i.\n */\n\n\n getTriangleVertices(i, a, b, c) {\n const i3 = i * 3;\n this.getVertex(this.indices[i3], a);\n this.getVertex(this.indices[i3 + 1], b);\n this.getVertex(this.indices[i3 + 2], c);\n }\n /**\n * Compute the normal of triangle i.\n * @return The \"target\" vector object\n */\n\n\n getNormal(i, target) {\n const i3 = i * 3;\n return target.set(this.normals[i3], this.normals[i3 + 1], this.normals[i3 + 2]);\n }\n /**\n * @return The \"target\" vector object\n */\n\n\n calculateLocalInertia(mass, target) {\n // Approximate with box inertia\n // Exact inertia calculation is overkill, but see http://geometrictools.com/Documentation/PolyhedralMassProperties.pdf for the correct way to do it\n this.computeLocalAABB(cli_aabb);\n const x = cli_aabb.upperBound.x - cli_aabb.lowerBound.x;\n const y = cli_aabb.upperBound.y - cli_aabb.lowerBound.y;\n const z = cli_aabb.upperBound.z - cli_aabb.lowerBound.z;\n return target.set(1.0 / 12.0 * mass * (2 * y * 2 * y + 2 * z * 2 * z), 1.0 / 12.0 * mass * (2 * x * 2 * x + 2 * z * 2 * z), 1.0 / 12.0 * mass * (2 * y * 2 * y + 2 * x * 2 * x));\n }\n /**\n * Compute the local AABB for the trimesh\n */\n\n\n computeLocalAABB(aabb) {\n const l = aabb.lowerBound;\n const u = aabb.upperBound;\n const n = this.vertices.length;\n this.vertices;\n const v = computeLocalAABB_worldVert;\n this.getVertex(0, v);\n l.copy(v);\n u.copy(v);\n\n for (let i = 0; i !== n; i++) {\n this.getVertex(i, v);\n\n if (v.x < l.x) {\n l.x = v.x;\n } else if (v.x > u.x) {\n u.x = v.x;\n }\n\n if (v.y < l.y) {\n l.y = v.y;\n } else if (v.y > u.y) {\n u.y = v.y;\n }\n\n if (v.z < l.z) {\n l.z = v.z;\n } else if (v.z > u.z) {\n u.z = v.z;\n }\n }\n }\n /**\n * Update the `.aabb` property\n */\n\n\n updateAABB() {\n this.computeLocalAABB(this.aabb);\n }\n /**\n * Will update the `.boundingSphereRadius` property\n */\n\n\n updateBoundingSphereRadius() {\n // Assume points are distributed with local (0,0,0) as center\n let max2 = 0;\n const vertices = this.vertices;\n const v = new Vec3();\n\n for (let i = 0, N = vertices.length / 3; i !== N; i++) {\n this.getVertex(i, v);\n const norm2 = v.lengthSquared();\n\n if (norm2 > max2) {\n max2 = norm2;\n }\n }\n\n this.boundingSphereRadius = Math.sqrt(max2);\n }\n /**\n * calculateWorldAABB\n */\n\n\n calculateWorldAABB(pos, quat, min, max) {\n /*\n const n = this.vertices.length / 3,\n verts = this.vertices;\n const minx,miny,minz,maxx,maxy,maxz;\n const v = tempWorldVertex;\n for(let i=0; i maxx || maxx===undefined){\n maxx = v.x;\n }\n if (v.y < miny || miny===undefined){\n miny = v.y;\n } else if(v.y > maxy || maxy===undefined){\n maxy = v.y;\n }\n if (v.z < minz || minz===undefined){\n minz = v.z;\n } else if(v.z > maxz || maxz===undefined){\n maxz = v.z;\n }\n }\n min.set(minx,miny,minz);\n max.set(maxx,maxy,maxz);\n */\n // Faster approximation using local AABB\n const frame = calculateWorldAABB_frame;\n const result = calculateWorldAABB_aabb;\n frame.position = pos;\n frame.quaternion = quat;\n this.aabb.toWorldFrame(frame, result);\n min.copy(result.lowerBound);\n max.copy(result.upperBound);\n }\n /**\n * Get approximate volume\n */\n\n\n volume() {\n return 4.0 * Math.PI * this.boundingSphereRadius / 3.0;\n }\n /**\n * Create a Trimesh instance, shaped as a torus.\n */\n\n\n static createTorus(radius = 1, tube = 0.5, radialSegments = 8, tubularSegments = 6, arc = Math.PI * 2) {\n const vertices = [];\n const indices = [];\n\n for (let j = 0; j <= radialSegments; j++) {\n for (let i = 0; i <= tubularSegments; i++) {\n const u = i / tubularSegments * arc;\n const v = j / radialSegments * Math.PI * 2;\n const x = (radius + tube * Math.cos(v)) * Math.cos(u);\n const y = (radius + tube * Math.cos(v)) * Math.sin(u);\n const z = tube * Math.sin(v);\n vertices.push(x, y, z);\n }\n }\n\n for (let j = 1; j <= radialSegments; j++) {\n for (let i = 1; i <= tubularSegments; i++) {\n const a = (tubularSegments + 1) * j + i - 1;\n const b = (tubularSegments + 1) * (j - 1) + i - 1;\n const c = (tubularSegments + 1) * (j - 1) + i;\n const d = (tubularSegments + 1) * j + i;\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n }\n\n return new Trimesh(vertices, indices);\n }\n\n}\nconst computeNormals_n = new Vec3();\nconst unscaledAABB = new AABB();\nconst getEdgeVector_va = new Vec3();\nconst getEdgeVector_vb = new Vec3();\nconst cb = new Vec3();\nconst ab = new Vec3();\nconst va = new Vec3();\nconst vb = new Vec3();\nconst vc = new Vec3();\nconst cli_aabb = new AABB();\nconst computeLocalAABB_worldVert = new Vec3();\nconst calculateWorldAABB_frame = new Transform();\nconst calculateWorldAABB_aabb = new AABB();\n\n/**\n * Constraint equation solver base class.\n */\nclass Solver {\n /**\n * All equations to be solved\n */\n\n /**\n * @todo remove useless constructor\n */\n constructor() {\n this.equations = void 0;\n this.equations = [];\n }\n /**\n * Should be implemented in subclasses!\n * @todo use abstract\n * @return number of iterations performed\n */\n\n\n solve(dt, world) {\n return (// Should return the number of iterations done!\n 0\n );\n }\n /**\n * Add an equation\n */\n\n\n addEquation(eq) {\n if (eq.enabled && !eq.bi.isTrigger && !eq.bj.isTrigger) {\n this.equations.push(eq);\n }\n }\n /**\n * Remove an equation\n */\n\n\n removeEquation(eq) {\n const eqs = this.equations;\n const i = eqs.indexOf(eq);\n\n if (i !== -1) {\n eqs.splice(i, 1);\n }\n }\n /**\n * Add all equations\n */\n\n\n removeAllEquations() {\n this.equations.length = 0;\n }\n\n}\n\n/**\n * Constraint equation Gauss-Seidel solver.\n * @todo The spook parameters should be specified for each constraint, not globally.\n * @see https://www8.cs.umu.se/kurser/5DV058/VT09/lectures/spooknotes.pdf\n */\nclass GSSolver extends Solver {\n /**\n * The number of solver iterations determines quality of the constraints in the world.\n * The more iterations, the more correct simulation. More iterations need more computations though. If you have a large gravity force in your world, you will need more iterations.\n */\n\n /**\n * When tolerance is reached, the system is assumed to be converged.\n */\n\n /**\n * @todo remove useless constructor\n */\n constructor() {\n super();\n this.iterations = void 0;\n this.tolerance = void 0;\n this.iterations = 10;\n this.tolerance = 1e-7;\n }\n /**\n * Solve\n * @return number of iterations performed\n */\n\n\n solve(dt, world) {\n let iter = 0;\n const maxIter = this.iterations;\n const tolSquared = this.tolerance * this.tolerance;\n const equations = this.equations;\n const Neq = equations.length;\n const bodies = world.bodies;\n const Nbodies = bodies.length;\n const h = dt;\n let B;\n let invC;\n let deltalambda;\n let deltalambdaTot;\n let GWlambda;\n let lambdaj; // Update solve mass\n\n if (Neq !== 0) {\n for (let i = 0; i !== Nbodies; i++) {\n bodies[i].updateSolveMassProperties();\n }\n } // Things that do not change during iteration can be computed once\n\n\n const invCs = GSSolver_solve_invCs;\n const Bs = GSSolver_solve_Bs;\n const lambda = GSSolver_solve_lambda;\n invCs.length = Neq;\n Bs.length = Neq;\n lambda.length = Neq;\n\n for (let i = 0; i !== Neq; i++) {\n const c = equations[i];\n lambda[i] = 0.0;\n Bs[i] = c.computeB(h);\n invCs[i] = 1.0 / c.computeC();\n }\n\n if (Neq !== 0) {\n // Reset vlambda\n for (let i = 0; i !== Nbodies; i++) {\n const b = bodies[i];\n const vlambda = b.vlambda;\n const wlambda = b.wlambda;\n vlambda.set(0, 0, 0);\n wlambda.set(0, 0, 0);\n } // Iterate over equations\n\n\n for (iter = 0; iter !== maxIter; iter++) {\n // Accumulate the total error for each iteration.\n deltalambdaTot = 0.0;\n\n for (let j = 0; j !== Neq; j++) {\n const c = equations[j]; // Compute iteration\n\n B = Bs[j];\n invC = invCs[j];\n lambdaj = lambda[j];\n GWlambda = c.computeGWlambda();\n deltalambda = invC * (B - GWlambda - c.eps * lambdaj); // Clamp if we are not within the min/max interval\n\n if (lambdaj + deltalambda < c.minForce) {\n deltalambda = c.minForce - lambdaj;\n } else if (lambdaj + deltalambda > c.maxForce) {\n deltalambda = c.maxForce - lambdaj;\n }\n\n lambda[j] += deltalambda;\n deltalambdaTot += deltalambda > 0.0 ? deltalambda : -deltalambda; // abs(deltalambda)\n\n c.addToWlambda(deltalambda);\n } // If the total error is small enough - stop iterate\n\n\n if (deltalambdaTot * deltalambdaTot < tolSquared) {\n break;\n }\n } // Add result to velocity\n\n\n for (let i = 0; i !== Nbodies; i++) {\n const b = bodies[i];\n const v = b.velocity;\n const w = b.angularVelocity;\n b.vlambda.vmul(b.linearFactor, b.vlambda);\n v.vadd(b.vlambda, v);\n b.wlambda.vmul(b.angularFactor, b.wlambda);\n w.vadd(b.wlambda, w);\n } // Set the `.multiplier` property of each equation\n\n\n let l = equations.length;\n const invDt = 1 / h;\n\n while (l--) {\n equations[l].multiplier = lambda[l] * invDt;\n }\n }\n\n return iter;\n }\n\n} // Just temporary number holders that we want to reuse each iteration.\n\nconst GSSolver_solve_lambda = [];\nconst GSSolver_solve_invCs = [];\nconst GSSolver_solve_Bs = [];\n\n/**\n * Splits the equations into islands and solves them independently. Can improve performance.\n */\nclass SplitSolver extends Solver {\n /**\n * The number of solver iterations determines quality of the constraints in the world. The more iterations, the more correct simulation. More iterations need more computations though. If you have a large gravity force in your world, you will need more iterations.\n */\n\n /**\n * When tolerance is reached, the system is assumed to be converged.\n */\n\n /** subsolver */\n constructor(subsolver) {\n super();\n this.iterations = void 0;\n this.tolerance = void 0;\n this.subsolver = void 0;\n this.nodes = void 0;\n this.nodePool = void 0;\n this.iterations = 10;\n this.tolerance = 1e-7;\n this.subsolver = subsolver;\n this.nodes = [];\n this.nodePool = []; // Create needed nodes, reuse if possible\n\n while (this.nodePool.length < 128) {\n this.nodePool.push(this.createNode());\n }\n }\n /**\n * createNode\n */\n\n\n createNode() {\n return {\n body: null,\n children: [],\n eqs: [],\n visited: false\n };\n }\n /**\n * Solve the subsystems\n * @return number of iterations performed\n */\n\n\n solve(dt, world) {\n const nodes = SplitSolver_solve_nodes;\n const nodePool = this.nodePool;\n const bodies = world.bodies;\n const equations = this.equations;\n const Neq = equations.length;\n const Nbodies = bodies.length;\n const subsolver = this.subsolver; // Create needed nodes, reuse if possible\n\n while (nodePool.length < Nbodies) {\n nodePool.push(this.createNode());\n }\n\n nodes.length = Nbodies;\n\n for (let i = 0; i < Nbodies; i++) {\n nodes[i] = nodePool[i];\n } // Reset node values\n\n\n for (let i = 0; i !== Nbodies; i++) {\n const node = nodes[i];\n node.body = bodies[i];\n node.children.length = 0;\n node.eqs.length = 0;\n node.visited = false;\n }\n\n for (let k = 0; k !== Neq; k++) {\n const eq = equations[k];\n const i = bodies.indexOf(eq.bi);\n const j = bodies.indexOf(eq.bj);\n const ni = nodes[i];\n const nj = nodes[j];\n ni.children.push(nj);\n ni.eqs.push(eq);\n nj.children.push(ni);\n nj.eqs.push(eq);\n }\n\n let child;\n let n = 0;\n let eqs = SplitSolver_solve_eqs;\n subsolver.tolerance = this.tolerance;\n subsolver.iterations = this.iterations;\n const dummyWorld = SplitSolver_solve_dummyWorld;\n\n while (child = getUnvisitedNode(nodes)) {\n eqs.length = 0;\n dummyWorld.bodies.length = 0;\n bfs(child, visitFunc, dummyWorld.bodies, eqs);\n const Neqs = eqs.length;\n eqs = eqs.sort(sortById);\n\n for (let i = 0; i !== Neqs; i++) {\n subsolver.addEquation(eqs[i]);\n }\n\n subsolver.solve(dt, dummyWorld);\n subsolver.removeAllEquations();\n n++;\n }\n\n return n;\n }\n\n} // Returns the number of subsystems\n\nconst SplitSolver_solve_nodes = []; // All allocated node objects\n\nconst SplitSolver_solve_eqs = []; // Temp array\n\nconst SplitSolver_solve_dummyWorld = {\n bodies: []\n}; // Temp object\n\nconst STATIC = Body.STATIC;\n\nfunction getUnvisitedNode(nodes) {\n const Nnodes = nodes.length;\n\n for (let i = 0; i !== Nnodes; i++) {\n const node = nodes[i];\n\n if (!node.visited && !(node.body.type & STATIC)) {\n return node;\n }\n }\n\n return false;\n}\n\nconst queue = [];\n\nfunction bfs(root, visitFunc, bds, eqs) {\n queue.push(root);\n root.visited = true;\n visitFunc(root, bds, eqs);\n\n while (queue.length) {\n const node = queue.pop(); // Loop over unvisited child nodes\n\n let child;\n\n while (child = getUnvisitedNode(node.children)) {\n child.visited = true;\n visitFunc(child, bds, eqs);\n queue.push(child);\n }\n }\n}\n\nfunction visitFunc(node, bds, eqs) {\n bds.push(node.body);\n const Neqs = node.eqs.length;\n\n for (let i = 0; i !== Neqs; i++) {\n const eq = node.eqs[i];\n\n if (!eqs.includes(eq)) {\n eqs.push(eq);\n }\n }\n}\n\nfunction sortById(a, b) {\n return b.id - a.id;\n}\n\n/**\n * For pooling objects that can be reused.\n */\nclass Pool {\n constructor() {\n this.objects = [];\n this.type = Object;\n }\n\n /**\n * Release an object after use\n */\n release(...args) {\n const Nargs = args.length;\n\n for (let i = 0; i !== Nargs; i++) {\n this.objects.push(args[i]);\n }\n\n return this;\n }\n /**\n * Get an object\n */\n\n\n get() {\n if (this.objects.length === 0) {\n return this.constructObject();\n } else {\n return this.objects.pop();\n }\n }\n /**\n * Construct an object. Should be implemented in each subclass.\n */\n\n\n constructObject() {\n throw new Error('constructObject() not implemented in this Pool subclass yet!');\n }\n /**\n * @return Self, for chaining\n */\n\n\n resize(size) {\n const objects = this.objects;\n\n while (objects.length > size) {\n objects.pop();\n }\n\n while (objects.length < size) {\n objects.push(this.constructObject());\n }\n\n return this;\n }\n\n}\n\n/**\n * Vec3Pool\n */\n\nclass Vec3Pool extends Pool {\n constructor(...args) {\n super(...args);\n this.type = Vec3;\n }\n\n /**\n * Construct a vector\n */\n constructObject() {\n return new Vec3();\n }\n\n}\n\nlet _COLLISION_TYPES$sphe, _COLLISION_TYPES$sphe2, _COLLISION_TYPES$boxB, _COLLISION_TYPES$sphe3, _COLLISION_TYPES$plan, _COLLISION_TYPES$conv, _COLLISION_TYPES$sphe4, _COLLISION_TYPES$plan2, _COLLISION_TYPES$boxC, _COLLISION_TYPES$sphe5, _COLLISION_TYPES$boxH, _COLLISION_TYPES$conv2, _COLLISION_TYPES$sphe6, _COLLISION_TYPES$plan3, _COLLISION_TYPES$boxP, _COLLISION_TYPES$conv3, _COLLISION_TYPES$cyli, _COLLISION_TYPES$sphe7, _COLLISION_TYPES$plan4, _COLLISION_TYPES$boxC2, _COLLISION_TYPES$conv4, _COLLISION_TYPES$heig, _COLLISION_TYPES$part, _COLLISION_TYPES$sphe8, _COLLISION_TYPES$plan5;\n// Naming rule: based of the order in SHAPE_TYPES,\n// the first part of the method is formed by the\n// shape type that comes before, in the second part\n// there is the shape type that comes after in the SHAPE_TYPES list\nconst COLLISION_TYPES = {\n sphereSphere: Shape.types.SPHERE,\n spherePlane: Shape.types.SPHERE | Shape.types.PLANE,\n boxBox: Shape.types.BOX | Shape.types.BOX,\n sphereBox: Shape.types.SPHERE | Shape.types.BOX,\n planeBox: Shape.types.PLANE | Shape.types.BOX,\n convexConvex: Shape.types.CONVEXPOLYHEDRON,\n sphereConvex: Shape.types.SPHERE | Shape.types.CONVEXPOLYHEDRON,\n planeConvex: Shape.types.PLANE | Shape.types.CONVEXPOLYHEDRON,\n boxConvex: Shape.types.BOX | Shape.types.CONVEXPOLYHEDRON,\n sphereHeightfield: Shape.types.SPHERE | Shape.types.HEIGHTFIELD,\n boxHeightfield: Shape.types.BOX | Shape.types.HEIGHTFIELD,\n convexHeightfield: Shape.types.CONVEXPOLYHEDRON | Shape.types.HEIGHTFIELD,\n sphereParticle: Shape.types.PARTICLE | Shape.types.SPHERE,\n planeParticle: Shape.types.PLANE | Shape.types.PARTICLE,\n boxParticle: Shape.types.BOX | Shape.types.PARTICLE,\n convexParticle: Shape.types.PARTICLE | Shape.types.CONVEXPOLYHEDRON,\n cylinderCylinder: Shape.types.CYLINDER,\n sphereCylinder: Shape.types.SPHERE | Shape.types.CYLINDER,\n planeCylinder: Shape.types.PLANE | Shape.types.CYLINDER,\n boxCylinder: Shape.types.BOX | Shape.types.CYLINDER,\n convexCylinder: Shape.types.CONVEXPOLYHEDRON | Shape.types.CYLINDER,\n heightfieldCylinder: Shape.types.HEIGHTFIELD | Shape.types.CYLINDER,\n particleCylinder: Shape.types.PARTICLE | Shape.types.CYLINDER,\n sphereTrimesh: Shape.types.SPHERE | Shape.types.TRIMESH,\n planeTrimesh: Shape.types.PLANE | Shape.types.TRIMESH\n};\n_COLLISION_TYPES$sphe = COLLISION_TYPES.sphereSphere;\n_COLLISION_TYPES$sphe2 = COLLISION_TYPES.spherePlane;\n_COLLISION_TYPES$boxB = COLLISION_TYPES.boxBox;\n_COLLISION_TYPES$sphe3 = COLLISION_TYPES.sphereBox;\n_COLLISION_TYPES$plan = COLLISION_TYPES.planeBox;\n_COLLISION_TYPES$conv = COLLISION_TYPES.convexConvex;\n_COLLISION_TYPES$sphe4 = COLLISION_TYPES.sphereConvex;\n_COLLISION_TYPES$plan2 = COLLISION_TYPES.planeConvex;\n_COLLISION_TYPES$boxC = COLLISION_TYPES.boxConvex;\n_COLLISION_TYPES$sphe5 = COLLISION_TYPES.sphereHeightfield;\n_COLLISION_TYPES$boxH = COLLISION_TYPES.boxHeightfield;\n_COLLISION_TYPES$conv2 = COLLISION_TYPES.convexHeightfield;\n_COLLISION_TYPES$sphe6 = COLLISION_TYPES.sphereParticle;\n_COLLISION_TYPES$plan3 = COLLISION_TYPES.planeParticle;\n_COLLISION_TYPES$boxP = COLLISION_TYPES.boxParticle;\n_COLLISION_TYPES$conv3 = COLLISION_TYPES.convexParticle;\n_COLLISION_TYPES$cyli = COLLISION_TYPES.cylinderCylinder;\n_COLLISION_TYPES$sphe7 = COLLISION_TYPES.sphereCylinder;\n_COLLISION_TYPES$plan4 = COLLISION_TYPES.planeCylinder;\n_COLLISION_TYPES$boxC2 = COLLISION_TYPES.boxCylinder;\n_COLLISION_TYPES$conv4 = COLLISION_TYPES.convexCylinder;\n_COLLISION_TYPES$heig = COLLISION_TYPES.heightfieldCylinder;\n_COLLISION_TYPES$part = COLLISION_TYPES.particleCylinder;\n_COLLISION_TYPES$sphe8 = COLLISION_TYPES.sphereTrimesh;\n_COLLISION_TYPES$plan5 = COLLISION_TYPES.planeTrimesh;\n\n/**\n * Helper class for the World. Generates ContactEquations.\n * @todo Sphere-ConvexPolyhedron contacts\n * @todo Contact reduction\n * @todo should move methods to prototype\n */\nclass Narrowphase {\n /**\n * Internal storage of pooled contact points.\n */\n\n /**\n * Pooled vectors.\n */\n get [_COLLISION_TYPES$sphe]() {\n return this.sphereSphere;\n }\n\n get [_COLLISION_TYPES$sphe2]() {\n return this.spherePlane;\n }\n\n get [_COLLISION_TYPES$boxB]() {\n return this.boxBox;\n }\n\n get [_COLLISION_TYPES$sphe3]() {\n return this.sphereBox;\n }\n\n get [_COLLISION_TYPES$plan]() {\n return this.planeBox;\n }\n\n get [_COLLISION_TYPES$conv]() {\n return this.convexConvex;\n }\n\n get [_COLLISION_TYPES$sphe4]() {\n return this.sphereConvex;\n }\n\n get [_COLLISION_TYPES$plan2]() {\n return this.planeConvex;\n }\n\n get [_COLLISION_TYPES$boxC]() {\n return this.boxConvex;\n }\n\n get [_COLLISION_TYPES$sphe5]() {\n return this.sphereHeightfield;\n }\n\n get [_COLLISION_TYPES$boxH]() {\n return this.boxHeightfield;\n }\n\n get [_COLLISION_TYPES$conv2]() {\n return this.convexHeightfield;\n }\n\n get [_COLLISION_TYPES$sphe6]() {\n return this.sphereParticle;\n }\n\n get [_COLLISION_TYPES$plan3]() {\n return this.planeParticle;\n }\n\n get [_COLLISION_TYPES$boxP]() {\n return this.boxParticle;\n }\n\n get [_COLLISION_TYPES$conv3]() {\n return this.convexParticle;\n }\n\n get [_COLLISION_TYPES$cyli]() {\n return this.convexConvex;\n }\n\n get [_COLLISION_TYPES$sphe7]() {\n return this.sphereConvex;\n }\n\n get [_COLLISION_TYPES$plan4]() {\n return this.planeConvex;\n }\n\n get [_COLLISION_TYPES$boxC2]() {\n return this.boxConvex;\n }\n\n get [_COLLISION_TYPES$conv4]() {\n return this.convexConvex;\n }\n\n get [_COLLISION_TYPES$heig]() {\n return this.heightfieldCylinder;\n }\n\n get [_COLLISION_TYPES$part]() {\n return this.particleCylinder;\n }\n\n get [_COLLISION_TYPES$sphe8]() {\n return this.sphereTrimesh;\n }\n\n get [_COLLISION_TYPES$plan5]() {\n return this.planeTrimesh;\n } // get [COLLISION_TYPES.convexTrimesh]() {\n // return this.convexTrimesh\n // }\n\n\n constructor(world) {\n this.contactPointPool = void 0;\n this.frictionEquationPool = void 0;\n this.result = void 0;\n this.frictionResult = void 0;\n this.v3pool = void 0;\n this.world = void 0;\n this.currentContactMaterial = void 0;\n this.enableFrictionReduction = void 0;\n this.contactPointPool = [];\n this.frictionEquationPool = [];\n this.result = [];\n this.frictionResult = [];\n this.v3pool = new Vec3Pool();\n this.world = world;\n this.currentContactMaterial = world.defaultContactMaterial;\n this.enableFrictionReduction = false;\n }\n /**\n * Make a contact object, by using the internal pool or creating a new one.\n */\n\n\n createContactEquation(bi, bj, si, sj, overrideShapeA, overrideShapeB) {\n let c;\n\n if (this.contactPointPool.length) {\n c = this.contactPointPool.pop();\n c.bi = bi;\n c.bj = bj;\n } else {\n c = new ContactEquation(bi, bj);\n }\n\n c.enabled = bi.collisionResponse && bj.collisionResponse && si.collisionResponse && sj.collisionResponse;\n const cm = this.currentContactMaterial;\n c.restitution = cm.restitution;\n c.setSpookParams(cm.contactEquationStiffness, cm.contactEquationRelaxation, this.world.dt);\n const matA = si.material || bi.material;\n const matB = sj.material || bj.material;\n\n if (matA && matB && matA.restitution >= 0 && matB.restitution >= 0) {\n c.restitution = matA.restitution * matB.restitution;\n }\n\n c.si = overrideShapeA || si;\n c.sj = overrideShapeB || sj;\n return c;\n }\n\n createFrictionEquationsFromContact(contactEquation, outArray) {\n const bodyA = contactEquation.bi;\n const bodyB = contactEquation.bj;\n const shapeA = contactEquation.si;\n const shapeB = contactEquation.sj;\n const world = this.world;\n const cm = this.currentContactMaterial; // If friction or restitution were specified in the material, use them\n\n let friction = cm.friction;\n const matA = shapeA.material || bodyA.material;\n const matB = shapeB.material || bodyB.material;\n\n if (matA && matB && matA.friction >= 0 && matB.friction >= 0) {\n friction = matA.friction * matB.friction;\n }\n\n if (friction > 0) {\n // Create 2 tangent equations\n const mug = friction * world.gravity.length();\n let reducedMass = bodyA.invMass + bodyB.invMass;\n\n if (reducedMass > 0) {\n reducedMass = 1 / reducedMass;\n }\n\n const pool = this.frictionEquationPool;\n const c1 = pool.length ? pool.pop() : new FrictionEquation(bodyA, bodyB, mug * reducedMass);\n const c2 = pool.length ? pool.pop() : new FrictionEquation(bodyA, bodyB, mug * reducedMass);\n c1.bi = c2.bi = bodyA;\n c1.bj = c2.bj = bodyB;\n c1.minForce = c2.minForce = -mug * reducedMass;\n c1.maxForce = c2.maxForce = mug * reducedMass; // Copy over the relative vectors\n\n c1.ri.copy(contactEquation.ri);\n c1.rj.copy(contactEquation.rj);\n c2.ri.copy(contactEquation.ri);\n c2.rj.copy(contactEquation.rj); // Construct tangents\n\n contactEquation.ni.tangents(c1.t, c2.t); // Set spook params\n\n c1.setSpookParams(cm.frictionEquationStiffness, cm.frictionEquationRelaxation, world.dt);\n c2.setSpookParams(cm.frictionEquationStiffness, cm.frictionEquationRelaxation, world.dt);\n c1.enabled = c2.enabled = contactEquation.enabled;\n outArray.push(c1, c2);\n return true;\n }\n\n return false;\n }\n /**\n * Take the average N latest contact point on the plane.\n */\n\n\n createFrictionFromAverage(numContacts) {\n // The last contactEquation\n let c = this.result[this.result.length - 1]; // Create the result: two \"average\" friction equations\n\n if (!this.createFrictionEquationsFromContact(c, this.frictionResult) || numContacts === 1) {\n return;\n }\n\n const f1 = this.frictionResult[this.frictionResult.length - 2];\n const f2 = this.frictionResult[this.frictionResult.length - 1];\n averageNormal.setZero();\n averageContactPointA.setZero();\n averageContactPointB.setZero();\n const bodyA = c.bi;\n c.bj;\n\n for (let i = 0; i !== numContacts; i++) {\n c = this.result[this.result.length - 1 - i];\n\n if (c.bi !== bodyA) {\n averageNormal.vadd(c.ni, averageNormal);\n averageContactPointA.vadd(c.ri, averageContactPointA);\n averageContactPointB.vadd(c.rj, averageContactPointB);\n } else {\n averageNormal.vsub(c.ni, averageNormal);\n averageContactPointA.vadd(c.rj, averageContactPointA);\n averageContactPointB.vadd(c.ri, averageContactPointB);\n }\n }\n\n const invNumContacts = 1 / numContacts;\n averageContactPointA.scale(invNumContacts, f1.ri);\n averageContactPointB.scale(invNumContacts, f1.rj);\n f2.ri.copy(f1.ri); // Should be the same\n\n f2.rj.copy(f1.rj);\n averageNormal.normalize();\n averageNormal.tangents(f1.t, f2.t); // return eq;\n }\n /**\n * Generate all contacts between a list of body pairs\n * @param p1 Array of body indices\n * @param p2 Array of body indices\n * @param result Array to store generated contacts\n * @param oldcontacts Optional. Array of reusable contact objects\n */\n\n\n getContacts(p1, p2, world, result, oldcontacts, frictionResult, frictionPool) {\n // Save old contact objects\n this.contactPointPool = oldcontacts;\n this.frictionEquationPool = frictionPool;\n this.result = result;\n this.frictionResult = frictionResult;\n const qi = tmpQuat1;\n const qj = tmpQuat2;\n const xi = tmpVec1;\n const xj = tmpVec2;\n\n for (let k = 0, N = p1.length; k !== N; k++) {\n // Get current collision bodies\n const bi = p1[k];\n const bj = p2[k]; // Get contact material\n\n let bodyContactMaterial = null;\n\n if (bi.material && bj.material) {\n bodyContactMaterial = world.getContactMaterial(bi.material, bj.material) || null;\n }\n\n const justTest = bi.type & Body.KINEMATIC && bj.type & Body.STATIC || bi.type & Body.STATIC && bj.type & Body.KINEMATIC || bi.type & Body.KINEMATIC && bj.type & Body.KINEMATIC;\n\n for (let i = 0; i < bi.shapes.length; i++) {\n bi.quaternion.mult(bi.shapeOrientations[i], qi);\n bi.quaternion.vmult(bi.shapeOffsets[i], xi);\n xi.vadd(bi.position, xi);\n const si = bi.shapes[i];\n\n for (let j = 0; j < bj.shapes.length; j++) {\n // Compute world transform of shapes\n bj.quaternion.mult(bj.shapeOrientations[j], qj);\n bj.quaternion.vmult(bj.shapeOffsets[j], xj);\n xj.vadd(bj.position, xj);\n const sj = bj.shapes[j];\n\n if (!(si.collisionFilterMask & sj.collisionFilterGroup && sj.collisionFilterMask & si.collisionFilterGroup)) {\n continue;\n }\n\n if (xi.distanceTo(xj) > si.boundingSphereRadius + sj.boundingSphereRadius) {\n continue;\n } // Get collision material\n\n\n let shapeContactMaterial = null;\n\n if (si.material && sj.material) {\n shapeContactMaterial = world.getContactMaterial(si.material, sj.material) || null;\n }\n\n this.currentContactMaterial = shapeContactMaterial || bodyContactMaterial || world.defaultContactMaterial; // Get contacts\n\n const resolverIndex = si.type | sj.type;\n const resolver = this[resolverIndex];\n\n if (resolver) {\n let retval = false; // TO DO: investigate why sphereParticle and convexParticle\n // resolvers expect si and sj shapes to be in reverse order\n // (i.e. larger integer value type first instead of smaller first)\n\n if (si.type < sj.type) {\n retval = resolver.call(this, si, sj, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n } else {\n retval = resolver.call(this, sj, si, xj, xi, qj, qi, bj, bi, si, sj, justTest);\n }\n\n if (retval && justTest) {\n // Register overlap\n world.shapeOverlapKeeper.set(si.id, sj.id);\n world.bodyOverlapKeeper.set(bi.id, bj.id);\n }\n }\n }\n }\n }\n }\n\n sphereSphere(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n if (justTest) {\n return xi.distanceSquared(xj) < (si.radius + sj.radius) ** 2;\n } // We will have only one contact in this case\n\n\n const contactEq = this.createContactEquation(bi, bj, si, sj, rsi, rsj); // Contact normal\n\n xj.vsub(xi, contactEq.ni);\n contactEq.ni.normalize(); // Contact point locations\n\n contactEq.ri.copy(contactEq.ni);\n contactEq.rj.copy(contactEq.ni);\n contactEq.ri.scale(si.radius, contactEq.ri);\n contactEq.rj.scale(-sj.radius, contactEq.rj);\n contactEq.ri.vadd(xi, contactEq.ri);\n contactEq.ri.vsub(bi.position, contactEq.ri);\n contactEq.rj.vadd(xj, contactEq.rj);\n contactEq.rj.vsub(bj.position, contactEq.rj);\n this.result.push(contactEq);\n this.createFrictionEquationsFromContact(contactEq, this.frictionResult);\n }\n\n spherePlane(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n // We will have one contact in this case\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj); // Contact normal\n\n r.ni.set(0, 0, 1);\n qj.vmult(r.ni, r.ni);\n r.ni.negate(r.ni); // body i is the sphere, flip normal\n\n r.ni.normalize(); // Needed?\n // Vector from sphere center to contact point\n\n r.ni.scale(si.radius, r.ri); // Project down sphere on plane\n\n xi.vsub(xj, point_on_plane_to_sphere);\n r.ni.scale(r.ni.dot(point_on_plane_to_sphere), plane_to_sphere_ortho);\n point_on_plane_to_sphere.vsub(plane_to_sphere_ortho, r.rj); // The sphere position projected to plane\n\n if (-point_on_plane_to_sphere.dot(r.ni) <= si.radius) {\n if (justTest) {\n return true;\n } // Make it relative to the body\n\n\n const ri = r.ri;\n const rj = r.rj;\n ri.vadd(xi, ri);\n ri.vsub(bi.position, ri);\n rj.vadd(xj, rj);\n rj.vsub(bj.position, rj);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n\n boxBox(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n si.convexPolyhedronRepresentation.material = si.material;\n sj.convexPolyhedronRepresentation.material = sj.material;\n si.convexPolyhedronRepresentation.collisionResponse = si.collisionResponse;\n sj.convexPolyhedronRepresentation.collisionResponse = sj.collisionResponse;\n return this.convexConvex(si.convexPolyhedronRepresentation, sj.convexPolyhedronRepresentation, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n }\n\n sphereBox(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n const v3pool = this.v3pool; // we refer to the box as body j\n\n const sides = sphereBox_sides;\n xi.vsub(xj, box_to_sphere);\n sj.getSideNormals(sides, qj);\n const R = si.radius;\n\n let found = false; // Store the resulting side penetration info\n\n const side_ns = sphereBox_side_ns;\n const side_ns1 = sphereBox_side_ns1;\n const side_ns2 = sphereBox_side_ns2;\n let side_h = null;\n let side_penetrations = 0;\n let side_dot1 = 0;\n let side_dot2 = 0;\n let side_distance = null;\n\n for (let idx = 0, nsides = sides.length; idx !== nsides && found === false; idx++) {\n // Get the plane side normal (ns)\n const ns = sphereBox_ns;\n ns.copy(sides[idx]);\n const h = ns.length();\n ns.normalize(); // The normal/distance dot product tells which side of the plane we are\n\n const dot = box_to_sphere.dot(ns);\n\n if (dot < h + R && dot > 0) {\n // Intersects plane. Now check the other two dimensions\n const ns1 = sphereBox_ns1;\n const ns2 = sphereBox_ns2;\n ns1.copy(sides[(idx + 1) % 3]);\n ns2.copy(sides[(idx + 2) % 3]);\n const h1 = ns1.length();\n const h2 = ns2.length();\n ns1.normalize();\n ns2.normalize();\n const dot1 = box_to_sphere.dot(ns1);\n const dot2 = box_to_sphere.dot(ns2);\n\n if (dot1 < h1 && dot1 > -h1 && dot2 < h2 && dot2 > -h2) {\n const dist = Math.abs(dot - h - R);\n\n if (side_distance === null || dist < side_distance) {\n side_distance = dist;\n side_dot1 = dot1;\n side_dot2 = dot2;\n side_h = h;\n side_ns.copy(ns);\n side_ns1.copy(ns1);\n side_ns2.copy(ns2);\n side_penetrations++;\n\n if (justTest) {\n return true;\n }\n }\n }\n }\n }\n\n if (side_penetrations) {\n found = true;\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n side_ns.scale(-R, r.ri); // Sphere r\n\n r.ni.copy(side_ns);\n r.ni.negate(r.ni); // Normal should be out of sphere\n\n side_ns.scale(side_h, side_ns);\n side_ns1.scale(side_dot1, side_ns1);\n side_ns.vadd(side_ns1, side_ns);\n side_ns2.scale(side_dot2, side_ns2);\n side_ns.vadd(side_ns2, r.rj); // Make relative to bodies\n\n r.ri.vadd(xi, r.ri);\n r.ri.vsub(bi.position, r.ri);\n r.rj.vadd(xj, r.rj);\n r.rj.vsub(bj.position, r.rj);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n } // Check corners\n\n\n let rj = v3pool.get();\n const sphere_to_corner = sphereBox_sphere_to_corner;\n\n for (let j = 0; j !== 2 && !found; j++) {\n for (let k = 0; k !== 2 && !found; k++) {\n for (let l = 0; l !== 2 && !found; l++) {\n rj.set(0, 0, 0);\n\n if (j) {\n rj.vadd(sides[0], rj);\n } else {\n rj.vsub(sides[0], rj);\n }\n\n if (k) {\n rj.vadd(sides[1], rj);\n } else {\n rj.vsub(sides[1], rj);\n }\n\n if (l) {\n rj.vadd(sides[2], rj);\n } else {\n rj.vsub(sides[2], rj);\n } // World position of corner\n\n\n xj.vadd(rj, sphere_to_corner);\n sphere_to_corner.vsub(xi, sphere_to_corner);\n\n if (sphere_to_corner.lengthSquared() < R * R) {\n if (justTest) {\n return true;\n }\n\n found = true;\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n r.ri.copy(sphere_to_corner);\n r.ri.normalize();\n r.ni.copy(r.ri);\n r.ri.scale(R, r.ri);\n r.rj.copy(rj); // Make relative to bodies\n\n r.ri.vadd(xi, r.ri);\n r.ri.vsub(bi.position, r.ri);\n r.rj.vadd(xj, r.rj);\n r.rj.vsub(bj.position, r.rj);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n }\n }\n\n v3pool.release(rj);\n rj = null; // Check edges\n\n const edgeTangent = v3pool.get();\n const edgeCenter = v3pool.get();\n const r = v3pool.get(); // r = edge center to sphere center\n\n const orthogonal = v3pool.get();\n const dist = v3pool.get();\n const Nsides = sides.length;\n\n for (let j = 0; j !== Nsides && !found; j++) {\n for (let k = 0; k !== Nsides && !found; k++) {\n if (j % 3 !== k % 3) {\n // Get edge tangent\n sides[k].cross(sides[j], edgeTangent);\n edgeTangent.normalize();\n sides[j].vadd(sides[k], edgeCenter);\n r.copy(xi);\n r.vsub(edgeCenter, r);\n r.vsub(xj, r);\n const orthonorm = r.dot(edgeTangent); // distance from edge center to sphere center in the tangent direction\n\n edgeTangent.scale(orthonorm, orthogonal); // Vector from edge center to sphere center in the tangent direction\n // Find the third side orthogonal to this one\n\n let l = 0;\n\n while (l === j % 3 || l === k % 3) {\n l++;\n } // vec from edge center to sphere projected to the plane orthogonal to the edge tangent\n\n\n dist.copy(xi);\n dist.vsub(orthogonal, dist);\n dist.vsub(edgeCenter, dist);\n dist.vsub(xj, dist); // Distances in tangent direction and distance in the plane orthogonal to it\n\n const tdist = Math.abs(orthonorm);\n const ndist = dist.length();\n\n if (tdist < sides[l].length() && ndist < R) {\n if (justTest) {\n return true;\n }\n\n found = true;\n const res = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n edgeCenter.vadd(orthogonal, res.rj); // box rj\n\n res.rj.copy(res.rj);\n dist.negate(res.ni);\n res.ni.normalize();\n res.ri.copy(res.rj);\n res.ri.vadd(xj, res.ri);\n res.ri.vsub(xi, res.ri);\n res.ri.normalize();\n res.ri.scale(R, res.ri); // Make relative to bodies\n\n res.ri.vadd(xi, res.ri);\n res.ri.vsub(bi.position, res.ri);\n res.rj.vadd(xj, res.rj);\n res.rj.vsub(bj.position, res.rj);\n this.result.push(res);\n this.createFrictionEquationsFromContact(res, this.frictionResult);\n }\n }\n }\n }\n\n v3pool.release(edgeTangent, edgeCenter, r, orthogonal, dist);\n }\n\n planeBox(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n sj.convexPolyhedronRepresentation.material = sj.material;\n sj.convexPolyhedronRepresentation.collisionResponse = sj.collisionResponse;\n sj.convexPolyhedronRepresentation.id = sj.id;\n return this.planeConvex(si, sj.convexPolyhedronRepresentation, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n }\n\n convexConvex(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest, faceListA, faceListB) {\n const sepAxis = convexConvex_sepAxis;\n\n if (xi.distanceTo(xj) > si.boundingSphereRadius + sj.boundingSphereRadius) {\n return;\n }\n\n if (si.findSeparatingAxis(sj, xi, qi, xj, qj, sepAxis, faceListA, faceListB)) {\n const res = [];\n const q = convexConvex_q;\n si.clipAgainstHull(xi, qi, sj, xj, qj, sepAxis, -100, 100, res);\n let numContacts = 0;\n\n for (let j = 0; j !== res.length; j++) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n const ri = r.ri;\n const rj = r.rj;\n sepAxis.negate(r.ni);\n res[j].normal.negate(q);\n q.scale(res[j].depth, q);\n res[j].point.vadd(q, ri);\n rj.copy(res[j].point); // Contact points are in world coordinates. Transform back to relative\n\n ri.vsub(xi, ri);\n rj.vsub(xj, rj); // Make relative to bodies\n\n ri.vadd(xi, ri);\n ri.vsub(bi.position, ri);\n rj.vadd(xj, rj);\n rj.vsub(bj.position, rj);\n this.result.push(r);\n numContacts++;\n\n if (!this.enableFrictionReduction) {\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n\n if (this.enableFrictionReduction && numContacts) {\n this.createFrictionFromAverage(numContacts);\n }\n }\n }\n\n sphereConvex(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n const v3pool = this.v3pool;\n xi.vsub(xj, convex_to_sphere);\n const normals = sj.faceNormals;\n const faces = sj.faces;\n const verts = sj.vertices;\n const R = si.radius;\n // return;\n // }\n\n let found = false; // Check corners\n\n for (let i = 0; i !== verts.length; i++) {\n const v = verts[i]; // World position of corner\n\n const worldCorner = sphereConvex_worldCorner;\n qj.vmult(v, worldCorner);\n xj.vadd(worldCorner, worldCorner);\n const sphere_to_corner = sphereConvex_sphereToCorner;\n worldCorner.vsub(xi, sphere_to_corner);\n\n if (sphere_to_corner.lengthSquared() < R * R) {\n if (justTest) {\n return true;\n }\n\n found = true;\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n r.ri.copy(sphere_to_corner);\n r.ri.normalize();\n r.ni.copy(r.ri);\n r.ri.scale(R, r.ri);\n worldCorner.vsub(xj, r.rj); // Should be relative to the body.\n\n r.ri.vadd(xi, r.ri);\n r.ri.vsub(bi.position, r.ri); // Should be relative to the body.\n\n r.rj.vadd(xj, r.rj);\n r.rj.vsub(bj.position, r.rj);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n return;\n }\n } // Check side (plane) intersections\n\n\n for (let i = 0, nfaces = faces.length; i !== nfaces && found === false; i++) {\n const normal = normals[i];\n const face = faces[i]; // Get world-transformed normal of the face\n\n const worldNormal = sphereConvex_worldNormal;\n qj.vmult(normal, worldNormal); // Get a world vertex from the face\n\n const worldPoint = sphereConvex_worldPoint;\n qj.vmult(verts[face[0]], worldPoint);\n worldPoint.vadd(xj, worldPoint); // Get a point on the sphere, closest to the face normal\n\n const worldSpherePointClosestToPlane = sphereConvex_worldSpherePointClosestToPlane;\n worldNormal.scale(-R, worldSpherePointClosestToPlane);\n xi.vadd(worldSpherePointClosestToPlane, worldSpherePointClosestToPlane); // Vector from a face point to the closest point on the sphere\n\n const penetrationVec = sphereConvex_penetrationVec;\n worldSpherePointClosestToPlane.vsub(worldPoint, penetrationVec); // The penetration. Negative value means overlap.\n\n const penetration = penetrationVec.dot(worldNormal);\n const worldPointToSphere = sphereConvex_sphereToWorldPoint;\n xi.vsub(worldPoint, worldPointToSphere);\n\n if (penetration < 0 && worldPointToSphere.dot(worldNormal) > 0) {\n // Intersects plane. Now check if the sphere is inside the face polygon\n const faceVerts = []; // Face vertices, in world coords\n\n for (let j = 0, Nverts = face.length; j !== Nverts; j++) {\n const worldVertex = v3pool.get();\n qj.vmult(verts[face[j]], worldVertex);\n xj.vadd(worldVertex, worldVertex);\n faceVerts.push(worldVertex);\n }\n\n if (pointInPolygon(faceVerts, worldNormal, xi)) {\n // Is the sphere center in the face polygon?\n if (justTest) {\n return true;\n }\n\n found = true;\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n worldNormal.scale(-R, r.ri); // Contact offset, from sphere center to contact\n\n worldNormal.negate(r.ni); // Normal pointing out of sphere\n\n const penetrationVec2 = v3pool.get();\n worldNormal.scale(-penetration, penetrationVec2);\n const penetrationSpherePoint = v3pool.get();\n worldNormal.scale(-R, penetrationSpherePoint); //xi.vsub(xj).vadd(penetrationSpherePoint).vadd(penetrationVec2 , r.rj);\n\n xi.vsub(xj, r.rj);\n r.rj.vadd(penetrationSpherePoint, r.rj);\n r.rj.vadd(penetrationVec2, r.rj); // Should be relative to the body.\n\n r.rj.vadd(xj, r.rj);\n r.rj.vsub(bj.position, r.rj); // Should be relative to the body.\n\n r.ri.vadd(xi, r.ri);\n r.ri.vsub(bi.position, r.ri);\n v3pool.release(penetrationVec2);\n v3pool.release(penetrationSpherePoint);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult); // Release world vertices\n\n for (let j = 0, Nfaceverts = faceVerts.length; j !== Nfaceverts; j++) {\n v3pool.release(faceVerts[j]);\n }\n\n return; // We only expect *one* face contact\n } else {\n // Edge?\n for (let j = 0; j !== face.length; j++) {\n // Get two world transformed vertices\n const v1 = v3pool.get();\n const v2 = v3pool.get();\n qj.vmult(verts[face[(j + 1) % face.length]], v1);\n qj.vmult(verts[face[(j + 2) % face.length]], v2);\n xj.vadd(v1, v1);\n xj.vadd(v2, v2); // Construct edge vector\n\n const edge = sphereConvex_edge;\n v2.vsub(v1, edge); // Construct the same vector, but normalized\n\n const edgeUnit = sphereConvex_edgeUnit;\n edge.unit(edgeUnit); // p is xi projected onto the edge\n\n const p = v3pool.get();\n const v1_to_xi = v3pool.get();\n xi.vsub(v1, v1_to_xi);\n const dot = v1_to_xi.dot(edgeUnit);\n edgeUnit.scale(dot, p);\n p.vadd(v1, p); // Compute a vector from p to the center of the sphere\n\n const xi_to_p = v3pool.get();\n p.vsub(xi, xi_to_p); // Collision if the edge-sphere distance is less than the radius\n // AND if p is in between v1 and v2\n\n if (dot > 0 && dot * dot < edge.lengthSquared() && xi_to_p.lengthSquared() < R * R) {\n // Collision if the edge-sphere distance is less than the radius\n // Edge contact!\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n p.vsub(xj, r.rj);\n p.vsub(xi, r.ni);\n r.ni.normalize();\n r.ni.scale(R, r.ri); // Should be relative to the body.\n\n r.rj.vadd(xj, r.rj);\n r.rj.vsub(bj.position, r.rj); // Should be relative to the body.\n\n r.ri.vadd(xi, r.ri);\n r.ri.vsub(bi.position, r.ri);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult); // Release world vertices\n\n for (let j = 0, Nfaceverts = faceVerts.length; j !== Nfaceverts; j++) {\n v3pool.release(faceVerts[j]);\n }\n\n v3pool.release(v1);\n v3pool.release(v2);\n v3pool.release(p);\n v3pool.release(xi_to_p);\n v3pool.release(v1_to_xi);\n return;\n }\n\n v3pool.release(v1);\n v3pool.release(v2);\n v3pool.release(p);\n v3pool.release(xi_to_p);\n v3pool.release(v1_to_xi);\n }\n } // Release world vertices\n\n\n for (let j = 0, Nfaceverts = faceVerts.length; j !== Nfaceverts; j++) {\n v3pool.release(faceVerts[j]);\n }\n }\n }\n }\n\n planeConvex(planeShape, convexShape, planePosition, convexPosition, planeQuat, convexQuat, planeBody, convexBody, si, sj, justTest) {\n // Simply return the points behind the plane.\n const worldVertex = planeConvex_v;\n const worldNormal = planeConvex_normal;\n worldNormal.set(0, 0, 1);\n planeQuat.vmult(worldNormal, worldNormal); // Turn normal according to plane orientation\n\n let numContacts = 0;\n const relpos = planeConvex_relpos;\n\n for (let i = 0; i !== convexShape.vertices.length; i++) {\n // Get world convex vertex\n worldVertex.copy(convexShape.vertices[i]);\n convexQuat.vmult(worldVertex, worldVertex);\n convexPosition.vadd(worldVertex, worldVertex);\n worldVertex.vsub(planePosition, relpos);\n const dot = worldNormal.dot(relpos);\n\n if (dot <= 0.0) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(planeBody, convexBody, planeShape, convexShape, si, sj); // Get vertex position projected on plane\n\n const projected = planeConvex_projected;\n worldNormal.scale(worldNormal.dot(relpos), projected);\n worldVertex.vsub(projected, projected);\n projected.vsub(planePosition, r.ri); // From plane to vertex projected on plane\n\n r.ni.copy(worldNormal); // Contact normal is the plane normal out from plane\n // rj is now just the vector from the convex center to the vertex\n\n worldVertex.vsub(convexPosition, r.rj); // Make it relative to the body\n\n r.ri.vadd(planePosition, r.ri);\n r.ri.vsub(planeBody.position, r.ri);\n r.rj.vadd(convexPosition, r.rj);\n r.rj.vsub(convexBody.position, r.rj);\n this.result.push(r);\n numContacts++;\n\n if (!this.enableFrictionReduction) {\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n }\n\n if (this.enableFrictionReduction && numContacts) {\n this.createFrictionFromAverage(numContacts);\n }\n }\n\n boxConvex(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n si.convexPolyhedronRepresentation.material = si.material;\n si.convexPolyhedronRepresentation.collisionResponse = si.collisionResponse;\n return this.convexConvex(si.convexPolyhedronRepresentation, sj, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n }\n\n sphereHeightfield(sphereShape, hfShape, spherePos, hfPos, sphereQuat, hfQuat, sphereBody, hfBody, rsi, rsj, justTest) {\n const data = hfShape.data;\n const radius = sphereShape.radius;\n const w = hfShape.elementSize;\n const worldPillarOffset = sphereHeightfield_tmp2; // Get sphere position to heightfield local!\n\n const localSpherePos = sphereHeightfield_tmp1;\n Transform.pointToLocalFrame(hfPos, hfQuat, spherePos, localSpherePos); // Get the index of the data points to test against\n\n let iMinX = Math.floor((localSpherePos.x - radius) / w) - 1;\n let iMaxX = Math.ceil((localSpherePos.x + radius) / w) + 1;\n let iMinY = Math.floor((localSpherePos.y - radius) / w) - 1;\n let iMaxY = Math.ceil((localSpherePos.y + radius) / w) + 1; // Bail out if we are out of the terrain\n\n if (iMaxX < 0 || iMaxY < 0 || iMinX > data.length || iMinY > data[0].length) {\n return;\n } // Clamp index to edges\n\n\n if (iMinX < 0) {\n iMinX = 0;\n }\n\n if (iMaxX < 0) {\n iMaxX = 0;\n }\n\n if (iMinY < 0) {\n iMinY = 0;\n }\n\n if (iMaxY < 0) {\n iMaxY = 0;\n }\n\n if (iMinX >= data.length) {\n iMinX = data.length - 1;\n }\n\n if (iMaxX >= data.length) {\n iMaxX = data.length - 1;\n }\n\n if (iMaxY >= data[0].length) {\n iMaxY = data[0].length - 1;\n }\n\n if (iMinY >= data[0].length) {\n iMinY = data[0].length - 1;\n }\n\n const minMax = [];\n hfShape.getRectMinMax(iMinX, iMinY, iMaxX, iMaxY, minMax);\n const min = minMax[0];\n const max = minMax[1]; // Bail out if we can't touch the bounding height box\n\n if (localSpherePos.z - radius > max || localSpherePos.z + radius < min) {\n return;\n }\n\n const result = this.result;\n\n for (let i = iMinX; i < iMaxX; i++) {\n for (let j = iMinY; j < iMaxY; j++) {\n const numContactsBefore = result.length;\n let intersecting = false; // Lower triangle\n\n hfShape.getConvexTrianglePillar(i, j, false);\n Transform.pointToWorldFrame(hfPos, hfQuat, hfShape.pillarOffset, worldPillarOffset);\n\n if (spherePos.distanceTo(worldPillarOffset) < hfShape.pillarConvex.boundingSphereRadius + sphereShape.boundingSphereRadius) {\n intersecting = this.sphereConvex(sphereShape, hfShape.pillarConvex, spherePos, worldPillarOffset, sphereQuat, hfQuat, sphereBody, hfBody, sphereShape, hfShape, justTest);\n }\n\n if (justTest && intersecting) {\n return true;\n } // Upper triangle\n\n\n hfShape.getConvexTrianglePillar(i, j, true);\n Transform.pointToWorldFrame(hfPos, hfQuat, hfShape.pillarOffset, worldPillarOffset);\n\n if (spherePos.distanceTo(worldPillarOffset) < hfShape.pillarConvex.boundingSphereRadius + sphereShape.boundingSphereRadius) {\n intersecting = this.sphereConvex(sphereShape, hfShape.pillarConvex, spherePos, worldPillarOffset, sphereQuat, hfQuat, sphereBody, hfBody, sphereShape, hfShape, justTest);\n }\n\n if (justTest && intersecting) {\n return true;\n }\n\n const numContacts = result.length - numContactsBefore;\n\n if (numContacts > 2) {\n return;\n }\n /*\n // Skip all but 1\n for (let k = 0; k < numContacts - 1; k++) {\n result.pop();\n }\n */\n\n }\n }\n }\n\n boxHeightfield(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n si.convexPolyhedronRepresentation.material = si.material;\n si.convexPolyhedronRepresentation.collisionResponse = si.collisionResponse;\n return this.convexHeightfield(si.convexPolyhedronRepresentation, sj, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n }\n\n convexHeightfield(convexShape, hfShape, convexPos, hfPos, convexQuat, hfQuat, convexBody, hfBody, rsi, rsj, justTest) {\n const data = hfShape.data;\n const w = hfShape.elementSize;\n const radius = convexShape.boundingSphereRadius;\n const worldPillarOffset = convexHeightfield_tmp2;\n const faceList = convexHeightfield_faceList; // Get sphere position to heightfield local!\n\n const localConvexPos = convexHeightfield_tmp1;\n Transform.pointToLocalFrame(hfPos, hfQuat, convexPos, localConvexPos); // Get the index of the data points to test against\n\n let iMinX = Math.floor((localConvexPos.x - radius) / w) - 1;\n let iMaxX = Math.ceil((localConvexPos.x + radius) / w) + 1;\n let iMinY = Math.floor((localConvexPos.y - radius) / w) - 1;\n let iMaxY = Math.ceil((localConvexPos.y + radius) / w) + 1; // Bail out if we are out of the terrain\n\n if (iMaxX < 0 || iMaxY < 0 || iMinX > data.length || iMinY > data[0].length) {\n return;\n } // Clamp index to edges\n\n\n if (iMinX < 0) {\n iMinX = 0;\n }\n\n if (iMaxX < 0) {\n iMaxX = 0;\n }\n\n if (iMinY < 0) {\n iMinY = 0;\n }\n\n if (iMaxY < 0) {\n iMaxY = 0;\n }\n\n if (iMinX >= data.length) {\n iMinX = data.length - 1;\n }\n\n if (iMaxX >= data.length) {\n iMaxX = data.length - 1;\n }\n\n if (iMaxY >= data[0].length) {\n iMaxY = data[0].length - 1;\n }\n\n if (iMinY >= data[0].length) {\n iMinY = data[0].length - 1;\n }\n\n const minMax = [];\n hfShape.getRectMinMax(iMinX, iMinY, iMaxX, iMaxY, minMax);\n const min = minMax[0];\n const max = minMax[1]; // Bail out if we're cant touch the bounding height box\n\n if (localConvexPos.z - radius > max || localConvexPos.z + radius < min) {\n return;\n }\n\n for (let i = iMinX; i < iMaxX; i++) {\n for (let j = iMinY; j < iMaxY; j++) {\n let intersecting = false; // Lower triangle\n\n hfShape.getConvexTrianglePillar(i, j, false);\n Transform.pointToWorldFrame(hfPos, hfQuat, hfShape.pillarOffset, worldPillarOffset);\n\n if (convexPos.distanceTo(worldPillarOffset) < hfShape.pillarConvex.boundingSphereRadius + convexShape.boundingSphereRadius) {\n intersecting = this.convexConvex(convexShape, hfShape.pillarConvex, convexPos, worldPillarOffset, convexQuat, hfQuat, convexBody, hfBody, null, null, justTest, faceList, null);\n }\n\n if (justTest && intersecting) {\n return true;\n } // Upper triangle\n\n\n hfShape.getConvexTrianglePillar(i, j, true);\n Transform.pointToWorldFrame(hfPos, hfQuat, hfShape.pillarOffset, worldPillarOffset);\n\n if (convexPos.distanceTo(worldPillarOffset) < hfShape.pillarConvex.boundingSphereRadius + convexShape.boundingSphereRadius) {\n intersecting = this.convexConvex(convexShape, hfShape.pillarConvex, convexPos, worldPillarOffset, convexQuat, hfQuat, convexBody, hfBody, null, null, justTest, faceList, null);\n }\n\n if (justTest && intersecting) {\n return true;\n }\n }\n }\n }\n\n sphereParticle(sj, si, xj, xi, qj, qi, bj, bi, rsi, rsj, justTest) {\n // The normal is the unit vector from sphere center to particle center\n const normal = particleSphere_normal;\n normal.set(0, 0, 1);\n xi.vsub(xj, normal);\n const lengthSquared = normal.lengthSquared();\n\n if (lengthSquared <= sj.radius * sj.radius) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n normal.normalize();\n r.rj.copy(normal);\n r.rj.scale(sj.radius, r.rj);\n r.ni.copy(normal); // Contact normal\n\n r.ni.negate(r.ni);\n r.ri.set(0, 0, 0); // Center of particle\n\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n\n planeParticle(sj, si, xj, xi, qj, qi, bj, bi, rsi, rsj, justTest) {\n const normal = particlePlane_normal;\n normal.set(0, 0, 1);\n bj.quaternion.vmult(normal, normal); // Turn normal according to plane orientation\n\n const relpos = particlePlane_relpos;\n xi.vsub(bj.position, relpos);\n const dot = normal.dot(relpos);\n\n if (dot <= 0.0) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n r.ni.copy(normal); // Contact normal is the plane normal\n\n r.ni.negate(r.ni);\n r.ri.set(0, 0, 0); // Center of particle\n // Get particle position projected on plane\n\n const projected = particlePlane_projected;\n normal.scale(normal.dot(xi), projected);\n xi.vsub(projected, projected); //projected.vadd(bj.position,projected);\n // rj is now the projected world position minus plane position\n\n r.rj.copy(projected);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n\n boxParticle(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n si.convexPolyhedronRepresentation.material = si.material;\n si.convexPolyhedronRepresentation.collisionResponse = si.collisionResponse;\n return this.convexParticle(si.convexPolyhedronRepresentation, sj, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n }\n\n convexParticle(sj, si, xj, xi, qj, qi, bj, bi, rsi, rsj, justTest) {\n let penetratedFaceIndex = -1;\n const penetratedFaceNormal = convexParticle_penetratedFaceNormal;\n const worldPenetrationVec = convexParticle_worldPenetrationVec;\n let minPenetration = null;\n\n const local = convexParticle_local;\n local.copy(xi);\n local.vsub(xj, local); // Convert position to relative the convex origin\n\n qj.conjugate(cqj);\n cqj.vmult(local, local);\n\n if (sj.pointIsInside(local)) {\n if (sj.worldVerticesNeedsUpdate) {\n sj.computeWorldVertices(xj, qj);\n }\n\n if (sj.worldFaceNormalsNeedsUpdate) {\n sj.computeWorldFaceNormals(qj);\n } // For each world polygon in the polyhedra\n\n\n for (let i = 0, nfaces = sj.faces.length; i !== nfaces; i++) {\n // Construct world face vertices\n const verts = [sj.worldVertices[sj.faces[i][0]]];\n const normal = sj.worldFaceNormals[i]; // Check how much the particle penetrates the polygon plane.\n\n xi.vsub(verts[0], convexParticle_vertexToParticle);\n const penetration = -normal.dot(convexParticle_vertexToParticle);\n\n if (minPenetration === null || Math.abs(penetration) < Math.abs(minPenetration)) {\n if (justTest) {\n return true;\n }\n\n minPenetration = penetration;\n penetratedFaceIndex = i;\n penetratedFaceNormal.copy(normal);\n }\n }\n\n if (penetratedFaceIndex !== -1) {\n // Setup contact\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n penetratedFaceNormal.scale(minPenetration, worldPenetrationVec); // rj is the particle position projected to the face\n\n worldPenetrationVec.vadd(xi, worldPenetrationVec);\n worldPenetrationVec.vsub(xj, worldPenetrationVec);\n r.rj.copy(worldPenetrationVec); //const projectedToFace = xi.vsub(xj).vadd(worldPenetrationVec);\n //projectedToFace.copy(r.rj);\n //qj.vmult(r.rj,r.rj);\n\n penetratedFaceNormal.negate(r.ni); // Contact normal\n\n r.ri.set(0, 0, 0); // Center of particle\n\n const ri = r.ri;\n const rj = r.rj; // Make relative to bodies\n\n ri.vadd(xi, ri);\n ri.vsub(bi.position, ri);\n rj.vadd(xj, rj);\n rj.vsub(bj.position, rj);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n } else {\n console.warn('Point found inside convex, but did not find penetrating face!');\n }\n }\n }\n\n heightfieldCylinder(hfShape, convexShape, hfPos, convexPos, hfQuat, convexQuat, hfBody, convexBody, rsi, rsj, justTest) {\n return this.convexHeightfield(convexShape, hfShape, convexPos, hfPos, convexQuat, hfQuat, convexBody, hfBody, rsi, rsj, justTest);\n }\n\n particleCylinder(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n return this.convexParticle(sj, si, xj, xi, qj, qi, bj, bi, rsi, rsj, justTest);\n }\n\n sphereTrimesh(sphereShape, trimeshShape, spherePos, trimeshPos, sphereQuat, trimeshQuat, sphereBody, trimeshBody, rsi, rsj, justTest) {\n const edgeVertexA = sphereTrimesh_edgeVertexA;\n const edgeVertexB = sphereTrimesh_edgeVertexB;\n const edgeVector = sphereTrimesh_edgeVector;\n const edgeVectorUnit = sphereTrimesh_edgeVectorUnit;\n const localSpherePos = sphereTrimesh_localSpherePos;\n const tmp = sphereTrimesh_tmp;\n const localSphereAABB = sphereTrimesh_localSphereAABB;\n const v2 = sphereTrimesh_v2;\n const relpos = sphereTrimesh_relpos;\n const triangles = sphereTrimesh_triangles; // Convert sphere position to local in the trimesh\n\n Transform.pointToLocalFrame(trimeshPos, trimeshQuat, spherePos, localSpherePos); // Get the aabb of the sphere locally in the trimesh\n\n const sphereRadius = sphereShape.radius;\n localSphereAABB.lowerBound.set(localSpherePos.x - sphereRadius, localSpherePos.y - sphereRadius, localSpherePos.z - sphereRadius);\n localSphereAABB.upperBound.set(localSpherePos.x + sphereRadius, localSpherePos.y + sphereRadius, localSpherePos.z + sphereRadius);\n trimeshShape.getTrianglesInAABB(localSphereAABB, triangles); //for (let i = 0; i < trimeshShape.indices.length / 3; i++) triangles.push(i); // All\n // Vertices\n\n const v = sphereTrimesh_v;\n const radiusSquared = sphereShape.radius * sphereShape.radius;\n\n for (let i = 0; i < triangles.length; i++) {\n for (let j = 0; j < 3; j++) {\n trimeshShape.getVertex(trimeshShape.indices[triangles[i] * 3 + j], v); // Check vertex overlap in sphere\n\n v.vsub(localSpherePos, relpos);\n\n if (relpos.lengthSquared() <= radiusSquared) {\n // Safe up\n v2.copy(v);\n Transform.pointToWorldFrame(trimeshPos, trimeshQuat, v2, v);\n v.vsub(spherePos, relpos);\n\n if (justTest) {\n return true;\n }\n\n let r = this.createContactEquation(sphereBody, trimeshBody, sphereShape, trimeshShape, rsi, rsj);\n r.ni.copy(relpos);\n r.ni.normalize(); // ri is the vector from sphere center to the sphere surface\n\n r.ri.copy(r.ni);\n r.ri.scale(sphereShape.radius, r.ri);\n r.ri.vadd(spherePos, r.ri);\n r.ri.vsub(sphereBody.position, r.ri);\n r.rj.copy(v);\n r.rj.vsub(trimeshBody.position, r.rj); // Store result\n\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n } // Check all edges\n\n\n for (let i = 0; i < triangles.length; i++) {\n for (let j = 0; j < 3; j++) {\n trimeshShape.getVertex(trimeshShape.indices[triangles[i] * 3 + j], edgeVertexA);\n trimeshShape.getVertex(trimeshShape.indices[triangles[i] * 3 + (j + 1) % 3], edgeVertexB);\n edgeVertexB.vsub(edgeVertexA, edgeVector); // Project sphere position to the edge\n\n localSpherePos.vsub(edgeVertexB, tmp);\n const positionAlongEdgeB = tmp.dot(edgeVector);\n localSpherePos.vsub(edgeVertexA, tmp);\n let positionAlongEdgeA = tmp.dot(edgeVector);\n\n if (positionAlongEdgeA > 0 && positionAlongEdgeB < 0) {\n // Now check the orthogonal distance from edge to sphere center\n localSpherePos.vsub(edgeVertexA, tmp);\n edgeVectorUnit.copy(edgeVector);\n edgeVectorUnit.normalize();\n positionAlongEdgeA = tmp.dot(edgeVectorUnit);\n edgeVectorUnit.scale(positionAlongEdgeA, tmp);\n tmp.vadd(edgeVertexA, tmp); // tmp is now the sphere center position projected to the edge, defined locally in the trimesh frame\n\n const dist = tmp.distanceTo(localSpherePos);\n\n if (dist < sphereShape.radius) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(sphereBody, trimeshBody, sphereShape, trimeshShape, rsi, rsj);\n tmp.vsub(localSpherePos, r.ni);\n r.ni.normalize();\n r.ni.scale(sphereShape.radius, r.ri);\n r.ri.vadd(spherePos, r.ri);\n r.ri.vsub(sphereBody.position, r.ri);\n Transform.pointToWorldFrame(trimeshPos, trimeshQuat, tmp, tmp);\n tmp.vsub(trimeshBody.position, r.rj);\n Transform.vectorToWorldFrame(trimeshQuat, r.ni, r.ni);\n Transform.vectorToWorldFrame(trimeshQuat, r.ri, r.ri);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n }\n } // Triangle faces\n\n\n const va = sphereTrimesh_va;\n const vb = sphereTrimesh_vb;\n const vc = sphereTrimesh_vc;\n const normal = sphereTrimesh_normal;\n\n for (let i = 0, N = triangles.length; i !== N; i++) {\n trimeshShape.getTriangleVertices(triangles[i], va, vb, vc);\n trimeshShape.getNormal(triangles[i], normal);\n localSpherePos.vsub(va, tmp);\n let dist = tmp.dot(normal);\n normal.scale(dist, tmp);\n localSpherePos.vsub(tmp, tmp); // tmp is now the sphere position projected to the triangle plane\n\n dist = tmp.distanceTo(localSpherePos);\n\n if (Ray.pointInTriangle(tmp, va, vb, vc) && dist < sphereShape.radius) {\n if (justTest) {\n return true;\n }\n\n let r = this.createContactEquation(sphereBody, trimeshBody, sphereShape, trimeshShape, rsi, rsj);\n tmp.vsub(localSpherePos, r.ni);\n r.ni.normalize();\n r.ni.scale(sphereShape.radius, r.ri);\n r.ri.vadd(spherePos, r.ri);\n r.ri.vsub(sphereBody.position, r.ri);\n Transform.pointToWorldFrame(trimeshPos, trimeshQuat, tmp, tmp);\n tmp.vsub(trimeshBody.position, r.rj);\n Transform.vectorToWorldFrame(trimeshQuat, r.ni, r.ni);\n Transform.vectorToWorldFrame(trimeshQuat, r.ri, r.ri);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n\n triangles.length = 0;\n }\n\n planeTrimesh(planeShape, trimeshShape, planePos, trimeshPos, planeQuat, trimeshQuat, planeBody, trimeshBody, rsi, rsj, justTest) {\n // Make contacts!\n const v = new Vec3();\n const normal = planeTrimesh_normal;\n normal.set(0, 0, 1);\n planeQuat.vmult(normal, normal); // Turn normal according to plane\n\n for (let i = 0; i < trimeshShape.vertices.length / 3; i++) {\n // Get world vertex from trimesh\n trimeshShape.getVertex(i, v); // Safe up\n\n const v2 = new Vec3();\n v2.copy(v);\n Transform.pointToWorldFrame(trimeshPos, trimeshQuat, v2, v); // Check plane side\n\n const relpos = planeTrimesh_relpos;\n v.vsub(planePos, relpos);\n const dot = normal.dot(relpos);\n\n if (dot <= 0.0) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(planeBody, trimeshBody, planeShape, trimeshShape, rsi, rsj);\n r.ni.copy(normal); // Contact normal is the plane normal\n // Get vertex position projected on plane\n\n const projected = planeTrimesh_projected;\n normal.scale(relpos.dot(normal), projected);\n v.vsub(projected, projected); // ri is the projected world position minus plane position\n\n r.ri.copy(projected);\n r.ri.vsub(planeBody.position, r.ri);\n r.rj.copy(v);\n r.rj.vsub(trimeshBody.position, r.rj); // Store result\n\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n } // convexTrimesh(\n // si: ConvexPolyhedron, sj: Trimesh, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion,\n // bi: Body, bj: Body, rsi?: Shape | null, rsj?: Shape | null,\n // faceListA?: number[] | null, faceListB?: number[] | null,\n // ) {\n // const sepAxis = convexConvex_sepAxis;\n // if(xi.distanceTo(xj) > si.boundingSphereRadius + sj.boundingSphereRadius){\n // return;\n // }\n // // Construct a temp hull for each triangle\n // const hullB = new ConvexPolyhedron();\n // hullB.faces = [[0,1,2]];\n // const va = new Vec3();\n // const vb = new Vec3();\n // const vc = new Vec3();\n // hullB.vertices = [\n // va,\n // vb,\n // vc\n // ];\n // for (let i = 0; i < sj.indices.length / 3; i++) {\n // const triangleNormal = new Vec3();\n // sj.getNormal(i, triangleNormal);\n // hullB.faceNormals = [triangleNormal];\n // sj.getTriangleVertices(i, va, vb, vc);\n // let d = si.testSepAxis(triangleNormal, hullB, xi, qi, xj, qj);\n // if(!d){\n // triangleNormal.scale(-1, triangleNormal);\n // d = si.testSepAxis(triangleNormal, hullB, xi, qi, xj, qj);\n // if(!d){\n // continue;\n // }\n // }\n // const res: ConvexPolyhedronContactPoint[] = [];\n // const q = convexConvex_q;\n // si.clipAgainstHull(xi,qi,hullB,xj,qj,triangleNormal,-100,100,res);\n // for(let j = 0; j !== res.length; j++){\n // const r = this.createContactEquation(bi,bj,si,sj,rsi,rsj),\n // ri = r.ri,\n // rj = r.rj;\n // r.ni.copy(triangleNormal);\n // r.ni.negate(r.ni);\n // res[j].normal.negate(q);\n // q.mult(res[j].depth, q);\n // res[j].point.vadd(q, ri);\n // rj.copy(res[j].point);\n // // Contact points are in world coordinates. Transform back to relative\n // ri.vsub(xi,ri);\n // rj.vsub(xj,rj);\n // // Make relative to bodies\n // ri.vadd(xi, ri);\n // ri.vsub(bi.position, ri);\n // rj.vadd(xj, rj);\n // rj.vsub(bj.position, rj);\n // result.push(r);\n // }\n // }\n // }\n\n\n}\nconst averageNormal = new Vec3();\nconst averageContactPointA = new Vec3();\nconst averageContactPointB = new Vec3();\nconst tmpVec1 = new Vec3();\nconst tmpVec2 = new Vec3();\nconst tmpQuat1 = new Quaternion();\nconst tmpQuat2 = new Quaternion();\n\nconst planeTrimesh_normal = new Vec3();\nconst planeTrimesh_relpos = new Vec3();\nconst planeTrimesh_projected = new Vec3();\nconst sphereTrimesh_normal = new Vec3();\nconst sphereTrimesh_relpos = new Vec3();\nconst sphereTrimesh_v = new Vec3();\nconst sphereTrimesh_v2 = new Vec3();\nconst sphereTrimesh_edgeVertexA = new Vec3();\nconst sphereTrimesh_edgeVertexB = new Vec3();\nconst sphereTrimesh_edgeVector = new Vec3();\nconst sphereTrimesh_edgeVectorUnit = new Vec3();\nconst sphereTrimesh_localSpherePos = new Vec3();\nconst sphereTrimesh_tmp = new Vec3();\nconst sphereTrimesh_va = new Vec3();\nconst sphereTrimesh_vb = new Vec3();\nconst sphereTrimesh_vc = new Vec3();\nconst sphereTrimesh_localSphereAABB = new AABB();\nconst sphereTrimesh_triangles = [];\nconst point_on_plane_to_sphere = new Vec3();\nconst plane_to_sphere_ortho = new Vec3(); // See http://bulletphysics.com/Bullet/BulletFull/SphereTriangleDetector_8cpp_source.html\n\nconst pointInPolygon_edge = new Vec3();\nconst pointInPolygon_edge_x_normal = new Vec3();\nconst pointInPolygon_vtp = new Vec3();\n\nfunction pointInPolygon(verts, normal, p) {\n let positiveResult = null;\n const N = verts.length;\n\n for (let i = 0; i !== N; i++) {\n const v = verts[i]; // Get edge to the next vertex\n\n const edge = pointInPolygon_edge;\n verts[(i + 1) % N].vsub(v, edge); // Get cross product between polygon normal and the edge\n\n const edge_x_normal = pointInPolygon_edge_x_normal; //const edge_x_normal = new Vec3();\n\n edge.cross(normal, edge_x_normal); // Get vector between point and current vertex\n\n const vertex_to_p = pointInPolygon_vtp;\n p.vsub(v, vertex_to_p); // This dot product determines which side of the edge the point is\n\n const r = edge_x_normal.dot(vertex_to_p); // If all such dot products have same sign, we are inside the polygon.\n\n if (positiveResult === null || r > 0 && positiveResult === true || r <= 0 && positiveResult === false) {\n if (positiveResult === null) {\n positiveResult = r > 0;\n }\n\n continue;\n } else {\n return false; // Encountered some other sign. Exit.\n }\n } // If we got here, all dot products were of the same sign.\n\n\n return true;\n}\n\nconst box_to_sphere = new Vec3();\nconst sphereBox_ns = new Vec3();\nconst sphereBox_ns1 = new Vec3();\nconst sphereBox_ns2 = new Vec3();\nconst sphereBox_sides = [new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3()];\nconst sphereBox_sphere_to_corner = new Vec3();\nconst sphereBox_side_ns = new Vec3();\nconst sphereBox_side_ns1 = new Vec3();\nconst sphereBox_side_ns2 = new Vec3();\nconst convex_to_sphere = new Vec3();\nconst sphereConvex_edge = new Vec3();\nconst sphereConvex_edgeUnit = new Vec3();\nconst sphereConvex_sphereToCorner = new Vec3();\nconst sphereConvex_worldCorner = new Vec3();\nconst sphereConvex_worldNormal = new Vec3();\nconst sphereConvex_worldPoint = new Vec3();\nconst sphereConvex_worldSpherePointClosestToPlane = new Vec3();\nconst sphereConvex_penetrationVec = new Vec3();\nconst sphereConvex_sphereToWorldPoint = new Vec3();\nconst planeConvex_v = new Vec3();\nconst planeConvex_normal = new Vec3();\nconst planeConvex_relpos = new Vec3();\nconst planeConvex_projected = new Vec3();\nconst convexConvex_sepAxis = new Vec3();\nconst convexConvex_q = new Vec3();\nconst particlePlane_normal = new Vec3();\nconst particlePlane_relpos = new Vec3();\nconst particlePlane_projected = new Vec3();\nconst particleSphere_normal = new Vec3(); // WIP\n\nconst cqj = new Quaternion();\nconst convexParticle_local = new Vec3();\nconst convexParticle_penetratedFaceNormal = new Vec3();\nconst convexParticle_vertexToParticle = new Vec3();\nconst convexParticle_worldPenetrationVec = new Vec3();\nconst convexHeightfield_tmp1 = new Vec3();\nconst convexHeightfield_tmp2 = new Vec3();\nconst convexHeightfield_faceList = [0];\nconst sphereHeightfield_tmp1 = new Vec3();\nconst sphereHeightfield_tmp2 = new Vec3();\n\nclass OverlapKeeper {\n /**\n * @todo Remove useless constructor\n */\n constructor() {\n this.current = void 0;\n this.previous = void 0;\n this.current = [];\n this.previous = [];\n }\n /**\n * getKey\n */\n\n\n getKey(i, j) {\n if (j < i) {\n const temp = j;\n j = i;\n i = temp;\n }\n\n return i << 16 | j;\n }\n /**\n * set\n */\n\n\n set(i, j) {\n // Insertion sort. This way the diff will have linear complexity.\n const key = this.getKey(i, j);\n const current = this.current;\n let index = 0;\n\n while (key > current[index]) {\n index++;\n }\n\n if (key === current[index]) {\n return; // Pair was already added\n }\n\n for (let j = current.length - 1; j >= index; j--) {\n current[j + 1] = current[j];\n }\n\n current[index] = key;\n }\n /**\n * tick\n */\n\n\n tick() {\n const tmp = this.current;\n this.current = this.previous;\n this.previous = tmp;\n this.current.length = 0;\n }\n /**\n * getDiff\n */\n\n\n getDiff(additions, removals) {\n const a = this.current;\n const b = this.previous;\n const al = a.length;\n const bl = b.length;\n let j = 0;\n\n for (let i = 0; i < al; i++) {\n let found = false;\n const keyA = a[i];\n\n while (keyA > b[j]) {\n j++;\n }\n\n found = keyA === b[j];\n\n if (!found) {\n unpackAndPush(additions, keyA);\n }\n }\n\n j = 0;\n\n for (let i = 0; i < bl; i++) {\n let found = false;\n const keyB = b[i];\n\n while (keyB > a[j]) {\n j++;\n }\n\n found = a[j] === keyB;\n\n if (!found) {\n unpackAndPush(removals, keyB);\n }\n }\n }\n\n}\n\nfunction unpackAndPush(array, key) {\n array.push((key & 0xffff0000) >> 16, key & 0x0000ffff);\n}\n\n/**\n * TupleDictionary\n */\nclass TupleDictionary {\n constructor() {\n this.data = {\n keys: []\n };\n }\n\n /** get */\n get(i, j) {\n if (i > j) {\n // swap\n const temp = j;\n j = i;\n i = temp;\n }\n\n return this.data[i + \"-\" + j];\n }\n /** set */\n\n\n set(i, j, value) {\n if (i > j) {\n const temp = j;\n j = i;\n i = temp;\n }\n\n const key = i + \"-\" + j; // Check if key already exists\n\n if (!this.get(i, j)) {\n this.data.keys.push(key);\n }\n\n this.data[key] = value;\n }\n /** reset */\n\n\n reset() {\n const data = this.data;\n const keys = data.keys;\n\n while (keys.length > 0) {\n const key = keys.pop();\n delete data[key];\n }\n }\n\n}\n\n/**\n * The physics world\n */\nclass World extends EventTarget {\n /**\n * Currently / last used timestep. Is set to -1 if not available. This value is updated before each internal step, which means that it is \"fresh\" inside event callbacks.\n */\n\n /**\n * Makes bodies go to sleep when they've been inactive.\n * @default false\n */\n\n /**\n * All the current contacts (instances of ContactEquation) in the world.\n */\n\n /**\n * How often to normalize quaternions. Set to 0 for every step, 1 for every second etc.. A larger value increases performance. If bodies tend to explode, set to a smaller value (zero to be sure nothing can go wrong).\n * @default 0\n */\n\n /**\n * Set to true to use fast quaternion normalization. It is often enough accurate to use.\n * If bodies tend to explode, set to false.\n * @default false\n */\n\n /**\n * The wall-clock time since simulation start.\n */\n\n /**\n * Number of timesteps taken since start.\n */\n\n /**\n * Default and last timestep sizes.\n */\n\n /**\n * The gravity of the world.\n */\n\n /**\n * The broadphase algorithm to use.\n * @default NaiveBroadphase\n */\n\n /**\n * All bodies in this world\n */\n\n /**\n * True if any bodies are not sleeping, false if every body is sleeping.\n */\n\n /**\n * The solver algorithm to use.\n * @default GSSolver\n */\n\n /**\n * collisionMatrix\n */\n\n /**\n * CollisionMatrix from the previous step.\n */\n\n /**\n * All added materials.\n * @deprecated\n * @todo Remove\n */\n\n /**\n * All added contactmaterials.\n */\n\n /**\n * Used to look up a ContactMaterial given two instances of Material.\n */\n\n /**\n * The default material of the bodies.\n */\n\n /**\n * This contact material is used if no suitable contactmaterial is found for a contact.\n */\n\n /**\n * Time accumulator for interpolation.\n * @see https://gafferongames.com/game-physics/fix-your-timestep/\n */\n\n /**\n * Dispatched after a body has been added to the world.\n */\n\n /**\n * Dispatched after a body has been removed from the world.\n */\n constructor(options = {}) {\n super();\n this.dt = void 0;\n this.allowSleep = void 0;\n this.contacts = void 0;\n this.frictionEquations = void 0;\n this.quatNormalizeSkip = void 0;\n this.quatNormalizeFast = void 0;\n this.time = void 0;\n this.stepnumber = void 0;\n this.default_dt = void 0;\n this.nextId = void 0;\n this.gravity = void 0;\n this.broadphase = void 0;\n this.bodies = void 0;\n this.hasActiveBodies = void 0;\n this.solver = void 0;\n this.constraints = void 0;\n this.narrowphase = void 0;\n this.collisionMatrix = void 0;\n this.collisionMatrixPrevious = void 0;\n this.bodyOverlapKeeper = void 0;\n this.shapeOverlapKeeper = void 0;\n this.materials = void 0;\n this.contactmaterials = void 0;\n this.contactMaterialTable = void 0;\n this.defaultMaterial = void 0;\n this.defaultContactMaterial = void 0;\n this.doProfiling = void 0;\n this.profile = void 0;\n this.accumulator = void 0;\n this.subsystems = void 0;\n this.addBodyEvent = void 0;\n this.removeBodyEvent = void 0;\n this.idToBodyMap = void 0;\n this.dt = -1;\n this.allowSleep = !!options.allowSleep;\n this.contacts = [];\n this.frictionEquations = [];\n this.quatNormalizeSkip = options.quatNormalizeSkip !== undefined ? options.quatNormalizeSkip : 0;\n this.quatNormalizeFast = options.quatNormalizeFast !== undefined ? options.quatNormalizeFast : false;\n this.time = 0.0;\n this.stepnumber = 0;\n this.default_dt = 1 / 60;\n this.nextId = 0;\n this.gravity = new Vec3();\n\n if (options.gravity) {\n this.gravity.copy(options.gravity);\n }\n\n this.broadphase = options.broadphase !== undefined ? options.broadphase : new NaiveBroadphase();\n this.bodies = [];\n this.hasActiveBodies = false;\n this.solver = options.solver !== undefined ? options.solver : new GSSolver();\n this.constraints = [];\n this.narrowphase = new Narrowphase(this);\n this.collisionMatrix = new ArrayCollisionMatrix();\n this.collisionMatrixPrevious = new ArrayCollisionMatrix();\n this.bodyOverlapKeeper = new OverlapKeeper();\n this.shapeOverlapKeeper = new OverlapKeeper();\n this.materials = [];\n this.contactmaterials = [];\n this.contactMaterialTable = new TupleDictionary();\n this.defaultMaterial = new Material('default');\n this.defaultContactMaterial = new ContactMaterial(this.defaultMaterial, this.defaultMaterial, {\n friction: 0.3,\n restitution: 0.0\n });\n this.doProfiling = false;\n this.profile = {\n solve: 0,\n makeContactConstraints: 0,\n broadphase: 0,\n integrate: 0,\n narrowphase: 0\n };\n this.accumulator = 0;\n this.subsystems = [];\n this.addBodyEvent = {\n type: 'addBody',\n body: null\n };\n this.removeBodyEvent = {\n type: 'removeBody',\n body: null\n };\n this.idToBodyMap = {};\n this.broadphase.setWorld(this);\n }\n /**\n * Get the contact material between materials m1 and m2\n * @return The contact material if it was found.\n */\n\n\n getContactMaterial(m1, m2) {\n return this.contactMaterialTable.get(m1.id, m2.id);\n }\n /**\n * Get number of objects in the world.\n * @deprecated\n */\n\n\n numObjects() {\n return this.bodies.length;\n }\n /**\n * Store old collision state info\n */\n\n\n collisionMatrixTick() {\n const temp = this.collisionMatrixPrevious;\n this.collisionMatrixPrevious = this.collisionMatrix;\n this.collisionMatrix = temp;\n this.collisionMatrix.reset();\n this.bodyOverlapKeeper.tick();\n this.shapeOverlapKeeper.tick();\n }\n /**\n * Add a constraint to the simulation.\n */\n\n\n addConstraint(c) {\n this.constraints.push(c);\n }\n /**\n * Removes a constraint\n */\n\n\n removeConstraint(c) {\n const idx = this.constraints.indexOf(c);\n\n if (idx !== -1) {\n this.constraints.splice(idx, 1);\n }\n }\n /**\n * Raycast test\n * @deprecated Use .raycastAll, .raycastClosest or .raycastAny instead.\n */\n\n\n rayTest(from, to, result) {\n if (result instanceof RaycastResult) {\n // Do raycastClosest\n this.raycastClosest(from, to, {\n skipBackfaces: true\n }, result);\n } else {\n // Do raycastAll\n this.raycastAll(from, to, {\n skipBackfaces: true\n }, result);\n }\n }\n /**\n * Ray cast against all bodies. The provided callback will be executed for each hit with a RaycastResult as single argument.\n * @return True if any body was hit.\n */\n\n\n raycastAll(from, to, options = {}, callback) {\n options.mode = Ray.ALL;\n options.from = from;\n options.to = to;\n options.callback = callback;\n return tmpRay.intersectWorld(this, options);\n }\n /**\n * Ray cast, and stop at the first result. Note that the order is random - but the method is fast.\n * @return True if any body was hit.\n */\n\n\n raycastAny(from, to, options = {}, result) {\n options.mode = Ray.ANY;\n options.from = from;\n options.to = to;\n options.result = result;\n return tmpRay.intersectWorld(this, options);\n }\n /**\n * Ray cast, and return information of the closest hit.\n * @return True if any body was hit.\n */\n\n\n raycastClosest(from, to, options = {}, result) {\n options.mode = Ray.CLOSEST;\n options.from = from;\n options.to = to;\n options.result = result;\n return tmpRay.intersectWorld(this, options);\n }\n /**\n * Add a rigid body to the simulation.\n * @todo If the simulation has not yet started, why recrete and copy arrays for each body? Accumulate in dynamic arrays in this case.\n * @todo Adding an array of bodies should be possible. This would save some loops too\n */\n\n\n addBody(body) {\n if (this.bodies.includes(body)) {\n return;\n }\n\n body.index = this.bodies.length;\n this.bodies.push(body);\n body.world = this;\n body.initPosition.copy(body.position);\n body.initVelocity.copy(body.velocity);\n body.timeLastSleepy = this.time;\n\n if (body instanceof Body) {\n body.initAngularVelocity.copy(body.angularVelocity);\n body.initQuaternion.copy(body.quaternion);\n }\n\n this.collisionMatrix.setNumObjects(this.bodies.length);\n this.addBodyEvent.body = body;\n this.idToBodyMap[body.id] = body;\n this.dispatchEvent(this.addBodyEvent);\n }\n /**\n * Remove a rigid body from the simulation.\n */\n\n\n removeBody(body) {\n body.world = null;\n const n = this.bodies.length - 1;\n const bodies = this.bodies;\n const idx = bodies.indexOf(body);\n\n if (idx !== -1) {\n bodies.splice(idx, 1); // Todo: should use a garbage free method\n // Recompute index\n\n for (let i = 0; i !== bodies.length; i++) {\n bodies[i].index = i;\n }\n\n this.collisionMatrix.setNumObjects(n);\n this.removeBodyEvent.body = body;\n delete this.idToBodyMap[body.id];\n this.dispatchEvent(this.removeBodyEvent);\n }\n }\n\n getBodyById(id) {\n return this.idToBodyMap[id];\n }\n /**\n * @todo Make a faster map\n */\n\n\n getShapeById(id) {\n const bodies = this.bodies;\n\n for (let i = 0; i < bodies.length; i++) {\n const shapes = bodies[i].shapes;\n\n for (let j = 0; j < shapes.length; j++) {\n const shape = shapes[j];\n\n if (shape.id === id) {\n return shape;\n }\n }\n }\n\n return null;\n }\n /**\n * Adds a material to the World.\n * @deprecated\n * @todo Remove\n */\n\n\n addMaterial(m) {\n this.materials.push(m);\n }\n /**\n * Adds a contact material to the World\n */\n\n\n addContactMaterial(cmat) {\n // Add contact material\n this.contactmaterials.push(cmat); // Add current contact material to the material table\n\n this.contactMaterialTable.set(cmat.materials[0].id, cmat.materials[1].id, cmat);\n }\n /**\n * Step the physics world forward in time.\n *\n * There are two modes. The simple mode is fixed timestepping without interpolation. In this case you only use the first argument. The second case uses interpolation. In that you also provide the time since the function was last used, as well as the maximum fixed timesteps to take.\n *\n * @param dt The fixed time step size to use.\n * @param timeSinceLastCalled The time elapsed since the function was last called.\n * @param maxSubSteps Maximum number of fixed steps to take per function call.\n * @see https://web.archive.org/web/20180426154531/http://bulletphysics.org/mediawiki-1.5.8/index.php/Stepping_The_World#What_do_the_parameters_to_btDynamicsWorld::stepSimulation_mean.3F\n * @example\n * // fixed timestepping without interpolation\n * world.step(1 / 60)\n */\n\n\n step(dt, timeSinceLastCalled, maxSubSteps = 10) {\n if (timeSinceLastCalled === undefined) {\n // Fixed, simple stepping\n this.internalStep(dt); // Increment time\n\n this.time += dt;\n } else {\n this.accumulator += timeSinceLastCalled;\n const t0 = performance.now();\n let substeps = 0;\n\n while (this.accumulator >= dt && substeps < maxSubSteps) {\n // Do fixed steps to catch up\n this.internalStep(dt);\n this.accumulator -= dt;\n substeps++;\n\n if (performance.now() - t0 > dt * 1000) {\n // The framerate is not interactive anymore.\n // We are below the target framerate.\n // Better bail out.\n break;\n }\n } // Remove the excess accumulator, since we may not\n // have had enough substeps available to catch up\n\n\n this.accumulator = this.accumulator % dt;\n const t = this.accumulator / dt;\n\n for (let j = 0; j !== this.bodies.length; j++) {\n const b = this.bodies[j];\n b.previousPosition.lerp(b.position, t, b.interpolatedPosition);\n b.previousQuaternion.slerp(b.quaternion, t, b.interpolatedQuaternion);\n b.previousQuaternion.normalize();\n }\n\n this.time += timeSinceLastCalled;\n }\n }\n\n internalStep(dt) {\n this.dt = dt;\n const contacts = this.contacts;\n const p1 = World_step_p1;\n const p2 = World_step_p2;\n const N = this.numObjects();\n const bodies = this.bodies;\n const solver = this.solver;\n const gravity = this.gravity;\n const doProfiling = this.doProfiling;\n const profile = this.profile;\n const DYNAMIC = Body.DYNAMIC;\n let profilingStart = -Infinity;\n const constraints = this.constraints;\n const frictionEquationPool = World_step_frictionEquationPool;\n gravity.length();\n const gx = gravity.x;\n const gy = gravity.y;\n const gz = gravity.z;\n let i = 0;\n\n if (doProfiling) {\n profilingStart = performance.now();\n } // Add gravity to all objects\n\n\n for (i = 0; i !== N; i++) {\n const bi = bodies[i];\n\n if (bi.type === DYNAMIC) {\n // Only for dynamic bodies\n const f = bi.force;\n const m = bi.mass;\n f.x += m * gx;\n f.y += m * gy;\n f.z += m * gz;\n }\n } // Update subsystems\n\n\n for (let i = 0, Nsubsystems = this.subsystems.length; i !== Nsubsystems; i++) {\n this.subsystems[i].update();\n } // Collision detection\n\n\n if (doProfiling) {\n profilingStart = performance.now();\n }\n\n p1.length = 0; // Clean up pair arrays from last step\n\n p2.length = 0;\n this.broadphase.collisionPairs(this, p1, p2);\n\n if (doProfiling) {\n profile.broadphase = performance.now() - profilingStart;\n } // Remove constrained pairs with collideConnected == false\n\n\n let Nconstraints = constraints.length;\n\n for (i = 0; i !== Nconstraints; i++) {\n const c = constraints[i];\n\n if (!c.collideConnected) {\n for (let j = p1.length - 1; j >= 0; j -= 1) {\n if (c.bodyA === p1[j] && c.bodyB === p2[j] || c.bodyB === p1[j] && c.bodyA === p2[j]) {\n p1.splice(j, 1);\n p2.splice(j, 1);\n }\n }\n }\n }\n\n this.collisionMatrixTick(); // Generate contacts\n\n if (doProfiling) {\n profilingStart = performance.now();\n }\n\n const oldcontacts = World_step_oldContacts;\n const NoldContacts = contacts.length;\n\n for (i = 0; i !== NoldContacts; i++) {\n oldcontacts.push(contacts[i]);\n }\n\n contacts.length = 0; // Transfer FrictionEquation from current list to the pool for reuse\n\n const NoldFrictionEquations = this.frictionEquations.length;\n\n for (i = 0; i !== NoldFrictionEquations; i++) {\n frictionEquationPool.push(this.frictionEquations[i]);\n }\n\n this.frictionEquations.length = 0;\n this.narrowphase.getContacts(p1, p2, this, contacts, oldcontacts, // To be reused\n this.frictionEquations, frictionEquationPool);\n\n if (doProfiling) {\n profile.narrowphase = performance.now() - profilingStart;\n } // Loop over all collisions\n\n\n if (doProfiling) {\n profilingStart = performance.now();\n } // Add all friction eqs\n\n\n for (i = 0; i < this.frictionEquations.length; i++) {\n solver.addEquation(this.frictionEquations[i]);\n }\n\n const ncontacts = contacts.length;\n\n for (let k = 0; k !== ncontacts; k++) {\n // Current contact\n const c = contacts[k]; // Get current collision indeces\n\n const bi = c.bi;\n const bj = c.bj;\n const si = c.si;\n const sj = c.sj; // Get collision properties\n\n let cm;\n\n if (bi.material && bj.material) {\n cm = this.getContactMaterial(bi.material, bj.material) || this.defaultContactMaterial;\n } else {\n cm = this.defaultContactMaterial;\n } // c.enabled = bi.collisionResponse && bj.collisionResponse && si.collisionResponse && sj.collisionResponse;\n\n\n cm.friction; // c.restitution = cm.restitution;\n // If friction or restitution were specified in the material, use them\n\n if (bi.material && bj.material) {\n if (bi.material.friction >= 0 && bj.material.friction >= 0) {\n bi.material.friction * bj.material.friction;\n }\n\n if (bi.material.restitution >= 0 && bj.material.restitution >= 0) {\n c.restitution = bi.material.restitution * bj.material.restitution;\n }\n } // c.setSpookParams(\n // cm.contactEquationStiffness,\n // cm.contactEquationRelaxation,\n // dt\n // );\n\n\n solver.addEquation(c); // // Add friction constraint equation\n // if(mu > 0){\n // \t// Create 2 tangent equations\n // \tconst mug = mu * gnorm;\n // \tconst reducedMass = (bi.invMass + bj.invMass);\n // \tif(reducedMass > 0){\n // \t\treducedMass = 1/reducedMass;\n // \t}\n // \tconst pool = frictionEquationPool;\n // \tconst c1 = pool.length ? pool.pop() : new FrictionEquation(bi,bj,mug*reducedMass);\n // \tconst c2 = pool.length ? pool.pop() : new FrictionEquation(bi,bj,mug*reducedMass);\n // \tthis.frictionEquations.push(c1, c2);\n // \tc1.bi = c2.bi = bi;\n // \tc1.bj = c2.bj = bj;\n // \tc1.minForce = c2.minForce = -mug*reducedMass;\n // \tc1.maxForce = c2.maxForce = mug*reducedMass;\n // \t// Copy over the relative vectors\n // \tc1.ri.copy(c.ri);\n // \tc1.rj.copy(c.rj);\n // \tc2.ri.copy(c.ri);\n // \tc2.rj.copy(c.rj);\n // \t// Construct tangents\n // \tc.ni.tangents(c1.t, c2.t);\n // // Set spook params\n // c1.setSpookParams(cm.frictionEquationStiffness, cm.frictionEquationRelaxation, dt);\n // c2.setSpookParams(cm.frictionEquationStiffness, cm.frictionEquationRelaxation, dt);\n // c1.enabled = c2.enabled = c.enabled;\n // \t// Add equations to solver\n // \tsolver.addEquation(c1);\n // \tsolver.addEquation(c2);\n // }\n\n if (bi.allowSleep && bi.type === Body.DYNAMIC && bi.sleepState === Body.SLEEPING && bj.sleepState === Body.AWAKE && bj.type !== Body.STATIC) {\n const speedSquaredB = bj.velocity.lengthSquared() + bj.angularVelocity.lengthSquared();\n const speedLimitSquaredB = bj.sleepSpeedLimit ** 2;\n\n if (speedSquaredB >= speedLimitSquaredB * 2) {\n bi.wakeUpAfterNarrowphase = true;\n }\n }\n\n if (bj.allowSleep && bj.type === Body.DYNAMIC && bj.sleepState === Body.SLEEPING && bi.sleepState === Body.AWAKE && bi.type !== Body.STATIC) {\n const speedSquaredA = bi.velocity.lengthSquared() + bi.angularVelocity.lengthSquared();\n const speedLimitSquaredA = bi.sleepSpeedLimit ** 2;\n\n if (speedSquaredA >= speedLimitSquaredA * 2) {\n bj.wakeUpAfterNarrowphase = true;\n }\n } // Now we know that i and j are in contact. Set collision matrix state\n\n\n this.collisionMatrix.set(bi, bj, true);\n\n if (!this.collisionMatrixPrevious.get(bi, bj)) {\n // First contact!\n // We reuse the collideEvent object, otherwise we will end up creating new objects for each new contact, even if there's no event listener attached.\n World_step_collideEvent.body = bj;\n World_step_collideEvent.contact = c;\n bi.dispatchEvent(World_step_collideEvent);\n World_step_collideEvent.body = bi;\n bj.dispatchEvent(World_step_collideEvent);\n }\n\n this.bodyOverlapKeeper.set(bi.id, bj.id);\n this.shapeOverlapKeeper.set(si.id, sj.id);\n }\n\n this.emitContactEvents();\n\n if (doProfiling) {\n profile.makeContactConstraints = performance.now() - profilingStart;\n profilingStart = performance.now();\n } // Wake up bodies\n\n\n for (i = 0; i !== N; i++) {\n const bi = bodies[i];\n\n if (bi.wakeUpAfterNarrowphase) {\n bi.wakeUp();\n bi.wakeUpAfterNarrowphase = false;\n }\n } // Add user-added constraints\n\n\n Nconstraints = constraints.length;\n\n for (i = 0; i !== Nconstraints; i++) {\n const c = constraints[i];\n c.update();\n\n for (let j = 0, Neq = c.equations.length; j !== Neq; j++) {\n const eq = c.equations[j];\n solver.addEquation(eq);\n }\n } // Solve the constrained system\n\n\n solver.solve(dt, this);\n\n if (doProfiling) {\n profile.solve = performance.now() - profilingStart;\n } // Remove all contacts from solver\n\n\n solver.removeAllEquations(); // Apply damping, see http://code.google.com/p/bullet/issues/detail?id=74 for details\n\n const pow = Math.pow;\n\n for (i = 0; i !== N; i++) {\n const bi = bodies[i];\n\n if (bi.type & DYNAMIC) {\n // Only for dynamic bodies\n const ld = pow(1.0 - bi.linearDamping, dt);\n const v = bi.velocity;\n v.scale(ld, v);\n const av = bi.angularVelocity;\n\n if (av) {\n const ad = pow(1.0 - bi.angularDamping, dt);\n av.scale(ad, av);\n }\n }\n }\n\n this.dispatchEvent(World_step_preStepEvent); // Invoke pre-step callbacks\n\n for (i = 0; i !== N; i++) {\n const bi = bodies[i];\n\n if (bi.preStep) {\n bi.preStep.call(bi);\n }\n } // Leap frog\n // vnew = v + h*f/m\n // xnew = x + h*vnew\n\n\n if (doProfiling) {\n profilingStart = performance.now();\n }\n\n const stepnumber = this.stepnumber;\n const quatNormalize = stepnumber % (this.quatNormalizeSkip + 1) === 0;\n const quatNormalizeFast = this.quatNormalizeFast;\n\n for (i = 0; i !== N; i++) {\n bodies[i].integrate(dt, quatNormalize, quatNormalizeFast);\n }\n\n this.clearForces();\n this.broadphase.dirty = true;\n\n if (doProfiling) {\n profile.integrate = performance.now() - profilingStart;\n } // Update step number\n\n\n this.stepnumber += 1;\n this.dispatchEvent(World_step_postStepEvent); // Invoke post-step callbacks\n\n for (i = 0; i !== N; i++) {\n const bi = bodies[i];\n const postStep = bi.postStep;\n\n if (postStep) {\n postStep.call(bi);\n }\n } // Sleeping update\n\n\n let hasActiveBodies = true;\n\n if (this.allowSleep) {\n hasActiveBodies = false;\n\n for (i = 0; i !== N; i++) {\n const bi = bodies[i];\n bi.sleepTick(this.time);\n\n if (bi.sleepState !== Body.SLEEPING) {\n hasActiveBodies = true;\n }\n }\n }\n\n this.hasActiveBodies = hasActiveBodies;\n }\n\n emitContactEvents() {\n const hasBeginContact = this.hasAnyEventListener('beginContact');\n const hasEndContact = this.hasAnyEventListener('endContact');\n\n if (hasBeginContact || hasEndContact) {\n this.bodyOverlapKeeper.getDiff(additions, removals);\n }\n\n if (hasBeginContact) {\n for (let i = 0, l = additions.length; i < l; i += 2) {\n beginContactEvent.bodyA = this.getBodyById(additions[i]);\n beginContactEvent.bodyB = this.getBodyById(additions[i + 1]);\n this.dispatchEvent(beginContactEvent);\n }\n\n beginContactEvent.bodyA = beginContactEvent.bodyB = null;\n }\n\n if (hasEndContact) {\n for (let i = 0, l = removals.length; i < l; i += 2) {\n endContactEvent.bodyA = this.getBodyById(removals[i]);\n endContactEvent.bodyB = this.getBodyById(removals[i + 1]);\n this.dispatchEvent(endContactEvent);\n }\n\n endContactEvent.bodyA = endContactEvent.bodyB = null;\n }\n\n additions.length = removals.length = 0;\n const hasBeginShapeContact = this.hasAnyEventListener('beginShapeContact');\n const hasEndShapeContact = this.hasAnyEventListener('endShapeContact');\n\n if (hasBeginShapeContact || hasEndShapeContact) {\n this.shapeOverlapKeeper.getDiff(additions, removals);\n }\n\n if (hasBeginShapeContact) {\n for (let i = 0, l = additions.length; i < l; i += 2) {\n const shapeA = this.getShapeById(additions[i]);\n const shapeB = this.getShapeById(additions[i + 1]);\n beginShapeContactEvent.shapeA = shapeA;\n beginShapeContactEvent.shapeB = shapeB;\n if (shapeA) beginShapeContactEvent.bodyA = shapeA.body;\n if (shapeB) beginShapeContactEvent.bodyB = shapeB.body;\n this.dispatchEvent(beginShapeContactEvent);\n }\n\n beginShapeContactEvent.bodyA = beginShapeContactEvent.bodyB = beginShapeContactEvent.shapeA = beginShapeContactEvent.shapeB = null;\n }\n\n if (hasEndShapeContact) {\n for (let i = 0, l = removals.length; i < l; i += 2) {\n const shapeA = this.getShapeById(removals[i]);\n const shapeB = this.getShapeById(removals[i + 1]);\n endShapeContactEvent.shapeA = shapeA;\n endShapeContactEvent.shapeB = shapeB;\n if (shapeA) endShapeContactEvent.bodyA = shapeA.body;\n if (shapeB) endShapeContactEvent.bodyB = shapeB.body;\n this.dispatchEvent(endShapeContactEvent);\n }\n\n endShapeContactEvent.bodyA = endShapeContactEvent.bodyB = endShapeContactEvent.shapeA = endShapeContactEvent.shapeB = null;\n }\n }\n /**\n * Sets all body forces in the world to zero.\n */\n\n\n clearForces() {\n const bodies = this.bodies;\n const N = bodies.length;\n\n for (let i = 0; i !== N; i++) {\n const b = bodies[i];\n b.force;\n b.torque;\n b.force.set(0, 0, 0);\n b.torque.set(0, 0, 0);\n }\n }\n\n} // Temp stuff\n\nnew AABB();\nconst tmpRay = new Ray(); // performance.now() fallback on Date.now()\n\nconst performance = globalThis.performance || {};\n\nif (!performance.now) {\n let nowOffset = Date.now();\n\n if (performance.timing && performance.timing.navigationStart) {\n nowOffset = performance.timing.navigationStart;\n }\n\n performance.now = () => Date.now() - nowOffset;\n}\n// Reusable event objects to save memory.\n\nconst World_step_postStepEvent = {\n type: 'postStep'\n}; // Dispatched before the world steps forward in time.\n\nconst World_step_preStepEvent = {\n type: 'preStep'\n};\nconst World_step_collideEvent = {\n type: Body.COLLIDE_EVENT_NAME,\n body: null,\n contact: null\n}; // Pools for unused objects\n\nconst World_step_oldContacts = [];\nconst World_step_frictionEquationPool = []; // Reusable arrays for collision pairs\n\nconst World_step_p1 = [];\nconst World_step_p2 = []; // Stuff for emitContactEvents\n\nconst additions = [];\nconst removals = [];\nconst beginContactEvent = {\n type: 'beginContact',\n bodyA: null,\n bodyB: null\n};\nconst endContactEvent = {\n type: 'endContact',\n bodyA: null,\n bodyB: null\n};\nconst beginShapeContactEvent = {\n type: 'beginShapeContact',\n bodyA: null,\n bodyB: null,\n shapeA: null,\n shapeB: null\n};\nconst endShapeContactEvent = {\n type: 'endShapeContact',\n bodyA: null,\n bodyB: null,\n shapeA: null,\n shapeB: null\n};\n\n\n\n\n//# sourceURL=webpack://3d_game/./node_modules/cannon-es/dist/cannon-es.js?"); - -/***/ }), - -/***/ "./src/index.js": -/*!**********************!*\ - !*** ./src/index.js ***! - \**********************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var three_examples_jsm_controls_PointerLockControls_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three/examples/jsm/controls/PointerLockControls.js */ \"./node_modules/three/examples/jsm/controls/PointerLockControls.js\");\n/* harmony import */ var cannon_es__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! cannon-es */ \"./node_modules/cannon-es/dist/cannon-es.js\");\n/* harmony import */ var three_examples_jsm_libs_stats_module_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three/examples/jsm/libs/stats.module.js */ \"./node_modules/three/examples/jsm/libs/stats.module.js\");\n\n\n\n\nvar isGameRunning = false; // Track if the game is running\nvar paused = false; // Track if the game is paused\n\ndocument.addEventListener('DOMContentLoaded', function () {\n var mainButton = document.getElementById('mainButton');\n if (mainButton) {\n mainButton.onclick = function () {\n if (isGameRunning) {\n resumeGame(); // Resume the game if already started and paused\n } else {\n startGame(); // Start the game for the first time\n }\n };\n } else {\n console.error(\"Main button not found!\");\n }\n});\nfunction startGame() {\n controls.lock(); // Lock the pointer for the first time\n isGameRunning = true;\n paused = false;\n document.getElementById('mainButton').innerText = 'Resume Game'; // Change button to 'Resume Game' after start\n document.getElementById('menu').style.display = 'none'; // Hide the menu\n animate(); // Start the game animation loop\n}\nfunction resumeGame() {\n controls.lock(); // Lock the pointer again to resume\n paused = false;\n document.getElementById('menu').style.display = 'none'; // Hide the menu\n animate(); // Resume the animation loop\n}\nfunction pauseGame() {\n paused = true;\n document.getElementById('menu').style.display = 'block'; // Show the menu when paused\n}\nvar scene = new three__WEBPACK_IMPORTED_MODULE_0__.Scene();\nvar renderer = new three__WEBPACK_IMPORTED_MODULE_0__.WebGLRenderer({\n antialias: true\n});\nrenderer.setSize(window.innerWidth, window.innerHeight);\nrenderer.shadowMap.enabled = true;\nrenderer.shadowMap.type = three__WEBPACK_IMPORTED_MODULE_0__.PCFSoftShadowMap;\ndocument.body.appendChild(renderer.domElement);\n\n// FPS Counter (Stats.js)\nvar stats = new three_examples_jsm_libs_stats_module_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\ndocument.body.appendChild(stats.dom);\nvar camera = new three__WEBPACK_IMPORTED_MODULE_0__.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);\ncamera.position.set(0, 1.8, 5);\nvar controls = new three_examples_jsm_controls_PointerLockControls_js__WEBPACK_IMPORTED_MODULE_2__.PointerLockControls(camera, document.body);\ndocument.body.addEventListener('click', function () {\n if (!isGameRunning) return; // Prevent locking controls before the game starts\n controls.lock();\n});\ncontrols.addEventListener('lock', function () {\n if (!paused) document.getElementById('menu').style.display = 'none'; // Hide the menu when the pointer is locked\n});\ncontrols.addEventListener('unlock', function () {\n if (isGameRunning) pauseGame(); // Show the menu when the pointer is unlocked and the game is running\n});\nwindow.addEventListener('resize', function () {\n renderer.setSize(window.innerWidth, window.innerHeight);\n camera.aspect = window.innerWidth / window.innerHeight;\n camera.updateProjectionMatrix();\n});\n\n// Load Babylon.js online skybox textures using CubeTextureLoader\nvar skyboxLoader = new three__WEBPACK_IMPORTED_MODULE_0__.CubeTextureLoader();\nvar skyboxTexture = skyboxLoader.load(['https://playground.babylonjs.com/textures/skybox_px.jpg', 'https://playground.babylonjs.com/textures/skybox_nx.jpg', 'https://playground.babylonjs.com/textures/skybox_py.jpg', 'https://playground.babylonjs.com/textures/skybox_ny.jpg', 'https://playground.babylonjs.com/textures/skybox_pz.jpg', 'https://playground.babylonjs.com/textures/skybox_nz.jpg']);\nscene.background = skyboxTexture;\n\n// Physics world\nvar world = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.World();\nworld.gravity.set(0, -9.82, 0);\nworld.broadphase = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.NaiveBroadphase();\nworld.solver.iterations = 10;\nvar fixedTimeStep = 1 / 120;\nvar maxSubSteps = 3;\n\n// Ground Physics\nvar groundBody = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({\n type: cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body.STATIC,\n shape: new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Plane()\n});\ngroundBody.quaternion.setFromEuler(-Math.PI / 2, 0, 0);\nworld.addBody(groundBody);\n\n// Ground Mesh\nvar textureLoader = new three__WEBPACK_IMPORTED_MODULE_0__.TextureLoader();\nvar groundTexture = textureLoader.load('https://threejsfundamentals.org/threejs/resources/images/checker.png');\ngroundTexture.wrapS = groundTexture.wrapT = three__WEBPACK_IMPORTED_MODULE_0__.RepeatWrapping;\ngroundTexture.repeat.set(10, 10);\nvar groundMaterial = new three__WEBPACK_IMPORTED_MODULE_0__.MeshStandardMaterial({\n map: groundTexture,\n metalness: 0.3,\n roughness: 0.7\n});\nvar ground = new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(new three__WEBPACK_IMPORTED_MODULE_0__.PlaneGeometry(50, 50), groundMaterial);\nground.rotation.x = -Math.PI / 2;\nground.receiveShadow = true;\nscene.add(ground);\n\n// Wall texture\nvar wallTexture = textureLoader.load('https://dl.polyhaven.org/file/ph-assets/Textures/jpg/2k/brick_wall_006/brick_wall_006_diff_2k.jpg');\nvar wallMaterial = new three__WEBPACK_IMPORTED_MODULE_0__.MeshStandardMaterial({\n map: wallTexture,\n metalness: 0.0,\n roughness: 0.8\n});\n\n// Create walls\nvar wall1 = new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(new three__WEBPACK_IMPORTED_MODULE_0__.BoxGeometry(10, 5, 1), wallMaterial);\nwall1.position.set(0, 2.5, -5);\nwall1.castShadow = true;\nwall1.receiveShadow = true;\nscene.add(wall1);\nvar wall1Body = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({\n mass: 0,\n shape: new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Box(new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Vec3(5, 2.5, 0.5))\n});\nwall1Body.position.set(0, 2.5, -5);\nworld.addBody(wall1Body);\nvar wall2 = new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(new three__WEBPACK_IMPORTED_MODULE_0__.BoxGeometry(10, 5, 1), wallMaterial);\nwall2.position.set(-5, 2.5, 0);\nwall2.rotation.y = Math.PI / 2;\nwall2.castShadow = true;\nwall2.receiveShadow = true;\nscene.add(wall2);\nvar wall2Body = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({\n mass: 0,\n shape: new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Box(new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Vec3(5, 2.5, 0.5))\n});\nwall2Body.position.set(-5, 2.5, 0);\nwall2Body.quaternion.setFromEuler(0, Math.PI / 2, 0);\nworld.addBody(wall2Body);\n\n// Light setup\nvar hemisphereLight = new three__WEBPACK_IMPORTED_MODULE_0__.HemisphereLight(0xddeeff, 0x0f0e0d, 1);\nscene.add(hemisphereLight);\nvar directionalLight = new three__WEBPACK_IMPORTED_MODULE_0__.DirectionalLight(0xffffff, 1.5);\ndirectionalLight.position.set(10, 20, 10);\ndirectionalLight.castShadow = true;\nscene.add(directionalLight);\n\n// Cube object with dynamic physics\nvar cubeMaterial = new three__WEBPACK_IMPORTED_MODULE_0__.MeshStandardMaterial({\n color: 0xff0000\n});\nvar cube = new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(new three__WEBPACK_IMPORTED_MODULE_0__.BoxGeometry(1, 1, 1), cubeMaterial);\ncube.position.set(0, 1, 0);\ncube.castShadow = true;\nscene.add(cube);\nvar cubeBody = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({\n mass: 2,\n shape: new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Box(new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Vec3(0.5, 0.5, 0.5))\n});\ncubeBody.position.set(0, 1, 0);\nworld.addBody(cubeBody);\n\n// Sphere object with dynamic physics\nvar sphere = new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(new three__WEBPACK_IMPORTED_MODULE_0__.SphereGeometry(0.5, 32, 32), new three__WEBPACK_IMPORTED_MODULE_0__.MeshStandardMaterial({\n color: 0x00ff00\n}));\nsphere.position.set(3, 1, 0);\nsphere.castShadow = true;\nscene.add(sphere);\nvar sphereBody = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({\n mass: 2,\n shape: new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Sphere(0.5)\n});\nsphereBody.position.set(3, 1, 0);\nworld.addBody(sphereBody);\n\n// Player Physics\nvar playerBody = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({\n mass: 5,\n shape: new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Sphere(1)\n});\nplayerBody.position.set(0, 1, 10);\nworld.addBody(playerBody);\nvar moveForward = false,\n moveBackward = false,\n moveLeft = false,\n moveRight = false;\nvar canJump = false;\nvar isSprinting = false;\nvar baseMoveSpeed = 100;\nvar sprintMultiplier = 2;\nvar velocity = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nvar heldObject = null;\nvar holder = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nvar pickupDistance = 2.5;\n\n// Event listener for collisions to enable jumping\nplayerBody.addEventListener('collide', function (event) {\n if (event.body === groundBody) {\n canJump = true;\n }\n});\n\n// Input controls\ndocument.addEventListener('keydown', function (event) {\n switch (event.code) {\n case 'KeyW':\n moveForward = true;\n break;\n case 'KeyS':\n moveBackward = true;\n break;\n case 'KeyA':\n moveLeft = true;\n break;\n case 'KeyD':\n moveRight = true;\n break;\n case 'ControlLeft':\n isSprinting = true;\n break;\n case 'Space':\n if (canJump) {\n playerBody.velocity.y = 10;\n canJump = false;\n }\n break;\n case 'KeyE':\n if (heldObject) {\n releaseObject();\n } else {\n pickUpObject();\n }\n break;\n case 'KeyF':\n if (heldObject) {\n throwObject();\n }\n break;\n }\n});\ndocument.addEventListener('keyup', function (event) {\n switch (event.code) {\n case 'KeyW':\n moveForward = false;\n break;\n case 'KeyS':\n moveBackward = false;\n break;\n case 'KeyA':\n moveLeft = false;\n break;\n case 'KeyD':\n moveRight = false;\n break;\n case 'ControlLeft':\n isSprinting = false;\n break;\n }\n});\n\n// Picking up objects and making them kinematic\nfunction pickUpObject() {\n var raycaster = new three__WEBPACK_IMPORTED_MODULE_0__.Raycaster();\n raycaster.setFromCamera(new three__WEBPACK_IMPORTED_MODULE_0__.Vector2(0, 0), camera);\n var intersects = raycaster.intersectObjects([cube, sphere]);\n if (intersects.length > 0) {\n var intersectedObject = intersects[0].object;\n var body;\n if (intersectedObject === cube) {\n body = cubeBody;\n } else if (intersectedObject === sphere) {\n body = sphereBody;\n }\n var distance = playerBody.position.distanceTo(intersectedObject.position);\n if (distance <= pickupDistance) {\n heldObject = body;\n heldObject.angularVelocity.set(0, 0, 0);\n heldObject.angularDamping = 1;\n\n // Disable gravity and set kinematic so the object doesn't affect the player\n heldObject.type = cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body.KINEMATIC;\n heldObject.allowSleep = false;\n heldObject.gravityScale = 0;\n\n // Adjust object position smoothly to prevent passing through walls\n heldObject.collisionResponse = false;\n }\n }\n}\n\n// Release held object and make it dynamic again\nfunction releaseObject() {\n if (heldObject) {\n heldObject.type = cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body.DYNAMIC;\n heldObject.gravityScale = 1;\n heldObject.angularDamping = 0.1;\n heldObject.collisionResponse = true;\n heldObject = null;\n }\n}\n\n// Throw object with velocity\nfunction throwObject() {\n if (heldObject) {\n var throwVelocity = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Vec3();\n var cameraDirection = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n camera.getWorldDirection(cameraDirection);\n throwVelocity.set(cameraDirection.x * 20, cameraDirection.y * 20, cameraDirection.z * 20);\n heldObject.velocity.copy(throwVelocity);\n releaseObject();\n }\n}\n\n// Movement logic and restrictions\nfunction updatePlayerMovement(delta) {\n velocity.set(0, 0, 0);\n var moveSpeed = isSprinting ? baseMoveSpeed * sprintMultiplier : baseMoveSpeed;\n var forward = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n camera.getWorldDirection(forward);\n var right = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n right.crossVectors(forward, camera.up).normalize();\n if (moveForward) velocity.add(forward.multiplyScalar(moveSpeed * delta));\n if (moveBackward) velocity.add(forward.multiplyScalar(-moveSpeed * delta));\n if (moveLeft) velocity.add(right.multiplyScalar(-moveSpeed * delta));\n if (moveRight) velocity.add(right.multiplyScalar(moveSpeed * delta));\n playerBody.velocity.x = velocity.x;\n playerBody.velocity.z = velocity.z;\n camera.position.copy(playerBody.position);\n controls.object.position.copy(playerBody.position);\n\n // Move held object smoothly with the player\n if (heldObject) {\n var cameraDirection = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n camera.getWorldDirection(cameraDirection);\n cameraDirection.normalize();\n holder.copy(camera.position).add(cameraDirection.multiplyScalar(2));\n heldObject.position.set(holder.x, holder.y, holder.z);\n }\n}\n\n// Animation loop\nvar clock = new three__WEBPACK_IMPORTED_MODULE_0__.Clock();\nfunction animate() {\n if (paused) return; // Stop the loop if paused\n\n var delta = clock.getDelta();\n world.step(fixedTimeStep, delta, maxSubSteps);\n updatePlayerMovement(delta);\n wall1.position.copy(wall1Body.position);\n wall1.quaternion.copy(wall1Body.quaternion);\n wall2.position.copy(wall2Body.position);\n wall2.quaternion.copy(wall2Body.quaternion);\n cube.position.copy(cubeBody.position);\n cube.quaternion.copy(cubeBody.quaternion);\n sphere.position.copy(sphereBody.position);\n sphere.quaternion.copy(sphereBody.quaternion);\n stats.update();\n renderer.render(scene, camera);\n requestAnimationFrame(animate);\n}\nanimate();\n\n//# sourceURL=webpack://3d_game/./src/index.js?"); - -/***/ }), - -/***/ "./node_modules/three/build/three.module.js": -/*!**************************************************!*\ - !*** ./node_modules/three/build/three.module.js ***! - \**************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ACESFilmicToneMapping: () => (/* binding */ ACESFilmicToneMapping),\n/* harmony export */ AddEquation: () => (/* binding */ AddEquation),\n/* harmony export */ AddOperation: () => (/* binding */ AddOperation),\n/* harmony export */ AdditiveAnimationBlendMode: () => (/* binding */ AdditiveAnimationBlendMode),\n/* harmony export */ AdditiveBlending: () => (/* binding */ AdditiveBlending),\n/* harmony export */ AgXToneMapping: () => (/* binding */ AgXToneMapping),\n/* harmony export */ AlphaFormat: () => (/* binding */ AlphaFormat),\n/* harmony export */ AlwaysCompare: () => (/* binding */ AlwaysCompare),\n/* harmony export */ AlwaysDepth: () => (/* binding */ AlwaysDepth),\n/* harmony export */ AlwaysStencilFunc: () => (/* binding */ AlwaysStencilFunc),\n/* harmony export */ AmbientLight: () => (/* binding */ AmbientLight),\n/* harmony export */ AnimationAction: () => (/* binding */ AnimationAction),\n/* harmony export */ AnimationClip: () => (/* binding */ AnimationClip),\n/* harmony export */ AnimationLoader: () => (/* binding */ AnimationLoader),\n/* harmony export */ AnimationMixer: () => (/* binding */ AnimationMixer),\n/* harmony export */ AnimationObjectGroup: () => (/* binding */ AnimationObjectGroup),\n/* harmony export */ AnimationUtils: () => (/* binding */ AnimationUtils),\n/* harmony export */ ArcCurve: () => (/* binding */ ArcCurve),\n/* harmony export */ ArrayCamera: () => (/* binding */ ArrayCamera),\n/* harmony export */ ArrowHelper: () => (/* binding */ ArrowHelper),\n/* harmony export */ AttachedBindMode: () => (/* binding */ AttachedBindMode),\n/* harmony export */ Audio: () => (/* binding */ Audio),\n/* harmony export */ AudioAnalyser: () => (/* binding */ AudioAnalyser),\n/* harmony export */ AudioContext: () => (/* binding */ AudioContext),\n/* harmony export */ AudioListener: () => (/* binding */ AudioListener),\n/* harmony export */ AudioLoader: () => (/* binding */ AudioLoader),\n/* harmony export */ AxesHelper: () => (/* binding */ AxesHelper),\n/* harmony export */ BackSide: () => (/* binding */ BackSide),\n/* harmony export */ BasicDepthPacking: () => (/* binding */ BasicDepthPacking),\n/* harmony export */ BasicShadowMap: () => (/* binding */ BasicShadowMap),\n/* harmony export */ BatchedMesh: () => (/* binding */ BatchedMesh),\n/* harmony export */ Bone: () => (/* binding */ Bone),\n/* harmony export */ BooleanKeyframeTrack: () => (/* binding */ BooleanKeyframeTrack),\n/* harmony export */ Box2: () => (/* binding */ Box2),\n/* harmony export */ Box3: () => (/* binding */ Box3),\n/* harmony export */ Box3Helper: () => (/* binding */ Box3Helper),\n/* harmony export */ BoxGeometry: () => (/* binding */ BoxGeometry),\n/* harmony export */ BoxHelper: () => (/* binding */ BoxHelper),\n/* harmony export */ BufferAttribute: () => (/* binding */ BufferAttribute),\n/* harmony export */ BufferGeometry: () => (/* binding */ BufferGeometry),\n/* harmony export */ BufferGeometryLoader: () => (/* binding */ BufferGeometryLoader),\n/* harmony export */ ByteType: () => (/* binding */ ByteType),\n/* harmony export */ Cache: () => (/* binding */ Cache),\n/* harmony export */ Camera: () => (/* binding */ Camera),\n/* harmony export */ CameraHelper: () => (/* binding */ CameraHelper),\n/* harmony export */ CanvasTexture: () => (/* binding */ CanvasTexture),\n/* harmony export */ CapsuleGeometry: () => (/* binding */ CapsuleGeometry),\n/* harmony export */ CatmullRomCurve3: () => (/* binding */ CatmullRomCurve3),\n/* harmony export */ CineonToneMapping: () => (/* binding */ CineonToneMapping),\n/* harmony export */ CircleGeometry: () => (/* binding */ CircleGeometry),\n/* harmony export */ ClampToEdgeWrapping: () => (/* binding */ ClampToEdgeWrapping),\n/* harmony export */ Clock: () => (/* binding */ Clock),\n/* harmony export */ Color: () => (/* binding */ Color),\n/* harmony export */ ColorKeyframeTrack: () => (/* binding */ ColorKeyframeTrack),\n/* harmony export */ ColorManagement: () => (/* binding */ ColorManagement),\n/* harmony export */ CompressedArrayTexture: () => (/* binding */ CompressedArrayTexture),\n/* harmony export */ CompressedCubeTexture: () => (/* binding */ CompressedCubeTexture),\n/* harmony export */ CompressedTexture: () => (/* binding */ CompressedTexture),\n/* harmony export */ CompressedTextureLoader: () => (/* binding */ CompressedTextureLoader),\n/* harmony export */ ConeGeometry: () => (/* binding */ ConeGeometry),\n/* harmony export */ ConstantAlphaFactor: () => (/* binding */ ConstantAlphaFactor),\n/* harmony export */ ConstantColorFactor: () => (/* binding */ ConstantColorFactor),\n/* harmony export */ Controls: () => (/* binding */ Controls),\n/* harmony export */ CubeCamera: () => (/* binding */ CubeCamera),\n/* harmony export */ CubeReflectionMapping: () => (/* binding */ CubeReflectionMapping),\n/* harmony export */ CubeRefractionMapping: () => (/* binding */ CubeRefractionMapping),\n/* harmony export */ CubeTexture: () => (/* binding */ CubeTexture),\n/* harmony export */ CubeTextureLoader: () => (/* binding */ CubeTextureLoader),\n/* harmony export */ CubeUVReflectionMapping: () => (/* binding */ CubeUVReflectionMapping),\n/* harmony export */ CubicBezierCurve: () => (/* binding */ CubicBezierCurve),\n/* harmony export */ CubicBezierCurve3: () => (/* binding */ CubicBezierCurve3),\n/* harmony export */ CubicInterpolant: () => (/* binding */ CubicInterpolant),\n/* harmony export */ CullFaceBack: () => (/* binding */ CullFaceBack),\n/* harmony export */ CullFaceFront: () => (/* binding */ CullFaceFront),\n/* harmony export */ CullFaceFrontBack: () => (/* binding */ CullFaceFrontBack),\n/* harmony export */ CullFaceNone: () => (/* binding */ CullFaceNone),\n/* harmony export */ Curve: () => (/* binding */ Curve),\n/* harmony export */ CurvePath: () => (/* binding */ CurvePath),\n/* harmony export */ CustomBlending: () => (/* binding */ CustomBlending),\n/* harmony export */ CustomToneMapping: () => (/* binding */ CustomToneMapping),\n/* harmony export */ CylinderGeometry: () => (/* binding */ CylinderGeometry),\n/* harmony export */ Cylindrical: () => (/* binding */ Cylindrical),\n/* harmony export */ Data3DTexture: () => (/* binding */ Data3DTexture),\n/* harmony export */ DataArrayTexture: () => (/* binding */ DataArrayTexture),\n/* harmony export */ DataTexture: () => (/* binding */ DataTexture),\n/* harmony export */ DataTextureLoader: () => (/* binding */ DataTextureLoader),\n/* harmony export */ DataUtils: () => (/* binding */ DataUtils),\n/* harmony export */ DecrementStencilOp: () => (/* binding */ DecrementStencilOp),\n/* harmony export */ DecrementWrapStencilOp: () => (/* binding */ DecrementWrapStencilOp),\n/* harmony export */ DefaultLoadingManager: () => (/* binding */ DefaultLoadingManager),\n/* harmony export */ DepthFormat: () => (/* binding */ DepthFormat),\n/* harmony export */ DepthStencilFormat: () => (/* binding */ DepthStencilFormat),\n/* harmony export */ DepthTexture: () => (/* binding */ DepthTexture),\n/* harmony export */ DetachedBindMode: () => (/* binding */ DetachedBindMode),\n/* harmony export */ DirectionalLight: () => (/* binding */ DirectionalLight),\n/* harmony export */ DirectionalLightHelper: () => (/* binding */ DirectionalLightHelper),\n/* harmony export */ DiscreteInterpolant: () => (/* binding */ DiscreteInterpolant),\n/* harmony export */ DisplayP3ColorSpace: () => (/* binding */ DisplayP3ColorSpace),\n/* harmony export */ DodecahedronGeometry: () => (/* binding */ DodecahedronGeometry),\n/* harmony export */ DoubleSide: () => (/* binding */ DoubleSide),\n/* harmony export */ DstAlphaFactor: () => (/* binding */ DstAlphaFactor),\n/* harmony export */ DstColorFactor: () => (/* binding */ DstColorFactor),\n/* harmony export */ DynamicCopyUsage: () => (/* binding */ DynamicCopyUsage),\n/* harmony export */ DynamicDrawUsage: () => (/* binding */ DynamicDrawUsage),\n/* harmony export */ DynamicReadUsage: () => (/* binding */ DynamicReadUsage),\n/* harmony export */ EdgesGeometry: () => (/* binding */ EdgesGeometry),\n/* harmony export */ EllipseCurve: () => (/* binding */ EllipseCurve),\n/* harmony export */ EqualCompare: () => (/* binding */ EqualCompare),\n/* harmony export */ EqualDepth: () => (/* binding */ EqualDepth),\n/* harmony export */ EqualStencilFunc: () => (/* binding */ EqualStencilFunc),\n/* harmony export */ EquirectangularReflectionMapping: () => (/* binding */ EquirectangularReflectionMapping),\n/* harmony export */ EquirectangularRefractionMapping: () => (/* binding */ EquirectangularRefractionMapping),\n/* harmony export */ Euler: () => (/* binding */ Euler),\n/* harmony export */ EventDispatcher: () => (/* binding */ EventDispatcher),\n/* harmony export */ ExtrudeGeometry: () => (/* binding */ ExtrudeGeometry),\n/* harmony export */ FileLoader: () => (/* binding */ FileLoader),\n/* harmony export */ Float16BufferAttribute: () => (/* binding */ Float16BufferAttribute),\n/* harmony export */ Float32BufferAttribute: () => (/* binding */ Float32BufferAttribute),\n/* harmony export */ FloatType: () => (/* binding */ FloatType),\n/* harmony export */ Fog: () => (/* binding */ Fog),\n/* harmony export */ FogExp2: () => (/* binding */ FogExp2),\n/* harmony export */ FramebufferTexture: () => (/* binding */ FramebufferTexture),\n/* harmony export */ FrontSide: () => (/* binding */ FrontSide),\n/* harmony export */ Frustum: () => (/* binding */ Frustum),\n/* harmony export */ GLBufferAttribute: () => (/* binding */ GLBufferAttribute),\n/* harmony export */ GLSL1: () => (/* binding */ GLSL1),\n/* harmony export */ GLSL3: () => (/* binding */ GLSL3),\n/* harmony export */ GreaterCompare: () => (/* binding */ GreaterCompare),\n/* harmony export */ GreaterDepth: () => (/* binding */ GreaterDepth),\n/* harmony export */ GreaterEqualCompare: () => (/* binding */ GreaterEqualCompare),\n/* harmony export */ GreaterEqualDepth: () => (/* binding */ GreaterEqualDepth),\n/* harmony export */ GreaterEqualStencilFunc: () => (/* binding */ GreaterEqualStencilFunc),\n/* harmony export */ GreaterStencilFunc: () => (/* binding */ GreaterStencilFunc),\n/* harmony export */ GridHelper: () => (/* binding */ GridHelper),\n/* harmony export */ Group: () => (/* binding */ Group),\n/* harmony export */ HalfFloatType: () => (/* binding */ HalfFloatType),\n/* harmony export */ HemisphereLight: () => (/* binding */ HemisphereLight),\n/* harmony export */ HemisphereLightHelper: () => (/* binding */ HemisphereLightHelper),\n/* harmony export */ IcosahedronGeometry: () => (/* binding */ IcosahedronGeometry),\n/* harmony export */ ImageBitmapLoader: () => (/* binding */ ImageBitmapLoader),\n/* harmony export */ ImageLoader: () => (/* binding */ ImageLoader),\n/* harmony export */ ImageUtils: () => (/* binding */ ImageUtils),\n/* harmony export */ IncrementStencilOp: () => (/* binding */ IncrementStencilOp),\n/* harmony export */ IncrementWrapStencilOp: () => (/* binding */ IncrementWrapStencilOp),\n/* harmony export */ InstancedBufferAttribute: () => (/* binding */ InstancedBufferAttribute),\n/* harmony export */ InstancedBufferGeometry: () => (/* binding */ InstancedBufferGeometry),\n/* harmony export */ InstancedInterleavedBuffer: () => (/* binding */ InstancedInterleavedBuffer),\n/* harmony export */ InstancedMesh: () => (/* binding */ InstancedMesh),\n/* harmony export */ Int16BufferAttribute: () => (/* binding */ Int16BufferAttribute),\n/* harmony export */ Int32BufferAttribute: () => (/* binding */ Int32BufferAttribute),\n/* harmony export */ Int8BufferAttribute: () => (/* binding */ Int8BufferAttribute),\n/* harmony export */ IntType: () => (/* binding */ IntType),\n/* harmony export */ InterleavedBuffer: () => (/* binding */ InterleavedBuffer),\n/* harmony export */ InterleavedBufferAttribute: () => (/* binding */ InterleavedBufferAttribute),\n/* harmony export */ Interpolant: () => (/* binding */ Interpolant),\n/* harmony export */ InterpolateDiscrete: () => (/* binding */ InterpolateDiscrete),\n/* harmony export */ InterpolateLinear: () => (/* binding */ InterpolateLinear),\n/* harmony export */ InterpolateSmooth: () => (/* binding */ InterpolateSmooth),\n/* harmony export */ InvertStencilOp: () => (/* binding */ InvertStencilOp),\n/* harmony export */ KeepStencilOp: () => (/* binding */ KeepStencilOp),\n/* harmony export */ KeyframeTrack: () => (/* binding */ KeyframeTrack),\n/* harmony export */ LOD: () => (/* binding */ LOD),\n/* harmony export */ LatheGeometry: () => (/* binding */ LatheGeometry),\n/* harmony export */ Layers: () => (/* binding */ Layers),\n/* harmony export */ LessCompare: () => (/* binding */ LessCompare),\n/* harmony export */ LessDepth: () => (/* binding */ LessDepth),\n/* harmony export */ LessEqualCompare: () => (/* binding */ LessEqualCompare),\n/* harmony export */ LessEqualDepth: () => (/* binding */ LessEqualDepth),\n/* harmony export */ LessEqualStencilFunc: () => (/* binding */ LessEqualStencilFunc),\n/* harmony export */ LessStencilFunc: () => (/* binding */ LessStencilFunc),\n/* harmony export */ Light: () => (/* binding */ Light),\n/* harmony export */ LightProbe: () => (/* binding */ LightProbe),\n/* harmony export */ Line: () => (/* binding */ Line),\n/* harmony export */ Line3: () => (/* binding */ Line3),\n/* harmony export */ LineBasicMaterial: () => (/* binding */ LineBasicMaterial),\n/* harmony export */ LineCurve: () => (/* binding */ LineCurve),\n/* harmony export */ LineCurve3: () => (/* binding */ LineCurve3),\n/* harmony export */ LineDashedMaterial: () => (/* binding */ LineDashedMaterial),\n/* harmony export */ LineLoop: () => (/* binding */ LineLoop),\n/* harmony export */ LineSegments: () => (/* binding */ LineSegments),\n/* harmony export */ LinearDisplayP3ColorSpace: () => (/* binding */ LinearDisplayP3ColorSpace),\n/* harmony export */ LinearFilter: () => (/* binding */ LinearFilter),\n/* harmony export */ LinearInterpolant: () => (/* binding */ LinearInterpolant),\n/* harmony export */ LinearMipMapLinearFilter: () => (/* binding */ LinearMipMapLinearFilter),\n/* harmony export */ LinearMipMapNearestFilter: () => (/* binding */ LinearMipMapNearestFilter),\n/* harmony export */ LinearMipmapLinearFilter: () => (/* binding */ LinearMipmapLinearFilter),\n/* harmony export */ LinearMipmapNearestFilter: () => (/* binding */ LinearMipmapNearestFilter),\n/* harmony export */ LinearSRGBColorSpace: () => (/* binding */ LinearSRGBColorSpace),\n/* harmony export */ LinearToneMapping: () => (/* binding */ LinearToneMapping),\n/* harmony export */ LinearTransfer: () => (/* binding */ LinearTransfer),\n/* harmony export */ Loader: () => (/* binding */ Loader),\n/* harmony export */ LoaderUtils: () => (/* binding */ LoaderUtils),\n/* harmony export */ LoadingManager: () => (/* binding */ LoadingManager),\n/* harmony export */ LoopOnce: () => (/* binding */ LoopOnce),\n/* harmony export */ LoopPingPong: () => (/* binding */ LoopPingPong),\n/* harmony export */ LoopRepeat: () => (/* binding */ LoopRepeat),\n/* harmony export */ LuminanceAlphaFormat: () => (/* binding */ LuminanceAlphaFormat),\n/* harmony export */ LuminanceFormat: () => (/* binding */ LuminanceFormat),\n/* harmony export */ MOUSE: () => (/* binding */ MOUSE),\n/* harmony export */ Material: () => (/* binding */ Material),\n/* harmony export */ MaterialLoader: () => (/* binding */ MaterialLoader),\n/* harmony export */ MathUtils: () => (/* binding */ MathUtils),\n/* harmony export */ Matrix2: () => (/* binding */ Matrix2),\n/* harmony export */ Matrix3: () => (/* binding */ Matrix3),\n/* harmony export */ Matrix4: () => (/* binding */ Matrix4),\n/* harmony export */ MaxEquation: () => (/* binding */ MaxEquation),\n/* harmony export */ Mesh: () => (/* binding */ Mesh),\n/* harmony export */ MeshBasicMaterial: () => (/* binding */ MeshBasicMaterial),\n/* harmony export */ MeshDepthMaterial: () => (/* binding */ MeshDepthMaterial),\n/* harmony export */ MeshDistanceMaterial: () => (/* binding */ MeshDistanceMaterial),\n/* harmony export */ MeshLambertMaterial: () => (/* binding */ MeshLambertMaterial),\n/* harmony export */ MeshMatcapMaterial: () => (/* binding */ MeshMatcapMaterial),\n/* harmony export */ MeshNormalMaterial: () => (/* binding */ MeshNormalMaterial),\n/* harmony export */ MeshPhongMaterial: () => (/* binding */ MeshPhongMaterial),\n/* harmony export */ MeshPhysicalMaterial: () => (/* binding */ MeshPhysicalMaterial),\n/* harmony export */ MeshStandardMaterial: () => (/* binding */ MeshStandardMaterial),\n/* harmony export */ MeshToonMaterial: () => (/* binding */ MeshToonMaterial),\n/* harmony export */ MinEquation: () => (/* binding */ MinEquation),\n/* harmony export */ MirroredRepeatWrapping: () => (/* binding */ MirroredRepeatWrapping),\n/* harmony export */ MixOperation: () => (/* binding */ MixOperation),\n/* harmony export */ MultiplyBlending: () => (/* binding */ MultiplyBlending),\n/* harmony export */ MultiplyOperation: () => (/* binding */ MultiplyOperation),\n/* harmony export */ NearestFilter: () => (/* binding */ NearestFilter),\n/* harmony export */ NearestMipMapLinearFilter: () => (/* binding */ NearestMipMapLinearFilter),\n/* harmony export */ NearestMipMapNearestFilter: () => (/* binding */ NearestMipMapNearestFilter),\n/* harmony export */ NearestMipmapLinearFilter: () => (/* binding */ NearestMipmapLinearFilter),\n/* harmony export */ NearestMipmapNearestFilter: () => (/* binding */ NearestMipmapNearestFilter),\n/* harmony export */ NeutralToneMapping: () => (/* binding */ NeutralToneMapping),\n/* harmony export */ NeverCompare: () => (/* binding */ NeverCompare),\n/* harmony export */ NeverDepth: () => (/* binding */ NeverDepth),\n/* harmony export */ NeverStencilFunc: () => (/* binding */ NeverStencilFunc),\n/* harmony export */ NoBlending: () => (/* binding */ NoBlending),\n/* harmony export */ NoColorSpace: () => (/* binding */ NoColorSpace),\n/* harmony export */ NoToneMapping: () => (/* binding */ NoToneMapping),\n/* harmony export */ NormalAnimationBlendMode: () => (/* binding */ NormalAnimationBlendMode),\n/* harmony export */ NormalBlending: () => (/* binding */ NormalBlending),\n/* harmony export */ NotEqualCompare: () => (/* binding */ NotEqualCompare),\n/* harmony export */ NotEqualDepth: () => (/* binding */ NotEqualDepth),\n/* harmony export */ NotEqualStencilFunc: () => (/* binding */ NotEqualStencilFunc),\n/* harmony export */ NumberKeyframeTrack: () => (/* binding */ NumberKeyframeTrack),\n/* harmony export */ Object3D: () => (/* binding */ Object3D),\n/* harmony export */ ObjectLoader: () => (/* binding */ ObjectLoader),\n/* harmony export */ ObjectSpaceNormalMap: () => (/* binding */ ObjectSpaceNormalMap),\n/* harmony export */ OctahedronGeometry: () => (/* binding */ OctahedronGeometry),\n/* harmony export */ OneFactor: () => (/* binding */ OneFactor),\n/* harmony export */ OneMinusConstantAlphaFactor: () => (/* binding */ OneMinusConstantAlphaFactor),\n/* harmony export */ OneMinusConstantColorFactor: () => (/* binding */ OneMinusConstantColorFactor),\n/* harmony export */ OneMinusDstAlphaFactor: () => (/* binding */ OneMinusDstAlphaFactor),\n/* harmony export */ OneMinusDstColorFactor: () => (/* binding */ OneMinusDstColorFactor),\n/* harmony export */ OneMinusSrcAlphaFactor: () => (/* binding */ OneMinusSrcAlphaFactor),\n/* harmony export */ OneMinusSrcColorFactor: () => (/* binding */ OneMinusSrcColorFactor),\n/* harmony export */ OrthographicCamera: () => (/* binding */ OrthographicCamera),\n/* harmony export */ P3Primaries: () => (/* binding */ P3Primaries),\n/* harmony export */ PCFShadowMap: () => (/* binding */ PCFShadowMap),\n/* harmony export */ PCFSoftShadowMap: () => (/* binding */ PCFSoftShadowMap),\n/* harmony export */ PMREMGenerator: () => (/* binding */ PMREMGenerator),\n/* harmony export */ Path: () => (/* binding */ Path),\n/* harmony export */ PerspectiveCamera: () => (/* binding */ PerspectiveCamera),\n/* harmony export */ Plane: () => (/* binding */ Plane),\n/* harmony export */ PlaneGeometry: () => (/* binding */ PlaneGeometry),\n/* harmony export */ PlaneHelper: () => (/* binding */ PlaneHelper),\n/* harmony export */ PointLight: () => (/* binding */ PointLight),\n/* harmony export */ PointLightHelper: () => (/* binding */ PointLightHelper),\n/* harmony export */ Points: () => (/* binding */ Points),\n/* harmony export */ PointsMaterial: () => (/* binding */ PointsMaterial),\n/* harmony export */ PolarGridHelper: () => (/* binding */ PolarGridHelper),\n/* harmony export */ PolyhedronGeometry: () => (/* binding */ PolyhedronGeometry),\n/* harmony export */ PositionalAudio: () => (/* binding */ PositionalAudio),\n/* harmony export */ PropertyBinding: () => (/* binding */ PropertyBinding),\n/* harmony export */ PropertyMixer: () => (/* binding */ PropertyMixer),\n/* harmony export */ QuadraticBezierCurve: () => (/* binding */ QuadraticBezierCurve),\n/* harmony export */ QuadraticBezierCurve3: () => (/* binding */ QuadraticBezierCurve3),\n/* harmony export */ Quaternion: () => (/* binding */ Quaternion),\n/* harmony export */ QuaternionKeyframeTrack: () => (/* binding */ QuaternionKeyframeTrack),\n/* harmony export */ QuaternionLinearInterpolant: () => (/* binding */ QuaternionLinearInterpolant),\n/* harmony export */ RED_GREEN_RGTC2_Format: () => (/* binding */ RED_GREEN_RGTC2_Format),\n/* harmony export */ RED_RGTC1_Format: () => (/* binding */ RED_RGTC1_Format),\n/* harmony export */ REVISION: () => (/* binding */ REVISION),\n/* harmony export */ RGBADepthPacking: () => (/* binding */ RGBADepthPacking),\n/* harmony export */ RGBAFormat: () => (/* binding */ RGBAFormat),\n/* harmony export */ RGBAIntegerFormat: () => (/* binding */ RGBAIntegerFormat),\n/* harmony export */ RGBA_ASTC_10x10_Format: () => (/* binding */ RGBA_ASTC_10x10_Format),\n/* harmony export */ RGBA_ASTC_10x5_Format: () => (/* binding */ RGBA_ASTC_10x5_Format),\n/* harmony export */ RGBA_ASTC_10x6_Format: () => (/* binding */ RGBA_ASTC_10x6_Format),\n/* harmony export */ RGBA_ASTC_10x8_Format: () => (/* binding */ RGBA_ASTC_10x8_Format),\n/* harmony export */ RGBA_ASTC_12x10_Format: () => (/* binding */ RGBA_ASTC_12x10_Format),\n/* harmony export */ RGBA_ASTC_12x12_Format: () => (/* binding */ RGBA_ASTC_12x12_Format),\n/* harmony export */ RGBA_ASTC_4x4_Format: () => (/* binding */ RGBA_ASTC_4x4_Format),\n/* harmony export */ RGBA_ASTC_5x4_Format: () => (/* binding */ RGBA_ASTC_5x4_Format),\n/* harmony export */ RGBA_ASTC_5x5_Format: () => (/* binding */ RGBA_ASTC_5x5_Format),\n/* harmony export */ RGBA_ASTC_6x5_Format: () => (/* binding */ RGBA_ASTC_6x5_Format),\n/* harmony export */ RGBA_ASTC_6x6_Format: () => (/* binding */ RGBA_ASTC_6x6_Format),\n/* harmony export */ RGBA_ASTC_8x5_Format: () => (/* binding */ RGBA_ASTC_8x5_Format),\n/* harmony export */ RGBA_ASTC_8x6_Format: () => (/* binding */ RGBA_ASTC_8x6_Format),\n/* harmony export */ RGBA_ASTC_8x8_Format: () => (/* binding */ RGBA_ASTC_8x8_Format),\n/* harmony export */ RGBA_BPTC_Format: () => (/* binding */ RGBA_BPTC_Format),\n/* harmony export */ RGBA_ETC2_EAC_Format: () => (/* binding */ RGBA_ETC2_EAC_Format),\n/* harmony export */ RGBA_PVRTC_2BPPV1_Format: () => (/* binding */ RGBA_PVRTC_2BPPV1_Format),\n/* harmony export */ RGBA_PVRTC_4BPPV1_Format: () => (/* binding */ RGBA_PVRTC_4BPPV1_Format),\n/* harmony export */ RGBA_S3TC_DXT1_Format: () => (/* binding */ RGBA_S3TC_DXT1_Format),\n/* harmony export */ RGBA_S3TC_DXT3_Format: () => (/* binding */ RGBA_S3TC_DXT3_Format),\n/* harmony export */ RGBA_S3TC_DXT5_Format: () => (/* binding */ RGBA_S3TC_DXT5_Format),\n/* harmony export */ RGBDepthPacking: () => (/* binding */ RGBDepthPacking),\n/* harmony export */ RGBFormat: () => (/* binding */ RGBFormat),\n/* harmony export */ RGBIntegerFormat: () => (/* binding */ RGBIntegerFormat),\n/* harmony export */ RGB_BPTC_SIGNED_Format: () => (/* binding */ RGB_BPTC_SIGNED_Format),\n/* harmony export */ RGB_BPTC_UNSIGNED_Format: () => (/* binding */ RGB_BPTC_UNSIGNED_Format),\n/* harmony export */ RGB_ETC1_Format: () => (/* binding */ RGB_ETC1_Format),\n/* harmony export */ RGB_ETC2_Format: () => (/* binding */ RGB_ETC2_Format),\n/* harmony export */ RGB_PVRTC_2BPPV1_Format: () => (/* binding */ RGB_PVRTC_2BPPV1_Format),\n/* harmony export */ RGB_PVRTC_4BPPV1_Format: () => (/* binding */ RGB_PVRTC_4BPPV1_Format),\n/* harmony export */ RGB_S3TC_DXT1_Format: () => (/* binding */ RGB_S3TC_DXT1_Format),\n/* harmony export */ RGDepthPacking: () => (/* binding */ RGDepthPacking),\n/* harmony export */ RGFormat: () => (/* binding */ RGFormat),\n/* harmony export */ RGIntegerFormat: () => (/* binding */ RGIntegerFormat),\n/* harmony export */ RawShaderMaterial: () => (/* binding */ RawShaderMaterial),\n/* harmony export */ Ray: () => (/* binding */ Ray),\n/* harmony export */ Raycaster: () => (/* binding */ Raycaster),\n/* harmony export */ Rec709Primaries: () => (/* binding */ Rec709Primaries),\n/* harmony export */ RectAreaLight: () => (/* binding */ RectAreaLight),\n/* harmony export */ RedFormat: () => (/* binding */ RedFormat),\n/* harmony export */ RedIntegerFormat: () => (/* binding */ RedIntegerFormat),\n/* harmony export */ ReinhardToneMapping: () => (/* binding */ ReinhardToneMapping),\n/* harmony export */ RenderTarget: () => (/* binding */ RenderTarget),\n/* harmony export */ RepeatWrapping: () => (/* binding */ RepeatWrapping),\n/* harmony export */ ReplaceStencilOp: () => (/* binding */ ReplaceStencilOp),\n/* harmony export */ ReverseSubtractEquation: () => (/* binding */ ReverseSubtractEquation),\n/* harmony export */ RingGeometry: () => (/* binding */ RingGeometry),\n/* harmony export */ SIGNED_RED_GREEN_RGTC2_Format: () => (/* binding */ SIGNED_RED_GREEN_RGTC2_Format),\n/* harmony export */ SIGNED_RED_RGTC1_Format: () => (/* binding */ SIGNED_RED_RGTC1_Format),\n/* harmony export */ SRGBColorSpace: () => (/* binding */ SRGBColorSpace),\n/* harmony export */ SRGBTransfer: () => (/* binding */ SRGBTransfer),\n/* harmony export */ Scene: () => (/* binding */ Scene),\n/* harmony export */ ShaderChunk: () => (/* binding */ ShaderChunk),\n/* harmony export */ ShaderLib: () => (/* binding */ ShaderLib),\n/* harmony export */ ShaderMaterial: () => (/* binding */ ShaderMaterial),\n/* harmony export */ ShadowMaterial: () => (/* binding */ ShadowMaterial),\n/* harmony export */ Shape: () => (/* binding */ Shape),\n/* harmony export */ ShapeGeometry: () => (/* binding */ ShapeGeometry),\n/* harmony export */ ShapePath: () => (/* binding */ ShapePath),\n/* harmony export */ ShapeUtils: () => (/* binding */ ShapeUtils),\n/* harmony export */ ShortType: () => (/* binding */ ShortType),\n/* harmony export */ Skeleton: () => (/* binding */ Skeleton),\n/* harmony export */ SkeletonHelper: () => (/* binding */ SkeletonHelper),\n/* harmony export */ SkinnedMesh: () => (/* binding */ SkinnedMesh),\n/* harmony export */ Source: () => (/* binding */ Source),\n/* harmony export */ Sphere: () => (/* binding */ Sphere),\n/* harmony export */ SphereGeometry: () => (/* binding */ SphereGeometry),\n/* harmony export */ Spherical: () => (/* binding */ Spherical),\n/* harmony export */ SphericalHarmonics3: () => (/* binding */ SphericalHarmonics3),\n/* harmony export */ SplineCurve: () => (/* binding */ SplineCurve),\n/* harmony export */ SpotLight: () => (/* binding */ SpotLight),\n/* harmony export */ SpotLightHelper: () => (/* binding */ SpotLightHelper),\n/* harmony export */ Sprite: () => (/* binding */ Sprite),\n/* harmony export */ SpriteMaterial: () => (/* binding */ SpriteMaterial),\n/* harmony export */ SrcAlphaFactor: () => (/* binding */ SrcAlphaFactor),\n/* harmony export */ SrcAlphaSaturateFactor: () => (/* binding */ SrcAlphaSaturateFactor),\n/* harmony export */ SrcColorFactor: () => (/* binding */ SrcColorFactor),\n/* harmony export */ StaticCopyUsage: () => (/* binding */ StaticCopyUsage),\n/* harmony export */ StaticDrawUsage: () => (/* binding */ StaticDrawUsage),\n/* harmony export */ StaticReadUsage: () => (/* binding */ StaticReadUsage),\n/* harmony export */ StereoCamera: () => (/* binding */ StereoCamera),\n/* harmony export */ StreamCopyUsage: () => (/* binding */ StreamCopyUsage),\n/* harmony export */ StreamDrawUsage: () => (/* binding */ StreamDrawUsage),\n/* harmony export */ StreamReadUsage: () => (/* binding */ StreamReadUsage),\n/* harmony export */ StringKeyframeTrack: () => (/* binding */ StringKeyframeTrack),\n/* harmony export */ SubtractEquation: () => (/* binding */ SubtractEquation),\n/* harmony export */ SubtractiveBlending: () => (/* binding */ SubtractiveBlending),\n/* harmony export */ TOUCH: () => (/* binding */ TOUCH),\n/* harmony export */ TangentSpaceNormalMap: () => (/* binding */ TangentSpaceNormalMap),\n/* harmony export */ TetrahedronGeometry: () => (/* binding */ TetrahedronGeometry),\n/* harmony export */ Texture: () => (/* binding */ Texture),\n/* harmony export */ TextureLoader: () => (/* binding */ TextureLoader),\n/* harmony export */ TextureUtils: () => (/* binding */ TextureUtils),\n/* harmony export */ TorusGeometry: () => (/* binding */ TorusGeometry),\n/* harmony export */ TorusKnotGeometry: () => (/* binding */ TorusKnotGeometry),\n/* harmony export */ Triangle: () => (/* binding */ Triangle),\n/* harmony export */ TriangleFanDrawMode: () => (/* binding */ TriangleFanDrawMode),\n/* harmony export */ TriangleStripDrawMode: () => (/* binding */ TriangleStripDrawMode),\n/* harmony export */ TrianglesDrawMode: () => (/* binding */ TrianglesDrawMode),\n/* harmony export */ TubeGeometry: () => (/* binding */ TubeGeometry),\n/* harmony export */ UVMapping: () => (/* binding */ UVMapping),\n/* harmony export */ Uint16BufferAttribute: () => (/* binding */ Uint16BufferAttribute),\n/* harmony export */ Uint32BufferAttribute: () => (/* binding */ Uint32BufferAttribute),\n/* harmony export */ Uint8BufferAttribute: () => (/* binding */ Uint8BufferAttribute),\n/* harmony export */ Uint8ClampedBufferAttribute: () => (/* binding */ Uint8ClampedBufferAttribute),\n/* harmony export */ Uniform: () => (/* binding */ Uniform),\n/* harmony export */ UniformsGroup: () => (/* binding */ UniformsGroup),\n/* harmony export */ UniformsLib: () => (/* binding */ UniformsLib),\n/* harmony export */ UniformsUtils: () => (/* binding */ UniformsUtils),\n/* harmony export */ UnsignedByteType: () => (/* binding */ UnsignedByteType),\n/* harmony export */ UnsignedInt248Type: () => (/* binding */ UnsignedInt248Type),\n/* harmony export */ UnsignedInt5999Type: () => (/* binding */ UnsignedInt5999Type),\n/* harmony export */ UnsignedIntType: () => (/* binding */ UnsignedIntType),\n/* harmony export */ UnsignedShort4444Type: () => (/* binding */ UnsignedShort4444Type),\n/* harmony export */ UnsignedShort5551Type: () => (/* binding */ UnsignedShort5551Type),\n/* harmony export */ UnsignedShortType: () => (/* binding */ UnsignedShortType),\n/* harmony export */ VSMShadowMap: () => (/* binding */ VSMShadowMap),\n/* harmony export */ Vector2: () => (/* binding */ Vector2),\n/* harmony export */ Vector3: () => (/* binding */ Vector3),\n/* harmony export */ Vector4: () => (/* binding */ Vector4),\n/* harmony export */ VectorKeyframeTrack: () => (/* binding */ VectorKeyframeTrack),\n/* harmony export */ VideoTexture: () => (/* binding */ VideoTexture),\n/* harmony export */ WebGL3DRenderTarget: () => (/* binding */ WebGL3DRenderTarget),\n/* harmony export */ WebGLArrayRenderTarget: () => (/* binding */ WebGLArrayRenderTarget),\n/* harmony export */ WebGLCoordinateSystem: () => (/* binding */ WebGLCoordinateSystem),\n/* harmony export */ WebGLCubeRenderTarget: () => (/* binding */ WebGLCubeRenderTarget),\n/* harmony export */ WebGLMultipleRenderTargets: () => (/* binding */ WebGLMultipleRenderTargets),\n/* harmony export */ WebGLRenderTarget: () => (/* binding */ WebGLRenderTarget),\n/* harmony export */ WebGLRenderer: () => (/* binding */ WebGLRenderer),\n/* harmony export */ WebGLUtils: () => (/* binding */ WebGLUtils),\n/* harmony export */ WebGPUCoordinateSystem: () => (/* binding */ WebGPUCoordinateSystem),\n/* harmony export */ WireframeGeometry: () => (/* binding */ WireframeGeometry),\n/* harmony export */ WrapAroundEnding: () => (/* binding */ WrapAroundEnding),\n/* harmony export */ ZeroCurvatureEnding: () => (/* binding */ ZeroCurvatureEnding),\n/* harmony export */ ZeroFactor: () => (/* binding */ ZeroFactor),\n/* harmony export */ ZeroSlopeEnding: () => (/* binding */ ZeroSlopeEnding),\n/* harmony export */ ZeroStencilOp: () => (/* binding */ ZeroStencilOp),\n/* harmony export */ createCanvasElement: () => (/* binding */ createCanvasElement)\n/* harmony export */ });\n/**\r\n * @license\r\n * Copyright 2010-2024 Three.js Authors\r\n * SPDX-License-Identifier: MIT\r\n */\r\nconst REVISION = '168';\r\n\r\nconst MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };\r\nconst TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };\r\nconst CullFaceNone = 0;\r\nconst CullFaceBack = 1;\r\nconst CullFaceFront = 2;\r\nconst CullFaceFrontBack = 3;\r\nconst BasicShadowMap = 0;\r\nconst PCFShadowMap = 1;\r\nconst PCFSoftShadowMap = 2;\r\nconst VSMShadowMap = 3;\r\nconst FrontSide = 0;\r\nconst BackSide = 1;\r\nconst DoubleSide = 2;\r\nconst NoBlending = 0;\r\nconst NormalBlending = 1;\r\nconst AdditiveBlending = 2;\r\nconst SubtractiveBlending = 3;\r\nconst MultiplyBlending = 4;\r\nconst CustomBlending = 5;\r\nconst AddEquation = 100;\r\nconst SubtractEquation = 101;\r\nconst ReverseSubtractEquation = 102;\r\nconst MinEquation = 103;\r\nconst MaxEquation = 104;\r\nconst ZeroFactor = 200;\r\nconst OneFactor = 201;\r\nconst SrcColorFactor = 202;\r\nconst OneMinusSrcColorFactor = 203;\r\nconst SrcAlphaFactor = 204;\r\nconst OneMinusSrcAlphaFactor = 205;\r\nconst DstAlphaFactor = 206;\r\nconst OneMinusDstAlphaFactor = 207;\r\nconst DstColorFactor = 208;\r\nconst OneMinusDstColorFactor = 209;\r\nconst SrcAlphaSaturateFactor = 210;\r\nconst ConstantColorFactor = 211;\r\nconst OneMinusConstantColorFactor = 212;\r\nconst ConstantAlphaFactor = 213;\r\nconst OneMinusConstantAlphaFactor = 214;\r\nconst NeverDepth = 0;\r\nconst AlwaysDepth = 1;\r\nconst LessDepth = 2;\r\nconst LessEqualDepth = 3;\r\nconst EqualDepth = 4;\r\nconst GreaterEqualDepth = 5;\r\nconst GreaterDepth = 6;\r\nconst NotEqualDepth = 7;\r\nconst MultiplyOperation = 0;\r\nconst MixOperation = 1;\r\nconst AddOperation = 2;\r\nconst NoToneMapping = 0;\r\nconst LinearToneMapping = 1;\r\nconst ReinhardToneMapping = 2;\r\nconst CineonToneMapping = 3;\r\nconst ACESFilmicToneMapping = 4;\r\nconst CustomToneMapping = 5;\r\nconst AgXToneMapping = 6;\r\nconst NeutralToneMapping = 7;\r\nconst AttachedBindMode = 'attached';\r\nconst DetachedBindMode = 'detached';\r\n\r\nconst UVMapping = 300;\r\nconst CubeReflectionMapping = 301;\r\nconst CubeRefractionMapping = 302;\r\nconst EquirectangularReflectionMapping = 303;\r\nconst EquirectangularRefractionMapping = 304;\r\nconst CubeUVReflectionMapping = 306;\r\nconst RepeatWrapping = 1000;\r\nconst ClampToEdgeWrapping = 1001;\r\nconst MirroredRepeatWrapping = 1002;\r\nconst NearestFilter = 1003;\r\nconst NearestMipmapNearestFilter = 1004;\r\nconst NearestMipMapNearestFilter = 1004;\r\nconst NearestMipmapLinearFilter = 1005;\r\nconst NearestMipMapLinearFilter = 1005;\r\nconst LinearFilter = 1006;\r\nconst LinearMipmapNearestFilter = 1007;\r\nconst LinearMipMapNearestFilter = 1007;\r\nconst LinearMipmapLinearFilter = 1008;\r\nconst LinearMipMapLinearFilter = 1008;\r\nconst UnsignedByteType = 1009;\r\nconst ByteType = 1010;\r\nconst ShortType = 1011;\r\nconst UnsignedShortType = 1012;\r\nconst IntType = 1013;\r\nconst UnsignedIntType = 1014;\r\nconst FloatType = 1015;\r\nconst HalfFloatType = 1016;\r\nconst UnsignedShort4444Type = 1017;\r\nconst UnsignedShort5551Type = 1018;\r\nconst UnsignedInt248Type = 1020;\r\nconst UnsignedInt5999Type = 35902;\r\nconst AlphaFormat = 1021;\r\nconst RGBFormat = 1022;\r\nconst RGBAFormat = 1023;\r\nconst LuminanceFormat = 1024;\r\nconst LuminanceAlphaFormat = 1025;\r\nconst DepthFormat = 1026;\r\nconst DepthStencilFormat = 1027;\r\nconst RedFormat = 1028;\r\nconst RedIntegerFormat = 1029;\r\nconst RGFormat = 1030;\r\nconst RGIntegerFormat = 1031;\r\nconst RGBIntegerFormat = 1032;\r\nconst RGBAIntegerFormat = 1033;\r\n\r\nconst RGB_S3TC_DXT1_Format = 33776;\r\nconst RGBA_S3TC_DXT1_Format = 33777;\r\nconst RGBA_S3TC_DXT3_Format = 33778;\r\nconst RGBA_S3TC_DXT5_Format = 33779;\r\nconst RGB_PVRTC_4BPPV1_Format = 35840;\r\nconst RGB_PVRTC_2BPPV1_Format = 35841;\r\nconst RGBA_PVRTC_4BPPV1_Format = 35842;\r\nconst RGBA_PVRTC_2BPPV1_Format = 35843;\r\nconst RGB_ETC1_Format = 36196;\r\nconst RGB_ETC2_Format = 37492;\r\nconst RGBA_ETC2_EAC_Format = 37496;\r\nconst RGBA_ASTC_4x4_Format = 37808;\r\nconst RGBA_ASTC_5x4_Format = 37809;\r\nconst RGBA_ASTC_5x5_Format = 37810;\r\nconst RGBA_ASTC_6x5_Format = 37811;\r\nconst RGBA_ASTC_6x6_Format = 37812;\r\nconst RGBA_ASTC_8x5_Format = 37813;\r\nconst RGBA_ASTC_8x6_Format = 37814;\r\nconst RGBA_ASTC_8x8_Format = 37815;\r\nconst RGBA_ASTC_10x5_Format = 37816;\r\nconst RGBA_ASTC_10x6_Format = 37817;\r\nconst RGBA_ASTC_10x8_Format = 37818;\r\nconst RGBA_ASTC_10x10_Format = 37819;\r\nconst RGBA_ASTC_12x10_Format = 37820;\r\nconst RGBA_ASTC_12x12_Format = 37821;\r\nconst RGBA_BPTC_Format = 36492;\r\nconst RGB_BPTC_SIGNED_Format = 36494;\r\nconst RGB_BPTC_UNSIGNED_Format = 36495;\r\nconst RED_RGTC1_Format = 36283;\r\nconst SIGNED_RED_RGTC1_Format = 36284;\r\nconst RED_GREEN_RGTC2_Format = 36285;\r\nconst SIGNED_RED_GREEN_RGTC2_Format = 36286;\r\nconst LoopOnce = 2200;\r\nconst LoopRepeat = 2201;\r\nconst LoopPingPong = 2202;\r\nconst InterpolateDiscrete = 2300;\r\nconst InterpolateLinear = 2301;\r\nconst InterpolateSmooth = 2302;\r\nconst ZeroCurvatureEnding = 2400;\r\nconst ZeroSlopeEnding = 2401;\r\nconst WrapAroundEnding = 2402;\r\nconst NormalAnimationBlendMode = 2500;\r\nconst AdditiveAnimationBlendMode = 2501;\r\nconst TrianglesDrawMode = 0;\r\nconst TriangleStripDrawMode = 1;\r\nconst TriangleFanDrawMode = 2;\r\nconst BasicDepthPacking = 3200;\r\nconst RGBADepthPacking = 3201;\r\nconst RGBDepthPacking = 3202;\r\nconst RGDepthPacking = 3203;\r\nconst TangentSpaceNormalMap = 0;\r\nconst ObjectSpaceNormalMap = 1;\r\n\r\n// Color space string identifiers, matching CSS Color Module Level 4 and WebGPU names where available.\r\nconst NoColorSpace = '';\r\nconst SRGBColorSpace = 'srgb';\r\nconst LinearSRGBColorSpace = 'srgb-linear';\r\nconst DisplayP3ColorSpace = 'display-p3';\r\nconst LinearDisplayP3ColorSpace = 'display-p3-linear';\r\n\r\nconst LinearTransfer = 'linear';\r\nconst SRGBTransfer = 'srgb';\r\n\r\nconst Rec709Primaries = 'rec709';\r\nconst P3Primaries = 'p3';\r\n\r\nconst ZeroStencilOp = 0;\r\nconst KeepStencilOp = 7680;\r\nconst ReplaceStencilOp = 7681;\r\nconst IncrementStencilOp = 7682;\r\nconst DecrementStencilOp = 7683;\r\nconst IncrementWrapStencilOp = 34055;\r\nconst DecrementWrapStencilOp = 34056;\r\nconst InvertStencilOp = 5386;\r\n\r\nconst NeverStencilFunc = 512;\r\nconst LessStencilFunc = 513;\r\nconst EqualStencilFunc = 514;\r\nconst LessEqualStencilFunc = 515;\r\nconst GreaterStencilFunc = 516;\r\nconst NotEqualStencilFunc = 517;\r\nconst GreaterEqualStencilFunc = 518;\r\nconst AlwaysStencilFunc = 519;\r\n\r\nconst NeverCompare = 512;\r\nconst LessCompare = 513;\r\nconst EqualCompare = 514;\r\nconst LessEqualCompare = 515;\r\nconst GreaterCompare = 516;\r\nconst NotEqualCompare = 517;\r\nconst GreaterEqualCompare = 518;\r\nconst AlwaysCompare = 519;\r\n\r\nconst StaticDrawUsage = 35044;\r\nconst DynamicDrawUsage = 35048;\r\nconst StreamDrawUsage = 35040;\r\nconst StaticReadUsage = 35045;\r\nconst DynamicReadUsage = 35049;\r\nconst StreamReadUsage = 35041;\r\nconst StaticCopyUsage = 35046;\r\nconst DynamicCopyUsage = 35050;\r\nconst StreamCopyUsage = 35042;\r\n\r\nconst GLSL1 = '100';\r\nconst GLSL3 = '300 es';\r\n\r\nconst WebGLCoordinateSystem = 2000;\r\nconst WebGPUCoordinateSystem = 2001;\r\n\r\n/**\r\n * https://github.com/mrdoob/eventdispatcher.js/\r\n */\r\n\r\nclass EventDispatcher {\r\n\r\n\taddEventListener( type, listener ) {\r\n\r\n\t\tif ( this._listeners === undefined ) this._listeners = {};\r\n\r\n\t\tconst listeners = this._listeners;\r\n\r\n\t\tif ( listeners[ type ] === undefined ) {\r\n\r\n\t\t\tlisteners[ type ] = [];\r\n\r\n\t\t}\r\n\r\n\t\tif ( listeners[ type ].indexOf( listener ) === - 1 ) {\r\n\r\n\t\t\tlisteners[ type ].push( listener );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\thasEventListener( type, listener ) {\r\n\r\n\t\tif ( this._listeners === undefined ) return false;\r\n\r\n\t\tconst listeners = this._listeners;\r\n\r\n\t\treturn listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;\r\n\r\n\t}\r\n\r\n\tremoveEventListener( type, listener ) {\r\n\r\n\t\tif ( this._listeners === undefined ) return;\r\n\r\n\t\tconst listeners = this._listeners;\r\n\t\tconst listenerArray = listeners[ type ];\r\n\r\n\t\tif ( listenerArray !== undefined ) {\r\n\r\n\t\t\tconst index = listenerArray.indexOf( listener );\r\n\r\n\t\t\tif ( index !== - 1 ) {\r\n\r\n\t\t\t\tlistenerArray.splice( index, 1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tdispatchEvent( event ) {\r\n\r\n\t\tif ( this._listeners === undefined ) return;\r\n\r\n\t\tconst listeners = this._listeners;\r\n\t\tconst listenerArray = listeners[ event.type ];\r\n\r\n\t\tif ( listenerArray !== undefined ) {\r\n\r\n\t\t\tevent.target = this;\r\n\r\n\t\t\t// Make a copy, in case listeners are removed while iterating.\r\n\t\t\tconst array = listenerArray.slice( 0 );\r\n\r\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tarray[ i ].call( this, event );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tevent.target = null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _lut = [ '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0a', '0b', '0c', '0d', '0e', '0f', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '1a', '1b', '1c', '1d', '1e', '1f', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '2a', '2b', '2c', '2d', '2e', '2f', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '3a', '3b', '3c', '3d', '3e', '3f', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '4a', '4b', '4c', '4d', '4e', '4f', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5a', '5b', '5c', '5d', '5e', '5f', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '6a', '6b', '6c', '6d', '6e', '6f', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '7a', '7b', '7c', '7d', '7e', '7f', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '8a', '8b', '8c', '8d', '8e', '8f', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '9a', '9b', '9c', '9d', '9e', '9f', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'aa', 'ab', 'ac', 'ad', 'ae', 'af', 'b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'ba', 'bb', 'bc', 'bd', 'be', 'bf', 'c0', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'ca', 'cb', 'cc', 'cd', 'ce', 'cf', 'd0', 'd1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'da', 'db', 'dc', 'dd', 'de', 'df', 'e0', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'ea', 'eb', 'ec', 'ed', 'ee', 'ef', 'f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'fa', 'fb', 'fc', 'fd', 'fe', 'ff' ];\r\n\r\nlet _seed = 1234567;\r\n\r\n\r\nconst DEG2RAD = Math.PI / 180;\r\nconst RAD2DEG = 180 / Math.PI;\r\n\r\n// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136\r\nfunction generateUUID() {\r\n\r\n\tconst d0 = Math.random() * 0xffffffff | 0;\r\n\tconst d1 = Math.random() * 0xffffffff | 0;\r\n\tconst d2 = Math.random() * 0xffffffff | 0;\r\n\tconst d3 = Math.random() * 0xffffffff | 0;\r\n\tconst uuid = _lut[ d0 & 0xff ] + _lut[ d0 >> 8 & 0xff ] + _lut[ d0 >> 16 & 0xff ] + _lut[ d0 >> 24 & 0xff ] + '-' +\r\n\t\t\t_lut[ d1 & 0xff ] + _lut[ d1 >> 8 & 0xff ] + '-' + _lut[ d1 >> 16 & 0x0f | 0x40 ] + _lut[ d1 >> 24 & 0xff ] + '-' +\r\n\t\t\t_lut[ d2 & 0x3f | 0x80 ] + _lut[ d2 >> 8 & 0xff ] + '-' + _lut[ d2 >> 16 & 0xff ] + _lut[ d2 >> 24 & 0xff ] +\r\n\t\t\t_lut[ d3 & 0xff ] + _lut[ d3 >> 8 & 0xff ] + _lut[ d3 >> 16 & 0xff ] + _lut[ d3 >> 24 & 0xff ];\r\n\r\n\t// .toLowerCase() here flattens concatenated strings to save heap memory space.\r\n\treturn uuid.toLowerCase();\r\n\r\n}\r\n\r\nfunction clamp( value, min, max ) {\r\n\r\n\treturn Math.max( min, Math.min( max, value ) );\r\n\r\n}\r\n\r\n// compute euclidean modulo of m % n\r\n// https://en.wikipedia.org/wiki/Modulo_operation\r\nfunction euclideanModulo( n, m ) {\r\n\r\n\treturn ( ( n % m ) + m ) % m;\r\n\r\n}\r\n\r\n// Linear mapping from range to range \r\nfunction mapLinear( x, a1, a2, b1, b2 ) {\r\n\r\n\treturn b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );\r\n\r\n}\r\n\r\n// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/\r\nfunction inverseLerp( x, y, value ) {\r\n\r\n\tif ( x !== y ) {\r\n\r\n\t\treturn ( value - x ) / ( y - x );\r\n\r\n\t} else {\r\n\r\n\t\treturn 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// https://en.wikipedia.org/wiki/Linear_interpolation\r\nfunction lerp( x, y, t ) {\r\n\r\n\treturn ( 1 - t ) * x + t * y;\r\n\r\n}\r\n\r\n// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/\r\nfunction damp( x, y, lambda, dt ) {\r\n\r\n\treturn lerp( x, y, 1 - Math.exp( - lambda * dt ) );\r\n\r\n}\r\n\r\n// https://www.desmos.com/calculator/vcsjnyz7x4\r\nfunction pingpong( x, length = 1 ) {\r\n\r\n\treturn length - Math.abs( euclideanModulo( x, length * 2 ) - length );\r\n\r\n}\r\n\r\n// http://en.wikipedia.org/wiki/Smoothstep\r\nfunction smoothstep( x, min, max ) {\r\n\r\n\tif ( x <= min ) return 0;\r\n\tif ( x >= max ) return 1;\r\n\r\n\tx = ( x - min ) / ( max - min );\r\n\r\n\treturn x * x * ( 3 - 2 * x );\r\n\r\n}\r\n\r\nfunction smootherstep( x, min, max ) {\r\n\r\n\tif ( x <= min ) return 0;\r\n\tif ( x >= max ) return 1;\r\n\r\n\tx = ( x - min ) / ( max - min );\r\n\r\n\treturn x * x * x * ( x * ( x * 6 - 15 ) + 10 );\r\n\r\n}\r\n\r\n// Random integer from interval\r\nfunction randInt( low, high ) {\r\n\r\n\treturn low + Math.floor( Math.random() * ( high - low + 1 ) );\r\n\r\n}\r\n\r\n// Random float from interval\r\nfunction randFloat( low, high ) {\r\n\r\n\treturn low + Math.random() * ( high - low );\r\n\r\n}\r\n\r\n// Random float from <-range/2, range/2> interval\r\nfunction randFloatSpread( range ) {\r\n\r\n\treturn range * ( 0.5 - Math.random() );\r\n\r\n}\r\n\r\n// Deterministic pseudo-random float in the interval [ 0, 1 ]\r\nfunction seededRandom( s ) {\r\n\r\n\tif ( s !== undefined ) _seed = s;\r\n\r\n\t// Mulberry32 generator\r\n\r\n\tlet t = _seed += 0x6D2B79F5;\r\n\r\n\tt = Math.imul( t ^ t >>> 15, t | 1 );\r\n\r\n\tt ^= t + Math.imul( t ^ t >>> 7, t | 61 );\r\n\r\n\treturn ( ( t ^ t >>> 14 ) >>> 0 ) / 4294967296;\r\n\r\n}\r\n\r\nfunction degToRad( degrees ) {\r\n\r\n\treturn degrees * DEG2RAD;\r\n\r\n}\r\n\r\nfunction radToDeg( radians ) {\r\n\r\n\treturn radians * RAD2DEG;\r\n\r\n}\r\n\r\nfunction isPowerOfTwo( value ) {\r\n\r\n\treturn ( value & ( value - 1 ) ) === 0 && value !== 0;\r\n\r\n}\r\n\r\nfunction ceilPowerOfTwo( value ) {\r\n\r\n\treturn Math.pow( 2, Math.ceil( Math.log( value ) / Math.LN2 ) );\r\n\r\n}\r\n\r\nfunction floorPowerOfTwo( value ) {\r\n\r\n\treturn Math.pow( 2, Math.floor( Math.log( value ) / Math.LN2 ) );\r\n\r\n}\r\n\r\nfunction setQuaternionFromProperEuler( q, a, b, c, order ) {\r\n\r\n\t// Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles\r\n\r\n\t// rotations are applied to the axes in the order specified by 'order'\r\n\t// rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'\r\n\t// angles are in radians\r\n\r\n\tconst cos = Math.cos;\r\n\tconst sin = Math.sin;\r\n\r\n\tconst c2 = cos( b / 2 );\r\n\tconst s2 = sin( b / 2 );\r\n\r\n\tconst c13 = cos( ( a + c ) / 2 );\r\n\tconst s13 = sin( ( a + c ) / 2 );\r\n\r\n\tconst c1_3 = cos( ( a - c ) / 2 );\r\n\tconst s1_3 = sin( ( a - c ) / 2 );\r\n\r\n\tconst c3_1 = cos( ( c - a ) / 2 );\r\n\tconst s3_1 = sin( ( c - a ) / 2 );\r\n\r\n\tswitch ( order ) {\r\n\r\n\t\tcase 'XYX':\r\n\t\t\tq.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );\r\n\t\t\tbreak;\r\n\r\n\t\tcase 'YZY':\r\n\t\t\tq.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );\r\n\t\t\tbreak;\r\n\r\n\t\tcase 'ZXZ':\r\n\t\t\tq.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );\r\n\t\t\tbreak;\r\n\r\n\t\tcase 'XZX':\r\n\t\t\tq.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );\r\n\t\t\tbreak;\r\n\r\n\t\tcase 'YXY':\r\n\t\t\tq.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );\r\n\t\t\tbreak;\r\n\r\n\t\tcase 'ZYZ':\r\n\t\t\tq.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );\r\n\t\t\tbreak;\r\n\r\n\t\tdefault:\r\n\t\t\tconsole.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction denormalize( value, array ) {\r\n\r\n\tswitch ( array.constructor ) {\r\n\r\n\t\tcase Float32Array:\r\n\r\n\t\t\treturn value;\r\n\r\n\t\tcase Uint32Array:\r\n\r\n\t\t\treturn value / 4294967295.0;\r\n\r\n\t\tcase Uint16Array:\r\n\r\n\t\t\treturn value / 65535.0;\r\n\r\n\t\tcase Uint8Array:\r\n\r\n\t\t\treturn value / 255.0;\r\n\r\n\t\tcase Int32Array:\r\n\r\n\t\t\treturn Math.max( value / 2147483647.0, - 1.0 );\r\n\r\n\t\tcase Int16Array:\r\n\r\n\t\t\treturn Math.max( value / 32767.0, - 1.0 );\r\n\r\n\t\tcase Int8Array:\r\n\r\n\t\t\treturn Math.max( value / 127.0, - 1.0 );\r\n\r\n\t\tdefault:\r\n\r\n\t\t\tthrow new Error( 'Invalid component type.' );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction normalize( value, array ) {\r\n\r\n\tswitch ( array.constructor ) {\r\n\r\n\t\tcase Float32Array:\r\n\r\n\t\t\treturn value;\r\n\r\n\t\tcase Uint32Array:\r\n\r\n\t\t\treturn Math.round( value * 4294967295.0 );\r\n\r\n\t\tcase Uint16Array:\r\n\r\n\t\t\treturn Math.round( value * 65535.0 );\r\n\r\n\t\tcase Uint8Array:\r\n\r\n\t\t\treturn Math.round( value * 255.0 );\r\n\r\n\t\tcase Int32Array:\r\n\r\n\t\t\treturn Math.round( value * 2147483647.0 );\r\n\r\n\t\tcase Int16Array:\r\n\r\n\t\t\treturn Math.round( value * 32767.0 );\r\n\r\n\t\tcase Int8Array:\r\n\r\n\t\t\treturn Math.round( value * 127.0 );\r\n\r\n\t\tdefault:\r\n\r\n\t\t\tthrow new Error( 'Invalid component type.' );\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst MathUtils = {\r\n\tDEG2RAD: DEG2RAD,\r\n\tRAD2DEG: RAD2DEG,\r\n\tgenerateUUID: generateUUID,\r\n\tclamp: clamp,\r\n\teuclideanModulo: euclideanModulo,\r\n\tmapLinear: mapLinear,\r\n\tinverseLerp: inverseLerp,\r\n\tlerp: lerp,\r\n\tdamp: damp,\r\n\tpingpong: pingpong,\r\n\tsmoothstep: smoothstep,\r\n\tsmootherstep: smootherstep,\r\n\trandInt: randInt,\r\n\trandFloat: randFloat,\r\n\trandFloatSpread: randFloatSpread,\r\n\tseededRandom: seededRandom,\r\n\tdegToRad: degToRad,\r\n\tradToDeg: radToDeg,\r\n\tisPowerOfTwo: isPowerOfTwo,\r\n\tceilPowerOfTwo: ceilPowerOfTwo,\r\n\tfloorPowerOfTwo: floorPowerOfTwo,\r\n\tsetQuaternionFromProperEuler: setQuaternionFromProperEuler,\r\n\tnormalize: normalize,\r\n\tdenormalize: denormalize\r\n};\r\n\r\nclass Vector2 {\r\n\r\n\tconstructor( x = 0, y = 0 ) {\r\n\r\n\t\tVector2.prototype.isVector2 = true;\r\n\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\r\n\t}\r\n\r\n\tget width() {\r\n\r\n\t\treturn this.x;\r\n\r\n\t}\r\n\r\n\tset width( value ) {\r\n\r\n\t\tthis.x = value;\r\n\r\n\t}\r\n\r\n\tget height() {\r\n\r\n\t\treturn this.y;\r\n\r\n\t}\r\n\r\n\tset height( value ) {\r\n\r\n\t\tthis.y = value;\r\n\r\n\t}\r\n\r\n\tset( x, y ) {\r\n\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetScalar( scalar ) {\r\n\r\n\t\tthis.x = scalar;\r\n\t\tthis.y = scalar;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetX( x ) {\r\n\r\n\t\tthis.x = x;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetY( y ) {\r\n\r\n\t\tthis.y = y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetComponent( index, value ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: this.x = value; break;\r\n\t\t\tcase 1: this.y = value; break;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetComponent( index ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: return this.x;\r\n\t\t\tcase 1: return this.y;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor( this.x, this.y );\r\n\r\n\t}\r\n\r\n\tcopy( v ) {\r\n\r\n\t\tthis.x = v.x;\r\n\t\tthis.y = v.y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tadd( v ) {\r\n\r\n\t\tthis.x += v.x;\r\n\t\tthis.y += v.y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\taddScalar( s ) {\r\n\r\n\t\tthis.x += s;\r\n\t\tthis.y += s;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\taddVectors( a, b ) {\r\n\r\n\t\tthis.x = a.x + b.x;\r\n\t\tthis.y = a.y + b.y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\taddScaledVector( v, s ) {\r\n\r\n\t\tthis.x += v.x * s;\r\n\t\tthis.y += v.y * s;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsub( v ) {\r\n\r\n\t\tthis.x -= v.x;\r\n\t\tthis.y -= v.y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsubScalar( s ) {\r\n\r\n\t\tthis.x -= s;\r\n\t\tthis.y -= s;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsubVectors( a, b ) {\r\n\r\n\t\tthis.x = a.x - b.x;\r\n\t\tthis.y = a.y - b.y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmultiply( v ) {\r\n\r\n\t\tthis.x *= v.x;\r\n\t\tthis.y *= v.y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmultiplyScalar( scalar ) {\r\n\r\n\t\tthis.x *= scalar;\r\n\t\tthis.y *= scalar;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdivide( v ) {\r\n\r\n\t\tthis.x /= v.x;\r\n\t\tthis.y /= v.y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdivideScalar( scalar ) {\r\n\r\n\t\treturn this.multiplyScalar( 1 / scalar );\r\n\r\n\t}\r\n\r\n\tapplyMatrix3( m ) {\r\n\r\n\t\tconst x = this.x, y = this.y;\r\n\t\tconst e = m.elements;\r\n\r\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ];\r\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ];\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmin( v ) {\r\n\r\n\t\tthis.x = Math.min( this.x, v.x );\r\n\t\tthis.y = Math.min( this.y, v.y );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmax( v ) {\r\n\r\n\t\tthis.x = Math.max( this.x, v.x );\r\n\t\tthis.y = Math.max( this.y, v.y );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclamp( min, max ) {\r\n\r\n\t\t// assumes min < max, componentwise\r\n\r\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\r\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclampScalar( minVal, maxVal ) {\r\n\r\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\r\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclampLength( min, max ) {\r\n\r\n\t\tconst length = this.length();\r\n\r\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\r\n\r\n\t}\r\n\r\n\tfloor() {\r\n\r\n\t\tthis.x = Math.floor( this.x );\r\n\t\tthis.y = Math.floor( this.y );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tceil() {\r\n\r\n\t\tthis.x = Math.ceil( this.x );\r\n\t\tthis.y = Math.ceil( this.y );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tround() {\r\n\r\n\t\tthis.x = Math.round( this.x );\r\n\t\tthis.y = Math.round( this.y );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\troundToZero() {\r\n\r\n\t\tthis.x = Math.trunc( this.x );\r\n\t\tthis.y = Math.trunc( this.y );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tnegate() {\r\n\r\n\t\tthis.x = - this.x;\r\n\t\tthis.y = - this.y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdot( v ) {\r\n\r\n\t\treturn this.x * v.x + this.y * v.y;\r\n\r\n\t}\r\n\r\n\tcross( v ) {\r\n\r\n\t\treturn this.x * v.y - this.y * v.x;\r\n\r\n\t}\r\n\r\n\tlengthSq() {\r\n\r\n\t\treturn this.x * this.x + this.y * this.y;\r\n\r\n\t}\r\n\r\n\tlength() {\r\n\r\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y );\r\n\r\n\t}\r\n\r\n\tmanhattanLength() {\r\n\r\n\t\treturn Math.abs( this.x ) + Math.abs( this.y );\r\n\r\n\t}\r\n\r\n\tnormalize() {\r\n\r\n\t\treturn this.divideScalar( this.length() || 1 );\r\n\r\n\t}\r\n\r\n\tangle() {\r\n\r\n\t\t// computes the angle in radians with respect to the positive x-axis\r\n\r\n\t\tconst angle = Math.atan2( - this.y, - this.x ) + Math.PI;\r\n\r\n\t\treturn angle;\r\n\r\n\t}\r\n\r\n\tangleTo( v ) {\r\n\r\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\r\n\r\n\t\tif ( denominator === 0 ) return Math.PI / 2;\r\n\r\n\t\tconst theta = this.dot( v ) / denominator;\r\n\r\n\t\t// clamp, to handle numerical problems\r\n\r\n\t\treturn Math.acos( clamp( theta, - 1, 1 ) );\r\n\r\n\t}\r\n\r\n\tdistanceTo( v ) {\r\n\r\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\r\n\r\n\t}\r\n\r\n\tdistanceToSquared( v ) {\r\n\r\n\t\tconst dx = this.x - v.x, dy = this.y - v.y;\r\n\t\treturn dx * dx + dy * dy;\r\n\r\n\t}\r\n\r\n\tmanhattanDistanceTo( v ) {\r\n\r\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y );\r\n\r\n\t}\r\n\r\n\tsetLength( length ) {\r\n\r\n\t\treturn this.normalize().multiplyScalar( length );\r\n\r\n\t}\r\n\r\n\tlerp( v, alpha ) {\r\n\r\n\t\tthis.x += ( v.x - this.x ) * alpha;\r\n\t\tthis.y += ( v.y - this.y ) * alpha;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tlerpVectors( v1, v2, alpha ) {\r\n\r\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\r\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tequals( v ) {\r\n\r\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) );\r\n\r\n\t}\r\n\r\n\tfromArray( array, offset = 0 ) {\r\n\r\n\t\tthis.x = array[ offset ];\r\n\t\tthis.y = array[ offset + 1 ];\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoArray( array = [], offset = 0 ) {\r\n\r\n\t\tarray[ offset ] = this.x;\r\n\t\tarray[ offset + 1 ] = this.y;\r\n\r\n\t\treturn array;\r\n\r\n\t}\r\n\r\n\tfromBufferAttribute( attribute, index ) {\r\n\r\n\t\tthis.x = attribute.getX( index );\r\n\t\tthis.y = attribute.getY( index );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\trotateAround( center, angle ) {\r\n\r\n\t\tconst c = Math.cos( angle ), s = Math.sin( angle );\r\n\r\n\t\tconst x = this.x - center.x;\r\n\t\tconst y = this.y - center.y;\r\n\r\n\t\tthis.x = x * c - y * s + center.x;\r\n\t\tthis.y = x * s + y * c + center.y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\trandom() {\r\n\r\n\t\tthis.x = Math.random();\r\n\t\tthis.y = Math.random();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t*[ Symbol.iterator ]() {\r\n\r\n\t\tyield this.x;\r\n\t\tyield this.y;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Matrix3 {\r\n\r\n\tconstructor( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\r\n\r\n\t\tMatrix3.prototype.isMatrix3 = true;\r\n\r\n\t\tthis.elements = [\r\n\r\n\t\t\t1, 0, 0,\r\n\t\t\t0, 1, 0,\r\n\t\t\t0, 0, 1\r\n\r\n\t\t];\r\n\r\n\t\tif ( n11 !== undefined ) {\r\n\r\n\t\t\tthis.set( n11, n12, n13, n21, n22, n23, n31, n32, n33 );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tset( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\r\n\r\n\t\tconst te = this.elements;\r\n\r\n\t\tte[ 0 ] = n11; te[ 1 ] = n21; te[ 2 ] = n31;\r\n\t\tte[ 3 ] = n12; te[ 4 ] = n22; te[ 5 ] = n32;\r\n\t\tte[ 6 ] = n13; te[ 7 ] = n23; te[ 8 ] = n33;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tidentity() {\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\t1, 0, 0,\r\n\t\t\t0, 1, 0,\r\n\t\t\t0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcopy( m ) {\r\n\r\n\t\tconst te = this.elements;\r\n\t\tconst me = m.elements;\r\n\r\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ];\r\n\t\tte[ 3 ] = me[ 3 ]; te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ];\r\n\t\tte[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ]; te[ 8 ] = me[ 8 ];\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\textractBasis( xAxis, yAxis, zAxis ) {\r\n\r\n\t\txAxis.setFromMatrix3Column( this, 0 );\r\n\t\tyAxis.setFromMatrix3Column( this, 1 );\r\n\t\tzAxis.setFromMatrix3Column( this, 2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromMatrix4( m ) {\r\n\r\n\t\tconst me = m.elements;\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\tme[ 0 ], me[ 4 ], me[ 8 ],\r\n\t\t\tme[ 1 ], me[ 5 ], me[ 9 ],\r\n\t\t\tme[ 2 ], me[ 6 ], me[ 10 ]\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmultiply( m ) {\r\n\r\n\t\treturn this.multiplyMatrices( this, m );\r\n\r\n\t}\r\n\r\n\tpremultiply( m ) {\r\n\r\n\t\treturn this.multiplyMatrices( m, this );\r\n\r\n\t}\r\n\r\n\tmultiplyMatrices( a, b ) {\r\n\r\n\t\tconst ae = a.elements;\r\n\t\tconst be = b.elements;\r\n\t\tconst te = this.elements;\r\n\r\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 3 ], a13 = ae[ 6 ];\r\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 4 ], a23 = ae[ 7 ];\r\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 5 ], a33 = ae[ 8 ];\r\n\r\n\t\tconst b11 = be[ 0 ], b12 = be[ 3 ], b13 = be[ 6 ];\r\n\t\tconst b21 = be[ 1 ], b22 = be[ 4 ], b23 = be[ 7 ];\r\n\t\tconst b31 = be[ 2 ], b32 = be[ 5 ], b33 = be[ 8 ];\r\n\r\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31;\r\n\t\tte[ 3 ] = a11 * b12 + a12 * b22 + a13 * b32;\r\n\t\tte[ 6 ] = a11 * b13 + a12 * b23 + a13 * b33;\r\n\r\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31;\r\n\t\tte[ 4 ] = a21 * b12 + a22 * b22 + a23 * b32;\r\n\t\tte[ 7 ] = a21 * b13 + a22 * b23 + a23 * b33;\r\n\r\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31;\r\n\t\tte[ 5 ] = a31 * b12 + a32 * b22 + a33 * b32;\r\n\t\tte[ 8 ] = a31 * b13 + a32 * b23 + a33 * b33;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmultiplyScalar( s ) {\r\n\r\n\t\tconst te = this.elements;\r\n\r\n\t\tte[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s;\r\n\t\tte[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s;\r\n\t\tte[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdeterminant() {\r\n\r\n\t\tconst te = this.elements;\r\n\r\n\t\tconst a = te[ 0 ], b = te[ 1 ], c = te[ 2 ],\r\n\t\t\td = te[ 3 ], e = te[ 4 ], f = te[ 5 ],\r\n\t\t\tg = te[ 6 ], h = te[ 7 ], i = te[ 8 ];\r\n\r\n\t\treturn a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;\r\n\r\n\t}\r\n\r\n\tinvert() {\r\n\r\n\t\tconst te = this.elements,\r\n\r\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ],\r\n\t\t\tn12 = te[ 3 ], n22 = te[ 4 ], n32 = te[ 5 ],\r\n\t\t\tn13 = te[ 6 ], n23 = te[ 7 ], n33 = te[ 8 ],\r\n\r\n\t\t\tt11 = n33 * n22 - n32 * n23,\r\n\t\t\tt12 = n32 * n13 - n33 * n12,\r\n\t\t\tt13 = n23 * n12 - n22 * n13,\r\n\r\n\t\t\tdet = n11 * t11 + n21 * t12 + n31 * t13;\r\n\r\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0 );\r\n\r\n\t\tconst detInv = 1 / det;\r\n\r\n\t\tte[ 0 ] = t11 * detInv;\r\n\t\tte[ 1 ] = ( n31 * n23 - n33 * n21 ) * detInv;\r\n\t\tte[ 2 ] = ( n32 * n21 - n31 * n22 ) * detInv;\r\n\r\n\t\tte[ 3 ] = t12 * detInv;\r\n\t\tte[ 4 ] = ( n33 * n11 - n31 * n13 ) * detInv;\r\n\t\tte[ 5 ] = ( n31 * n12 - n32 * n11 ) * detInv;\r\n\r\n\t\tte[ 6 ] = t13 * detInv;\r\n\t\tte[ 7 ] = ( n21 * n13 - n23 * n11 ) * detInv;\r\n\t\tte[ 8 ] = ( n22 * n11 - n21 * n12 ) * detInv;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttranspose() {\r\n\r\n\t\tlet tmp;\r\n\t\tconst m = this.elements;\r\n\r\n\t\ttmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp;\r\n\t\ttmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp;\r\n\t\ttmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetNormalMatrix( matrix4 ) {\r\n\r\n\t\treturn this.setFromMatrix4( matrix4 ).invert().transpose();\r\n\r\n\t}\r\n\r\n\ttransposeIntoArray( r ) {\r\n\r\n\t\tconst m = this.elements;\r\n\r\n\t\tr[ 0 ] = m[ 0 ];\r\n\t\tr[ 1 ] = m[ 3 ];\r\n\t\tr[ 2 ] = m[ 6 ];\r\n\t\tr[ 3 ] = m[ 1 ];\r\n\t\tr[ 4 ] = m[ 4 ];\r\n\t\tr[ 5 ] = m[ 7 ];\r\n\t\tr[ 6 ] = m[ 2 ];\r\n\t\tr[ 7 ] = m[ 5 ];\r\n\t\tr[ 8 ] = m[ 8 ];\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetUvTransform( tx, ty, sx, sy, rotation, cx, cy ) {\r\n\r\n\t\tconst c = Math.cos( rotation );\r\n\t\tconst s = Math.sin( rotation );\r\n\r\n\t\tthis.set(\r\n\t\t\tsx * c, sx * s, - sx * ( c * cx + s * cy ) + cx + tx,\r\n\t\t\t- sy * s, sy * c, - sy * ( - s * cx + c * cy ) + cy + ty,\r\n\t\t\t0, 0, 1\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tscale( sx, sy ) {\r\n\r\n\t\tthis.premultiply( _m3.makeScale( sx, sy ) );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\trotate( theta ) {\r\n\r\n\t\tthis.premultiply( _m3.makeRotation( - theta ) );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttranslate( tx, ty ) {\r\n\r\n\t\tthis.premultiply( _m3.makeTranslation( tx, ty ) );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t// for 2D Transforms\r\n\r\n\tmakeTranslation( x, y ) {\r\n\r\n\t\tif ( x.isVector2 ) {\r\n\r\n\t\t\tthis.set(\r\n\r\n\t\t\t\t1, 0, x.x,\r\n\t\t\t\t0, 1, x.y,\r\n\t\t\t\t0, 0, 1\r\n\r\n\t\t\t);\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.set(\r\n\r\n\t\t\t\t1, 0, x,\r\n\t\t\t\t0, 1, y,\r\n\t\t\t\t0, 0, 1\r\n\r\n\t\t\t);\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmakeRotation( theta ) {\r\n\r\n\t\t// counterclockwise\r\n\r\n\t\tconst c = Math.cos( theta );\r\n\t\tconst s = Math.sin( theta );\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\tc, - s, 0,\r\n\t\t\ts, c, 0,\r\n\t\t\t0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmakeScale( x, y ) {\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\tx, 0, 0,\r\n\t\t\t0, y, 0,\r\n\t\t\t0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tequals( matrix ) {\r\n\r\n\t\tconst te = this.elements;\r\n\t\tconst me = matrix.elements;\r\n\r\n\t\tfor ( let i = 0; i < 9; i ++ ) {\r\n\r\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t}\r\n\r\n\tfromArray( array, offset = 0 ) {\r\n\r\n\t\tfor ( let i = 0; i < 9; i ++ ) {\r\n\r\n\t\t\tthis.elements[ i ] = array[ i + offset ];\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoArray( array = [], offset = 0 ) {\r\n\r\n\t\tconst te = this.elements;\r\n\r\n\t\tarray[ offset ] = te[ 0 ];\r\n\t\tarray[ offset + 1 ] = te[ 1 ];\r\n\t\tarray[ offset + 2 ] = te[ 2 ];\r\n\r\n\t\tarray[ offset + 3 ] = te[ 3 ];\r\n\t\tarray[ offset + 4 ] = te[ 4 ];\r\n\t\tarray[ offset + 5 ] = te[ 5 ];\r\n\r\n\t\tarray[ offset + 6 ] = te[ 6 ];\r\n\t\tarray[ offset + 7 ] = te[ 7 ];\r\n\t\tarray[ offset + 8 ] = te[ 8 ];\r\n\r\n\t\treturn array;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().fromArray( this.elements );\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _m3 = /*@__PURE__*/ new Matrix3();\r\n\r\nfunction arrayNeedsUint32( array ) {\r\n\r\n\t// assumes larger values usually on last\r\n\r\n\tfor ( let i = array.length - 1; i >= 0; -- i ) {\r\n\r\n\t\tif ( array[ i ] >= 65535 ) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565\r\n\r\n\t}\r\n\r\n\treturn false;\r\n\r\n}\r\n\r\nconst TYPED_ARRAYS = {\r\n\tInt8Array: Int8Array,\r\n\tUint8Array: Uint8Array,\r\n\tUint8ClampedArray: Uint8ClampedArray,\r\n\tInt16Array: Int16Array,\r\n\tUint16Array: Uint16Array,\r\n\tInt32Array: Int32Array,\r\n\tUint32Array: Uint32Array,\r\n\tFloat32Array: Float32Array,\r\n\tFloat64Array: Float64Array\r\n};\r\n\r\nfunction getTypedArray( type, buffer ) {\r\n\r\n\treturn new TYPED_ARRAYS[ type ]( buffer );\r\n\r\n}\r\n\r\nfunction createElementNS( name ) {\r\n\r\n\treturn document.createElementNS( 'http://www.w3.org/1999/xhtml', name );\r\n\r\n}\r\n\r\nfunction createCanvasElement() {\r\n\r\n\tconst canvas = createElementNS( 'canvas' );\r\n\tcanvas.style.display = 'block';\r\n\treturn canvas;\r\n\r\n}\r\n\r\nconst _cache = {};\r\n\r\nfunction warnOnce( message ) {\r\n\r\n\tif ( message in _cache ) return;\r\n\r\n\t_cache[ message ] = true;\r\n\r\n\tconsole.warn( message );\r\n\r\n}\r\n\r\nfunction probeAsync( gl, sync, interval ) {\r\n\r\n\treturn new Promise( function ( resolve, reject ) {\r\n\r\n\t\tfunction probe() {\r\n\r\n\t\t\tswitch ( gl.clientWaitSync( sync, gl.SYNC_FLUSH_COMMANDS_BIT, 0 ) ) {\r\n\r\n\t\t\t\tcase gl.WAIT_FAILED:\r\n\t\t\t\t\treject();\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase gl.TIMEOUT_EXPIRED:\r\n\t\t\t\t\tsetTimeout( probe, interval );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tresolve();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tsetTimeout( probe, interval );\r\n\r\n\t} );\r\n\r\n}\r\n\r\n/**\r\n * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping\r\n * or clipping. Based on W3C specifications for sRGB and Display P3,\r\n * and ICC specifications for the D50 connection space. Values in/out\r\n * are _linear_ sRGB and _linear_ Display P3.\r\n *\r\n * Note that both sRGB and Display P3 use the sRGB transfer functions.\r\n *\r\n * Reference:\r\n * - http://www.russellcottrell.com/photo/matrixCalculator.htm\r\n */\r\n\r\nconst LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().set(\r\n\t0.8224621, 0.177538, 0.0,\r\n\t0.0331941, 0.9668058, 0.0,\r\n\t0.0170827, 0.0723974, 0.9105199,\r\n);\r\n\r\nconst LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().set(\r\n\t1.2249401, - 0.2249404, 0.0,\r\n\t- 0.0420569, 1.0420571, 0.0,\r\n\t- 0.0196376, - 0.0786361, 1.0982735\r\n);\r\n\r\n/**\r\n * Defines supported color spaces by transfer function and primaries,\r\n * and provides conversions to/from the Linear-sRGB reference space.\r\n */\r\nconst COLOR_SPACES = {\r\n\t[ LinearSRGBColorSpace ]: {\r\n\t\ttransfer: LinearTransfer,\r\n\t\tprimaries: Rec709Primaries,\r\n\t\tluminanceCoefficients: [ 0.2126, 0.7152, 0.0722 ],\r\n\t\ttoReference: ( color ) => color,\r\n\t\tfromReference: ( color ) => color,\r\n\t},\r\n\t[ SRGBColorSpace ]: {\r\n\t\ttransfer: SRGBTransfer,\r\n\t\tprimaries: Rec709Primaries,\r\n\t\tluminanceCoefficients: [ 0.2126, 0.7152, 0.0722 ],\r\n\t\ttoReference: ( color ) => color.convertSRGBToLinear(),\r\n\t\tfromReference: ( color ) => color.convertLinearToSRGB(),\r\n\t},\r\n\t[ LinearDisplayP3ColorSpace ]: {\r\n\t\ttransfer: LinearTransfer,\r\n\t\tprimaries: P3Primaries,\r\n\t\tluminanceCoefficients: [ 0.2289, 0.6917, 0.0793 ],\r\n\t\ttoReference: ( color ) => color.applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),\r\n\t\tfromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ),\r\n\t},\r\n\t[ DisplayP3ColorSpace ]: {\r\n\t\ttransfer: SRGBTransfer,\r\n\t\tprimaries: P3Primaries,\r\n\t\tluminanceCoefficients: [ 0.2289, 0.6917, 0.0793 ],\r\n\t\ttoReference: ( color ) => color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),\r\n\t\tfromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB(),\r\n\t},\r\n};\r\n\r\nconst SUPPORTED_WORKING_COLOR_SPACES = new Set( [ LinearSRGBColorSpace, LinearDisplayP3ColorSpace ] );\r\n\r\nconst ColorManagement = {\r\n\r\n\tenabled: true,\r\n\r\n\t_workingColorSpace: LinearSRGBColorSpace,\r\n\r\n\tget workingColorSpace() {\r\n\r\n\t\treturn this._workingColorSpace;\r\n\r\n\t},\r\n\r\n\tset workingColorSpace( colorSpace ) {\r\n\r\n\t\tif ( ! SUPPORTED_WORKING_COLOR_SPACES.has( colorSpace ) ) {\r\n\r\n\t\t\tthrow new Error( `Unsupported working color space, \"${ colorSpace }\".` );\r\n\r\n\t\t}\r\n\r\n\t\tthis._workingColorSpace = colorSpace;\r\n\r\n\t},\r\n\r\n\tconvert: function ( color, sourceColorSpace, targetColorSpace ) {\r\n\r\n\t\tif ( this.enabled === false || sourceColorSpace === targetColorSpace || ! sourceColorSpace || ! targetColorSpace ) {\r\n\r\n\t\t\treturn color;\r\n\r\n\t\t}\r\n\r\n\t\tconst sourceToReference = COLOR_SPACES[ sourceColorSpace ].toReference;\r\n\t\tconst targetFromReference = COLOR_SPACES[ targetColorSpace ].fromReference;\r\n\r\n\t\treturn targetFromReference( sourceToReference( color ) );\r\n\r\n\t},\r\n\r\n\tfromWorkingColorSpace: function ( color, targetColorSpace ) {\r\n\r\n\t\treturn this.convert( color, this._workingColorSpace, targetColorSpace );\r\n\r\n\t},\r\n\r\n\ttoWorkingColorSpace: function ( color, sourceColorSpace ) {\r\n\r\n\t\treturn this.convert( color, sourceColorSpace, this._workingColorSpace );\r\n\r\n\t},\r\n\r\n\tgetPrimaries: function ( colorSpace ) {\r\n\r\n\t\treturn COLOR_SPACES[ colorSpace ].primaries;\r\n\r\n\t},\r\n\r\n\tgetTransfer: function ( colorSpace ) {\r\n\r\n\t\tif ( colorSpace === NoColorSpace ) return LinearTransfer;\r\n\r\n\t\treturn COLOR_SPACES[ colorSpace ].transfer;\r\n\r\n\t},\r\n\r\n\tgetLuminanceCoefficients: function ( target, colorSpace = this._workingColorSpace ) {\r\n\r\n\t\treturn target.fromArray( COLOR_SPACES[ colorSpace ].luminanceCoefficients );\r\n\r\n\t},\r\n\r\n};\r\n\r\n\r\nfunction SRGBToLinear( c ) {\r\n\r\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );\r\n\r\n}\r\n\r\nfunction LinearToSRGB( c ) {\r\n\r\n\treturn ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;\r\n\r\n}\r\n\r\nlet _canvas;\r\n\r\nclass ImageUtils {\r\n\r\n\tstatic getDataURL( image ) {\r\n\r\n\t\tif ( /^data:/i.test( image.src ) ) {\r\n\r\n\t\t\treturn image.src;\r\n\r\n\t\t}\r\n\r\n\t\tif ( typeof HTMLCanvasElement === 'undefined' ) {\r\n\r\n\t\t\treturn image.src;\r\n\r\n\t\t}\r\n\r\n\t\tlet canvas;\r\n\r\n\t\tif ( image instanceof HTMLCanvasElement ) {\r\n\r\n\t\t\tcanvas = image;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tif ( _canvas === undefined ) _canvas = createElementNS( 'canvas' );\r\n\r\n\t\t\t_canvas.width = image.width;\r\n\t\t\t_canvas.height = image.height;\r\n\r\n\t\t\tconst context = _canvas.getContext( '2d' );\r\n\r\n\t\t\tif ( image instanceof ImageData ) {\r\n\r\n\t\t\t\tcontext.putImageData( image, 0, 0 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcanvas = _canvas;\r\n\r\n\t\t}\r\n\r\n\t\tif ( canvas.width > 2048 || canvas.height > 2048 ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons', image );\r\n\r\n\t\t\treturn canvas.toDataURL( 'image/jpeg', 0.6 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn canvas.toDataURL( 'image/png' );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tstatic sRGBToLinear( image ) {\r\n\r\n\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\r\n\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\r\n\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\r\n\r\n\t\t\tconst canvas = createElementNS( 'canvas' );\r\n\r\n\t\t\tcanvas.width = image.width;\r\n\t\t\tcanvas.height = image.height;\r\n\r\n\t\t\tconst context = canvas.getContext( '2d' );\r\n\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\r\n\r\n\t\t\tconst imageData = context.getImageData( 0, 0, image.width, image.height );\r\n\t\t\tconst data = imageData.data;\r\n\r\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\r\n\r\n\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] / 255 ) * 255;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcontext.putImageData( imageData, 0, 0 );\r\n\r\n\t\t\treturn canvas;\r\n\r\n\t\t} else if ( image.data ) {\r\n\r\n\t\t\tconst data = image.data.slice( 0 );\r\n\r\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\r\n\r\n\t\t\t\tif ( data instanceof Uint8Array || data instanceof Uint8ClampedArray ) {\r\n\r\n\t\t\t\t\tdata[ i ] = Math.floor( SRGBToLinear( data[ i ] / 255 ) * 255 );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// assuming float\r\n\r\n\t\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn {\r\n\t\t\t\tdata: data,\r\n\t\t\t\twidth: image.width,\r\n\t\t\t\theight: image.height\r\n\t\t\t};\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconsole.warn( 'THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.' );\r\n\t\t\treturn image;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nlet _sourceId = 0;\r\n\r\nclass Source {\r\n\r\n\tconstructor( data = null ) {\r\n\r\n\t\tthis.isSource = true;\r\n\r\n\t\tObject.defineProperty( this, 'id', { value: _sourceId ++ } );\r\n\r\n\t\tthis.uuid = generateUUID();\r\n\r\n\t\tthis.data = data;\r\n\t\tthis.dataReady = true;\r\n\r\n\t\tthis.version = 0;\r\n\r\n\t}\r\n\r\n\tset needsUpdate( value ) {\r\n\r\n\t\tif ( value === true ) this.version ++;\r\n\r\n\t}\r\n\r\n\ttoJSON( meta ) {\r\n\r\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\r\n\r\n\t\tif ( ! isRootObject && meta.images[ this.uuid ] !== undefined ) {\r\n\r\n\t\t\treturn meta.images[ this.uuid ];\r\n\r\n\t\t}\r\n\r\n\t\tconst output = {\r\n\t\t\tuuid: this.uuid,\r\n\t\t\turl: ''\r\n\t\t};\r\n\r\n\t\tconst data = this.data;\r\n\r\n\t\tif ( data !== null ) {\r\n\r\n\t\t\tlet url;\r\n\r\n\t\t\tif ( Array.isArray( data ) ) {\r\n\r\n\t\t\t\t// cube texture\r\n\r\n\t\t\t\turl = [];\r\n\r\n\t\t\t\tfor ( let i = 0, l = data.length; i < l; i ++ ) {\r\n\r\n\t\t\t\t\tif ( data[ i ].isDataTexture ) {\r\n\r\n\t\t\t\t\t\turl.push( serializeImage( data[ i ].image ) );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\turl.push( serializeImage( data[ i ] ) );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// texture\r\n\r\n\t\t\t\turl = serializeImage( data );\r\n\r\n\t\t\t}\r\n\r\n\t\t\toutput.url = url;\r\n\r\n\t\t}\r\n\r\n\t\tif ( ! isRootObject ) {\r\n\r\n\t\t\tmeta.images[ this.uuid ] = output;\r\n\r\n\t\t}\r\n\r\n\t\treturn output;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction serializeImage( image ) {\r\n\r\n\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\r\n\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\r\n\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\r\n\r\n\t\t// default images\r\n\r\n\t\treturn ImageUtils.getDataURL( image );\r\n\r\n\t} else {\r\n\r\n\t\tif ( image.data ) {\r\n\r\n\t\t\t// images of DataTexture\r\n\r\n\t\t\treturn {\r\n\t\t\t\tdata: Array.from( image.data ),\r\n\t\t\t\twidth: image.width,\r\n\t\t\t\theight: image.height,\r\n\t\t\t\ttype: image.data.constructor.name\r\n\t\t\t};\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconsole.warn( 'THREE.Texture: Unable to serialize Texture.' );\r\n\t\t\treturn {};\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nlet _textureId = 0;\r\n\r\nclass Texture extends EventDispatcher {\r\n\r\n\tconstructor( image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = Texture.DEFAULT_ANISOTROPY, colorSpace = NoColorSpace ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isTexture = true;\r\n\r\n\t\tObject.defineProperty( this, 'id', { value: _textureId ++ } );\r\n\r\n\t\tthis.uuid = generateUUID();\r\n\r\n\t\tthis.name = '';\r\n\r\n\t\tthis.source = new Source( image );\r\n\t\tthis.mipmaps = [];\r\n\r\n\t\tthis.mapping = mapping;\r\n\t\tthis.channel = 0;\r\n\r\n\t\tthis.wrapS = wrapS;\r\n\t\tthis.wrapT = wrapT;\r\n\r\n\t\tthis.magFilter = magFilter;\r\n\t\tthis.minFilter = minFilter;\r\n\r\n\t\tthis.anisotropy = anisotropy;\r\n\r\n\t\tthis.format = format;\r\n\t\tthis.internalFormat = null;\r\n\t\tthis.type = type;\r\n\r\n\t\tthis.offset = new Vector2( 0, 0 );\r\n\t\tthis.repeat = new Vector2( 1, 1 );\r\n\t\tthis.center = new Vector2( 0, 0 );\r\n\t\tthis.rotation = 0;\r\n\r\n\t\tthis.matrixAutoUpdate = true;\r\n\t\tthis.matrix = new Matrix3();\r\n\r\n\t\tthis.generateMipmaps = true;\r\n\t\tthis.premultiplyAlpha = false;\r\n\t\tthis.flipY = true;\r\n\t\tthis.unpackAlignment = 4;\t// valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)\r\n\r\n\t\tthis.colorSpace = colorSpace;\r\n\r\n\t\tthis.userData = {};\r\n\r\n\t\tthis.version = 0;\r\n\t\tthis.onUpdate = null;\r\n\r\n\t\tthis.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not\r\n\t\tthis.pmremVersion = 0; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)\r\n\r\n\t}\r\n\r\n\tget image() {\r\n\r\n\t\treturn this.source.data;\r\n\r\n\t}\r\n\r\n\tset image( value = null ) {\r\n\r\n\t\tthis.source.data = value;\r\n\r\n\t}\r\n\r\n\tupdateMatrix() {\r\n\r\n\t\tthis.matrix.setUvTransform( this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y );\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.name = source.name;\r\n\r\n\t\tthis.source = source.source;\r\n\t\tthis.mipmaps = source.mipmaps.slice( 0 );\r\n\r\n\t\tthis.mapping = source.mapping;\r\n\t\tthis.channel = source.channel;\r\n\r\n\t\tthis.wrapS = source.wrapS;\r\n\t\tthis.wrapT = source.wrapT;\r\n\r\n\t\tthis.magFilter = source.magFilter;\r\n\t\tthis.minFilter = source.minFilter;\r\n\r\n\t\tthis.anisotropy = source.anisotropy;\r\n\r\n\t\tthis.format = source.format;\r\n\t\tthis.internalFormat = source.internalFormat;\r\n\t\tthis.type = source.type;\r\n\r\n\t\tthis.offset.copy( source.offset );\r\n\t\tthis.repeat.copy( source.repeat );\r\n\t\tthis.center.copy( source.center );\r\n\t\tthis.rotation = source.rotation;\r\n\r\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\r\n\t\tthis.matrix.copy( source.matrix );\r\n\r\n\t\tthis.generateMipmaps = source.generateMipmaps;\r\n\t\tthis.premultiplyAlpha = source.premultiplyAlpha;\r\n\t\tthis.flipY = source.flipY;\r\n\t\tthis.unpackAlignment = source.unpackAlignment;\r\n\t\tthis.colorSpace = source.colorSpace;\r\n\r\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\r\n\r\n\t\tthis.needsUpdate = true;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON( meta ) {\r\n\r\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\r\n\r\n\t\tif ( ! isRootObject && meta.textures[ this.uuid ] !== undefined ) {\r\n\r\n\t\t\treturn meta.textures[ this.uuid ];\r\n\r\n\t\t}\r\n\r\n\t\tconst output = {\r\n\r\n\t\t\tmetadata: {\r\n\t\t\t\tversion: 4.6,\r\n\t\t\t\ttype: 'Texture',\r\n\t\t\t\tgenerator: 'Texture.toJSON'\r\n\t\t\t},\r\n\r\n\t\t\tuuid: this.uuid,\r\n\t\t\tname: this.name,\r\n\r\n\t\t\timage: this.source.toJSON( meta ).uuid,\r\n\r\n\t\t\tmapping: this.mapping,\r\n\t\t\tchannel: this.channel,\r\n\r\n\t\t\trepeat: [ this.repeat.x, this.repeat.y ],\r\n\t\t\toffset: [ this.offset.x, this.offset.y ],\r\n\t\t\tcenter: [ this.center.x, this.center.y ],\r\n\t\t\trotation: this.rotation,\r\n\r\n\t\t\twrap: [ this.wrapS, this.wrapT ],\r\n\r\n\t\t\tformat: this.format,\r\n\t\t\tinternalFormat: this.internalFormat,\r\n\t\t\ttype: this.type,\r\n\t\t\tcolorSpace: this.colorSpace,\r\n\r\n\t\t\tminFilter: this.minFilter,\r\n\t\t\tmagFilter: this.magFilter,\r\n\t\t\tanisotropy: this.anisotropy,\r\n\r\n\t\t\tflipY: this.flipY,\r\n\r\n\t\t\tgenerateMipmaps: this.generateMipmaps,\r\n\t\t\tpremultiplyAlpha: this.premultiplyAlpha,\r\n\t\t\tunpackAlignment: this.unpackAlignment\r\n\r\n\t\t};\r\n\r\n\t\tif ( Object.keys( this.userData ).length > 0 ) output.userData = this.userData;\r\n\r\n\t\tif ( ! isRootObject ) {\r\n\r\n\t\t\tmeta.textures[ this.uuid ] = output;\r\n\r\n\t\t}\r\n\r\n\t\treturn output;\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.dispatchEvent( { type: 'dispose' } );\r\n\r\n\t}\r\n\r\n\ttransformUv( uv ) {\r\n\r\n\t\tif ( this.mapping !== UVMapping ) return uv;\r\n\r\n\t\tuv.applyMatrix3( this.matrix );\r\n\r\n\t\tif ( uv.x < 0 || uv.x > 1 ) {\r\n\r\n\t\t\tswitch ( this.wrapS ) {\r\n\r\n\t\t\t\tcase RepeatWrapping:\r\n\r\n\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase ClampToEdgeWrapping:\r\n\r\n\t\t\t\t\tuv.x = uv.x < 0 ? 0 : 1;\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase MirroredRepeatWrapping:\r\n\r\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.x ) % 2 ) === 1 ) {\r\n\r\n\t\t\t\t\t\tuv.x = Math.ceil( uv.x ) - uv.x;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( uv.y < 0 || uv.y > 1 ) {\r\n\r\n\t\t\tswitch ( this.wrapT ) {\r\n\r\n\t\t\t\tcase RepeatWrapping:\r\n\r\n\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase ClampToEdgeWrapping:\r\n\r\n\t\t\t\t\tuv.y = uv.y < 0 ? 0 : 1;\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase MirroredRepeatWrapping:\r\n\r\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.y ) % 2 ) === 1 ) {\r\n\r\n\t\t\t\t\t\tuv.y = Math.ceil( uv.y ) - uv.y;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.flipY ) {\r\n\r\n\t\t\tuv.y = 1 - uv.y;\r\n\r\n\t\t}\r\n\r\n\t\treturn uv;\r\n\r\n\t}\r\n\r\n\tset needsUpdate( value ) {\r\n\r\n\t\tif ( value === true ) {\r\n\r\n\t\t\tthis.version ++;\r\n\t\t\tthis.source.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tset needsPMREMUpdate( value ) {\r\n\r\n\t\tif ( value === true ) {\r\n\r\n\t\t\tthis.pmremVersion ++;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nTexture.DEFAULT_IMAGE = null;\r\nTexture.DEFAULT_MAPPING = UVMapping;\r\nTexture.DEFAULT_ANISOTROPY = 1;\r\n\r\nclass Vector4 {\r\n\r\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\r\n\r\n\t\tVector4.prototype.isVector4 = true;\r\n\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\t\tthis.z = z;\r\n\t\tthis.w = w;\r\n\r\n\t}\r\n\r\n\tget width() {\r\n\r\n\t\treturn this.z;\r\n\r\n\t}\r\n\r\n\tset width( value ) {\r\n\r\n\t\tthis.z = value;\r\n\r\n\t}\r\n\r\n\tget height() {\r\n\r\n\t\treturn this.w;\r\n\r\n\t}\r\n\r\n\tset height( value ) {\r\n\r\n\t\tthis.w = value;\r\n\r\n\t}\r\n\r\n\tset( x, y, z, w ) {\r\n\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\t\tthis.z = z;\r\n\t\tthis.w = w;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetScalar( scalar ) {\r\n\r\n\t\tthis.x = scalar;\r\n\t\tthis.y = scalar;\r\n\t\tthis.z = scalar;\r\n\t\tthis.w = scalar;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetX( x ) {\r\n\r\n\t\tthis.x = x;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetY( y ) {\r\n\r\n\t\tthis.y = y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetZ( z ) {\r\n\r\n\t\tthis.z = z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetW( w ) {\r\n\r\n\t\tthis.w = w;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetComponent( index, value ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: this.x = value; break;\r\n\t\t\tcase 1: this.y = value; break;\r\n\t\t\tcase 2: this.z = value; break;\r\n\t\t\tcase 3: this.w = value; break;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetComponent( index ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: return this.x;\r\n\t\t\tcase 1: return this.y;\r\n\t\t\tcase 2: return this.z;\r\n\t\t\tcase 3: return this.w;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor( this.x, this.y, this.z, this.w );\r\n\r\n\t}\r\n\r\n\tcopy( v ) {\r\n\r\n\t\tthis.x = v.x;\r\n\t\tthis.y = v.y;\r\n\t\tthis.z = v.z;\r\n\t\tthis.w = ( v.w !== undefined ) ? v.w : 1;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tadd( v ) {\r\n\r\n\t\tthis.x += v.x;\r\n\t\tthis.y += v.y;\r\n\t\tthis.z += v.z;\r\n\t\tthis.w += v.w;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\taddScalar( s ) {\r\n\r\n\t\tthis.x += s;\r\n\t\tthis.y += s;\r\n\t\tthis.z += s;\r\n\t\tthis.w += s;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\taddVectors( a, b ) {\r\n\r\n\t\tthis.x = a.x + b.x;\r\n\t\tthis.y = a.y + b.y;\r\n\t\tthis.z = a.z + b.z;\r\n\t\tthis.w = a.w + b.w;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\taddScaledVector( v, s ) {\r\n\r\n\t\tthis.x += v.x * s;\r\n\t\tthis.y += v.y * s;\r\n\t\tthis.z += v.z * s;\r\n\t\tthis.w += v.w * s;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsub( v ) {\r\n\r\n\t\tthis.x -= v.x;\r\n\t\tthis.y -= v.y;\r\n\t\tthis.z -= v.z;\r\n\t\tthis.w -= v.w;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsubScalar( s ) {\r\n\r\n\t\tthis.x -= s;\r\n\t\tthis.y -= s;\r\n\t\tthis.z -= s;\r\n\t\tthis.w -= s;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsubVectors( a, b ) {\r\n\r\n\t\tthis.x = a.x - b.x;\r\n\t\tthis.y = a.y - b.y;\r\n\t\tthis.z = a.z - b.z;\r\n\t\tthis.w = a.w - b.w;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmultiply( v ) {\r\n\r\n\t\tthis.x *= v.x;\r\n\t\tthis.y *= v.y;\r\n\t\tthis.z *= v.z;\r\n\t\tthis.w *= v.w;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmultiplyScalar( scalar ) {\r\n\r\n\t\tthis.x *= scalar;\r\n\t\tthis.y *= scalar;\r\n\t\tthis.z *= scalar;\r\n\t\tthis.w *= scalar;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tapplyMatrix4( m ) {\r\n\r\n\t\tconst x = this.x, y = this.y, z = this.z, w = this.w;\r\n\t\tconst e = m.elements;\r\n\r\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w;\r\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w;\r\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w;\r\n\t\tthis.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdivideScalar( scalar ) {\r\n\r\n\t\treturn this.multiplyScalar( 1 / scalar );\r\n\r\n\t}\r\n\r\n\tsetAxisAngleFromQuaternion( q ) {\r\n\r\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm\r\n\r\n\t\t// q is assumed to be normalized\r\n\r\n\t\tthis.w = 2 * Math.acos( q.w );\r\n\r\n\t\tconst s = Math.sqrt( 1 - q.w * q.w );\r\n\r\n\t\tif ( s < 0.0001 ) {\r\n\r\n\t\t\tthis.x = 1;\r\n\t\t\tthis.y = 0;\r\n\t\t\tthis.z = 0;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.x = q.x / s;\r\n\t\t\tthis.y = q.y / s;\r\n\t\t\tthis.z = q.z / s;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetAxisAngleFromRotationMatrix( m ) {\r\n\r\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm\r\n\r\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\r\n\r\n\t\tlet angle, x, y, z; // variables for result\r\n\t\tconst epsilon = 0.01,\t\t// margin to allow for rounding errors\r\n\t\t\tepsilon2 = 0.1,\t\t// margin to distinguish between 0 and 180 degrees\r\n\r\n\t\t\tte = m.elements,\r\n\r\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\r\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\r\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\r\n\r\n\t\tif ( ( Math.abs( m12 - m21 ) < epsilon ) &&\r\n\t\t ( Math.abs( m13 - m31 ) < epsilon ) &&\r\n\t\t ( Math.abs( m23 - m32 ) < epsilon ) ) {\r\n\r\n\t\t\t// singularity found\r\n\t\t\t// first check for identity matrix which must have +1 for all terms\r\n\t\t\t// in leading diagonal and zero in other terms\r\n\r\n\t\t\tif ( ( Math.abs( m12 + m21 ) < epsilon2 ) &&\r\n\t\t\t ( Math.abs( m13 + m31 ) < epsilon2 ) &&\r\n\t\t\t ( Math.abs( m23 + m32 ) < epsilon2 ) &&\r\n\t\t\t ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {\r\n\r\n\t\t\t\t// this singularity is identity matrix so angle = 0\r\n\r\n\t\t\t\tthis.set( 1, 0, 0, 0 );\r\n\r\n\t\t\t\treturn this; // zero angle, arbitrary axis\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// otherwise this singularity is angle = 180\r\n\r\n\t\t\tangle = Math.PI;\r\n\r\n\t\t\tconst xx = ( m11 + 1 ) / 2;\r\n\t\t\tconst yy = ( m22 + 1 ) / 2;\r\n\t\t\tconst zz = ( m33 + 1 ) / 2;\r\n\t\t\tconst xy = ( m12 + m21 ) / 4;\r\n\t\t\tconst xz = ( m13 + m31 ) / 4;\r\n\t\t\tconst yz = ( m23 + m32 ) / 4;\r\n\r\n\t\t\tif ( ( xx > yy ) && ( xx > zz ) ) {\r\n\r\n\t\t\t\t// m11 is the largest diagonal term\r\n\r\n\t\t\t\tif ( xx < epsilon ) {\r\n\r\n\t\t\t\t\tx = 0;\r\n\t\t\t\t\ty = 0.707106781;\r\n\t\t\t\t\tz = 0.707106781;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tx = Math.sqrt( xx );\r\n\t\t\t\t\ty = xy / x;\r\n\t\t\t\t\tz = xz / x;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( yy > zz ) {\r\n\r\n\t\t\t\t// m22 is the largest diagonal term\r\n\r\n\t\t\t\tif ( yy < epsilon ) {\r\n\r\n\t\t\t\t\tx = 0.707106781;\r\n\t\t\t\t\ty = 0;\r\n\t\t\t\t\tz = 0.707106781;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\ty = Math.sqrt( yy );\r\n\t\t\t\t\tx = xy / y;\r\n\t\t\t\t\tz = yz / y;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// m33 is the largest diagonal term so base result on this\r\n\r\n\t\t\t\tif ( zz < epsilon ) {\r\n\r\n\t\t\t\t\tx = 0.707106781;\r\n\t\t\t\t\ty = 0.707106781;\r\n\t\t\t\t\tz = 0;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tz = Math.sqrt( zz );\r\n\t\t\t\t\tx = xz / z;\r\n\t\t\t\t\ty = yz / z;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.set( x, y, z, angle );\r\n\r\n\t\t\treturn this; // return 180 deg rotation\r\n\r\n\t\t}\r\n\r\n\t\t// as we have reached here there are no singularities so we can handle normally\r\n\r\n\t\tlet s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) +\r\n\t\t\t( m13 - m31 ) * ( m13 - m31 ) +\r\n\t\t\t( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize\r\n\r\n\t\tif ( Math.abs( s ) < 0.001 ) s = 1;\r\n\r\n\t\t// prevent divide by zero, should not happen if matrix is orthogonal and should be\r\n\t\t// caught by singularity test above, but I've left it in just in case\r\n\r\n\t\tthis.x = ( m32 - m23 ) / s;\r\n\t\tthis.y = ( m13 - m31 ) / s;\r\n\t\tthis.z = ( m21 - m12 ) / s;\r\n\t\tthis.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromMatrixPosition( m ) {\r\n\r\n\t\tconst e = m.elements;\r\n\r\n\t\tthis.x = e[ 12 ];\r\n\t\tthis.y = e[ 13 ];\r\n\t\tthis.z = e[ 14 ];\r\n\t\tthis.w = e[ 15 ];\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmin( v ) {\r\n\r\n\t\tthis.x = Math.min( this.x, v.x );\r\n\t\tthis.y = Math.min( this.y, v.y );\r\n\t\tthis.z = Math.min( this.z, v.z );\r\n\t\tthis.w = Math.min( this.w, v.w );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmax( v ) {\r\n\r\n\t\tthis.x = Math.max( this.x, v.x );\r\n\t\tthis.y = Math.max( this.y, v.y );\r\n\t\tthis.z = Math.max( this.z, v.z );\r\n\t\tthis.w = Math.max( this.w, v.w );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclamp( min, max ) {\r\n\r\n\t\t// assumes min < max, componentwise\r\n\r\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\r\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\r\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\r\n\t\tthis.w = Math.max( min.w, Math.min( max.w, this.w ) );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclampScalar( minVal, maxVal ) {\r\n\r\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\r\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\r\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\r\n\t\tthis.w = Math.max( minVal, Math.min( maxVal, this.w ) );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclampLength( min, max ) {\r\n\r\n\t\tconst length = this.length();\r\n\r\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\r\n\r\n\t}\r\n\r\n\tfloor() {\r\n\r\n\t\tthis.x = Math.floor( this.x );\r\n\t\tthis.y = Math.floor( this.y );\r\n\t\tthis.z = Math.floor( this.z );\r\n\t\tthis.w = Math.floor( this.w );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tceil() {\r\n\r\n\t\tthis.x = Math.ceil( this.x );\r\n\t\tthis.y = Math.ceil( this.y );\r\n\t\tthis.z = Math.ceil( this.z );\r\n\t\tthis.w = Math.ceil( this.w );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tround() {\r\n\r\n\t\tthis.x = Math.round( this.x );\r\n\t\tthis.y = Math.round( this.y );\r\n\t\tthis.z = Math.round( this.z );\r\n\t\tthis.w = Math.round( this.w );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\troundToZero() {\r\n\r\n\t\tthis.x = Math.trunc( this.x );\r\n\t\tthis.y = Math.trunc( this.y );\r\n\t\tthis.z = Math.trunc( this.z );\r\n\t\tthis.w = Math.trunc( this.w );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tnegate() {\r\n\r\n\t\tthis.x = - this.x;\r\n\t\tthis.y = - this.y;\r\n\t\tthis.z = - this.z;\r\n\t\tthis.w = - this.w;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdot( v ) {\r\n\r\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;\r\n\r\n\t}\r\n\r\n\tlengthSq() {\r\n\r\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\r\n\r\n\t}\r\n\r\n\tlength() {\r\n\r\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\r\n\r\n\t}\r\n\r\n\tmanhattanLength() {\r\n\r\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w );\r\n\r\n\t}\r\n\r\n\tnormalize() {\r\n\r\n\t\treturn this.divideScalar( this.length() || 1 );\r\n\r\n\t}\r\n\r\n\tsetLength( length ) {\r\n\r\n\t\treturn this.normalize().multiplyScalar( length );\r\n\r\n\t}\r\n\r\n\tlerp( v, alpha ) {\r\n\r\n\t\tthis.x += ( v.x - this.x ) * alpha;\r\n\t\tthis.y += ( v.y - this.y ) * alpha;\r\n\t\tthis.z += ( v.z - this.z ) * alpha;\r\n\t\tthis.w += ( v.w - this.w ) * alpha;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tlerpVectors( v1, v2, alpha ) {\r\n\r\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\r\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\r\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\r\n\t\tthis.w = v1.w + ( v2.w - v1.w ) * alpha;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tequals( v ) {\r\n\r\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) );\r\n\r\n\t}\r\n\r\n\tfromArray( array, offset = 0 ) {\r\n\r\n\t\tthis.x = array[ offset ];\r\n\t\tthis.y = array[ offset + 1 ];\r\n\t\tthis.z = array[ offset + 2 ];\r\n\t\tthis.w = array[ offset + 3 ];\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoArray( array = [], offset = 0 ) {\r\n\r\n\t\tarray[ offset ] = this.x;\r\n\t\tarray[ offset + 1 ] = this.y;\r\n\t\tarray[ offset + 2 ] = this.z;\r\n\t\tarray[ offset + 3 ] = this.w;\r\n\r\n\t\treturn array;\r\n\r\n\t}\r\n\r\n\tfromBufferAttribute( attribute, index ) {\r\n\r\n\t\tthis.x = attribute.getX( index );\r\n\t\tthis.y = attribute.getY( index );\r\n\t\tthis.z = attribute.getZ( index );\r\n\t\tthis.w = attribute.getW( index );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\trandom() {\r\n\r\n\t\tthis.x = Math.random();\r\n\t\tthis.y = Math.random();\r\n\t\tthis.z = Math.random();\r\n\t\tthis.w = Math.random();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t*[ Symbol.iterator ]() {\r\n\r\n\t\tyield this.x;\r\n\t\tyield this.y;\r\n\t\tyield this.z;\r\n\t\tyield this.w;\r\n\r\n\t}\r\n\r\n}\r\n\r\n/*\r\n In options, we can specify:\r\n * Texture parameters for an auto-generated target texture\r\n * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers\r\n*/\r\nclass RenderTarget extends EventDispatcher {\r\n\r\n\tconstructor( width = 1, height = 1, options = {} ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isRenderTarget = true;\r\n\r\n\t\tthis.width = width;\r\n\t\tthis.height = height;\r\n\t\tthis.depth = 1;\r\n\r\n\t\tthis.scissor = new Vector4( 0, 0, width, height );\r\n\t\tthis.scissorTest = false;\r\n\r\n\t\tthis.viewport = new Vector4( 0, 0, width, height );\r\n\r\n\t\tconst image = { width: width, height: height, depth: 1 };\r\n\r\n\t\toptions = Object.assign( {\r\n\t\t\tgenerateMipmaps: false,\r\n\t\t\tinternalFormat: null,\r\n\t\t\tminFilter: LinearFilter,\r\n\t\t\tdepthBuffer: true,\r\n\t\t\tstencilBuffer: false,\r\n\t\t\tresolveDepthBuffer: true,\r\n\t\t\tresolveStencilBuffer: true,\r\n\t\t\tdepthTexture: null,\r\n\t\t\tsamples: 0,\r\n\t\t\tcount: 1\r\n\t\t}, options );\r\n\r\n\t\tconst texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );\r\n\r\n\t\ttexture.flipY = false;\r\n\t\ttexture.generateMipmaps = options.generateMipmaps;\r\n\t\ttexture.internalFormat = options.internalFormat;\r\n\r\n\t\tthis.textures = [];\r\n\r\n\t\tconst count = options.count;\r\n\t\tfor ( let i = 0; i < count; i ++ ) {\r\n\r\n\t\t\tthis.textures[ i ] = texture.clone();\r\n\t\t\tthis.textures[ i ].isRenderTargetTexture = true;\r\n\r\n\t\t}\r\n\r\n\t\tthis.depthBuffer = options.depthBuffer;\r\n\t\tthis.stencilBuffer = options.stencilBuffer;\r\n\r\n\t\tthis.resolveDepthBuffer = options.resolveDepthBuffer;\r\n\t\tthis.resolveStencilBuffer = options.resolveStencilBuffer;\r\n\r\n\t\tthis.depthTexture = options.depthTexture;\r\n\r\n\t\tthis.samples = options.samples;\r\n\r\n\t}\r\n\r\n\tget texture() {\r\n\r\n\t\treturn this.textures[ 0 ];\r\n\r\n\t}\r\n\r\n\tset texture( value ) {\r\n\r\n\t\tthis.textures[ 0 ] = value;\r\n\r\n\t}\r\n\r\n\tsetSize( width, height, depth = 1 ) {\r\n\r\n\t\tif ( this.width !== width || this.height !== height || this.depth !== depth ) {\r\n\r\n\t\t\tthis.width = width;\r\n\t\t\tthis.height = height;\r\n\t\t\tthis.depth = depth;\r\n\r\n\t\t\tfor ( let i = 0, il = this.textures.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tthis.textures[ i ].image.width = width;\r\n\t\t\t\tthis.textures[ i ].image.height = height;\r\n\t\t\t\tthis.textures[ i ].image.depth = depth;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.dispose();\r\n\r\n\t\t}\r\n\r\n\t\tthis.viewport.set( 0, 0, width, height );\r\n\t\tthis.scissor.set( 0, 0, width, height );\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.width = source.width;\r\n\t\tthis.height = source.height;\r\n\t\tthis.depth = source.depth;\r\n\r\n\t\tthis.scissor.copy( source.scissor );\r\n\t\tthis.scissorTest = source.scissorTest;\r\n\r\n\t\tthis.viewport.copy( source.viewport );\r\n\r\n\t\tthis.textures.length = 0;\r\n\r\n\t\tfor ( let i = 0, il = source.textures.length; i < il; i ++ ) {\r\n\r\n\t\t\tthis.textures[ i ] = source.textures[ i ].clone();\r\n\t\t\tthis.textures[ i ].isRenderTargetTexture = true;\r\n\r\n\t\t}\r\n\r\n\t\t// ensure image object is not shared, see #20328\r\n\r\n\t\tconst image = Object.assign( {}, source.texture.image );\r\n\t\tthis.texture.source = new Source( image );\r\n\r\n\t\tthis.depthBuffer = source.depthBuffer;\r\n\t\tthis.stencilBuffer = source.stencilBuffer;\r\n\r\n\t\tthis.resolveDepthBuffer = source.resolveDepthBuffer;\r\n\t\tthis.resolveStencilBuffer = source.resolveStencilBuffer;\r\n\r\n\t\tif ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();\r\n\r\n\t\tthis.samples = source.samples;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.dispatchEvent( { type: 'dispose' } );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass WebGLRenderTarget extends RenderTarget {\r\n\r\n\tconstructor( width = 1, height = 1, options = {} ) {\r\n\r\n\t\tsuper( width, height, options );\r\n\r\n\t\tthis.isWebGLRenderTarget = true;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass DataArrayTexture extends Texture {\r\n\r\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\r\n\r\n\t\tsuper( null );\r\n\r\n\t\tthis.isDataArrayTexture = true;\r\n\r\n\t\tthis.image = { data, width, height, depth };\r\n\r\n\t\tthis.magFilter = NearestFilter;\r\n\t\tthis.minFilter = NearestFilter;\r\n\r\n\t\tthis.wrapR = ClampToEdgeWrapping;\r\n\r\n\t\tthis.generateMipmaps = false;\r\n\t\tthis.flipY = false;\r\n\t\tthis.unpackAlignment = 1;\r\n\r\n\t\tthis.layerUpdates = new Set();\r\n\r\n\t}\r\n\r\n\taddLayerUpdate( layerIndex ) {\r\n\r\n\t\tthis.layerUpdates.add( layerIndex );\r\n\r\n\t}\r\n\r\n\tclearLayerUpdates() {\r\n\r\n\t\tthis.layerUpdates.clear();\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass WebGLArrayRenderTarget extends WebGLRenderTarget {\r\n\r\n\tconstructor( width = 1, height = 1, depth = 1, options = {} ) {\r\n\r\n\t\tsuper( width, height, options );\r\n\r\n\t\tthis.isWebGLArrayRenderTarget = true;\r\n\r\n\t\tthis.depth = depth;\r\n\r\n\t\tthis.texture = new DataArrayTexture( null, width, height, depth );\r\n\r\n\t\tthis.texture.isRenderTargetTexture = true;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Data3DTexture extends Texture {\r\n\r\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\r\n\r\n\t\t// We're going to add .setXXX() methods for setting properties later.\r\n\t\t// Users can still set in DataTexture3D directly.\r\n\t\t//\r\n\t\t//\tconst texture = new THREE.DataTexture3D( data, width, height, depth );\r\n\t\t// \ttexture.anisotropy = 16;\r\n\t\t//\r\n\t\t// See #14839\r\n\r\n\t\tsuper( null );\r\n\r\n\t\tthis.isData3DTexture = true;\r\n\r\n\t\tthis.image = { data, width, height, depth };\r\n\r\n\t\tthis.magFilter = NearestFilter;\r\n\t\tthis.minFilter = NearestFilter;\r\n\r\n\t\tthis.wrapR = ClampToEdgeWrapping;\r\n\r\n\t\tthis.generateMipmaps = false;\r\n\t\tthis.flipY = false;\r\n\t\tthis.unpackAlignment = 1;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass WebGL3DRenderTarget extends WebGLRenderTarget {\r\n\r\n\tconstructor( width = 1, height = 1, depth = 1, options = {} ) {\r\n\r\n\t\tsuper( width, height, options );\r\n\r\n\t\tthis.isWebGL3DRenderTarget = true;\r\n\r\n\t\tthis.depth = depth;\r\n\r\n\t\tthis.texture = new Data3DTexture( null, width, height, depth );\r\n\r\n\t\tthis.texture.isRenderTargetTexture = true;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Quaternion {\r\n\r\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\r\n\r\n\t\tthis.isQuaternion = true;\r\n\r\n\t\tthis._x = x;\r\n\t\tthis._y = y;\r\n\t\tthis._z = z;\r\n\t\tthis._w = w;\r\n\r\n\t}\r\n\r\n\tstatic slerpFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) {\r\n\r\n\t\t// fuzz-free, array-based Quaternion SLERP operation\r\n\r\n\t\tlet x0 = src0[ srcOffset0 + 0 ],\r\n\t\t\ty0 = src0[ srcOffset0 + 1 ],\r\n\t\t\tz0 = src0[ srcOffset0 + 2 ],\r\n\t\t\tw0 = src0[ srcOffset0 + 3 ];\r\n\r\n\t\tconst x1 = src1[ srcOffset1 + 0 ],\r\n\t\t\ty1 = src1[ srcOffset1 + 1 ],\r\n\t\t\tz1 = src1[ srcOffset1 + 2 ],\r\n\t\t\tw1 = src1[ srcOffset1 + 3 ];\r\n\r\n\t\tif ( t === 0 ) {\r\n\r\n\t\t\tdst[ dstOffset + 0 ] = x0;\r\n\t\t\tdst[ dstOffset + 1 ] = y0;\r\n\t\t\tdst[ dstOffset + 2 ] = z0;\r\n\t\t\tdst[ dstOffset + 3 ] = w0;\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tif ( t === 1 ) {\r\n\r\n\t\t\tdst[ dstOffset + 0 ] = x1;\r\n\t\t\tdst[ dstOffset + 1 ] = y1;\r\n\t\t\tdst[ dstOffset + 2 ] = z1;\r\n\t\t\tdst[ dstOffset + 3 ] = w1;\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tif ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) {\r\n\r\n\t\t\tlet s = 1 - t;\r\n\t\t\tconst cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,\r\n\t\t\t\tdir = ( cos >= 0 ? 1 : - 1 ),\r\n\t\t\t\tsqrSin = 1 - cos * cos;\r\n\r\n\t\t\t// Skip the Slerp for tiny steps to avoid numeric problems:\r\n\t\t\tif ( sqrSin > Number.EPSILON ) {\r\n\r\n\t\t\t\tconst sin = Math.sqrt( sqrSin ),\r\n\t\t\t\t\tlen = Math.atan2( sin, cos * dir );\r\n\r\n\t\t\t\ts = Math.sin( s * len ) / sin;\r\n\t\t\t\tt = Math.sin( t * len ) / sin;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst tDir = t * dir;\r\n\r\n\t\t\tx0 = x0 * s + x1 * tDir;\r\n\t\t\ty0 = y0 * s + y1 * tDir;\r\n\t\t\tz0 = z0 * s + z1 * tDir;\r\n\t\t\tw0 = w0 * s + w1 * tDir;\r\n\r\n\t\t\t// Normalize in case we just did a lerp:\r\n\t\t\tif ( s === 1 - t ) {\r\n\r\n\t\t\t\tconst f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 );\r\n\r\n\t\t\t\tx0 *= f;\r\n\t\t\t\ty0 *= f;\r\n\t\t\t\tz0 *= f;\r\n\t\t\t\tw0 *= f;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tdst[ dstOffset ] = x0;\r\n\t\tdst[ dstOffset + 1 ] = y0;\r\n\t\tdst[ dstOffset + 2 ] = z0;\r\n\t\tdst[ dstOffset + 3 ] = w0;\r\n\r\n\t}\r\n\r\n\tstatic multiplyQuaternionsFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1 ) {\r\n\r\n\t\tconst x0 = src0[ srcOffset0 ];\r\n\t\tconst y0 = src0[ srcOffset0 + 1 ];\r\n\t\tconst z0 = src0[ srcOffset0 + 2 ];\r\n\t\tconst w0 = src0[ srcOffset0 + 3 ];\r\n\r\n\t\tconst x1 = src1[ srcOffset1 ];\r\n\t\tconst y1 = src1[ srcOffset1 + 1 ];\r\n\t\tconst z1 = src1[ srcOffset1 + 2 ];\r\n\t\tconst w1 = src1[ srcOffset1 + 3 ];\r\n\r\n\t\tdst[ dstOffset ] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;\r\n\t\tdst[ dstOffset + 1 ] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;\r\n\t\tdst[ dstOffset + 2 ] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;\r\n\t\tdst[ dstOffset + 3 ] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;\r\n\r\n\t\treturn dst;\r\n\r\n\t}\r\n\r\n\tget x() {\r\n\r\n\t\treturn this._x;\r\n\r\n\t}\r\n\r\n\tset x( value ) {\r\n\r\n\t\tthis._x = value;\r\n\t\tthis._onChangeCallback();\r\n\r\n\t}\r\n\r\n\tget y() {\r\n\r\n\t\treturn this._y;\r\n\r\n\t}\r\n\r\n\tset y( value ) {\r\n\r\n\t\tthis._y = value;\r\n\t\tthis._onChangeCallback();\r\n\r\n\t}\r\n\r\n\tget z() {\r\n\r\n\t\treturn this._z;\r\n\r\n\t}\r\n\r\n\tset z( value ) {\r\n\r\n\t\tthis._z = value;\r\n\t\tthis._onChangeCallback();\r\n\r\n\t}\r\n\r\n\tget w() {\r\n\r\n\t\treturn this._w;\r\n\r\n\t}\r\n\r\n\tset w( value ) {\r\n\r\n\t\tthis._w = value;\r\n\t\tthis._onChangeCallback();\r\n\r\n\t}\r\n\r\n\tset( x, y, z, w ) {\r\n\r\n\t\tthis._x = x;\r\n\t\tthis._y = y;\r\n\t\tthis._z = z;\r\n\t\tthis._w = w;\r\n\r\n\t\tthis._onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor( this._x, this._y, this._z, this._w );\r\n\r\n\t}\r\n\r\n\tcopy( quaternion ) {\r\n\r\n\t\tthis._x = quaternion.x;\r\n\t\tthis._y = quaternion.y;\r\n\t\tthis._z = quaternion.z;\r\n\t\tthis._w = quaternion.w;\r\n\r\n\t\tthis._onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromEuler( euler, update = true ) {\r\n\r\n\t\tconst x = euler._x, y = euler._y, z = euler._z, order = euler._order;\r\n\r\n\t\t// http://www.mathworks.com/matlabcentral/fileexchange/\r\n\t\t// \t20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\r\n\t\t//\tcontent/SpinCalc.m\r\n\r\n\t\tconst cos = Math.cos;\r\n\t\tconst sin = Math.sin;\r\n\r\n\t\tconst c1 = cos( x / 2 );\r\n\t\tconst c2 = cos( y / 2 );\r\n\t\tconst c3 = cos( z / 2 );\r\n\r\n\t\tconst s1 = sin( x / 2 );\r\n\t\tconst s2 = sin( y / 2 );\r\n\t\tconst s3 = sin( z / 2 );\r\n\r\n\t\tswitch ( order ) {\r\n\r\n\t\t\tcase 'XYZ':\r\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\r\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\r\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\r\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'YXZ':\r\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\r\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\r\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\r\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'ZXY':\r\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\r\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\r\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\r\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'ZYX':\r\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\r\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\r\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\r\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'YZX':\r\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\r\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\r\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\r\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'XZY':\r\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\r\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\r\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\r\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tdefault:\r\n\t\t\t\tconsole.warn( 'THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order );\r\n\r\n\t\t}\r\n\r\n\t\tif ( update === true ) this._onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromAxisAngle( axis, angle ) {\r\n\r\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\r\n\r\n\t\t// assumes axis is normalized\r\n\r\n\t\tconst halfAngle = angle / 2, s = Math.sin( halfAngle );\r\n\r\n\t\tthis._x = axis.x * s;\r\n\t\tthis._y = axis.y * s;\r\n\t\tthis._z = axis.z * s;\r\n\t\tthis._w = Math.cos( halfAngle );\r\n\r\n\t\tthis._onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromRotationMatrix( m ) {\r\n\r\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm\r\n\r\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\r\n\r\n\t\tconst te = m.elements,\r\n\r\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\r\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\r\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ],\r\n\r\n\t\t\ttrace = m11 + m22 + m33;\r\n\r\n\t\tif ( trace > 0 ) {\r\n\r\n\t\t\tconst s = 0.5 / Math.sqrt( trace + 1.0 );\r\n\r\n\t\t\tthis._w = 0.25 / s;\r\n\t\t\tthis._x = ( m32 - m23 ) * s;\r\n\t\t\tthis._y = ( m13 - m31 ) * s;\r\n\t\t\tthis._z = ( m21 - m12 ) * s;\r\n\r\n\t\t} else if ( m11 > m22 && m11 > m33 ) {\r\n\r\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 );\r\n\r\n\t\t\tthis._w = ( m32 - m23 ) / s;\r\n\t\t\tthis._x = 0.25 * s;\r\n\t\t\tthis._y = ( m12 + m21 ) / s;\r\n\t\t\tthis._z = ( m13 + m31 ) / s;\r\n\r\n\t\t} else if ( m22 > m33 ) {\r\n\r\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 );\r\n\r\n\t\t\tthis._w = ( m13 - m31 ) / s;\r\n\t\t\tthis._x = ( m12 + m21 ) / s;\r\n\t\t\tthis._y = 0.25 * s;\r\n\t\t\tthis._z = ( m23 + m32 ) / s;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 );\r\n\r\n\t\t\tthis._w = ( m21 - m12 ) / s;\r\n\t\t\tthis._x = ( m13 + m31 ) / s;\r\n\t\t\tthis._y = ( m23 + m32 ) / s;\r\n\t\t\tthis._z = 0.25 * s;\r\n\r\n\t\t}\r\n\r\n\t\tthis._onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromUnitVectors( vFrom, vTo ) {\r\n\r\n\t\t// assumes direction vectors vFrom and vTo are normalized\r\n\r\n\t\tlet r = vFrom.dot( vTo ) + 1;\r\n\r\n\t\tif ( r < Number.EPSILON ) {\r\n\r\n\t\t\t// vFrom and vTo point in opposite directions\r\n\r\n\t\t\tr = 0;\r\n\r\n\t\t\tif ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\r\n\r\n\t\t\t\tthis._x = - vFrom.y;\r\n\t\t\t\tthis._y = vFrom.x;\r\n\t\t\t\tthis._z = 0;\r\n\t\t\t\tthis._w = r;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis._x = 0;\r\n\t\t\t\tthis._y = - vFrom.z;\r\n\t\t\t\tthis._z = vFrom.y;\r\n\t\t\t\tthis._w = r;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3\r\n\r\n\t\t\tthis._x = vFrom.y * vTo.z - vFrom.z * vTo.y;\r\n\t\t\tthis._y = vFrom.z * vTo.x - vFrom.x * vTo.z;\r\n\t\t\tthis._z = vFrom.x * vTo.y - vFrom.y * vTo.x;\r\n\t\t\tthis._w = r;\r\n\r\n\t\t}\r\n\r\n\t\treturn this.normalize();\r\n\r\n\t}\r\n\r\n\tangleTo( q ) {\r\n\r\n\t\treturn 2 * Math.acos( Math.abs( clamp( this.dot( q ), - 1, 1 ) ) );\r\n\r\n\t}\r\n\r\n\trotateTowards( q, step ) {\r\n\r\n\t\tconst angle = this.angleTo( q );\r\n\r\n\t\tif ( angle === 0 ) return this;\r\n\r\n\t\tconst t = Math.min( 1, step / angle );\r\n\r\n\t\tthis.slerp( q, t );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tidentity() {\r\n\r\n\t\treturn this.set( 0, 0, 0, 1 );\r\n\r\n\t}\r\n\r\n\tinvert() {\r\n\r\n\t\t// quaternion is assumed to have unit length\r\n\r\n\t\treturn this.conjugate();\r\n\r\n\t}\r\n\r\n\tconjugate() {\r\n\r\n\t\tthis._x *= - 1;\r\n\t\tthis._y *= - 1;\r\n\t\tthis._z *= - 1;\r\n\r\n\t\tthis._onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdot( v ) {\r\n\r\n\t\treturn this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;\r\n\r\n\t}\r\n\r\n\tlengthSq() {\r\n\r\n\t\treturn this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\r\n\r\n\t}\r\n\r\n\tlength() {\r\n\r\n\t\treturn Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w );\r\n\r\n\t}\r\n\r\n\tnormalize() {\r\n\r\n\t\tlet l = this.length();\r\n\r\n\t\tif ( l === 0 ) {\r\n\r\n\t\t\tthis._x = 0;\r\n\t\t\tthis._y = 0;\r\n\t\t\tthis._z = 0;\r\n\t\t\tthis._w = 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tl = 1 / l;\r\n\r\n\t\t\tthis._x = this._x * l;\r\n\t\t\tthis._y = this._y * l;\r\n\t\t\tthis._z = this._z * l;\r\n\t\t\tthis._w = this._w * l;\r\n\r\n\t\t}\r\n\r\n\t\tthis._onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmultiply( q ) {\r\n\r\n\t\treturn this.multiplyQuaternions( this, q );\r\n\r\n\t}\r\n\r\n\tpremultiply( q ) {\r\n\r\n\t\treturn this.multiplyQuaternions( q, this );\r\n\r\n\t}\r\n\r\n\tmultiplyQuaternions( a, b ) {\r\n\r\n\t\t// from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\r\n\r\n\t\tconst qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;\r\n\t\tconst qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;\r\n\r\n\t\tthis._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\r\n\t\tthis._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\r\n\t\tthis._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\r\n\t\tthis._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\r\n\r\n\t\tthis._onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tslerp( qb, t ) {\r\n\r\n\t\tif ( t === 0 ) return this;\r\n\t\tif ( t === 1 ) return this.copy( qb );\r\n\r\n\t\tconst x = this._x, y = this._y, z = this._z, w = this._w;\r\n\r\n\t\t// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\r\n\r\n\t\tlet cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;\r\n\r\n\t\tif ( cosHalfTheta < 0 ) {\r\n\r\n\t\t\tthis._w = - qb._w;\r\n\t\t\tthis._x = - qb._x;\r\n\t\t\tthis._y = - qb._y;\r\n\t\t\tthis._z = - qb._z;\r\n\r\n\t\t\tcosHalfTheta = - cosHalfTheta;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.copy( qb );\r\n\r\n\t\t}\r\n\r\n\t\tif ( cosHalfTheta >= 1.0 ) {\r\n\r\n\t\t\tthis._w = w;\r\n\t\t\tthis._x = x;\r\n\t\t\tthis._y = y;\r\n\t\t\tthis._z = z;\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tconst sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;\r\n\r\n\t\tif ( sqrSinHalfTheta <= Number.EPSILON ) {\r\n\r\n\t\t\tconst s = 1 - t;\r\n\t\t\tthis._w = s * w + t * this._w;\r\n\t\t\tthis._x = s * x + t * this._x;\r\n\t\t\tthis._y = s * y + t * this._y;\r\n\t\t\tthis._z = s * z + t * this._z;\r\n\r\n\t\t\tthis.normalize(); // normalize calls _onChangeCallback()\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tconst sinHalfTheta = Math.sqrt( sqrSinHalfTheta );\r\n\t\tconst halfTheta = Math.atan2( sinHalfTheta, cosHalfTheta );\r\n\t\tconst ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\r\n\t\t\tratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\r\n\r\n\t\tthis._w = ( w * ratioA + this._w * ratioB );\r\n\t\tthis._x = ( x * ratioA + this._x * ratioB );\r\n\t\tthis._y = ( y * ratioA + this._y * ratioB );\r\n\t\tthis._z = ( z * ratioA + this._z * ratioB );\r\n\r\n\t\tthis._onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tslerpQuaternions( qa, qb, t ) {\r\n\r\n\t\treturn this.copy( qa ).slerp( qb, t );\r\n\r\n\t}\r\n\r\n\trandom() {\r\n\r\n\t\t// sets this quaternion to a uniform random unit quaternnion\r\n\r\n\t\t// Ken Shoemake\r\n\t\t// Uniform random rotations\r\n\t\t// D. Kirk, editor, Graphics Gems III, pages 124-132. Academic Press, New York, 1992.\r\n\r\n\t\tconst theta1 = 2 * Math.PI * Math.random();\r\n\t\tconst theta2 = 2 * Math.PI * Math.random();\r\n\r\n\t\tconst x0 = Math.random();\r\n\t\tconst r1 = Math.sqrt( 1 - x0 );\r\n\t\tconst r2 = Math.sqrt( x0 );\r\n\r\n\t\treturn this.set(\r\n\t\t\tr1 * Math.sin( theta1 ),\r\n\t\t\tr1 * Math.cos( theta1 ),\r\n\t\t\tr2 * Math.sin( theta2 ),\r\n\t\t\tr2 * Math.cos( theta2 ),\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tequals( quaternion ) {\r\n\r\n\t\treturn ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w );\r\n\r\n\t}\r\n\r\n\tfromArray( array, offset = 0 ) {\r\n\r\n\t\tthis._x = array[ offset ];\r\n\t\tthis._y = array[ offset + 1 ];\r\n\t\tthis._z = array[ offset + 2 ];\r\n\t\tthis._w = array[ offset + 3 ];\r\n\r\n\t\tthis._onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoArray( array = [], offset = 0 ) {\r\n\r\n\t\tarray[ offset ] = this._x;\r\n\t\tarray[ offset + 1 ] = this._y;\r\n\t\tarray[ offset + 2 ] = this._z;\r\n\t\tarray[ offset + 3 ] = this._w;\r\n\r\n\t\treturn array;\r\n\r\n\t}\r\n\r\n\tfromBufferAttribute( attribute, index ) {\r\n\r\n\t\tthis._x = attribute.getX( index );\r\n\t\tthis._y = attribute.getY( index );\r\n\t\tthis._z = attribute.getZ( index );\r\n\t\tthis._w = attribute.getW( index );\r\n\r\n\t\tthis._onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\treturn this.toArray();\r\n\r\n\t}\r\n\r\n\t_onChange( callback ) {\r\n\r\n\t\tthis._onChangeCallback = callback;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t_onChangeCallback() {}\r\n\r\n\t*[ Symbol.iterator ]() {\r\n\r\n\t\tyield this._x;\r\n\t\tyield this._y;\r\n\t\tyield this._z;\r\n\t\tyield this._w;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Vector3 {\r\n\r\n\tconstructor( x = 0, y = 0, z = 0 ) {\r\n\r\n\t\tVector3.prototype.isVector3 = true;\r\n\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\t\tthis.z = z;\r\n\r\n\t}\r\n\r\n\tset( x, y, z ) {\r\n\r\n\t\tif ( z === undefined ) z = this.z; // sprite.scale.set(x,y)\r\n\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\t\tthis.z = z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetScalar( scalar ) {\r\n\r\n\t\tthis.x = scalar;\r\n\t\tthis.y = scalar;\r\n\t\tthis.z = scalar;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetX( x ) {\r\n\r\n\t\tthis.x = x;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetY( y ) {\r\n\r\n\t\tthis.y = y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetZ( z ) {\r\n\r\n\t\tthis.z = z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetComponent( index, value ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: this.x = value; break;\r\n\t\t\tcase 1: this.y = value; break;\r\n\t\t\tcase 2: this.z = value; break;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetComponent( index ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: return this.x;\r\n\t\t\tcase 1: return this.y;\r\n\t\t\tcase 2: return this.z;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor( this.x, this.y, this.z );\r\n\r\n\t}\r\n\r\n\tcopy( v ) {\r\n\r\n\t\tthis.x = v.x;\r\n\t\tthis.y = v.y;\r\n\t\tthis.z = v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tadd( v ) {\r\n\r\n\t\tthis.x += v.x;\r\n\t\tthis.y += v.y;\r\n\t\tthis.z += v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\taddScalar( s ) {\r\n\r\n\t\tthis.x += s;\r\n\t\tthis.y += s;\r\n\t\tthis.z += s;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\taddVectors( a, b ) {\r\n\r\n\t\tthis.x = a.x + b.x;\r\n\t\tthis.y = a.y + b.y;\r\n\t\tthis.z = a.z + b.z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\taddScaledVector( v, s ) {\r\n\r\n\t\tthis.x += v.x * s;\r\n\t\tthis.y += v.y * s;\r\n\t\tthis.z += v.z * s;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsub( v ) {\r\n\r\n\t\tthis.x -= v.x;\r\n\t\tthis.y -= v.y;\r\n\t\tthis.z -= v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsubScalar( s ) {\r\n\r\n\t\tthis.x -= s;\r\n\t\tthis.y -= s;\r\n\t\tthis.z -= s;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsubVectors( a, b ) {\r\n\r\n\t\tthis.x = a.x - b.x;\r\n\t\tthis.y = a.y - b.y;\r\n\t\tthis.z = a.z - b.z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmultiply( v ) {\r\n\r\n\t\tthis.x *= v.x;\r\n\t\tthis.y *= v.y;\r\n\t\tthis.z *= v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmultiplyScalar( scalar ) {\r\n\r\n\t\tthis.x *= scalar;\r\n\t\tthis.y *= scalar;\r\n\t\tthis.z *= scalar;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmultiplyVectors( a, b ) {\r\n\r\n\t\tthis.x = a.x * b.x;\r\n\t\tthis.y = a.y * b.y;\r\n\t\tthis.z = a.z * b.z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tapplyEuler( euler ) {\r\n\r\n\t\treturn this.applyQuaternion( _quaternion$4.setFromEuler( euler ) );\r\n\r\n\t}\r\n\r\n\tapplyAxisAngle( axis, angle ) {\r\n\r\n\t\treturn this.applyQuaternion( _quaternion$4.setFromAxisAngle( axis, angle ) );\r\n\r\n\t}\r\n\r\n\tapplyMatrix3( m ) {\r\n\r\n\t\tconst x = this.x, y = this.y, z = this.z;\r\n\t\tconst e = m.elements;\r\n\r\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z;\r\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z;\r\n\t\tthis.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tapplyNormalMatrix( m ) {\r\n\r\n\t\treturn this.applyMatrix3( m ).normalize();\r\n\r\n\t}\r\n\r\n\tapplyMatrix4( m ) {\r\n\r\n\t\tconst x = this.x, y = this.y, z = this.z;\r\n\t\tconst e = m.elements;\r\n\r\n\t\tconst w = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] );\r\n\r\n\t\tthis.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * w;\r\n\t\tthis.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * w;\r\n\t\tthis.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * w;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tapplyQuaternion( q ) {\r\n\r\n\t\t// quaternion q is assumed to have unit length\r\n\r\n\t\tconst vx = this.x, vy = this.y, vz = this.z;\r\n\t\tconst qx = q.x, qy = q.y, qz = q.z, qw = q.w;\r\n\r\n\t\t// t = 2 * cross( q.xyz, v );\r\n\t\tconst tx = 2 * ( qy * vz - qz * vy );\r\n\t\tconst ty = 2 * ( qz * vx - qx * vz );\r\n\t\tconst tz = 2 * ( qx * vy - qy * vx );\r\n\r\n\t\t// v + q.w * t + cross( q.xyz, t );\r\n\t\tthis.x = vx + qw * tx + qy * tz - qz * ty;\r\n\t\tthis.y = vy + qw * ty + qz * tx - qx * tz;\r\n\t\tthis.z = vz + qw * tz + qx * ty - qy * tx;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tproject( camera ) {\r\n\r\n\t\treturn this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix );\r\n\r\n\t}\r\n\r\n\tunproject( camera ) {\r\n\r\n\t\treturn this.applyMatrix4( camera.projectionMatrixInverse ).applyMatrix4( camera.matrixWorld );\r\n\r\n\t}\r\n\r\n\ttransformDirection( m ) {\r\n\r\n\t\t// input: THREE.Matrix4 affine matrix\r\n\t\t// vector interpreted as a direction\r\n\r\n\t\tconst x = this.x, y = this.y, z = this.z;\r\n\t\tconst e = m.elements;\r\n\r\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z;\r\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z;\r\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z;\r\n\r\n\t\treturn this.normalize();\r\n\r\n\t}\r\n\r\n\tdivide( v ) {\r\n\r\n\t\tthis.x /= v.x;\r\n\t\tthis.y /= v.y;\r\n\t\tthis.z /= v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdivideScalar( scalar ) {\r\n\r\n\t\treturn this.multiplyScalar( 1 / scalar );\r\n\r\n\t}\r\n\r\n\tmin( v ) {\r\n\r\n\t\tthis.x = Math.min( this.x, v.x );\r\n\t\tthis.y = Math.min( this.y, v.y );\r\n\t\tthis.z = Math.min( this.z, v.z );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmax( v ) {\r\n\r\n\t\tthis.x = Math.max( this.x, v.x );\r\n\t\tthis.y = Math.max( this.y, v.y );\r\n\t\tthis.z = Math.max( this.z, v.z );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclamp( min, max ) {\r\n\r\n\t\t// assumes min < max, componentwise\r\n\r\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\r\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\r\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclampScalar( minVal, maxVal ) {\r\n\r\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\r\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\r\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclampLength( min, max ) {\r\n\r\n\t\tconst length = this.length();\r\n\r\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\r\n\r\n\t}\r\n\r\n\tfloor() {\r\n\r\n\t\tthis.x = Math.floor( this.x );\r\n\t\tthis.y = Math.floor( this.y );\r\n\t\tthis.z = Math.floor( this.z );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tceil() {\r\n\r\n\t\tthis.x = Math.ceil( this.x );\r\n\t\tthis.y = Math.ceil( this.y );\r\n\t\tthis.z = Math.ceil( this.z );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tround() {\r\n\r\n\t\tthis.x = Math.round( this.x );\r\n\t\tthis.y = Math.round( this.y );\r\n\t\tthis.z = Math.round( this.z );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\troundToZero() {\r\n\r\n\t\tthis.x = Math.trunc( this.x );\r\n\t\tthis.y = Math.trunc( this.y );\r\n\t\tthis.z = Math.trunc( this.z );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tnegate() {\r\n\r\n\t\tthis.x = - this.x;\r\n\t\tthis.y = - this.y;\r\n\t\tthis.z = - this.z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdot( v ) {\r\n\r\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z;\r\n\r\n\t}\r\n\r\n\t// TODO lengthSquared?\r\n\r\n\tlengthSq() {\r\n\r\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z;\r\n\r\n\t}\r\n\r\n\tlength() {\r\n\r\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\r\n\r\n\t}\r\n\r\n\tmanhattanLength() {\r\n\r\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );\r\n\r\n\t}\r\n\r\n\tnormalize() {\r\n\r\n\t\treturn this.divideScalar( this.length() || 1 );\r\n\r\n\t}\r\n\r\n\tsetLength( length ) {\r\n\r\n\t\treturn this.normalize().multiplyScalar( length );\r\n\r\n\t}\r\n\r\n\tlerp( v, alpha ) {\r\n\r\n\t\tthis.x += ( v.x - this.x ) * alpha;\r\n\t\tthis.y += ( v.y - this.y ) * alpha;\r\n\t\tthis.z += ( v.z - this.z ) * alpha;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tlerpVectors( v1, v2, alpha ) {\r\n\r\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\r\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\r\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcross( v ) {\r\n\r\n\t\treturn this.crossVectors( this, v );\r\n\r\n\t}\r\n\r\n\tcrossVectors( a, b ) {\r\n\r\n\t\tconst ax = a.x, ay = a.y, az = a.z;\r\n\t\tconst bx = b.x, by = b.y, bz = b.z;\r\n\r\n\t\tthis.x = ay * bz - az * by;\r\n\t\tthis.y = az * bx - ax * bz;\r\n\t\tthis.z = ax * by - ay * bx;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tprojectOnVector( v ) {\r\n\r\n\t\tconst denominator = v.lengthSq();\r\n\r\n\t\tif ( denominator === 0 ) return this.set( 0, 0, 0 );\r\n\r\n\t\tconst scalar = v.dot( this ) / denominator;\r\n\r\n\t\treturn this.copy( v ).multiplyScalar( scalar );\r\n\r\n\t}\r\n\r\n\tprojectOnPlane( planeNormal ) {\r\n\r\n\t\t_vector$c.copy( this ).projectOnVector( planeNormal );\r\n\r\n\t\treturn this.sub( _vector$c );\r\n\r\n\t}\r\n\r\n\treflect( normal ) {\r\n\r\n\t\t// reflect incident vector off plane orthogonal to normal\r\n\t\t// normal is assumed to have unit length\r\n\r\n\t\treturn this.sub( _vector$c.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );\r\n\r\n\t}\r\n\r\n\tangleTo( v ) {\r\n\r\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\r\n\r\n\t\tif ( denominator === 0 ) return Math.PI / 2;\r\n\r\n\t\tconst theta = this.dot( v ) / denominator;\r\n\r\n\t\t// clamp, to handle numerical problems\r\n\r\n\t\treturn Math.acos( clamp( theta, - 1, 1 ) );\r\n\r\n\t}\r\n\r\n\tdistanceTo( v ) {\r\n\r\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\r\n\r\n\t}\r\n\r\n\tdistanceToSquared( v ) {\r\n\r\n\t\tconst dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;\r\n\r\n\t\treturn dx * dx + dy * dy + dz * dz;\r\n\r\n\t}\r\n\r\n\tmanhattanDistanceTo( v ) {\r\n\r\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z );\r\n\r\n\t}\r\n\r\n\tsetFromSpherical( s ) {\r\n\r\n\t\treturn this.setFromSphericalCoords( s.radius, s.phi, s.theta );\r\n\r\n\t}\r\n\r\n\tsetFromSphericalCoords( radius, phi, theta ) {\r\n\r\n\t\tconst sinPhiRadius = Math.sin( phi ) * radius;\r\n\r\n\t\tthis.x = sinPhiRadius * Math.sin( theta );\r\n\t\tthis.y = Math.cos( phi ) * radius;\r\n\t\tthis.z = sinPhiRadius * Math.cos( theta );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromCylindrical( c ) {\r\n\r\n\t\treturn this.setFromCylindricalCoords( c.radius, c.theta, c.y );\r\n\r\n\t}\r\n\r\n\tsetFromCylindricalCoords( radius, theta, y ) {\r\n\r\n\t\tthis.x = radius * Math.sin( theta );\r\n\t\tthis.y = y;\r\n\t\tthis.z = radius * Math.cos( theta );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromMatrixPosition( m ) {\r\n\r\n\t\tconst e = m.elements;\r\n\r\n\t\tthis.x = e[ 12 ];\r\n\t\tthis.y = e[ 13 ];\r\n\t\tthis.z = e[ 14 ];\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromMatrixScale( m ) {\r\n\r\n\t\tconst sx = this.setFromMatrixColumn( m, 0 ).length();\r\n\t\tconst sy = this.setFromMatrixColumn( m, 1 ).length();\r\n\t\tconst sz = this.setFromMatrixColumn( m, 2 ).length();\r\n\r\n\t\tthis.x = sx;\r\n\t\tthis.y = sy;\r\n\t\tthis.z = sz;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromMatrixColumn( m, index ) {\r\n\r\n\t\treturn this.fromArray( m.elements, index * 4 );\r\n\r\n\t}\r\n\r\n\tsetFromMatrix3Column( m, index ) {\r\n\r\n\t\treturn this.fromArray( m.elements, index * 3 );\r\n\r\n\t}\r\n\r\n\tsetFromEuler( e ) {\r\n\r\n\t\tthis.x = e._x;\r\n\t\tthis.y = e._y;\r\n\t\tthis.z = e._z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromColor( c ) {\r\n\r\n\t\tthis.x = c.r;\r\n\t\tthis.y = c.g;\r\n\t\tthis.z = c.b;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tequals( v ) {\r\n\r\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );\r\n\r\n\t}\r\n\r\n\tfromArray( array, offset = 0 ) {\r\n\r\n\t\tthis.x = array[ offset ];\r\n\t\tthis.y = array[ offset + 1 ];\r\n\t\tthis.z = array[ offset + 2 ];\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoArray( array = [], offset = 0 ) {\r\n\r\n\t\tarray[ offset ] = this.x;\r\n\t\tarray[ offset + 1 ] = this.y;\r\n\t\tarray[ offset + 2 ] = this.z;\r\n\r\n\t\treturn array;\r\n\r\n\t}\r\n\r\n\tfromBufferAttribute( attribute, index ) {\r\n\r\n\t\tthis.x = attribute.getX( index );\r\n\t\tthis.y = attribute.getY( index );\r\n\t\tthis.z = attribute.getZ( index );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\trandom() {\r\n\r\n\t\tthis.x = Math.random();\r\n\t\tthis.y = Math.random();\r\n\t\tthis.z = Math.random();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\trandomDirection() {\r\n\r\n\t\t// https://mathworld.wolfram.com/SpherePointPicking.html\r\n\r\n\t\tconst theta = Math.random() * Math.PI * 2;\r\n\t\tconst u = Math.random() * 2 - 1;\r\n\t\tconst c = Math.sqrt( 1 - u * u );\r\n\r\n\t\tthis.x = c * Math.cos( theta );\r\n\t\tthis.y = u;\r\n\t\tthis.z = c * Math.sin( theta );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t*[ Symbol.iterator ]() {\r\n\r\n\t\tyield this.x;\r\n\t\tyield this.y;\r\n\t\tyield this.z;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _vector$c = /*@__PURE__*/ new Vector3();\r\nconst _quaternion$4 = /*@__PURE__*/ new Quaternion();\r\n\r\nclass Box3 {\r\n\r\n\tconstructor( min = new Vector3( + Infinity, + Infinity, + Infinity ), max = new Vector3( - Infinity, - Infinity, - Infinity ) ) {\r\n\r\n\t\tthis.isBox3 = true;\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tset( min, max ) {\r\n\r\n\t\tthis.min.copy( min );\r\n\t\tthis.max.copy( max );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromArray( array ) {\r\n\r\n\t\tthis.makeEmpty();\r\n\r\n\t\tfor ( let i = 0, il = array.length; i < il; i += 3 ) {\r\n\r\n\t\t\tthis.expandByPoint( _vector$b.fromArray( array, i ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromBufferAttribute( attribute ) {\r\n\r\n\t\tthis.makeEmpty();\r\n\r\n\t\tfor ( let i = 0, il = attribute.count; i < il; i ++ ) {\r\n\r\n\t\t\tthis.expandByPoint( _vector$b.fromBufferAttribute( attribute, i ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromPoints( points ) {\r\n\r\n\t\tthis.makeEmpty();\r\n\r\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\r\n\r\n\t\t\tthis.expandByPoint( points[ i ] );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromCenterAndSize( center, size ) {\r\n\r\n\t\tconst halfSize = _vector$b.copy( size ).multiplyScalar( 0.5 );\r\n\r\n\t\tthis.min.copy( center ).sub( halfSize );\r\n\t\tthis.max.copy( center ).add( halfSize );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromObject( object, precise = false ) {\r\n\r\n\t\tthis.makeEmpty();\r\n\r\n\t\treturn this.expandByObject( object, precise );\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n\tcopy( box ) {\r\n\r\n\t\tthis.min.copy( box.min );\r\n\t\tthis.max.copy( box.max );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmakeEmpty() {\r\n\r\n\t\tthis.min.x = this.min.y = this.min.z = + Infinity;\r\n\t\tthis.max.x = this.max.y = this.max.z = - Infinity;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tisEmpty() {\r\n\r\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\r\n\r\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z );\r\n\r\n\t}\r\n\r\n\tgetCenter( target ) {\r\n\r\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\r\n\r\n\t}\r\n\r\n\tgetSize( target ) {\r\n\r\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.subVectors( this.max, this.min );\r\n\r\n\t}\r\n\r\n\texpandByPoint( point ) {\r\n\r\n\t\tthis.min.min( point );\r\n\t\tthis.max.max( point );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\texpandByVector( vector ) {\r\n\r\n\t\tthis.min.sub( vector );\r\n\t\tthis.max.add( vector );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\texpandByScalar( scalar ) {\r\n\r\n\t\tthis.min.addScalar( - scalar );\r\n\t\tthis.max.addScalar( scalar );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\texpandByObject( object, precise = false ) {\r\n\r\n\t\t// Computes the world-axis-aligned bounding box of an object (including its children),\r\n\t\t// accounting for both the object's, and children's, world transforms\r\n\r\n\t\tobject.updateWorldMatrix( false, false );\r\n\r\n\t\tconst geometry = object.geometry;\r\n\r\n\t\tif ( geometry !== undefined ) {\r\n\r\n\t\t\tconst positionAttribute = geometry.getAttribute( 'position' );\r\n\r\n\t\t\t// precise AABB computation based on vertex data requires at least a position attribute.\r\n\t\t\t// instancing isn't supported so far and uses the normal (conservative) code path.\r\n\r\n\t\t\tif ( precise === true && positionAttribute !== undefined && object.isInstancedMesh !== true ) {\r\n\r\n\t\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i ++ ) {\r\n\r\n\t\t\t\t\tif ( object.isMesh === true ) {\r\n\r\n\t\t\t\t\t\tobject.getVertexPosition( i, _vector$b );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t_vector$b.fromBufferAttribute( positionAttribute, i );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_vector$b.applyMatrix4( object.matrixWorld );\r\n\t\t\t\t\tthis.expandByPoint( _vector$b );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif ( object.boundingBox !== undefined ) {\r\n\r\n\t\t\t\t\t// object-level bounding box\r\n\r\n\t\t\t\t\tif ( object.boundingBox === null ) {\r\n\r\n\t\t\t\t\t\tobject.computeBoundingBox();\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_box$4.copy( object.boundingBox );\r\n\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// geometry-level bounding box\r\n\r\n\t\t\t\t\tif ( geometry.boundingBox === null ) {\r\n\r\n\t\t\t\t\t\tgeometry.computeBoundingBox();\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_box$4.copy( geometry.boundingBox );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t_box$4.applyMatrix4( object.matrixWorld );\r\n\r\n\t\t\t\tthis.union( _box$4 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconst children = object.children;\r\n\r\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\r\n\r\n\t\t\tthis.expandByObject( children[ i ], precise );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcontainsPoint( point ) {\r\n\r\n\t\treturn point.x >= this.min.x && point.x <= this.max.x &&\r\n\t\t\tpoint.y >= this.min.y && point.y <= this.max.y &&\r\n\t\t\tpoint.z >= this.min.z && point.z <= this.max.z;\r\n\r\n\t}\r\n\r\n\tcontainsBox( box ) {\r\n\r\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\r\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y &&\r\n\t\t\tthis.min.z <= box.min.z && box.max.z <= this.max.z;\r\n\r\n\t}\r\n\r\n\tgetParameter( point, target ) {\r\n\r\n\t\t// This can potentially have a divide by zero if the box\r\n\t\t// has a size dimension of 0.\r\n\r\n\t\treturn target.set(\r\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\r\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y ),\r\n\t\t\t( point.z - this.min.z ) / ( this.max.z - this.min.z )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tintersectsBox( box ) {\r\n\r\n\t\t// using 6 splitting planes to rule out intersections.\r\n\t\treturn box.max.x >= this.min.x && box.min.x <= this.max.x &&\r\n\t\t\tbox.max.y >= this.min.y && box.min.y <= this.max.y &&\r\n\t\t\tbox.max.z >= this.min.z && box.min.z <= this.max.z;\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\t// Find the point on the AABB closest to the sphere center.\r\n\t\tthis.clampPoint( sphere.center, _vector$b );\r\n\r\n\t\t// If that point is inside the sphere, the AABB and sphere intersect.\r\n\t\treturn _vector$b.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius );\r\n\r\n\t}\r\n\r\n\tintersectsPlane( plane ) {\r\n\r\n\t\t// We compute the minimum and maximum dot product values. If those values\r\n\t\t// are on the same side (back or front) of the plane, then there is no intersection.\r\n\r\n\t\tlet min, max;\r\n\r\n\t\tif ( plane.normal.x > 0 ) {\r\n\r\n\t\t\tmin = plane.normal.x * this.min.x;\r\n\t\t\tmax = plane.normal.x * this.max.x;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tmin = plane.normal.x * this.max.x;\r\n\t\t\tmax = plane.normal.x * this.min.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( plane.normal.y > 0 ) {\r\n\r\n\t\t\tmin += plane.normal.y * this.min.y;\r\n\t\t\tmax += plane.normal.y * this.max.y;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tmin += plane.normal.y * this.max.y;\r\n\t\t\tmax += plane.normal.y * this.min.y;\r\n\r\n\t\t}\r\n\r\n\t\tif ( plane.normal.z > 0 ) {\r\n\r\n\t\t\tmin += plane.normal.z * this.min.z;\r\n\t\t\tmax += plane.normal.z * this.max.z;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tmin += plane.normal.z * this.max.z;\r\n\t\t\tmax += plane.normal.z * this.min.z;\r\n\r\n\t\t}\r\n\r\n\t\treturn ( min <= - plane.constant && max >= - plane.constant );\r\n\r\n\t}\r\n\r\n\tintersectsTriangle( triangle ) {\r\n\r\n\t\tif ( this.isEmpty() ) {\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t\t// compute box center and extents\r\n\t\tthis.getCenter( _center );\r\n\t\t_extents.subVectors( this.max, _center );\r\n\r\n\t\t// translate triangle to aabb origin\r\n\t\t_v0$3.subVectors( triangle.a, _center );\r\n\t\t_v1$7.subVectors( triangle.b, _center );\r\n\t\t_v2$4.subVectors( triangle.c, _center );\r\n\r\n\t\t// compute edge vectors for triangle\r\n\t\t_f0.subVectors( _v1$7, _v0$3 );\r\n\t\t_f1.subVectors( _v2$4, _v1$7 );\r\n\t\t_f2.subVectors( _v0$3, _v2$4 );\r\n\r\n\t\t// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb\r\n\t\t// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation\r\n\t\t// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)\r\n\t\tlet axes = [\r\n\t\t\t0, - _f0.z, _f0.y, 0, - _f1.z, _f1.y, 0, - _f2.z, _f2.y,\r\n\t\t\t_f0.z, 0, - _f0.x, _f1.z, 0, - _f1.x, _f2.z, 0, - _f2.x,\r\n\t\t\t- _f0.y, _f0.x, 0, - _f1.y, _f1.x, 0, - _f2.y, _f2.x, 0\r\n\t\t];\r\n\t\tif ( ! satForAxes( axes, _v0$3, _v1$7, _v2$4, _extents ) ) {\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t\t// test 3 face normals from the aabb\r\n\t\taxes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];\r\n\t\tif ( ! satForAxes( axes, _v0$3, _v1$7, _v2$4, _extents ) ) {\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t\t// finally testing the face normal of the triangle\r\n\t\t// use already existing triangle edge vectors here\r\n\t\t_triangleNormal.crossVectors( _f0, _f1 );\r\n\t\taxes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ];\r\n\r\n\t\treturn satForAxes( axes, _v0$3, _v1$7, _v2$4, _extents );\r\n\r\n\t}\r\n\r\n\tclampPoint( point, target ) {\r\n\r\n\t\treturn target.copy( point ).clamp( this.min, this.max );\r\n\r\n\t}\r\n\r\n\tdistanceToPoint( point ) {\r\n\r\n\t\treturn this.clampPoint( point, _vector$b ).distanceTo( point );\r\n\r\n\t}\r\n\r\n\tgetBoundingSphere( target ) {\r\n\r\n\t\tif ( this.isEmpty() ) {\r\n\r\n\t\t\ttarget.makeEmpty();\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.getCenter( target.center );\r\n\r\n\t\t\ttarget.radius = this.getSize( _vector$b ).length() * 0.5;\r\n\r\n\t\t}\r\n\r\n\t\treturn target;\r\n\r\n\t}\r\n\r\n\tintersect( box ) {\r\n\r\n\t\tthis.min.max( box.min );\r\n\t\tthis.max.min( box.max );\r\n\r\n\t\t// ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.\r\n\t\tif ( this.isEmpty() ) this.makeEmpty();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tunion( box ) {\r\n\r\n\t\tthis.min.min( box.min );\r\n\t\tthis.max.max( box.max );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tapplyMatrix4( matrix ) {\r\n\r\n\t\t// transform of empty box is an empty box.\r\n\t\tif ( this.isEmpty() ) return this;\r\n\r\n\t\t// NOTE: I am using a binary pattern to specify all 2^3 combinations below\r\n\t\t_points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000\r\n\t\t_points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001\r\n\t\t_points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010\r\n\t\t_points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011\r\n\t\t_points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100\r\n\t\t_points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101\r\n\t\t_points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110\r\n\t\t_points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111\r\n\r\n\t\tthis.setFromPoints( _points );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttranslate( offset ) {\r\n\r\n\t\tthis.min.add( offset );\r\n\t\tthis.max.add( offset );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tequals( box ) {\r\n\r\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _points = [\r\n\t/*@__PURE__*/ new Vector3(),\r\n\t/*@__PURE__*/ new Vector3(),\r\n\t/*@__PURE__*/ new Vector3(),\r\n\t/*@__PURE__*/ new Vector3(),\r\n\t/*@__PURE__*/ new Vector3(),\r\n\t/*@__PURE__*/ new Vector3(),\r\n\t/*@__PURE__*/ new Vector3(),\r\n\t/*@__PURE__*/ new Vector3()\r\n];\r\n\r\nconst _vector$b = /*@__PURE__*/ new Vector3();\r\n\r\nconst _box$4 = /*@__PURE__*/ new Box3();\r\n\r\n// triangle centered vertices\r\n\r\nconst _v0$3 = /*@__PURE__*/ new Vector3();\r\nconst _v1$7 = /*@__PURE__*/ new Vector3();\r\nconst _v2$4 = /*@__PURE__*/ new Vector3();\r\n\r\n// triangle edge vectors\r\n\r\nconst _f0 = /*@__PURE__*/ new Vector3();\r\nconst _f1 = /*@__PURE__*/ new Vector3();\r\nconst _f2 = /*@__PURE__*/ new Vector3();\r\n\r\nconst _center = /*@__PURE__*/ new Vector3();\r\nconst _extents = /*@__PURE__*/ new Vector3();\r\nconst _triangleNormal = /*@__PURE__*/ new Vector3();\r\nconst _testAxis = /*@__PURE__*/ new Vector3();\r\n\r\nfunction satForAxes( axes, v0, v1, v2, extents ) {\r\n\r\n\tfor ( let i = 0, j = axes.length - 3; i <= j; i += 3 ) {\r\n\r\n\t\t_testAxis.fromArray( axes, i );\r\n\t\t// project the aabb onto the separating axis\r\n\t\tconst r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z );\r\n\t\t// project all 3 vertices of the triangle onto the separating axis\r\n\t\tconst p0 = v0.dot( _testAxis );\r\n\t\tconst p1 = v1.dot( _testAxis );\r\n\t\tconst p2 = v2.dot( _testAxis );\r\n\t\t// actual test, basically see if either of the most extreme of the triangle points intersects r\r\n\t\tif ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {\r\n\r\n\t\t\t// points of the projected triangle are outside the projected half-length of the aabb\r\n\t\t\t// the axis is separating and we can exit\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn true;\r\n\r\n}\r\n\r\nconst _box$3 = /*@__PURE__*/ new Box3();\r\nconst _v1$6 = /*@__PURE__*/ new Vector3();\r\nconst _v2$3 = /*@__PURE__*/ new Vector3();\r\n\r\nclass Sphere {\r\n\r\n\tconstructor( center = new Vector3(), radius = - 1 ) {\r\n\r\n\t\tthis.isSphere = true;\r\n\r\n\t\tthis.center = center;\r\n\t\tthis.radius = radius;\r\n\r\n\t}\r\n\r\n\tset( center, radius ) {\r\n\r\n\t\tthis.center.copy( center );\r\n\t\tthis.radius = radius;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromPoints( points, optionalCenter ) {\r\n\r\n\t\tconst center = this.center;\r\n\r\n\t\tif ( optionalCenter !== undefined ) {\r\n\r\n\t\t\tcenter.copy( optionalCenter );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_box$3.setFromPoints( points ).getCenter( center );\r\n\r\n\t\t}\r\n\r\n\t\tlet maxRadiusSq = 0;\r\n\r\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\r\n\r\n\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );\r\n\r\n\t\t}\r\n\r\n\t\tthis.radius = Math.sqrt( maxRadiusSq );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcopy( sphere ) {\r\n\r\n\t\tthis.center.copy( sphere.center );\r\n\t\tthis.radius = sphere.radius;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tisEmpty() {\r\n\r\n\t\treturn ( this.radius < 0 );\r\n\r\n\t}\r\n\r\n\tmakeEmpty() {\r\n\r\n\t\tthis.center.set( 0, 0, 0 );\r\n\t\tthis.radius = - 1;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcontainsPoint( point ) {\r\n\r\n\t\treturn ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );\r\n\r\n\t}\r\n\r\n\tdistanceToPoint( point ) {\r\n\r\n\t\treturn ( point.distanceTo( this.center ) - this.radius );\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\tconst radiusSum = this.radius + sphere.radius;\r\n\r\n\t\treturn sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum );\r\n\r\n\t}\r\n\r\n\tintersectsBox( box ) {\r\n\r\n\t\treturn box.intersectsSphere( this );\r\n\r\n\t}\r\n\r\n\tintersectsPlane( plane ) {\r\n\r\n\t\treturn Math.abs( plane.distanceToPoint( this.center ) ) <= this.radius;\r\n\r\n\t}\r\n\r\n\tclampPoint( point, target ) {\r\n\r\n\t\tconst deltaLengthSq = this.center.distanceToSquared( point );\r\n\r\n\t\ttarget.copy( point );\r\n\r\n\t\tif ( deltaLengthSq > ( this.radius * this.radius ) ) {\r\n\r\n\t\t\ttarget.sub( this.center ).normalize();\r\n\t\t\ttarget.multiplyScalar( this.radius ).add( this.center );\r\n\r\n\t\t}\r\n\r\n\t\treturn target;\r\n\r\n\t}\r\n\r\n\tgetBoundingBox( target ) {\r\n\r\n\t\tif ( this.isEmpty() ) {\r\n\r\n\t\t\t// Empty sphere produces empty bounding box\r\n\t\t\ttarget.makeEmpty();\r\n\t\t\treturn target;\r\n\r\n\t\t}\r\n\r\n\t\ttarget.set( this.center, this.center );\r\n\t\ttarget.expandByScalar( this.radius );\r\n\r\n\t\treturn target;\r\n\r\n\t}\r\n\r\n\tapplyMatrix4( matrix ) {\r\n\r\n\t\tthis.center.applyMatrix4( matrix );\r\n\t\tthis.radius = this.radius * matrix.getMaxScaleOnAxis();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttranslate( offset ) {\r\n\r\n\t\tthis.center.add( offset );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\texpandByPoint( point ) {\r\n\r\n\t\tif ( this.isEmpty() ) {\r\n\r\n\t\t\tthis.center.copy( point );\r\n\r\n\t\t\tthis.radius = 0;\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\t_v1$6.subVectors( point, this.center );\r\n\r\n\t\tconst lengthSq = _v1$6.lengthSq();\r\n\r\n\t\tif ( lengthSq > ( this.radius * this.radius ) ) {\r\n\r\n\t\t\t// calculate the minimal sphere\r\n\r\n\t\t\tconst length = Math.sqrt( lengthSq );\r\n\r\n\t\t\tconst delta = ( length - this.radius ) * 0.5;\r\n\r\n\t\t\tthis.center.addScaledVector( _v1$6, delta / length );\r\n\r\n\t\t\tthis.radius += delta;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tunion( sphere ) {\r\n\r\n\t\tif ( sphere.isEmpty() ) {\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.isEmpty() ) {\r\n\r\n\t\t\tthis.copy( sphere );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.center.equals( sphere.center ) === true ) {\r\n\r\n\t\t\t this.radius = Math.max( this.radius, sphere.radius );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_v2$3.subVectors( sphere.center, this.center ).setLength( sphere.radius );\r\n\r\n\t\t\tthis.expandByPoint( _v1$6.copy( sphere.center ).add( _v2$3 ) );\r\n\r\n\t\t\tthis.expandByPoint( _v1$6.copy( sphere.center ).sub( _v2$3 ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tequals( sphere ) {\r\n\r\n\t\treturn sphere.center.equals( this.center ) && ( sphere.radius === this.radius );\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _vector$a = /*@__PURE__*/ new Vector3();\r\nconst _segCenter = /*@__PURE__*/ new Vector3();\r\nconst _segDir = /*@__PURE__*/ new Vector3();\r\nconst _diff = /*@__PURE__*/ new Vector3();\r\n\r\nconst _edge1 = /*@__PURE__*/ new Vector3();\r\nconst _edge2 = /*@__PURE__*/ new Vector3();\r\nconst _normal$1 = /*@__PURE__*/ new Vector3();\r\n\r\nclass Ray {\r\n\r\n\tconstructor( origin = new Vector3(), direction = new Vector3( 0, 0, - 1 ) ) {\r\n\r\n\t\tthis.origin = origin;\r\n\t\tthis.direction = direction;\r\n\r\n\t}\r\n\r\n\tset( origin, direction ) {\r\n\r\n\t\tthis.origin.copy( origin );\r\n\t\tthis.direction.copy( direction );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcopy( ray ) {\r\n\r\n\t\tthis.origin.copy( ray.origin );\r\n\t\tthis.direction.copy( ray.direction );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tat( t, target ) {\r\n\r\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, t );\r\n\r\n\t}\r\n\r\n\tlookAt( v ) {\r\n\r\n\t\tthis.direction.copy( v ).sub( this.origin ).normalize();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\trecast( t ) {\r\n\r\n\t\tthis.origin.copy( this.at( t, _vector$a ) );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclosestPointToPoint( point, target ) {\r\n\r\n\t\ttarget.subVectors( point, this.origin );\r\n\r\n\t\tconst directionDistance = target.dot( this.direction );\r\n\r\n\t\tif ( directionDistance < 0 ) {\r\n\r\n\t\t\treturn target.copy( this.origin );\r\n\r\n\t\t}\r\n\r\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, directionDistance );\r\n\r\n\t}\r\n\r\n\tdistanceToPoint( point ) {\r\n\r\n\t\treturn Math.sqrt( this.distanceSqToPoint( point ) );\r\n\r\n\t}\r\n\r\n\tdistanceSqToPoint( point ) {\r\n\r\n\t\tconst directionDistance = _vector$a.subVectors( point, this.origin ).dot( this.direction );\r\n\r\n\t\t// point behind the ray\r\n\r\n\t\tif ( directionDistance < 0 ) {\r\n\r\n\t\t\treturn this.origin.distanceToSquared( point );\r\n\r\n\t\t}\r\n\r\n\t\t_vector$a.copy( this.origin ).addScaledVector( this.direction, directionDistance );\r\n\r\n\t\treturn _vector$a.distanceToSquared( point );\r\n\r\n\t}\r\n\r\n\tdistanceSqToSegment( v0, v1, optionalPointOnRay, optionalPointOnSegment ) {\r\n\r\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h\r\n\t\t// It returns the min distance between the ray and the segment\r\n\t\t// defined by v0 and v1\r\n\t\t// It can also set two optional targets :\r\n\t\t// - The closest point on the ray\r\n\t\t// - The closest point on the segment\r\n\r\n\t\t_segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 );\r\n\t\t_segDir.copy( v1 ).sub( v0 ).normalize();\r\n\t\t_diff.copy( this.origin ).sub( _segCenter );\r\n\r\n\t\tconst segExtent = v0.distanceTo( v1 ) * 0.5;\r\n\t\tconst a01 = - this.direction.dot( _segDir );\r\n\t\tconst b0 = _diff.dot( this.direction );\r\n\t\tconst b1 = - _diff.dot( _segDir );\r\n\t\tconst c = _diff.lengthSq();\r\n\t\tconst det = Math.abs( 1 - a01 * a01 );\r\n\t\tlet s0, s1, sqrDist, extDet;\r\n\r\n\t\tif ( det > 0 ) {\r\n\r\n\t\t\t// The ray and segment are not parallel.\r\n\r\n\t\t\ts0 = a01 * b1 - b0;\r\n\t\t\ts1 = a01 * b0 - b1;\r\n\t\t\textDet = segExtent * det;\r\n\r\n\t\t\tif ( s0 >= 0 ) {\r\n\r\n\t\t\t\tif ( s1 >= - extDet ) {\r\n\r\n\t\t\t\t\tif ( s1 <= extDet ) {\r\n\r\n\t\t\t\t\t\t// region 0\r\n\t\t\t\t\t\t// Minimum at interior points of ray and segment.\r\n\r\n\t\t\t\t\t\tconst invDet = 1 / det;\r\n\t\t\t\t\t\ts0 *= invDet;\r\n\t\t\t\t\t\ts1 *= invDet;\r\n\t\t\t\t\t\tsqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t// region 1\r\n\r\n\t\t\t\t\t\ts1 = segExtent;\r\n\t\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\r\n\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// region 5\r\n\r\n\t\t\t\t\ts1 = - segExtent;\r\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\r\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif ( s1 <= - extDet ) {\r\n\r\n\t\t\t\t\t// region 4\r\n\r\n\t\t\t\t\ts0 = Math.max( 0, - ( - a01 * segExtent + b0 ) );\r\n\t\t\t\t\ts1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\r\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t} else if ( s1 <= extDet ) {\r\n\r\n\t\t\t\t\t// region 3\r\n\r\n\t\t\t\t\ts0 = 0;\r\n\t\t\t\t\ts1 = Math.min( Math.max( - segExtent, - b1 ), segExtent );\r\n\t\t\t\t\tsqrDist = s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// region 2\r\n\r\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * segExtent + b0 ) );\r\n\t\t\t\t\ts1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\r\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// Ray and segment are parallel.\r\n\r\n\t\t\ts1 = ( a01 > 0 ) ? - segExtent : segExtent;\r\n\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\r\n\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t}\r\n\r\n\t\tif ( optionalPointOnRay ) {\r\n\r\n\t\t\toptionalPointOnRay.copy( this.origin ).addScaledVector( this.direction, s0 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( optionalPointOnSegment ) {\r\n\r\n\t\t\toptionalPointOnSegment.copy( _segCenter ).addScaledVector( _segDir, s1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn sqrDist;\r\n\r\n\t}\r\n\r\n\tintersectSphere( sphere, target ) {\r\n\r\n\t\t_vector$a.subVectors( sphere.center, this.origin );\r\n\t\tconst tca = _vector$a.dot( this.direction );\r\n\t\tconst d2 = _vector$a.dot( _vector$a ) - tca * tca;\r\n\t\tconst radius2 = sphere.radius * sphere.radius;\r\n\r\n\t\tif ( d2 > radius2 ) return null;\r\n\r\n\t\tconst thc = Math.sqrt( radius2 - d2 );\r\n\r\n\t\t// t0 = first intersect point - entrance on front of sphere\r\n\t\tconst t0 = tca - thc;\r\n\r\n\t\t// t1 = second intersect point - exit point on back of sphere\r\n\t\tconst t1 = tca + thc;\r\n\r\n\t\t// test to see if t1 is behind the ray - if so, return null\r\n\t\tif ( t1 < 0 ) return null;\r\n\r\n\t\t// test to see if t0 is behind the ray:\r\n\t\t// if it is, the ray is inside the sphere, so return the second exit point scaled by t1,\r\n\t\t// in order to always return an intersect point that is in front of the ray.\r\n\t\tif ( t0 < 0 ) return this.at( t1, target );\r\n\r\n\t\t// else t0 is in front of the ray, so return the first collision point scaled by t0\r\n\t\treturn this.at( t0, target );\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );\r\n\r\n\t}\r\n\r\n\tdistanceToPlane( plane ) {\r\n\r\n\t\tconst denominator = plane.normal.dot( this.direction );\r\n\r\n\t\tif ( denominator === 0 ) {\r\n\r\n\t\t\t// line is coplanar, return origin\r\n\t\t\tif ( plane.distanceToPoint( this.origin ) === 0 ) {\r\n\r\n\t\t\t\treturn 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Null is preferable to undefined since undefined means.... it is undefined\r\n\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\tconst t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator;\r\n\r\n\t\t// Return if the ray never intersects the plane\r\n\r\n\t\treturn t >= 0 ? t : null;\r\n\r\n\t}\r\n\r\n\tintersectPlane( plane, target ) {\r\n\r\n\t\tconst t = this.distanceToPlane( plane );\r\n\r\n\t\tif ( t === null ) {\r\n\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\treturn this.at( t, target );\r\n\r\n\t}\r\n\r\n\tintersectsPlane( plane ) {\r\n\r\n\t\t// check if the ray lies on the plane first\r\n\r\n\t\tconst distToPoint = plane.distanceToPoint( this.origin );\r\n\r\n\t\tif ( distToPoint === 0 ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t\tconst denominator = plane.normal.dot( this.direction );\r\n\r\n\t\tif ( denominator * distToPoint < 0 ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t\t// ray origin is behind the plane (and is pointing behind it)\r\n\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\tintersectBox( box, target ) {\r\n\r\n\t\tlet tmin, tmax, tymin, tymax, tzmin, tzmax;\r\n\r\n\t\tconst invdirx = 1 / this.direction.x,\r\n\t\t\tinvdiry = 1 / this.direction.y,\r\n\t\t\tinvdirz = 1 / this.direction.z;\r\n\r\n\t\tconst origin = this.origin;\r\n\r\n\t\tif ( invdirx >= 0 ) {\r\n\r\n\t\t\ttmin = ( box.min.x - origin.x ) * invdirx;\r\n\t\t\ttmax = ( box.max.x - origin.x ) * invdirx;\r\n\r\n\t\t} else {\r\n\r\n\t\t\ttmin = ( box.max.x - origin.x ) * invdirx;\r\n\t\t\ttmax = ( box.min.x - origin.x ) * invdirx;\r\n\r\n\t\t}\r\n\r\n\t\tif ( invdiry >= 0 ) {\r\n\r\n\t\t\ttymin = ( box.min.y - origin.y ) * invdiry;\r\n\t\t\ttymax = ( box.max.y - origin.y ) * invdiry;\r\n\r\n\t\t} else {\r\n\r\n\t\t\ttymin = ( box.max.y - origin.y ) * invdiry;\r\n\t\t\ttymax = ( box.min.y - origin.y ) * invdiry;\r\n\r\n\t\t}\r\n\r\n\t\tif ( ( tmin > tymax ) || ( tymin > tmax ) ) return null;\r\n\r\n\t\tif ( tymin > tmin || isNaN( tmin ) ) tmin = tymin;\r\n\r\n\t\tif ( tymax < tmax || isNaN( tmax ) ) tmax = tymax;\r\n\r\n\t\tif ( invdirz >= 0 ) {\r\n\r\n\t\t\ttzmin = ( box.min.z - origin.z ) * invdirz;\r\n\t\t\ttzmax = ( box.max.z - origin.z ) * invdirz;\r\n\r\n\t\t} else {\r\n\r\n\t\t\ttzmin = ( box.max.z - origin.z ) * invdirz;\r\n\t\t\ttzmax = ( box.min.z - origin.z ) * invdirz;\r\n\r\n\t\t}\r\n\r\n\t\tif ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null;\r\n\r\n\t\tif ( tzmin > tmin || tmin !== tmin ) tmin = tzmin;\r\n\r\n\t\tif ( tzmax < tmax || tmax !== tmax ) tmax = tzmax;\r\n\r\n\t\t//return point closest to the ray (positive side)\r\n\r\n\t\tif ( tmax < 0 ) return null;\r\n\r\n\t\treturn this.at( tmin >= 0 ? tmin : tmax, target );\r\n\r\n\t}\r\n\r\n\tintersectsBox( box ) {\r\n\r\n\t\treturn this.intersectBox( box, _vector$a ) !== null;\r\n\r\n\t}\r\n\r\n\tintersectTriangle( a, b, c, backfaceCulling, target ) {\r\n\r\n\t\t// Compute the offset origin, edges, and normal.\r\n\r\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h\r\n\r\n\t\t_edge1.subVectors( b, a );\r\n\t\t_edge2.subVectors( c, a );\r\n\t\t_normal$1.crossVectors( _edge1, _edge2 );\r\n\r\n\t\t// Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,\r\n\t\t// E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by\r\n\t\t// |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))\r\n\t\t// |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))\r\n\t\t// |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)\r\n\t\tlet DdN = this.direction.dot( _normal$1 );\r\n\t\tlet sign;\r\n\r\n\t\tif ( DdN > 0 ) {\r\n\r\n\t\t\tif ( backfaceCulling ) return null;\r\n\t\t\tsign = 1;\r\n\r\n\t\t} else if ( DdN < 0 ) {\r\n\r\n\t\t\tsign = - 1;\r\n\t\t\tDdN = - DdN;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\t_diff.subVectors( this.origin, a );\r\n\t\tconst DdQxE2 = sign * this.direction.dot( _edge2.crossVectors( _diff, _edge2 ) );\r\n\r\n\t\t// b1 < 0, no intersection\r\n\t\tif ( DdQxE2 < 0 ) {\r\n\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\tconst DdE1xQ = sign * this.direction.dot( _edge1.cross( _diff ) );\r\n\r\n\t\t// b2 < 0, no intersection\r\n\t\tif ( DdE1xQ < 0 ) {\r\n\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\t// b1+b2 > 1, no intersection\r\n\t\tif ( DdQxE2 + DdE1xQ > DdN ) {\r\n\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\t// Line intersects triangle, check if ray does.\r\n\t\tconst QdN = - sign * _diff.dot( _normal$1 );\r\n\r\n\t\t// t < 0, no intersection\r\n\t\tif ( QdN < 0 ) {\r\n\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\t// Ray intersects triangle.\r\n\t\treturn this.at( QdN / DdN, target );\r\n\r\n\t}\r\n\r\n\tapplyMatrix4( matrix4 ) {\r\n\r\n\t\tthis.origin.applyMatrix4( matrix4 );\r\n\t\tthis.direction.transformDirection( matrix4 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tequals( ray ) {\r\n\r\n\t\treturn ray.origin.equals( this.origin ) && ray.direction.equals( this.direction );\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Matrix4 {\r\n\r\n\tconstructor( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\r\n\r\n\t\tMatrix4.prototype.isMatrix4 = true;\r\n\r\n\t\tthis.elements = [\r\n\r\n\t\t\t1, 0, 0, 0,\r\n\t\t\t0, 1, 0, 0,\r\n\t\t\t0, 0, 1, 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t];\r\n\r\n\t\tif ( n11 !== undefined ) {\r\n\r\n\t\t\tthis.set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tset( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\r\n\r\n\t\tconst te = this.elements;\r\n\r\n\t\tte[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;\r\n\t\tte[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;\r\n\t\tte[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;\r\n\t\tte[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tidentity() {\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\t1, 0, 0, 0,\r\n\t\t\t0, 1, 0, 0,\r\n\t\t\t0, 0, 1, 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new Matrix4().fromArray( this.elements );\r\n\r\n\t}\r\n\r\n\tcopy( m ) {\r\n\r\n\t\tconst te = this.elements;\r\n\t\tconst me = m.elements;\r\n\r\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; te[ 3 ] = me[ 3 ];\r\n\t\tte[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ];\r\n\t\tte[ 8 ] = me[ 8 ]; te[ 9 ] = me[ 9 ]; te[ 10 ] = me[ 10 ]; te[ 11 ] = me[ 11 ];\r\n\t\tte[ 12 ] = me[ 12 ]; te[ 13 ] = me[ 13 ]; te[ 14 ] = me[ 14 ]; te[ 15 ] = me[ 15 ];\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcopyPosition( m ) {\r\n\r\n\t\tconst te = this.elements, me = m.elements;\r\n\r\n\t\tte[ 12 ] = me[ 12 ];\r\n\t\tte[ 13 ] = me[ 13 ];\r\n\t\tte[ 14 ] = me[ 14 ];\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromMatrix3( m ) {\r\n\r\n\t\tconst me = m.elements;\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\tme[ 0 ], me[ 3 ], me[ 6 ], 0,\r\n\t\t\tme[ 1 ], me[ 4 ], me[ 7 ], 0,\r\n\t\t\tme[ 2 ], me[ 5 ], me[ 8 ], 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\textractBasis( xAxis, yAxis, zAxis ) {\r\n\r\n\t\txAxis.setFromMatrixColumn( this, 0 );\r\n\t\tyAxis.setFromMatrixColumn( this, 1 );\r\n\t\tzAxis.setFromMatrixColumn( this, 2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmakeBasis( xAxis, yAxis, zAxis ) {\r\n\r\n\t\tthis.set(\r\n\t\t\txAxis.x, yAxis.x, zAxis.x, 0,\r\n\t\t\txAxis.y, yAxis.y, zAxis.y, 0,\r\n\t\t\txAxis.z, yAxis.z, zAxis.z, 0,\r\n\t\t\t0, 0, 0, 1\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\textractRotation( m ) {\r\n\r\n\t\t// this method does not support reflection matrices\r\n\r\n\t\tconst te = this.elements;\r\n\t\tconst me = m.elements;\r\n\r\n\t\tconst scaleX = 1 / _v1$5.setFromMatrixColumn( m, 0 ).length();\r\n\t\tconst scaleY = 1 / _v1$5.setFromMatrixColumn( m, 1 ).length();\r\n\t\tconst scaleZ = 1 / _v1$5.setFromMatrixColumn( m, 2 ).length();\r\n\r\n\t\tte[ 0 ] = me[ 0 ] * scaleX;\r\n\t\tte[ 1 ] = me[ 1 ] * scaleX;\r\n\t\tte[ 2 ] = me[ 2 ] * scaleX;\r\n\t\tte[ 3 ] = 0;\r\n\r\n\t\tte[ 4 ] = me[ 4 ] * scaleY;\r\n\t\tte[ 5 ] = me[ 5 ] * scaleY;\r\n\t\tte[ 6 ] = me[ 6 ] * scaleY;\r\n\t\tte[ 7 ] = 0;\r\n\r\n\t\tte[ 8 ] = me[ 8 ] * scaleZ;\r\n\t\tte[ 9 ] = me[ 9 ] * scaleZ;\r\n\t\tte[ 10 ] = me[ 10 ] * scaleZ;\r\n\t\tte[ 11 ] = 0;\r\n\r\n\t\tte[ 12 ] = 0;\r\n\t\tte[ 13 ] = 0;\r\n\t\tte[ 14 ] = 0;\r\n\t\tte[ 15 ] = 1;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmakeRotationFromEuler( euler ) {\r\n\r\n\t\tconst te = this.elements;\r\n\r\n\t\tconst x = euler.x, y = euler.y, z = euler.z;\r\n\t\tconst a = Math.cos( x ), b = Math.sin( x );\r\n\t\tconst c = Math.cos( y ), d = Math.sin( y );\r\n\t\tconst e = Math.cos( z ), f = Math.sin( z );\r\n\r\n\t\tif ( euler.order === 'XYZ' ) {\r\n\r\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\r\n\r\n\t\t\tte[ 0 ] = c * e;\r\n\t\t\tte[ 4 ] = - c * f;\r\n\t\t\tte[ 8 ] = d;\r\n\r\n\t\t\tte[ 1 ] = af + be * d;\r\n\t\t\tte[ 5 ] = ae - bf * d;\r\n\t\t\tte[ 9 ] = - b * c;\r\n\r\n\t\t\tte[ 2 ] = bf - ae * d;\r\n\t\t\tte[ 6 ] = be + af * d;\r\n\t\t\tte[ 10 ] = a * c;\r\n\r\n\t\t} else if ( euler.order === 'YXZ' ) {\r\n\r\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\r\n\r\n\t\t\tte[ 0 ] = ce + df * b;\r\n\t\t\tte[ 4 ] = de * b - cf;\r\n\t\t\tte[ 8 ] = a * d;\r\n\r\n\t\t\tte[ 1 ] = a * f;\r\n\t\t\tte[ 5 ] = a * e;\r\n\t\t\tte[ 9 ] = - b;\r\n\r\n\t\t\tte[ 2 ] = cf * b - de;\r\n\t\t\tte[ 6 ] = df + ce * b;\r\n\t\t\tte[ 10 ] = a * c;\r\n\r\n\t\t} else if ( euler.order === 'ZXY' ) {\r\n\r\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\r\n\r\n\t\t\tte[ 0 ] = ce - df * b;\r\n\t\t\tte[ 4 ] = - a * f;\r\n\t\t\tte[ 8 ] = de + cf * b;\r\n\r\n\t\t\tte[ 1 ] = cf + de * b;\r\n\t\t\tte[ 5 ] = a * e;\r\n\t\t\tte[ 9 ] = df - ce * b;\r\n\r\n\t\t\tte[ 2 ] = - a * d;\r\n\t\t\tte[ 6 ] = b;\r\n\t\t\tte[ 10 ] = a * c;\r\n\r\n\t\t} else if ( euler.order === 'ZYX' ) {\r\n\r\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\r\n\r\n\t\t\tte[ 0 ] = c * e;\r\n\t\t\tte[ 4 ] = be * d - af;\r\n\t\t\tte[ 8 ] = ae * d + bf;\r\n\r\n\t\t\tte[ 1 ] = c * f;\r\n\t\t\tte[ 5 ] = bf * d + ae;\r\n\t\t\tte[ 9 ] = af * d - be;\r\n\r\n\t\t\tte[ 2 ] = - d;\r\n\t\t\tte[ 6 ] = b * c;\r\n\t\t\tte[ 10 ] = a * c;\r\n\r\n\t\t} else if ( euler.order === 'YZX' ) {\r\n\r\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\r\n\r\n\t\t\tte[ 0 ] = c * e;\r\n\t\t\tte[ 4 ] = bd - ac * f;\r\n\t\t\tte[ 8 ] = bc * f + ad;\r\n\r\n\t\t\tte[ 1 ] = f;\r\n\t\t\tte[ 5 ] = a * e;\r\n\t\t\tte[ 9 ] = - b * e;\r\n\r\n\t\t\tte[ 2 ] = - d * e;\r\n\t\t\tte[ 6 ] = ad * f + bc;\r\n\t\t\tte[ 10 ] = ac - bd * f;\r\n\r\n\t\t} else if ( euler.order === 'XZY' ) {\r\n\r\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\r\n\r\n\t\t\tte[ 0 ] = c * e;\r\n\t\t\tte[ 4 ] = - f;\r\n\t\t\tte[ 8 ] = d * e;\r\n\r\n\t\t\tte[ 1 ] = ac * f + bd;\r\n\t\t\tte[ 5 ] = a * e;\r\n\t\t\tte[ 9 ] = ad * f - bc;\r\n\r\n\t\t\tte[ 2 ] = bc * f - ad;\r\n\t\t\tte[ 6 ] = b * e;\r\n\t\t\tte[ 10 ] = bd * f + ac;\r\n\r\n\t\t}\r\n\r\n\t\t// bottom row\r\n\t\tte[ 3 ] = 0;\r\n\t\tte[ 7 ] = 0;\r\n\t\tte[ 11 ] = 0;\r\n\r\n\t\t// last column\r\n\t\tte[ 12 ] = 0;\r\n\t\tte[ 13 ] = 0;\r\n\t\tte[ 14 ] = 0;\r\n\t\tte[ 15 ] = 1;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmakeRotationFromQuaternion( q ) {\r\n\r\n\t\treturn this.compose( _zero, q, _one );\r\n\r\n\t}\r\n\r\n\tlookAt( eye, target, up ) {\r\n\r\n\t\tconst te = this.elements;\r\n\r\n\t\t_z.subVectors( eye, target );\r\n\r\n\t\tif ( _z.lengthSq() === 0 ) {\r\n\r\n\t\t\t// eye and target are in the same position\r\n\r\n\t\t\t_z.z = 1;\r\n\r\n\t\t}\r\n\r\n\t\t_z.normalize();\r\n\t\t_x.crossVectors( up, _z );\r\n\r\n\t\tif ( _x.lengthSq() === 0 ) {\r\n\r\n\t\t\t// up and z are parallel\r\n\r\n\t\t\tif ( Math.abs( up.z ) === 1 ) {\r\n\r\n\t\t\t\t_z.x += 0.0001;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_z.z += 0.0001;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_z.normalize();\r\n\t\t\t_x.crossVectors( up, _z );\r\n\r\n\t\t}\r\n\r\n\t\t_x.normalize();\r\n\t\t_y.crossVectors( _z, _x );\r\n\r\n\t\tte[ 0 ] = _x.x; te[ 4 ] = _y.x; te[ 8 ] = _z.x;\r\n\t\tte[ 1 ] = _x.y; te[ 5 ] = _y.y; te[ 9 ] = _z.y;\r\n\t\tte[ 2 ] = _x.z; te[ 6 ] = _y.z; te[ 10 ] = _z.z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmultiply( m ) {\r\n\r\n\t\treturn this.multiplyMatrices( this, m );\r\n\r\n\t}\r\n\r\n\tpremultiply( m ) {\r\n\r\n\t\treturn this.multiplyMatrices( m, this );\r\n\r\n\t}\r\n\r\n\tmultiplyMatrices( a, b ) {\r\n\r\n\t\tconst ae = a.elements;\r\n\t\tconst be = b.elements;\r\n\t\tconst te = this.elements;\r\n\r\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];\r\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];\r\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];\r\n\t\tconst a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];\r\n\r\n\t\tconst b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];\r\n\t\tconst b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];\r\n\t\tconst b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];\r\n\t\tconst b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];\r\n\r\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;\r\n\t\tte[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;\r\n\t\tte[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;\r\n\t\tte[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;\r\n\r\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;\r\n\t\tte[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;\r\n\t\tte[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;\r\n\t\tte[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;\r\n\r\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;\r\n\t\tte[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;\r\n\t\tte[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;\r\n\t\tte[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;\r\n\r\n\t\tte[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;\r\n\t\tte[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;\r\n\t\tte[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;\r\n\t\tte[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmultiplyScalar( s ) {\r\n\r\n\t\tconst te = this.elements;\r\n\r\n\t\tte[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;\r\n\t\tte[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;\r\n\t\tte[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;\r\n\t\tte[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdeterminant() {\r\n\r\n\t\tconst te = this.elements;\r\n\r\n\t\tconst n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];\r\n\t\tconst n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];\r\n\t\tconst n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];\r\n\t\tconst n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];\r\n\r\n\t\t//TODO: make this more efficient\r\n\t\t//( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )\r\n\r\n\t\treturn (\r\n\t\t\tn41 * (\r\n\t\t\t\t+ n14 * n23 * n32\r\n\t\t\t\t - n13 * n24 * n32\r\n\t\t\t\t - n14 * n22 * n33\r\n\t\t\t\t + n12 * n24 * n33\r\n\t\t\t\t + n13 * n22 * n34\r\n\t\t\t\t - n12 * n23 * n34\r\n\t\t\t) +\r\n\t\t\tn42 * (\r\n\t\t\t\t+ n11 * n23 * n34\r\n\t\t\t\t - n11 * n24 * n33\r\n\t\t\t\t + n14 * n21 * n33\r\n\t\t\t\t - n13 * n21 * n34\r\n\t\t\t\t + n13 * n24 * n31\r\n\t\t\t\t - n14 * n23 * n31\r\n\t\t\t) +\r\n\t\t\tn43 * (\r\n\t\t\t\t+ n11 * n24 * n32\r\n\t\t\t\t - n11 * n22 * n34\r\n\t\t\t\t - n14 * n21 * n32\r\n\t\t\t\t + n12 * n21 * n34\r\n\t\t\t\t + n14 * n22 * n31\r\n\t\t\t\t - n12 * n24 * n31\r\n\t\t\t) +\r\n\t\t\tn44 * (\r\n\t\t\t\t- n13 * n22 * n31\r\n\t\t\t\t - n11 * n23 * n32\r\n\t\t\t\t + n11 * n22 * n33\r\n\t\t\t\t + n13 * n21 * n32\r\n\t\t\t\t - n12 * n21 * n33\r\n\t\t\t\t + n12 * n23 * n31\r\n\t\t\t)\r\n\r\n\t\t);\r\n\r\n\t}\r\n\r\n\ttranspose() {\r\n\r\n\t\tconst te = this.elements;\r\n\t\tlet tmp;\r\n\r\n\t\ttmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;\r\n\t\ttmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;\r\n\t\ttmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;\r\n\r\n\t\ttmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;\r\n\t\ttmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;\r\n\t\ttmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetPosition( x, y, z ) {\r\n\r\n\t\tconst te = this.elements;\r\n\r\n\t\tif ( x.isVector3 ) {\r\n\r\n\t\t\tte[ 12 ] = x.x;\r\n\t\t\tte[ 13 ] = x.y;\r\n\t\t\tte[ 14 ] = x.z;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tte[ 12 ] = x;\r\n\t\t\tte[ 13 ] = y;\r\n\t\t\tte[ 14 ] = z;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tinvert() {\r\n\r\n\t\t// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm\r\n\t\tconst te = this.elements,\r\n\r\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ], n41 = te[ 3 ],\r\n\t\t\tn12 = te[ 4 ], n22 = te[ 5 ], n32 = te[ 6 ], n42 = te[ 7 ],\r\n\t\t\tn13 = te[ 8 ], n23 = te[ 9 ], n33 = te[ 10 ], n43 = te[ 11 ],\r\n\t\t\tn14 = te[ 12 ], n24 = te[ 13 ], n34 = te[ 14 ], n44 = te[ 15 ],\r\n\r\n\t\t\tt11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,\r\n\t\t\tt12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,\r\n\t\t\tt13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,\r\n\t\t\tt14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;\r\n\r\n\t\tconst det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;\r\n\r\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );\r\n\r\n\t\tconst detInv = 1 / det;\r\n\r\n\t\tte[ 0 ] = t11 * detInv;\r\n\t\tte[ 1 ] = ( n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44 ) * detInv;\r\n\t\tte[ 2 ] = ( n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44 ) * detInv;\r\n\t\tte[ 3 ] = ( n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43 ) * detInv;\r\n\r\n\t\tte[ 4 ] = t12 * detInv;\r\n\t\tte[ 5 ] = ( n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44 ) * detInv;\r\n\t\tte[ 6 ] = ( n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44 ) * detInv;\r\n\t\tte[ 7 ] = ( n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43 ) * detInv;\r\n\r\n\t\tte[ 8 ] = t13 * detInv;\r\n\t\tte[ 9 ] = ( n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44 ) * detInv;\r\n\t\tte[ 10 ] = ( n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44 ) * detInv;\r\n\t\tte[ 11 ] = ( n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43 ) * detInv;\r\n\r\n\t\tte[ 12 ] = t14 * detInv;\r\n\t\tte[ 13 ] = ( n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34 ) * detInv;\r\n\t\tte[ 14 ] = ( n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34 ) * detInv;\r\n\t\tte[ 15 ] = ( n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33 ) * detInv;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tscale( v ) {\r\n\r\n\t\tconst te = this.elements;\r\n\t\tconst x = v.x, y = v.y, z = v.z;\r\n\r\n\t\tte[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;\r\n\t\tte[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;\r\n\t\tte[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;\r\n\t\tte[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetMaxScaleOnAxis() {\r\n\r\n\t\tconst te = this.elements;\r\n\r\n\t\tconst scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];\r\n\t\tconst scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];\r\n\t\tconst scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];\r\n\r\n\t\treturn Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) );\r\n\r\n\t}\r\n\r\n\tmakeTranslation( x, y, z ) {\r\n\r\n\t\tif ( x.isVector3 ) {\r\n\r\n\t\t\tthis.set(\r\n\r\n\t\t\t\t1, 0, 0, x.x,\r\n\t\t\t\t0, 1, 0, x.y,\r\n\t\t\t\t0, 0, 1, x.z,\r\n\t\t\t\t0, 0, 0, 1\r\n\r\n\t\t\t);\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.set(\r\n\r\n\t\t\t\t1, 0, 0, x,\r\n\t\t\t\t0, 1, 0, y,\r\n\t\t\t\t0, 0, 1, z,\r\n\t\t\t\t0, 0, 0, 1\r\n\r\n\t\t\t);\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmakeRotationX( theta ) {\r\n\r\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\t1, 0, 0, 0,\r\n\t\t\t0, c, - s, 0,\r\n\t\t\t0, s, c, 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmakeRotationY( theta ) {\r\n\r\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\t c, 0, s, 0,\r\n\t\t\t 0, 1, 0, 0,\r\n\t\t\t- s, 0, c, 0,\r\n\t\t\t 0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmakeRotationZ( theta ) {\r\n\r\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\tc, - s, 0, 0,\r\n\t\t\ts, c, 0, 0,\r\n\t\t\t0, 0, 1, 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmakeRotationAxis( axis, angle ) {\r\n\r\n\t\t// Based on http://www.gamedev.net/reference/articles/article1199.asp\r\n\r\n\t\tconst c = Math.cos( angle );\r\n\t\tconst s = Math.sin( angle );\r\n\t\tconst t = 1 - c;\r\n\t\tconst x = axis.x, y = axis.y, z = axis.z;\r\n\t\tconst tx = t * x, ty = t * y;\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\ttx * x + c, tx * y - s * z, tx * z + s * y, 0,\r\n\t\t\ttx * y + s * z, ty * y + c, ty * z - s * x, 0,\r\n\t\t\ttx * z - s * y, ty * z + s * x, t * z * z + c, 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmakeScale( x, y, z ) {\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\tx, 0, 0, 0,\r\n\t\t\t0, y, 0, 0,\r\n\t\t\t0, 0, z, 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmakeShear( xy, xz, yx, yz, zx, zy ) {\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\t1, yx, zx, 0,\r\n\t\t\txy, 1, zy, 0,\r\n\t\t\txz, yz, 1, 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcompose( position, quaternion, scale ) {\r\n\r\n\t\tconst te = this.elements;\r\n\r\n\t\tconst x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;\r\n\t\tconst x2 = x + x,\ty2 = y + y, z2 = z + z;\r\n\t\tconst xx = x * x2, xy = x * y2, xz = x * z2;\r\n\t\tconst yy = y * y2, yz = y * z2, zz = z * z2;\r\n\t\tconst wx = w * x2, wy = w * y2, wz = w * z2;\r\n\r\n\t\tconst sx = scale.x, sy = scale.y, sz = scale.z;\r\n\r\n\t\tte[ 0 ] = ( 1 - ( yy + zz ) ) * sx;\r\n\t\tte[ 1 ] = ( xy + wz ) * sx;\r\n\t\tte[ 2 ] = ( xz - wy ) * sx;\r\n\t\tte[ 3 ] = 0;\r\n\r\n\t\tte[ 4 ] = ( xy - wz ) * sy;\r\n\t\tte[ 5 ] = ( 1 - ( xx + zz ) ) * sy;\r\n\t\tte[ 6 ] = ( yz + wx ) * sy;\r\n\t\tte[ 7 ] = 0;\r\n\r\n\t\tte[ 8 ] = ( xz + wy ) * sz;\r\n\t\tte[ 9 ] = ( yz - wx ) * sz;\r\n\t\tte[ 10 ] = ( 1 - ( xx + yy ) ) * sz;\r\n\t\tte[ 11 ] = 0;\r\n\r\n\t\tte[ 12 ] = position.x;\r\n\t\tte[ 13 ] = position.y;\r\n\t\tte[ 14 ] = position.z;\r\n\t\tte[ 15 ] = 1;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdecompose( position, quaternion, scale ) {\r\n\r\n\t\tconst te = this.elements;\r\n\r\n\t\tlet sx = _v1$5.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();\r\n\t\tconst sy = _v1$5.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();\r\n\t\tconst sz = _v1$5.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();\r\n\r\n\t\t// if determine is negative, we need to invert one scale\r\n\t\tconst det = this.determinant();\r\n\t\tif ( det < 0 ) sx = - sx;\r\n\r\n\t\tposition.x = te[ 12 ];\r\n\t\tposition.y = te[ 13 ];\r\n\t\tposition.z = te[ 14 ];\r\n\r\n\t\t// scale the rotation part\r\n\t\t_m1$4.copy( this );\r\n\r\n\t\tconst invSX = 1 / sx;\r\n\t\tconst invSY = 1 / sy;\r\n\t\tconst invSZ = 1 / sz;\r\n\r\n\t\t_m1$4.elements[ 0 ] *= invSX;\r\n\t\t_m1$4.elements[ 1 ] *= invSX;\r\n\t\t_m1$4.elements[ 2 ] *= invSX;\r\n\r\n\t\t_m1$4.elements[ 4 ] *= invSY;\r\n\t\t_m1$4.elements[ 5 ] *= invSY;\r\n\t\t_m1$4.elements[ 6 ] *= invSY;\r\n\r\n\t\t_m1$4.elements[ 8 ] *= invSZ;\r\n\t\t_m1$4.elements[ 9 ] *= invSZ;\r\n\t\t_m1$4.elements[ 10 ] *= invSZ;\r\n\r\n\t\tquaternion.setFromRotationMatrix( _m1$4 );\r\n\r\n\t\tscale.x = sx;\r\n\t\tscale.y = sy;\r\n\t\tscale.z = sz;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmakePerspective( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {\r\n\r\n\t\tconst te = this.elements;\r\n\t\tconst x = 2 * near / ( right - left );\r\n\t\tconst y = 2 * near / ( top - bottom );\r\n\r\n\t\tconst a = ( right + left ) / ( right - left );\r\n\t\tconst b = ( top + bottom ) / ( top - bottom );\r\n\r\n\t\tlet c, d;\r\n\r\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\r\n\r\n\t\t\tc = - ( far + near ) / ( far - near );\r\n\t\t\td = ( - 2 * far * near ) / ( far - near );\r\n\r\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\r\n\r\n\t\t\tc = - far / ( far - near );\r\n\t\t\td = ( - far * near ) / ( far - near );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthrow new Error( 'THREE.Matrix4.makePerspective(): Invalid coordinate system: ' + coordinateSystem );\r\n\r\n\t\t}\r\n\r\n\t\tte[ 0 ] = x;\tte[ 4 ] = 0;\tte[ 8 ] = a; \tte[ 12 ] = 0;\r\n\t\tte[ 1 ] = 0;\tte[ 5 ] = y;\tte[ 9 ] = b; \tte[ 13 ] = 0;\r\n\t\tte[ 2 ] = 0;\tte[ 6 ] = 0;\tte[ 10 ] = c; \tte[ 14 ] = d;\r\n\t\tte[ 3 ] = 0;\tte[ 7 ] = 0;\tte[ 11 ] = - 1;\tte[ 15 ] = 0;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmakeOrthographic( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {\r\n\r\n\t\tconst te = this.elements;\r\n\t\tconst w = 1.0 / ( right - left );\r\n\t\tconst h = 1.0 / ( top - bottom );\r\n\t\tconst p = 1.0 / ( far - near );\r\n\r\n\t\tconst x = ( right + left ) * w;\r\n\t\tconst y = ( top + bottom ) * h;\r\n\r\n\t\tlet z, zInv;\r\n\r\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\r\n\r\n\t\t\tz = ( far + near ) * p;\r\n\t\t\tzInv = - 2 * p;\r\n\r\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\r\n\r\n\t\t\tz = near * p;\r\n\t\t\tzInv = - 1 * p;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthrow new Error( 'THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' + coordinateSystem );\r\n\r\n\t\t}\r\n\r\n\t\tte[ 0 ] = 2 * w;\tte[ 4 ] = 0;\t\tte[ 8 ] = 0; \t\tte[ 12 ] = - x;\r\n\t\tte[ 1 ] = 0; \t\tte[ 5 ] = 2 * h;\tte[ 9 ] = 0; \t\tte[ 13 ] = - y;\r\n\t\tte[ 2 ] = 0; \t\tte[ 6 ] = 0;\t\tte[ 10 ] = zInv;\tte[ 14 ] = - z;\r\n\t\tte[ 3 ] = 0; \t\tte[ 7 ] = 0;\t\tte[ 11 ] = 0;\t\tte[ 15 ] = 1;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tequals( matrix ) {\r\n\r\n\t\tconst te = this.elements;\r\n\t\tconst me = matrix.elements;\r\n\r\n\t\tfor ( let i = 0; i < 16; i ++ ) {\r\n\r\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t}\r\n\r\n\tfromArray( array, offset = 0 ) {\r\n\r\n\t\tfor ( let i = 0; i < 16; i ++ ) {\r\n\r\n\t\t\tthis.elements[ i ] = array[ i + offset ];\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoArray( array = [], offset = 0 ) {\r\n\r\n\t\tconst te = this.elements;\r\n\r\n\t\tarray[ offset ] = te[ 0 ];\r\n\t\tarray[ offset + 1 ] = te[ 1 ];\r\n\t\tarray[ offset + 2 ] = te[ 2 ];\r\n\t\tarray[ offset + 3 ] = te[ 3 ];\r\n\r\n\t\tarray[ offset + 4 ] = te[ 4 ];\r\n\t\tarray[ offset + 5 ] = te[ 5 ];\r\n\t\tarray[ offset + 6 ] = te[ 6 ];\r\n\t\tarray[ offset + 7 ] = te[ 7 ];\r\n\r\n\t\tarray[ offset + 8 ] = te[ 8 ];\r\n\t\tarray[ offset + 9 ] = te[ 9 ];\r\n\t\tarray[ offset + 10 ] = te[ 10 ];\r\n\t\tarray[ offset + 11 ] = te[ 11 ];\r\n\r\n\t\tarray[ offset + 12 ] = te[ 12 ];\r\n\t\tarray[ offset + 13 ] = te[ 13 ];\r\n\t\tarray[ offset + 14 ] = te[ 14 ];\r\n\t\tarray[ offset + 15 ] = te[ 15 ];\r\n\r\n\t\treturn array;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _v1$5 = /*@__PURE__*/ new Vector3();\r\nconst _m1$4 = /*@__PURE__*/ new Matrix4();\r\nconst _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );\r\nconst _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );\r\nconst _x = /*@__PURE__*/ new Vector3();\r\nconst _y = /*@__PURE__*/ new Vector3();\r\nconst _z = /*@__PURE__*/ new Vector3();\r\n\r\nconst _matrix$2 = /*@__PURE__*/ new Matrix4();\r\nconst _quaternion$3 = /*@__PURE__*/ new Quaternion();\r\n\r\nclass Euler {\r\n\r\n\tconstructor( x = 0, y = 0, z = 0, order = Euler.DEFAULT_ORDER ) {\r\n\r\n\t\tthis.isEuler = true;\r\n\r\n\t\tthis._x = x;\r\n\t\tthis._y = y;\r\n\t\tthis._z = z;\r\n\t\tthis._order = order;\r\n\r\n\t}\r\n\r\n\tget x() {\r\n\r\n\t\treturn this._x;\r\n\r\n\t}\r\n\r\n\tset x( value ) {\r\n\r\n\t\tthis._x = value;\r\n\t\tthis._onChangeCallback();\r\n\r\n\t}\r\n\r\n\tget y() {\r\n\r\n\t\treturn this._y;\r\n\r\n\t}\r\n\r\n\tset y( value ) {\r\n\r\n\t\tthis._y = value;\r\n\t\tthis._onChangeCallback();\r\n\r\n\t}\r\n\r\n\tget z() {\r\n\r\n\t\treturn this._z;\r\n\r\n\t}\r\n\r\n\tset z( value ) {\r\n\r\n\t\tthis._z = value;\r\n\t\tthis._onChangeCallback();\r\n\r\n\t}\r\n\r\n\tget order() {\r\n\r\n\t\treturn this._order;\r\n\r\n\t}\r\n\r\n\tset order( value ) {\r\n\r\n\t\tthis._order = value;\r\n\t\tthis._onChangeCallback();\r\n\r\n\t}\r\n\r\n\tset( x, y, z, order = this._order ) {\r\n\r\n\t\tthis._x = x;\r\n\t\tthis._y = y;\r\n\t\tthis._z = z;\r\n\t\tthis._order = order;\r\n\r\n\t\tthis._onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor( this._x, this._y, this._z, this._order );\r\n\r\n\t}\r\n\r\n\tcopy( euler ) {\r\n\r\n\t\tthis._x = euler._x;\r\n\t\tthis._y = euler._y;\r\n\t\tthis._z = euler._z;\r\n\t\tthis._order = euler._order;\r\n\r\n\t\tthis._onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromRotationMatrix( m, order = this._order, update = true ) {\r\n\r\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\r\n\r\n\t\tconst te = m.elements;\r\n\t\tconst m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ];\r\n\t\tconst m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ];\r\n\t\tconst m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\r\n\r\n\t\tswitch ( order ) {\r\n\r\n\t\t\tcase 'XYZ':\r\n\r\n\t\t\t\tthis._y = Math.asin( clamp( m13, - 1, 1 ) );\r\n\r\n\t\t\t\tif ( Math.abs( m13 ) < 0.9999999 ) {\r\n\r\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\r\n\t\t\t\t\tthis._z = Math.atan2( - m12, m11 );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\r\n\t\t\t\t\tthis._z = 0;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'YXZ':\r\n\r\n\t\t\t\tthis._x = Math.asin( - clamp( m23, - 1, 1 ) );\r\n\r\n\t\t\t\tif ( Math.abs( m23 ) < 0.9999999 ) {\r\n\r\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\r\n\t\t\t\t\tthis._z = Math.atan2( m21, m22 );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\r\n\t\t\t\t\tthis._z = 0;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'ZXY':\r\n\r\n\t\t\t\tthis._x = Math.asin( clamp( m32, - 1, 1 ) );\r\n\r\n\t\t\t\tif ( Math.abs( m32 ) < 0.9999999 ) {\r\n\r\n\t\t\t\t\tthis._y = Math.atan2( - m31, m33 );\r\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tthis._y = 0;\r\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'ZYX':\r\n\r\n\t\t\t\tthis._y = Math.asin( - clamp( m31, - 1, 1 ) );\r\n\r\n\t\t\t\tif ( Math.abs( m31 ) < 0.9999999 ) {\r\n\r\n\t\t\t\t\tthis._x = Math.atan2( m32, m33 );\r\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tthis._x = 0;\r\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'YZX':\r\n\r\n\t\t\t\tthis._z = Math.asin( clamp( m21, - 1, 1 ) );\r\n\r\n\t\t\t\tif ( Math.abs( m21 ) < 0.9999999 ) {\r\n\r\n\t\t\t\t\tthis._x = Math.atan2( - m23, m22 );\r\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tthis._x = 0;\r\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'XZY':\r\n\r\n\t\t\t\tthis._z = Math.asin( - clamp( m12, - 1, 1 ) );\r\n\r\n\t\t\t\tif ( Math.abs( m12 ) < 0.9999999 ) {\r\n\r\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\r\n\t\t\t\t\tthis._y = Math.atan2( m13, m11 );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\r\n\t\t\t\t\tthis._y = 0;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tdefault:\r\n\r\n\t\t\t\tconsole.warn( 'THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order );\r\n\r\n\t\t}\r\n\r\n\t\tthis._order = order;\r\n\r\n\t\tif ( update === true ) this._onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromQuaternion( q, order, update ) {\r\n\r\n\t\t_matrix$2.makeRotationFromQuaternion( q );\r\n\r\n\t\treturn this.setFromRotationMatrix( _matrix$2, order, update );\r\n\r\n\t}\r\n\r\n\tsetFromVector3( v, order = this._order ) {\r\n\r\n\t\treturn this.set( v.x, v.y, v.z, order );\r\n\r\n\t}\r\n\r\n\treorder( newOrder ) {\r\n\r\n\t\t// WARNING: this discards revolution information -bhouston\r\n\r\n\t\t_quaternion$3.setFromEuler( this );\r\n\r\n\t\treturn this.setFromQuaternion( _quaternion$3, newOrder );\r\n\r\n\t}\r\n\r\n\tequals( euler ) {\r\n\r\n\t\treturn ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order );\r\n\r\n\t}\r\n\r\n\tfromArray( array ) {\r\n\r\n\t\tthis._x = array[ 0 ];\r\n\t\tthis._y = array[ 1 ];\r\n\t\tthis._z = array[ 2 ];\r\n\t\tif ( array[ 3 ] !== undefined ) this._order = array[ 3 ];\r\n\r\n\t\tthis._onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoArray( array = [], offset = 0 ) {\r\n\r\n\t\tarray[ offset ] = this._x;\r\n\t\tarray[ offset + 1 ] = this._y;\r\n\t\tarray[ offset + 2 ] = this._z;\r\n\t\tarray[ offset + 3 ] = this._order;\r\n\r\n\t\treturn array;\r\n\r\n\t}\r\n\r\n\t_onChange( callback ) {\r\n\r\n\t\tthis._onChangeCallback = callback;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t_onChangeCallback() {}\r\n\r\n\t*[ Symbol.iterator ]() {\r\n\r\n\t\tyield this._x;\r\n\t\tyield this._y;\r\n\t\tyield this._z;\r\n\t\tyield this._order;\r\n\r\n\t}\r\n\r\n}\r\n\r\nEuler.DEFAULT_ORDER = 'XYZ';\r\n\r\nclass Layers {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.mask = 1 | 0;\r\n\r\n\t}\r\n\r\n\tset( channel ) {\r\n\r\n\t\tthis.mask = ( 1 << channel | 0 ) >>> 0;\r\n\r\n\t}\r\n\r\n\tenable( channel ) {\r\n\r\n\t\tthis.mask |= 1 << channel | 0;\r\n\r\n\t}\r\n\r\n\tenableAll() {\r\n\r\n\t\tthis.mask = 0xffffffff | 0;\r\n\r\n\t}\r\n\r\n\ttoggle( channel ) {\r\n\r\n\t\tthis.mask ^= 1 << channel | 0;\r\n\r\n\t}\r\n\r\n\tdisable( channel ) {\r\n\r\n\t\tthis.mask &= ~ ( 1 << channel | 0 );\r\n\r\n\t}\r\n\r\n\tdisableAll() {\r\n\r\n\t\tthis.mask = 0;\r\n\r\n\t}\r\n\r\n\ttest( layers ) {\r\n\r\n\t\treturn ( this.mask & layers.mask ) !== 0;\r\n\r\n\t}\r\n\r\n\tisEnabled( channel ) {\r\n\r\n\t\treturn ( this.mask & ( 1 << channel | 0 ) ) !== 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nlet _object3DId = 0;\r\n\r\nconst _v1$4 = /*@__PURE__*/ new Vector3();\r\nconst _q1 = /*@__PURE__*/ new Quaternion();\r\nconst _m1$3 = /*@__PURE__*/ new Matrix4();\r\nconst _target = /*@__PURE__*/ new Vector3();\r\n\r\nconst _position$3 = /*@__PURE__*/ new Vector3();\r\nconst _scale$2 = /*@__PURE__*/ new Vector3();\r\nconst _quaternion$2 = /*@__PURE__*/ new Quaternion();\r\n\r\nconst _xAxis = /*@__PURE__*/ new Vector3( 1, 0, 0 );\r\nconst _yAxis = /*@__PURE__*/ new Vector3( 0, 1, 0 );\r\nconst _zAxis = /*@__PURE__*/ new Vector3( 0, 0, 1 );\r\n\r\nconst _addedEvent = { type: 'added' };\r\nconst _removedEvent = { type: 'removed' };\r\n\r\nconst _childaddedEvent = { type: 'childadded', child: null };\r\nconst _childremovedEvent = { type: 'childremoved', child: null };\r\n\r\nclass Object3D extends EventDispatcher {\r\n\r\n\tconstructor() {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isObject3D = true;\r\n\r\n\t\tObject.defineProperty( this, 'id', { value: _object3DId ++ } );\r\n\r\n\t\tthis.uuid = generateUUID();\r\n\r\n\t\tthis.name = '';\r\n\t\tthis.type = 'Object3D';\r\n\r\n\t\tthis.parent = null;\r\n\t\tthis.children = [];\r\n\r\n\t\tthis.up = Object3D.DEFAULT_UP.clone();\r\n\r\n\t\tconst position = new Vector3();\r\n\t\tconst rotation = new Euler();\r\n\t\tconst quaternion = new Quaternion();\r\n\t\tconst scale = new Vector3( 1, 1, 1 );\r\n\r\n\t\tfunction onRotationChange() {\r\n\r\n\t\t\tquaternion.setFromEuler( rotation, false );\r\n\r\n\t\t}\r\n\r\n\t\tfunction onQuaternionChange() {\r\n\r\n\t\t\trotation.setFromQuaternion( quaternion, undefined, false );\r\n\r\n\t\t}\r\n\r\n\t\trotation._onChange( onRotationChange );\r\n\t\tquaternion._onChange( onQuaternionChange );\r\n\r\n\t\tObject.defineProperties( this, {\r\n\t\t\tposition: {\r\n\t\t\t\tconfigurable: true,\r\n\t\t\t\tenumerable: true,\r\n\t\t\t\tvalue: position\r\n\t\t\t},\r\n\t\t\trotation: {\r\n\t\t\t\tconfigurable: true,\r\n\t\t\t\tenumerable: true,\r\n\t\t\t\tvalue: rotation\r\n\t\t\t},\r\n\t\t\tquaternion: {\r\n\t\t\t\tconfigurable: true,\r\n\t\t\t\tenumerable: true,\r\n\t\t\t\tvalue: quaternion\r\n\t\t\t},\r\n\t\t\tscale: {\r\n\t\t\t\tconfigurable: true,\r\n\t\t\t\tenumerable: true,\r\n\t\t\t\tvalue: scale\r\n\t\t\t},\r\n\t\t\tmodelViewMatrix: {\r\n\t\t\t\tvalue: new Matrix4()\r\n\t\t\t},\r\n\t\t\tnormalMatrix: {\r\n\t\t\t\tvalue: new Matrix3()\r\n\t\t\t}\r\n\t\t} );\r\n\r\n\t\tthis.matrix = new Matrix4();\r\n\t\tthis.matrixWorld = new Matrix4();\r\n\r\n\t\tthis.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;\r\n\r\n\t\tthis.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer\r\n\t\tthis.matrixWorldNeedsUpdate = false;\r\n\r\n\t\tthis.layers = new Layers();\r\n\t\tthis.visible = true;\r\n\r\n\t\tthis.castShadow = false;\r\n\t\tthis.receiveShadow = false;\r\n\r\n\t\tthis.frustumCulled = true;\r\n\t\tthis.renderOrder = 0;\r\n\r\n\t\tthis.animations = [];\r\n\r\n\t\tthis.userData = {};\r\n\r\n\t}\r\n\r\n\tonBeforeShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}\r\n\r\n\tonAfterShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}\r\n\r\n\tonBeforeRender( /* renderer, scene, camera, geometry, material, group */ ) {}\r\n\r\n\tonAfterRender( /* renderer, scene, camera, geometry, material, group */ ) {}\r\n\r\n\tapplyMatrix4( matrix ) {\r\n\r\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\r\n\r\n\t\tthis.matrix.premultiply( matrix );\r\n\r\n\t\tthis.matrix.decompose( this.position, this.quaternion, this.scale );\r\n\r\n\t}\r\n\r\n\tapplyQuaternion( q ) {\r\n\r\n\t\tthis.quaternion.premultiply( q );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetRotationFromAxisAngle( axis, angle ) {\r\n\r\n\t\t// assumes axis is normalized\r\n\r\n\t\tthis.quaternion.setFromAxisAngle( axis, angle );\r\n\r\n\t}\r\n\r\n\tsetRotationFromEuler( euler ) {\r\n\r\n\t\tthis.quaternion.setFromEuler( euler, true );\r\n\r\n\t}\r\n\r\n\tsetRotationFromMatrix( m ) {\r\n\r\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\r\n\r\n\t\tthis.quaternion.setFromRotationMatrix( m );\r\n\r\n\t}\r\n\r\n\tsetRotationFromQuaternion( q ) {\r\n\r\n\t\t// assumes q is normalized\r\n\r\n\t\tthis.quaternion.copy( q );\r\n\r\n\t}\r\n\r\n\trotateOnAxis( axis, angle ) {\r\n\r\n\t\t// rotate object on axis in object space\r\n\t\t// axis is assumed to be normalized\r\n\r\n\t\t_q1.setFromAxisAngle( axis, angle );\r\n\r\n\t\tthis.quaternion.multiply( _q1 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\trotateOnWorldAxis( axis, angle ) {\r\n\r\n\t\t// rotate object on axis in world space\r\n\t\t// axis is assumed to be normalized\r\n\t\t// method assumes no rotated parent\r\n\r\n\t\t_q1.setFromAxisAngle( axis, angle );\r\n\r\n\t\tthis.quaternion.premultiply( _q1 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\trotateX( angle ) {\r\n\r\n\t\treturn this.rotateOnAxis( _xAxis, angle );\r\n\r\n\t}\r\n\r\n\trotateY( angle ) {\r\n\r\n\t\treturn this.rotateOnAxis( _yAxis, angle );\r\n\r\n\t}\r\n\r\n\trotateZ( angle ) {\r\n\r\n\t\treturn this.rotateOnAxis( _zAxis, angle );\r\n\r\n\t}\r\n\r\n\ttranslateOnAxis( axis, distance ) {\r\n\r\n\t\t// translate object by distance along axis in object space\r\n\t\t// axis is assumed to be normalized\r\n\r\n\t\t_v1$4.copy( axis ).applyQuaternion( this.quaternion );\r\n\r\n\t\tthis.position.add( _v1$4.multiplyScalar( distance ) );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttranslateX( distance ) {\r\n\r\n\t\treturn this.translateOnAxis( _xAxis, distance );\r\n\r\n\t}\r\n\r\n\ttranslateY( distance ) {\r\n\r\n\t\treturn this.translateOnAxis( _yAxis, distance );\r\n\r\n\t}\r\n\r\n\ttranslateZ( distance ) {\r\n\r\n\t\treturn this.translateOnAxis( _zAxis, distance );\r\n\r\n\t}\r\n\r\n\tlocalToWorld( vector ) {\r\n\r\n\t\tthis.updateWorldMatrix( true, false );\r\n\r\n\t\treturn vector.applyMatrix4( this.matrixWorld );\r\n\r\n\t}\r\n\r\n\tworldToLocal( vector ) {\r\n\r\n\t\tthis.updateWorldMatrix( true, false );\r\n\r\n\t\treturn vector.applyMatrix4( _m1$3.copy( this.matrixWorld ).invert() );\r\n\r\n\t}\r\n\r\n\tlookAt( x, y, z ) {\r\n\r\n\t\t// This method does not support objects having non-uniformly-scaled parent(s)\r\n\r\n\t\tif ( x.isVector3 ) {\r\n\r\n\t\t\t_target.copy( x );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_target.set( x, y, z );\r\n\r\n\t\t}\r\n\r\n\t\tconst parent = this.parent;\r\n\r\n\t\tthis.updateWorldMatrix( true, false );\r\n\r\n\t\t_position$3.setFromMatrixPosition( this.matrixWorld );\r\n\r\n\t\tif ( this.isCamera || this.isLight ) {\r\n\r\n\t\t\t_m1$3.lookAt( _position$3, _target, this.up );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_m1$3.lookAt( _target, _position$3, this.up );\r\n\r\n\t\t}\r\n\r\n\t\tthis.quaternion.setFromRotationMatrix( _m1$3 );\r\n\r\n\t\tif ( parent ) {\r\n\r\n\t\t\t_m1$3.extractRotation( parent.matrixWorld );\r\n\t\t\t_q1.setFromRotationMatrix( _m1$3 );\r\n\t\t\tthis.quaternion.premultiply( _q1.invert() );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tadd( object ) {\r\n\r\n\t\tif ( arguments.length > 1 ) {\r\n\r\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\r\n\r\n\t\t\t\tthis.add( arguments[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tif ( object === this ) {\r\n\r\n\t\t\tconsole.error( 'THREE.Object3D.add: object can\\'t be added as a child of itself.', object );\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tif ( object && object.isObject3D ) {\r\n\r\n\t\t\tobject.removeFromParent();\r\n\t\t\tobject.parent = this;\r\n\t\t\tthis.children.push( object );\r\n\r\n\t\t\tobject.dispatchEvent( _addedEvent );\r\n\r\n\t\t\t_childaddedEvent.child = object;\r\n\t\t\tthis.dispatchEvent( _childaddedEvent );\r\n\t\t\t_childaddedEvent.child = null;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconsole.error( 'THREE.Object3D.add: object not an instance of THREE.Object3D.', object );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tremove( object ) {\r\n\r\n\t\tif ( arguments.length > 1 ) {\r\n\r\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\r\n\r\n\t\t\t\tthis.remove( arguments[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tconst index = this.children.indexOf( object );\r\n\r\n\t\tif ( index !== - 1 ) {\r\n\r\n\t\t\tobject.parent = null;\r\n\t\t\tthis.children.splice( index, 1 );\r\n\r\n\t\t\tobject.dispatchEvent( _removedEvent );\r\n\r\n\t\t\t_childremovedEvent.child = object;\r\n\t\t\tthis.dispatchEvent( _childremovedEvent );\r\n\t\t\t_childremovedEvent.child = null;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tremoveFromParent() {\r\n\r\n\t\tconst parent = this.parent;\r\n\r\n\t\tif ( parent !== null ) {\r\n\r\n\t\t\tparent.remove( this );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclear() {\r\n\r\n\t\treturn this.remove( ... this.children );\r\n\r\n\t}\r\n\r\n\tattach( object ) {\r\n\r\n\t\t// adds object as a child of this, while maintaining the object's world transform\r\n\r\n\t\t// Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)\r\n\r\n\t\tthis.updateWorldMatrix( true, false );\r\n\r\n\t\t_m1$3.copy( this.matrixWorld ).invert();\r\n\r\n\t\tif ( object.parent !== null ) {\r\n\r\n\t\t\tobject.parent.updateWorldMatrix( true, false );\r\n\r\n\t\t\t_m1$3.multiply( object.parent.matrixWorld );\r\n\r\n\t\t}\r\n\r\n\t\tobject.applyMatrix4( _m1$3 );\r\n\r\n\t\tobject.removeFromParent();\r\n\t\tobject.parent = this;\r\n\t\tthis.children.push( object );\r\n\r\n\t\tobject.updateWorldMatrix( false, true );\r\n\r\n\t\tobject.dispatchEvent( _addedEvent );\r\n\r\n\t\t_childaddedEvent.child = object;\r\n\t\tthis.dispatchEvent( _childaddedEvent );\r\n\t\t_childaddedEvent.child = null;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetObjectById( id ) {\r\n\r\n\t\treturn this.getObjectByProperty( 'id', id );\r\n\r\n\t}\r\n\r\n\tgetObjectByName( name ) {\r\n\r\n\t\treturn this.getObjectByProperty( 'name', name );\r\n\r\n\t}\r\n\r\n\tgetObjectByProperty( name, value ) {\r\n\r\n\t\tif ( this[ name ] === value ) return this;\r\n\r\n\t\tfor ( let i = 0, l = this.children.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst child = this.children[ i ];\r\n\t\t\tconst object = child.getObjectByProperty( name, value );\r\n\r\n\t\t\tif ( object !== undefined ) {\r\n\r\n\t\t\t\treturn object;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn undefined;\r\n\r\n\t}\r\n\r\n\tgetObjectsByProperty( name, value, result = [] ) {\r\n\r\n\t\tif ( this[ name ] === value ) result.push( this );\r\n\r\n\t\tconst children = this.children;\r\n\r\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\r\n\r\n\t\t\tchildren[ i ].getObjectsByProperty( name, value, result );\r\n\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tgetWorldPosition( target ) {\r\n\r\n\t\tthis.updateWorldMatrix( true, false );\r\n\r\n\t\treturn target.setFromMatrixPosition( this.matrixWorld );\r\n\r\n\t}\r\n\r\n\tgetWorldQuaternion( target ) {\r\n\r\n\t\tthis.updateWorldMatrix( true, false );\r\n\r\n\t\tthis.matrixWorld.decompose( _position$3, target, _scale$2 );\r\n\r\n\t\treturn target;\r\n\r\n\t}\r\n\r\n\tgetWorldScale( target ) {\r\n\r\n\t\tthis.updateWorldMatrix( true, false );\r\n\r\n\t\tthis.matrixWorld.decompose( _position$3, _quaternion$2, target );\r\n\r\n\t\treturn target;\r\n\r\n\t}\r\n\r\n\tgetWorldDirection( target ) {\r\n\r\n\t\tthis.updateWorldMatrix( true, false );\r\n\r\n\t\tconst e = this.matrixWorld.elements;\r\n\r\n\t\treturn target.set( e[ 8 ], e[ 9 ], e[ 10 ] ).normalize();\r\n\r\n\t}\r\n\r\n\traycast( /* raycaster, intersects */ ) {}\r\n\r\n\ttraverse( callback ) {\r\n\r\n\t\tcallback( this );\r\n\r\n\t\tconst children = this.children;\r\n\r\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\r\n\r\n\t\t\tchildren[ i ].traverse( callback );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ttraverseVisible( callback ) {\r\n\r\n\t\tif ( this.visible === false ) return;\r\n\r\n\t\tcallback( this );\r\n\r\n\t\tconst children = this.children;\r\n\r\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\r\n\r\n\t\t\tchildren[ i ].traverseVisible( callback );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ttraverseAncestors( callback ) {\r\n\r\n\t\tconst parent = this.parent;\r\n\r\n\t\tif ( parent !== null ) {\r\n\r\n\t\t\tcallback( parent );\r\n\r\n\t\t\tparent.traverseAncestors( callback );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrix() {\r\n\r\n\t\tthis.matrix.compose( this.position, this.quaternion, this.scale );\r\n\r\n\t\tthis.matrixWorldNeedsUpdate = true;\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( force ) {\r\n\r\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\r\n\r\n\t\tif ( this.matrixWorldNeedsUpdate || force ) {\r\n\r\n\t\t\tif ( this.matrixWorldAutoUpdate === true ) {\r\n\r\n\t\t\t\tif ( this.parent === null ) {\r\n\r\n\t\t\t\t\tthis.matrixWorld.copy( this.matrix );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.matrixWorldNeedsUpdate = false;\r\n\r\n\t\t\tforce = true;\r\n\r\n\t\t}\r\n\r\n\t\t// make sure descendants are updated if required\r\n\r\n\t\tconst children = this.children;\r\n\r\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst child = children[ i ];\r\n\r\n\t\t\tchild.updateMatrixWorld( force );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateWorldMatrix( updateParents, updateChildren ) {\r\n\r\n\t\tconst parent = this.parent;\r\n\r\n\t\tif ( updateParents === true && parent !== null ) {\r\n\r\n\t\t\tparent.updateWorldMatrix( true, false );\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\r\n\r\n\t\tif ( this.matrixWorldAutoUpdate === true ) {\r\n\r\n\t\t\tif ( this.parent === null ) {\r\n\r\n\t\t\t\tthis.matrixWorld.copy( this.matrix );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// make sure descendants are updated\r\n\r\n\t\tif ( updateChildren === true ) {\r\n\r\n\t\t\tconst children = this.children;\r\n\r\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tconst child = children[ i ];\r\n\r\n\t\t\t\tchild.updateWorldMatrix( false, true );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ttoJSON( meta ) {\r\n\r\n\t\t// meta is a string when called from JSON.stringify\r\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\r\n\r\n\t\tconst output = {};\r\n\r\n\t\t// meta is a hash used to collect geometries, materials.\r\n\t\t// not providing it implies that this is the root object\r\n\t\t// being serialized.\r\n\t\tif ( isRootObject ) {\r\n\r\n\t\t\t// initialize meta obj\r\n\t\t\tmeta = {\r\n\t\t\t\tgeometries: {},\r\n\t\t\t\tmaterials: {},\r\n\t\t\t\ttextures: {},\r\n\t\t\t\timages: {},\r\n\t\t\t\tshapes: {},\r\n\t\t\t\tskeletons: {},\r\n\t\t\t\tanimations: {},\r\n\t\t\t\tnodes: {}\r\n\t\t\t};\r\n\r\n\t\t\toutput.metadata = {\r\n\t\t\t\tversion: 4.6,\r\n\t\t\t\ttype: 'Object',\r\n\t\t\t\tgenerator: 'Object3D.toJSON'\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t\t// standard Object3D serialization\r\n\r\n\t\tconst object = {};\r\n\r\n\t\tobject.uuid = this.uuid;\r\n\t\tobject.type = this.type;\r\n\r\n\t\tif ( this.name !== '' ) object.name = this.name;\r\n\t\tif ( this.castShadow === true ) object.castShadow = true;\r\n\t\tif ( this.receiveShadow === true ) object.receiveShadow = true;\r\n\t\tif ( this.visible === false ) object.visible = false;\r\n\t\tif ( this.frustumCulled === false ) object.frustumCulled = false;\r\n\t\tif ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;\r\n\t\tif ( Object.keys( this.userData ).length > 0 ) object.userData = this.userData;\r\n\r\n\t\tobject.layers = this.layers.mask;\r\n\t\tobject.matrix = this.matrix.toArray();\r\n\t\tobject.up = this.up.toArray();\r\n\r\n\t\tif ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;\r\n\r\n\t\t// object specific properties\r\n\r\n\t\tif ( this.isInstancedMesh ) {\r\n\r\n\t\t\tobject.type = 'InstancedMesh';\r\n\t\t\tobject.count = this.count;\r\n\t\t\tobject.instanceMatrix = this.instanceMatrix.toJSON();\r\n\t\t\tif ( this.instanceColor !== null ) object.instanceColor = this.instanceColor.toJSON();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.isBatchedMesh ) {\r\n\r\n\t\t\tobject.type = 'BatchedMesh';\r\n\t\t\tobject.perObjectFrustumCulled = this.perObjectFrustumCulled;\r\n\t\t\tobject.sortObjects = this.sortObjects;\r\n\r\n\t\t\tobject.drawRanges = this._drawRanges;\r\n\t\t\tobject.reservedRanges = this._reservedRanges;\r\n\r\n\t\t\tobject.visibility = this._visibility;\r\n\t\t\tobject.active = this._active;\r\n\t\t\tobject.bounds = this._bounds.map( bound => ( {\r\n\t\t\t\tboxInitialized: bound.boxInitialized,\r\n\t\t\t\tboxMin: bound.box.min.toArray(),\r\n\t\t\t\tboxMax: bound.box.max.toArray(),\r\n\r\n\t\t\t\tsphereInitialized: bound.sphereInitialized,\r\n\t\t\t\tsphereRadius: bound.sphere.radius,\r\n\t\t\t\tsphereCenter: bound.sphere.center.toArray()\r\n\t\t\t} ) );\r\n\r\n\t\t\tobject.maxInstanceCount = this._maxInstanceCount;\r\n\t\t\tobject.maxVertexCount = this._maxVertexCount;\r\n\t\t\tobject.maxIndexCount = this._maxIndexCount;\r\n\r\n\t\t\tobject.geometryInitialized = this._geometryInitialized;\r\n\t\t\tobject.geometryCount = this._geometryCount;\r\n\r\n\t\t\tobject.matricesTexture = this._matricesTexture.toJSON( meta );\r\n\r\n\t\t\tif ( this._colorsTexture !== null ) object.colorsTexture = this._colorsTexture.toJSON( meta );\r\n\r\n\t\t\tif ( this.boundingSphere !== null ) {\r\n\r\n\t\t\t\tobject.boundingSphere = {\r\n\t\t\t\t\tcenter: object.boundingSphere.center.toArray(),\r\n\t\t\t\t\tradius: object.boundingSphere.radius\r\n\t\t\t\t};\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( this.boundingBox !== null ) {\r\n\r\n\t\t\t\tobject.boundingBox = {\r\n\t\t\t\t\tmin: object.boundingBox.min.toArray(),\r\n\t\t\t\t\tmax: object.boundingBox.max.toArray()\r\n\t\t\t\t};\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t//\r\n\r\n\t\tfunction serialize( library, element ) {\r\n\r\n\t\t\tif ( library[ element.uuid ] === undefined ) {\r\n\r\n\t\t\t\tlibrary[ element.uuid ] = element.toJSON( meta );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn element.uuid;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.isScene ) {\r\n\r\n\t\t\tif ( this.background ) {\r\n\r\n\t\t\t\tif ( this.background.isColor ) {\r\n\r\n\t\t\t\t\tobject.background = this.background.toJSON();\r\n\r\n\t\t\t\t} else if ( this.background.isTexture ) {\r\n\r\n\t\t\t\t\tobject.background = this.background.toJSON( meta ).uuid;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true ) {\r\n\r\n\t\t\t\tobject.environment = this.environment.toJSON( meta ).uuid;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( this.isMesh || this.isLine || this.isPoints ) {\r\n\r\n\t\t\tobject.geometry = serialize( meta.geometries, this.geometry );\r\n\r\n\t\t\tconst parameters = this.geometry.parameters;\r\n\r\n\t\t\tif ( parameters !== undefined && parameters.shapes !== undefined ) {\r\n\r\n\t\t\t\tconst shapes = parameters.shapes;\r\n\r\n\t\t\t\tif ( Array.isArray( shapes ) ) {\r\n\r\n\t\t\t\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\r\n\r\n\t\t\t\t\t\tconst shape = shapes[ i ];\r\n\r\n\t\t\t\t\t\tserialize( meta.shapes, shape );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tserialize( meta.shapes, shapes );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.isSkinnedMesh ) {\r\n\r\n\t\t\tobject.bindMode = this.bindMode;\r\n\t\t\tobject.bindMatrix = this.bindMatrix.toArray();\r\n\r\n\t\t\tif ( this.skeleton !== undefined ) {\r\n\r\n\t\t\t\tserialize( meta.skeletons, this.skeleton );\r\n\r\n\t\t\t\tobject.skeleton = this.skeleton.uuid;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.material !== undefined ) {\r\n\r\n\t\t\tif ( Array.isArray( this.material ) ) {\r\n\r\n\t\t\t\tconst uuids = [];\r\n\r\n\t\t\t\tfor ( let i = 0, l = this.material.length; i < l; i ++ ) {\r\n\r\n\t\t\t\t\tuuids.push( serialize( meta.materials, this.material[ i ] ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tobject.material = uuids;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tobject.material = serialize( meta.materials, this.material );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t//\r\n\r\n\t\tif ( this.children.length > 0 ) {\r\n\r\n\t\t\tobject.children = [];\r\n\r\n\t\t\tfor ( let i = 0; i < this.children.length; i ++ ) {\r\n\r\n\t\t\t\tobject.children.push( this.children[ i ].toJSON( meta ).object );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t//\r\n\r\n\t\tif ( this.animations.length > 0 ) {\r\n\r\n\t\t\tobject.animations = [];\r\n\r\n\t\t\tfor ( let i = 0; i < this.animations.length; i ++ ) {\r\n\r\n\t\t\t\tconst animation = this.animations[ i ];\r\n\r\n\t\t\t\tobject.animations.push( serialize( meta.animations, animation ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( isRootObject ) {\r\n\r\n\t\t\tconst geometries = extractFromCache( meta.geometries );\r\n\t\t\tconst materials = extractFromCache( meta.materials );\r\n\t\t\tconst textures = extractFromCache( meta.textures );\r\n\t\t\tconst images = extractFromCache( meta.images );\r\n\t\t\tconst shapes = extractFromCache( meta.shapes );\r\n\t\t\tconst skeletons = extractFromCache( meta.skeletons );\r\n\t\t\tconst animations = extractFromCache( meta.animations );\r\n\t\t\tconst nodes = extractFromCache( meta.nodes );\r\n\r\n\t\t\tif ( geometries.length > 0 ) output.geometries = geometries;\r\n\t\t\tif ( materials.length > 0 ) output.materials = materials;\r\n\t\t\tif ( textures.length > 0 ) output.textures = textures;\r\n\t\t\tif ( images.length > 0 ) output.images = images;\r\n\t\t\tif ( shapes.length > 0 ) output.shapes = shapes;\r\n\t\t\tif ( skeletons.length > 0 ) output.skeletons = skeletons;\r\n\t\t\tif ( animations.length > 0 ) output.animations = animations;\r\n\t\t\tif ( nodes.length > 0 ) output.nodes = nodes;\r\n\r\n\t\t}\r\n\r\n\t\toutput.object = object;\r\n\r\n\t\treturn output;\r\n\r\n\t\t// extract data from the cache hash\r\n\t\t// remove metadata on each item\r\n\t\t// and return as array\r\n\t\tfunction extractFromCache( cache ) {\r\n\r\n\t\t\tconst values = [];\r\n\t\t\tfor ( const key in cache ) {\r\n\r\n\t\t\t\tconst data = cache[ key ];\r\n\t\t\t\tdelete data.metadata;\r\n\t\t\t\tvalues.push( data );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn values;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tclone( recursive ) {\r\n\r\n\t\treturn new this.constructor().copy( this, recursive );\r\n\r\n\t}\r\n\r\n\tcopy( source, recursive = true ) {\r\n\r\n\t\tthis.name = source.name;\r\n\r\n\t\tthis.up.copy( source.up );\r\n\r\n\t\tthis.position.copy( source.position );\r\n\t\tthis.rotation.order = source.rotation.order;\r\n\t\tthis.quaternion.copy( source.quaternion );\r\n\t\tthis.scale.copy( source.scale );\r\n\r\n\t\tthis.matrix.copy( source.matrix );\r\n\t\tthis.matrixWorld.copy( source.matrixWorld );\r\n\r\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\r\n\r\n\t\tthis.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;\r\n\t\tthis.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;\r\n\r\n\t\tthis.layers.mask = source.layers.mask;\r\n\t\tthis.visible = source.visible;\r\n\r\n\t\tthis.castShadow = source.castShadow;\r\n\t\tthis.receiveShadow = source.receiveShadow;\r\n\r\n\t\tthis.frustumCulled = source.frustumCulled;\r\n\t\tthis.renderOrder = source.renderOrder;\r\n\r\n\t\tthis.animations = source.animations.slice();\r\n\r\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\r\n\r\n\t\tif ( recursive === true ) {\r\n\r\n\t\t\tfor ( let i = 0; i < source.children.length; i ++ ) {\r\n\r\n\t\t\t\tconst child = source.children[ i ];\r\n\t\t\t\tthis.add( child.clone() );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nObject3D.DEFAULT_UP = /*@__PURE__*/ new Vector3( 0, 1, 0 );\r\nObject3D.DEFAULT_MATRIX_AUTO_UPDATE = true;\r\nObject3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;\r\n\r\nconst _v0$2 = /*@__PURE__*/ new Vector3();\r\nconst _v1$3 = /*@__PURE__*/ new Vector3();\r\nconst _v2$2 = /*@__PURE__*/ new Vector3();\r\nconst _v3$2 = /*@__PURE__*/ new Vector3();\r\n\r\nconst _vab = /*@__PURE__*/ new Vector3();\r\nconst _vac = /*@__PURE__*/ new Vector3();\r\nconst _vbc = /*@__PURE__*/ new Vector3();\r\nconst _vap = /*@__PURE__*/ new Vector3();\r\nconst _vbp = /*@__PURE__*/ new Vector3();\r\nconst _vcp = /*@__PURE__*/ new Vector3();\r\n\r\nclass Triangle {\r\n\r\n\tconstructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {\r\n\r\n\t\tthis.a = a;\r\n\t\tthis.b = b;\r\n\t\tthis.c = c;\r\n\r\n\t}\r\n\r\n\tstatic getNormal( a, b, c, target ) {\r\n\r\n\t\ttarget.subVectors( c, b );\r\n\t\t_v0$2.subVectors( a, b );\r\n\t\ttarget.cross( _v0$2 );\r\n\r\n\t\tconst targetLengthSq = target.lengthSq();\r\n\t\tif ( targetLengthSq > 0 ) {\r\n\r\n\t\t\treturn target.multiplyScalar( 1 / Math.sqrt( targetLengthSq ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn target.set( 0, 0, 0 );\r\n\r\n\t}\r\n\r\n\t// static/instance method to calculate barycentric coordinates\r\n\t// based on: http://www.blackpawn.com/texts/pointinpoly/default.html\r\n\tstatic getBarycoord( point, a, b, c, target ) {\r\n\r\n\t\t_v0$2.subVectors( c, a );\r\n\t\t_v1$3.subVectors( b, a );\r\n\t\t_v2$2.subVectors( point, a );\r\n\r\n\t\tconst dot00 = _v0$2.dot( _v0$2 );\r\n\t\tconst dot01 = _v0$2.dot( _v1$3 );\r\n\t\tconst dot02 = _v0$2.dot( _v2$2 );\r\n\t\tconst dot11 = _v1$3.dot( _v1$3 );\r\n\t\tconst dot12 = _v1$3.dot( _v2$2 );\r\n\r\n\t\tconst denom = ( dot00 * dot11 - dot01 * dot01 );\r\n\r\n\t\t// collinear or singular triangle\r\n\t\tif ( denom === 0 ) {\r\n\r\n\t\t\ttarget.set( 0, 0, 0 );\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\tconst invDenom = 1 / denom;\r\n\t\tconst u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;\r\n\t\tconst v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;\r\n\r\n\t\t// barycentric coordinates must always sum to 1\r\n\t\treturn target.set( 1 - u - v, v, u );\r\n\r\n\t}\r\n\r\n\tstatic containsPoint( point, a, b, c ) {\r\n\r\n\t\t// if the triangle is degenerate then we can't contain a point\r\n\t\tif ( this.getBarycoord( point, a, b, c, _v3$2 ) === null ) {\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t\treturn ( _v3$2.x >= 0 ) && ( _v3$2.y >= 0 ) && ( ( _v3$2.x + _v3$2.y ) <= 1 );\r\n\r\n\t}\r\n\r\n\tstatic getInterpolation( point, p1, p2, p3, v1, v2, v3, target ) {\r\n\r\n\t\tif ( this.getBarycoord( point, p1, p2, p3, _v3$2 ) === null ) {\r\n\r\n\t\t\ttarget.x = 0;\r\n\t\t\ttarget.y = 0;\r\n\t\t\tif ( 'z' in target ) target.z = 0;\r\n\t\t\tif ( 'w' in target ) target.w = 0;\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\ttarget.setScalar( 0 );\r\n\t\ttarget.addScaledVector( v1, _v3$2.x );\r\n\t\ttarget.addScaledVector( v2, _v3$2.y );\r\n\t\ttarget.addScaledVector( v3, _v3$2.z );\r\n\r\n\t\treturn target;\r\n\r\n\t}\r\n\r\n\tstatic isFrontFacing( a, b, c, direction ) {\r\n\r\n\t\t_v0$2.subVectors( c, b );\r\n\t\t_v1$3.subVectors( a, b );\r\n\r\n\t\t// strictly front facing\r\n\t\treturn ( _v0$2.cross( _v1$3 ).dot( direction ) < 0 ) ? true : false;\r\n\r\n\t}\r\n\r\n\tset( a, b, c ) {\r\n\r\n\t\tthis.a.copy( a );\r\n\t\tthis.b.copy( b );\r\n\t\tthis.c.copy( c );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromPointsAndIndices( points, i0, i1, i2 ) {\r\n\r\n\t\tthis.a.copy( points[ i0 ] );\r\n\t\tthis.b.copy( points[ i1 ] );\r\n\t\tthis.c.copy( points[ i2 ] );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromAttributeAndIndices( attribute, i0, i1, i2 ) {\r\n\r\n\t\tthis.a.fromBufferAttribute( attribute, i0 );\r\n\t\tthis.b.fromBufferAttribute( attribute, i1 );\r\n\t\tthis.c.fromBufferAttribute( attribute, i2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n\tcopy( triangle ) {\r\n\r\n\t\tthis.a.copy( triangle.a );\r\n\t\tthis.b.copy( triangle.b );\r\n\t\tthis.c.copy( triangle.c );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetArea() {\r\n\r\n\t\t_v0$2.subVectors( this.c, this.b );\r\n\t\t_v1$3.subVectors( this.a, this.b );\r\n\r\n\t\treturn _v0$2.cross( _v1$3 ).length() * 0.5;\r\n\r\n\t}\r\n\r\n\tgetMidpoint( target ) {\r\n\r\n\t\treturn target.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 );\r\n\r\n\t}\r\n\r\n\tgetNormal( target ) {\r\n\r\n\t\treturn Triangle.getNormal( this.a, this.b, this.c, target );\r\n\r\n\t}\r\n\r\n\tgetPlane( target ) {\r\n\r\n\t\treturn target.setFromCoplanarPoints( this.a, this.b, this.c );\r\n\r\n\t}\r\n\r\n\tgetBarycoord( point, target ) {\r\n\r\n\t\treturn Triangle.getBarycoord( point, this.a, this.b, this.c, target );\r\n\r\n\t}\r\n\r\n\tgetInterpolation( point, v1, v2, v3, target ) {\r\n\r\n\t\treturn Triangle.getInterpolation( point, this.a, this.b, this.c, v1, v2, v3, target );\r\n\r\n\t}\r\n\r\n\tcontainsPoint( point ) {\r\n\r\n\t\treturn Triangle.containsPoint( point, this.a, this.b, this.c );\r\n\r\n\t}\r\n\r\n\tisFrontFacing( direction ) {\r\n\r\n\t\treturn Triangle.isFrontFacing( this.a, this.b, this.c, direction );\r\n\r\n\t}\r\n\r\n\tintersectsBox( box ) {\r\n\r\n\t\treturn box.intersectsTriangle( this );\r\n\r\n\t}\r\n\r\n\tclosestPointToPoint( p, target ) {\r\n\r\n\t\tconst a = this.a, b = this.b, c = this.c;\r\n\t\tlet v, w;\r\n\r\n\t\t// algorithm thanks to Real-Time Collision Detection by Christer Ericson,\r\n\t\t// published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,\r\n\t\t// under the accompanying license; see chapter 5.1.5 for detailed explanation.\r\n\t\t// basically, we're distinguishing which of the voronoi regions of the triangle\r\n\t\t// the point lies in with the minimum amount of redundant computation.\r\n\r\n\t\t_vab.subVectors( b, a );\r\n\t\t_vac.subVectors( c, a );\r\n\t\t_vap.subVectors( p, a );\r\n\t\tconst d1 = _vab.dot( _vap );\r\n\t\tconst d2 = _vac.dot( _vap );\r\n\t\tif ( d1 <= 0 && d2 <= 0 ) {\r\n\r\n\t\t\t// vertex region of A; barycentric coords (1, 0, 0)\r\n\t\t\treturn target.copy( a );\r\n\r\n\t\t}\r\n\r\n\t\t_vbp.subVectors( p, b );\r\n\t\tconst d3 = _vab.dot( _vbp );\r\n\t\tconst d4 = _vac.dot( _vbp );\r\n\t\tif ( d3 >= 0 && d4 <= d3 ) {\r\n\r\n\t\t\t// vertex region of B; barycentric coords (0, 1, 0)\r\n\t\t\treturn target.copy( b );\r\n\r\n\t\t}\r\n\r\n\t\tconst vc = d1 * d4 - d3 * d2;\r\n\t\tif ( vc <= 0 && d1 >= 0 && d3 <= 0 ) {\r\n\r\n\t\t\tv = d1 / ( d1 - d3 );\r\n\t\t\t// edge region of AB; barycentric coords (1-v, v, 0)\r\n\t\t\treturn target.copy( a ).addScaledVector( _vab, v );\r\n\r\n\t\t}\r\n\r\n\t\t_vcp.subVectors( p, c );\r\n\t\tconst d5 = _vab.dot( _vcp );\r\n\t\tconst d6 = _vac.dot( _vcp );\r\n\t\tif ( d6 >= 0 && d5 <= d6 ) {\r\n\r\n\t\t\t// vertex region of C; barycentric coords (0, 0, 1)\r\n\t\t\treturn target.copy( c );\r\n\r\n\t\t}\r\n\r\n\t\tconst vb = d5 * d2 - d1 * d6;\r\n\t\tif ( vb <= 0 && d2 >= 0 && d6 <= 0 ) {\r\n\r\n\t\t\tw = d2 / ( d2 - d6 );\r\n\t\t\t// edge region of AC; barycentric coords (1-w, 0, w)\r\n\t\t\treturn target.copy( a ).addScaledVector( _vac, w );\r\n\r\n\t\t}\r\n\r\n\t\tconst va = d3 * d6 - d5 * d4;\r\n\t\tif ( va <= 0 && ( d4 - d3 ) >= 0 && ( d5 - d6 ) >= 0 ) {\r\n\r\n\t\t\t_vbc.subVectors( c, b );\r\n\t\t\tw = ( d4 - d3 ) / ( ( d4 - d3 ) + ( d5 - d6 ) );\r\n\t\t\t// edge region of BC; barycentric coords (0, 1-w, w)\r\n\t\t\treturn target.copy( b ).addScaledVector( _vbc, w ); // edge region of BC\r\n\r\n\t\t}\r\n\r\n\t\t// face region\r\n\t\tconst denom = 1 / ( va + vb + vc );\r\n\t\t// u = va * denom\r\n\t\tv = vb * denom;\r\n\t\tw = vc * denom;\r\n\r\n\t\treturn target.copy( a ).addScaledVector( _vab, v ).addScaledVector( _vac, w );\r\n\r\n\t}\r\n\r\n\tequals( triangle ) {\r\n\r\n\t\treturn triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c );\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,\r\n\t'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,\r\n\t'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50,\r\n\t'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B,\r\n\t'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B,\r\n\t'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F,\r\n\t'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3,\r\n\t'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222,\r\n\t'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700,\r\n\t'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4,\r\n\t'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00,\r\n\t'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3,\r\n\t'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA,\r\n\t'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32,\r\n\t'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3,\r\n\t'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC,\r\n\t'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD,\r\n\t'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6,\r\n\t'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9,\r\n\t'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'rebeccapurple': 0x663399, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F,\r\n\t'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE,\r\n\t'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA,\r\n\t'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,\r\n\t'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };\r\n\r\nconst _hslA = { h: 0, s: 0, l: 0 };\r\nconst _hslB = { h: 0, s: 0, l: 0 };\r\n\r\nfunction hue2rgb( p, q, t ) {\r\n\r\n\tif ( t < 0 ) t += 1;\r\n\tif ( t > 1 ) t -= 1;\r\n\tif ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;\r\n\tif ( t < 1 / 2 ) return q;\r\n\tif ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );\r\n\treturn p;\r\n\r\n}\r\n\r\nclass Color {\r\n\r\n\tconstructor( r, g, b ) {\r\n\r\n\t\tthis.isColor = true;\r\n\r\n\t\tthis.r = 1;\r\n\t\tthis.g = 1;\r\n\t\tthis.b = 1;\r\n\r\n\t\treturn this.set( r, g, b );\r\n\r\n\t}\r\n\r\n\tset( r, g, b ) {\r\n\r\n\t\tif ( g === undefined && b === undefined ) {\r\n\r\n\t\t\t// r is THREE.Color, hex or string\r\n\r\n\t\t\tconst value = r;\r\n\r\n\t\t\tif ( value && value.isColor ) {\r\n\r\n\t\t\t\tthis.copy( value );\r\n\r\n\t\t\t} else if ( typeof value === 'number' ) {\r\n\r\n\t\t\t\tthis.setHex( value );\r\n\r\n\t\t\t} else if ( typeof value === 'string' ) {\r\n\r\n\t\t\t\tthis.setStyle( value );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.setRGB( r, g, b );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetScalar( scalar ) {\r\n\r\n\t\tthis.r = scalar;\r\n\t\tthis.g = scalar;\r\n\t\tthis.b = scalar;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetHex( hex, colorSpace = SRGBColorSpace ) {\r\n\r\n\t\thex = Math.floor( hex );\r\n\r\n\t\tthis.r = ( hex >> 16 & 255 ) / 255;\r\n\t\tthis.g = ( hex >> 8 & 255 ) / 255;\r\n\t\tthis.b = ( hex & 255 ) / 255;\r\n\r\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetRGB( r, g, b, colorSpace = ColorManagement.workingColorSpace ) {\r\n\r\n\t\tthis.r = r;\r\n\t\tthis.g = g;\r\n\t\tthis.b = b;\r\n\r\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetHSL( h, s, l, colorSpace = ColorManagement.workingColorSpace ) {\r\n\r\n\t\t// h,s,l ranges are in 0.0 - 1.0\r\n\t\th = euclideanModulo( h, 1 );\r\n\t\ts = clamp( s, 0, 1 );\r\n\t\tl = clamp( l, 0, 1 );\r\n\r\n\t\tif ( s === 0 ) {\r\n\r\n\t\t\tthis.r = this.g = this.b = l;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );\r\n\t\t\tconst q = ( 2 * l ) - p;\r\n\r\n\t\t\tthis.r = hue2rgb( q, p, h + 1 / 3 );\r\n\t\t\tthis.g = hue2rgb( q, p, h );\r\n\t\t\tthis.b = hue2rgb( q, p, h - 1 / 3 );\r\n\r\n\t\t}\r\n\r\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetStyle( style, colorSpace = SRGBColorSpace ) {\r\n\r\n\t\tfunction handleAlpha( string ) {\r\n\r\n\t\t\tif ( string === undefined ) return;\r\n\r\n\t\t\tif ( parseFloat( string ) < 1 ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.Color: Alpha component of ' + style + ' will be ignored.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\r\n\t\tlet m;\r\n\r\n\t\tif ( m = /^(\\w+)\\(([^\\)]*)\\)/.exec( style ) ) {\r\n\r\n\t\t\t// rgb / hsl\r\n\r\n\t\t\tlet color;\r\n\t\t\tconst name = m[ 1 ];\r\n\t\t\tconst components = m[ 2 ];\r\n\r\n\t\t\tswitch ( name ) {\r\n\r\n\t\t\t\tcase 'rgb':\r\n\t\t\t\tcase 'rgba':\r\n\r\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\r\n\r\n\t\t\t\t\t\t// rgb(255,0,0) rgba(255,0,0,0.5)\r\n\r\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\r\n\r\n\t\t\t\t\t\treturn this.setRGB(\r\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 1 ], 10 ) ) / 255,\r\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 2 ], 10 ) ) / 255,\r\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 3 ], 10 ) ) / 255,\r\n\t\t\t\t\t\t\tcolorSpace\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\r\n\r\n\t\t\t\t\t\t// rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)\r\n\r\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\r\n\r\n\t\t\t\t\t\treturn this.setRGB(\r\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 1 ], 10 ) ) / 100,\r\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 2 ], 10 ) ) / 100,\r\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 3 ], 10 ) ) / 100,\r\n\t\t\t\t\t\t\tcolorSpace\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'hsl':\r\n\t\t\t\tcase 'hsla':\r\n\r\n\t\t\t\t\tif ( color = /^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\r\n\r\n\t\t\t\t\t\t// hsl(120,50%,50%) hsla(120,50%,50%,0.5)\r\n\r\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\r\n\r\n\t\t\t\t\t\treturn this.setHSL(\r\n\t\t\t\t\t\t\tparseFloat( color[ 1 ] ) / 360,\r\n\t\t\t\t\t\t\tparseFloat( color[ 2 ] ) / 100,\r\n\t\t\t\t\t\t\tparseFloat( color[ 3 ] ) / 100,\r\n\t\t\t\t\t\t\tcolorSpace\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tdefault:\r\n\r\n\t\t\t\t\tconsole.warn( 'THREE.Color: Unknown color model ' + style );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( m = /^\\#([A-Fa-f\\d]+)$/.exec( style ) ) {\r\n\r\n\t\t\t// hex color\r\n\r\n\t\t\tconst hex = m[ 1 ];\r\n\t\t\tconst size = hex.length;\r\n\r\n\t\t\tif ( size === 3 ) {\r\n\r\n\t\t\t\t// #ff0\r\n\t\t\t\treturn this.setRGB(\r\n\t\t\t\t\tparseInt( hex.charAt( 0 ), 16 ) / 15,\r\n\t\t\t\t\tparseInt( hex.charAt( 1 ), 16 ) / 15,\r\n\t\t\t\t\tparseInt( hex.charAt( 2 ), 16 ) / 15,\r\n\t\t\t\t\tcolorSpace\r\n\t\t\t\t);\r\n\r\n\t\t\t} else if ( size === 6 ) {\r\n\r\n\t\t\t\t// #ff0000\r\n\t\t\t\treturn this.setHex( parseInt( hex, 16 ), colorSpace );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.Color: Invalid hex color ' + style );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( style && style.length > 0 ) {\r\n\r\n\t\t\treturn this.setColorName( style, colorSpace );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetColorName( style, colorSpace = SRGBColorSpace ) {\r\n\r\n\t\t// color keywords\r\n\t\tconst hex = _colorKeywords[ style.toLowerCase() ];\r\n\r\n\t\tif ( hex !== undefined ) {\r\n\r\n\t\t\t// red\r\n\t\t\tthis.setHex( hex, colorSpace );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// unknown color\r\n\t\t\tconsole.warn( 'THREE.Color: Unknown color ' + style );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor( this.r, this.g, this.b );\r\n\r\n\t}\r\n\r\n\tcopy( color ) {\r\n\r\n\t\tthis.r = color.r;\r\n\t\tthis.g = color.g;\r\n\t\tthis.b = color.b;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcopySRGBToLinear( color ) {\r\n\r\n\t\tthis.r = SRGBToLinear( color.r );\r\n\t\tthis.g = SRGBToLinear( color.g );\r\n\t\tthis.b = SRGBToLinear( color.b );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcopyLinearToSRGB( color ) {\r\n\r\n\t\tthis.r = LinearToSRGB( color.r );\r\n\t\tthis.g = LinearToSRGB( color.g );\r\n\t\tthis.b = LinearToSRGB( color.b );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tconvertSRGBToLinear() {\r\n\r\n\t\tthis.copySRGBToLinear( this );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tconvertLinearToSRGB() {\r\n\r\n\t\tthis.copyLinearToSRGB( this );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetHex( colorSpace = SRGBColorSpace ) {\r\n\r\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\r\n\r\n\t\treturn Math.round( clamp( _color.r * 255, 0, 255 ) ) * 65536 + Math.round( clamp( _color.g * 255, 0, 255 ) ) * 256 + Math.round( clamp( _color.b * 255, 0, 255 ) );\r\n\r\n\t}\r\n\r\n\tgetHexString( colorSpace = SRGBColorSpace ) {\r\n\r\n\t\treturn ( '000000' + this.getHex( colorSpace ).toString( 16 ) ).slice( - 6 );\r\n\r\n\t}\r\n\r\n\tgetHSL( target, colorSpace = ColorManagement.workingColorSpace ) {\r\n\r\n\t\t// h,s,l ranges are in 0.0 - 1.0\r\n\r\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\r\n\r\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\r\n\r\n\t\tconst max = Math.max( r, g, b );\r\n\t\tconst min = Math.min( r, g, b );\r\n\r\n\t\tlet hue, saturation;\r\n\t\tconst lightness = ( min + max ) / 2.0;\r\n\r\n\t\tif ( min === max ) {\r\n\r\n\t\t\thue = 0;\r\n\t\t\tsaturation = 0;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst delta = max - min;\r\n\r\n\t\t\tsaturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min );\r\n\r\n\t\t\tswitch ( max ) {\r\n\r\n\t\t\t\tcase r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break;\r\n\t\t\t\tcase g: hue = ( b - r ) / delta + 2; break;\r\n\t\t\t\tcase b: hue = ( r - g ) / delta + 4; break;\r\n\r\n\t\t\t}\r\n\r\n\t\t\thue /= 6;\r\n\r\n\t\t}\r\n\r\n\t\ttarget.h = hue;\r\n\t\ttarget.s = saturation;\r\n\t\ttarget.l = lightness;\r\n\r\n\t\treturn target;\r\n\r\n\t}\r\n\r\n\tgetRGB( target, colorSpace = ColorManagement.workingColorSpace ) {\r\n\r\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\r\n\r\n\t\ttarget.r = _color.r;\r\n\t\ttarget.g = _color.g;\r\n\t\ttarget.b = _color.b;\r\n\r\n\t\treturn target;\r\n\r\n\t}\r\n\r\n\tgetStyle( colorSpace = SRGBColorSpace ) {\r\n\r\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\r\n\r\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\r\n\r\n\t\tif ( colorSpace !== SRGBColorSpace ) {\r\n\r\n\t\t\t// Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).\r\n\t\t\treturn `color(${ colorSpace } ${ r.toFixed( 3 ) } ${ g.toFixed( 3 ) } ${ b.toFixed( 3 ) })`;\r\n\r\n\t\t}\r\n\r\n\t\treturn `rgb(${ Math.round( r * 255 ) },${ Math.round( g * 255 ) },${ Math.round( b * 255 ) })`;\r\n\r\n\t}\r\n\r\n\toffsetHSL( h, s, l ) {\r\n\r\n\t\tthis.getHSL( _hslA );\r\n\r\n\t\treturn this.setHSL( _hslA.h + h, _hslA.s + s, _hslA.l + l );\r\n\r\n\t}\r\n\r\n\tadd( color ) {\r\n\r\n\t\tthis.r += color.r;\r\n\t\tthis.g += color.g;\r\n\t\tthis.b += color.b;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\taddColors( color1, color2 ) {\r\n\r\n\t\tthis.r = color1.r + color2.r;\r\n\t\tthis.g = color1.g + color2.g;\r\n\t\tthis.b = color1.b + color2.b;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\taddScalar( s ) {\r\n\r\n\t\tthis.r += s;\r\n\t\tthis.g += s;\r\n\t\tthis.b += s;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsub( color ) {\r\n\r\n\t\tthis.r = Math.max( 0, this.r - color.r );\r\n\t\tthis.g = Math.max( 0, this.g - color.g );\r\n\t\tthis.b = Math.max( 0, this.b - color.b );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmultiply( color ) {\r\n\r\n\t\tthis.r *= color.r;\r\n\t\tthis.g *= color.g;\r\n\t\tthis.b *= color.b;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmultiplyScalar( s ) {\r\n\r\n\t\tthis.r *= s;\r\n\t\tthis.g *= s;\r\n\t\tthis.b *= s;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tlerp( color, alpha ) {\r\n\r\n\t\tthis.r += ( color.r - this.r ) * alpha;\r\n\t\tthis.g += ( color.g - this.g ) * alpha;\r\n\t\tthis.b += ( color.b - this.b ) * alpha;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tlerpColors( color1, color2, alpha ) {\r\n\r\n\t\tthis.r = color1.r + ( color2.r - color1.r ) * alpha;\r\n\t\tthis.g = color1.g + ( color2.g - color1.g ) * alpha;\r\n\t\tthis.b = color1.b + ( color2.b - color1.b ) * alpha;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tlerpHSL( color, alpha ) {\r\n\r\n\t\tthis.getHSL( _hslA );\r\n\t\tcolor.getHSL( _hslB );\r\n\r\n\t\tconst h = lerp( _hslA.h, _hslB.h, alpha );\r\n\t\tconst s = lerp( _hslA.s, _hslB.s, alpha );\r\n\t\tconst l = lerp( _hslA.l, _hslB.l, alpha );\r\n\r\n\t\tthis.setHSL( h, s, l );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromVector3( v ) {\r\n\r\n\t\tthis.r = v.x;\r\n\t\tthis.g = v.y;\r\n\t\tthis.b = v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tapplyMatrix3( m ) {\r\n\r\n\t\tconst r = this.r, g = this.g, b = this.b;\r\n\t\tconst e = m.elements;\r\n\r\n\t\tthis.r = e[ 0 ] * r + e[ 3 ] * g + e[ 6 ] * b;\r\n\t\tthis.g = e[ 1 ] * r + e[ 4 ] * g + e[ 7 ] * b;\r\n\t\tthis.b = e[ 2 ] * r + e[ 5 ] * g + e[ 8 ] * b;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tequals( c ) {\r\n\r\n\t\treturn ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b );\r\n\r\n\t}\r\n\r\n\tfromArray( array, offset = 0 ) {\r\n\r\n\t\tthis.r = array[ offset ];\r\n\t\tthis.g = array[ offset + 1 ];\r\n\t\tthis.b = array[ offset + 2 ];\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoArray( array = [], offset = 0 ) {\r\n\r\n\t\tarray[ offset ] = this.r;\r\n\t\tarray[ offset + 1 ] = this.g;\r\n\t\tarray[ offset + 2 ] = this.b;\r\n\r\n\t\treturn array;\r\n\r\n\t}\r\n\r\n\tfromBufferAttribute( attribute, index ) {\r\n\r\n\t\tthis.r = attribute.getX( index );\r\n\t\tthis.g = attribute.getY( index );\r\n\t\tthis.b = attribute.getZ( index );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\treturn this.getHex();\r\n\r\n\t}\r\n\r\n\t*[ Symbol.iterator ]() {\r\n\r\n\t\tyield this.r;\r\n\t\tyield this.g;\r\n\t\tyield this.b;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _color = /*@__PURE__*/ new Color();\r\n\r\nColor.NAMES = _colorKeywords;\r\n\r\nlet _materialId = 0;\r\n\r\nclass Material extends EventDispatcher {\r\n\r\n\tconstructor() {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isMaterial = true;\r\n\r\n\t\tObject.defineProperty( this, 'id', { value: _materialId ++ } );\r\n\r\n\t\tthis.uuid = generateUUID();\r\n\r\n\t\tthis.name = '';\r\n\t\tthis.type = 'Material';\r\n\r\n\t\tthis.blending = NormalBlending;\r\n\t\tthis.side = FrontSide;\r\n\t\tthis.vertexColors = false;\r\n\r\n\t\tthis.opacity = 1;\r\n\t\tthis.transparent = false;\r\n\t\tthis.alphaHash = false;\r\n\r\n\t\tthis.blendSrc = SrcAlphaFactor;\r\n\t\tthis.blendDst = OneMinusSrcAlphaFactor;\r\n\t\tthis.blendEquation = AddEquation;\r\n\t\tthis.blendSrcAlpha = null;\r\n\t\tthis.blendDstAlpha = null;\r\n\t\tthis.blendEquationAlpha = null;\r\n\t\tthis.blendColor = new Color( 0, 0, 0 );\r\n\t\tthis.blendAlpha = 0;\r\n\r\n\t\tthis.depthFunc = LessEqualDepth;\r\n\t\tthis.depthTest = true;\r\n\t\tthis.depthWrite = true;\r\n\r\n\t\tthis.stencilWriteMask = 0xff;\r\n\t\tthis.stencilFunc = AlwaysStencilFunc;\r\n\t\tthis.stencilRef = 0;\r\n\t\tthis.stencilFuncMask = 0xff;\r\n\t\tthis.stencilFail = KeepStencilOp;\r\n\t\tthis.stencilZFail = KeepStencilOp;\r\n\t\tthis.stencilZPass = KeepStencilOp;\r\n\t\tthis.stencilWrite = false;\r\n\r\n\t\tthis.clippingPlanes = null;\r\n\t\tthis.clipIntersection = false;\r\n\t\tthis.clipShadows = false;\r\n\r\n\t\tthis.shadowSide = null;\r\n\r\n\t\tthis.colorWrite = true;\r\n\r\n\t\tthis.precision = null; // override the renderer's default precision for this material\r\n\r\n\t\tthis.polygonOffset = false;\r\n\t\tthis.polygonOffsetFactor = 0;\r\n\t\tthis.polygonOffsetUnits = 0;\r\n\r\n\t\tthis.dithering = false;\r\n\r\n\t\tthis.alphaToCoverage = false;\r\n\t\tthis.premultipliedAlpha = false;\r\n\t\tthis.forceSinglePass = false;\r\n\r\n\t\tthis.visible = true;\r\n\r\n\t\tthis.toneMapped = true;\r\n\r\n\t\tthis.userData = {};\r\n\r\n\t\tthis.version = 0;\r\n\r\n\t\tthis._alphaTest = 0;\r\n\r\n\t}\r\n\r\n\tget alphaTest() {\r\n\r\n\t\treturn this._alphaTest;\r\n\r\n\t}\r\n\r\n\tset alphaTest( value ) {\r\n\r\n\t\tif ( this._alphaTest > 0 !== value > 0 ) {\r\n\r\n\t\t\tthis.version ++;\r\n\r\n\t\t}\r\n\r\n\t\tthis._alphaTest = value;\r\n\r\n\t}\r\n\r\n\t// onBeforeRender and onBeforeCompile only supported in WebGLRenderer\r\n\r\n\tonBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}\r\n\r\n\tonBeforeCompile( /* shaderobject, renderer */ ) {}\r\n\r\n\tcustomProgramCacheKey() {\r\n\r\n\t\treturn this.onBeforeCompile.toString();\r\n\r\n\t}\r\n\r\n\tsetValues( values ) {\r\n\r\n\t\tif ( values === undefined ) return;\r\n\r\n\t\tfor ( const key in values ) {\r\n\r\n\t\t\tconst newValue = values[ key ];\r\n\r\n\t\t\tif ( newValue === undefined ) {\r\n\r\n\t\t\t\tconsole.warn( `THREE.Material: parameter '${ key }' has value of undefined.` );\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst currentValue = this[ key ];\r\n\r\n\t\t\tif ( currentValue === undefined ) {\r\n\r\n\t\t\t\tconsole.warn( `THREE.Material: '${ key }' is not a property of THREE.${ this.type }.` );\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( currentValue && currentValue.isColor ) {\r\n\r\n\t\t\t\tcurrentValue.set( newValue );\r\n\r\n\t\t\t} else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) {\r\n\r\n\t\t\t\tcurrentValue.copy( newValue );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis[ key ] = newValue;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ttoJSON( meta ) {\r\n\r\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\r\n\r\n\t\tif ( isRootObject ) {\r\n\r\n\t\t\tmeta = {\r\n\t\t\t\ttextures: {},\r\n\t\t\t\timages: {}\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t\tconst data = {\r\n\t\t\tmetadata: {\r\n\t\t\t\tversion: 4.6,\r\n\t\t\t\ttype: 'Material',\r\n\t\t\t\tgenerator: 'Material.toJSON'\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t// standard Material serialization\r\n\t\tdata.uuid = this.uuid;\r\n\t\tdata.type = this.type;\r\n\r\n\t\tif ( this.name !== '' ) data.name = this.name;\r\n\r\n\t\tif ( this.color && this.color.isColor ) data.color = this.color.getHex();\r\n\r\n\t\tif ( this.roughness !== undefined ) data.roughness = this.roughness;\r\n\t\tif ( this.metalness !== undefined ) data.metalness = this.metalness;\r\n\r\n\t\tif ( this.sheen !== undefined ) data.sheen = this.sheen;\r\n\t\tif ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();\r\n\t\tif ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;\r\n\t\tif ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();\r\n\t\tif ( this.emissiveIntensity !== undefined && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;\r\n\r\n\t\tif ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();\r\n\t\tif ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;\r\n\t\tif ( this.specularColor && this.specularColor.isColor ) data.specularColor = this.specularColor.getHex();\r\n\t\tif ( this.shininess !== undefined ) data.shininess = this.shininess;\r\n\t\tif ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat;\r\n\t\tif ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness;\r\n\r\n\t\tif ( this.clearcoatMap && this.clearcoatMap.isTexture ) {\r\n\r\n\t\t\tdata.clearcoatMap = this.clearcoatMap.toJSON( meta ).uuid;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture ) {\r\n\r\n\t\t\tdata.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON( meta ).uuid;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture ) {\r\n\r\n\t\t\tdata.clearcoatNormalMap = this.clearcoatNormalMap.toJSON( meta ).uuid;\r\n\t\t\tdata.clearcoatNormalScale = this.clearcoatNormalScale.toArray();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.dispersion !== undefined ) data.dispersion = this.dispersion;\r\n\r\n\t\tif ( this.iridescence !== undefined ) data.iridescence = this.iridescence;\r\n\t\tif ( this.iridescenceIOR !== undefined ) data.iridescenceIOR = this.iridescenceIOR;\r\n\t\tif ( this.iridescenceThicknessRange !== undefined ) data.iridescenceThicknessRange = this.iridescenceThicknessRange;\r\n\r\n\t\tif ( this.iridescenceMap && this.iridescenceMap.isTexture ) {\r\n\r\n\t\t\tdata.iridescenceMap = this.iridescenceMap.toJSON( meta ).uuid;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture ) {\r\n\r\n\t\t\tdata.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON( meta ).uuid;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.anisotropy !== undefined ) data.anisotropy = this.anisotropy;\r\n\t\tif ( this.anisotropyRotation !== undefined ) data.anisotropyRotation = this.anisotropyRotation;\r\n\r\n\t\tif ( this.anisotropyMap && this.anisotropyMap.isTexture ) {\r\n\r\n\t\t\tdata.anisotropyMap = this.anisotropyMap.toJSON( meta ).uuid;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid;\r\n\t\tif ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid;\r\n\t\tif ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;\r\n\r\n\t\tif ( this.lightMap && this.lightMap.isTexture ) {\r\n\r\n\t\t\tdata.lightMap = this.lightMap.toJSON( meta ).uuid;\r\n\t\t\tdata.lightMapIntensity = this.lightMapIntensity;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.aoMap && this.aoMap.isTexture ) {\r\n\r\n\t\t\tdata.aoMap = this.aoMap.toJSON( meta ).uuid;\r\n\t\t\tdata.aoMapIntensity = this.aoMapIntensity;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.bumpMap && this.bumpMap.isTexture ) {\r\n\r\n\t\t\tdata.bumpMap = this.bumpMap.toJSON( meta ).uuid;\r\n\t\t\tdata.bumpScale = this.bumpScale;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.normalMap && this.normalMap.isTexture ) {\r\n\r\n\t\t\tdata.normalMap = this.normalMap.toJSON( meta ).uuid;\r\n\t\t\tdata.normalMapType = this.normalMapType;\r\n\t\t\tdata.normalScale = this.normalScale.toArray();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.displacementMap && this.displacementMap.isTexture ) {\r\n\r\n\t\t\tdata.displacementMap = this.displacementMap.toJSON( meta ).uuid;\r\n\t\t\tdata.displacementScale = this.displacementScale;\r\n\t\t\tdata.displacementBias = this.displacementBias;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.roughnessMap && this.roughnessMap.isTexture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid;\r\n\t\tif ( this.metalnessMap && this.metalnessMap.isTexture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid;\r\n\r\n\t\tif ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid;\r\n\t\tif ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;\r\n\t\tif ( this.specularIntensityMap && this.specularIntensityMap.isTexture ) data.specularIntensityMap = this.specularIntensityMap.toJSON( meta ).uuid;\r\n\t\tif ( this.specularColorMap && this.specularColorMap.isTexture ) data.specularColorMap = this.specularColorMap.toJSON( meta ).uuid;\r\n\r\n\t\tif ( this.envMap && this.envMap.isTexture ) {\r\n\r\n\t\t\tdata.envMap = this.envMap.toJSON( meta ).uuid;\r\n\r\n\t\t\tif ( this.combine !== undefined ) data.combine = this.combine;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.envMapRotation !== undefined ) data.envMapRotation = this.envMapRotation.toArray();\r\n\t\tif ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;\r\n\t\tif ( this.reflectivity !== undefined ) data.reflectivity = this.reflectivity;\r\n\t\tif ( this.refractionRatio !== undefined ) data.refractionRatio = this.refractionRatio;\r\n\r\n\t\tif ( this.gradientMap && this.gradientMap.isTexture ) {\r\n\r\n\t\t\tdata.gradientMap = this.gradientMap.toJSON( meta ).uuid;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.transmission !== undefined ) data.transmission = this.transmission;\r\n\t\tif ( this.transmissionMap && this.transmissionMap.isTexture ) data.transmissionMap = this.transmissionMap.toJSON( meta ).uuid;\r\n\t\tif ( this.thickness !== undefined ) data.thickness = this.thickness;\r\n\t\tif ( this.thicknessMap && this.thicknessMap.isTexture ) data.thicknessMap = this.thicknessMap.toJSON( meta ).uuid;\r\n\t\tif ( this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity ) data.attenuationDistance = this.attenuationDistance;\r\n\t\tif ( this.attenuationColor !== undefined ) data.attenuationColor = this.attenuationColor.getHex();\r\n\r\n\t\tif ( this.size !== undefined ) data.size = this.size;\r\n\t\tif ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;\r\n\t\tif ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;\r\n\r\n\t\tif ( this.blending !== NormalBlending ) data.blending = this.blending;\r\n\t\tif ( this.side !== FrontSide ) data.side = this.side;\r\n\t\tif ( this.vertexColors === true ) data.vertexColors = true;\r\n\r\n\t\tif ( this.opacity < 1 ) data.opacity = this.opacity;\r\n\t\tif ( this.transparent === true ) data.transparent = true;\r\n\r\n\t\tif ( this.blendSrc !== SrcAlphaFactor ) data.blendSrc = this.blendSrc;\r\n\t\tif ( this.blendDst !== OneMinusSrcAlphaFactor ) data.blendDst = this.blendDst;\r\n\t\tif ( this.blendEquation !== AddEquation ) data.blendEquation = this.blendEquation;\r\n\t\tif ( this.blendSrcAlpha !== null ) data.blendSrcAlpha = this.blendSrcAlpha;\r\n\t\tif ( this.blendDstAlpha !== null ) data.blendDstAlpha = this.blendDstAlpha;\r\n\t\tif ( this.blendEquationAlpha !== null ) data.blendEquationAlpha = this.blendEquationAlpha;\r\n\t\tif ( this.blendColor && this.blendColor.isColor ) data.blendColor = this.blendColor.getHex();\r\n\t\tif ( this.blendAlpha !== 0 ) data.blendAlpha = this.blendAlpha;\r\n\r\n\t\tif ( this.depthFunc !== LessEqualDepth ) data.depthFunc = this.depthFunc;\r\n\t\tif ( this.depthTest === false ) data.depthTest = this.depthTest;\r\n\t\tif ( this.depthWrite === false ) data.depthWrite = this.depthWrite;\r\n\t\tif ( this.colorWrite === false ) data.colorWrite = this.colorWrite;\r\n\r\n\t\tif ( this.stencilWriteMask !== 0xff ) data.stencilWriteMask = this.stencilWriteMask;\r\n\t\tif ( this.stencilFunc !== AlwaysStencilFunc ) data.stencilFunc = this.stencilFunc;\r\n\t\tif ( this.stencilRef !== 0 ) data.stencilRef = this.stencilRef;\r\n\t\tif ( this.stencilFuncMask !== 0xff ) data.stencilFuncMask = this.stencilFuncMask;\r\n\t\tif ( this.stencilFail !== KeepStencilOp ) data.stencilFail = this.stencilFail;\r\n\t\tif ( this.stencilZFail !== KeepStencilOp ) data.stencilZFail = this.stencilZFail;\r\n\t\tif ( this.stencilZPass !== KeepStencilOp ) data.stencilZPass = this.stencilZPass;\r\n\t\tif ( this.stencilWrite === true ) data.stencilWrite = this.stencilWrite;\r\n\r\n\t\t// rotation (SpriteMaterial)\r\n\t\tif ( this.rotation !== undefined && this.rotation !== 0 ) data.rotation = this.rotation;\r\n\r\n\t\tif ( this.polygonOffset === true ) data.polygonOffset = true;\r\n\t\tif ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;\r\n\t\tif ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;\r\n\r\n\t\tif ( this.linewidth !== undefined && this.linewidth !== 1 ) data.linewidth = this.linewidth;\r\n\t\tif ( this.dashSize !== undefined ) data.dashSize = this.dashSize;\r\n\t\tif ( this.gapSize !== undefined ) data.gapSize = this.gapSize;\r\n\t\tif ( this.scale !== undefined ) data.scale = this.scale;\r\n\r\n\t\tif ( this.dithering === true ) data.dithering = true;\r\n\r\n\t\tif ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;\r\n\t\tif ( this.alphaHash === true ) data.alphaHash = true;\r\n\t\tif ( this.alphaToCoverage === true ) data.alphaToCoverage = true;\r\n\t\tif ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;\r\n\t\tif ( this.forceSinglePass === true ) data.forceSinglePass = true;\r\n\r\n\t\tif ( this.wireframe === true ) data.wireframe = true;\r\n\t\tif ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;\r\n\t\tif ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;\r\n\t\tif ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;\r\n\r\n\t\tif ( this.flatShading === true ) data.flatShading = true;\r\n\r\n\t\tif ( this.visible === false ) data.visible = false;\r\n\r\n\t\tif ( this.toneMapped === false ) data.toneMapped = false;\r\n\r\n\t\tif ( this.fog === false ) data.fog = false;\r\n\r\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\r\n\r\n\t\t// TODO: Copied from Object3D.toJSON\r\n\r\n\t\tfunction extractFromCache( cache ) {\r\n\r\n\t\t\tconst values = [];\r\n\r\n\t\t\tfor ( const key in cache ) {\r\n\r\n\t\t\t\tconst data = cache[ key ];\r\n\t\t\t\tdelete data.metadata;\r\n\t\t\t\tvalues.push( data );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn values;\r\n\r\n\t\t}\r\n\r\n\t\tif ( isRootObject ) {\r\n\r\n\t\t\tconst textures = extractFromCache( meta.textures );\r\n\t\t\tconst images = extractFromCache( meta.images );\r\n\r\n\t\t\tif ( textures.length > 0 ) data.textures = textures;\r\n\t\t\tif ( images.length > 0 ) data.images = images;\r\n\r\n\t\t}\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.name = source.name;\r\n\r\n\t\tthis.blending = source.blending;\r\n\t\tthis.side = source.side;\r\n\t\tthis.vertexColors = source.vertexColors;\r\n\r\n\t\tthis.opacity = source.opacity;\r\n\t\tthis.transparent = source.transparent;\r\n\r\n\t\tthis.blendSrc = source.blendSrc;\r\n\t\tthis.blendDst = source.blendDst;\r\n\t\tthis.blendEquation = source.blendEquation;\r\n\t\tthis.blendSrcAlpha = source.blendSrcAlpha;\r\n\t\tthis.blendDstAlpha = source.blendDstAlpha;\r\n\t\tthis.blendEquationAlpha = source.blendEquationAlpha;\r\n\t\tthis.blendColor.copy( source.blendColor );\r\n\t\tthis.blendAlpha = source.blendAlpha;\r\n\r\n\t\tthis.depthFunc = source.depthFunc;\r\n\t\tthis.depthTest = source.depthTest;\r\n\t\tthis.depthWrite = source.depthWrite;\r\n\r\n\t\tthis.stencilWriteMask = source.stencilWriteMask;\r\n\t\tthis.stencilFunc = source.stencilFunc;\r\n\t\tthis.stencilRef = source.stencilRef;\r\n\t\tthis.stencilFuncMask = source.stencilFuncMask;\r\n\t\tthis.stencilFail = source.stencilFail;\r\n\t\tthis.stencilZFail = source.stencilZFail;\r\n\t\tthis.stencilZPass = source.stencilZPass;\r\n\t\tthis.stencilWrite = source.stencilWrite;\r\n\r\n\t\tconst srcPlanes = source.clippingPlanes;\r\n\t\tlet dstPlanes = null;\r\n\r\n\t\tif ( srcPlanes !== null ) {\r\n\r\n\t\t\tconst n = srcPlanes.length;\r\n\t\t\tdstPlanes = new Array( n );\r\n\r\n\t\t\tfor ( let i = 0; i !== n; ++ i ) {\r\n\r\n\t\t\t\tdstPlanes[ i ] = srcPlanes[ i ].clone();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.clippingPlanes = dstPlanes;\r\n\t\tthis.clipIntersection = source.clipIntersection;\r\n\t\tthis.clipShadows = source.clipShadows;\r\n\r\n\t\tthis.shadowSide = source.shadowSide;\r\n\r\n\t\tthis.colorWrite = source.colorWrite;\r\n\r\n\t\tthis.precision = source.precision;\r\n\r\n\t\tthis.polygonOffset = source.polygonOffset;\r\n\t\tthis.polygonOffsetFactor = source.polygonOffsetFactor;\r\n\t\tthis.polygonOffsetUnits = source.polygonOffsetUnits;\r\n\r\n\t\tthis.dithering = source.dithering;\r\n\r\n\t\tthis.alphaTest = source.alphaTest;\r\n\t\tthis.alphaHash = source.alphaHash;\r\n\t\tthis.alphaToCoverage = source.alphaToCoverage;\r\n\t\tthis.premultipliedAlpha = source.premultipliedAlpha;\r\n\t\tthis.forceSinglePass = source.forceSinglePass;\r\n\r\n\t\tthis.visible = source.visible;\r\n\r\n\t\tthis.toneMapped = source.toneMapped;\r\n\r\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.dispatchEvent( { type: 'dispose' } );\r\n\r\n\t}\r\n\r\n\tset needsUpdate( value ) {\r\n\r\n\t\tif ( value === true ) this.version ++;\r\n\r\n\t}\r\n\r\n\tonBuild( /* shaderobject, renderer */ ) {\r\n\r\n\t\tconsole.warn( 'Material: onBuild() has been removed.' ); // @deprecated, r166\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshBasicMaterial extends Material {\r\n\r\n\tconstructor( parameters ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isMeshBasicMaterial = true;\r\n\r\n\t\tthis.type = 'MeshBasicMaterial';\r\n\r\n\t\tthis.color = new Color( 0xffffff ); // emissive\r\n\r\n\t\tthis.map = null;\r\n\r\n\t\tthis.lightMap = null;\r\n\t\tthis.lightMapIntensity = 1.0;\r\n\r\n\t\tthis.aoMap = null;\r\n\t\tthis.aoMapIntensity = 1.0;\r\n\r\n\t\tthis.specularMap = null;\r\n\r\n\t\tthis.alphaMap = null;\r\n\r\n\t\tthis.envMap = null;\r\n\t\tthis.envMapRotation = new Euler();\r\n\t\tthis.combine = MultiplyOperation;\r\n\t\tthis.reflectivity = 1;\r\n\t\tthis.refractionRatio = 0.98;\r\n\r\n\t\tthis.wireframe = false;\r\n\t\tthis.wireframeLinewidth = 1;\r\n\t\tthis.wireframeLinecap = 'round';\r\n\t\tthis.wireframeLinejoin = 'round';\r\n\r\n\t\tthis.fog = true;\r\n\r\n\t\tthis.setValues( parameters );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.color.copy( source.color );\r\n\r\n\t\tthis.map = source.map;\r\n\r\n\t\tthis.lightMap = source.lightMap;\r\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\r\n\r\n\t\tthis.aoMap = source.aoMap;\r\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\r\n\r\n\t\tthis.specularMap = source.specularMap;\r\n\r\n\t\tthis.alphaMap = source.alphaMap;\r\n\r\n\t\tthis.envMap = source.envMap;\r\n\t\tthis.envMapRotation.copy( source.envMapRotation );\r\n\t\tthis.combine = source.combine;\r\n\t\tthis.reflectivity = source.reflectivity;\r\n\t\tthis.refractionRatio = source.refractionRatio;\r\n\r\n\t\tthis.wireframe = source.wireframe;\r\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\r\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\r\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\r\n\r\n\t\tthis.fog = source.fog;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Fast Half Float Conversions, http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\r\n\r\nconst _tables = /*@__PURE__*/ _generateTables();\r\n\r\nfunction _generateTables() {\r\n\r\n\t// float32 to float16 helpers\r\n\r\n\tconst buffer = new ArrayBuffer( 4 );\r\n\tconst floatView = new Float32Array( buffer );\r\n\tconst uint32View = new Uint32Array( buffer );\r\n\r\n\tconst baseTable = new Uint32Array( 512 );\r\n\tconst shiftTable = new Uint32Array( 512 );\r\n\r\n\tfor ( let i = 0; i < 256; ++ i ) {\r\n\r\n\t\tconst e = i - 127;\r\n\r\n\t\t// very small number (0, -0)\r\n\r\n\t\tif ( e < - 27 ) {\r\n\r\n\t\t\tbaseTable[ i ] = 0x0000;\r\n\t\t\tbaseTable[ i | 0x100 ] = 0x8000;\r\n\t\t\tshiftTable[ i ] = 24;\r\n\t\t\tshiftTable[ i | 0x100 ] = 24;\r\n\r\n\t\t\t// small number (denorm)\r\n\r\n\t\t} else if ( e < - 14 ) {\r\n\r\n\t\t\tbaseTable[ i ] = 0x0400 >> ( - e - 14 );\r\n\t\t\tbaseTable[ i | 0x100 ] = ( 0x0400 >> ( - e - 14 ) ) | 0x8000;\r\n\t\t\tshiftTable[ i ] = - e - 1;\r\n\t\t\tshiftTable[ i | 0x100 ] = - e - 1;\r\n\r\n\t\t\t// normal number\r\n\r\n\t\t} else if ( e <= 15 ) {\r\n\r\n\t\t\tbaseTable[ i ] = ( e + 15 ) << 10;\r\n\t\t\tbaseTable[ i | 0x100 ] = ( ( e + 15 ) << 10 ) | 0x8000;\r\n\t\t\tshiftTable[ i ] = 13;\r\n\t\t\tshiftTable[ i | 0x100 ] = 13;\r\n\r\n\t\t\t// large number (Infinity, -Infinity)\r\n\r\n\t\t} else if ( e < 128 ) {\r\n\r\n\t\t\tbaseTable[ i ] = 0x7c00;\r\n\t\t\tbaseTable[ i | 0x100 ] = 0xfc00;\r\n\t\t\tshiftTable[ i ] = 24;\r\n\t\t\tshiftTable[ i | 0x100 ] = 24;\r\n\r\n\t\t\t// stay (NaN, Infinity, -Infinity)\r\n\r\n\t\t} else {\r\n\r\n\t\t\tbaseTable[ i ] = 0x7c00;\r\n\t\t\tbaseTable[ i | 0x100 ] = 0xfc00;\r\n\t\t\tshiftTable[ i ] = 13;\r\n\t\t\tshiftTable[ i | 0x100 ] = 13;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// float16 to float32 helpers\r\n\r\n\tconst mantissaTable = new Uint32Array( 2048 );\r\n\tconst exponentTable = new Uint32Array( 64 );\r\n\tconst offsetTable = new Uint32Array( 64 );\r\n\r\n\tfor ( let i = 1; i < 1024; ++ i ) {\r\n\r\n\t\tlet m = i << 13; // zero pad mantissa bits\r\n\t\tlet e = 0; // zero exponent\r\n\r\n\t\t// normalized\r\n\t\twhile ( ( m & 0x00800000 ) === 0 ) {\r\n\r\n\t\t\tm <<= 1;\r\n\t\t\te -= 0x00800000; // decrement exponent\r\n\r\n\t\t}\r\n\r\n\t\tm &= ~ 0x00800000; // clear leading 1 bit\r\n\t\te += 0x38800000; // adjust bias\r\n\r\n\t\tmantissaTable[ i ] = m | e;\r\n\r\n\t}\r\n\r\n\tfor ( let i = 1024; i < 2048; ++ i ) {\r\n\r\n\t\tmantissaTable[ i ] = 0x38000000 + ( ( i - 1024 ) << 13 );\r\n\r\n\t}\r\n\r\n\tfor ( let i = 1; i < 31; ++ i ) {\r\n\r\n\t\texponentTable[ i ] = i << 23;\r\n\r\n\t}\r\n\r\n\texponentTable[ 31 ] = 0x47800000;\r\n\texponentTable[ 32 ] = 0x80000000;\r\n\r\n\tfor ( let i = 33; i < 63; ++ i ) {\r\n\r\n\t\texponentTable[ i ] = 0x80000000 + ( ( i - 32 ) << 23 );\r\n\r\n\t}\r\n\r\n\texponentTable[ 63 ] = 0xc7800000;\r\n\r\n\tfor ( let i = 1; i < 64; ++ i ) {\r\n\r\n\t\tif ( i !== 32 ) {\r\n\r\n\t\t\toffsetTable[ i ] = 1024;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn {\r\n\t\tfloatView: floatView,\r\n\t\tuint32View: uint32View,\r\n\t\tbaseTable: baseTable,\r\n\t\tshiftTable: shiftTable,\r\n\t\tmantissaTable: mantissaTable,\r\n\t\texponentTable: exponentTable,\r\n\t\toffsetTable: offsetTable\r\n\t};\r\n\r\n}\r\n\r\n// float32 to float16\r\n\r\nfunction toHalfFloat( val ) {\r\n\r\n\tif ( Math.abs( val ) > 65504 ) console.warn( 'THREE.DataUtils.toHalfFloat(): Value out of range.' );\r\n\r\n\tval = clamp( val, - 65504, 65504 );\r\n\r\n\t_tables.floatView[ 0 ] = val;\r\n\tconst f = _tables.uint32View[ 0 ];\r\n\tconst e = ( f >> 23 ) & 0x1ff;\r\n\treturn _tables.baseTable[ e ] + ( ( f & 0x007fffff ) >> _tables.shiftTable[ e ] );\r\n\r\n}\r\n\r\n// float16 to float32\r\n\r\nfunction fromHalfFloat( val ) {\r\n\r\n\tconst m = val >> 10;\r\n\t_tables.uint32View[ 0 ] = _tables.mantissaTable[ _tables.offsetTable[ m ] + ( val & 0x3ff ) ] + _tables.exponentTable[ m ];\r\n\treturn _tables.floatView[ 0 ];\r\n\r\n}\r\n\r\nconst DataUtils = {\r\n\ttoHalfFloat: toHalfFloat,\r\n\tfromHalfFloat: fromHalfFloat,\r\n};\r\n\r\nconst _vector$9 = /*@__PURE__*/ new Vector3();\r\nconst _vector2$1 = /*@__PURE__*/ new Vector2();\r\n\r\nclass BufferAttribute {\r\n\r\n\tconstructor( array, itemSize, normalized = false ) {\r\n\r\n\t\tif ( Array.isArray( array ) ) {\r\n\r\n\t\t\tthrow new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' );\r\n\r\n\t\t}\r\n\r\n\t\tthis.isBufferAttribute = true;\r\n\r\n\t\tthis.name = '';\r\n\r\n\t\tthis.array = array;\r\n\t\tthis.itemSize = itemSize;\r\n\t\tthis.count = array !== undefined ? array.length / itemSize : 0;\r\n\t\tthis.normalized = normalized;\r\n\r\n\t\tthis.usage = StaticDrawUsage;\r\n\t\tthis._updateRange = { offset: 0, count: - 1 };\r\n\t\tthis.updateRanges = [];\r\n\t\tthis.gpuType = FloatType;\r\n\r\n\t\tthis.version = 0;\r\n\r\n\t}\r\n\r\n\tonUploadCallback() {}\r\n\r\n\tset needsUpdate( value ) {\r\n\r\n\t\tif ( value === true ) this.version ++;\r\n\r\n\t}\r\n\r\n\tget updateRange() {\r\n\r\n\t\twarnOnce( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159\r\n\t\treturn this._updateRange;\r\n\r\n\t}\r\n\r\n\tsetUsage( value ) {\r\n\r\n\t\tthis.usage = value;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\taddUpdateRange( start, count ) {\r\n\r\n\t\tthis.updateRanges.push( { start, count } );\r\n\r\n\t}\r\n\r\n\tclearUpdateRanges() {\r\n\r\n\t\tthis.updateRanges.length = 0;\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.name = source.name;\r\n\t\tthis.array = new source.array.constructor( source.array );\r\n\t\tthis.itemSize = source.itemSize;\r\n\t\tthis.count = source.count;\r\n\t\tthis.normalized = source.normalized;\r\n\r\n\t\tthis.usage = source.usage;\r\n\t\tthis.gpuType = source.gpuType;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcopyAt( index1, attribute, index2 ) {\r\n\r\n\t\tindex1 *= this.itemSize;\r\n\t\tindex2 *= attribute.itemSize;\r\n\r\n\t\tfor ( let i = 0, l = this.itemSize; i < l; i ++ ) {\r\n\r\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcopyArray( array ) {\r\n\r\n\t\tthis.array.set( array );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tapplyMatrix3( m ) {\r\n\r\n\t\tif ( this.itemSize === 2 ) {\r\n\r\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\r\n\r\n\t\t\t\t_vector2$1.fromBufferAttribute( this, i );\r\n\t\t\t\t_vector2$1.applyMatrix3( m );\r\n\r\n\t\t\t\tthis.setXY( i, _vector2$1.x, _vector2$1.y );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( this.itemSize === 3 ) {\r\n\r\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\r\n\r\n\t\t\t\t_vector$9.fromBufferAttribute( this, i );\r\n\t\t\t\t_vector$9.applyMatrix3( m );\r\n\r\n\t\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tapplyMatrix4( m ) {\r\n\r\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\r\n\r\n\t\t\t_vector$9.fromBufferAttribute( this, i );\r\n\r\n\t\t\t_vector$9.applyMatrix4( m );\r\n\r\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tapplyNormalMatrix( m ) {\r\n\r\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\r\n\r\n\t\t\t_vector$9.fromBufferAttribute( this, i );\r\n\r\n\t\t\t_vector$9.applyNormalMatrix( m );\r\n\r\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttransformDirection( m ) {\r\n\r\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\r\n\r\n\t\t\t_vector$9.fromBufferAttribute( this, i );\r\n\r\n\t\t\t_vector$9.transformDirection( m );\r\n\r\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tset( value, offset = 0 ) {\r\n\r\n\t\t// Matching BufferAttribute constructor, do not normalize the array.\r\n\t\tthis.array.set( value, offset );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetComponent( index, component ) {\r\n\r\n\t\tlet value = this.array[ index * this.itemSize + component ];\r\n\r\n\t\tif ( this.normalized ) value = denormalize( value, this.array );\r\n\r\n\t\treturn value;\r\n\r\n\t}\r\n\r\n\tsetComponent( index, component, value ) {\r\n\r\n\t\tif ( this.normalized ) value = normalize( value, this.array );\r\n\r\n\t\tthis.array[ index * this.itemSize + component ] = value;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetX( index ) {\r\n\r\n\t\tlet x = this.array[ index * this.itemSize ];\r\n\r\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\r\n\r\n\t\treturn x;\r\n\r\n\t}\r\n\r\n\tsetX( index, x ) {\r\n\r\n\t\tif ( this.normalized ) x = normalize( x, this.array );\r\n\r\n\t\tthis.array[ index * this.itemSize ] = x;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetY( index ) {\r\n\r\n\t\tlet y = this.array[ index * this.itemSize + 1 ];\r\n\r\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\r\n\r\n\t\treturn y;\r\n\r\n\t}\r\n\r\n\tsetY( index, y ) {\r\n\r\n\t\tif ( this.normalized ) y = normalize( y, this.array );\r\n\r\n\t\tthis.array[ index * this.itemSize + 1 ] = y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetZ( index ) {\r\n\r\n\t\tlet z = this.array[ index * this.itemSize + 2 ];\r\n\r\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\r\n\r\n\t\treturn z;\r\n\r\n\t}\r\n\r\n\tsetZ( index, z ) {\r\n\r\n\t\tif ( this.normalized ) z = normalize( z, this.array );\r\n\r\n\t\tthis.array[ index * this.itemSize + 2 ] = z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetW( index ) {\r\n\r\n\t\tlet w = this.array[ index * this.itemSize + 3 ];\r\n\r\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\r\n\r\n\t\treturn w;\r\n\r\n\t}\r\n\r\n\tsetW( index, w ) {\r\n\r\n\t\tif ( this.normalized ) w = normalize( w, this.array );\r\n\r\n\t\tthis.array[ index * this.itemSize + 3 ] = w;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetXY( index, x, y ) {\r\n\r\n\t\tindex *= this.itemSize;\r\n\r\n\t\tif ( this.normalized ) {\r\n\r\n\t\t\tx = normalize( x, this.array );\r\n\t\t\ty = normalize( y, this.array );\r\n\r\n\t\t}\r\n\r\n\t\tthis.array[ index + 0 ] = x;\r\n\t\tthis.array[ index + 1 ] = y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetXYZ( index, x, y, z ) {\r\n\r\n\t\tindex *= this.itemSize;\r\n\r\n\t\tif ( this.normalized ) {\r\n\r\n\t\t\tx = normalize( x, this.array );\r\n\t\t\ty = normalize( y, this.array );\r\n\t\t\tz = normalize( z, this.array );\r\n\r\n\t\t}\r\n\r\n\t\tthis.array[ index + 0 ] = x;\r\n\t\tthis.array[ index + 1 ] = y;\r\n\t\tthis.array[ index + 2 ] = z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetXYZW( index, x, y, z, w ) {\r\n\r\n\t\tindex *= this.itemSize;\r\n\r\n\t\tif ( this.normalized ) {\r\n\r\n\t\t\tx = normalize( x, this.array );\r\n\t\t\ty = normalize( y, this.array );\r\n\t\t\tz = normalize( z, this.array );\r\n\t\t\tw = normalize( w, this.array );\r\n\r\n\t\t}\r\n\r\n\t\tthis.array[ index + 0 ] = x;\r\n\t\tthis.array[ index + 1 ] = y;\r\n\t\tthis.array[ index + 2 ] = z;\r\n\t\tthis.array[ index + 3 ] = w;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tonUpload( callback ) {\r\n\r\n\t\tthis.onUploadCallback = callback;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor( this.array, this.itemSize ).copy( this );\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = {\r\n\t\t\titemSize: this.itemSize,\r\n\t\t\ttype: this.array.constructor.name,\r\n\t\t\tarray: Array.from( this.array ),\r\n\t\t\tnormalized: this.normalized\r\n\t\t};\r\n\r\n\t\tif ( this.name !== '' ) data.name = this.name;\r\n\t\tif ( this.usage !== StaticDrawUsage ) data.usage = this.usage;\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n}\r\n\r\n//\r\n\r\nclass Int8BufferAttribute extends BufferAttribute {\r\n\r\n\tconstructor( array, itemSize, normalized ) {\r\n\r\n\t\tsuper( new Int8Array( array ), itemSize, normalized );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Uint8BufferAttribute extends BufferAttribute {\r\n\r\n\tconstructor( array, itemSize, normalized ) {\r\n\r\n\t\tsuper( new Uint8Array( array ), itemSize, normalized );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Uint8ClampedBufferAttribute extends BufferAttribute {\r\n\r\n\tconstructor( array, itemSize, normalized ) {\r\n\r\n\t\tsuper( new Uint8ClampedArray( array ), itemSize, normalized );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Int16BufferAttribute extends BufferAttribute {\r\n\r\n\tconstructor( array, itemSize, normalized ) {\r\n\r\n\t\tsuper( new Int16Array( array ), itemSize, normalized );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Uint16BufferAttribute extends BufferAttribute {\r\n\r\n\tconstructor( array, itemSize, normalized ) {\r\n\r\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Int32BufferAttribute extends BufferAttribute {\r\n\r\n\tconstructor( array, itemSize, normalized ) {\r\n\r\n\t\tsuper( new Int32Array( array ), itemSize, normalized );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Uint32BufferAttribute extends BufferAttribute {\r\n\r\n\tconstructor( array, itemSize, normalized ) {\r\n\r\n\t\tsuper( new Uint32Array( array ), itemSize, normalized );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Float16BufferAttribute extends BufferAttribute {\r\n\r\n\tconstructor( array, itemSize, normalized ) {\r\n\r\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\r\n\r\n\t\tthis.isFloat16BufferAttribute = true;\r\n\r\n\t}\r\n\r\n\tgetX( index ) {\r\n\r\n\t\tlet x = fromHalfFloat( this.array[ index * this.itemSize ] );\r\n\r\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\r\n\r\n\t\treturn x;\r\n\r\n\t}\r\n\r\n\tsetX( index, x ) {\r\n\r\n\t\tif ( this.normalized ) x = normalize( x, this.array );\r\n\r\n\t\tthis.array[ index * this.itemSize ] = toHalfFloat( x );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetY( index ) {\r\n\r\n\t\tlet y = fromHalfFloat( this.array[ index * this.itemSize + 1 ] );\r\n\r\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\r\n\r\n\t\treturn y;\r\n\r\n\t}\r\n\r\n\tsetY( index, y ) {\r\n\r\n\t\tif ( this.normalized ) y = normalize( y, this.array );\r\n\r\n\t\tthis.array[ index * this.itemSize + 1 ] = toHalfFloat( y );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetZ( index ) {\r\n\r\n\t\tlet z = fromHalfFloat( this.array[ index * this.itemSize + 2 ] );\r\n\r\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\r\n\r\n\t\treturn z;\r\n\r\n\t}\r\n\r\n\tsetZ( index, z ) {\r\n\r\n\t\tif ( this.normalized ) z = normalize( z, this.array );\r\n\r\n\t\tthis.array[ index * this.itemSize + 2 ] = toHalfFloat( z );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetW( index ) {\r\n\r\n\t\tlet w = fromHalfFloat( this.array[ index * this.itemSize + 3 ] );\r\n\r\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\r\n\r\n\t\treturn w;\r\n\r\n\t}\r\n\r\n\tsetW( index, w ) {\r\n\r\n\t\tif ( this.normalized ) w = normalize( w, this.array );\r\n\r\n\t\tthis.array[ index * this.itemSize + 3 ] = toHalfFloat( w );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetXY( index, x, y ) {\r\n\r\n\t\tindex *= this.itemSize;\r\n\r\n\t\tif ( this.normalized ) {\r\n\r\n\t\t\tx = normalize( x, this.array );\r\n\t\t\ty = normalize( y, this.array );\r\n\r\n\t\t}\r\n\r\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\r\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetXYZ( index, x, y, z ) {\r\n\r\n\t\tindex *= this.itemSize;\r\n\r\n\t\tif ( this.normalized ) {\r\n\r\n\t\t\tx = normalize( x, this.array );\r\n\t\t\ty = normalize( y, this.array );\r\n\t\t\tz = normalize( z, this.array );\r\n\r\n\t\t}\r\n\r\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\r\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\r\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetXYZW( index, x, y, z, w ) {\r\n\r\n\t\tindex *= this.itemSize;\r\n\r\n\t\tif ( this.normalized ) {\r\n\r\n\t\t\tx = normalize( x, this.array );\r\n\t\t\ty = normalize( y, this.array );\r\n\t\t\tz = normalize( z, this.array );\r\n\t\t\tw = normalize( w, this.array );\r\n\r\n\t\t}\r\n\r\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\r\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\r\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\r\n\t\tthis.array[ index + 3 ] = toHalfFloat( w );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nclass Float32BufferAttribute extends BufferAttribute {\r\n\r\n\tconstructor( array, itemSize, normalized ) {\r\n\r\n\t\tsuper( new Float32Array( array ), itemSize, normalized );\r\n\r\n\t}\r\n\r\n}\r\n\r\nlet _id$2 = 0;\r\n\r\nconst _m1$2 = /*@__PURE__*/ new Matrix4();\r\nconst _obj = /*@__PURE__*/ new Object3D();\r\nconst _offset = /*@__PURE__*/ new Vector3();\r\nconst _box$2 = /*@__PURE__*/ new Box3();\r\nconst _boxMorphTargets = /*@__PURE__*/ new Box3();\r\nconst _vector$8 = /*@__PURE__*/ new Vector3();\r\n\r\nclass BufferGeometry extends EventDispatcher {\r\n\r\n\tconstructor() {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isBufferGeometry = true;\r\n\r\n\t\tObject.defineProperty( this, 'id', { value: _id$2 ++ } );\r\n\r\n\t\tthis.uuid = generateUUID();\r\n\r\n\t\tthis.name = '';\r\n\t\tthis.type = 'BufferGeometry';\r\n\r\n\t\tthis.index = null;\r\n\t\tthis.attributes = {};\r\n\r\n\t\tthis.morphAttributes = {};\r\n\t\tthis.morphTargetsRelative = false;\r\n\r\n\t\tthis.groups = [];\r\n\r\n\t\tthis.boundingBox = null;\r\n\t\tthis.boundingSphere = null;\r\n\r\n\t\tthis.drawRange = { start: 0, count: Infinity };\r\n\r\n\t\tthis.userData = {};\r\n\r\n\t}\r\n\r\n\tgetIndex() {\r\n\r\n\t\treturn this.index;\r\n\r\n\t}\r\n\r\n\tsetIndex( index ) {\r\n\r\n\t\tif ( Array.isArray( index ) ) {\r\n\r\n\t\t\tthis.index = new ( arrayNeedsUint32( index ) ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.index = index;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetAttribute( name ) {\r\n\r\n\t\treturn this.attributes[ name ];\r\n\r\n\t}\r\n\r\n\tsetAttribute( name, attribute ) {\r\n\r\n\t\tthis.attributes[ name ] = attribute;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdeleteAttribute( name ) {\r\n\r\n\t\tdelete this.attributes[ name ];\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\thasAttribute( name ) {\r\n\r\n\t\treturn this.attributes[ name ] !== undefined;\r\n\r\n\t}\r\n\r\n\taddGroup( start, count, materialIndex = 0 ) {\r\n\r\n\t\tthis.groups.push( {\r\n\r\n\t\t\tstart: start,\r\n\t\t\tcount: count,\r\n\t\t\tmaterialIndex: materialIndex\r\n\r\n\t\t} );\r\n\r\n\t}\r\n\r\n\tclearGroups() {\r\n\r\n\t\tthis.groups = [];\r\n\r\n\t}\r\n\r\n\tsetDrawRange( start, count ) {\r\n\r\n\t\tthis.drawRange.start = start;\r\n\t\tthis.drawRange.count = count;\r\n\r\n\t}\r\n\r\n\tapplyMatrix4( matrix ) {\r\n\r\n\t\tconst position = this.attributes.position;\r\n\r\n\t\tif ( position !== undefined ) {\r\n\r\n\t\t\tposition.applyMatrix4( matrix );\r\n\r\n\t\t\tposition.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t\tconst normal = this.attributes.normal;\r\n\r\n\t\tif ( normal !== undefined ) {\r\n\r\n\t\t\tconst normalMatrix = new Matrix3().getNormalMatrix( matrix );\r\n\r\n\t\t\tnormal.applyNormalMatrix( normalMatrix );\r\n\r\n\t\t\tnormal.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t\tconst tangent = this.attributes.tangent;\r\n\r\n\t\tif ( tangent !== undefined ) {\r\n\r\n\t\t\ttangent.transformDirection( matrix );\r\n\r\n\t\t\ttangent.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.boundingBox !== null ) {\r\n\r\n\t\t\tthis.computeBoundingBox();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.boundingSphere !== null ) {\r\n\r\n\t\t\tthis.computeBoundingSphere();\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tapplyQuaternion( q ) {\r\n\r\n\t\t_m1$2.makeRotationFromQuaternion( q );\r\n\r\n\t\tthis.applyMatrix4( _m1$2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\trotateX( angle ) {\r\n\r\n\t\t// rotate geometry around world x-axis\r\n\r\n\t\t_m1$2.makeRotationX( angle );\r\n\r\n\t\tthis.applyMatrix4( _m1$2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\trotateY( angle ) {\r\n\r\n\t\t// rotate geometry around world y-axis\r\n\r\n\t\t_m1$2.makeRotationY( angle );\r\n\r\n\t\tthis.applyMatrix4( _m1$2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\trotateZ( angle ) {\r\n\r\n\t\t// rotate geometry around world z-axis\r\n\r\n\t\t_m1$2.makeRotationZ( angle );\r\n\r\n\t\tthis.applyMatrix4( _m1$2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttranslate( x, y, z ) {\r\n\r\n\t\t// translate geometry\r\n\r\n\t\t_m1$2.makeTranslation( x, y, z );\r\n\r\n\t\tthis.applyMatrix4( _m1$2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tscale( x, y, z ) {\r\n\r\n\t\t// scale geometry\r\n\r\n\t\t_m1$2.makeScale( x, y, z );\r\n\r\n\t\tthis.applyMatrix4( _m1$2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tlookAt( vector ) {\r\n\r\n\t\t_obj.lookAt( vector );\r\n\r\n\t\t_obj.updateMatrix();\r\n\r\n\t\tthis.applyMatrix4( _obj.matrix );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcenter() {\r\n\r\n\t\tthis.computeBoundingBox();\r\n\r\n\t\tthis.boundingBox.getCenter( _offset ).negate();\r\n\r\n\t\tthis.translate( _offset.x, _offset.y, _offset.z );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromPoints( points ) {\r\n\r\n\t\tconst position = [];\r\n\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst point = points[ i ];\r\n\t\t\tposition.push( point.x, point.y, point.z || 0 );\r\n\r\n\t\t}\r\n\r\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcomputeBoundingBox() {\r\n\r\n\t\tif ( this.boundingBox === null ) {\r\n\r\n\t\t\tthis.boundingBox = new Box3();\r\n\r\n\t\t}\r\n\r\n\t\tconst position = this.attributes.position;\r\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\r\n\r\n\t\tif ( position && position.isGLBufferAttribute ) {\r\n\r\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.', this );\r\n\r\n\t\t\tthis.boundingBox.set(\r\n\t\t\t\tnew Vector3( - Infinity, - Infinity, - Infinity ),\r\n\t\t\t\tnew Vector3( + Infinity, + Infinity, + Infinity )\r\n\t\t\t);\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tif ( position !== undefined ) {\r\n\r\n\t\t\tthis.boundingBox.setFromBufferAttribute( position );\r\n\r\n\t\t\t// process morph attributes if present\r\n\r\n\t\t\tif ( morphAttributesPosition ) {\r\n\r\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\r\n\t\t\t\t\t_box$2.setFromBufferAttribute( morphAttribute );\r\n\r\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\r\n\r\n\t\t\t\t\t\t_vector$8.addVectors( this.boundingBox.min, _box$2.min );\r\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$8 );\r\n\r\n\t\t\t\t\t\t_vector$8.addVectors( this.boundingBox.max, _box$2.max );\r\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$8 );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$2.min );\r\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$2.max );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.boundingBox.makeEmpty();\r\n\r\n\t\t}\r\n\r\n\t\tif ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {\r\n\r\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The \"position\" attribute is likely to have NaN values.', this );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcomputeBoundingSphere() {\r\n\r\n\t\tif ( this.boundingSphere === null ) {\r\n\r\n\t\t\tthis.boundingSphere = new Sphere();\r\n\r\n\t\t}\r\n\r\n\t\tconst position = this.attributes.position;\r\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\r\n\r\n\t\tif ( position && position.isGLBufferAttribute ) {\r\n\r\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.', this );\r\n\r\n\t\t\tthis.boundingSphere.set( new Vector3(), Infinity );\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tif ( position ) {\r\n\r\n\t\t\t// first, find the center of the bounding sphere\r\n\r\n\t\t\tconst center = this.boundingSphere.center;\r\n\r\n\t\t\t_box$2.setFromBufferAttribute( position );\r\n\r\n\t\t\t// process morph attributes if present\r\n\r\n\t\t\tif ( morphAttributesPosition ) {\r\n\r\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\r\n\t\t\t\t\t_boxMorphTargets.setFromBufferAttribute( morphAttribute );\r\n\r\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\r\n\r\n\t\t\t\t\t\t_vector$8.addVectors( _box$2.min, _boxMorphTargets.min );\r\n\t\t\t\t\t\t_box$2.expandByPoint( _vector$8 );\r\n\r\n\t\t\t\t\t\t_vector$8.addVectors( _box$2.max, _boxMorphTargets.max );\r\n\t\t\t\t\t\t_box$2.expandByPoint( _vector$8 );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t_box$2.expandByPoint( _boxMorphTargets.min );\r\n\t\t\t\t\t\t_box$2.expandByPoint( _boxMorphTargets.max );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_box$2.getCenter( center );\r\n\r\n\t\t\t// second, try to find a boundingSphere with a radius smaller than the\r\n\t\t\t// boundingSphere of the boundingBox: sqrt(3) smaller in the best case\r\n\r\n\t\t\tlet maxRadiusSq = 0;\r\n\r\n\t\t\tfor ( let i = 0, il = position.count; i < il; i ++ ) {\r\n\r\n\t\t\t\t_vector$8.fromBufferAttribute( position, i );\r\n\r\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// process morph attributes if present\r\n\r\n\t\t\tif ( morphAttributesPosition ) {\r\n\r\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\r\n\t\t\t\t\tconst morphTargetsRelative = this.morphTargetsRelative;\r\n\r\n\t\t\t\t\tfor ( let j = 0, jl = morphAttribute.count; j < jl; j ++ ) {\r\n\r\n\t\t\t\t\t\t_vector$8.fromBufferAttribute( morphAttribute, j );\r\n\r\n\t\t\t\t\t\tif ( morphTargetsRelative ) {\r\n\r\n\t\t\t\t\t\t\t_offset.fromBufferAttribute( position, j );\r\n\t\t\t\t\t\t\t_vector$8.add( _offset );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.boundingSphere.radius = Math.sqrt( maxRadiusSq );\r\n\r\n\t\t\tif ( isNaN( this.boundingSphere.radius ) ) {\r\n\r\n\t\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.', this );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcomputeTangents() {\r\n\r\n\t\tconst index = this.index;\r\n\t\tconst attributes = this.attributes;\r\n\r\n\t\t// based on http://www.terathon.com/code/tangent.html\r\n\t\t// (per vertex tangents)\r\n\r\n\t\tif ( index === null ||\r\n\t\t\t attributes.position === undefined ||\r\n\t\t\t attributes.normal === undefined ||\r\n\t\t\t attributes.uv === undefined ) {\r\n\r\n\t\t\tconsole.error( 'THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)' );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tconst positionAttribute = attributes.position;\r\n\t\tconst normalAttribute = attributes.normal;\r\n\t\tconst uvAttribute = attributes.uv;\r\n\r\n\t\tif ( this.hasAttribute( 'tangent' ) === false ) {\r\n\r\n\t\t\tthis.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * positionAttribute.count ), 4 ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst tangentAttribute = this.getAttribute( 'tangent' );\r\n\r\n\t\tconst tan1 = [], tan2 = [];\r\n\r\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\r\n\r\n\t\t\ttan1[ i ] = new Vector3();\r\n\t\t\ttan2[ i ] = new Vector3();\r\n\r\n\t\t}\r\n\r\n\t\tconst vA = new Vector3(),\r\n\t\t\tvB = new Vector3(),\r\n\t\t\tvC = new Vector3(),\r\n\r\n\t\t\tuvA = new Vector2(),\r\n\t\t\tuvB = new Vector2(),\r\n\t\t\tuvC = new Vector2(),\r\n\r\n\t\t\tsdir = new Vector3(),\r\n\t\t\ttdir = new Vector3();\r\n\r\n\t\tfunction handleTriangle( a, b, c ) {\r\n\r\n\t\t\tvA.fromBufferAttribute( positionAttribute, a );\r\n\t\t\tvB.fromBufferAttribute( positionAttribute, b );\r\n\t\t\tvC.fromBufferAttribute( positionAttribute, c );\r\n\r\n\t\t\tuvA.fromBufferAttribute( uvAttribute, a );\r\n\t\t\tuvB.fromBufferAttribute( uvAttribute, b );\r\n\t\t\tuvC.fromBufferAttribute( uvAttribute, c );\r\n\r\n\t\t\tvB.sub( vA );\r\n\t\t\tvC.sub( vA );\r\n\r\n\t\t\tuvB.sub( uvA );\r\n\t\t\tuvC.sub( uvA );\r\n\r\n\t\t\tconst r = 1.0 / ( uvB.x * uvC.y - uvC.x * uvB.y );\r\n\r\n\t\t\t// silently ignore degenerate uv triangles having coincident or colinear vertices\r\n\r\n\t\t\tif ( ! isFinite( r ) ) return;\r\n\r\n\t\t\tsdir.copy( vB ).multiplyScalar( uvC.y ).addScaledVector( vC, - uvB.y ).multiplyScalar( r );\r\n\t\t\ttdir.copy( vC ).multiplyScalar( uvB.x ).addScaledVector( vB, - uvC.x ).multiplyScalar( r );\r\n\r\n\t\t\ttan1[ a ].add( sdir );\r\n\t\t\ttan1[ b ].add( sdir );\r\n\t\t\ttan1[ c ].add( sdir );\r\n\r\n\t\t\ttan2[ a ].add( tdir );\r\n\t\t\ttan2[ b ].add( tdir );\r\n\t\t\ttan2[ c ].add( tdir );\r\n\r\n\t\t}\r\n\r\n\t\tlet groups = this.groups;\r\n\r\n\t\tif ( groups.length === 0 ) {\r\n\r\n\t\t\tgroups = [ {\r\n\t\t\t\tstart: 0,\r\n\t\t\t\tcount: index.count\r\n\t\t\t} ];\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\r\n\r\n\t\t\tconst group = groups[ i ];\r\n\r\n\t\t\tconst start = group.start;\r\n\t\t\tconst count = group.count;\r\n\r\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\r\n\r\n\t\t\t\thandleTriangle(\r\n\t\t\t\t\tindex.getX( j + 0 ),\r\n\t\t\t\t\tindex.getX( j + 1 ),\r\n\t\t\t\t\tindex.getX( j + 2 )\r\n\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconst tmp = new Vector3(), tmp2 = new Vector3();\r\n\t\tconst n = new Vector3(), n2 = new Vector3();\r\n\r\n\t\tfunction handleVertex( v ) {\r\n\r\n\t\t\tn.fromBufferAttribute( normalAttribute, v );\r\n\t\t\tn2.copy( n );\r\n\r\n\t\t\tconst t = tan1[ v ];\r\n\r\n\t\t\t// Gram-Schmidt orthogonalize\r\n\r\n\t\t\ttmp.copy( t );\r\n\t\t\ttmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();\r\n\r\n\t\t\t// Calculate handedness\r\n\r\n\t\t\ttmp2.crossVectors( n2, t );\r\n\t\t\tconst test = tmp2.dot( tan2[ v ] );\r\n\t\t\tconst w = ( test < 0.0 ) ? - 1.0 : 1.0;\r\n\r\n\t\t\ttangentAttribute.setXYZW( v, tmp.x, tmp.y, tmp.z, w );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\r\n\r\n\t\t\tconst group = groups[ i ];\r\n\r\n\t\t\tconst start = group.start;\r\n\t\t\tconst count = group.count;\r\n\r\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\r\n\r\n\t\t\t\thandleVertex( index.getX( j + 0 ) );\r\n\t\t\t\thandleVertex( index.getX( j + 1 ) );\r\n\t\t\t\thandleVertex( index.getX( j + 2 ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcomputeVertexNormals() {\r\n\r\n\t\tconst index = this.index;\r\n\t\tconst positionAttribute = this.getAttribute( 'position' );\r\n\r\n\t\tif ( positionAttribute !== undefined ) {\r\n\r\n\t\t\tlet normalAttribute = this.getAttribute( 'normal' );\r\n\r\n\t\t\tif ( normalAttribute === undefined ) {\r\n\r\n\t\t\t\tnormalAttribute = new BufferAttribute( new Float32Array( positionAttribute.count * 3 ), 3 );\r\n\t\t\t\tthis.setAttribute( 'normal', normalAttribute );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// reset existing normals to zero\r\n\r\n\t\t\t\tfor ( let i = 0, il = normalAttribute.count; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tnormalAttribute.setXYZ( i, 0, 0, 0 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst pA = new Vector3(), pB = new Vector3(), pC = new Vector3();\r\n\t\t\tconst nA = new Vector3(), nB = new Vector3(), nC = new Vector3();\r\n\t\t\tconst cb = new Vector3(), ab = new Vector3();\r\n\r\n\t\t\t// indexed elements\r\n\r\n\t\t\tif ( index ) {\r\n\r\n\t\t\t\tfor ( let i = 0, il = index.count; i < il; i += 3 ) {\r\n\r\n\t\t\t\t\tconst vA = index.getX( i + 0 );\r\n\t\t\t\t\tconst vB = index.getX( i + 1 );\r\n\t\t\t\t\tconst vC = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, vA );\r\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, vB );\r\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, vC );\r\n\r\n\t\t\t\t\tcb.subVectors( pC, pB );\r\n\t\t\t\t\tab.subVectors( pA, pB );\r\n\t\t\t\t\tcb.cross( ab );\r\n\r\n\t\t\t\t\tnA.fromBufferAttribute( normalAttribute, vA );\r\n\t\t\t\t\tnB.fromBufferAttribute( normalAttribute, vB );\r\n\t\t\t\t\tnC.fromBufferAttribute( normalAttribute, vC );\r\n\r\n\t\t\t\t\tnA.add( cb );\r\n\t\t\t\t\tnB.add( cb );\r\n\t\t\t\t\tnC.add( cb );\r\n\r\n\t\t\t\t\tnormalAttribute.setXYZ( vA, nA.x, nA.y, nA.z );\r\n\t\t\t\t\tnormalAttribute.setXYZ( vB, nB.x, nB.y, nB.z );\r\n\t\t\t\t\tnormalAttribute.setXYZ( vC, nC.x, nC.y, nC.z );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// non-indexed elements (unconnected triangle soup)\r\n\r\n\t\t\t\tfor ( let i = 0, il = positionAttribute.count; i < il; i += 3 ) {\r\n\r\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, i + 0 );\r\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, i + 1 );\r\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, i + 2 );\r\n\r\n\t\t\t\t\tcb.subVectors( pC, pB );\r\n\t\t\t\t\tab.subVectors( pA, pB );\r\n\t\t\t\t\tcb.cross( ab );\r\n\r\n\t\t\t\t\tnormalAttribute.setXYZ( i + 0, cb.x, cb.y, cb.z );\r\n\t\t\t\t\tnormalAttribute.setXYZ( i + 1, cb.x, cb.y, cb.z );\r\n\t\t\t\t\tnormalAttribute.setXYZ( i + 2, cb.x, cb.y, cb.z );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.normalizeNormals();\r\n\r\n\t\t\tnormalAttribute.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tnormalizeNormals() {\r\n\r\n\t\tconst normals = this.attributes.normal;\r\n\r\n\t\tfor ( let i = 0, il = normals.count; i < il; i ++ ) {\r\n\r\n\t\t\t_vector$8.fromBufferAttribute( normals, i );\r\n\r\n\t\t\t_vector$8.normalize();\r\n\r\n\t\t\tnormals.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ttoNonIndexed() {\r\n\r\n\t\tfunction convertBufferAttribute( attribute, indices ) {\r\n\r\n\t\t\tconst array = attribute.array;\r\n\t\t\tconst itemSize = attribute.itemSize;\r\n\t\t\tconst normalized = attribute.normalized;\r\n\r\n\t\t\tconst array2 = new array.constructor( indices.length * itemSize );\r\n\r\n\t\t\tlet index = 0, index2 = 0;\r\n\r\n\t\t\tfor ( let i = 0, l = indices.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\t\t\tindex = indices[ i ] * attribute.data.stride + attribute.offset;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tindex = indices[ i ] * itemSize;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor ( let j = 0; j < itemSize; j ++ ) {\r\n\r\n\t\t\t\t\tarray2[ index2 ++ ] = array[ index ++ ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn new BufferAttribute( array2, itemSize, normalized );\r\n\r\n\t\t}\r\n\r\n\t\t//\r\n\r\n\t\tif ( this.index === null ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.' );\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tconst geometry2 = new BufferGeometry();\r\n\r\n\t\tconst indices = this.index.array;\r\n\t\tconst attributes = this.attributes;\r\n\r\n\t\t// attributes\r\n\r\n\t\tfor ( const name in attributes ) {\r\n\r\n\t\t\tconst attribute = attributes[ name ];\r\n\r\n\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\r\n\r\n\t\t\tgeometry2.setAttribute( name, newAttribute );\r\n\r\n\t\t}\r\n\r\n\t\t// morph attributes\r\n\r\n\t\tconst morphAttributes = this.morphAttributes;\r\n\r\n\t\tfor ( const name in morphAttributes ) {\r\n\r\n\t\t\tconst morphArray = [];\r\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\r\n\r\n\t\t\tfor ( let i = 0, il = morphAttribute.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tconst attribute = morphAttribute[ i ];\r\n\r\n\t\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\r\n\r\n\t\t\t\tmorphArray.push( newAttribute );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgeometry2.morphAttributes[ name ] = morphArray;\r\n\r\n\t\t}\r\n\r\n\t\tgeometry2.morphTargetsRelative = this.morphTargetsRelative;\r\n\r\n\t\t// groups\r\n\r\n\t\tconst groups = this.groups;\r\n\r\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst group = groups[ i ];\r\n\t\t\tgeometry2.addGroup( group.start, group.count, group.materialIndex );\r\n\r\n\t\t}\r\n\r\n\t\treturn geometry2;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = {\r\n\t\t\tmetadata: {\r\n\t\t\t\tversion: 4.6,\r\n\t\t\t\ttype: 'BufferGeometry',\r\n\t\t\t\tgenerator: 'BufferGeometry.toJSON'\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t// standard BufferGeometry serialization\r\n\r\n\t\tdata.uuid = this.uuid;\r\n\t\tdata.type = this.type;\r\n\t\tif ( this.name !== '' ) data.name = this.name;\r\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\r\n\r\n\t\tif ( this.parameters !== undefined ) {\r\n\r\n\t\t\tconst parameters = this.parameters;\r\n\r\n\t\t\tfor ( const key in parameters ) {\r\n\r\n\t\t\t\tif ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn data;\r\n\r\n\t\t}\r\n\r\n\t\t// for simplicity the code assumes attributes are not shared across geometries, see #15811\r\n\r\n\t\tdata.data = { attributes: {} };\r\n\r\n\t\tconst index = this.index;\r\n\r\n\t\tif ( index !== null ) {\r\n\r\n\t\t\tdata.data.index = {\r\n\t\t\t\ttype: index.array.constructor.name,\r\n\t\t\t\tarray: Array.prototype.slice.call( index.array )\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t\tconst attributes = this.attributes;\r\n\r\n\t\tfor ( const key in attributes ) {\r\n\r\n\t\t\tconst attribute = attributes[ key ];\r\n\r\n\t\t\tdata.data.attributes[ key ] = attribute.toJSON( data.data );\r\n\r\n\t\t}\r\n\r\n\t\tconst morphAttributes = {};\r\n\t\tlet hasMorphAttributes = false;\r\n\r\n\t\tfor ( const key in this.morphAttributes ) {\r\n\r\n\t\t\tconst attributeArray = this.morphAttributes[ key ];\r\n\r\n\t\t\tconst array = [];\r\n\r\n\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tconst attribute = attributeArray[ i ];\r\n\r\n\t\t\t\tarray.push( attribute.toJSON( data.data ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( array.length > 0 ) {\r\n\r\n\t\t\t\tmorphAttributes[ key ] = array;\r\n\r\n\t\t\t\thasMorphAttributes = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( hasMorphAttributes ) {\r\n\r\n\t\t\tdata.data.morphAttributes = morphAttributes;\r\n\t\t\tdata.data.morphTargetsRelative = this.morphTargetsRelative;\r\n\r\n\t\t}\r\n\r\n\t\tconst groups = this.groups;\r\n\r\n\t\tif ( groups.length > 0 ) {\r\n\r\n\t\t\tdata.data.groups = JSON.parse( JSON.stringify( groups ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst boundingSphere = this.boundingSphere;\r\n\r\n\t\tif ( boundingSphere !== null ) {\r\n\r\n\t\t\tdata.data.boundingSphere = {\r\n\t\t\t\tcenter: boundingSphere.center.toArray(),\r\n\t\t\t\tradius: boundingSphere.radius\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\t// reset\r\n\r\n\t\tthis.index = null;\r\n\t\tthis.attributes = {};\r\n\t\tthis.morphAttributes = {};\r\n\t\tthis.groups = [];\r\n\t\tthis.boundingBox = null;\r\n\t\tthis.boundingSphere = null;\r\n\r\n\t\t// used for storing cloned, shared data\r\n\r\n\t\tconst data = {};\r\n\r\n\t\t// name\r\n\r\n\t\tthis.name = source.name;\r\n\r\n\t\t// index\r\n\r\n\t\tconst index = source.index;\r\n\r\n\t\tif ( index !== null ) {\r\n\r\n\t\t\tthis.setIndex( index.clone( data ) );\r\n\r\n\t\t}\r\n\r\n\t\t// attributes\r\n\r\n\t\tconst attributes = source.attributes;\r\n\r\n\t\tfor ( const name in attributes ) {\r\n\r\n\t\t\tconst attribute = attributes[ name ];\r\n\t\t\tthis.setAttribute( name, attribute.clone( data ) );\r\n\r\n\t\t}\r\n\r\n\t\t// morph attributes\r\n\r\n\t\tconst morphAttributes = source.morphAttributes;\r\n\r\n\t\tfor ( const name in morphAttributes ) {\r\n\r\n\t\t\tconst array = [];\r\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\r\n\r\n\t\t\tfor ( let i = 0, l = morphAttribute.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tarray.push( morphAttribute[ i ].clone( data ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.morphAttributes[ name ] = array;\r\n\r\n\t\t}\r\n\r\n\t\tthis.morphTargetsRelative = source.morphTargetsRelative;\r\n\r\n\t\t// groups\r\n\r\n\t\tconst groups = source.groups;\r\n\r\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst group = groups[ i ];\r\n\t\t\tthis.addGroup( group.start, group.count, group.materialIndex );\r\n\r\n\t\t}\r\n\r\n\t\t// bounding box\r\n\r\n\t\tconst boundingBox = source.boundingBox;\r\n\r\n\t\tif ( boundingBox !== null ) {\r\n\r\n\t\t\tthis.boundingBox = boundingBox.clone();\r\n\r\n\t\t}\r\n\r\n\t\t// bounding sphere\r\n\r\n\t\tconst boundingSphere = source.boundingSphere;\r\n\r\n\t\tif ( boundingSphere !== null ) {\r\n\r\n\t\t\tthis.boundingSphere = boundingSphere.clone();\r\n\r\n\t\t}\r\n\r\n\t\t// draw range\r\n\r\n\t\tthis.drawRange.start = source.drawRange.start;\r\n\t\tthis.drawRange.count = source.drawRange.count;\r\n\r\n\t\t// user data\r\n\r\n\t\tthis.userData = source.userData;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.dispatchEvent( { type: 'dispose' } );\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _inverseMatrix$3 = /*@__PURE__*/ new Matrix4();\r\nconst _ray$3 = /*@__PURE__*/ new Ray();\r\nconst _sphere$6 = /*@__PURE__*/ new Sphere();\r\nconst _sphereHitAt = /*@__PURE__*/ new Vector3();\r\n\r\nconst _vA$1 = /*@__PURE__*/ new Vector3();\r\nconst _vB$1 = /*@__PURE__*/ new Vector3();\r\nconst _vC$1 = /*@__PURE__*/ new Vector3();\r\n\r\nconst _tempA = /*@__PURE__*/ new Vector3();\r\nconst _morphA = /*@__PURE__*/ new Vector3();\r\n\r\nconst _uvA$1 = /*@__PURE__*/ new Vector2();\r\nconst _uvB$1 = /*@__PURE__*/ new Vector2();\r\nconst _uvC$1 = /*@__PURE__*/ new Vector2();\r\n\r\nconst _normalA = /*@__PURE__*/ new Vector3();\r\nconst _normalB = /*@__PURE__*/ new Vector3();\r\nconst _normalC = /*@__PURE__*/ new Vector3();\r\n\r\nconst _intersectionPoint = /*@__PURE__*/ new Vector3();\r\nconst _intersectionPointWorld = /*@__PURE__*/ new Vector3();\r\n\r\nclass Mesh extends Object3D {\r\n\r\n\tconstructor( geometry = new BufferGeometry(), material = new MeshBasicMaterial() ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isMesh = true;\r\n\r\n\t\tthis.type = 'Mesh';\r\n\r\n\t\tthis.geometry = geometry;\r\n\t\tthis.material = material;\r\n\r\n\t\tthis.updateMorphTargets();\r\n\r\n\t}\r\n\r\n\tcopy( source, recursive ) {\r\n\r\n\t\tsuper.copy( source, recursive );\r\n\r\n\t\tif ( source.morphTargetInfluences !== undefined ) {\r\n\r\n\t\t\tthis.morphTargetInfluences = source.morphTargetInfluences.slice();\r\n\r\n\t\t}\r\n\r\n\t\tif ( source.morphTargetDictionary !== undefined ) {\r\n\r\n\t\t\tthis.morphTargetDictionary = Object.assign( {}, source.morphTargetDictionary );\r\n\r\n\t\t}\r\n\r\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\r\n\t\tthis.geometry = source.geometry;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tupdateMorphTargets() {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\r\n\t\tconst morphAttributes = geometry.morphAttributes;\r\n\t\tconst keys = Object.keys( morphAttributes );\r\n\r\n\t\tif ( keys.length > 0 ) {\r\n\r\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\r\n\r\n\t\t\tif ( morphAttribute !== undefined ) {\r\n\r\n\t\t\t\tthis.morphTargetInfluences = [];\r\n\t\t\t\tthis.morphTargetDictionary = {};\r\n\r\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\r\n\r\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\r\n\r\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\r\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tgetVertexPosition( index, target ) {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tconst position = geometry.attributes.position;\r\n\t\tconst morphPosition = geometry.morphAttributes.position;\r\n\t\tconst morphTargetsRelative = geometry.morphTargetsRelative;\r\n\r\n\t\ttarget.fromBufferAttribute( position, index );\r\n\r\n\t\tconst morphInfluences = this.morphTargetInfluences;\r\n\r\n\t\tif ( morphPosition && morphInfluences ) {\r\n\r\n\t\t\t_morphA.set( 0, 0, 0 );\r\n\r\n\t\t\tfor ( let i = 0, il = morphPosition.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tconst influence = morphInfluences[ i ];\r\n\t\t\t\tconst morphAttribute = morphPosition[ i ];\r\n\r\n\t\t\t\tif ( influence === 0 ) continue;\r\n\r\n\t\t\t\t_tempA.fromBufferAttribute( morphAttribute, index );\r\n\r\n\t\t\t\tif ( morphTargetsRelative ) {\r\n\r\n\t\t\t\t\t_morphA.addScaledVector( _tempA, influence );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t_morphA.addScaledVector( _tempA.sub( target ), influence );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\ttarget.add( _morphA );\r\n\r\n\t\t}\r\n\r\n\t\treturn target;\r\n\r\n\t}\r\n\r\n\traycast( raycaster, intersects ) {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tconst material = this.material;\r\n\t\tconst matrixWorld = this.matrixWorld;\r\n\r\n\t\tif ( material === undefined ) return;\r\n\r\n\t\t// test with bounding sphere in world space\r\n\r\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\r\n\r\n\t\t_sphere$6.copy( geometry.boundingSphere );\r\n\t\t_sphere$6.applyMatrix4( matrixWorld );\r\n\r\n\t\t// check distance from ray origin to bounding sphere\r\n\r\n\t\t_ray$3.copy( raycaster.ray ).recast( raycaster.near );\r\n\r\n\t\tif ( _sphere$6.containsPoint( _ray$3.origin ) === false ) {\r\n\r\n\t\t\tif ( _ray$3.intersectSphere( _sphere$6, _sphereHitAt ) === null ) return;\r\n\r\n\t\t\tif ( _ray$3.origin.distanceToSquared( _sphereHitAt ) > ( raycaster.far - raycaster.near ) ** 2 ) return;\r\n\r\n\t\t}\r\n\r\n\t\t// convert ray to local space of mesh\r\n\r\n\t\t_inverseMatrix$3.copy( matrixWorld ).invert();\r\n\t\t_ray$3.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$3 );\r\n\r\n\t\t// test with bounding box in local space\r\n\r\n\t\tif ( geometry.boundingBox !== null ) {\r\n\r\n\t\t\tif ( _ray$3.intersectsBox( geometry.boundingBox ) === false ) return;\r\n\r\n\t\t}\r\n\r\n\t\t// test for intersections with geometry\r\n\r\n\t\tthis._computeIntersections( raycaster, intersects, _ray$3 );\r\n\r\n\t}\r\n\r\n\t_computeIntersections( raycaster, intersects, rayLocalSpace ) {\r\n\r\n\t\tlet intersection;\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tconst material = this.material;\r\n\r\n\t\tconst index = geometry.index;\r\n\t\tconst position = geometry.attributes.position;\r\n\t\tconst uv = geometry.attributes.uv;\r\n\t\tconst uv1 = geometry.attributes.uv1;\r\n\t\tconst normal = geometry.attributes.normal;\r\n\t\tconst groups = geometry.groups;\r\n\t\tconst drawRange = geometry.drawRange;\r\n\r\n\t\tif ( index !== null ) {\r\n\r\n\t\t\t// indexed buffer geometry\r\n\r\n\t\t\tif ( Array.isArray( material ) ) {\r\n\r\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tconst group = groups[ i ];\r\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\r\n\r\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\r\n\t\t\t\t\tconst end = Math.min( index.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\r\n\r\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\r\n\r\n\t\t\t\t\t\tconst a = index.getX( j );\r\n\t\t\t\t\t\tconst b = index.getX( j + 1 );\r\n\t\t\t\t\t\tconst c = index.getX( j + 2 );\r\n\r\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\r\n\r\n\t\t\t\t\t\tif ( intersection ) {\r\n\r\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in indexed buffer semantics\r\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\r\n\t\t\t\t\t\t\tintersects.push( intersection );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\r\n\t\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\r\n\r\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\r\n\r\n\t\t\t\t\tconst a = index.getX( i );\r\n\t\t\t\t\tconst b = index.getX( i + 1 );\r\n\t\t\t\t\tconst c = index.getX( i + 2 );\r\n\r\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\r\n\r\n\t\t\t\t\tif ( intersection ) {\r\n\r\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics\r\n\t\t\t\t\t\tintersects.push( intersection );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( position !== undefined ) {\r\n\r\n\t\t\t// non-indexed buffer geometry\r\n\r\n\t\t\tif ( Array.isArray( material ) ) {\r\n\r\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tconst group = groups[ i ];\r\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\r\n\r\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\r\n\t\t\t\t\tconst end = Math.min( position.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\r\n\r\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\r\n\r\n\t\t\t\t\t\tconst a = j;\r\n\t\t\t\t\t\tconst b = j + 1;\r\n\t\t\t\t\t\tconst c = j + 2;\r\n\r\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\r\n\r\n\t\t\t\t\t\tif ( intersection ) {\r\n\r\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in non-indexed buffer semantics\r\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\r\n\t\t\t\t\t\t\tintersects.push( intersection );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\r\n\t\t\t\tconst end = Math.min( position.count, ( drawRange.start + drawRange.count ) );\r\n\r\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\r\n\r\n\t\t\t\t\tconst a = i;\r\n\t\t\t\t\tconst b = i + 1;\r\n\t\t\t\t\tconst c = i + 2;\r\n\r\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\r\n\r\n\t\t\t\t\tif ( intersection ) {\r\n\r\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics\r\n\t\t\t\t\t\tintersects.push( intersection );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction checkIntersection$1( object, material, raycaster, ray, pA, pB, pC, point ) {\r\n\r\n\tlet intersect;\r\n\r\n\tif ( material.side === BackSide ) {\r\n\r\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\r\n\r\n\t} else {\r\n\r\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, ( material.side === FrontSide ), point );\r\n\r\n\t}\r\n\r\n\tif ( intersect === null ) return null;\r\n\r\n\t_intersectionPointWorld.copy( point );\r\n\t_intersectionPointWorld.applyMatrix4( object.matrixWorld );\r\n\r\n\tconst distance = raycaster.ray.origin.distanceTo( _intersectionPointWorld );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\r\n\r\n\treturn {\r\n\t\tdistance: distance,\r\n\t\tpoint: _intersectionPointWorld.clone(),\r\n\t\tobject: object\r\n\t};\r\n\r\n}\r\n\r\nfunction checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, normal, a, b, c ) {\r\n\r\n\tobject.getVertexPosition( a, _vA$1 );\r\n\tobject.getVertexPosition( b, _vB$1 );\r\n\tobject.getVertexPosition( c, _vC$1 );\r\n\r\n\tconst intersection = checkIntersection$1( object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint );\r\n\r\n\tif ( intersection ) {\r\n\r\n\t\tif ( uv ) {\r\n\r\n\t\t\t_uvA$1.fromBufferAttribute( uv, a );\r\n\t\t\t_uvB$1.fromBufferAttribute( uv, b );\r\n\t\t\t_uvC$1.fromBufferAttribute( uv, c );\r\n\r\n\t\t\tintersection.uv = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );\r\n\r\n\t\t}\r\n\r\n\t\tif ( uv1 ) {\r\n\r\n\t\t\t_uvA$1.fromBufferAttribute( uv1, a );\r\n\t\t\t_uvB$1.fromBufferAttribute( uv1, b );\r\n\t\t\t_uvC$1.fromBufferAttribute( uv1, c );\r\n\r\n\t\t\tintersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );\r\n\r\n\t\t}\r\n\r\n\t\tif ( normal ) {\r\n\r\n\t\t\t_normalA.fromBufferAttribute( normal, a );\r\n\t\t\t_normalB.fromBufferAttribute( normal, b );\r\n\t\t\t_normalC.fromBufferAttribute( normal, c );\r\n\r\n\t\t\tintersection.normal = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _normalA, _normalB, _normalC, new Vector3() );\r\n\r\n\t\t\tif ( intersection.normal.dot( ray.direction ) > 0 ) {\r\n\r\n\t\t\t\tintersection.normal.multiplyScalar( - 1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconst face = {\r\n\t\t\ta: a,\r\n\t\t\tb: b,\r\n\t\t\tc: c,\r\n\t\t\tnormal: new Vector3(),\r\n\t\t\tmaterialIndex: 0\r\n\t\t};\r\n\r\n\t\tTriangle.getNormal( _vA$1, _vB$1, _vC$1, face.normal );\r\n\r\n\t\tintersection.face = face;\r\n\r\n\t}\r\n\r\n\treturn intersection;\r\n\r\n}\r\n\r\nclass BoxGeometry extends BufferGeometry {\r\n\r\n\tconstructor( width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1 ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'BoxGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\twidth: width,\r\n\t\t\theight: height,\r\n\t\t\tdepth: depth,\r\n\t\t\twidthSegments: widthSegments,\r\n\t\t\theightSegments: heightSegments,\r\n\t\t\tdepthSegments: depthSegments\r\n\t\t};\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\t// segments\r\n\r\n\t\twidthSegments = Math.floor( widthSegments );\r\n\t\theightSegments = Math.floor( heightSegments );\r\n\t\tdepthSegments = Math.floor( depthSegments );\r\n\r\n\t\t// buffers\r\n\r\n\t\tconst indices = [];\r\n\t\tconst vertices = [];\r\n\t\tconst normals = [];\r\n\t\tconst uvs = [];\r\n\r\n\t\t// helper variables\r\n\r\n\t\tlet numberOfVertices = 0;\r\n\t\tlet groupStart = 0;\r\n\r\n\t\t// build each side of the box geometry\r\n\r\n\t\tbuildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px\r\n\t\tbuildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx\r\n\t\tbuildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py\r\n\t\tbuildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny\r\n\t\tbuildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz\r\n\t\tbuildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz\r\n\r\n\t\t// build geometry\r\n\r\n\t\tthis.setIndex( indices );\r\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\r\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\r\n\r\n\t\tfunction buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) {\r\n\r\n\t\t\tconst segmentWidth = width / gridX;\r\n\t\t\tconst segmentHeight = height / gridY;\r\n\r\n\t\t\tconst widthHalf = width / 2;\r\n\t\t\tconst heightHalf = height / 2;\r\n\t\t\tconst depthHalf = depth / 2;\r\n\r\n\t\t\tconst gridX1 = gridX + 1;\r\n\t\t\tconst gridY1 = gridY + 1;\r\n\r\n\t\t\tlet vertexCounter = 0;\r\n\t\t\tlet groupCount = 0;\r\n\r\n\t\t\tconst vector = new Vector3();\r\n\r\n\t\t\t// generate vertices, normals and uvs\r\n\r\n\t\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\r\n\r\n\t\t\t\tconst y = iy * segmentHeight - heightHalf;\r\n\r\n\t\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\r\n\r\n\t\t\t\t\tconst x = ix * segmentWidth - widthHalf;\r\n\r\n\t\t\t\t\t// set values to correct vector component\r\n\r\n\t\t\t\t\tvector[ u ] = x * udir;\r\n\t\t\t\t\tvector[ v ] = y * vdir;\r\n\t\t\t\t\tvector[ w ] = depthHalf;\r\n\r\n\t\t\t\t\t// now apply vector to vertex buffer\r\n\r\n\t\t\t\t\tvertices.push( vector.x, vector.y, vector.z );\r\n\r\n\t\t\t\t\t// set values to correct vector component\r\n\r\n\t\t\t\t\tvector[ u ] = 0;\r\n\t\t\t\t\tvector[ v ] = 0;\r\n\t\t\t\t\tvector[ w ] = depth > 0 ? 1 : - 1;\r\n\r\n\t\t\t\t\t// now apply vector to normal buffer\r\n\r\n\t\t\t\t\tnormals.push( vector.x, vector.y, vector.z );\r\n\r\n\t\t\t\t\t// uvs\r\n\r\n\t\t\t\t\tuvs.push( ix / gridX );\r\n\t\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\r\n\r\n\t\t\t\t\t// counters\r\n\r\n\t\t\t\t\tvertexCounter += 1;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// indices\r\n\r\n\t\t\t// 1. you need three indices to draw a single face\r\n\t\t\t// 2. a single segment consists of two faces\r\n\t\t\t// 3. so we need to generate six (2*3) indices per segment\r\n\r\n\t\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\r\n\r\n\t\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\r\n\r\n\t\t\t\t\tconst a = numberOfVertices + ix + gridX1 * iy;\r\n\t\t\t\t\tconst b = numberOfVertices + ix + gridX1 * ( iy + 1 );\r\n\t\t\t\t\tconst c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );\r\n\t\t\t\t\tconst d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;\r\n\r\n\t\t\t\t\t// faces\r\n\r\n\t\t\t\t\tindices.push( a, b, d );\r\n\t\t\t\t\tindices.push( b, c, d );\r\n\r\n\t\t\t\t\t// increase counter\r\n\r\n\t\t\t\t\tgroupCount += 6;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// add a group to the geometry. this will ensure multi material support\r\n\r\n\t\t\tscope.addGroup( groupStart, groupCount, materialIndex );\r\n\r\n\t\t\t// calculate new start value for groups\r\n\r\n\t\t\tgroupStart += groupCount;\r\n\r\n\t\t\t// update total number of vertices\r\n\r\n\t\t\tnumberOfVertices += vertexCounter;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.parameters = Object.assign( {}, source.parameters );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data ) {\r\n\r\n\t\treturn new BoxGeometry( data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments );\r\n\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Uniform Utilities\r\n */\r\n\r\nfunction cloneUniforms( src ) {\r\n\r\n\tconst dst = {};\r\n\r\n\tfor ( const u in src ) {\r\n\r\n\t\tdst[ u ] = {};\r\n\r\n\t\tfor ( const p in src[ u ] ) {\r\n\r\n\t\t\tconst property = src[ u ][ p ];\r\n\r\n\t\t\tif ( property && ( property.isColor ||\r\n\t\t\t\tproperty.isMatrix3 || property.isMatrix4 ||\r\n\t\t\t\tproperty.isVector2 || property.isVector3 || property.isVector4 ||\r\n\t\t\t\tproperty.isTexture || property.isQuaternion ) ) {\r\n\r\n\t\t\t\tif ( property.isRenderTargetTexture ) {\r\n\r\n\t\t\t\t\tconsole.warn( 'UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().' );\r\n\t\t\t\t\tdst[ u ][ p ] = null;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tdst[ u ][ p ] = property.clone();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( Array.isArray( property ) ) {\r\n\r\n\t\t\t\tdst[ u ][ p ] = property.slice();\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tdst[ u ][ p ] = property;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn dst;\r\n\r\n}\r\n\r\nfunction mergeUniforms( uniforms ) {\r\n\r\n\tconst merged = {};\r\n\r\n\tfor ( let u = 0; u < uniforms.length; u ++ ) {\r\n\r\n\t\tconst tmp = cloneUniforms( uniforms[ u ] );\r\n\r\n\t\tfor ( const p in tmp ) {\r\n\r\n\t\t\tmerged[ p ] = tmp[ p ];\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn merged;\r\n\r\n}\r\n\r\nfunction cloneUniformsGroups( src ) {\r\n\r\n\tconst dst = [];\r\n\r\n\tfor ( let u = 0; u < src.length; u ++ ) {\r\n\r\n\t\tdst.push( src[ u ].clone() );\r\n\r\n\t}\r\n\r\n\treturn dst;\r\n\r\n}\r\n\r\nfunction getUnlitUniformColorSpace( renderer ) {\r\n\r\n\tconst currentRenderTarget = renderer.getRenderTarget();\r\n\r\n\tif ( currentRenderTarget === null ) {\r\n\r\n\t\t// https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398\r\n\t\treturn renderer.outputColorSpace;\r\n\r\n\t}\r\n\r\n\t// https://github.com/mrdoob/three.js/issues/27868\r\n\tif ( currentRenderTarget.isXRRenderTarget === true ) {\r\n\r\n\t\treturn currentRenderTarget.texture.colorSpace;\r\n\r\n\t}\r\n\r\n\treturn ColorManagement.workingColorSpace;\r\n\r\n}\r\n\r\n// Legacy\r\n\r\nconst UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms };\r\n\r\nvar default_vertex = \"void main() {\\n\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\n}\";\r\n\r\nvar default_fragment = \"void main() {\\n\\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\\n}\";\r\n\r\nclass ShaderMaterial extends Material {\r\n\r\n\tconstructor( parameters ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isShaderMaterial = true;\r\n\r\n\t\tthis.type = 'ShaderMaterial';\r\n\r\n\t\tthis.defines = {};\r\n\t\tthis.uniforms = {};\r\n\t\tthis.uniformsGroups = [];\r\n\r\n\t\tthis.vertexShader = default_vertex;\r\n\t\tthis.fragmentShader = default_fragment;\r\n\r\n\t\tthis.linewidth = 1;\r\n\r\n\t\tthis.wireframe = false;\r\n\t\tthis.wireframeLinewidth = 1;\r\n\r\n\t\tthis.fog = false; // set to use scene fog\r\n\t\tthis.lights = false; // set to use scene lights\r\n\t\tthis.clipping = false; // set to use user-defined clipping planes\r\n\r\n\t\tthis.forceSinglePass = true;\r\n\r\n\t\tthis.extensions = {\r\n\t\t\tclipCullDistance: false, // set to use vertex shader clipping\r\n\t\t\tmultiDraw: false // set to use vertex shader multi_draw / enable gl_DrawID\r\n\t\t};\r\n\r\n\t\t// When rendered geometry doesn't include these attributes but the material does,\r\n\t\t// use these default values in WebGL. This avoids errors when buffer data is missing.\r\n\t\tthis.defaultAttributeValues = {\r\n\t\t\t'color': [ 1, 1, 1 ],\r\n\t\t\t'uv': [ 0, 0 ],\r\n\t\t\t'uv1': [ 0, 0 ]\r\n\t\t};\r\n\r\n\t\tthis.index0AttributeName = undefined;\r\n\t\tthis.uniformsNeedUpdate = false;\r\n\r\n\t\tthis.glslVersion = null;\r\n\r\n\t\tif ( parameters !== undefined ) {\r\n\r\n\t\t\tthis.setValues( parameters );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.fragmentShader = source.fragmentShader;\r\n\t\tthis.vertexShader = source.vertexShader;\r\n\r\n\t\tthis.uniforms = cloneUniforms( source.uniforms );\r\n\t\tthis.uniformsGroups = cloneUniformsGroups( source.uniformsGroups );\r\n\r\n\t\tthis.defines = Object.assign( {}, source.defines );\r\n\r\n\t\tthis.wireframe = source.wireframe;\r\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\r\n\r\n\t\tthis.fog = source.fog;\r\n\t\tthis.lights = source.lights;\r\n\t\tthis.clipping = source.clipping;\r\n\r\n\t\tthis.extensions = Object.assign( {}, source.extensions );\r\n\r\n\t\tthis.glslVersion = source.glslVersion;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON( meta ) {\r\n\r\n\t\tconst data = super.toJSON( meta );\r\n\r\n\t\tdata.glslVersion = this.glslVersion;\r\n\t\tdata.uniforms = {};\r\n\r\n\t\tfor ( const name in this.uniforms ) {\r\n\r\n\t\t\tconst uniform = this.uniforms[ name ];\r\n\t\t\tconst value = uniform.value;\r\n\r\n\t\t\tif ( value && value.isTexture ) {\r\n\r\n\t\t\t\tdata.uniforms[ name ] = {\r\n\t\t\t\t\ttype: 't',\r\n\t\t\t\t\tvalue: value.toJSON( meta ).uuid\r\n\t\t\t\t};\r\n\r\n\t\t\t} else if ( value && value.isColor ) {\r\n\r\n\t\t\t\tdata.uniforms[ name ] = {\r\n\t\t\t\t\ttype: 'c',\r\n\t\t\t\t\tvalue: value.getHex()\r\n\t\t\t\t};\r\n\r\n\t\t\t} else if ( value && value.isVector2 ) {\r\n\r\n\t\t\t\tdata.uniforms[ name ] = {\r\n\t\t\t\t\ttype: 'v2',\r\n\t\t\t\t\tvalue: value.toArray()\r\n\t\t\t\t};\r\n\r\n\t\t\t} else if ( value && value.isVector3 ) {\r\n\r\n\t\t\t\tdata.uniforms[ name ] = {\r\n\t\t\t\t\ttype: 'v3',\r\n\t\t\t\t\tvalue: value.toArray()\r\n\t\t\t\t};\r\n\r\n\t\t\t} else if ( value && value.isVector4 ) {\r\n\r\n\t\t\t\tdata.uniforms[ name ] = {\r\n\t\t\t\t\ttype: 'v4',\r\n\t\t\t\t\tvalue: value.toArray()\r\n\t\t\t\t};\r\n\r\n\t\t\t} else if ( value && value.isMatrix3 ) {\r\n\r\n\t\t\t\tdata.uniforms[ name ] = {\r\n\t\t\t\t\ttype: 'm3',\r\n\t\t\t\t\tvalue: value.toArray()\r\n\t\t\t\t};\r\n\r\n\t\t\t} else if ( value && value.isMatrix4 ) {\r\n\r\n\t\t\t\tdata.uniforms[ name ] = {\r\n\t\t\t\t\ttype: 'm4',\r\n\t\t\t\t\tvalue: value.toArray()\r\n\t\t\t\t};\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tdata.uniforms[ name ] = {\r\n\t\t\t\t\tvalue: value\r\n\t\t\t\t};\r\n\r\n\t\t\t\t// note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( Object.keys( this.defines ).length > 0 ) data.defines = this.defines;\r\n\r\n\t\tdata.vertexShader = this.vertexShader;\r\n\t\tdata.fragmentShader = this.fragmentShader;\r\n\r\n\t\tdata.lights = this.lights;\r\n\t\tdata.clipping = this.clipping;\r\n\r\n\t\tconst extensions = {};\r\n\r\n\t\tfor ( const key in this.extensions ) {\r\n\r\n\t\t\tif ( this.extensions[ key ] === true ) extensions[ key ] = true;\r\n\r\n\t\t}\r\n\r\n\t\tif ( Object.keys( extensions ).length > 0 ) data.extensions = extensions;\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Camera extends Object3D {\r\n\r\n\tconstructor() {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isCamera = true;\r\n\r\n\t\tthis.type = 'Camera';\r\n\r\n\t\tthis.matrixWorldInverse = new Matrix4();\r\n\r\n\t\tthis.projectionMatrix = new Matrix4();\r\n\t\tthis.projectionMatrixInverse = new Matrix4();\r\n\r\n\t\tthis.coordinateSystem = WebGLCoordinateSystem;\r\n\r\n\t}\r\n\r\n\tcopy( source, recursive ) {\r\n\r\n\t\tsuper.copy( source, recursive );\r\n\r\n\t\tthis.matrixWorldInverse.copy( source.matrixWorldInverse );\r\n\r\n\t\tthis.projectionMatrix.copy( source.projectionMatrix );\r\n\t\tthis.projectionMatrixInverse.copy( source.projectionMatrixInverse );\r\n\r\n\t\tthis.coordinateSystem = source.coordinateSystem;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetWorldDirection( target ) {\r\n\r\n\t\treturn super.getWorldDirection( target ).negate();\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( force ) {\r\n\r\n\t\tsuper.updateMatrixWorld( force );\r\n\r\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\r\n\r\n\t}\r\n\r\n\tupdateWorldMatrix( updateParents, updateChildren ) {\r\n\r\n\t\tsuper.updateWorldMatrix( updateParents, updateChildren );\r\n\r\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _v3$1 = /*@__PURE__*/ new Vector3();\r\nconst _minTarget = /*@__PURE__*/ new Vector2();\r\nconst _maxTarget = /*@__PURE__*/ new Vector2();\r\n\r\n\r\nclass PerspectiveCamera extends Camera {\r\n\r\n\tconstructor( fov = 50, aspect = 1, near = 0.1, far = 2000 ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isPerspectiveCamera = true;\r\n\r\n\t\tthis.type = 'PerspectiveCamera';\r\n\r\n\t\tthis.fov = fov;\r\n\t\tthis.zoom = 1;\r\n\r\n\t\tthis.near = near;\r\n\t\tthis.far = far;\r\n\t\tthis.focus = 10;\r\n\r\n\t\tthis.aspect = aspect;\r\n\t\tthis.view = null;\r\n\r\n\t\tthis.filmGauge = 35;\t// width of the film (default in millimeters)\r\n\t\tthis.filmOffset = 0;\t// horizontal film offset (same unit as gauge)\r\n\r\n\t\tthis.updateProjectionMatrix();\r\n\r\n\t}\r\n\r\n\tcopy( source, recursive ) {\r\n\r\n\t\tsuper.copy( source, recursive );\r\n\r\n\t\tthis.fov = source.fov;\r\n\t\tthis.zoom = source.zoom;\r\n\r\n\t\tthis.near = source.near;\r\n\t\tthis.far = source.far;\r\n\t\tthis.focus = source.focus;\r\n\r\n\t\tthis.aspect = source.aspect;\r\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\r\n\r\n\t\tthis.filmGauge = source.filmGauge;\r\n\t\tthis.filmOffset = source.filmOffset;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the FOV by focal length in respect to the current .filmGauge.\r\n\t *\r\n\t * The default film gauge is 35, so that the focal length can be specified for\r\n\t * a 35mm (full frame) camera.\r\n\t *\r\n\t * Values for focal length and film gauge must have the same unit.\r\n\t */\r\n\tsetFocalLength( focalLength ) {\r\n\r\n\t\t/** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */\r\n\t\tconst vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;\r\n\r\n\t\tthis.fov = RAD2DEG * 2 * Math.atan( vExtentSlope );\r\n\t\tthis.updateProjectionMatrix();\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Calculates the focal length from the current .fov and .filmGauge.\r\n\t */\r\n\tgetFocalLength() {\r\n\r\n\t\tconst vExtentSlope = Math.tan( DEG2RAD * 0.5 * this.fov );\r\n\r\n\t\treturn 0.5 * this.getFilmHeight() / vExtentSlope;\r\n\r\n\t}\r\n\r\n\tgetEffectiveFOV() {\r\n\r\n\t\treturn RAD2DEG * 2 * Math.atan(\r\n\t\t\tMath.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom );\r\n\r\n\t}\r\n\r\n\tgetFilmWidth() {\r\n\r\n\t\t// film not completely covered in portrait format (aspect < 1)\r\n\t\treturn this.filmGauge * Math.min( this.aspect, 1 );\r\n\r\n\t}\r\n\r\n\tgetFilmHeight() {\r\n\r\n\t\t// film not completely covered in landscape format (aspect > 1)\r\n\t\treturn this.filmGauge / Math.max( this.aspect, 1 );\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction.\r\n\t * Sets minTarget and maxTarget to the coordinates of the lower-left and upper-right corners of the view rectangle.\r\n\t */\r\n\tgetViewBounds( distance, minTarget, maxTarget ) {\r\n\r\n\t\t_v3$1.set( - 1, - 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );\r\n\r\n\t\tminTarget.set( _v3$1.x, _v3$1.y ).multiplyScalar( - distance / _v3$1.z );\r\n\r\n\t\t_v3$1.set( 1, 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );\r\n\r\n\t\tmaxTarget.set( _v3$1.x, _v3$1.y ).multiplyScalar( - distance / _v3$1.z );\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.\r\n\t * Copies the result into the target Vector2, where x is width and y is height.\r\n\t */\r\n\tgetViewSize( distance, target ) {\r\n\r\n\t\tthis.getViewBounds( distance, _minTarget, _maxTarget );\r\n\r\n\t\treturn target.subVectors( _maxTarget, _minTarget );\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Sets an offset in a larger frustum. This is useful for multi-window or\r\n\t * multi-monitor/multi-machine setups.\r\n\t *\r\n\t * For example, if you have 3x2 monitors and each monitor is 1920x1080 and\r\n\t * the monitors are in grid like this\r\n\t *\r\n\t * +---+---+---+\r\n\t * | A | B | C |\r\n\t * +---+---+---+\r\n\t * | D | E | F |\r\n\t * +---+---+---+\r\n\t *\r\n\t * then for each monitor you would call it like this\r\n\t *\r\n\t * const w = 1920;\r\n\t * const h = 1080;\r\n\t * const fullWidth = w * 3;\r\n\t * const fullHeight = h * 2;\r\n\t *\r\n\t * --A--\r\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );\r\n\t * --B--\r\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );\r\n\t * --C--\r\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );\r\n\t * --D--\r\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );\r\n\t * --E--\r\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );\r\n\t * --F--\r\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );\r\n\t *\r\n\t * Note there is no reason monitors have to be the same size or in a grid.\r\n\t */\r\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\r\n\r\n\t\tthis.aspect = fullWidth / fullHeight;\r\n\r\n\t\tif ( this.view === null ) {\r\n\r\n\t\t\tthis.view = {\r\n\t\t\t\tenabled: true,\r\n\t\t\t\tfullWidth: 1,\r\n\t\t\t\tfullHeight: 1,\r\n\t\t\t\toffsetX: 0,\r\n\t\t\t\toffsetY: 0,\r\n\t\t\t\twidth: 1,\r\n\t\t\t\theight: 1\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t\tthis.view.enabled = true;\r\n\t\tthis.view.fullWidth = fullWidth;\r\n\t\tthis.view.fullHeight = fullHeight;\r\n\t\tthis.view.offsetX = x;\r\n\t\tthis.view.offsetY = y;\r\n\t\tthis.view.width = width;\r\n\t\tthis.view.height = height;\r\n\r\n\t\tthis.updateProjectionMatrix();\r\n\r\n\t}\r\n\r\n\tclearViewOffset() {\r\n\r\n\t\tif ( this.view !== null ) {\r\n\r\n\t\t\tthis.view.enabled = false;\r\n\r\n\t\t}\r\n\r\n\t\tthis.updateProjectionMatrix();\r\n\r\n\t}\r\n\r\n\tupdateProjectionMatrix() {\r\n\r\n\t\tconst near = this.near;\r\n\t\tlet top = near * Math.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom;\r\n\t\tlet height = 2 * top;\r\n\t\tlet width = this.aspect * height;\r\n\t\tlet left = - 0.5 * width;\r\n\t\tconst view = this.view;\r\n\r\n\t\tif ( this.view !== null && this.view.enabled ) {\r\n\r\n\t\t\tconst fullWidth = view.fullWidth,\r\n\t\t\t\tfullHeight = view.fullHeight;\r\n\r\n\t\t\tleft += view.offsetX * width / fullWidth;\r\n\t\t\ttop -= view.offsetY * height / fullHeight;\r\n\t\t\twidth *= view.width / fullWidth;\r\n\t\t\theight *= view.height / fullHeight;\r\n\r\n\t\t}\r\n\r\n\t\tconst skew = this.filmOffset;\r\n\t\tif ( skew !== 0 ) left += near * skew / this.getFilmWidth();\r\n\r\n\t\tthis.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far, this.coordinateSystem );\r\n\r\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\r\n\r\n\t}\r\n\r\n\ttoJSON( meta ) {\r\n\r\n\t\tconst data = super.toJSON( meta );\r\n\r\n\t\tdata.object.fov = this.fov;\r\n\t\tdata.object.zoom = this.zoom;\r\n\r\n\t\tdata.object.near = this.near;\r\n\t\tdata.object.far = this.far;\r\n\t\tdata.object.focus = this.focus;\r\n\r\n\t\tdata.object.aspect = this.aspect;\r\n\r\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\r\n\r\n\t\tdata.object.filmGauge = this.filmGauge;\r\n\t\tdata.object.filmOffset = this.filmOffset;\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst fov = - 90; // negative fov is not an error\r\nconst aspect = 1;\r\n\r\nclass CubeCamera extends Object3D {\r\n\r\n\tconstructor( near, far, renderTarget ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'CubeCamera';\r\n\r\n\t\tthis.renderTarget = renderTarget;\r\n\t\tthis.coordinateSystem = null;\r\n\t\tthis.activeMipmapLevel = 0;\r\n\r\n\t\tconst cameraPX = new PerspectiveCamera( fov, aspect, near, far );\r\n\t\tcameraPX.layers = this.layers;\r\n\t\tthis.add( cameraPX );\r\n\r\n\t\tconst cameraNX = new PerspectiveCamera( fov, aspect, near, far );\r\n\t\tcameraNX.layers = this.layers;\r\n\t\tthis.add( cameraNX );\r\n\r\n\t\tconst cameraPY = new PerspectiveCamera( fov, aspect, near, far );\r\n\t\tcameraPY.layers = this.layers;\r\n\t\tthis.add( cameraPY );\r\n\r\n\t\tconst cameraNY = new PerspectiveCamera( fov, aspect, near, far );\r\n\t\tcameraNY.layers = this.layers;\r\n\t\tthis.add( cameraNY );\r\n\r\n\t\tconst cameraPZ = new PerspectiveCamera( fov, aspect, near, far );\r\n\t\tcameraPZ.layers = this.layers;\r\n\t\tthis.add( cameraPZ );\r\n\r\n\t\tconst cameraNZ = new PerspectiveCamera( fov, aspect, near, far );\r\n\t\tcameraNZ.layers = this.layers;\r\n\t\tthis.add( cameraNZ );\r\n\r\n\t}\r\n\r\n\tupdateCoordinateSystem() {\r\n\r\n\t\tconst coordinateSystem = this.coordinateSystem;\r\n\r\n\t\tconst cameras = this.children.concat();\r\n\r\n\t\tconst [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = cameras;\r\n\r\n\t\tfor ( const camera of cameras ) this.remove( camera );\r\n\r\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\r\n\r\n\t\t\tcameraPX.up.set( 0, 1, 0 );\r\n\t\t\tcameraPX.lookAt( 1, 0, 0 );\r\n\r\n\t\t\tcameraNX.up.set( 0, 1, 0 );\r\n\t\t\tcameraNX.lookAt( - 1, 0, 0 );\r\n\r\n\t\t\tcameraPY.up.set( 0, 0, - 1 );\r\n\t\t\tcameraPY.lookAt( 0, 1, 0 );\r\n\r\n\t\t\tcameraNY.up.set( 0, 0, 1 );\r\n\t\t\tcameraNY.lookAt( 0, - 1, 0 );\r\n\r\n\t\t\tcameraPZ.up.set( 0, 1, 0 );\r\n\t\t\tcameraPZ.lookAt( 0, 0, 1 );\r\n\r\n\t\t\tcameraNZ.up.set( 0, 1, 0 );\r\n\t\t\tcameraNZ.lookAt( 0, 0, - 1 );\r\n\r\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\r\n\r\n\t\t\tcameraPX.up.set( 0, - 1, 0 );\r\n\t\t\tcameraPX.lookAt( - 1, 0, 0 );\r\n\r\n\t\t\tcameraNX.up.set( 0, - 1, 0 );\r\n\t\t\tcameraNX.lookAt( 1, 0, 0 );\r\n\r\n\t\t\tcameraPY.up.set( 0, 0, 1 );\r\n\t\t\tcameraPY.lookAt( 0, 1, 0 );\r\n\r\n\t\t\tcameraNY.up.set( 0, 0, - 1 );\r\n\t\t\tcameraNY.lookAt( 0, - 1, 0 );\r\n\r\n\t\t\tcameraPZ.up.set( 0, - 1, 0 );\r\n\t\t\tcameraPZ.lookAt( 0, 0, 1 );\r\n\r\n\t\t\tcameraNZ.up.set( 0, - 1, 0 );\r\n\t\t\tcameraNZ.lookAt( 0, 0, - 1 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthrow new Error( 'THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: ' + coordinateSystem );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( const camera of cameras ) {\r\n\r\n\t\t\tthis.add( camera );\r\n\r\n\t\t\tcamera.updateMatrixWorld();\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdate( renderer, scene ) {\r\n\r\n\t\tif ( this.parent === null ) this.updateMatrixWorld();\r\n\r\n\t\tconst { renderTarget, activeMipmapLevel } = this;\r\n\r\n\t\tif ( this.coordinateSystem !== renderer.coordinateSystem ) {\r\n\r\n\t\t\tthis.coordinateSystem = renderer.coordinateSystem;\r\n\r\n\t\t\tthis.updateCoordinateSystem();\r\n\r\n\t\t}\r\n\r\n\t\tconst [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = this.children;\r\n\r\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\r\n\t\tconst currentActiveCubeFace = renderer.getActiveCubeFace();\r\n\t\tconst currentActiveMipmapLevel = renderer.getActiveMipmapLevel();\r\n\r\n\t\tconst currentXrEnabled = renderer.xr.enabled;\r\n\r\n\t\trenderer.xr.enabled = false;\r\n\r\n\t\tconst generateMipmaps = renderTarget.texture.generateMipmaps;\r\n\r\n\t\trenderTarget.texture.generateMipmaps = false;\r\n\r\n\t\trenderer.setRenderTarget( renderTarget, 0, activeMipmapLevel );\r\n\t\trenderer.render( scene, cameraPX );\r\n\r\n\t\trenderer.setRenderTarget( renderTarget, 1, activeMipmapLevel );\r\n\t\trenderer.render( scene, cameraNX );\r\n\r\n\t\trenderer.setRenderTarget( renderTarget, 2, activeMipmapLevel );\r\n\t\trenderer.render( scene, cameraPY );\r\n\r\n\t\trenderer.setRenderTarget( renderTarget, 3, activeMipmapLevel );\r\n\t\trenderer.render( scene, cameraNY );\r\n\r\n\t\trenderer.setRenderTarget( renderTarget, 4, activeMipmapLevel );\r\n\t\trenderer.render( scene, cameraPZ );\r\n\r\n\t\t// mipmaps are generated during the last call of render()\r\n\t\t// at this point, all sides of the cube render target are defined\r\n\r\n\t\trenderTarget.texture.generateMipmaps = generateMipmaps;\r\n\r\n\t\trenderer.setRenderTarget( renderTarget, 5, activeMipmapLevel );\r\n\t\trenderer.render( scene, cameraNZ );\r\n\r\n\t\trenderer.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );\r\n\r\n\t\trenderer.xr.enabled = currentXrEnabled;\r\n\r\n\t\trenderTarget.texture.needsPMREMUpdate = true;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass CubeTexture extends Texture {\r\n\r\n\tconstructor( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace ) {\r\n\r\n\t\timages = images !== undefined ? images : [];\r\n\t\tmapping = mapping !== undefined ? mapping : CubeReflectionMapping;\r\n\r\n\t\tsuper( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\r\n\r\n\t\tthis.isCubeTexture = true;\r\n\r\n\t\tthis.flipY = false;\r\n\r\n\t}\r\n\r\n\tget images() {\r\n\r\n\t\treturn this.image;\r\n\r\n\t}\r\n\r\n\tset images( value ) {\r\n\r\n\t\tthis.image = value;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass WebGLCubeRenderTarget extends WebGLRenderTarget {\r\n\r\n\tconstructor( size = 1, options = {} ) {\r\n\r\n\t\tsuper( size, size, options );\r\n\r\n\t\tthis.isWebGLCubeRenderTarget = true;\r\n\r\n\t\tconst image = { width: size, height: size, depth: 1 };\r\n\t\tconst images = [ image, image, image, image, image, image ];\r\n\r\n\t\tthis.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );\r\n\r\n\t\t// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)\r\n\t\t// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,\r\n\t\t// in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.\r\n\r\n\t\t// three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped\r\n\t\t// and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture\r\n\t\t// as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).\r\n\r\n\t\tthis.texture.isRenderTargetTexture = true;\r\n\r\n\t\tthis.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\r\n\t\tthis.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;\r\n\r\n\t}\r\n\r\n\tfromEquirectangularTexture( renderer, texture ) {\r\n\r\n\t\tthis.texture.type = texture.type;\r\n\t\tthis.texture.colorSpace = texture.colorSpace;\r\n\r\n\t\tthis.texture.generateMipmaps = texture.generateMipmaps;\r\n\t\tthis.texture.minFilter = texture.minFilter;\r\n\t\tthis.texture.magFilter = texture.magFilter;\r\n\r\n\t\tconst shader = {\r\n\r\n\t\t\tuniforms: {\r\n\t\t\t\ttEquirect: { value: null },\r\n\t\t\t},\r\n\r\n\t\t\tvertexShader: /* glsl */`\r\n\r\n\t\t\t\tvarying vec3 vWorldDirection;\r\n\r\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\r\n\r\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvoid main() {\r\n\r\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\r\n\r\n\t\t\t\t\t#include \r\n\t\t\t\t\t#include \r\n\r\n\t\t\t\t}\r\n\t\t\t`,\r\n\r\n\t\t\tfragmentShader: /* glsl */`\r\n\r\n\t\t\t\tuniform sampler2D tEquirect;\r\n\r\n\t\t\t\tvarying vec3 vWorldDirection;\r\n\r\n\t\t\t\t#include \r\n\r\n\t\t\t\tvoid main() {\r\n\r\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\r\n\r\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\r\n\r\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\r\n\r\n\t\t\t\t}\r\n\t\t\t`\r\n\t\t};\r\n\r\n\t\tconst geometry = new BoxGeometry( 5, 5, 5 );\r\n\r\n\t\tconst material = new ShaderMaterial( {\r\n\r\n\t\t\tname: 'CubemapFromEquirect',\r\n\r\n\t\t\tuniforms: cloneUniforms( shader.uniforms ),\r\n\t\t\tvertexShader: shader.vertexShader,\r\n\t\t\tfragmentShader: shader.fragmentShader,\r\n\t\t\tside: BackSide,\r\n\t\t\tblending: NoBlending\r\n\r\n\t\t} );\r\n\r\n\t\tmaterial.uniforms.tEquirect.value = texture;\r\n\r\n\t\tconst mesh = new Mesh( geometry, material );\r\n\r\n\t\tconst currentMinFilter = texture.minFilter;\r\n\r\n\t\t// Avoid blurred poles\r\n\t\tif ( texture.minFilter === LinearMipmapLinearFilter ) texture.minFilter = LinearFilter;\r\n\r\n\t\tconst camera = new CubeCamera( 1, 10, this );\r\n\t\tcamera.update( renderer, mesh );\r\n\r\n\t\ttexture.minFilter = currentMinFilter;\r\n\r\n\t\tmesh.geometry.dispose();\r\n\t\tmesh.material.dispose();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclear( renderer, color, depth, stencil ) {\r\n\r\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\r\n\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\trenderer.setRenderTarget( this, i );\r\n\r\n\t\t\trenderer.clear( color, depth, stencil );\r\n\r\n\t\t}\r\n\r\n\t\trenderer.setRenderTarget( currentRenderTarget );\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _vector1 = /*@__PURE__*/ new Vector3();\r\nconst _vector2 = /*@__PURE__*/ new Vector3();\r\nconst _normalMatrix = /*@__PURE__*/ new Matrix3();\r\n\r\nclass Plane {\r\n\r\n\tconstructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) {\r\n\r\n\t\tthis.isPlane = true;\r\n\r\n\t\t// normal is assumed to be normalized\r\n\r\n\t\tthis.normal = normal;\r\n\t\tthis.constant = constant;\r\n\r\n\t}\r\n\r\n\tset( normal, constant ) {\r\n\r\n\t\tthis.normal.copy( normal );\r\n\t\tthis.constant = constant;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetComponents( x, y, z, w ) {\r\n\r\n\t\tthis.normal.set( x, y, z );\r\n\t\tthis.constant = w;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromNormalAndCoplanarPoint( normal, point ) {\r\n\r\n\t\tthis.normal.copy( normal );\r\n\t\tthis.constant = - point.dot( this.normal );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromCoplanarPoints( a, b, c ) {\r\n\r\n\t\tconst normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();\r\n\r\n\t\t// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?\r\n\r\n\t\tthis.setFromNormalAndCoplanarPoint( normal, a );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcopy( plane ) {\r\n\r\n\t\tthis.normal.copy( plane.normal );\r\n\t\tthis.constant = plane.constant;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tnormalize() {\r\n\r\n\t\t// Note: will lead to a divide by zero if the plane is invalid.\r\n\r\n\t\tconst inverseNormalLength = 1.0 / this.normal.length();\r\n\t\tthis.normal.multiplyScalar( inverseNormalLength );\r\n\t\tthis.constant *= inverseNormalLength;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tnegate() {\r\n\r\n\t\tthis.constant *= - 1;\r\n\t\tthis.normal.negate();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdistanceToPoint( point ) {\r\n\r\n\t\treturn this.normal.dot( point ) + this.constant;\r\n\r\n\t}\r\n\r\n\tdistanceToSphere( sphere ) {\r\n\r\n\t\treturn this.distanceToPoint( sphere.center ) - sphere.radius;\r\n\r\n\t}\r\n\r\n\tprojectPoint( point, target ) {\r\n\r\n\t\treturn target.copy( point ).addScaledVector( this.normal, - this.distanceToPoint( point ) );\r\n\r\n\t}\r\n\r\n\tintersectLine( line, target ) {\r\n\r\n\t\tconst direction = line.delta( _vector1 );\r\n\r\n\t\tconst denominator = this.normal.dot( direction );\r\n\r\n\t\tif ( denominator === 0 ) {\r\n\r\n\t\t\t// line is coplanar, return origin\r\n\t\t\tif ( this.distanceToPoint( line.start ) === 0 ) {\r\n\r\n\t\t\t\treturn target.copy( line.start );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Unsure if this is the correct method to handle this case.\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\tconst t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;\r\n\r\n\t\tif ( t < 0 || t > 1 ) {\r\n\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\treturn target.copy( line.start ).addScaledVector( direction, t );\r\n\r\n\t}\r\n\r\n\tintersectsLine( line ) {\r\n\r\n\t\t// Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.\r\n\r\n\t\tconst startSign = this.distanceToPoint( line.start );\r\n\t\tconst endSign = this.distanceToPoint( line.end );\r\n\r\n\t\treturn ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );\r\n\r\n\t}\r\n\r\n\tintersectsBox( box ) {\r\n\r\n\t\treturn box.intersectsPlane( this );\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\treturn sphere.intersectsPlane( this );\r\n\r\n\t}\r\n\r\n\tcoplanarPoint( target ) {\r\n\r\n\t\treturn target.copy( this.normal ).multiplyScalar( - this.constant );\r\n\r\n\t}\r\n\r\n\tapplyMatrix4( matrix, optionalNormalMatrix ) {\r\n\r\n\t\tconst normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );\r\n\r\n\t\tconst referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );\r\n\r\n\t\tconst normal = this.normal.applyMatrix3( normalMatrix ).normalize();\r\n\r\n\t\tthis.constant = - referencePoint.dot( normal );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttranslate( offset ) {\r\n\r\n\t\tthis.constant -= offset.dot( this.normal );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tequals( plane ) {\r\n\r\n\t\treturn plane.normal.equals( this.normal ) && ( plane.constant === this.constant );\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _sphere$5 = /*@__PURE__*/ new Sphere();\r\nconst _vector$7 = /*@__PURE__*/ new Vector3();\r\n\r\nclass Frustum {\r\n\r\n\tconstructor( p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane() ) {\r\n\r\n\t\tthis.planes = [ p0, p1, p2, p3, p4, p5 ];\r\n\r\n\t}\r\n\r\n\tset( p0, p1, p2, p3, p4, p5 ) {\r\n\r\n\t\tconst planes = this.planes;\r\n\r\n\t\tplanes[ 0 ].copy( p0 );\r\n\t\tplanes[ 1 ].copy( p1 );\r\n\t\tplanes[ 2 ].copy( p2 );\r\n\t\tplanes[ 3 ].copy( p3 );\r\n\t\tplanes[ 4 ].copy( p4 );\r\n\t\tplanes[ 5 ].copy( p5 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcopy( frustum ) {\r\n\r\n\t\tconst planes = this.planes;\r\n\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tplanes[ i ].copy( frustum.planes[ i ] );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromProjectionMatrix( m, coordinateSystem = WebGLCoordinateSystem ) {\r\n\r\n\t\tconst planes = this.planes;\r\n\t\tconst me = m.elements;\r\n\t\tconst me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ];\r\n\t\tconst me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ];\r\n\t\tconst me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ];\r\n\t\tconst me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ];\r\n\r\n\t\tplanes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize();\r\n\t\tplanes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize();\r\n\t\tplanes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();\r\n\t\tplanes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();\r\n\t\tplanes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize();\r\n\r\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\r\n\r\n\t\t\tplanes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();\r\n\r\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\r\n\r\n\t\t\tplanes[ 5 ].setComponents( me2, me6, me10, me14 ).normalize();\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthrow new Error( 'THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: ' + coordinateSystem );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tintersectsObject( object ) {\r\n\r\n\t\tif ( object.boundingSphere !== undefined ) {\r\n\r\n\t\t\tif ( object.boundingSphere === null ) object.computeBoundingSphere();\r\n\r\n\t\t\t_sphere$5.copy( object.boundingSphere ).applyMatrix4( object.matrixWorld );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst geometry = object.geometry;\r\n\r\n\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\r\n\r\n\t\t\t_sphere$5.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );\r\n\r\n\t\t}\r\n\r\n\t\treturn this.intersectsSphere( _sphere$5 );\r\n\r\n\t}\r\n\r\n\tintersectsSprite( sprite ) {\r\n\r\n\t\t_sphere$5.center.set( 0, 0, 0 );\r\n\t\t_sphere$5.radius = 0.7071067811865476;\r\n\t\t_sphere$5.applyMatrix4( sprite.matrixWorld );\r\n\r\n\t\treturn this.intersectsSphere( _sphere$5 );\r\n\r\n\t}\r\n\r\n\tintersectsSphere( sphere ) {\r\n\r\n\t\tconst planes = this.planes;\r\n\t\tconst center = sphere.center;\r\n\t\tconst negRadius = - sphere.radius;\r\n\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tconst distance = planes[ i ].distanceToPoint( center );\r\n\r\n\t\t\tif ( distance < negRadius ) {\r\n\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t}\r\n\r\n\tintersectsBox( box ) {\r\n\r\n\t\tconst planes = this.planes;\r\n\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tconst plane = planes[ i ];\r\n\r\n\t\t\t// corner at max distance\r\n\r\n\t\t\t_vector$7.x = plane.normal.x > 0 ? box.max.x : box.min.x;\r\n\t\t\t_vector$7.y = plane.normal.y > 0 ? box.max.y : box.min.y;\r\n\t\t\t_vector$7.z = plane.normal.z > 0 ? box.max.z : box.min.z;\r\n\r\n\t\t\tif ( plane.distanceToPoint( _vector$7 ) < 0 ) {\r\n\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t}\r\n\r\n\tcontainsPoint( point ) {\r\n\r\n\t\tconst planes = this.planes;\r\n\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tif ( planes[ i ].distanceToPoint( point ) < 0 ) {\r\n\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction WebGLAnimation() {\r\n\r\n\tlet context = null;\r\n\tlet isAnimating = false;\r\n\tlet animationLoop = null;\r\n\tlet requestId = null;\r\n\r\n\tfunction onAnimationFrame( time, frame ) {\r\n\r\n\t\tanimationLoop( time, frame );\r\n\r\n\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\r\n\r\n\t}\r\n\r\n\treturn {\r\n\r\n\t\tstart: function () {\r\n\r\n\t\t\tif ( isAnimating === true ) return;\r\n\t\t\tif ( animationLoop === null ) return;\r\n\r\n\t\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\r\n\r\n\t\t\tisAnimating = true;\r\n\r\n\t\t},\r\n\r\n\t\tstop: function () {\r\n\r\n\t\t\tcontext.cancelAnimationFrame( requestId );\r\n\r\n\t\t\tisAnimating = false;\r\n\r\n\t\t},\r\n\r\n\t\tsetAnimationLoop: function ( callback ) {\r\n\r\n\t\t\tanimationLoop = callback;\r\n\r\n\t\t},\r\n\r\n\t\tsetContext: function ( value ) {\r\n\r\n\t\t\tcontext = value;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n}\r\n\r\nfunction WebGLAttributes( gl ) {\r\n\r\n\tconst buffers = new WeakMap();\r\n\r\n\tfunction createBuffer( attribute, bufferType ) {\r\n\r\n\t\tconst array = attribute.array;\r\n\t\tconst usage = attribute.usage;\r\n\t\tconst size = array.byteLength;\r\n\r\n\t\tconst buffer = gl.createBuffer();\r\n\r\n\t\tgl.bindBuffer( bufferType, buffer );\r\n\t\tgl.bufferData( bufferType, array, usage );\r\n\r\n\t\tattribute.onUploadCallback();\r\n\r\n\t\tlet type;\r\n\r\n\t\tif ( array instanceof Float32Array ) {\r\n\r\n\t\t\ttype = gl.FLOAT;\r\n\r\n\t\t} else if ( array instanceof Uint16Array ) {\r\n\r\n\t\t\tif ( attribute.isFloat16BufferAttribute ) {\r\n\r\n\t\t\t\ttype = gl.HALF_FLOAT;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\ttype = gl.UNSIGNED_SHORT;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( array instanceof Int16Array ) {\r\n\r\n\t\t\ttype = gl.SHORT;\r\n\r\n\t\t} else if ( array instanceof Uint32Array ) {\r\n\r\n\t\t\ttype = gl.UNSIGNED_INT;\r\n\r\n\t\t} else if ( array instanceof Int32Array ) {\r\n\r\n\t\t\ttype = gl.INT;\r\n\r\n\t\t} else if ( array instanceof Int8Array ) {\r\n\r\n\t\t\ttype = gl.BYTE;\r\n\r\n\t\t} else if ( array instanceof Uint8Array ) {\r\n\r\n\t\t\ttype = gl.UNSIGNED_BYTE;\r\n\r\n\t\t} else if ( array instanceof Uint8ClampedArray ) {\r\n\r\n\t\t\ttype = gl.UNSIGNED_BYTE;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthrow new Error( 'THREE.WebGLAttributes: Unsupported buffer data format: ' + array );\r\n\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tbuffer: buffer,\r\n\t\t\ttype: type,\r\n\t\t\tbytesPerElement: array.BYTES_PER_ELEMENT,\r\n\t\t\tversion: attribute.version,\r\n\t\t\tsize: size\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tfunction updateBuffer( buffer, attribute, bufferType ) {\r\n\r\n\t\tconst array = attribute.array;\r\n\t\tconst updateRange = attribute._updateRange; // @deprecated, r159\r\n\t\tconst updateRanges = attribute.updateRanges;\r\n\r\n\t\tgl.bindBuffer( bufferType, buffer );\r\n\r\n\t\tif ( updateRange.count === - 1 && updateRanges.length === 0 ) {\r\n\r\n\t\t\t// Not using update ranges\r\n\t\t\tgl.bufferSubData( bufferType, 0, array );\r\n\r\n\t\t}\r\n\r\n\t\tif ( updateRanges.length !== 0 ) {\r\n\r\n\t\t\tfor ( let i = 0, l = updateRanges.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tconst range = updateRanges[ i ];\r\n\r\n\t\t\t\tgl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,\r\n\t\t\t\t\tarray, range.start, range.count );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tattribute.clearUpdateRanges();\r\n\r\n\t\t}\r\n\r\n\t\t// @deprecated, r159\r\n\t\tif ( updateRange.count !== - 1 ) {\r\n\r\n\t\t\tgl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,\r\n\t\t\t\tarray, updateRange.offset, updateRange.count );\r\n\r\n\t\t\tupdateRange.count = - 1; // reset range\r\n\r\n\t\t}\r\n\r\n\t\tattribute.onUploadCallback();\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tfunction get( attribute ) {\r\n\r\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\r\n\r\n\t\treturn buffers.get( attribute );\r\n\r\n\t}\r\n\r\n\tfunction remove( attribute ) {\r\n\r\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\r\n\r\n\t\tconst data = buffers.get( attribute );\r\n\r\n\t\tif ( data ) {\r\n\r\n\t\t\tgl.deleteBuffer( data.buffer );\r\n\r\n\t\t\tbuffers.delete( attribute );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction update( attribute, bufferType ) {\r\n\r\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\r\n\r\n\t\tif ( attribute.isGLBufferAttribute ) {\r\n\r\n\t\t\tconst cached = buffers.get( attribute );\r\n\r\n\t\t\tif ( ! cached || cached.version < attribute.version ) {\r\n\r\n\t\t\t\tbuffers.set( attribute, {\r\n\t\t\t\t\tbuffer: attribute.buffer,\r\n\t\t\t\t\ttype: attribute.type,\r\n\t\t\t\t\tbytesPerElement: attribute.elementSize,\r\n\t\t\t\t\tversion: attribute.version\r\n\t\t\t\t} );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tconst data = buffers.get( attribute );\r\n\r\n\t\tif ( data === undefined ) {\r\n\r\n\t\t\tbuffers.set( attribute, createBuffer( attribute, bufferType ) );\r\n\r\n\t\t} else if ( data.version < attribute.version ) {\r\n\r\n\t\t\tif ( data.size !== attribute.array.byteLength ) {\r\n\r\n\t\t\t\tthrow new Error( 'THREE.WebGLAttributes: The size of the buffer attribute\\'s array buffer does not match the original size. Resizing buffer attributes is not supported.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tupdateBuffer( data.buffer, attribute, bufferType );\r\n\r\n\t\t\tdata.version = attribute.version;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn {\r\n\r\n\t\tget: get,\r\n\t\tremove: remove,\r\n\t\tupdate: update\r\n\r\n\t};\r\n\r\n}\r\n\r\nclass PlaneGeometry extends BufferGeometry {\r\n\r\n\tconstructor( width = 1, height = 1, widthSegments = 1, heightSegments = 1 ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'PlaneGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\twidth: width,\r\n\t\t\theight: height,\r\n\t\t\twidthSegments: widthSegments,\r\n\t\t\theightSegments: heightSegments\r\n\t\t};\r\n\r\n\t\tconst width_half = width / 2;\r\n\t\tconst height_half = height / 2;\r\n\r\n\t\tconst gridX = Math.floor( widthSegments );\r\n\t\tconst gridY = Math.floor( heightSegments );\r\n\r\n\t\tconst gridX1 = gridX + 1;\r\n\t\tconst gridY1 = gridY + 1;\r\n\r\n\t\tconst segment_width = width / gridX;\r\n\t\tconst segment_height = height / gridY;\r\n\r\n\t\t//\r\n\r\n\t\tconst indices = [];\r\n\t\tconst vertices = [];\r\n\t\tconst normals = [];\r\n\t\tconst uvs = [];\r\n\r\n\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\r\n\r\n\t\t\tconst y = iy * segment_height - height_half;\r\n\r\n\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\r\n\r\n\t\t\t\tconst x = ix * segment_width - width_half;\r\n\r\n\t\t\t\tvertices.push( x, - y, 0 );\r\n\r\n\t\t\t\tnormals.push( 0, 0, 1 );\r\n\r\n\t\t\t\tuvs.push( ix / gridX );\r\n\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\r\n\r\n\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\r\n\r\n\t\t\t\tconst a = ix + gridX1 * iy;\r\n\t\t\t\tconst b = ix + gridX1 * ( iy + 1 );\r\n\t\t\t\tconst c = ( ix + 1 ) + gridX1 * ( iy + 1 );\r\n\t\t\t\tconst d = ( ix + 1 ) + gridX1 * iy;\r\n\r\n\t\t\t\tindices.push( a, b, d );\r\n\t\t\t\tindices.push( b, c, d );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.setIndex( indices );\r\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\r\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.parameters = Object.assign( {}, source.parameters );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data ) {\r\n\r\n\t\treturn new PlaneGeometry( data.width, data.height, data.widthSegments, data.heightSegments );\r\n\r\n\t}\r\n\r\n}\r\n\r\nvar alphahash_fragment = \"#ifdef USE_ALPHAHASH\\n\\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\\n#endif\";\r\n\r\nvar alphahash_pars_fragment = \"#ifdef USE_ALPHAHASH\\n\\tconst float ALPHA_HASH_SCALE = 0.05;\\n\\tfloat hash2D( vec2 value ) {\\n\\t\\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\\n\\t}\\n\\tfloat hash3D( vec3 value ) {\\n\\t\\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\\n\\t}\\n\\tfloat getAlphaHashThreshold( vec3 position ) {\\n\\t\\tfloat maxDeriv = max(\\n\\t\\t\\tlength( dFdx( position.xyz ) ),\\n\\t\\t\\tlength( dFdy( position.xyz ) )\\n\\t\\t);\\n\\t\\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\\n\\t\\tvec2 pixScales = vec2(\\n\\t\\t\\texp2( floor( log2( pixScale ) ) ),\\n\\t\\t\\texp2( ceil( log2( pixScale ) ) )\\n\\t\\t);\\n\\t\\tvec2 alpha = vec2(\\n\\t\\t\\thash3D( floor( pixScales.x * position.xyz ) ),\\n\\t\\t\\thash3D( floor( pixScales.y * position.xyz ) )\\n\\t\\t);\\n\\t\\tfloat lerpFactor = fract( log2( pixScale ) );\\n\\t\\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\\n\\t\\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\\n\\t\\tvec3 cases = vec3(\\n\\t\\t\\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\\n\\t\\t\\t( x - 0.5 * a ) / ( 1.0 - a ),\\n\\t\\t\\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\\n\\t\\t);\\n\\t\\tfloat threshold = ( x < ( 1.0 - a ) )\\n\\t\\t\\t? ( ( x < a ) ? cases.x : cases.y )\\n\\t\\t\\t: cases.z;\\n\\t\\treturn clamp( threshold , 1.0e-6, 1.0 );\\n\\t}\\n#endif\";\r\n\r\nvar alphamap_fragment = \"#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\\n#endif\";\r\n\r\nvar alphamap_pars_fragment = \"#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\r\n\r\nvar alphatest_fragment = \"#ifdef USE_ALPHATEST\\n\\t#ifdef ALPHA_TO_COVERAGE\\n\\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\\n\\tif ( diffuseColor.a == 0.0 ) discard;\\n\\t#else\\n\\tif ( diffuseColor.a < alphaTest ) discard;\\n\\t#endif\\n#endif\";\r\n\r\nvar alphatest_pars_fragment = \"#ifdef USE_ALPHATEST\\n\\tuniform float alphaTest;\\n#endif\";\r\n\r\nvar aomap_fragment = \"#ifdef USE_AOMAP\\n\\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\\n\\treflectedLight.indirectDiffuse *= ambientOcclusion;\\n\\t#if defined( USE_CLEARCOAT ) \\n\\t\\tclearcoatSpecularIndirect *= ambientOcclusion;\\n\\t#endif\\n\\t#if defined( USE_SHEEN ) \\n\\t\\tsheenSpecularIndirect *= ambientOcclusion;\\n\\t#endif\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD )\\n\\t\\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\\n\\t\\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\\n\\t#endif\\n#endif\";\r\n\r\nvar aomap_pars_fragment = \"#ifdef USE_AOMAP\\n\\tuniform sampler2D aoMap;\\n\\tuniform float aoMapIntensity;\\n#endif\";\r\n\r\nvar batching_pars_vertex = \"#ifdef USE_BATCHING\\n\\t#if ! defined( GL_ANGLE_multi_draw )\\n\\t#define gl_DrawID _gl_DrawID\\n\\tuniform int _gl_DrawID;\\n\\t#endif\\n\\tuniform highp sampler2D batchingTexture;\\n\\tuniform highp usampler2D batchingIdTexture;\\n\\tmat4 getBatchingMatrix( const in float i ) {\\n\\t\\tint size = textureSize( batchingTexture, 0 ).x;\\n\\t\\tint j = int( i ) * 4;\\n\\t\\tint x = j % size;\\n\\t\\tint y = j / size;\\n\\t\\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\\n\\t\\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\\n\\t\\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\\n\\t\\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\\n\\t\\treturn mat4( v1, v2, v3, v4 );\\n\\t}\\n\\tfloat getIndirectIndex( const in int i ) {\\n\\t\\tint size = textureSize( batchingIdTexture, 0 ).x;\\n\\t\\tint x = i % size;\\n\\t\\tint y = i / size;\\n\\t\\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\\n\\t}\\n#endif\\n#ifdef USE_BATCHING_COLOR\\n\\tuniform sampler2D batchingColorTexture;\\n\\tvec3 getBatchingColor( const in float i ) {\\n\\t\\tint size = textureSize( batchingColorTexture, 0 ).x;\\n\\t\\tint j = int( i );\\n\\t\\tint x = j % size;\\n\\t\\tint y = j / size;\\n\\t\\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\\n\\t}\\n#endif\";\r\n\r\nvar batching_vertex = \"#ifdef USE_BATCHING\\n\\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\\n#endif\";\r\n\r\nvar begin_vertex = \"vec3 transformed = vec3( position );\\n#ifdef USE_ALPHAHASH\\n\\tvPosition = vec3( position );\\n#endif\";\r\n\r\nvar beginnormal_vertex = \"vec3 objectNormal = vec3( normal );\\n#ifdef USE_TANGENT\\n\\tvec3 objectTangent = vec3( tangent.xyz );\\n#endif\";\r\n\r\nvar bsdfs = \"float G_BlinnPhong_Implicit( ) {\\n\\treturn 0.25;\\n}\\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\\n\\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\\n}\\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\\n\\tfloat G = G_BlinnPhong_Implicit( );\\n\\tfloat D = D_BlinnPhong( shininess, dotNH );\\n\\treturn F * ( G * D );\\n} // validated\";\r\n\r\nvar iridescence_fragment = \"#ifdef USE_IRIDESCENCE\\n\\tconst mat3 XYZ_TO_REC709 = mat3(\\n\\t\\t 3.2404542, -0.9692660, 0.0556434,\\n\\t\\t-1.5371385, 1.8760108, -0.2040259,\\n\\t\\t-0.4985314, 0.0415560, 1.0572252\\n\\t);\\n\\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\\n\\t\\tvec3 sqrtF0 = sqrt( fresnel0 );\\n\\t\\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\\n\\t}\\n\\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\\n\\t\\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\\n\\t}\\n\\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\\n\\t\\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\\n\\t}\\n\\tvec3 evalSensitivity( float OPD, vec3 shift ) {\\n\\t\\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\\n\\t\\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\\n\\t\\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\\n\\t\\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\\n\\t\\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\\n\\t\\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\\n\\t\\txyz /= 1.0685e-7;\\n\\t\\tvec3 rgb = XYZ_TO_REC709 * xyz;\\n\\t\\treturn rgb;\\n\\t}\\n\\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\\n\\t\\tvec3 I;\\n\\t\\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\\n\\t\\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\\n\\t\\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\\n\\t\\tif ( cosTheta2Sq < 0.0 ) {\\n\\t\\t\\treturn vec3( 1.0 );\\n\\t\\t}\\n\\t\\tfloat cosTheta2 = sqrt( cosTheta2Sq );\\n\\t\\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\\n\\t\\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\\n\\t\\tfloat T121 = 1.0 - R12;\\n\\t\\tfloat phi12 = 0.0;\\n\\t\\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\\n\\t\\tfloat phi21 = PI - phi12;\\n\\t\\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\\t\\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\\n\\t\\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\\n\\t\\tvec3 phi23 = vec3( 0.0 );\\n\\t\\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\\n\\t\\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\\n\\t\\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\\n\\t\\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\\n\\t\\tvec3 phi = vec3( phi21 ) + phi23;\\n\\t\\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\\n\\t\\tvec3 r123 = sqrt( R123 );\\n\\t\\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\\n\\t\\tvec3 C0 = R12 + Rs;\\n\\t\\tI = C0;\\n\\t\\tvec3 Cm = Rs - T121;\\n\\t\\tfor ( int m = 1; m <= 2; ++ m ) {\\n\\t\\t\\tCm *= r123;\\n\\t\\t\\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\\n\\t\\t\\tI += Cm * Sm;\\n\\t\\t}\\n\\t\\treturn max( I, vec3( 0.0 ) );\\n\\t}\\n#endif\";\r\n\r\nvar bumpmap_pars_fragment = \"#ifdef USE_BUMPMAP\\n\\tuniform sampler2D bumpMap;\\n\\tuniform float bumpScale;\\n\\tvec2 dHdxy_fwd() {\\n\\t\\tvec2 dSTdx = dFdx( vBumpMapUv );\\n\\t\\tvec2 dSTdy = dFdy( vBumpMapUv );\\n\\t\\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\\n\\t\\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\\n\\t\\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\\n\\t\\treturn vec2( dBx, dBy );\\n\\t}\\n\\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\\n\\t\\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\\n\\t\\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\\n\\t\\tvec3 vN = surf_norm;\\n\\t\\tvec3 R1 = cross( vSigmaY, vN );\\n\\t\\tvec3 R2 = cross( vN, vSigmaX );\\n\\t\\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\\n\\t\\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\\n\\t\\treturn normalize( abs( fDet ) * surf_norm - vGrad );\\n\\t}\\n#endif\";\r\n\r\nvar clipping_planes_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvec4 plane;\\n\\t#ifdef ALPHA_TO_COVERAGE\\n\\t\\tfloat distanceToPlane, distanceGradient;\\n\\t\\tfloat clipOpacity = 1.0;\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\\n\\t\\t\\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\\n\\t\\t\\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\\n\\t\\t\\tif ( clipOpacity == 0.0 ) discard;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\n\\t\\t\\tfloat unionClipOpacity = 1.0;\\n\\t\\t\\t#pragma unroll_loop_start\\n\\t\\t\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\t\\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\\n\\t\\t\\t\\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\\n\\t\\t\\t\\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\\n\\t\\t\\t}\\n\\t\\t\\t#pragma unroll_loop_end\\n\\t\\t\\tclipOpacity *= 1.0 - unionClipOpacity;\\n\\t\\t#endif\\n\\t\\tdiffuseColor.a *= clipOpacity;\\n\\t\\tif ( diffuseColor.a == 0.0 ) discard;\\n\\t#else\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\n\\t\\t\\tbool clipped = true;\\n\\t\\t\\t#pragma unroll_loop_start\\n\\t\\t\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\t\\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\\n\\t\\t\\t}\\n\\t\\t\\t#pragma unroll_loop_end\\n\\t\\t\\tif ( clipped ) discard;\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\r\n\r\nvar clipping_planes_pars_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n\\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\\n#endif\";\r\n\r\nvar clipping_planes_pars_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n#endif\";\r\n\r\nvar clipping_planes_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvClipPosition = - mvPosition.xyz;\\n#endif\";\r\n\r\nvar color_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tdiffuseColor *= vColor;\\n#elif defined( USE_COLOR )\\n\\tdiffuseColor.rgb *= vColor;\\n#endif\";\r\n\r\nvar color_pars_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\r\n\r\nvar color_pars_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\r\n\r\nvar color_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvColor = vec4( 1.0 );\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\\n\\tvColor = vec3( 1.0 );\\n#endif\\n#ifdef USE_COLOR\\n\\tvColor *= color;\\n#endif\\n#ifdef USE_INSTANCING_COLOR\\n\\tvColor.xyz *= instanceColor.xyz;\\n#endif\\n#ifdef USE_BATCHING_COLOR\\n\\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\\n\\tvColor.xyz *= batchingColor.xyz;\\n#endif\";\r\n\r\nvar common = \"#define PI 3.141592653589793\\n#define PI2 6.283185307179586\\n#define PI_HALF 1.5707963267948966\\n#define RECIPROCAL_PI 0.3183098861837907\\n#define RECIPROCAL_PI2 0.15915494309189535\\n#define EPSILON 1e-6\\n#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\\nfloat pow2( const in float x ) { return x*x; }\\nvec3 pow2( const in vec3 x ) { return x*x; }\\nfloat pow3( const in float x ) { return x*x*x; }\\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\\nhighp float rand( const in vec2 uv ) {\\n\\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\\n\\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\\n\\treturn fract( sin( sn ) * c );\\n}\\n#ifdef HIGH_PRECISION\\n\\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\\n#else\\n\\tfloat precisionSafeLength( vec3 v ) {\\n\\t\\tfloat maxComponent = max3( abs( v ) );\\n\\t\\treturn length( v / maxComponent ) * maxComponent;\\n\\t}\\n#endif\\nstruct IncidentLight {\\n\\tvec3 color;\\n\\tvec3 direction;\\n\\tbool visible;\\n};\\nstruct ReflectedLight {\\n\\tvec3 directDiffuse;\\n\\tvec3 directSpecular;\\n\\tvec3 indirectDiffuse;\\n\\tvec3 indirectSpecular;\\n};\\n#ifdef USE_ALPHAHASH\\n\\tvarying vec3 vPosition;\\n#endif\\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\\n}\\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\\n}\\nmat3 transposeMat3( const in mat3 m ) {\\n\\tmat3 tmp;\\n\\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\\n\\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\\n\\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\\n\\treturn tmp;\\n}\\nbool isPerspectiveMatrix( mat4 m ) {\\n\\treturn m[ 2 ][ 3 ] == - 1.0;\\n}\\nvec2 equirectUv( in vec3 dir ) {\\n\\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\\n\\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\\n\\treturn vec2( u, v );\\n}\\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\\n\\treturn RECIPROCAL_PI * diffuseColor;\\n}\\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\\n\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n}\\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\\n\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n} // validated\";\r\n\r\nvar cube_uv_reflection_fragment = \"#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t#define cubeUV_minMipLevel 4.0\\n\\t#define cubeUV_minTileSize 16.0\\n\\tfloat getFace( vec3 direction ) {\\n\\t\\tvec3 absDirection = abs( direction );\\n\\t\\tfloat face = - 1.0;\\n\\t\\tif ( absDirection.x > absDirection.z ) {\\n\\t\\t\\tif ( absDirection.x > absDirection.y )\\n\\t\\t\\t\\tface = direction.x > 0.0 ? 0.0 : 3.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t} else {\\n\\t\\t\\tif ( absDirection.z > absDirection.y )\\n\\t\\t\\t\\tface = direction.z > 0.0 ? 2.0 : 5.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t}\\n\\t\\treturn face;\\n\\t}\\n\\tvec2 getUV( vec3 direction, float face ) {\\n\\t\\tvec2 uv;\\n\\t\\tif ( face == 0.0 ) {\\n\\t\\t\\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 1.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\\n\\t\\t} else if ( face == 2.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\\n\\t\\t} else if ( face == 3.0 ) {\\n\\t\\t\\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 4.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\\n\\t\\t} else {\\n\\t\\t\\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\\n\\t\\t}\\n\\t\\treturn 0.5 * ( uv + 1.0 );\\n\\t}\\n\\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\\n\\t\\tfloat face = getFace( direction );\\n\\t\\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\\n\\t\\tmipInt = max( mipInt, cubeUV_minMipLevel );\\n\\t\\tfloat faceSize = exp2( mipInt );\\n\\t\\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\\n\\t\\tif ( face > 2.0 ) {\\n\\t\\t\\tuv.y += faceSize;\\n\\t\\t\\tface -= 3.0;\\n\\t\\t}\\n\\t\\tuv.x += face * faceSize;\\n\\t\\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\\n\\t\\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\\n\\t\\tuv.x *= CUBEUV_TEXEL_WIDTH;\\n\\t\\tuv.y *= CUBEUV_TEXEL_HEIGHT;\\n\\t\\t#ifdef texture2DGradEXT\\n\\t\\t\\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\\n\\t\\t#else\\n\\t\\t\\treturn texture2D( envMap, uv ).rgb;\\n\\t\\t#endif\\n\\t}\\n\\t#define cubeUV_r0 1.0\\n\\t#define cubeUV_m0 - 2.0\\n\\t#define cubeUV_r1 0.8\\n\\t#define cubeUV_m1 - 1.0\\n\\t#define cubeUV_r4 0.4\\n\\t#define cubeUV_m4 2.0\\n\\t#define cubeUV_r5 0.305\\n\\t#define cubeUV_m5 3.0\\n\\t#define cubeUV_r6 0.21\\n\\t#define cubeUV_m6 4.0\\n\\tfloat roughnessToMip( float roughness ) {\\n\\t\\tfloat mip = 0.0;\\n\\t\\tif ( roughness >= cubeUV_r1 ) {\\n\\t\\t\\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\\n\\t\\t} else if ( roughness >= cubeUV_r4 ) {\\n\\t\\t\\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\\n\\t\\t} else if ( roughness >= cubeUV_r5 ) {\\n\\t\\t\\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\\n\\t\\t} else if ( roughness >= cubeUV_r6 ) {\\n\\t\\t\\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\\n\\t\\t} else {\\n\\t\\t\\tmip = - 2.0 * log2( 1.16 * roughness );\\t\\t}\\n\\t\\treturn mip;\\n\\t}\\n\\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\\n\\t\\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\\n\\t\\tfloat mipF = fract( mip );\\n\\t\\tfloat mipInt = floor( mip );\\n\\t\\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\\n\\t\\tif ( mipF == 0.0 ) {\\n\\t\\t\\treturn vec4( color0, 1.0 );\\n\\t\\t} else {\\n\\t\\t\\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\\n\\t\\t\\treturn vec4( mix( color0, color1, mipF ), 1.0 );\\n\\t\\t}\\n\\t}\\n#endif\";\r\n\r\nvar defaultnormal_vertex = \"vec3 transformedNormal = objectNormal;\\n#ifdef USE_TANGENT\\n\\tvec3 transformedTangent = objectTangent;\\n#endif\\n#ifdef USE_BATCHING\\n\\tmat3 bm = mat3( batchingMatrix );\\n\\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\\n\\ttransformedNormal = bm * transformedNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\ttransformedTangent = bm * transformedTangent;\\n\\t#endif\\n#endif\\n#ifdef USE_INSTANCING\\n\\tmat3 im = mat3( instanceMatrix );\\n\\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\\n\\ttransformedNormal = im * transformedNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\ttransformedTangent = im * transformedTangent;\\n\\t#endif\\n#endif\\ntransformedNormal = normalMatrix * transformedNormal;\\n#ifdef FLIP_SIDED\\n\\ttransformedNormal = - transformedNormal;\\n#endif\\n#ifdef USE_TANGENT\\n\\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\\n\\t#ifdef FLIP_SIDED\\n\\t\\ttransformedTangent = - transformedTangent;\\n\\t#endif\\n#endif\";\r\n\r\nvar displacementmap_pars_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\tuniform sampler2D displacementMap;\\n\\tuniform float displacementScale;\\n\\tuniform float displacementBias;\\n#endif\";\r\n\r\nvar displacementmap_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\\n#endif\";\r\n\r\nvar emissivemap_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\\n\\ttotalEmissiveRadiance *= emissiveColor.rgb;\\n#endif\";\r\n\r\nvar emissivemap_pars_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tuniform sampler2D emissiveMap;\\n#endif\";\r\n\r\nvar colorspace_fragment = \"gl_FragColor = linearToOutputTexel( gl_FragColor );\";\r\n\r\nvar colorspace_pars_fragment = \"\\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\\n\\tvec3( 0.8224621, 0.177538, 0.0 ),\\n\\tvec3( 0.0331941, 0.9668058, 0.0 ),\\n\\tvec3( 0.0170827, 0.0723974, 0.9105199 )\\n);\\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\\n\\tvec3( 1.2249401, - 0.2249404, 0.0 ),\\n\\tvec3( - 0.0420569, 1.0420571, 0.0 ),\\n\\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\\n);\\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\\n\\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\\n}\\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\\n\\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\\n}\\nvec4 LinearTransferOETF( in vec4 value ) {\\n\\treturn value;\\n}\\nvec4 sRGBTransferOETF( in vec4 value ) {\\n\\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\\n}\";\r\n\r\nvar envmap_fragment = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvec3 cameraToFrag;\\n\\t\\tif ( isOrthographic ) {\\n\\t\\t\\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\\n\\t\\t}\\n\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\\n\\t\\t#else\\n\\t\\t\\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\\n\\t\\t#endif\\n\\t#else\\n\\t\\tvec3 reflectVec = vReflect;\\n\\t#endif\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\\n\\t#else\\n\\t\\tvec4 envColor = vec4( 0.0 );\\n\\t#endif\\n\\t#ifdef ENVMAP_BLENDING_MULTIPLY\\n\\t\\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\\n\\t#elif defined( ENVMAP_BLENDING_MIX )\\n\\t\\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\\n\\t#elif defined( ENVMAP_BLENDING_ADD )\\n\\t\\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\\n\\t#endif\\n#endif\";\r\n\r\nvar envmap_common_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float envMapIntensity;\\n\\tuniform float flipEnvMap;\\n\\tuniform mat3 envMapRotation;\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tuniform samplerCube envMap;\\n\\t#else\\n\\t\\tuniform sampler2D envMap;\\n\\t#endif\\n\\t\\n#endif\";\r\n\r\nvar envmap_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float reflectivity;\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\n\\t\\t#define ENV_WORLDPOS\\n\\t#endif\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvarying vec3 vWorldPosition;\\n\\t\\tuniform float refractionRatio;\\n\\t#else\\n\\t\\tvarying vec3 vReflect;\\n\\t#endif\\n#endif\";\r\n\r\nvar envmap_pars_vertex = \"#ifdef USE_ENVMAP\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\n\\t\\t#define ENV_WORLDPOS\\n\\t#endif\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\t\\n\\t\\tvarying vec3 vWorldPosition;\\n\\t#else\\n\\t\\tvarying vec3 vReflect;\\n\\t\\tuniform float refractionRatio;\\n\\t#endif\\n#endif\";\r\n\r\nvar envmap_vertex = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvWorldPosition = worldPosition.xyz;\\n\\t#else\\n\\t\\tvec3 cameraToVertex;\\n\\t\\tif ( isOrthographic ) {\\n\\t\\t\\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\\n\\t\\t}\\n\\t\\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\tvReflect = reflect( cameraToVertex, worldNormal );\\n\\t\\t#else\\n\\t\\t\\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\r\n\r\nvar fog_vertex = \"#ifdef USE_FOG\\n\\tvFogDepth = - mvPosition.z;\\n#endif\";\r\n\r\nvar fog_pars_vertex = \"#ifdef USE_FOG\\n\\tvarying float vFogDepth;\\n#endif\";\r\n\r\nvar fog_fragment = \"#ifdef USE_FOG\\n\\t#ifdef FOG_EXP2\\n\\t\\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\\n\\t#else\\n\\t\\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\\n\\t#endif\\n\\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\\n#endif\";\r\n\r\nvar fog_pars_fragment = \"#ifdef USE_FOG\\n\\tuniform vec3 fogColor;\\n\\tvarying float vFogDepth;\\n\\t#ifdef FOG_EXP2\\n\\t\\tuniform float fogDensity;\\n\\t#else\\n\\t\\tuniform float fogNear;\\n\\t\\tuniform float fogFar;\\n\\t#endif\\n#endif\";\r\n\r\nvar gradientmap_pars_fragment = \"#ifdef USE_GRADIENTMAP\\n\\tuniform sampler2D gradientMap;\\n#endif\\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\\n\\tfloat dotNL = dot( normal, lightDirection );\\n\\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\\n\\t#ifdef USE_GRADIENTMAP\\n\\t\\treturn vec3( texture2D( gradientMap, coord ).r );\\n\\t#else\\n\\t\\tvec2 fw = fwidth( coord ) * 0.5;\\n\\t\\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\\n\\t#endif\\n}\";\r\n\r\nvar lightmap_pars_fragment = \"#ifdef USE_LIGHTMAP\\n\\tuniform sampler2D lightMap;\\n\\tuniform float lightMapIntensity;\\n#endif\";\r\n\r\nvar lights_lambert_fragment = \"LambertMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularStrength = specularStrength;\";\r\n\r\nvar lights_lambert_pars_fragment = \"varying vec3 vViewPosition;\\nstruct LambertMaterial {\\n\\tvec3 diffuseColor;\\n\\tfloat specularStrength;\\n};\\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Lambert\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Lambert\";\r\n\r\nvar lights_pars_begin = \"uniform bool receiveShadow;\\nuniform vec3 ambientLightColor;\\n#if defined( USE_LIGHT_PROBES )\\n\\tuniform vec3 lightProbe[ 9 ];\\n#endif\\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\\n\\tfloat x = normal.x, y = normal.y, z = normal.z;\\n\\tvec3 result = shCoefficients[ 0 ] * 0.886227;\\n\\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\\n\\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\\n\\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\\n\\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\\n\\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\\n\\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\\n\\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\\n\\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\\n\\treturn result;\\n}\\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\\n\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\\n\\treturn irradiance;\\n}\\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\\n\\tvec3 irradiance = ambientLightColor;\\n\\treturn irradiance;\\n}\\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\\n\\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\\n\\tif ( cutoffDistance > 0.0 ) {\\n\\t\\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\\n\\t}\\n\\treturn distanceFalloff;\\n}\\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\\n\\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\\n}\\n#if NUM_DIR_LIGHTS > 0\\n\\tstruct DirectionalLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t};\\n\\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\\n\\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\\n\\t\\tlight.color = directionalLight.color;\\n\\t\\tlight.direction = directionalLight.direction;\\n\\t\\tlight.visible = true;\\n\\t}\\n#endif\\n#if NUM_POINT_LIGHTS > 0\\n\\tstruct PointLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t};\\n\\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\\n\\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\\n\\t\\tvec3 lVector = pointLight.position - geometryPosition;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat lightDistance = length( lVector );\\n\\t\\tlight.color = pointLight.color;\\n\\t\\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\\n\\t\\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\\t}\\n#endif\\n#if NUM_SPOT_LIGHTS > 0\\n\\tstruct SpotLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t\\tfloat coneCos;\\n\\t\\tfloat penumbraCos;\\n\\t};\\n\\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\\n\\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\\n\\t\\tvec3 lVector = spotLight.position - geometryPosition;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat angleCos = dot( light.direction, spotLight.direction );\\n\\t\\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\\n\\t\\tif ( spotAttenuation > 0.0 ) {\\n\\t\\t\\tfloat lightDistance = length( lVector );\\n\\t\\t\\tlight.color = spotLight.color * spotAttenuation;\\n\\t\\t\\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\\n\\t\\t\\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\\t\\t} else {\\n\\t\\t\\tlight.color = vec3( 0.0 );\\n\\t\\t\\tlight.visible = false;\\n\\t\\t}\\n\\t}\\n#endif\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tstruct RectAreaLight {\\n\\t\\tvec3 color;\\n\\t\\tvec3 position;\\n\\t\\tvec3 halfWidth;\\n\\t\\tvec3 halfHeight;\\n\\t};\\n\\tuniform sampler2D ltc_1;\\tuniform sampler2D ltc_2;\\n\\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\\n#endif\\n#if NUM_HEMI_LIGHTS > 0\\n\\tstruct HemisphereLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 skyColor;\\n\\t\\tvec3 groundColor;\\n\\t};\\n\\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\\n\\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\\n\\t\\tfloat dotNL = dot( normal, hemiLight.direction );\\n\\t\\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\\n\\t\\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\\n\\t\\treturn irradiance;\\n\\t}\\n#endif\";\r\n\r\nvar envmap_physical_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tvec3 getIBLIrradiance( const in vec3 normal ) {\\n\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\\n\\t\\t\\treturn PI * envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n\\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\\n\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\tvec3 reflectVec = reflect( - viewDir, normal );\\n\\t\\t\\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\\n\\t\\t\\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\\n\\t\\t\\treturn envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\\n\\t\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\t\\tvec3 bentNormal = cross( bitangent, viewDir );\\n\\t\\t\\t\\tbentNormal = normalize( cross( bentNormal, bitangent ) );\\n\\t\\t\\t\\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\\n\\t\\t\\t\\treturn getIBLRadiance( viewDir, bentNormal, roughness );\\n\\t\\t\\t#else\\n\\t\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t\\t#endif\\n\\t\\t}\\n\\t#endif\\n#endif\";\r\n\r\nvar lights_toon_fragment = \"ToonMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\";\r\n\r\nvar lights_toon_pars_fragment = \"varying vec3 vViewPosition;\\nstruct ToonMaterial {\\n\\tvec3 diffuseColor;\\n};\\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Toon\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Toon\";\r\n\r\nvar lights_phong_fragment = \"BlinnPhongMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularColor = specular;\\nmaterial.specularShininess = shininess;\\nmaterial.specularStrength = specularStrength;\";\r\n\r\nvar lights_phong_pars_fragment = \"varying vec3 vViewPosition;\\nstruct BlinnPhongMaterial {\\n\\tvec3 diffuseColor;\\n\\tvec3 specularColor;\\n\\tfloat specularShininess;\\n\\tfloat specularStrength;\\n};\\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n\\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\\n}\\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_BlinnPhong\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_BlinnPhong\";\r\n\r\nvar lights_physical_fragment = \"PhysicalMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\\nmaterial.roughness = min( material.roughness, 1.0 );\\n#ifdef IOR\\n\\tmaterial.ior = ior;\\n\\t#ifdef USE_SPECULAR\\n\\t\\tfloat specularIntensityFactor = specularIntensity;\\n\\t\\tvec3 specularColorFactor = specularColor;\\n\\t\\t#ifdef USE_SPECULAR_COLORMAP\\n\\t\\t\\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\\n\\t\\t#endif\\n\\t\\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\\t\\t\\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\\n\\t\\t#endif\\n\\t\\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\\n\\t#else\\n\\t\\tfloat specularIntensityFactor = 1.0;\\n\\t\\tvec3 specularColorFactor = vec3( 1.0 );\\n\\t\\tmaterial.specularF90 = 1.0;\\n\\t#endif\\n\\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\\n#else\\n\\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\\n\\tmaterial.specularF90 = 1.0;\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tmaterial.clearcoat = clearcoat;\\n\\tmaterial.clearcoatRoughness = clearcoatRoughness;\\n\\tmaterial.clearcoatF0 = vec3( 0.04 );\\n\\tmaterial.clearcoatF90 = 1.0;\\n\\t#ifdef USE_CLEARCOATMAP\\n\\t\\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\t\\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\\n\\t#endif\\n\\tmaterial.clearcoat = saturate( material.clearcoat );\\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\\n\\tmaterial.clearcoatRoughness += geometryRoughness;\\n\\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\\n#endif\\n#ifdef USE_DISPERSION\\n\\tmaterial.dispersion = dispersion;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tmaterial.iridescence = iridescence;\\n\\tmaterial.iridescenceIOR = iridescenceIOR;\\n\\t#ifdef USE_IRIDESCENCEMAP\\n\\t\\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\\n\\t#endif\\n\\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\t\\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\\n\\t#else\\n\\t\\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\\n\\t#endif\\n#endif\\n#ifdef USE_SHEEN\\n\\tmaterial.sheenColor = sheenColor;\\n\\t#ifdef USE_SHEEN_COLORMAP\\n\\t\\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\\n\\t#endif\\n\\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\\n\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\t\\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\\n\\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\\t#ifdef USE_ANISOTROPYMAP\\n\\t\\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\\n\\t\\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\\n\\t\\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\\n\\t#else\\n\\t\\tvec2 anisotropyV = anisotropyVector;\\n\\t#endif\\n\\tmaterial.anisotropy = length( anisotropyV );\\n\\tif( material.anisotropy == 0.0 ) {\\n\\t\\tanisotropyV = vec2( 1.0, 0.0 );\\n\\t} else {\\n\\t\\tanisotropyV /= material.anisotropy;\\n\\t\\tmaterial.anisotropy = saturate( material.anisotropy );\\n\\t}\\n\\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\\n\\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\\n\\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\\n#endif\";\r\n\r\nvar lights_physical_pars_fragment = \"struct PhysicalMaterial {\\n\\tvec3 diffuseColor;\\n\\tfloat roughness;\\n\\tvec3 specularColor;\\n\\tfloat specularF90;\\n\\tfloat dispersion;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat clearcoat;\\n\\t\\tfloat clearcoatRoughness;\\n\\t\\tvec3 clearcoatF0;\\n\\t\\tfloat clearcoatF90;\\n\\t#endif\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tfloat iridescence;\\n\\t\\tfloat iridescenceIOR;\\n\\t\\tfloat iridescenceThickness;\\n\\t\\tvec3 iridescenceFresnel;\\n\\t\\tvec3 iridescenceF0;\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tvec3 sheenColor;\\n\\t\\tfloat sheenRoughness;\\n\\t#endif\\n\\t#ifdef IOR\\n\\t\\tfloat ior;\\n\\t#endif\\n\\t#ifdef USE_TRANSMISSION\\n\\t\\tfloat transmission;\\n\\t\\tfloat transmissionAlpha;\\n\\t\\tfloat thickness;\\n\\t\\tfloat attenuationDistance;\\n\\t\\tvec3 attenuationColor;\\n\\t#endif\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tfloat anisotropy;\\n\\t\\tfloat alphaT;\\n\\t\\tvec3 anisotropyT;\\n\\t\\tvec3 anisotropyB;\\n\\t#endif\\n};\\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\\nvec3 sheenSpecularDirect = vec3( 0.0 );\\nvec3 sheenSpecularIndirect = vec3(0.0 );\\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\\n float x2 = x * x;\\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\\n}\\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\\n\\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\\n\\treturn 0.5 / max( gv + gl, EPSILON );\\n}\\nfloat D_GGX( const in float alpha, const in float dotNH ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\\n\\treturn RECIPROCAL_PI * a2 / pow2( denom );\\n}\\n#ifdef USE_ANISOTROPY\\n\\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\\n\\t\\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\\n\\t\\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\\n\\t\\tfloat v = 0.5 / ( gv + gl );\\n\\t\\treturn saturate(v);\\n\\t}\\n\\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\\n\\t\\tfloat a2 = alphaT * alphaB;\\n\\t\\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\\n\\t\\thighp float v2 = dot( v, v );\\n\\t\\tfloat w2 = a2 / v2;\\n\\t\\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\\n\\t}\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\\n\\t\\tvec3 f0 = material.clearcoatF0;\\n\\t\\tfloat f90 = material.clearcoatF90;\\n\\t\\tfloat roughness = material.clearcoatRoughness;\\n\\t\\tfloat alpha = pow2( roughness );\\n\\t\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\t\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\t\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\t\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\t\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\t\\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\\t\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\t\\tfloat D = D_GGX( alpha, dotNH );\\n\\t\\treturn F * ( V * D );\\n\\t}\\n#endif\\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\\n\\tvec3 f0 = material.specularColor;\\n\\tfloat f90 = material.specularF90;\\n\\tfloat roughness = material.roughness;\\n\\tfloat alpha = pow2( roughness );\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tF = mix( F, material.iridescenceFresnel, material.iridescence );\\n\\t#endif\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tfloat dotTL = dot( material.anisotropyT, lightDir );\\n\\t\\tfloat dotTV = dot( material.anisotropyT, viewDir );\\n\\t\\tfloat dotTH = dot( material.anisotropyT, halfDir );\\n\\t\\tfloat dotBL = dot( material.anisotropyB, lightDir );\\n\\t\\tfloat dotBV = dot( material.anisotropyB, viewDir );\\n\\t\\tfloat dotBH = dot( material.anisotropyB, halfDir );\\n\\t\\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\\n\\t\\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\\n\\t#else\\n\\t\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\t\\tfloat D = D_GGX( alpha, dotNH );\\n\\t#endif\\n\\treturn F * ( V * D );\\n}\\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\\n\\tconst float LUT_SIZE = 64.0;\\n\\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\\n\\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\\n\\tfloat dotNV = saturate( dot( N, V ) );\\n\\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\\n\\tuv = uv * LUT_SCALE + LUT_BIAS;\\n\\treturn uv;\\n}\\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\\n\\tfloat l = length( f );\\n\\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\\n}\\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\\n\\tfloat x = dot( v1, v2 );\\n\\tfloat y = abs( x );\\n\\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\\n\\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\\n\\tfloat v = a / b;\\n\\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\\n\\treturn cross( v1, v2 ) * theta_sintheta;\\n}\\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\\n\\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\\n\\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\\n\\tvec3 lightNormal = cross( v1, v2 );\\n\\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\\n\\tvec3 T1, T2;\\n\\tT1 = normalize( V - N * dot( V, N ) );\\n\\tT2 = - cross( N, T1 );\\n\\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\\n\\tvec3 coords[ 4 ];\\n\\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\\n\\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\\n\\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\\n\\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\\n\\tcoords[ 0 ] = normalize( coords[ 0 ] );\\n\\tcoords[ 1 ] = normalize( coords[ 1 ] );\\n\\tcoords[ 2 ] = normalize( coords[ 2 ] );\\n\\tcoords[ 3 ] = normalize( coords[ 3 ] );\\n\\tvec3 vectorFormFactor = vec3( 0.0 );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\\n\\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\\n\\treturn vec3( result );\\n}\\n#if defined( USE_SHEEN )\\nfloat D_Charlie( float roughness, float dotNH ) {\\n\\tfloat alpha = pow2( roughness );\\n\\tfloat invAlpha = 1.0 / alpha;\\n\\tfloat cos2h = dotNH * dotNH;\\n\\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\\n\\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\\n}\\nfloat V_Neubelt( float dotNV, float dotNL ) {\\n\\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\\n}\\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat D = D_Charlie( sheenRoughness, dotNH );\\n\\tfloat V = V_Neubelt( dotNV, dotNL );\\n\\treturn sheenColor * ( D * V );\\n}\\n#endif\\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat r2 = roughness * roughness;\\n\\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\\n\\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\\n\\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\\n\\treturn saturate( DG * RECIPROCAL_PI );\\n}\\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\\n\\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\\n\\tvec4 r = roughness * c0 + c1;\\n\\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\\n\\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\\n\\treturn fab;\\n}\\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\\n\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\\treturn specularColor * fab.x + specularF90 * fab.y;\\n}\\n#ifdef USE_IRIDESCENCE\\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#else\\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#endif\\n\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\\n\\t#else\\n\\t\\tvec3 Fr = specularColor;\\n\\t#endif\\n\\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\\n\\tfloat Ess = fab.x + fab.y;\\n\\tfloat Ems = 1.0 - Ess;\\n\\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\\n\\tsingleScatter += FssEss;\\n\\tmultiScatter += Fms * Ems;\\n}\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\t\\tvec3 normal = geometryNormal;\\n\\t\\tvec3 viewDir = geometryViewDir;\\n\\t\\tvec3 position = geometryPosition;\\n\\t\\tvec3 lightPos = rectAreaLight.position;\\n\\t\\tvec3 halfWidth = rectAreaLight.halfWidth;\\n\\t\\tvec3 halfHeight = rectAreaLight.halfHeight;\\n\\t\\tvec3 lightColor = rectAreaLight.color;\\n\\t\\tfloat roughness = material.roughness;\\n\\t\\tvec3 rectCoords[ 4 ];\\n\\t\\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\\t\\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\\n\\t\\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\\n\\t\\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\\n\\t\\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\\n\\t\\tvec4 t1 = texture2D( ltc_1, uv );\\n\\t\\tvec4 t2 = texture2D( ltc_2, uv );\\n\\t\\tmat3 mInv = mat3(\\n\\t\\t\\tvec3( t1.x, 0, t1.y ),\\n\\t\\t\\tvec3( 0, 1, 0 ),\\n\\t\\t\\tvec3( t1.z, 0, t1.w )\\n\\t\\t);\\n\\t\\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\\n\\t\\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\\n\\t\\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\\n\\t}\\n#endif\\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\\n\\t\\tvec3 ccIrradiance = dotNLcc * directLight.color;\\n\\t\\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\\n\\t#endif\\n\\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\\n\\t#endif\\n\\tvec3 singleScattering = vec3( 0.0 );\\n\\tvec3 multiScattering = vec3( 0.0 );\\n\\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\\n\\t#else\\n\\t\\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\\n\\t#endif\\n\\tvec3 totalScattering = singleScattering + multiScattering;\\n\\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\\n\\treflectedLight.indirectSpecular += radiance * singleScattering;\\n\\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\\n\\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Physical\\n#define RE_Direct_RectArea\\t\\tRE_Direct_RectArea_Physical\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Physical\\n#define RE_IndirectSpecular\\t\\tRE_IndirectSpecular_Physical\\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\\n\\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\\n}\";\r\n\r\nvar lights_fragment_begin = \"\\nvec3 geometryPosition = - vViewPosition;\\nvec3 geometryNormal = normal;\\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\\nvec3 geometryClearcoatNormal = vec3( 0.0 );\\n#ifdef USE_CLEARCOAT\\n\\tgeometryClearcoatNormal = clearcoatNormal;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\\n\\tif ( material.iridescenceThickness == 0.0 ) {\\n\\t\\tmaterial.iridescence = 0.0;\\n\\t} else {\\n\\t\\tmaterial.iridescence = saturate( material.iridescence );\\n\\t}\\n\\tif ( material.iridescence > 0.0 ) {\\n\\t\\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\\n\\t\\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\\n\\t}\\n#endif\\nIncidentLight directLight;\\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tPointLight pointLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\\n\\tPointLightShadow pointLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\\n\\t\\tpointLight = pointLights[ i ];\\n\\t\\tgetPointLightInfo( pointLight, geometryPosition, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\\n\\t\\tpointLightShadow = pointLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tSpotLight spotLight;\\n\\tvec4 spotColor;\\n\\tvec3 spotLightCoord;\\n\\tbool inSpotLightMap;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\\n\\tSpotLightShadow spotLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\\n\\t\\tspotLight = spotLights[ i ];\\n\\t\\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\\n\\t\\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\\n\\t\\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\\n\\t\\t#else\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\\t\\t#endif\\n\\t\\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\\n\\t\\t\\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\\n\\t\\t\\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\\n\\t\\t\\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\\n\\t\\t\\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\\n\\t\\t#endif\\n\\t\\t#undef SPOT_LIGHT_MAP_INDEX\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\tspotLightShadow = spotLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tDirectionalLight directionalLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\\n\\tDirectionalLightShadow directionalLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLights[ i ];\\n\\t\\tgetDirectionalLightInfo( directionalLight, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\\n\\t\\tdirectionalLightShadow = directionalLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\\n\\tRectAreaLight rectAreaLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\\n\\t\\trectAreaLight = rectAreaLights[ i ];\\n\\t\\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if defined( RE_IndirectDiffuse )\\n\\tvec3 iblIrradiance = vec3( 0.0 );\\n\\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\\n\\t#if defined( USE_LIGHT_PROBES )\\n\\t\\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\\n\\t#endif\\n\\t#if ( NUM_HEMI_LIGHTS > 0 )\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\\n\\t\\t\\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tvec3 radiance = vec3( 0.0 );\\n\\tvec3 clearcoatRadiance = vec3( 0.0 );\\n#endif\";\r\n\r\nvar lights_fragment_maps = \"#if defined( RE_IndirectDiffuse )\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\t\\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\\t\\tirradiance += lightMapIrradiance;\\n\\t#endif\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tiblIrradiance += getIBLIrradiance( geometryNormal );\\n\\t#endif\\n#endif\\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\\n\\t#else\\n\\t\\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\\n\\t#endif\\n#endif\";\r\n\r\nvar lights_fragment_end = \"#if defined( RE_IndirectDiffuse )\\n\\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n#endif\";\r\n\r\nvar logdepthbuf_fragment = \"#if defined( USE_LOGDEPTHBUF )\\n\\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\\n#endif\";\r\n\r\nvar logdepthbuf_pars_fragment = \"#if defined( USE_LOGDEPTHBUF )\\n\\tuniform float logDepthBufFC;\\n\\tvarying float vFragDepth;\\n\\tvarying float vIsPerspective;\\n#endif\";\r\n\r\nvar logdepthbuf_pars_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\tvarying float vFragDepth;\\n\\tvarying float vIsPerspective;\\n#endif\";\r\n\r\nvar logdepthbuf_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\tvFragDepth = 1.0 + gl_Position.w;\\n\\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\\n#endif\";\r\n\r\nvar map_fragment = \"#ifdef USE_MAP\\n\\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\\n\\t#ifdef DECODE_VIDEO_TEXTURE\\n\\t\\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\\n\\t\\n\\t#endif\\n\\tdiffuseColor *= sampledDiffuseColor;\\n#endif\";\r\n\r\nvar map_pars_fragment = \"#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\";\r\n\r\nvar map_particle_fragment = \"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\t#if defined( USE_POINTS_UV )\\n\\t\\tvec2 uv = vUv;\\n\\t#else\\n\\t\\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\\n\\t#endif\\n#endif\\n#ifdef USE_MAP\\n\\tdiffuseColor *= texture2D( map, uv );\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\\n#endif\";\r\n\r\nvar map_particle_pars_fragment = \"#if defined( USE_POINTS_UV )\\n\\tvarying vec2 vUv;\\n#else\\n\\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\t\\tuniform mat3 uvTransform;\\n\\t#endif\\n#endif\\n#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\r\n\r\nvar metalnessmap_fragment = \"float metalnessFactor = metalness;\\n#ifdef USE_METALNESSMAP\\n\\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\\n\\tmetalnessFactor *= texelMetalness.b;\\n#endif\";\r\n\r\nvar metalnessmap_pars_fragment = \"#ifdef USE_METALNESSMAP\\n\\tuniform sampler2D metalnessMap;\\n#endif\";\r\n\r\nvar morphinstance_vertex = \"#ifdef USE_INSTANCING_MORPH\\n\\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\\n\\t}\\n#endif\";\r\n\r\nvar morphcolor_vertex = \"#if defined( USE_MORPHCOLORS )\\n\\tvColor *= morphTargetBaseInfluence;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t#if defined( USE_COLOR_ALPHA )\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\\n\\t\\t#elif defined( USE_COLOR )\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\\n\\t\\t#endif\\n\\t}\\n#endif\";\r\n\r\nvar morphnormal_vertex = \"#ifdef USE_MORPHNORMALS\\n\\tobjectNormal *= morphTargetBaseInfluence;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\\n\\t}\\n#endif\";\r\n\r\nvar morphtarget_pars_vertex = \"#ifdef USE_MORPHTARGETS\\n\\t#ifndef USE_INSTANCING_MORPH\\n\\t\\tuniform float morphTargetBaseInfluence;\\n\\t\\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\\t#endif\\n\\tuniform sampler2DArray morphTargetsTexture;\\n\\tuniform ivec2 morphTargetsTextureSize;\\n\\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\\n\\t\\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\\n\\t\\tint y = texelIndex / morphTargetsTextureSize.x;\\n\\t\\tint x = texelIndex - y * morphTargetsTextureSize.x;\\n\\t\\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\\n\\t\\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\\n\\t}\\n#endif\";\r\n\r\nvar morphtarget_vertex = \"#ifdef USE_MORPHTARGETS\\n\\ttransformed *= morphTargetBaseInfluence;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\\n\\t}\\n#endif\";\r\n\r\nvar normal_fragment_begin = \"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\\n#ifdef FLAT_SHADED\\n\\tvec3 fdx = dFdx( vViewPosition );\\n\\tvec3 fdy = dFdy( vViewPosition );\\n\\tvec3 normal = normalize( cross( fdx, fdy ) );\\n#else\\n\\tvec3 normal = normalize( vNormal );\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal *= faceDirection;\\n\\t#endif\\n#endif\\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\\n\\t#ifdef USE_TANGENT\\n\\t\\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\\t#else\\n\\t\\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\\n\\t\\t#if defined( USE_NORMALMAP )\\n\\t\\t\\tvNormalMapUv\\n\\t\\t#elif defined( USE_CLEARCOAT_NORMALMAP )\\n\\t\\t\\tvClearcoatNormalMapUv\\n\\t\\t#else\\n\\t\\t\\tvUv\\n\\t\\t#endif\\n\\t\\t);\\n\\t#endif\\n\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\\t\\ttbn[0] *= faceDirection;\\n\\t\\ttbn[1] *= faceDirection;\\n\\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\t#ifdef USE_TANGENT\\n\\t\\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\\t#else\\n\\t\\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\\n\\t#endif\\n\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\\t\\ttbn2[0] *= faceDirection;\\n\\t\\ttbn2[1] *= faceDirection;\\n\\t#endif\\n#endif\\nvec3 nonPerturbedNormal = normal;\";\r\n\r\nvar normal_fragment_maps = \"#ifdef USE_NORMALMAP_OBJECTSPACE\\n\\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\\t#ifdef FLIP_SIDED\\n\\t\\tnormal = - normal;\\n\\t#endif\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal = normal * faceDirection;\\n\\t#endif\\n\\tnormal = normalize( normalMatrix * normal );\\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\\tmapN.xy *= normalScale;\\n\\tnormal = normalize( tbn * mapN );\\n#elif defined( USE_BUMPMAP )\\n\\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\\n#endif\";\r\n\r\nvar normal_pars_fragment = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\r\n\r\nvar normal_pars_vertex = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\r\n\r\nvar normal_vertex = \"#ifndef FLAT_SHADED\\n\\tvNormal = normalize( transformedNormal );\\n\\t#ifdef USE_TANGENT\\n\\t\\tvTangent = normalize( transformedTangent );\\n\\t\\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\\n\\t#endif\\n#endif\";\r\n\r\nvar normalmap_pars_fragment = \"#ifdef USE_NORMALMAP\\n\\tuniform sampler2D normalMap;\\n\\tuniform vec2 normalScale;\\n#endif\\n#ifdef USE_NORMALMAP_OBJECTSPACE\\n\\tuniform mat3 normalMatrix;\\n#endif\\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\\n\\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\\n\\t\\tvec3 q0 = dFdx( eye_pos.xyz );\\n\\t\\tvec3 q1 = dFdy( eye_pos.xyz );\\n\\t\\tvec2 st0 = dFdx( uv.st );\\n\\t\\tvec2 st1 = dFdy( uv.st );\\n\\t\\tvec3 N = surf_norm;\\n\\t\\tvec3 q1perp = cross( q1, N );\\n\\t\\tvec3 q0perp = cross( N, q0 );\\n\\t\\tvec3 T = q1perp * st0.x + q0perp * st1.x;\\n\\t\\tvec3 B = q1perp * st0.y + q0perp * st1.y;\\n\\t\\tfloat det = max( dot( T, T ), dot( B, B ) );\\n\\t\\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\\n\\t\\treturn mat3( T * scale, B * scale, N );\\n\\t}\\n#endif\";\r\n\r\nvar clearcoat_normal_fragment_begin = \"#ifdef USE_CLEARCOAT\\n\\tvec3 clearcoatNormal = nonPerturbedNormal;\\n#endif\";\r\n\r\nvar clearcoat_normal_fragment_maps = \"#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\\n\\tclearcoatMapN.xy *= clearcoatNormalScale;\\n\\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\\n#endif\";\r\n\r\nvar clearcoat_pars_fragment = \"#ifdef USE_CLEARCOATMAP\\n\\tuniform sampler2D clearcoatMap;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform sampler2D clearcoatNormalMap;\\n\\tuniform vec2 clearcoatNormalScale;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tuniform sampler2D clearcoatRoughnessMap;\\n#endif\";\r\n\r\nvar iridescence_pars_fragment = \"#ifdef USE_IRIDESCENCEMAP\\n\\tuniform sampler2D iridescenceMap;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tuniform sampler2D iridescenceThicknessMap;\\n#endif\";\r\n\r\nvar opaque_fragment = \"#ifdef OPAQUE\\ndiffuseColor.a = 1.0;\\n#endif\\n#ifdef USE_TRANSMISSION\\ndiffuseColor.a *= material.transmissionAlpha;\\n#endif\\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\";\r\n\r\nvar packing = \"vec3 packNormalToRGB( const in vec3 normal ) {\\n\\treturn normalize( normal ) * 0.5 + 0.5;\\n}\\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\\n\\treturn 2.0 * rgb.xyz - 1.0;\\n}\\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\\nconst float Inv255 = 1. / 255.;\\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\\nvec4 packDepthToRGBA( const in float v ) {\\n\\tif( v <= 0.0 )\\n\\t\\treturn vec4( 0., 0., 0., 0. );\\n\\tif( v >= 1.0 )\\n\\t\\treturn vec4( 1., 1., 1., 1. );\\n\\tfloat vuf;\\n\\tfloat af = modf( v * PackFactors.a, vuf );\\n\\tfloat bf = modf( vuf * ShiftRight8, vuf );\\n\\tfloat gf = modf( vuf * ShiftRight8, vuf );\\n\\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\\n}\\nvec3 packDepthToRGB( const in float v ) {\\n\\tif( v <= 0.0 )\\n\\t\\treturn vec3( 0., 0., 0. );\\n\\tif( v >= 1.0 )\\n\\t\\treturn vec3( 1., 1., 1. );\\n\\tfloat vuf;\\n\\tfloat bf = modf( v * PackFactors.b, vuf );\\n\\tfloat gf = modf( vuf * ShiftRight8, vuf );\\n\\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\\n}\\nvec2 packDepthToRG( const in float v ) {\\n\\tif( v <= 0.0 )\\n\\t\\treturn vec2( 0., 0. );\\n\\tif( v >= 1.0 )\\n\\t\\treturn vec2( 1., 1. );\\n\\tfloat vuf;\\n\\tfloat gf = modf( v * 256., vuf );\\n\\treturn vec2( vuf * Inv255, gf );\\n}\\nfloat unpackRGBAToDepth( const in vec4 v ) {\\n\\treturn dot( v, UnpackFactors4 );\\n}\\nfloat unpackRGBToDepth( const in vec3 v ) {\\n\\treturn dot( v, UnpackFactors3 );\\n}\\nfloat unpackRGToDepth( const in vec2 v ) {\\n\\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\\n}\\nvec4 pack2HalfToRGBA( const in vec2 v ) {\\n\\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\\n\\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\\n}\\nvec2 unpackRGBATo2Half( const in vec4 v ) {\\n\\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\\n}\\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\\n\\treturn ( viewZ + near ) / ( near - far );\\n}\\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\\n\\treturn depth * ( near - far ) - near;\\n}\\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\\n\\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\\n}\\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\\n\\treturn ( near * far ) / ( ( far - near ) * depth - far );\\n}\";\r\n\r\nvar premultiplied_alpha_fragment = \"#ifdef PREMULTIPLIED_ALPHA\\n\\tgl_FragColor.rgb *= gl_FragColor.a;\\n#endif\";\r\n\r\nvar project_vertex = \"vec4 mvPosition = vec4( transformed, 1.0 );\\n#ifdef USE_BATCHING\\n\\tmvPosition = batchingMatrix * mvPosition;\\n#endif\\n#ifdef USE_INSTANCING\\n\\tmvPosition = instanceMatrix * mvPosition;\\n#endif\\nmvPosition = modelViewMatrix * mvPosition;\\ngl_Position = projectionMatrix * mvPosition;\";\r\n\r\nvar dithering_fragment = \"#ifdef DITHERING\\n\\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\\n#endif\";\r\n\r\nvar dithering_pars_fragment = \"#ifdef DITHERING\\n\\tvec3 dithering( vec3 color ) {\\n\\t\\tfloat grid_position = rand( gl_FragCoord.xy );\\n\\t\\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\\n\\t\\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\\n\\t\\treturn color + dither_shift_RGB;\\n\\t}\\n#endif\";\r\n\r\nvar roughnessmap_fragment = \"float roughnessFactor = roughness;\\n#ifdef USE_ROUGHNESSMAP\\n\\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\\n\\troughnessFactor *= texelRoughness.g;\\n#endif\";\r\n\r\nvar roughnessmap_pars_fragment = \"#ifdef USE_ROUGHNESSMAP\\n\\tuniform sampler2D roughnessMap;\\n#endif\";\r\n\r\nvar shadowmap_pars_fragment = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#if NUM_SPOT_LIGHT_MAPS > 0\\n\\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\\n\\t\\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\\n\\t}\\n\\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\\n\\t\\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\\n\\t}\\n\\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\\n\\t\\tfloat occlusion = 1.0;\\n\\t\\tvec2 distribution = texture2DDistribution( shadow, uv );\\n\\t\\tfloat hard_shadow = step( compare , distribution.x );\\n\\t\\tif (hard_shadow != 1.0 ) {\\n\\t\\t\\tfloat distance = compare - distribution.x ;\\n\\t\\t\\tfloat variance = max( 0.00000, distribution.y * distribution.y );\\n\\t\\t\\tfloat softness_probability = variance / (variance + distance * distance );\\t\\t\\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\\t\\t\\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\\n\\t\\t}\\n\\t\\treturn occlusion;\\n\\t}\\n\\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\\n\\t\\tfloat shadow = 1.0;\\n\\t\\tshadowCoord.xyz /= shadowCoord.w;\\n\\t\\tshadowCoord.z += shadowBias;\\n\\t\\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\\n\\t\\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\\n\\t\\tif ( frustumTest ) {\\n\\t\\t#if defined( SHADOWMAP_TYPE_PCF )\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\\n\\t\\t\\tfloat dx0 = - texelSize.x * shadowRadius;\\n\\t\\t\\tfloat dy0 = - texelSize.y * shadowRadius;\\n\\t\\t\\tfloat dx1 = + texelSize.x * shadowRadius;\\n\\t\\t\\tfloat dy1 = + texelSize.y * shadowRadius;\\n\\t\\t\\tfloat dx2 = dx0 / 2.0;\\n\\t\\t\\tfloat dy2 = dy0 / 2.0;\\n\\t\\t\\tfloat dx3 = dx1 / 2.0;\\n\\t\\t\\tfloat dy3 = dy1 / 2.0;\\n\\t\\t\\tshadow = (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\\n\\t\\t\\t) * ( 1.0 / 17.0 );\\n\\t\\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\\n\\t\\t\\tfloat dx = texelSize.x;\\n\\t\\t\\tfloat dy = texelSize.y;\\n\\t\\t\\tvec2 uv = shadowCoord.xy;\\n\\t\\t\\tvec2 f = fract( uv * shadowMapSize + 0.5 );\\n\\t\\t\\tuv -= f * texelSize;\\n\\t\\t\\tshadow = (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.x ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.x ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.y ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.y ) +\\n\\t\\t\\t\\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t f.x ),\\n\\t\\t\\t\\t\\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t f.x ),\\n\\t\\t\\t\\t\\t f.y )\\n\\t\\t\\t) * ( 1.0 / 9.0 );\\n\\t\\t#elif defined( SHADOWMAP_TYPE_VSM )\\n\\t\\t\\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\\n\\t\\t#else\\n\\t\\t\\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\\n\\t\\t#endif\\n\\t\\t}\\n\\t\\treturn mix( 1.0, shadow, shadowIntensity );\\n\\t}\\n\\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\\n\\t\\tvec3 absV = abs( v );\\n\\t\\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\\n\\t\\tabsV *= scaleToCube;\\n\\t\\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\\n\\t\\tvec2 planar = v.xy;\\n\\t\\tfloat almostATexel = 1.5 * texelSizeY;\\n\\t\\tfloat almostOne = 1.0 - almostATexel;\\n\\t\\tif ( absV.z >= almostOne ) {\\n\\t\\t\\tif ( v.z > 0.0 )\\n\\t\\t\\t\\tplanar.x = 4.0 - v.x;\\n\\t\\t} else if ( absV.x >= almostOne ) {\\n\\t\\t\\tfloat signX = sign( v.x );\\n\\t\\t\\tplanar.x = v.z * signX + 2.0 * signX;\\n\\t\\t} else if ( absV.y >= almostOne ) {\\n\\t\\t\\tfloat signY = sign( v.y );\\n\\t\\t\\tplanar.x = v.x + 2.0 * signY + 2.0;\\n\\t\\t\\tplanar.y = v.z * signY - 2.0;\\n\\t\\t}\\n\\t\\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\\n\\t}\\n\\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\\n\\t\\tfloat shadow = 1.0;\\n\\t\\tvec3 lightToPosition = shadowCoord.xyz;\\n\\t\\t\\n\\t\\tfloat lightToPositionLength = length( lightToPosition );\\n\\t\\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\\n\\t\\t\\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\\t\\t\\tdp += shadowBias;\\n\\t\\t\\tvec3 bd3D = normalize( lightToPosition );\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\\n\\t\\t\\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\\n\\t\\t\\t\\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\\n\\t\\t\\t\\tshadow = (\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\\n\\t\\t\\t\\t) * ( 1.0 / 9.0 );\\n\\t\\t\\t#else\\n\\t\\t\\t\\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\\n\\t\\t\\t#endif\\n\\t\\t}\\n\\t\\treturn mix( 1.0, shadow, shadowIntensity );\\n\\t}\\n#endif\";\r\n\r\nvar shadowmap_pars_vertex = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\\n\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowIntensity;\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n#endif\";\r\n\r\nvar shadowmap_vertex = \"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\\n\\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\\tvec4 shadowWorldPosition;\\n#endif\\n#if defined( USE_SHADOWMAP )\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\t\\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\t\\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n#endif\\n#if NUM_SPOT_LIGHT_COORDS > 0\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\\n\\t\\tshadowWorldPosition = worldPosition;\\n\\t\\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\t\\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\\n\\t\\t#endif\\n\\t\\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\";\r\n\r\nvar shadowmask_pars_fragment = \"float getShadowMask() {\\n\\tfloat shadow = 1.0;\\n\\t#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\tDirectionalLightShadow directionalLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\tSpotLightShadow spotLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tspotLight = spotLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\tPointLightShadow pointLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tpointLight = pointLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#endif\\n\\treturn shadow;\\n}\";\r\n\r\nvar skinbase_vertex = \"#ifdef USE_SKINNING\\n\\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\\n\\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\\n\\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\\n\\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\\n#endif\";\r\n\r\nvar skinning_pars_vertex = \"#ifdef USE_SKINNING\\n\\tuniform mat4 bindMatrix;\\n\\tuniform mat4 bindMatrixInverse;\\n\\tuniform highp sampler2D boneTexture;\\n\\tmat4 getBoneMatrix( const in float i ) {\\n\\t\\tint size = textureSize( boneTexture, 0 ).x;\\n\\t\\tint j = int( i ) * 4;\\n\\t\\tint x = j % size;\\n\\t\\tint y = j / size;\\n\\t\\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\\n\\t\\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\\n\\t\\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\\n\\t\\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\\n\\t\\treturn mat4( v1, v2, v3, v4 );\\n\\t}\\n#endif\";\r\n\r\nvar skinning_vertex = \"#ifdef USE_SKINNING\\n\\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\\n\\tvec4 skinned = vec4( 0.0 );\\n\\tskinned += boneMatX * skinVertex * skinWeight.x;\\n\\tskinned += boneMatY * skinVertex * skinWeight.y;\\n\\tskinned += boneMatZ * skinVertex * skinWeight.z;\\n\\tskinned += boneMatW * skinVertex * skinWeight.w;\\n\\ttransformed = ( bindMatrixInverse * skinned ).xyz;\\n#endif\";\r\n\r\nvar skinnormal_vertex = \"#ifdef USE_SKINNING\\n\\tmat4 skinMatrix = mat4( 0.0 );\\n\\tskinMatrix += skinWeight.x * boneMatX;\\n\\tskinMatrix += skinWeight.y * boneMatY;\\n\\tskinMatrix += skinWeight.z * boneMatZ;\\n\\tskinMatrix += skinWeight.w * boneMatW;\\n\\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\\n\\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\\n\\t#ifdef USE_TANGENT\\n\\t\\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\\n\\t#endif\\n#endif\";\r\n\r\nvar specularmap_fragment = \"float specularStrength;\\n#ifdef USE_SPECULARMAP\\n\\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\\n\\tspecularStrength = texelSpecular.r;\\n#else\\n\\tspecularStrength = 1.0;\\n#endif\";\r\n\r\nvar specularmap_pars_fragment = \"#ifdef USE_SPECULARMAP\\n\\tuniform sampler2D specularMap;\\n#endif\";\r\n\r\nvar tonemapping_fragment = \"#if defined( TONE_MAPPING )\\n\\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\\n#endif\";\r\n\r\nvar tonemapping_pars_fragment = \"#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\nuniform float toneMappingExposure;\\nvec3 LinearToneMapping( vec3 color ) {\\n\\treturn saturate( toneMappingExposure * color );\\n}\\nvec3 ReinhardToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\treturn saturate( color / ( vec3( 1.0 ) + color ) );\\n}\\nvec3 CineonToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\tcolor = max( vec3( 0.0 ), color - 0.004 );\\n\\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\\n}\\nvec3 RRTAndODTFit( vec3 v ) {\\n\\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\\n\\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\\n\\treturn a / b;\\n}\\nvec3 ACESFilmicToneMapping( vec3 color ) {\\n\\tconst mat3 ACESInputMat = mat3(\\n\\t\\tvec3( 0.59719, 0.07600, 0.02840 ),\\t\\tvec3( 0.35458, 0.90834, 0.13383 ),\\n\\t\\tvec3( 0.04823, 0.01566, 0.83777 )\\n\\t);\\n\\tconst mat3 ACESOutputMat = mat3(\\n\\t\\tvec3( 1.60475, -0.10208, -0.00327 ),\\t\\tvec3( -0.53108, 1.10813, -0.07276 ),\\n\\t\\tvec3( -0.07367, -0.00605, 1.07602 )\\n\\t);\\n\\tcolor *= toneMappingExposure / 0.6;\\n\\tcolor = ACESInputMat * color;\\n\\tcolor = RRTAndODTFit( color );\\n\\tcolor = ACESOutputMat * color;\\n\\treturn saturate( color );\\n}\\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\\n\\tvec3( 1.6605, - 0.1246, - 0.0182 ),\\n\\tvec3( - 0.5876, 1.1329, - 0.1006 ),\\n\\tvec3( - 0.0728, - 0.0083, 1.1187 )\\n);\\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\\n\\tvec3( 0.6274, 0.0691, 0.0164 ),\\n\\tvec3( 0.3293, 0.9195, 0.0880 ),\\n\\tvec3( 0.0433, 0.0113, 0.8956 )\\n);\\nvec3 agxDefaultContrastApprox( vec3 x ) {\\n\\tvec3 x2 = x * x;\\n\\tvec3 x4 = x2 * x2;\\n\\treturn + 15.5 * x4 * x2\\n\\t\\t- 40.14 * x4 * x\\n\\t\\t+ 31.96 * x4\\n\\t\\t- 6.868 * x2 * x\\n\\t\\t+ 0.4298 * x2\\n\\t\\t+ 0.1191 * x\\n\\t\\t- 0.00232;\\n}\\nvec3 AgXToneMapping( vec3 color ) {\\n\\tconst mat3 AgXInsetMatrix = mat3(\\n\\t\\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\\n\\t\\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\\n\\t\\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\\n\\t);\\n\\tconst mat3 AgXOutsetMatrix = mat3(\\n\\t\\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\\n\\t\\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\\n\\t\\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\\n\\t);\\n\\tconst float AgxMinEv = - 12.47393;\\tconst float AgxMaxEv = 4.026069;\\n\\tcolor *= toneMappingExposure;\\n\\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\\n\\tcolor = AgXInsetMatrix * color;\\n\\tcolor = max( color, 1e-10 );\\tcolor = log2( color );\\n\\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\\n\\tcolor = clamp( color, 0.0, 1.0 );\\n\\tcolor = agxDefaultContrastApprox( color );\\n\\tcolor = AgXOutsetMatrix * color;\\n\\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\\n\\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\\n\\tcolor = clamp( color, 0.0, 1.0 );\\n\\treturn color;\\n}\\nvec3 NeutralToneMapping( vec3 color ) {\\n\\tconst float StartCompression = 0.8 - 0.04;\\n\\tconst float Desaturation = 0.15;\\n\\tcolor *= toneMappingExposure;\\n\\tfloat x = min( color.r, min( color.g, color.b ) );\\n\\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\\n\\tcolor -= offset;\\n\\tfloat peak = max( color.r, max( color.g, color.b ) );\\n\\tif ( peak < StartCompression ) return color;\\n\\tfloat d = 1. - StartCompression;\\n\\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\\n\\tcolor *= newPeak / peak;\\n\\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\\n\\treturn mix( color, vec3( newPeak ), g );\\n}\\nvec3 CustomToneMapping( vec3 color ) { return color; }\";\r\n\r\nvar transmission_fragment = \"#ifdef USE_TRANSMISSION\\n\\tmaterial.transmission = transmission;\\n\\tmaterial.transmissionAlpha = 1.0;\\n\\tmaterial.thickness = thickness;\\n\\tmaterial.attenuationDistance = attenuationDistance;\\n\\tmaterial.attenuationColor = attenuationColor;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\\n\\t#endif\\n\\tvec3 pos = vWorldPosition;\\n\\tvec3 v = normalize( cameraPosition - pos );\\n\\tvec3 n = inverseTransformDirection( normal, viewMatrix );\\n\\tvec4 transmitted = getIBLVolumeRefraction(\\n\\t\\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\\n\\t\\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\\n\\t\\tmaterial.attenuationColor, material.attenuationDistance );\\n\\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\\n\\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\\n#endif\";\r\n\r\nvar transmission_pars_fragment = \"#ifdef USE_TRANSMISSION\\n\\tuniform float transmission;\\n\\tuniform float thickness;\\n\\tuniform float attenuationDistance;\\n\\tuniform vec3 attenuationColor;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\tuniform sampler2D transmissionMap;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tuniform sampler2D thicknessMap;\\n\\t#endif\\n\\tuniform vec2 transmissionSamplerSize;\\n\\tuniform sampler2D transmissionSamplerMap;\\n\\tuniform mat4 modelMatrix;\\n\\tuniform mat4 projectionMatrix;\\n\\tvarying vec3 vWorldPosition;\\n\\tfloat w0( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\\n\\t}\\n\\tfloat w1( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\\n\\t}\\n\\tfloat w2( float a ){\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\\n\\t}\\n\\tfloat w3( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * a * a );\\n\\t}\\n\\tfloat g0( float a ) {\\n\\t\\treturn w0( a ) + w1( a );\\n\\t}\\n\\tfloat g1( float a ) {\\n\\t\\treturn w2( a ) + w3( a );\\n\\t}\\n\\tfloat h0( float a ) {\\n\\t\\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\\n\\t}\\n\\tfloat h1( float a ) {\\n\\t\\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\\n\\t}\\n\\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\\n\\t\\tuv = uv * texelSize.zw + 0.5;\\n\\t\\tvec2 iuv = floor( uv );\\n\\t\\tvec2 fuv = fract( uv );\\n\\t\\tfloat g0x = g0( fuv.x );\\n\\t\\tfloat g1x = g1( fuv.x );\\n\\t\\tfloat h0x = h0( fuv.x );\\n\\t\\tfloat h1x = h1( fuv.x );\\n\\t\\tfloat h0y = h0( fuv.y );\\n\\t\\tfloat h1y = h1( fuv.y );\\n\\t\\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\\t\\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\\n\\t\\t\\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\\n\\t}\\n\\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\\n\\t\\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\\n\\t\\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\\n\\t\\tvec2 fLodSizeInv = 1.0 / fLodSize;\\n\\t\\tvec2 cLodSizeInv = 1.0 / cLodSize;\\n\\t\\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\\n\\t\\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\\n\\t\\treturn mix( fSample, cSample, fract( lod ) );\\n\\t}\\n\\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\\n\\t\\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\\n\\t\\tvec3 modelScale;\\n\\t\\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\\n\\t\\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\\n\\t\\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\\n\\t\\treturn normalize( refractionVector ) * thickness * modelScale;\\n\\t}\\n\\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\\n\\t\\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\\n\\t}\\n\\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\\n\\t\\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\\n\\t\\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\\n\\t}\\n\\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tif ( isinf( attenuationDistance ) ) {\\n\\t\\t\\treturn vec3( 1.0 );\\n\\t\\t} else {\\n\\t\\t\\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\\n\\t\\t\\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\\t\\t\\treturn transmittance;\\n\\t\\t}\\n\\t}\\n\\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\\n\\t\\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\\n\\t\\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\\n\\t\\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tvec4 transmittedLight;\\n\\t\\tvec3 transmittance;\\n\\t\\t#ifdef USE_DISPERSION\\n\\t\\t\\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\\n\\t\\t\\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\\n\\t\\t\\tfor ( int i = 0; i < 3; i ++ ) {\\n\\t\\t\\t\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\\n\\t\\t\\t\\tvec3 refractedRayExit = position + transmissionRay;\\n\\t\\t\\n\\t\\t\\t\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\\t\\t\\t\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\\t\\t\\t\\trefractionCoords += 1.0;\\n\\t\\t\\t\\trefractionCoords /= 2.0;\\n\\t\\t\\n\\t\\t\\t\\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\\n\\t\\t\\t\\ttransmittedLight[ i ] = transmissionSample[ i ];\\n\\t\\t\\t\\ttransmittedLight.a += transmissionSample.a;\\n\\t\\t\\t\\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\\n\\t\\t\\t}\\n\\t\\t\\ttransmittedLight.a /= 3.0;\\n\\t\\t\\n\\t\\t#else\\n\\t\\t\\n\\t\\t\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\\n\\t\\t\\tvec3 refractedRayExit = position + transmissionRay;\\n\\t\\t\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\\t\\t\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\\t\\t\\trefractionCoords += 1.0;\\n\\t\\t\\trefractionCoords /= 2.0;\\n\\t\\t\\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\\n\\t\\t\\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\\n\\t\\t\\n\\t\\t#endif\\n\\t\\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\\n\\t\\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\\n\\t\\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\\n\\t\\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\\n\\t}\\n#endif\";\r\n\r\nvar uv_pars_fragment = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tuniform mat3 transmissionMapTransform;\\n\\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tuniform mat3 thicknessMapTransform;\\n\\tvarying vec2 vThicknessMapUv;\\n#endif\";\r\n\r\nvar uv_pars_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\\tuniform mat3 mapTransform;\\n\\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform mat3 alphaMapTransform;\\n\\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tuniform mat3 lightMapTransform;\\n\\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\\tuniform mat3 aoMapTransform;\\n\\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tuniform mat3 bumpMapTransform;\\n\\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tuniform mat3 normalMapTransform;\\n\\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\\tuniform mat3 displacementMapTransform;\\n\\tvarying vec2 vDisplacementMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tuniform mat3 emissiveMapTransform;\\n\\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tuniform mat3 metalnessMapTransform;\\n\\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tuniform mat3 roughnessMapTransform;\\n\\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tuniform mat3 anisotropyMapTransform;\\n\\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tuniform mat3 clearcoatMapTransform;\\n\\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform mat3 clearcoatNormalMapTransform;\\n\\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tuniform mat3 clearcoatRoughnessMapTransform;\\n\\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tuniform mat3 sheenColorMapTransform;\\n\\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tuniform mat3 sheenRoughnessMapTransform;\\n\\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tuniform mat3 iridescenceMapTransform;\\n\\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tuniform mat3 iridescenceThicknessMapTransform;\\n\\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tuniform mat3 specularMapTransform;\\n\\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tuniform mat3 specularColorMapTransform;\\n\\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tuniform mat3 specularIntensityMapTransform;\\n\\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tuniform mat3 transmissionMapTransform;\\n\\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tuniform mat3 thicknessMapTransform;\\n\\tvarying vec2 vThicknessMapUv;\\n#endif\";\r\n\r\nvar uv_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvUv = vec3( uv, 1 ).xy;\\n#endif\\n#ifdef USE_MAP\\n\\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_AOMAP\\n\\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\";\r\n\r\nvar worldpos_vertex = \"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\\n\\tvec4 worldPosition = vec4( transformed, 1.0 );\\n\\t#ifdef USE_BATCHING\\n\\t\\tworldPosition = batchingMatrix * worldPosition;\\n\\t#endif\\n\\t#ifdef USE_INSTANCING\\n\\t\\tworldPosition = instanceMatrix * worldPosition;\\n\\t#endif\\n\\tworldPosition = modelMatrix * worldPosition;\\n#endif\";\r\n\r\nconst vertex$h = \"varying vec2 vUv;\\nuniform mat3 uvTransform;\\nvoid main() {\\n\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\\tgl_Position = vec4( position.xy, 1.0, 1.0 );\\n}\";\r\n\r\nconst fragment$h = \"uniform sampler2D t2D;\\nuniform float backgroundIntensity;\\nvarying vec2 vUv;\\nvoid main() {\\n\\tvec4 texColor = texture2D( t2D, vUv );\\n\\t#ifdef DECODE_VIDEO_TEXTURE\\n\\t\\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\\n\\t#endif\\n\\ttexColor.rgb *= backgroundIntensity;\\n\\tgl_FragColor = texColor;\\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst vertex$g = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n\\tgl_Position.z = gl_Position.w;\\n}\";\r\n\r\nconst fragment$g = \"#ifdef ENVMAP_TYPE_CUBE\\n\\tuniform samplerCube envMap;\\n#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\tuniform sampler2D envMap;\\n#endif\\nuniform float flipEnvMap;\\nuniform float backgroundBlurriness;\\nuniform float backgroundIntensity;\\nuniform mat3 backgroundRotation;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\\n\\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\\n\\t#else\\n\\t\\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\\n\\t#endif\\n\\ttexColor.rgb *= backgroundIntensity;\\n\\tgl_FragColor = texColor;\\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst vertex$f = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n\\tgl_Position.z = gl_Position.w;\\n}\";\r\n\r\nconst fragment$f = \"uniform samplerCube tCube;\\nuniform float tFlip;\\nuniform float opacity;\\nvarying vec3 vWorldDirection;\\nvoid main() {\\n\\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\\n\\tgl_FragColor = texColor;\\n\\tgl_FragColor.a *= opacity;\\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst vertex$e = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvHighPrecisionZW = gl_Position.zw;\\n}\";\r\n\r\nconst fragment$e = \"#if DEPTH_PACKING == 3200\\n\\tuniform float opacity;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include \\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tdiffuseColor.a = opacity;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\\n\\t#elif DEPTH_PACKING == 3201\\n\\t\\tgl_FragColor = packDepthToRGBA( fragCoordZ );\\n\\t#elif DEPTH_PACKING == 3202\\n\\t\\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\\n\\t#elif DEPTH_PACKING == 3203\\n\\t\\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\\n\\t#endif\\n}\";\r\n\r\nconst vertex$d = \"#define DISTANCE\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvWorldPosition = worldPosition.xyz;\\n}\";\r\n\r\nconst fragment$d = \"#define DISTANCE\\nuniform vec3 referencePosition;\\nuniform float nearDistance;\\nuniform float farDistance;\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main () {\\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tfloat dist = length( vWorldPosition - referencePosition );\\n\\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\\n\\tdist = saturate( dist );\\n\\tgl_FragColor = packDepthToRGBA( dist );\\n}\";\r\n\r\nconst vertex$c = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst fragment$c = \"uniform sampler2D tEquirect;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvec3 direction = normalize( vWorldDirection );\\n\\tvec2 sampleUV = equirectUv( direction );\\n\\tgl_FragColor = texture2D( tEquirect, sampleUV );\\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst vertex$b = \"uniform float scale;\\nattribute float lineDistance;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvLineDistance = scale * lineDistance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst fragment$b = \"uniform vec3 diffuse;\\nuniform float opacity;\\nuniform float dashSize;\\nuniform float totalSize;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\\n\\t\\tdiscard;\\n\\t}\\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst vertex$a = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst fragment$a = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\t\\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\\n\\t#else\\n\\t\\treflectedLight.indirectDiffuse += vec3( 1.0 );\\n\\t#endif\\n\\t#include \\n\\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\\n\\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst vertex$9 = \"#define LAMBERT\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst fragment$9 = \"#define LAMBERT\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst vertex$8 = \"#define MATCAP\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n}\";\r\n\r\nconst fragment$8 = \"#define MATCAP\\nuniform vec3 diffuse;\\nuniform float opacity;\\nuniform sampler2D matcap;\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 viewDir = normalize( vViewPosition );\\n\\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\\n\\tvec3 y = cross( viewDir, x );\\n\\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\\n\\t#ifdef USE_MATCAP\\n\\t\\tvec4 matcapColor = texture2D( matcap, uv );\\n\\t#else\\n\\t\\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\\n\\t#endif\\n\\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst vertex$7 = \"#define NORMAL\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvViewPosition = - mvPosition.xyz;\\n#endif\\n}\";\r\n\r\nconst fragment$7 = \"#define NORMAL\\nuniform float opacity;\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\\n\\t#ifdef OPAQUE\\n\\t\\tgl_FragColor.a = 1.0;\\n\\t#endif\\n}\";\r\n\r\nconst vertex$6 = \"#define PHONG\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst fragment$6 = \"#define PHONG\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform vec3 specular;\\nuniform float shininess;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst vertex$5 = \"#define STANDARD\\nvarying vec3 vViewPosition;\\n#ifdef USE_TRANSMISSION\\n\\tvarying vec3 vWorldPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n#ifdef USE_TRANSMISSION\\n\\tvWorldPosition = worldPosition.xyz;\\n#endif\\n}\";\r\n\r\nconst fragment$5 = \"#define STANDARD\\n#ifdef PHYSICAL\\n\\t#define IOR\\n\\t#define USE_SPECULAR\\n#endif\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float roughness;\\nuniform float metalness;\\nuniform float opacity;\\n#ifdef IOR\\n\\tuniform float ior;\\n#endif\\n#ifdef USE_SPECULAR\\n\\tuniform float specularIntensity;\\n\\tuniform vec3 specularColor;\\n\\t#ifdef USE_SPECULAR_COLORMAP\\n\\t\\tuniform sampler2D specularColorMap;\\n\\t#endif\\n\\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\\t\\tuniform sampler2D specularIntensityMap;\\n\\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tuniform float clearcoat;\\n\\tuniform float clearcoatRoughness;\\n#endif\\n#ifdef USE_DISPERSION\\n\\tuniform float dispersion;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tuniform float iridescence;\\n\\tuniform float iridescenceIOR;\\n\\tuniform float iridescenceThicknessMinimum;\\n\\tuniform float iridescenceThicknessMaximum;\\n#endif\\n#ifdef USE_SHEEN\\n\\tuniform vec3 sheenColor;\\n\\tuniform float sheenRoughness;\\n\\t#ifdef USE_SHEEN_COLORMAP\\n\\t\\tuniform sampler2D sheenColorMap;\\n\\t#endif\\n\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\t\\tuniform sampler2D sheenRoughnessMap;\\n\\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\\tuniform vec2 anisotropyVector;\\n\\t#ifdef USE_ANISOTROPYMAP\\n\\t\\tuniform sampler2D anisotropyMap;\\n\\t#endif\\n#endif\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\\n\\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\\n\\t#include \\n\\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\\n\\t#ifdef USE_SHEEN\\n\\t\\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\\n\\t\\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\\n\\t\\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\\n\\t\\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst vertex$4 = \"#define TOON\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst fragment$4 = \"#define TOON\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst vertex$3 = \"uniform float size;\\nuniform float scale;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#ifdef USE_POINTS_UV\\n\\tvarying vec2 vUv;\\n\\tuniform mat3 uvTransform;\\n#endif\\nvoid main() {\\n\\t#ifdef USE_POINTS_UV\\n\\t\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tgl_PointSize = size;\\n\\t#ifdef USE_SIZEATTENUATION\\n\\t\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\n\\t\\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst fragment$3 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst vertex$2 = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst fragment$2 = \"uniform vec3 color;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst vertex$1 = \"uniform float rotation;\\nuniform vec2 center;\\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\\n\\tvec2 scale;\\n\\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\\n\\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\\n\\t#ifndef USE_SIZEATTENUATION\\n\\t\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\n\\t\\tif ( isPerspective ) scale *= - mvPosition.z;\\n\\t#endif\\n\\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\\n\\tvec2 rotatedPosition;\\n\\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\\n\\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\\n\\tmvPosition.xy += rotatedPosition;\\n\\tgl_Position = projectionMatrix * mvPosition;\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst fragment$1 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\r\n\r\nconst ShaderChunk = {\r\n\talphahash_fragment: alphahash_fragment,\r\n\talphahash_pars_fragment: alphahash_pars_fragment,\r\n\talphamap_fragment: alphamap_fragment,\r\n\talphamap_pars_fragment: alphamap_pars_fragment,\r\n\talphatest_fragment: alphatest_fragment,\r\n\talphatest_pars_fragment: alphatest_pars_fragment,\r\n\taomap_fragment: aomap_fragment,\r\n\taomap_pars_fragment: aomap_pars_fragment,\r\n\tbatching_pars_vertex: batching_pars_vertex,\r\n\tbatching_vertex: batching_vertex,\r\n\tbegin_vertex: begin_vertex,\r\n\tbeginnormal_vertex: beginnormal_vertex,\r\n\tbsdfs: bsdfs,\r\n\tiridescence_fragment: iridescence_fragment,\r\n\tbumpmap_pars_fragment: bumpmap_pars_fragment,\r\n\tclipping_planes_fragment: clipping_planes_fragment,\r\n\tclipping_planes_pars_fragment: clipping_planes_pars_fragment,\r\n\tclipping_planes_pars_vertex: clipping_planes_pars_vertex,\r\n\tclipping_planes_vertex: clipping_planes_vertex,\r\n\tcolor_fragment: color_fragment,\r\n\tcolor_pars_fragment: color_pars_fragment,\r\n\tcolor_pars_vertex: color_pars_vertex,\r\n\tcolor_vertex: color_vertex,\r\n\tcommon: common,\r\n\tcube_uv_reflection_fragment: cube_uv_reflection_fragment,\r\n\tdefaultnormal_vertex: defaultnormal_vertex,\r\n\tdisplacementmap_pars_vertex: displacementmap_pars_vertex,\r\n\tdisplacementmap_vertex: displacementmap_vertex,\r\n\temissivemap_fragment: emissivemap_fragment,\r\n\temissivemap_pars_fragment: emissivemap_pars_fragment,\r\n\tcolorspace_fragment: colorspace_fragment,\r\n\tcolorspace_pars_fragment: colorspace_pars_fragment,\r\n\tenvmap_fragment: envmap_fragment,\r\n\tenvmap_common_pars_fragment: envmap_common_pars_fragment,\r\n\tenvmap_pars_fragment: envmap_pars_fragment,\r\n\tenvmap_pars_vertex: envmap_pars_vertex,\r\n\tenvmap_physical_pars_fragment: envmap_physical_pars_fragment,\r\n\tenvmap_vertex: envmap_vertex,\r\n\tfog_vertex: fog_vertex,\r\n\tfog_pars_vertex: fog_pars_vertex,\r\n\tfog_fragment: fog_fragment,\r\n\tfog_pars_fragment: fog_pars_fragment,\r\n\tgradientmap_pars_fragment: gradientmap_pars_fragment,\r\n\tlightmap_pars_fragment: lightmap_pars_fragment,\r\n\tlights_lambert_fragment: lights_lambert_fragment,\r\n\tlights_lambert_pars_fragment: lights_lambert_pars_fragment,\r\n\tlights_pars_begin: lights_pars_begin,\r\n\tlights_toon_fragment: lights_toon_fragment,\r\n\tlights_toon_pars_fragment: lights_toon_pars_fragment,\r\n\tlights_phong_fragment: lights_phong_fragment,\r\n\tlights_phong_pars_fragment: lights_phong_pars_fragment,\r\n\tlights_physical_fragment: lights_physical_fragment,\r\n\tlights_physical_pars_fragment: lights_physical_pars_fragment,\r\n\tlights_fragment_begin: lights_fragment_begin,\r\n\tlights_fragment_maps: lights_fragment_maps,\r\n\tlights_fragment_end: lights_fragment_end,\r\n\tlogdepthbuf_fragment: logdepthbuf_fragment,\r\n\tlogdepthbuf_pars_fragment: logdepthbuf_pars_fragment,\r\n\tlogdepthbuf_pars_vertex: logdepthbuf_pars_vertex,\r\n\tlogdepthbuf_vertex: logdepthbuf_vertex,\r\n\tmap_fragment: map_fragment,\r\n\tmap_pars_fragment: map_pars_fragment,\r\n\tmap_particle_fragment: map_particle_fragment,\r\n\tmap_particle_pars_fragment: map_particle_pars_fragment,\r\n\tmetalnessmap_fragment: metalnessmap_fragment,\r\n\tmetalnessmap_pars_fragment: metalnessmap_pars_fragment,\r\n\tmorphinstance_vertex: morphinstance_vertex,\r\n\tmorphcolor_vertex: morphcolor_vertex,\r\n\tmorphnormal_vertex: morphnormal_vertex,\r\n\tmorphtarget_pars_vertex: morphtarget_pars_vertex,\r\n\tmorphtarget_vertex: morphtarget_vertex,\r\n\tnormal_fragment_begin: normal_fragment_begin,\r\n\tnormal_fragment_maps: normal_fragment_maps,\r\n\tnormal_pars_fragment: normal_pars_fragment,\r\n\tnormal_pars_vertex: normal_pars_vertex,\r\n\tnormal_vertex: normal_vertex,\r\n\tnormalmap_pars_fragment: normalmap_pars_fragment,\r\n\tclearcoat_normal_fragment_begin: clearcoat_normal_fragment_begin,\r\n\tclearcoat_normal_fragment_maps: clearcoat_normal_fragment_maps,\r\n\tclearcoat_pars_fragment: clearcoat_pars_fragment,\r\n\tiridescence_pars_fragment: iridescence_pars_fragment,\r\n\topaque_fragment: opaque_fragment,\r\n\tpacking: packing,\r\n\tpremultiplied_alpha_fragment: premultiplied_alpha_fragment,\r\n\tproject_vertex: project_vertex,\r\n\tdithering_fragment: dithering_fragment,\r\n\tdithering_pars_fragment: dithering_pars_fragment,\r\n\troughnessmap_fragment: roughnessmap_fragment,\r\n\troughnessmap_pars_fragment: roughnessmap_pars_fragment,\r\n\tshadowmap_pars_fragment: shadowmap_pars_fragment,\r\n\tshadowmap_pars_vertex: shadowmap_pars_vertex,\r\n\tshadowmap_vertex: shadowmap_vertex,\r\n\tshadowmask_pars_fragment: shadowmask_pars_fragment,\r\n\tskinbase_vertex: skinbase_vertex,\r\n\tskinning_pars_vertex: skinning_pars_vertex,\r\n\tskinning_vertex: skinning_vertex,\r\n\tskinnormal_vertex: skinnormal_vertex,\r\n\tspecularmap_fragment: specularmap_fragment,\r\n\tspecularmap_pars_fragment: specularmap_pars_fragment,\r\n\ttonemapping_fragment: tonemapping_fragment,\r\n\ttonemapping_pars_fragment: tonemapping_pars_fragment,\r\n\ttransmission_fragment: transmission_fragment,\r\n\ttransmission_pars_fragment: transmission_pars_fragment,\r\n\tuv_pars_fragment: uv_pars_fragment,\r\n\tuv_pars_vertex: uv_pars_vertex,\r\n\tuv_vertex: uv_vertex,\r\n\tworldpos_vertex: worldpos_vertex,\r\n\r\n\tbackground_vert: vertex$h,\r\n\tbackground_frag: fragment$h,\r\n\tbackgroundCube_vert: vertex$g,\r\n\tbackgroundCube_frag: fragment$g,\r\n\tcube_vert: vertex$f,\r\n\tcube_frag: fragment$f,\r\n\tdepth_vert: vertex$e,\r\n\tdepth_frag: fragment$e,\r\n\tdistanceRGBA_vert: vertex$d,\r\n\tdistanceRGBA_frag: fragment$d,\r\n\tequirect_vert: vertex$c,\r\n\tequirect_frag: fragment$c,\r\n\tlinedashed_vert: vertex$b,\r\n\tlinedashed_frag: fragment$b,\r\n\tmeshbasic_vert: vertex$a,\r\n\tmeshbasic_frag: fragment$a,\r\n\tmeshlambert_vert: vertex$9,\r\n\tmeshlambert_frag: fragment$9,\r\n\tmeshmatcap_vert: vertex$8,\r\n\tmeshmatcap_frag: fragment$8,\r\n\tmeshnormal_vert: vertex$7,\r\n\tmeshnormal_frag: fragment$7,\r\n\tmeshphong_vert: vertex$6,\r\n\tmeshphong_frag: fragment$6,\r\n\tmeshphysical_vert: vertex$5,\r\n\tmeshphysical_frag: fragment$5,\r\n\tmeshtoon_vert: vertex$4,\r\n\tmeshtoon_frag: fragment$4,\r\n\tpoints_vert: vertex$3,\r\n\tpoints_frag: fragment$3,\r\n\tshadow_vert: vertex$2,\r\n\tshadow_frag: fragment$2,\r\n\tsprite_vert: vertex$1,\r\n\tsprite_frag: fragment$1\r\n};\r\n\r\n/**\r\n * Uniforms library for shared webgl shaders\r\n */\r\n\r\nconst UniformsLib = {\r\n\r\n\tcommon: {\r\n\r\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\r\n\t\topacity: { value: 1.0 },\r\n\r\n\t\tmap: { value: null },\r\n\t\tmapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\r\n\t\talphaMap: { value: null },\r\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\r\n\t\talphaTest: { value: 0 }\r\n\r\n\t},\r\n\r\n\tspecularmap: {\r\n\r\n\t\tspecularMap: { value: null },\r\n\t\tspecularMapTransform: { value: /*@__PURE__*/ new Matrix3() }\r\n\r\n\t},\r\n\r\n\tenvmap: {\r\n\r\n\t\tenvMap: { value: null },\r\n\t\tenvMapRotation: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\tflipEnvMap: { value: - 1 },\r\n\t\treflectivity: { value: 1.0 }, // basic, lambert, phong\r\n\t\tior: { value: 1.5 }, // physical\r\n\t\trefractionRatio: { value: 0.98 }, // basic, lambert, phong\r\n\r\n\t},\r\n\r\n\taomap: {\r\n\r\n\t\taoMap: { value: null },\r\n\t\taoMapIntensity: { value: 1 },\r\n\t\taoMapTransform: { value: /*@__PURE__*/ new Matrix3() }\r\n\r\n\t},\r\n\r\n\tlightmap: {\r\n\r\n\t\tlightMap: { value: null },\r\n\t\tlightMapIntensity: { value: 1 },\r\n\t\tlightMapTransform: { value: /*@__PURE__*/ new Matrix3() }\r\n\r\n\t},\r\n\r\n\tbumpmap: {\r\n\r\n\t\tbumpMap: { value: null },\r\n\t\tbumpMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\tbumpScale: { value: 1 }\r\n\r\n\t},\r\n\r\n\tnormalmap: {\r\n\r\n\t\tnormalMap: { value: null },\r\n\t\tnormalMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\tnormalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) }\r\n\r\n\t},\r\n\r\n\tdisplacementmap: {\r\n\r\n\t\tdisplacementMap: { value: null },\r\n\t\tdisplacementMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\tdisplacementScale: { value: 1 },\r\n\t\tdisplacementBias: { value: 0 }\r\n\r\n\t},\r\n\r\n\temissivemap: {\r\n\r\n\t\temissiveMap: { value: null },\r\n\t\temissiveMapTransform: { value: /*@__PURE__*/ new Matrix3() }\r\n\r\n\t},\r\n\r\n\tmetalnessmap: {\r\n\r\n\t\tmetalnessMap: { value: null },\r\n\t\tmetalnessMapTransform: { value: /*@__PURE__*/ new Matrix3() }\r\n\r\n\t},\r\n\r\n\troughnessmap: {\r\n\r\n\t\troughnessMap: { value: null },\r\n\t\troughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() }\r\n\r\n\t},\r\n\r\n\tgradientmap: {\r\n\r\n\t\tgradientMap: { value: null }\r\n\r\n\t},\r\n\r\n\tfog: {\r\n\r\n\t\tfogDensity: { value: 0.00025 },\r\n\t\tfogNear: { value: 1 },\r\n\t\tfogFar: { value: 2000 },\r\n\t\tfogColor: { value: /*@__PURE__*/ new Color( 0xffffff ) }\r\n\r\n\t},\r\n\r\n\tlights: {\r\n\r\n\t\tambientLightColor: { value: [] },\r\n\r\n\t\tlightProbe: { value: [] },\r\n\r\n\t\tdirectionalLights: { value: [], properties: {\r\n\t\t\tdirection: {},\r\n\t\t\tcolor: {}\r\n\t\t} },\r\n\r\n\t\tdirectionalLightShadows: { value: [], properties: {\r\n\t\t\tshadowIntensity: 1,\r\n\t\t\tshadowBias: {},\r\n\t\t\tshadowNormalBias: {},\r\n\t\t\tshadowRadius: {},\r\n\t\t\tshadowMapSize: {}\r\n\t\t} },\r\n\r\n\t\tdirectionalShadowMap: { value: [] },\r\n\t\tdirectionalShadowMatrix: { value: [] },\r\n\r\n\t\tspotLights: { value: [], properties: {\r\n\t\t\tcolor: {},\r\n\t\t\tposition: {},\r\n\t\t\tdirection: {},\r\n\t\t\tdistance: {},\r\n\t\t\tconeCos: {},\r\n\t\t\tpenumbraCos: {},\r\n\t\t\tdecay: {}\r\n\t\t} },\r\n\r\n\t\tspotLightShadows: { value: [], properties: {\r\n\t\t\tshadowIntensity: 1,\r\n\t\t\tshadowBias: {},\r\n\t\t\tshadowNormalBias: {},\r\n\t\t\tshadowRadius: {},\r\n\t\t\tshadowMapSize: {}\r\n\t\t} },\r\n\r\n\t\tspotLightMap: { value: [] },\r\n\t\tspotShadowMap: { value: [] },\r\n\t\tspotLightMatrix: { value: [] },\r\n\r\n\t\tpointLights: { value: [], properties: {\r\n\t\t\tcolor: {},\r\n\t\t\tposition: {},\r\n\t\t\tdecay: {},\r\n\t\t\tdistance: {}\r\n\t\t} },\r\n\r\n\t\tpointLightShadows: { value: [], properties: {\r\n\t\t\tshadowIntensity: 1,\r\n\t\t\tshadowBias: {},\r\n\t\t\tshadowNormalBias: {},\r\n\t\t\tshadowRadius: {},\r\n\t\t\tshadowMapSize: {},\r\n\t\t\tshadowCameraNear: {},\r\n\t\t\tshadowCameraFar: {}\r\n\t\t} },\r\n\r\n\t\tpointShadowMap: { value: [] },\r\n\t\tpointShadowMatrix: { value: [] },\r\n\r\n\t\themisphereLights: { value: [], properties: {\r\n\t\t\tdirection: {},\r\n\t\t\tskyColor: {},\r\n\t\t\tgroundColor: {}\r\n\t\t} },\r\n\r\n\t\t// TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src\r\n\t\trectAreaLights: { value: [], properties: {\r\n\t\t\tcolor: {},\r\n\t\t\tposition: {},\r\n\t\t\twidth: {},\r\n\t\t\theight: {}\r\n\t\t} },\r\n\r\n\t\tltc_1: { value: null },\r\n\t\tltc_2: { value: null }\r\n\r\n\t},\r\n\r\n\tpoints: {\r\n\r\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\r\n\t\topacity: { value: 1.0 },\r\n\t\tsize: { value: 1.0 },\r\n\t\tscale: { value: 1.0 },\r\n\t\tmap: { value: null },\r\n\t\talphaMap: { value: null },\r\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\talphaTest: { value: 0 },\r\n\t\tuvTransform: { value: /*@__PURE__*/ new Matrix3() }\r\n\r\n\t},\r\n\r\n\tsprite: {\r\n\r\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\r\n\t\topacity: { value: 1.0 },\r\n\t\tcenter: { value: /*@__PURE__*/ new Vector2( 0.5, 0.5 ) },\r\n\t\trotation: { value: 0.0 },\r\n\t\tmap: { value: null },\r\n\t\tmapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\talphaMap: { value: null },\r\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\talphaTest: { value: 0 }\r\n\r\n\t}\r\n\r\n};\r\n\r\nconst ShaderLib = {\r\n\r\n\tbasic: {\r\n\r\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\r\n\t\t\tUniformsLib.common,\r\n\t\t\tUniformsLib.specularmap,\r\n\t\t\tUniformsLib.envmap,\r\n\t\t\tUniformsLib.aomap,\r\n\t\t\tUniformsLib.lightmap,\r\n\t\t\tUniformsLib.fog\r\n\t\t] ),\r\n\r\n\t\tvertexShader: ShaderChunk.meshbasic_vert,\r\n\t\tfragmentShader: ShaderChunk.meshbasic_frag\r\n\r\n\t},\r\n\r\n\tlambert: {\r\n\r\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\r\n\t\t\tUniformsLib.common,\r\n\t\t\tUniformsLib.specularmap,\r\n\t\t\tUniformsLib.envmap,\r\n\t\t\tUniformsLib.aomap,\r\n\t\t\tUniformsLib.lightmap,\r\n\t\t\tUniformsLib.emissivemap,\r\n\t\t\tUniformsLib.bumpmap,\r\n\t\t\tUniformsLib.normalmap,\r\n\t\t\tUniformsLib.displacementmap,\r\n\t\t\tUniformsLib.fog,\r\n\t\t\tUniformsLib.lights,\r\n\t\t\t{\r\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) }\r\n\t\t\t}\r\n\t\t] ),\r\n\r\n\t\tvertexShader: ShaderChunk.meshlambert_vert,\r\n\t\tfragmentShader: ShaderChunk.meshlambert_frag\r\n\r\n\t},\r\n\r\n\tphong: {\r\n\r\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\r\n\t\t\tUniformsLib.common,\r\n\t\t\tUniformsLib.specularmap,\r\n\t\t\tUniformsLib.envmap,\r\n\t\t\tUniformsLib.aomap,\r\n\t\t\tUniformsLib.lightmap,\r\n\t\t\tUniformsLib.emissivemap,\r\n\t\t\tUniformsLib.bumpmap,\r\n\t\t\tUniformsLib.normalmap,\r\n\t\t\tUniformsLib.displacementmap,\r\n\t\t\tUniformsLib.fog,\r\n\t\t\tUniformsLib.lights,\r\n\t\t\t{\r\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },\r\n\t\t\t\tspecular: { value: /*@__PURE__*/ new Color( 0x111111 ) },\r\n\t\t\t\tshininess: { value: 30 }\r\n\t\t\t}\r\n\t\t] ),\r\n\r\n\t\tvertexShader: ShaderChunk.meshphong_vert,\r\n\t\tfragmentShader: ShaderChunk.meshphong_frag\r\n\r\n\t},\r\n\r\n\tstandard: {\r\n\r\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\r\n\t\t\tUniformsLib.common,\r\n\t\t\tUniformsLib.envmap,\r\n\t\t\tUniformsLib.aomap,\r\n\t\t\tUniformsLib.lightmap,\r\n\t\t\tUniformsLib.emissivemap,\r\n\t\t\tUniformsLib.bumpmap,\r\n\t\t\tUniformsLib.normalmap,\r\n\t\t\tUniformsLib.displacementmap,\r\n\t\t\tUniformsLib.roughnessmap,\r\n\t\t\tUniformsLib.metalnessmap,\r\n\t\t\tUniformsLib.fog,\r\n\t\t\tUniformsLib.lights,\r\n\t\t\t{\r\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },\r\n\t\t\t\troughness: { value: 1.0 },\r\n\t\t\t\tmetalness: { value: 0.0 },\r\n\t\t\t\tenvMapIntensity: { value: 1 }\r\n\t\t\t}\r\n\t\t] ),\r\n\r\n\t\tvertexShader: ShaderChunk.meshphysical_vert,\r\n\t\tfragmentShader: ShaderChunk.meshphysical_frag\r\n\r\n\t},\r\n\r\n\ttoon: {\r\n\r\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\r\n\t\t\tUniformsLib.common,\r\n\t\t\tUniformsLib.aomap,\r\n\t\t\tUniformsLib.lightmap,\r\n\t\t\tUniformsLib.emissivemap,\r\n\t\t\tUniformsLib.bumpmap,\r\n\t\t\tUniformsLib.normalmap,\r\n\t\t\tUniformsLib.displacementmap,\r\n\t\t\tUniformsLib.gradientmap,\r\n\t\t\tUniformsLib.fog,\r\n\t\t\tUniformsLib.lights,\r\n\t\t\t{\r\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) }\r\n\t\t\t}\r\n\t\t] ),\r\n\r\n\t\tvertexShader: ShaderChunk.meshtoon_vert,\r\n\t\tfragmentShader: ShaderChunk.meshtoon_frag\r\n\r\n\t},\r\n\r\n\tmatcap: {\r\n\r\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\r\n\t\t\tUniformsLib.common,\r\n\t\t\tUniformsLib.bumpmap,\r\n\t\t\tUniformsLib.normalmap,\r\n\t\t\tUniformsLib.displacementmap,\r\n\t\t\tUniformsLib.fog,\r\n\t\t\t{\r\n\t\t\t\tmatcap: { value: null }\r\n\t\t\t}\r\n\t\t] ),\r\n\r\n\t\tvertexShader: ShaderChunk.meshmatcap_vert,\r\n\t\tfragmentShader: ShaderChunk.meshmatcap_frag\r\n\r\n\t},\r\n\r\n\tpoints: {\r\n\r\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\r\n\t\t\tUniformsLib.points,\r\n\t\t\tUniformsLib.fog\r\n\t\t] ),\r\n\r\n\t\tvertexShader: ShaderChunk.points_vert,\r\n\t\tfragmentShader: ShaderChunk.points_frag\r\n\r\n\t},\r\n\r\n\tdashed: {\r\n\r\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\r\n\t\t\tUniformsLib.common,\r\n\t\t\tUniformsLib.fog,\r\n\t\t\t{\r\n\t\t\t\tscale: { value: 1 },\r\n\t\t\t\tdashSize: { value: 1 },\r\n\t\t\t\ttotalSize: { value: 2 }\r\n\t\t\t}\r\n\t\t] ),\r\n\r\n\t\tvertexShader: ShaderChunk.linedashed_vert,\r\n\t\tfragmentShader: ShaderChunk.linedashed_frag\r\n\r\n\t},\r\n\r\n\tdepth: {\r\n\r\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\r\n\t\t\tUniformsLib.common,\r\n\t\t\tUniformsLib.displacementmap\r\n\t\t] ),\r\n\r\n\t\tvertexShader: ShaderChunk.depth_vert,\r\n\t\tfragmentShader: ShaderChunk.depth_frag\r\n\r\n\t},\r\n\r\n\tnormal: {\r\n\r\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\r\n\t\t\tUniformsLib.common,\r\n\t\t\tUniformsLib.bumpmap,\r\n\t\t\tUniformsLib.normalmap,\r\n\t\t\tUniformsLib.displacementmap,\r\n\t\t\t{\r\n\t\t\t\topacity: { value: 1.0 }\r\n\t\t\t}\r\n\t\t] ),\r\n\r\n\t\tvertexShader: ShaderChunk.meshnormal_vert,\r\n\t\tfragmentShader: ShaderChunk.meshnormal_frag\r\n\r\n\t},\r\n\r\n\tsprite: {\r\n\r\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\r\n\t\t\tUniformsLib.sprite,\r\n\t\t\tUniformsLib.fog\r\n\t\t] ),\r\n\r\n\t\tvertexShader: ShaderChunk.sprite_vert,\r\n\t\tfragmentShader: ShaderChunk.sprite_frag\r\n\r\n\t},\r\n\r\n\tbackground: {\r\n\r\n\t\tuniforms: {\r\n\t\t\tuvTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\t\tt2D: { value: null },\r\n\t\t\tbackgroundIntensity: { value: 1 }\r\n\t\t},\r\n\r\n\t\tvertexShader: ShaderChunk.background_vert,\r\n\t\tfragmentShader: ShaderChunk.background_frag\r\n\r\n\t},\r\n\r\n\tbackgroundCube: {\r\n\r\n\t\tuniforms: {\r\n\t\t\tenvMap: { value: null },\r\n\t\t\tflipEnvMap: { value: - 1 },\r\n\t\t\tbackgroundBlurriness: { value: 0 },\r\n\t\t\tbackgroundIntensity: { value: 1 },\r\n\t\t\tbackgroundRotation: { value: /*@__PURE__*/ new Matrix3() }\r\n\t\t},\r\n\r\n\t\tvertexShader: ShaderChunk.backgroundCube_vert,\r\n\t\tfragmentShader: ShaderChunk.backgroundCube_frag\r\n\r\n\t},\r\n\r\n\tcube: {\r\n\r\n\t\tuniforms: {\r\n\t\t\ttCube: { value: null },\r\n\t\t\ttFlip: { value: - 1 },\r\n\t\t\topacity: { value: 1.0 }\r\n\t\t},\r\n\r\n\t\tvertexShader: ShaderChunk.cube_vert,\r\n\t\tfragmentShader: ShaderChunk.cube_frag\r\n\r\n\t},\r\n\r\n\tequirect: {\r\n\r\n\t\tuniforms: {\r\n\t\t\ttEquirect: { value: null },\r\n\t\t},\r\n\r\n\t\tvertexShader: ShaderChunk.equirect_vert,\r\n\t\tfragmentShader: ShaderChunk.equirect_frag\r\n\r\n\t},\r\n\r\n\tdistanceRGBA: {\r\n\r\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\r\n\t\t\tUniformsLib.common,\r\n\t\t\tUniformsLib.displacementmap,\r\n\t\t\t{\r\n\t\t\t\treferencePosition: { value: /*@__PURE__*/ new Vector3() },\r\n\t\t\t\tnearDistance: { value: 1 },\r\n\t\t\t\tfarDistance: { value: 1000 }\r\n\t\t\t}\r\n\t\t] ),\r\n\r\n\t\tvertexShader: ShaderChunk.distanceRGBA_vert,\r\n\t\tfragmentShader: ShaderChunk.distanceRGBA_frag\r\n\r\n\t},\r\n\r\n\tshadow: {\r\n\r\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\r\n\t\t\tUniformsLib.lights,\r\n\t\t\tUniformsLib.fog,\r\n\t\t\t{\r\n\t\t\t\tcolor: { value: /*@__PURE__*/ new Color( 0x00000 ) },\r\n\t\t\t\topacity: { value: 1.0 }\r\n\t\t\t},\r\n\t\t] ),\r\n\r\n\t\tvertexShader: ShaderChunk.shadow_vert,\r\n\t\tfragmentShader: ShaderChunk.shadow_frag\r\n\r\n\t}\r\n\r\n};\r\n\r\nShaderLib.physical = {\r\n\r\n\tuniforms: /*@__PURE__*/ mergeUniforms( [\r\n\t\tShaderLib.standard.uniforms,\r\n\t\t{\r\n\t\t\tclearcoat: { value: 0 },\r\n\t\t\tclearcoatMap: { value: null },\r\n\t\t\tclearcoatMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\t\tclearcoatNormalMap: { value: null },\r\n\t\t\tclearcoatNormalMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\t\tclearcoatNormalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) },\r\n\t\t\tclearcoatRoughness: { value: 0 },\r\n\t\t\tclearcoatRoughnessMap: { value: null },\r\n\t\t\tclearcoatRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\t\tdispersion: { value: 0 },\r\n\t\t\tiridescence: { value: 0 },\r\n\t\t\tiridescenceMap: { value: null },\r\n\t\t\tiridescenceMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\t\tiridescenceIOR: { value: 1.3 },\r\n\t\t\tiridescenceThicknessMinimum: { value: 100 },\r\n\t\t\tiridescenceThicknessMaximum: { value: 400 },\r\n\t\t\tiridescenceThicknessMap: { value: null },\r\n\t\t\tiridescenceThicknessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\t\tsheen: { value: 0 },\r\n\t\t\tsheenColor: { value: /*@__PURE__*/ new Color( 0x000000 ) },\r\n\t\t\tsheenColorMap: { value: null },\r\n\t\t\tsheenColorMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\t\tsheenRoughness: { value: 1 },\r\n\t\t\tsheenRoughnessMap: { value: null },\r\n\t\t\tsheenRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\t\ttransmission: { value: 0 },\r\n\t\t\ttransmissionMap: { value: null },\r\n\t\t\ttransmissionMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\t\ttransmissionSamplerSize: { value: /*@__PURE__*/ new Vector2() },\r\n\t\t\ttransmissionSamplerMap: { value: null },\r\n\t\t\tthickness: { value: 0 },\r\n\t\t\tthicknessMap: { value: null },\r\n\t\t\tthicknessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\t\tattenuationDistance: { value: 0 },\r\n\t\t\tattenuationColor: { value: /*@__PURE__*/ new Color( 0x000000 ) },\r\n\t\t\tspecularColor: { value: /*@__PURE__*/ new Color( 1, 1, 1 ) },\r\n\t\t\tspecularColorMap: { value: null },\r\n\t\t\tspecularColorMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\t\tspecularIntensity: { value: 1 },\r\n\t\t\tspecularIntensityMap: { value: null },\r\n\t\t\tspecularIntensityMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\t\tanisotropyVector: { value: /*@__PURE__*/ new Vector2() },\r\n\t\t\tanisotropyMap: { value: null },\r\n\t\t\tanisotropyMapTransform: { value: /*@__PURE__*/ new Matrix3() },\r\n\t\t}\r\n\t] ),\r\n\r\n\tvertexShader: ShaderChunk.meshphysical_vert,\r\n\tfragmentShader: ShaderChunk.meshphysical_frag\r\n\r\n};\r\n\r\nconst _rgb = { r: 0, b: 0, g: 0 };\r\nconst _e1$1 = /*@__PURE__*/ new Euler();\r\nconst _m1$1 = /*@__PURE__*/ new Matrix4();\r\n\r\nfunction WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha ) {\r\n\r\n\tconst clearColor = new Color( 0x000000 );\r\n\tlet clearAlpha = alpha === true ? 0 : 1;\r\n\r\n\tlet planeMesh;\r\n\tlet boxMesh;\r\n\r\n\tlet currentBackground = null;\r\n\tlet currentBackgroundVersion = 0;\r\n\tlet currentTonemapping = null;\r\n\r\n\tfunction getBackground( scene ) {\r\n\r\n\t\tlet background = scene.isScene === true ? scene.background : null;\r\n\r\n\t\tif ( background && background.isTexture ) {\r\n\r\n\t\t\tconst usePMREM = scene.backgroundBlurriness > 0; // use PMREM if the user wants to blur the background\r\n\t\t\tbackground = ( usePMREM ? cubeuvmaps : cubemaps ).get( background );\r\n\r\n\t\t}\r\n\r\n\t\treturn background;\r\n\r\n\t}\r\n\r\n\tfunction render( scene ) {\r\n\r\n\t\tlet forceClear = false;\r\n\t\tconst background = getBackground( scene );\r\n\r\n\t\tif ( background === null ) {\r\n\r\n\t\t\tsetClear( clearColor, clearAlpha );\r\n\r\n\t\t} else if ( background && background.isColor ) {\r\n\r\n\t\t\tsetClear( background, 1 );\r\n\t\t\tforceClear = true;\r\n\r\n\t\t}\r\n\r\n\t\tconst environmentBlendMode = renderer.xr.getEnvironmentBlendMode();\r\n\r\n\t\tif ( environmentBlendMode === 'additive' ) {\r\n\r\n\t\t\tstate.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );\r\n\r\n\t\t} else if ( environmentBlendMode === 'alpha-blend' ) {\r\n\r\n\t\t\tstate.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );\r\n\r\n\t\t}\r\n\r\n\t\tif ( renderer.autoClear || forceClear ) {\r\n\r\n\t\t\t// buffers might not be writable which is required to ensure a correct clear\r\n\r\n\t\t\tstate.buffers.depth.setTest( true );\r\n\t\t\tstate.buffers.depth.setMask( true );\r\n\t\t\tstate.buffers.color.setMask( true );\r\n\r\n\t\t\trenderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction addToRenderList( renderList, scene ) {\r\n\r\n\t\tconst background = getBackground( scene );\r\n\r\n\t\tif ( background && ( background.isCubeTexture || background.mapping === CubeUVReflectionMapping ) ) {\r\n\r\n\t\t\tif ( boxMesh === undefined ) {\r\n\r\n\t\t\t\tboxMesh = new Mesh(\r\n\t\t\t\t\tnew BoxGeometry( 1, 1, 1 ),\r\n\t\t\t\t\tnew ShaderMaterial( {\r\n\t\t\t\t\t\tname: 'BackgroundCubeMaterial',\r\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.backgroundCube.uniforms ),\r\n\t\t\t\t\t\tvertexShader: ShaderLib.backgroundCube.vertexShader,\r\n\t\t\t\t\t\tfragmentShader: ShaderLib.backgroundCube.fragmentShader,\r\n\t\t\t\t\t\tside: BackSide,\r\n\t\t\t\t\t\tdepthTest: false,\r\n\t\t\t\t\t\tdepthWrite: false,\r\n\t\t\t\t\t\tfog: false\r\n\t\t\t\t\t} )\r\n\t\t\t\t);\r\n\r\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'normal' );\r\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'uv' );\r\n\r\n\t\t\t\tboxMesh.onBeforeRender = function ( renderer, scene, camera ) {\r\n\r\n\t\t\t\t\tthis.matrixWorld.copyPosition( camera.matrixWorld );\r\n\r\n\t\t\t\t};\r\n\r\n\t\t\t\t// add \"envMap\" material property so the renderer can evaluate it like for built-in materials\r\n\t\t\t\tObject.defineProperty( boxMesh.material, 'envMap', {\r\n\r\n\t\t\t\t\tget: function () {\r\n\r\n\t\t\t\t\t\treturn this.uniforms.envMap.value;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} );\r\n\r\n\t\t\t\tobjects.update( boxMesh );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_e1$1.copy( scene.backgroundRotation );\r\n\r\n\t\t\t// accommodate left-handed frame\r\n\t\t\t_e1$1.x *= - 1; _e1$1.y *= - 1; _e1$1.z *= - 1;\r\n\r\n\t\t\tif ( background.isCubeTexture && background.isRenderTargetTexture === false ) {\r\n\r\n\t\t\t\t// environment maps which are not cube render targets or PMREMs follow a different convention\r\n\t\t\t\t_e1$1.y *= - 1;\r\n\t\t\t\t_e1$1.z *= - 1;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tboxMesh.material.uniforms.envMap.value = background;\r\n\t\t\tboxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;\r\n\t\t\tboxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;\r\n\t\t\tboxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\r\n\t\t\tboxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4( _m1$1.makeRotationFromEuler( _e1$1 ) );\r\n\t\t\tboxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;\r\n\r\n\t\t\tif ( currentBackground !== background ||\r\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\r\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\r\n\r\n\t\t\t\tboxMesh.material.needsUpdate = true;\r\n\r\n\t\t\t\tcurrentBackground = background;\r\n\t\t\t\tcurrentBackgroundVersion = background.version;\r\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tboxMesh.layers.enableAll();\r\n\r\n\t\t\t// push to the pre-sorted opaque render list\r\n\t\t\trenderList.unshift( boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null );\r\n\r\n\t\t} else if ( background && background.isTexture ) {\r\n\r\n\t\t\tif ( planeMesh === undefined ) {\r\n\r\n\t\t\t\tplaneMesh = new Mesh(\r\n\t\t\t\t\tnew PlaneGeometry( 2, 2 ),\r\n\t\t\t\t\tnew ShaderMaterial( {\r\n\t\t\t\t\t\tname: 'BackgroundMaterial',\r\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.background.uniforms ),\r\n\t\t\t\t\t\tvertexShader: ShaderLib.background.vertexShader,\r\n\t\t\t\t\t\tfragmentShader: ShaderLib.background.fragmentShader,\r\n\t\t\t\t\t\tside: FrontSide,\r\n\t\t\t\t\t\tdepthTest: false,\r\n\t\t\t\t\t\tdepthWrite: false,\r\n\t\t\t\t\t\tfog: false\r\n\t\t\t\t\t} )\r\n\t\t\t\t);\r\n\r\n\t\t\t\tplaneMesh.geometry.deleteAttribute( 'normal' );\r\n\r\n\t\t\t\t// add \"map\" material property so the renderer can evaluate it like for built-in materials\r\n\t\t\t\tObject.defineProperty( planeMesh.material, 'map', {\r\n\r\n\t\t\t\t\tget: function () {\r\n\r\n\t\t\t\t\t\treturn this.uniforms.t2D.value;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} );\r\n\r\n\t\t\t\tobjects.update( planeMesh );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tplaneMesh.material.uniforms.t2D.value = background;\r\n\t\t\tplaneMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\r\n\t\t\tplaneMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;\r\n\r\n\t\t\tif ( background.matrixAutoUpdate === true ) {\r\n\r\n\t\t\t\tbackground.updateMatrix();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tplaneMesh.material.uniforms.uvTransform.value.copy( background.matrix );\r\n\r\n\t\t\tif ( currentBackground !== background ||\r\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\r\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\r\n\r\n\t\t\t\tplaneMesh.material.needsUpdate = true;\r\n\r\n\t\t\t\tcurrentBackground = background;\r\n\t\t\t\tcurrentBackgroundVersion = background.version;\r\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tplaneMesh.layers.enableAll();\r\n\r\n\t\t\t// push to the pre-sorted opaque render list\r\n\t\t\trenderList.unshift( planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction setClear( color, alpha ) {\r\n\r\n\t\tcolor.getRGB( _rgb, getUnlitUniformColorSpace( renderer ) );\r\n\r\n\t\tstate.buffers.color.setClear( _rgb.r, _rgb.g, _rgb.b, alpha, premultipliedAlpha );\r\n\r\n\t}\r\n\r\n\treturn {\r\n\r\n\t\tgetClearColor: function () {\r\n\r\n\t\t\treturn clearColor;\r\n\r\n\t\t},\r\n\t\tsetClearColor: function ( color, alpha = 1 ) {\r\n\r\n\t\t\tclearColor.set( color );\r\n\t\t\tclearAlpha = alpha;\r\n\t\t\tsetClear( clearColor, clearAlpha );\r\n\r\n\t\t},\r\n\t\tgetClearAlpha: function () {\r\n\r\n\t\t\treturn clearAlpha;\r\n\r\n\t\t},\r\n\t\tsetClearAlpha: function ( alpha ) {\r\n\r\n\t\t\tclearAlpha = alpha;\r\n\t\t\tsetClear( clearColor, clearAlpha );\r\n\r\n\t\t},\r\n\t\trender: render,\r\n\t\taddToRenderList: addToRenderList\r\n\r\n\t};\r\n\r\n}\r\n\r\nfunction WebGLBindingStates( gl, attributes ) {\r\n\r\n\tconst maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\r\n\r\n\tconst bindingStates = {};\r\n\r\n\tconst defaultState = createBindingState( null );\r\n\tlet currentState = defaultState;\r\n\tlet forceUpdate = false;\r\n\r\n\tfunction setup( object, material, program, geometry, index ) {\r\n\r\n\t\tlet updateBuffers = false;\r\n\r\n\t\tconst state = getBindingState( geometry, program, material );\r\n\r\n\t\tif ( currentState !== state ) {\r\n\r\n\t\t\tcurrentState = state;\r\n\t\t\tbindVertexArrayObject( currentState.object );\r\n\r\n\t\t}\r\n\r\n\t\tupdateBuffers = needsUpdate( object, geometry, program, index );\r\n\r\n\t\tif ( updateBuffers ) saveCache( object, geometry, program, index );\r\n\r\n\t\tif ( index !== null ) {\r\n\r\n\t\t\tattributes.update( index, gl.ELEMENT_ARRAY_BUFFER );\r\n\r\n\t\t}\r\n\r\n\t\tif ( updateBuffers || forceUpdate ) {\r\n\r\n\t\t\tforceUpdate = false;\r\n\r\n\t\t\tsetupVertexAttributes( object, material, program, geometry );\r\n\r\n\t\t\tif ( index !== null ) {\r\n\r\n\t\t\t\tgl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, attributes.get( index ).buffer );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction createVertexArrayObject() {\r\n\r\n\t\treturn gl.createVertexArray();\r\n\r\n\t}\r\n\r\n\tfunction bindVertexArrayObject( vao ) {\r\n\r\n\t\treturn gl.bindVertexArray( vao );\r\n\r\n\t}\r\n\r\n\tfunction deleteVertexArrayObject( vao ) {\r\n\r\n\t\treturn gl.deleteVertexArray( vao );\r\n\r\n\t}\r\n\r\n\tfunction getBindingState( geometry, program, material ) {\r\n\r\n\t\tconst wireframe = ( material.wireframe === true );\r\n\r\n\t\tlet programMap = bindingStates[ geometry.id ];\r\n\r\n\t\tif ( programMap === undefined ) {\r\n\r\n\t\t\tprogramMap = {};\r\n\t\t\tbindingStates[ geometry.id ] = programMap;\r\n\r\n\t\t}\r\n\r\n\t\tlet stateMap = programMap[ program.id ];\r\n\r\n\t\tif ( stateMap === undefined ) {\r\n\r\n\t\t\tstateMap = {};\r\n\t\t\tprogramMap[ program.id ] = stateMap;\r\n\r\n\t\t}\r\n\r\n\t\tlet state = stateMap[ wireframe ];\r\n\r\n\t\tif ( state === undefined ) {\r\n\r\n\t\t\tstate = createBindingState( createVertexArrayObject() );\r\n\t\t\tstateMap[ wireframe ] = state;\r\n\r\n\t\t}\r\n\r\n\t\treturn state;\r\n\r\n\t}\r\n\r\n\tfunction createBindingState( vao ) {\r\n\r\n\t\tconst newAttributes = [];\r\n\t\tconst enabledAttributes = [];\r\n\t\tconst attributeDivisors = [];\r\n\r\n\t\tfor ( let i = 0; i < maxVertexAttributes; i ++ ) {\r\n\r\n\t\t\tnewAttributes[ i ] = 0;\r\n\t\t\tenabledAttributes[ i ] = 0;\r\n\t\t\tattributeDivisors[ i ] = 0;\r\n\r\n\t\t}\r\n\r\n\t\treturn {\r\n\r\n\t\t\t// for backward compatibility on non-VAO support browser\r\n\t\t\tgeometry: null,\r\n\t\t\tprogram: null,\r\n\t\t\twireframe: false,\r\n\r\n\t\t\tnewAttributes: newAttributes,\r\n\t\t\tenabledAttributes: enabledAttributes,\r\n\t\t\tattributeDivisors: attributeDivisors,\r\n\t\t\tobject: vao,\r\n\t\t\tattributes: {},\r\n\t\t\tindex: null\r\n\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tfunction needsUpdate( object, geometry, program, index ) {\r\n\r\n\t\tconst cachedAttributes = currentState.attributes;\r\n\t\tconst geometryAttributes = geometry.attributes;\r\n\r\n\t\tlet attributesNum = 0;\r\n\r\n\t\tconst programAttributes = program.getAttributes();\r\n\r\n\t\tfor ( const name in programAttributes ) {\r\n\r\n\t\t\tconst programAttribute = programAttributes[ name ];\r\n\r\n\t\t\tif ( programAttribute.location >= 0 ) {\r\n\r\n\t\t\t\tconst cachedAttribute = cachedAttributes[ name ];\r\n\t\t\t\tlet geometryAttribute = geometryAttributes[ name ];\r\n\r\n\t\t\t\tif ( geometryAttribute === undefined ) {\r\n\r\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;\r\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( cachedAttribute === undefined ) return true;\r\n\r\n\t\t\t\tif ( cachedAttribute.attribute !== geometryAttribute ) return true;\r\n\r\n\t\t\t\tif ( geometryAttribute && cachedAttribute.data !== geometryAttribute.data ) return true;\r\n\r\n\t\t\t\tattributesNum ++;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( currentState.attributesNum !== attributesNum ) return true;\r\n\r\n\t\tif ( currentState.index !== index ) return true;\r\n\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\tfunction saveCache( object, geometry, program, index ) {\r\n\r\n\t\tconst cache = {};\r\n\t\tconst attributes = geometry.attributes;\r\n\t\tlet attributesNum = 0;\r\n\r\n\t\tconst programAttributes = program.getAttributes();\r\n\r\n\t\tfor ( const name in programAttributes ) {\r\n\r\n\t\t\tconst programAttribute = programAttributes[ name ];\r\n\r\n\t\t\tif ( programAttribute.location >= 0 ) {\r\n\r\n\t\t\t\tlet attribute = attributes[ name ];\r\n\r\n\t\t\t\tif ( attribute === undefined ) {\r\n\r\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) attribute = object.instanceMatrix;\r\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) attribute = object.instanceColor;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst data = {};\r\n\t\t\t\tdata.attribute = attribute;\r\n\r\n\t\t\t\tif ( attribute && attribute.data ) {\r\n\r\n\t\t\t\t\tdata.data = attribute.data;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tcache[ name ] = data;\r\n\r\n\t\t\t\tattributesNum ++;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tcurrentState.attributes = cache;\r\n\t\tcurrentState.attributesNum = attributesNum;\r\n\r\n\t\tcurrentState.index = index;\r\n\r\n\t}\r\n\r\n\tfunction initAttributes() {\r\n\r\n\t\tconst newAttributes = currentState.newAttributes;\r\n\r\n\t\tfor ( let i = 0, il = newAttributes.length; i < il; i ++ ) {\r\n\r\n\t\t\tnewAttributes[ i ] = 0;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction enableAttribute( attribute ) {\r\n\r\n\t\tenableAttributeAndDivisor( attribute, 0 );\r\n\r\n\t}\r\n\r\n\tfunction enableAttributeAndDivisor( attribute, meshPerAttribute ) {\r\n\r\n\t\tconst newAttributes = currentState.newAttributes;\r\n\t\tconst enabledAttributes = currentState.enabledAttributes;\r\n\t\tconst attributeDivisors = currentState.attributeDivisors;\r\n\r\n\t\tnewAttributes[ attribute ] = 1;\r\n\r\n\t\tif ( enabledAttributes[ attribute ] === 0 ) {\r\n\r\n\t\t\tgl.enableVertexAttribArray( attribute );\r\n\t\t\tenabledAttributes[ attribute ] = 1;\r\n\r\n\t\t}\r\n\r\n\t\tif ( attributeDivisors[ attribute ] !== meshPerAttribute ) {\r\n\r\n\t\t\tgl.vertexAttribDivisor( attribute, meshPerAttribute );\r\n\t\t\tattributeDivisors[ attribute ] = meshPerAttribute;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction disableUnusedAttributes() {\r\n\r\n\t\tconst newAttributes = currentState.newAttributes;\r\n\t\tconst enabledAttributes = currentState.enabledAttributes;\r\n\r\n\t\tfor ( let i = 0, il = enabledAttributes.length; i < il; i ++ ) {\r\n\r\n\t\t\tif ( enabledAttributes[ i ] !== newAttributes[ i ] ) {\r\n\r\n\t\t\t\tgl.disableVertexAttribArray( i );\r\n\t\t\t\tenabledAttributes[ i ] = 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction vertexAttribPointer( index, size, type, normalized, stride, offset, integer ) {\r\n\r\n\t\tif ( integer === true ) {\r\n\r\n\t\t\tgl.vertexAttribIPointer( index, size, type, stride, offset );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tgl.vertexAttribPointer( index, size, type, normalized, stride, offset );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction setupVertexAttributes( object, material, program, geometry ) {\r\n\r\n\t\tinitAttributes();\r\n\r\n\t\tconst geometryAttributes = geometry.attributes;\r\n\r\n\t\tconst programAttributes = program.getAttributes();\r\n\r\n\t\tconst materialDefaultAttributeValues = material.defaultAttributeValues;\r\n\r\n\t\tfor ( const name in programAttributes ) {\r\n\r\n\t\t\tconst programAttribute = programAttributes[ name ];\r\n\r\n\t\t\tif ( programAttribute.location >= 0 ) {\r\n\r\n\t\t\t\tlet geometryAttribute = geometryAttributes[ name ];\r\n\r\n\t\t\t\tif ( geometryAttribute === undefined ) {\r\n\r\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;\r\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( geometryAttribute !== undefined ) {\r\n\r\n\t\t\t\t\tconst normalized = geometryAttribute.normalized;\r\n\t\t\t\t\tconst size = geometryAttribute.itemSize;\r\n\r\n\t\t\t\t\tconst attribute = attributes.get( geometryAttribute );\r\n\r\n\t\t\t\t\t// TODO Attribute may not be available on context restore\r\n\r\n\t\t\t\t\tif ( attribute === undefined ) continue;\r\n\r\n\t\t\t\t\tconst buffer = attribute.buffer;\r\n\t\t\t\t\tconst type = attribute.type;\r\n\t\t\t\t\tconst bytesPerElement = attribute.bytesPerElement;\r\n\r\n\t\t\t\t\t// check for integer attributes\r\n\r\n\t\t\t\t\tconst integer = ( type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === IntType );\r\n\r\n\t\t\t\t\tif ( geometryAttribute.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\t\t\t\tconst data = geometryAttribute.data;\r\n\t\t\t\t\t\tconst stride = data.stride;\r\n\t\t\t\t\t\tconst offset = geometryAttribute.offset;\r\n\r\n\t\t\t\t\t\tif ( data.isInstancedInterleavedBuffer ) {\r\n\r\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\r\n\r\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, data.meshPerAttribute );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\r\n\r\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = data.meshPerAttribute * data.count;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\r\n\r\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tgl.bindBuffer( gl.ARRAY_BUFFER, buffer );\r\n\r\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\r\n\r\n\t\t\t\t\t\t\tvertexAttribPointer(\r\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\r\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\r\n\t\t\t\t\t\t\t\ttype,\r\n\t\t\t\t\t\t\t\tnormalized,\r\n\t\t\t\t\t\t\t\tstride * bytesPerElement,\r\n\t\t\t\t\t\t\t\t( offset + ( size / programAttribute.locationSize ) * i ) * bytesPerElement,\r\n\t\t\t\t\t\t\t\tinteger\r\n\t\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tif ( geometryAttribute.isInstancedBufferAttribute ) {\r\n\r\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\r\n\r\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, geometryAttribute.meshPerAttribute );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\r\n\r\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\r\n\r\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tgl.bindBuffer( gl.ARRAY_BUFFER, buffer );\r\n\r\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\r\n\r\n\t\t\t\t\t\t\tvertexAttribPointer(\r\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\r\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\r\n\t\t\t\t\t\t\t\ttype,\r\n\t\t\t\t\t\t\t\tnormalized,\r\n\t\t\t\t\t\t\t\tsize * bytesPerElement,\r\n\t\t\t\t\t\t\t\t( size / programAttribute.locationSize ) * i * bytesPerElement,\r\n\t\t\t\t\t\t\t\tinteger\r\n\t\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else if ( materialDefaultAttributeValues !== undefined ) {\r\n\r\n\t\t\t\t\tconst value = materialDefaultAttributeValues[ name ];\r\n\r\n\t\t\t\t\tif ( value !== undefined ) {\r\n\r\n\t\t\t\t\t\tswitch ( value.length ) {\r\n\r\n\t\t\t\t\t\t\tcase 2:\r\n\t\t\t\t\t\t\t\tgl.vertexAttrib2fv( programAttribute.location, value );\r\n\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\tcase 3:\r\n\t\t\t\t\t\t\t\tgl.vertexAttrib3fv( programAttribute.location, value );\r\n\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\tcase 4:\r\n\t\t\t\t\t\t\t\tgl.vertexAttrib4fv( programAttribute.location, value );\r\n\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\tgl.vertexAttrib1fv( programAttribute.location, value );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tdisableUnusedAttributes();\r\n\r\n\t}\r\n\r\n\tfunction dispose() {\r\n\r\n\t\treset();\r\n\r\n\t\tfor ( const geometryId in bindingStates ) {\r\n\r\n\t\t\tconst programMap = bindingStates[ geometryId ];\r\n\r\n\t\t\tfor ( const programId in programMap ) {\r\n\r\n\t\t\t\tconst stateMap = programMap[ programId ];\r\n\r\n\t\t\t\tfor ( const wireframe in stateMap ) {\r\n\r\n\t\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\r\n\r\n\t\t\t\t\tdelete stateMap[ wireframe ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdelete programMap[ programId ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdelete bindingStates[ geometryId ];\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction releaseStatesOfGeometry( geometry ) {\r\n\r\n\t\tif ( bindingStates[ geometry.id ] === undefined ) return;\r\n\r\n\t\tconst programMap = bindingStates[ geometry.id ];\r\n\r\n\t\tfor ( const programId in programMap ) {\r\n\r\n\t\t\tconst stateMap = programMap[ programId ];\r\n\r\n\t\t\tfor ( const wireframe in stateMap ) {\r\n\r\n\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\r\n\r\n\t\t\t\tdelete stateMap[ wireframe ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdelete programMap[ programId ];\r\n\r\n\t\t}\r\n\r\n\t\tdelete bindingStates[ geometry.id ];\r\n\r\n\t}\r\n\r\n\tfunction releaseStatesOfProgram( program ) {\r\n\r\n\t\tfor ( const geometryId in bindingStates ) {\r\n\r\n\t\t\tconst programMap = bindingStates[ geometryId ];\r\n\r\n\t\t\tif ( programMap[ program.id ] === undefined ) continue;\r\n\r\n\t\t\tconst stateMap = programMap[ program.id ];\r\n\r\n\t\t\tfor ( const wireframe in stateMap ) {\r\n\r\n\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\r\n\r\n\t\t\t\tdelete stateMap[ wireframe ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdelete programMap[ program.id ];\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction reset() {\r\n\r\n\t\tresetDefaultState();\r\n\t\tforceUpdate = true;\r\n\r\n\t\tif ( currentState === defaultState ) return;\r\n\r\n\t\tcurrentState = defaultState;\r\n\t\tbindVertexArrayObject( currentState.object );\r\n\r\n\t}\r\n\r\n\t// for backward-compatibility\r\n\r\n\tfunction resetDefaultState() {\r\n\r\n\t\tdefaultState.geometry = null;\r\n\t\tdefaultState.program = null;\r\n\t\tdefaultState.wireframe = false;\r\n\r\n\t}\r\n\r\n\treturn {\r\n\r\n\t\tsetup: setup,\r\n\t\treset: reset,\r\n\t\tresetDefaultState: resetDefaultState,\r\n\t\tdispose: dispose,\r\n\t\treleaseStatesOfGeometry: releaseStatesOfGeometry,\r\n\t\treleaseStatesOfProgram: releaseStatesOfProgram,\r\n\r\n\t\tinitAttributes: initAttributes,\r\n\t\tenableAttribute: enableAttribute,\r\n\t\tdisableUnusedAttributes: disableUnusedAttributes\r\n\r\n\t};\r\n\r\n}\r\n\r\nfunction WebGLBufferRenderer( gl, extensions, info ) {\r\n\r\n\tlet mode;\r\n\r\n\tfunction setMode( value ) {\r\n\r\n\t\tmode = value;\r\n\r\n\t}\r\n\r\n\tfunction render( start, count ) {\r\n\r\n\t\tgl.drawArrays( mode, start, count );\r\n\r\n\t\tinfo.update( count, mode, 1 );\r\n\r\n\t}\r\n\r\n\tfunction renderInstances( start, count, primcount ) {\r\n\r\n\t\tif ( primcount === 0 ) return;\r\n\r\n\t\tgl.drawArraysInstanced( mode, start, count, primcount );\r\n\r\n\t\tinfo.update( count, mode, primcount );\r\n\r\n\t}\r\n\r\n\tfunction renderMultiDraw( starts, counts, drawCount ) {\r\n\r\n\t\tif ( drawCount === 0 ) return;\r\n\r\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\r\n\t\textension.multiDrawArraysWEBGL( mode, starts, 0, counts, 0, drawCount );\r\n\r\n\t\tlet elementCount = 0;\r\n\t\tfor ( let i = 0; i < drawCount; i ++ ) {\r\n\r\n\t\t\telementCount += counts[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tinfo.update( elementCount, mode, 1 );\r\n\r\n\t}\r\n\r\n\tfunction renderMultiDrawInstances( starts, counts, drawCount, primcount ) {\r\n\r\n\t\tif ( drawCount === 0 ) return;\r\n\r\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\r\n\r\n\t\tif ( extension === null ) {\r\n\r\n\t\t\tfor ( let i = 0; i < starts.length; i ++ ) {\r\n\r\n\t\t\t\trenderInstances( starts[ i ], counts[ i ], primcount[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\textension.multiDrawArraysInstancedWEBGL( mode, starts, 0, counts, 0, primcount, 0, drawCount );\r\n\r\n\t\t\tlet elementCount = 0;\r\n\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\r\n\r\n\t\t\t\telementCount += counts[ i ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( let i = 0; i < primcount.length; i ++ ) {\r\n\r\n\t\t\t\tinfo.update( elementCount, mode, primcount[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tthis.setMode = setMode;\r\n\tthis.render = render;\r\n\tthis.renderInstances = renderInstances;\r\n\tthis.renderMultiDraw = renderMultiDraw;\r\n\tthis.renderMultiDrawInstances = renderMultiDrawInstances;\r\n\r\n}\r\n\r\nfunction WebGLCapabilities( gl, extensions, parameters, utils ) {\r\n\r\n\tlet maxAnisotropy;\r\n\r\n\tfunction getMaxAnisotropy() {\r\n\r\n\t\tif ( maxAnisotropy !== undefined ) return maxAnisotropy;\r\n\r\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\r\n\r\n\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\r\n\r\n\t\t\tmaxAnisotropy = gl.getParameter( extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tmaxAnisotropy = 0;\r\n\r\n\t\t}\r\n\r\n\t\treturn maxAnisotropy;\r\n\r\n\t}\r\n\r\n\tfunction textureFormatReadable( textureFormat ) {\r\n\r\n\t\tif ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_FORMAT ) ) {\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t}\r\n\r\n\tfunction textureTypeReadable( textureType ) {\r\n\r\n\t\tconst halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) );\r\n\r\n\t\tif ( textureType !== UnsignedByteType && utils.convert( textureType ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)\r\n\t\t\ttextureType !== FloatType && ! halfFloatSupportedByExt ) {\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t}\r\n\r\n\tfunction getMaxPrecision( precision ) {\r\n\r\n\t\tif ( precision === 'highp' ) {\r\n\r\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.HIGH_FLOAT ).precision > 0 &&\r\n\t\t\t\tgl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.HIGH_FLOAT ).precision > 0 ) {\r\n\r\n\t\t\t\treturn 'highp';\r\n\r\n\t\t\t}\r\n\r\n\t\t\tprecision = 'mediump';\r\n\r\n\t\t}\r\n\r\n\t\tif ( precision === 'mediump' ) {\r\n\r\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.MEDIUM_FLOAT ).precision > 0 &&\r\n\t\t\t\tgl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT ).precision > 0 ) {\r\n\r\n\t\t\t\treturn 'mediump';\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn 'lowp';\r\n\r\n\t}\r\n\r\n\tlet precision = parameters.precision !== undefined ? parameters.precision : 'highp';\r\n\tconst maxPrecision = getMaxPrecision( precision );\r\n\r\n\tif ( maxPrecision !== precision ) {\r\n\r\n\t\tconsole.warn( 'THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.' );\r\n\t\tprecision = maxPrecision;\r\n\r\n\t}\r\n\r\n\tconst logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;\r\n\r\n\tconst maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );\r\n\tconst maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );\r\n\tconst maxTextureSize = gl.getParameter( gl.MAX_TEXTURE_SIZE );\r\n\tconst maxCubemapSize = gl.getParameter( gl.MAX_CUBE_MAP_TEXTURE_SIZE );\r\n\r\n\tconst maxAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\r\n\tconst maxVertexUniforms = gl.getParameter( gl.MAX_VERTEX_UNIFORM_VECTORS );\r\n\tconst maxVaryings = gl.getParameter( gl.MAX_VARYING_VECTORS );\r\n\tconst maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS );\r\n\r\n\tconst vertexTextures = maxVertexTextures > 0;\r\n\r\n\tconst maxSamples = gl.getParameter( gl.MAX_SAMPLES );\r\n\r\n\treturn {\r\n\r\n\t\tisWebGL2: true, // keeping this for backwards compatibility\r\n\r\n\t\tgetMaxAnisotropy: getMaxAnisotropy,\r\n\t\tgetMaxPrecision: getMaxPrecision,\r\n\r\n\t\ttextureFormatReadable: textureFormatReadable,\r\n\t\ttextureTypeReadable: textureTypeReadable,\r\n\r\n\t\tprecision: precision,\r\n\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\r\n\r\n\t\tmaxTextures: maxTextures,\r\n\t\tmaxVertexTextures: maxVertexTextures,\r\n\t\tmaxTextureSize: maxTextureSize,\r\n\t\tmaxCubemapSize: maxCubemapSize,\r\n\r\n\t\tmaxAttributes: maxAttributes,\r\n\t\tmaxVertexUniforms: maxVertexUniforms,\r\n\t\tmaxVaryings: maxVaryings,\r\n\t\tmaxFragmentUniforms: maxFragmentUniforms,\r\n\r\n\t\tvertexTextures: vertexTextures,\r\n\r\n\t\tmaxSamples: maxSamples\r\n\r\n\t};\r\n\r\n}\r\n\r\nfunction WebGLClipping( properties ) {\r\n\r\n\tconst scope = this;\r\n\r\n\tlet globalState = null,\r\n\t\tnumGlobalPlanes = 0,\r\n\t\tlocalClippingEnabled = false,\r\n\t\trenderingShadows = false;\r\n\r\n\tconst plane = new Plane(),\r\n\t\tviewNormalMatrix = new Matrix3(),\r\n\r\n\t\tuniform = { value: null, needsUpdate: false };\r\n\r\n\tthis.uniform = uniform;\r\n\tthis.numPlanes = 0;\r\n\tthis.numIntersection = 0;\r\n\r\n\tthis.init = function ( planes, enableLocalClipping ) {\r\n\r\n\t\tconst enabled =\r\n\t\t\tplanes.length !== 0 ||\r\n\t\t\tenableLocalClipping ||\r\n\t\t\t// enable state of previous frame - the clipping code has to\r\n\t\t\t// run another frame in order to reset the state:\r\n\t\t\tnumGlobalPlanes !== 0 ||\r\n\t\t\tlocalClippingEnabled;\r\n\r\n\t\tlocalClippingEnabled = enableLocalClipping;\r\n\r\n\t\tnumGlobalPlanes = planes.length;\r\n\r\n\t\treturn enabled;\r\n\r\n\t};\r\n\r\n\tthis.beginShadows = function () {\r\n\r\n\t\trenderingShadows = true;\r\n\t\tprojectPlanes( null );\r\n\r\n\t};\r\n\r\n\tthis.endShadows = function () {\r\n\r\n\t\trenderingShadows = false;\r\n\r\n\t};\r\n\r\n\tthis.setGlobalState = function ( planes, camera ) {\r\n\r\n\t\tglobalState = projectPlanes( planes, camera, 0 );\r\n\r\n\t};\r\n\r\n\tthis.setState = function ( material, camera, useCache ) {\r\n\r\n\t\tconst planes = material.clippingPlanes,\r\n\t\t\tclipIntersection = material.clipIntersection,\r\n\t\t\tclipShadows = material.clipShadows;\r\n\r\n\t\tconst materialProperties = properties.get( material );\r\n\r\n\t\tif ( ! localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && ! clipShadows ) {\r\n\r\n\t\t\t// there's no local clipping\r\n\r\n\t\t\tif ( renderingShadows ) {\r\n\r\n\t\t\t\t// there's no global clipping\r\n\r\n\t\t\t\tprojectPlanes( null );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tresetGlobalState();\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst nGlobal = renderingShadows ? 0 : numGlobalPlanes,\r\n\t\t\t\tlGlobal = nGlobal * 4;\r\n\r\n\t\t\tlet dstArray = materialProperties.clippingState || null;\r\n\r\n\t\t\tuniform.value = dstArray; // ensure unique state\r\n\r\n\t\t\tdstArray = projectPlanes( planes, camera, lGlobal, useCache );\r\n\r\n\t\t\tfor ( let i = 0; i !== lGlobal; ++ i ) {\r\n\r\n\t\t\t\tdstArray[ i ] = globalState[ i ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tmaterialProperties.clippingState = dstArray;\r\n\t\t\tthis.numIntersection = clipIntersection ? this.numPlanes : 0;\r\n\t\t\tthis.numPlanes += nGlobal;\r\n\r\n\t\t}\r\n\r\n\r\n\t};\r\n\r\n\tfunction resetGlobalState() {\r\n\r\n\t\tif ( uniform.value !== globalState ) {\r\n\r\n\t\t\tuniform.value = globalState;\r\n\t\t\tuniform.needsUpdate = numGlobalPlanes > 0;\r\n\r\n\t\t}\r\n\r\n\t\tscope.numPlanes = numGlobalPlanes;\r\n\t\tscope.numIntersection = 0;\r\n\r\n\t}\r\n\r\n\tfunction projectPlanes( planes, camera, dstOffset, skipTransform ) {\r\n\r\n\t\tconst nPlanes = planes !== null ? planes.length : 0;\r\n\t\tlet dstArray = null;\r\n\r\n\t\tif ( nPlanes !== 0 ) {\r\n\r\n\t\t\tdstArray = uniform.value;\r\n\r\n\t\t\tif ( skipTransform !== true || dstArray === null ) {\r\n\r\n\t\t\t\tconst flatSize = dstOffset + nPlanes * 4,\r\n\t\t\t\t\tviewMatrix = camera.matrixWorldInverse;\r\n\r\n\t\t\t\tviewNormalMatrix.getNormalMatrix( viewMatrix );\r\n\r\n\t\t\t\tif ( dstArray === null || dstArray.length < flatSize ) {\r\n\r\n\t\t\t\t\tdstArray = new Float32Array( flatSize );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor ( let i = 0, i4 = dstOffset; i !== nPlanes; ++ i, i4 += 4 ) {\r\n\r\n\t\t\t\t\tplane.copy( planes[ i ] ).applyMatrix4( viewMatrix, viewNormalMatrix );\r\n\r\n\t\t\t\t\tplane.normal.toArray( dstArray, i4 );\r\n\t\t\t\t\tdstArray[ i4 + 3 ] = plane.constant;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuniform.value = dstArray;\r\n\t\t\tuniform.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t\tscope.numPlanes = nPlanes;\r\n\t\tscope.numIntersection = 0;\r\n\r\n\t\treturn dstArray;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction WebGLCubeMaps( renderer ) {\r\n\r\n\tlet cubemaps = new WeakMap();\r\n\r\n\tfunction mapTextureMapping( texture, mapping ) {\r\n\r\n\t\tif ( mapping === EquirectangularReflectionMapping ) {\r\n\r\n\t\t\ttexture.mapping = CubeReflectionMapping;\r\n\r\n\t\t} else if ( mapping === EquirectangularRefractionMapping ) {\r\n\r\n\t\t\ttexture.mapping = CubeRefractionMapping;\r\n\r\n\t\t}\r\n\r\n\t\treturn texture;\r\n\r\n\t}\r\n\r\n\tfunction get( texture ) {\r\n\r\n\t\tif ( texture && texture.isTexture ) {\r\n\r\n\t\t\tconst mapping = texture.mapping;\r\n\r\n\t\t\tif ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping ) {\r\n\r\n\t\t\t\tif ( cubemaps.has( texture ) ) {\r\n\r\n\t\t\t\t\tconst cubemap = cubemaps.get( texture ).texture;\r\n\t\t\t\t\treturn mapTextureMapping( cubemap, texture.mapping );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tconst image = texture.image;\r\n\r\n\t\t\t\t\tif ( image && image.height > 0 ) {\r\n\r\n\t\t\t\t\t\tconst renderTarget = new WebGLCubeRenderTarget( image.height );\r\n\t\t\t\t\t\trenderTarget.fromEquirectangularTexture( renderer, texture );\r\n\t\t\t\t\t\tcubemaps.set( texture, renderTarget );\r\n\r\n\t\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\r\n\r\n\t\t\t\t\t\treturn mapTextureMapping( renderTarget.texture, texture.mapping );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t// image not yet ready. try the conversion next frame\r\n\r\n\t\t\t\t\t\treturn null;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn texture;\r\n\r\n\t}\r\n\r\n\tfunction onTextureDispose( event ) {\r\n\r\n\t\tconst texture = event.target;\r\n\r\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\r\n\r\n\t\tconst cubemap = cubemaps.get( texture );\r\n\r\n\t\tif ( cubemap !== undefined ) {\r\n\r\n\t\t\tcubemaps.delete( texture );\r\n\t\t\tcubemap.dispose();\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction dispose() {\r\n\r\n\t\tcubemaps = new WeakMap();\r\n\r\n\t}\r\n\r\n\treturn {\r\n\t\tget: get,\r\n\t\tdispose: dispose\r\n\t};\r\n\r\n}\r\n\r\nclass OrthographicCamera extends Camera {\r\n\r\n\tconstructor( left = - 1, right = 1, top = 1, bottom = - 1, near = 0.1, far = 2000 ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isOrthographicCamera = true;\r\n\r\n\t\tthis.type = 'OrthographicCamera';\r\n\r\n\t\tthis.zoom = 1;\r\n\t\tthis.view = null;\r\n\r\n\t\tthis.left = left;\r\n\t\tthis.right = right;\r\n\t\tthis.top = top;\r\n\t\tthis.bottom = bottom;\r\n\r\n\t\tthis.near = near;\r\n\t\tthis.far = far;\r\n\r\n\t\tthis.updateProjectionMatrix();\r\n\r\n\t}\r\n\r\n\tcopy( source, recursive ) {\r\n\r\n\t\tsuper.copy( source, recursive );\r\n\r\n\t\tthis.left = source.left;\r\n\t\tthis.right = source.right;\r\n\t\tthis.top = source.top;\r\n\t\tthis.bottom = source.bottom;\r\n\t\tthis.near = source.near;\r\n\t\tthis.far = source.far;\r\n\r\n\t\tthis.zoom = source.zoom;\r\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\r\n\r\n\t\tif ( this.view === null ) {\r\n\r\n\t\t\tthis.view = {\r\n\t\t\t\tenabled: true,\r\n\t\t\t\tfullWidth: 1,\r\n\t\t\t\tfullHeight: 1,\r\n\t\t\t\toffsetX: 0,\r\n\t\t\t\toffsetY: 0,\r\n\t\t\t\twidth: 1,\r\n\t\t\t\theight: 1\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t\tthis.view.enabled = true;\r\n\t\tthis.view.fullWidth = fullWidth;\r\n\t\tthis.view.fullHeight = fullHeight;\r\n\t\tthis.view.offsetX = x;\r\n\t\tthis.view.offsetY = y;\r\n\t\tthis.view.width = width;\r\n\t\tthis.view.height = height;\r\n\r\n\t\tthis.updateProjectionMatrix();\r\n\r\n\t}\r\n\r\n\tclearViewOffset() {\r\n\r\n\t\tif ( this.view !== null ) {\r\n\r\n\t\t\tthis.view.enabled = false;\r\n\r\n\t\t}\r\n\r\n\t\tthis.updateProjectionMatrix();\r\n\r\n\t}\r\n\r\n\tupdateProjectionMatrix() {\r\n\r\n\t\tconst dx = ( this.right - this.left ) / ( 2 * this.zoom );\r\n\t\tconst dy = ( this.top - this.bottom ) / ( 2 * this.zoom );\r\n\t\tconst cx = ( this.right + this.left ) / 2;\r\n\t\tconst cy = ( this.top + this.bottom ) / 2;\r\n\r\n\t\tlet left = cx - dx;\r\n\t\tlet right = cx + dx;\r\n\t\tlet top = cy + dy;\r\n\t\tlet bottom = cy - dy;\r\n\r\n\t\tif ( this.view !== null && this.view.enabled ) {\r\n\r\n\t\t\tconst scaleW = ( this.right - this.left ) / this.view.fullWidth / this.zoom;\r\n\t\t\tconst scaleH = ( this.top - this.bottom ) / this.view.fullHeight / this.zoom;\r\n\r\n\t\t\tleft += scaleW * this.view.offsetX;\r\n\t\t\tright = left + scaleW * this.view.width;\r\n\t\t\ttop -= scaleH * this.view.offsetY;\r\n\t\t\tbottom = top - scaleH * this.view.height;\r\n\r\n\t\t}\r\n\r\n\t\tthis.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far, this.coordinateSystem );\r\n\r\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\r\n\r\n\t}\r\n\r\n\ttoJSON( meta ) {\r\n\r\n\t\tconst data = super.toJSON( meta );\r\n\r\n\t\tdata.object.zoom = this.zoom;\r\n\t\tdata.object.left = this.left;\r\n\t\tdata.object.right = this.right;\r\n\t\tdata.object.top = this.top;\r\n\t\tdata.object.bottom = this.bottom;\r\n\t\tdata.object.near = this.near;\r\n\t\tdata.object.far = this.far;\r\n\r\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst LOD_MIN = 4;\r\n\r\n// The standard deviations (radians) associated with the extra mips. These are\r\n// chosen to approximate a Trowbridge-Reitz distribution function times the\r\n// geometric shadowing function. These sigma values squared must match the\r\n// variance #defines in cube_uv_reflection_fragment.glsl.js.\r\nconst EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ];\r\n\r\n// The maximum length of the blur for loop. Smaller sigmas will use fewer\r\n// samples and exit early, but not recompile the shader.\r\nconst MAX_SAMPLES = 20;\r\n\r\nconst _flatCamera = /*@__PURE__*/ new OrthographicCamera();\r\nconst _clearColor = /*@__PURE__*/ new Color();\r\nlet _oldTarget = null;\r\nlet _oldActiveCubeFace = 0;\r\nlet _oldActiveMipmapLevel = 0;\r\nlet _oldXrEnabled = false;\r\n\r\n// Golden Ratio\r\nconst PHI = ( 1 + Math.sqrt( 5 ) ) / 2;\r\nconst INV_PHI = 1 / PHI;\r\n\r\n// Vertices of a dodecahedron (except the opposites, which represent the\r\n// same axis), used as axis directions evenly spread on a sphere.\r\nconst _axisDirections = [\r\n\t/*@__PURE__*/ new Vector3( - PHI, INV_PHI, 0 ),\r\n\t/*@__PURE__*/ new Vector3( PHI, INV_PHI, 0 ),\r\n\t/*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),\r\n\t/*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),\r\n\t/*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),\r\n\t/*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),\r\n\t/*@__PURE__*/ new Vector3( - 1, 1, - 1 ),\r\n\t/*@__PURE__*/ new Vector3( 1, 1, - 1 ),\r\n\t/*@__PURE__*/ new Vector3( - 1, 1, 1 ),\r\n\t/*@__PURE__*/ new Vector3( 1, 1, 1 ) ];\r\n\r\n/**\r\n * This class generates a Prefiltered, Mipmapped Radiance Environment Map\r\n * (PMREM) from a cubeMap environment texture. This allows different levels of\r\n * blur to be quickly accessed based on material roughness. It is packed into a\r\n * special CubeUV format that allows us to perform custom interpolation so that\r\n * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap\r\n * chain, it only goes down to the LOD_MIN level (above), and then creates extra\r\n * even more filtered 'mips' at the same LOD_MIN resolution, associated with\r\n * higher roughness levels. In this way we maintain resolution to smoothly\r\n * interpolate diffuse lighting while limiting sampling computation.\r\n *\r\n * Paper: Fast, Accurate Image-Based Lighting\r\n * https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view\r\n*/\r\n\r\nclass PMREMGenerator {\r\n\r\n\tconstructor( renderer ) {\r\n\r\n\t\tthis._renderer = renderer;\r\n\t\tthis._pingPongRenderTarget = null;\r\n\r\n\t\tthis._lodMax = 0;\r\n\t\tthis._cubeSize = 0;\r\n\t\tthis._lodPlanes = [];\r\n\t\tthis._sizeLods = [];\r\n\t\tthis._sigmas = [];\r\n\r\n\t\tthis._blurMaterial = null;\r\n\t\tthis._cubemapMaterial = null;\r\n\t\tthis._equirectMaterial = null;\r\n\r\n\t\tthis._compileMaterial( this._blurMaterial );\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Generates a PMREM from a supplied Scene, which can be faster than using an\r\n\t * image if networking bandwidth is low. Optional sigma specifies a blur radius\r\n\t * in radians to be applied to the scene before PMREM generation. Optional near\r\n\t * and far planes ensure the scene is rendered in its entirety (the cubeCamera\r\n\t * is placed at the origin).\r\n\t */\r\n\tfromScene( scene, sigma = 0, near = 0.1, far = 100 ) {\r\n\r\n\t\t_oldTarget = this._renderer.getRenderTarget();\r\n\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\r\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\r\n\t\t_oldXrEnabled = this._renderer.xr.enabled;\r\n\r\n\t\tthis._renderer.xr.enabled = false;\r\n\r\n\t\tthis._setSize( 256 );\r\n\r\n\t\tconst cubeUVRenderTarget = this._allocateTargets();\r\n\t\tcubeUVRenderTarget.depthBuffer = true;\r\n\r\n\t\tthis._sceneToCubeUV( scene, near, far, cubeUVRenderTarget );\r\n\r\n\t\tif ( sigma > 0 ) {\r\n\r\n\t\t\tthis._blur( cubeUVRenderTarget, 0, 0, sigma );\r\n\r\n\t\t}\r\n\r\n\t\tthis._applyPMREM( cubeUVRenderTarget );\r\n\t\tthis._cleanup( cubeUVRenderTarget );\r\n\r\n\t\treturn cubeUVRenderTarget;\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Generates a PMREM from an equirectangular texture, which can be either LDR\r\n\t * or HDR. The ideal input image size is 1k (1024 x 512),\r\n\t * as this matches best with the 256 x 256 cubemap output.\r\n\t * The smallest supported equirectangular image size is 64 x 32.\r\n\t */\r\n\tfromEquirectangular( equirectangular, renderTarget = null ) {\r\n\r\n\t\treturn this._fromTexture( equirectangular, renderTarget );\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Generates a PMREM from an cubemap texture, which can be either LDR\r\n\t * or HDR. The ideal input cube size is 256 x 256,\r\n\t * as this matches best with the 256 x 256 cubemap output.\r\n\t * The smallest supported cube size is 16 x 16.\r\n\t */\r\n\tfromCubemap( cubemap, renderTarget = null ) {\r\n\r\n\t\treturn this._fromTexture( cubemap, renderTarget );\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during\r\n\t * your texture's network fetch for increased concurrency.\r\n\t */\r\n\tcompileCubemapShader() {\r\n\r\n\t\tif ( this._cubemapMaterial === null ) {\r\n\r\n\t\t\tthis._cubemapMaterial = _getCubemapMaterial();\r\n\t\t\tthis._compileMaterial( this._cubemapMaterial );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during\r\n\t * your texture's network fetch for increased concurrency.\r\n\t */\r\n\tcompileEquirectangularShader() {\r\n\r\n\t\tif ( this._equirectMaterial === null ) {\r\n\r\n\t\t\tthis._equirectMaterial = _getEquirectMaterial();\r\n\t\t\tthis._compileMaterial( this._equirectMaterial );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,\r\n\t * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on\r\n\t * one of them will cause any others to also become unusable.\r\n\t */\r\n\tdispose() {\r\n\r\n\t\tthis._dispose();\r\n\r\n\t\tif ( this._cubemapMaterial !== null ) this._cubemapMaterial.dispose();\r\n\t\tif ( this._equirectMaterial !== null ) this._equirectMaterial.dispose();\r\n\r\n\t}\r\n\r\n\t// private interface\r\n\r\n\t_setSize( cubeSize ) {\r\n\r\n\t\tthis._lodMax = Math.floor( Math.log2( cubeSize ) );\r\n\t\tthis._cubeSize = Math.pow( 2, this._lodMax );\r\n\r\n\t}\r\n\r\n\t_dispose() {\r\n\r\n\t\tif ( this._blurMaterial !== null ) this._blurMaterial.dispose();\r\n\r\n\t\tif ( this._pingPongRenderTarget !== null ) this._pingPongRenderTarget.dispose();\r\n\r\n\t\tfor ( let i = 0; i < this._lodPlanes.length; i ++ ) {\r\n\r\n\t\t\tthis._lodPlanes[ i ].dispose();\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t_cleanup( outputTarget ) {\r\n\r\n\t\tthis._renderer.setRenderTarget( _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel );\r\n\t\tthis._renderer.xr.enabled = _oldXrEnabled;\r\n\r\n\t\toutputTarget.scissorTest = false;\r\n\t\t_setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );\r\n\r\n\t}\r\n\r\n\t_fromTexture( texture, renderTarget ) {\r\n\r\n\t\tif ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping ) {\r\n\r\n\t\t\tthis._setSize( texture.image.length === 0 ? 16 : ( texture.image[ 0 ].width || texture.image[ 0 ].image.width ) );\r\n\r\n\t\t} else { // Equirectangular\r\n\r\n\t\t\tthis._setSize( texture.image.width / 4 );\r\n\r\n\t\t}\r\n\r\n\t\t_oldTarget = this._renderer.getRenderTarget();\r\n\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\r\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\r\n\t\t_oldXrEnabled = this._renderer.xr.enabled;\r\n\r\n\t\tthis._renderer.xr.enabled = false;\r\n\r\n\t\tconst cubeUVRenderTarget = renderTarget || this._allocateTargets();\r\n\t\tthis._textureToCubeUV( texture, cubeUVRenderTarget );\r\n\t\tthis._applyPMREM( cubeUVRenderTarget );\r\n\t\tthis._cleanup( cubeUVRenderTarget );\r\n\r\n\t\treturn cubeUVRenderTarget;\r\n\r\n\t}\r\n\r\n\t_allocateTargets() {\r\n\r\n\t\tconst width = 3 * Math.max( this._cubeSize, 16 * 7 );\r\n\t\tconst height = 4 * this._cubeSize;\r\n\r\n\t\tconst params = {\r\n\t\t\tmagFilter: LinearFilter,\r\n\t\t\tminFilter: LinearFilter,\r\n\t\t\tgenerateMipmaps: false,\r\n\t\t\ttype: HalfFloatType,\r\n\t\t\tformat: RGBAFormat,\r\n\t\t\tcolorSpace: LinearSRGBColorSpace,\r\n\t\t\tdepthBuffer: false\r\n\t\t};\r\n\r\n\t\tconst cubeUVRenderTarget = _createRenderTarget( width, height, params );\r\n\r\n\t\tif ( this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== width || this._pingPongRenderTarget.height !== height ) {\r\n\r\n\t\t\tif ( this._pingPongRenderTarget !== null ) {\r\n\r\n\t\t\t\tthis._dispose();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis._pingPongRenderTarget = _createRenderTarget( width, height, params );\r\n\r\n\t\t\tconst { _lodMax } = this;\r\n\t\t\t( { sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = _createPlanes( _lodMax ) );\r\n\r\n\t\t\tthis._blurMaterial = _getBlurShader( _lodMax, width, height );\r\n\r\n\t\t}\r\n\r\n\t\treturn cubeUVRenderTarget;\r\n\r\n\t}\r\n\r\n\t_compileMaterial( material ) {\r\n\r\n\t\tconst tmpMesh = new Mesh( this._lodPlanes[ 0 ], material );\r\n\t\tthis._renderer.compile( tmpMesh, _flatCamera );\r\n\r\n\t}\r\n\r\n\t_sceneToCubeUV( scene, near, far, cubeUVRenderTarget ) {\r\n\r\n\t\tconst fov = 90;\r\n\t\tconst aspect = 1;\r\n\t\tconst cubeCamera = new PerspectiveCamera( fov, aspect, near, far );\r\n\t\tconst upSign = [ 1, - 1, 1, 1, 1, 1 ];\r\n\t\tconst forwardSign = [ 1, 1, 1, - 1, - 1, - 1 ];\r\n\t\tconst renderer = this._renderer;\r\n\r\n\t\tconst originalAutoClear = renderer.autoClear;\r\n\t\tconst toneMapping = renderer.toneMapping;\r\n\t\trenderer.getClearColor( _clearColor );\r\n\r\n\t\trenderer.toneMapping = NoToneMapping;\r\n\t\trenderer.autoClear = false;\r\n\r\n\t\tconst backgroundMaterial = new MeshBasicMaterial( {\r\n\t\t\tname: 'PMREM.Background',\r\n\t\t\tside: BackSide,\r\n\t\t\tdepthWrite: false,\r\n\t\t\tdepthTest: false,\r\n\t\t} );\r\n\r\n\t\tconst backgroundBox = new Mesh( new BoxGeometry(), backgroundMaterial );\r\n\r\n\t\tlet useSolidColor = false;\r\n\t\tconst background = scene.background;\r\n\r\n\t\tif ( background ) {\r\n\r\n\t\t\tif ( background.isColor ) {\r\n\r\n\t\t\t\tbackgroundMaterial.color.copy( background );\r\n\t\t\t\tscene.background = null;\r\n\t\t\t\tuseSolidColor = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tbackgroundMaterial.color.copy( _clearColor );\r\n\t\t\tuseSolidColor = true;\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tconst col = i % 3;\r\n\r\n\t\t\tif ( col === 0 ) {\r\n\r\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\r\n\t\t\t\tcubeCamera.lookAt( forwardSign[ i ], 0, 0 );\r\n\r\n\t\t\t} else if ( col === 1 ) {\r\n\r\n\t\t\t\tcubeCamera.up.set( 0, 0, upSign[ i ] );\r\n\t\t\t\tcubeCamera.lookAt( 0, forwardSign[ i ], 0 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\r\n\t\t\t\tcubeCamera.lookAt( 0, 0, forwardSign[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst size = this._cubeSize;\r\n\r\n\t\t\t_setViewport( cubeUVRenderTarget, col * size, i > 2 ? size : 0, size, size );\r\n\r\n\t\t\trenderer.setRenderTarget( cubeUVRenderTarget );\r\n\r\n\t\t\tif ( useSolidColor ) {\r\n\r\n\t\t\t\trenderer.render( backgroundBox, cubeCamera );\r\n\r\n\t\t\t}\r\n\r\n\t\t\trenderer.render( scene, cubeCamera );\r\n\r\n\t\t}\r\n\r\n\t\tbackgroundBox.geometry.dispose();\r\n\t\tbackgroundBox.material.dispose();\r\n\r\n\t\trenderer.toneMapping = toneMapping;\r\n\t\trenderer.autoClear = originalAutoClear;\r\n\t\tscene.background = background;\r\n\r\n\t}\r\n\r\n\t_textureToCubeUV( texture, cubeUVRenderTarget ) {\r\n\r\n\t\tconst renderer = this._renderer;\r\n\r\n\t\tconst isCubeTexture = ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping );\r\n\r\n\t\tif ( isCubeTexture ) {\r\n\r\n\t\t\tif ( this._cubemapMaterial === null ) {\r\n\r\n\t\t\t\tthis._cubemapMaterial = _getCubemapMaterial();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis._cubemapMaterial.uniforms.flipEnvMap.value = ( texture.isRenderTargetTexture === false ) ? - 1 : 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tif ( this._equirectMaterial === null ) {\r\n\r\n\t\t\t\tthis._equirectMaterial = _getEquirectMaterial();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconst material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial;\r\n\t\tconst mesh = new Mesh( this._lodPlanes[ 0 ], material );\r\n\r\n\t\tconst uniforms = material.uniforms;\r\n\r\n\t\tuniforms[ 'envMap' ].value = texture;\r\n\r\n\t\tconst size = this._cubeSize;\r\n\r\n\t\t_setViewport( cubeUVRenderTarget, 0, 0, 3 * size, 2 * size );\r\n\r\n\t\trenderer.setRenderTarget( cubeUVRenderTarget );\r\n\t\trenderer.render( mesh, _flatCamera );\r\n\r\n\t}\r\n\r\n\t_applyPMREM( cubeUVRenderTarget ) {\r\n\r\n\t\tconst renderer = this._renderer;\r\n\t\tconst autoClear = renderer.autoClear;\r\n\t\trenderer.autoClear = false;\r\n\t\tconst n = this._lodPlanes.length;\r\n\r\n\t\tfor ( let i = 1; i < n; i ++ ) {\r\n\r\n\t\t\tconst sigma = Math.sqrt( this._sigmas[ i ] * this._sigmas[ i ] - this._sigmas[ i - 1 ] * this._sigmas[ i - 1 ] );\r\n\r\n\t\t\tconst poleAxis = _axisDirections[ ( n - i - 1 ) % _axisDirections.length ];\r\n\r\n\t\t\tthis._blur( cubeUVRenderTarget, i - 1, i, sigma, poleAxis );\r\n\r\n\t\t}\r\n\r\n\t\trenderer.autoClear = autoClear;\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * This is a two-pass Gaussian blur for a cubemap. Normally this is done\r\n\t * vertically and horizontally, but this breaks down on a cube. Here we apply\r\n\t * the blur latitudinally (around the poles), and then longitudinally (towards\r\n\t * the poles) to approximate the orthogonally-separable blur. It is least\r\n\t * accurate at the poles, but still does a decent job.\r\n\t */\r\n\t_blur( cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis ) {\r\n\r\n\t\tconst pingPongRenderTarget = this._pingPongRenderTarget;\r\n\r\n\t\tthis._halfBlur(\r\n\t\t\tcubeUVRenderTarget,\r\n\t\t\tpingPongRenderTarget,\r\n\t\t\tlodIn,\r\n\t\t\tlodOut,\r\n\t\t\tsigma,\r\n\t\t\t'latitudinal',\r\n\t\t\tpoleAxis );\r\n\r\n\t\tthis._halfBlur(\r\n\t\t\tpingPongRenderTarget,\r\n\t\t\tcubeUVRenderTarget,\r\n\t\t\tlodOut,\r\n\t\t\tlodOut,\r\n\t\t\tsigma,\r\n\t\t\t'longitudinal',\r\n\t\t\tpoleAxis );\r\n\r\n\t}\r\n\r\n\t_halfBlur( targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis ) {\r\n\r\n\t\tconst renderer = this._renderer;\r\n\t\tconst blurMaterial = this._blurMaterial;\r\n\r\n\t\tif ( direction !== 'latitudinal' && direction !== 'longitudinal' ) {\r\n\r\n\t\t\tconsole.error(\r\n\t\t\t\t'blur direction must be either latitudinal or longitudinal!' );\r\n\r\n\t\t}\r\n\r\n\t\t// Number of standard deviations at which to cut off the discrete approximation.\r\n\t\tconst STANDARD_DEVIATIONS = 3;\r\n\r\n\t\tconst blurMesh = new Mesh( this._lodPlanes[ lodOut ], blurMaterial );\r\n\t\tconst blurUniforms = blurMaterial.uniforms;\r\n\r\n\t\tconst pixels = this._sizeLods[ lodIn ] - 1;\r\n\t\tconst radiansPerPixel = isFinite( sigmaRadians ) ? Math.PI / ( 2 * pixels ) : 2 * Math.PI / ( 2 * MAX_SAMPLES - 1 );\r\n\t\tconst sigmaPixels = sigmaRadians / radiansPerPixel;\r\n\t\tconst samples = isFinite( sigmaRadians ) ? 1 + Math.floor( STANDARD_DEVIATIONS * sigmaPixels ) : MAX_SAMPLES;\r\n\r\n\t\tif ( samples > MAX_SAMPLES ) {\r\n\r\n\t\t\tconsole.warn( `sigmaRadians, ${\r\n\t\t\t\tsigmaRadians}, is too large and will clip, as it requested ${\r\n\t\t\t\tsamples} samples when the maximum is set to ${MAX_SAMPLES}` );\r\n\r\n\t\t}\r\n\r\n\t\tconst weights = [];\r\n\t\tlet sum = 0;\r\n\r\n\t\tfor ( let i = 0; i < MAX_SAMPLES; ++ i ) {\r\n\r\n\t\t\tconst x = i / sigmaPixels;\r\n\t\t\tconst weight = Math.exp( - x * x / 2 );\r\n\t\t\tweights.push( weight );\r\n\r\n\t\t\tif ( i === 0 ) {\r\n\r\n\t\t\t\tsum += weight;\r\n\r\n\t\t\t} else if ( i < samples ) {\r\n\r\n\t\t\t\tsum += 2 * weight;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < weights.length; i ++ ) {\r\n\r\n\t\t\tweights[ i ] = weights[ i ] / sum;\r\n\r\n\t\t}\r\n\r\n\t\tblurUniforms[ 'envMap' ].value = targetIn.texture;\r\n\t\tblurUniforms[ 'samples' ].value = samples;\r\n\t\tblurUniforms[ 'weights' ].value = weights;\r\n\t\tblurUniforms[ 'latitudinal' ].value = direction === 'latitudinal';\r\n\r\n\t\tif ( poleAxis ) {\r\n\r\n\t\t\tblurUniforms[ 'poleAxis' ].value = poleAxis;\r\n\r\n\t\t}\r\n\r\n\t\tconst { _lodMax } = this;\r\n\t\tblurUniforms[ 'dTheta' ].value = radiansPerPixel;\r\n\t\tblurUniforms[ 'mipInt' ].value = _lodMax - lodIn;\r\n\r\n\t\tconst outputSize = this._sizeLods[ lodOut ];\r\n\t\tconst x = 3 * outputSize * ( lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0 );\r\n\t\tconst y = 4 * ( this._cubeSize - outputSize );\r\n\r\n\t\t_setViewport( targetOut, x, y, 3 * outputSize, 2 * outputSize );\r\n\t\trenderer.setRenderTarget( targetOut );\r\n\t\trenderer.render( blurMesh, _flatCamera );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\n\r\nfunction _createPlanes( lodMax ) {\r\n\r\n\tconst lodPlanes = [];\r\n\tconst sizeLods = [];\r\n\tconst sigmas = [];\r\n\r\n\tlet lod = lodMax;\r\n\r\n\tconst totalLods = lodMax - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;\r\n\r\n\tfor ( let i = 0; i < totalLods; i ++ ) {\r\n\r\n\t\tconst sizeLod = Math.pow( 2, lod );\r\n\t\tsizeLods.push( sizeLod );\r\n\t\tlet sigma = 1.0 / sizeLod;\r\n\r\n\t\tif ( i > lodMax - LOD_MIN ) {\r\n\r\n\t\t\tsigma = EXTRA_LOD_SIGMA[ i - lodMax + LOD_MIN - 1 ];\r\n\r\n\t\t} else if ( i === 0 ) {\r\n\r\n\t\t\tsigma = 0;\r\n\r\n\t\t}\r\n\r\n\t\tsigmas.push( sigma );\r\n\r\n\t\tconst texelSize = 1.0 / ( sizeLod - 2 );\r\n\t\tconst min = - texelSize;\r\n\t\tconst max = 1 + texelSize;\r\n\t\tconst uv1 = [ min, min, max, min, max, max, min, min, max, max, min, max ];\r\n\r\n\t\tconst cubeFaces = 6;\r\n\t\tconst vertices = 6;\r\n\t\tconst positionSize = 3;\r\n\t\tconst uvSize = 2;\r\n\t\tconst faceIndexSize = 1;\r\n\r\n\t\tconst position = new Float32Array( positionSize * vertices * cubeFaces );\r\n\t\tconst uv = new Float32Array( uvSize * vertices * cubeFaces );\r\n\t\tconst faceIndex = new Float32Array( faceIndexSize * vertices * cubeFaces );\r\n\r\n\t\tfor ( let face = 0; face < cubeFaces; face ++ ) {\r\n\r\n\t\t\tconst x = ( face % 3 ) * 2 / 3 - 1;\r\n\t\t\tconst y = face > 2 ? 0 : - 1;\r\n\t\t\tconst coordinates = [\r\n\t\t\t\tx, y, 0,\r\n\t\t\t\tx + 2 / 3, y, 0,\r\n\t\t\t\tx + 2 / 3, y + 1, 0,\r\n\t\t\t\tx, y, 0,\r\n\t\t\t\tx + 2 / 3, y + 1, 0,\r\n\t\t\t\tx, y + 1, 0\r\n\t\t\t];\r\n\t\t\tposition.set( coordinates, positionSize * vertices * face );\r\n\t\t\tuv.set( uv1, uvSize * vertices * face );\r\n\t\t\tconst fill = [ face, face, face, face, face, face ];\r\n\t\t\tfaceIndex.set( fill, faceIndexSize * vertices * face );\r\n\r\n\t\t}\r\n\r\n\t\tconst planes = new BufferGeometry();\r\n\t\tplanes.setAttribute( 'position', new BufferAttribute( position, positionSize ) );\r\n\t\tplanes.setAttribute( 'uv', new BufferAttribute( uv, uvSize ) );\r\n\t\tplanes.setAttribute( 'faceIndex', new BufferAttribute( faceIndex, faceIndexSize ) );\r\n\t\tlodPlanes.push( planes );\r\n\r\n\t\tif ( lod > LOD_MIN ) {\r\n\r\n\t\t\tlod --;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn { lodPlanes, sizeLods, sigmas };\r\n\r\n}\r\n\r\nfunction _createRenderTarget( width, height, params ) {\r\n\r\n\tconst cubeUVRenderTarget = new WebGLRenderTarget( width, height, params );\r\n\tcubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping;\r\n\tcubeUVRenderTarget.texture.name = 'PMREM.cubeUv';\r\n\tcubeUVRenderTarget.scissorTest = true;\r\n\treturn cubeUVRenderTarget;\r\n\r\n}\r\n\r\nfunction _setViewport( target, x, y, width, height ) {\r\n\r\n\ttarget.viewport.set( x, y, width, height );\r\n\ttarget.scissor.set( x, y, width, height );\r\n\r\n}\r\n\r\nfunction _getBlurShader( lodMax, width, height ) {\r\n\r\n\tconst weights = new Float32Array( MAX_SAMPLES );\r\n\tconst poleAxis = new Vector3( 0, 1, 0 );\r\n\tconst shaderMaterial = new ShaderMaterial( {\r\n\r\n\t\tname: 'SphericalGaussianBlur',\r\n\r\n\t\tdefines: {\r\n\t\t\t'n': MAX_SAMPLES,\r\n\t\t\t'CUBEUV_TEXEL_WIDTH': 1.0 / width,\r\n\t\t\t'CUBEUV_TEXEL_HEIGHT': 1.0 / height,\r\n\t\t\t'CUBEUV_MAX_MIP': `${lodMax}.0`,\r\n\t\t},\r\n\r\n\t\tuniforms: {\r\n\t\t\t'envMap': { value: null },\r\n\t\t\t'samples': { value: 1 },\r\n\t\t\t'weights': { value: weights },\r\n\t\t\t'latitudinal': { value: false },\r\n\t\t\t'dTheta': { value: 0 },\r\n\t\t\t'mipInt': { value: 0 },\r\n\t\t\t'poleAxis': { value: poleAxis }\r\n\t\t},\r\n\r\n\t\tvertexShader: _getCommonVertexShader(),\r\n\r\n\t\tfragmentShader: /* glsl */`\r\n\r\n\t\t\tprecision mediump float;\r\n\t\t\tprecision mediump int;\r\n\r\n\t\t\tvarying vec3 vOutputDirection;\r\n\r\n\t\t\tuniform sampler2D envMap;\r\n\t\t\tuniform int samples;\r\n\t\t\tuniform float weights[ n ];\r\n\t\t\tuniform bool latitudinal;\r\n\t\t\tuniform float dTheta;\r\n\t\t\tuniform float mipInt;\r\n\t\t\tuniform vec3 poleAxis;\r\n\r\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\r\n\t\t\t#include \r\n\r\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\r\n\r\n\t\t\t\tfloat cosTheta = cos( theta );\r\n\t\t\t\t// Rodrigues' axis-angle rotation\r\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\r\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\r\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\r\n\r\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvoid main() {\r\n\r\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\r\n\r\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\r\n\r\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\taxis = normalize( axis );\r\n\r\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\r\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\r\n\r\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\r\n\r\n\t\t\t\t\tif ( i >= samples ) {\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfloat theta = dTheta * float( i );\r\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\r\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t`,\r\n\r\n\t\tblending: NoBlending,\r\n\t\tdepthTest: false,\r\n\t\tdepthWrite: false\r\n\r\n\t} );\r\n\r\n\treturn shaderMaterial;\r\n\r\n}\r\n\r\nfunction _getEquirectMaterial() {\r\n\r\n\treturn new ShaderMaterial( {\r\n\r\n\t\tname: 'EquirectangularToCubeUV',\r\n\r\n\t\tuniforms: {\r\n\t\t\t'envMap': { value: null }\r\n\t\t},\r\n\r\n\t\tvertexShader: _getCommonVertexShader(),\r\n\r\n\t\tfragmentShader: /* glsl */`\r\n\r\n\t\t\tprecision mediump float;\r\n\t\t\tprecision mediump int;\r\n\r\n\t\t\tvarying vec3 vOutputDirection;\r\n\r\n\t\t\tuniform sampler2D envMap;\r\n\r\n\t\t\t#include \r\n\r\n\t\t\tvoid main() {\r\n\r\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\r\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\r\n\r\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\r\n\r\n\t\t\t}\r\n\t\t`,\r\n\r\n\t\tblending: NoBlending,\r\n\t\tdepthTest: false,\r\n\t\tdepthWrite: false\r\n\r\n\t} );\r\n\r\n}\r\n\r\nfunction _getCubemapMaterial() {\r\n\r\n\treturn new ShaderMaterial( {\r\n\r\n\t\tname: 'CubemapToCubeUV',\r\n\r\n\t\tuniforms: {\r\n\t\t\t'envMap': { value: null },\r\n\t\t\t'flipEnvMap': { value: - 1 }\r\n\t\t},\r\n\r\n\t\tvertexShader: _getCommonVertexShader(),\r\n\r\n\t\tfragmentShader: /* glsl */`\r\n\r\n\t\t\tprecision mediump float;\r\n\t\t\tprecision mediump int;\r\n\r\n\t\t\tuniform float flipEnvMap;\r\n\r\n\t\t\tvarying vec3 vOutputDirection;\r\n\r\n\t\t\tuniform samplerCube envMap;\r\n\r\n\t\t\tvoid main() {\r\n\r\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\r\n\r\n\t\t\t}\r\n\t\t`,\r\n\r\n\t\tblending: NoBlending,\r\n\t\tdepthTest: false,\r\n\t\tdepthWrite: false\r\n\r\n\t} );\r\n\r\n}\r\n\r\nfunction _getCommonVertexShader() {\r\n\r\n\treturn /* glsl */`\r\n\r\n\t\tprecision mediump float;\r\n\t\tprecision mediump int;\r\n\r\n\t\tattribute float faceIndex;\r\n\r\n\t\tvarying vec3 vOutputDirection;\r\n\r\n\t\t// RH coordinate system; PMREM face-indexing convention\r\n\t\tvec3 getDirection( vec2 uv, float face ) {\r\n\r\n\t\t\tuv = 2.0 * uv - 1.0;\r\n\r\n\t\t\tvec3 direction = vec3( uv, 1.0 );\r\n\r\n\t\t\tif ( face == 0.0 ) {\r\n\r\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\r\n\r\n\t\t\t} else if ( face == 1.0 ) {\r\n\r\n\t\t\t\tdirection = direction.xzy;\r\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\r\n\r\n\t\t\t} else if ( face == 2.0 ) {\r\n\r\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\r\n\r\n\t\t\t} else if ( face == 3.0 ) {\r\n\r\n\t\t\t\tdirection = direction.zyx;\r\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\r\n\r\n\t\t\t} else if ( face == 4.0 ) {\r\n\r\n\t\t\t\tdirection = direction.xzy;\r\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\r\n\r\n\t\t\t} else if ( face == 5.0 ) {\r\n\r\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn direction;\r\n\r\n\t\t}\r\n\r\n\t\tvoid main() {\r\n\r\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\r\n\t\t\tgl_Position = vec4( position, 1.0 );\r\n\r\n\t\t}\r\n\t`;\r\n\r\n}\r\n\r\nfunction WebGLCubeUVMaps( renderer ) {\r\n\r\n\tlet cubeUVmaps = new WeakMap();\r\n\r\n\tlet pmremGenerator = null;\r\n\r\n\tfunction get( texture ) {\r\n\r\n\t\tif ( texture && texture.isTexture ) {\r\n\r\n\t\t\tconst mapping = texture.mapping;\r\n\r\n\t\t\tconst isEquirectMap = ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping );\r\n\t\t\tconst isCubeMap = ( mapping === CubeReflectionMapping || mapping === CubeRefractionMapping );\r\n\r\n\t\t\t// equirect/cube map to cubeUV conversion\r\n\r\n\t\t\tif ( isEquirectMap || isCubeMap ) {\r\n\r\n\t\t\t\tlet renderTarget = cubeUVmaps.get( texture );\r\n\r\n\t\t\t\tconst currentPMREMVersion = renderTarget !== undefined ? renderTarget.texture.pmremVersion : 0;\r\n\r\n\t\t\t\tif ( texture.isRenderTargetTexture && texture.pmremVersion !== currentPMREMVersion ) {\r\n\r\n\t\t\t\t\tif ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );\r\n\r\n\t\t\t\t\trenderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture, renderTarget ) : pmremGenerator.fromCubemap( texture, renderTarget );\r\n\t\t\t\t\trenderTarget.texture.pmremVersion = texture.pmremVersion;\r\n\r\n\t\t\t\t\tcubeUVmaps.set( texture, renderTarget );\r\n\r\n\t\t\t\t\treturn renderTarget.texture;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif ( renderTarget !== undefined ) {\r\n\r\n\t\t\t\t\t\treturn renderTarget.texture;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tconst image = texture.image;\r\n\r\n\t\t\t\t\t\tif ( ( isEquirectMap && image && image.height > 0 ) || ( isCubeMap && image && isCubeTextureComplete( image ) ) ) {\r\n\r\n\t\t\t\t\t\t\tif ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );\r\n\r\n\t\t\t\t\t\t\trenderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );\r\n\t\t\t\t\t\t\trenderTarget.texture.pmremVersion = texture.pmremVersion;\r\n\r\n\t\t\t\t\t\t\tcubeUVmaps.set( texture, renderTarget );\r\n\r\n\t\t\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\r\n\r\n\t\t\t\t\t\t\treturn renderTarget.texture;\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t// image not yet ready. try the conversion next frame\r\n\r\n\t\t\t\t\t\t\treturn null;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn texture;\r\n\r\n\t}\r\n\r\n\tfunction isCubeTextureComplete( image ) {\r\n\r\n\t\tlet count = 0;\r\n\t\tconst length = 6;\r\n\r\n\t\tfor ( let i = 0; i < length; i ++ ) {\r\n\r\n\t\t\tif ( image[ i ] !== undefined ) count ++;\r\n\r\n\t\t}\r\n\r\n\t\treturn count === length;\r\n\r\n\r\n\t}\r\n\r\n\tfunction onTextureDispose( event ) {\r\n\r\n\t\tconst texture = event.target;\r\n\r\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\r\n\r\n\t\tconst cubemapUV = cubeUVmaps.get( texture );\r\n\r\n\t\tif ( cubemapUV !== undefined ) {\r\n\r\n\t\t\tcubeUVmaps.delete( texture );\r\n\t\t\tcubemapUV.dispose();\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction dispose() {\r\n\r\n\t\tcubeUVmaps = new WeakMap();\r\n\r\n\t\tif ( pmremGenerator !== null ) {\r\n\r\n\t\t\tpmremGenerator.dispose();\r\n\t\t\tpmremGenerator = null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn {\r\n\t\tget: get,\r\n\t\tdispose: dispose\r\n\t};\r\n\r\n}\r\n\r\nfunction WebGLExtensions( gl ) {\r\n\r\n\tconst extensions = {};\r\n\r\n\tfunction getExtension( name ) {\r\n\r\n\t\tif ( extensions[ name ] !== undefined ) {\r\n\r\n\t\t\treturn extensions[ name ];\r\n\r\n\t\t}\r\n\r\n\t\tlet extension;\r\n\r\n\t\tswitch ( name ) {\r\n\r\n\t\t\tcase 'WEBGL_depth_texture':\r\n\t\t\t\textension = gl.getExtension( 'WEBGL_depth_texture' ) || gl.getExtension( 'MOZ_WEBGL_depth_texture' ) || gl.getExtension( 'WEBKIT_WEBGL_depth_texture' );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'EXT_texture_filter_anisotropic':\r\n\t\t\t\textension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'WEBGL_compressed_texture_s3tc':\r\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'WEBGL_compressed_texture_pvrtc':\r\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tdefault:\r\n\t\t\t\textension = gl.getExtension( name );\r\n\r\n\t\t}\r\n\r\n\t\textensions[ name ] = extension;\r\n\r\n\t\treturn extension;\r\n\r\n\t}\r\n\r\n\treturn {\r\n\r\n\t\thas: function ( name ) {\r\n\r\n\t\t\treturn getExtension( name ) !== null;\r\n\r\n\t\t},\r\n\r\n\t\tinit: function () {\r\n\r\n\t\t\tgetExtension( 'EXT_color_buffer_float' );\r\n\t\t\tgetExtension( 'WEBGL_clip_cull_distance' );\r\n\t\t\tgetExtension( 'OES_texture_float_linear' );\r\n\t\t\tgetExtension( 'EXT_color_buffer_half_float' );\r\n\t\t\tgetExtension( 'WEBGL_multisampled_render_to_texture' );\r\n\t\t\tgetExtension( 'WEBGL_render_shared_exponent' );\r\n\r\n\t\t},\r\n\r\n\t\tget: function ( name ) {\r\n\r\n\t\t\tconst extension = getExtension( name );\r\n\r\n\t\t\tif ( extension === null ) {\r\n\r\n\t\t\t\twarnOnce( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn extension;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n}\r\n\r\nfunction WebGLGeometries( gl, attributes, info, bindingStates ) {\r\n\r\n\tconst geometries = {};\r\n\tconst wireframeAttributes = new WeakMap();\r\n\r\n\tfunction onGeometryDispose( event ) {\r\n\r\n\t\tconst geometry = event.target;\r\n\r\n\t\tif ( geometry.index !== null ) {\r\n\r\n\t\t\tattributes.remove( geometry.index );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( const name in geometry.attributes ) {\r\n\r\n\t\t\tattributes.remove( geometry.attributes[ name ] );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( const name in geometry.morphAttributes ) {\r\n\r\n\t\t\tconst array = geometry.morphAttributes[ name ];\r\n\r\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tattributes.remove( array[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tgeometry.removeEventListener( 'dispose', onGeometryDispose );\r\n\r\n\t\tdelete geometries[ geometry.id ];\r\n\r\n\t\tconst attribute = wireframeAttributes.get( geometry );\r\n\r\n\t\tif ( attribute ) {\r\n\r\n\t\t\tattributes.remove( attribute );\r\n\t\t\twireframeAttributes.delete( geometry );\r\n\r\n\t\t}\r\n\r\n\t\tbindingStates.releaseStatesOfGeometry( geometry );\r\n\r\n\t\tif ( geometry.isInstancedBufferGeometry === true ) {\r\n\r\n\t\t\tdelete geometry._maxInstanceCount;\r\n\r\n\t\t}\r\n\r\n\t\t//\r\n\r\n\t\tinfo.memory.geometries --;\r\n\r\n\t}\r\n\r\n\tfunction get( object, geometry ) {\r\n\r\n\t\tif ( geometries[ geometry.id ] === true ) return geometry;\r\n\r\n\t\tgeometry.addEventListener( 'dispose', onGeometryDispose );\r\n\r\n\t\tgeometries[ geometry.id ] = true;\r\n\r\n\t\tinfo.memory.geometries ++;\r\n\r\n\t\treturn geometry;\r\n\r\n\t}\r\n\r\n\tfunction update( geometry ) {\r\n\r\n\t\tconst geometryAttributes = geometry.attributes;\r\n\r\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates.\r\n\r\n\t\tfor ( const name in geometryAttributes ) {\r\n\r\n\t\t\tattributes.update( geometryAttributes[ name ], gl.ARRAY_BUFFER );\r\n\r\n\t\t}\r\n\r\n\t\t// morph targets\r\n\r\n\t\tconst morphAttributes = geometry.morphAttributes;\r\n\r\n\t\tfor ( const name in morphAttributes ) {\r\n\r\n\t\t\tconst array = morphAttributes[ name ];\r\n\r\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tattributes.update( array[ i ], gl.ARRAY_BUFFER );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction updateWireframeAttribute( geometry ) {\r\n\r\n\t\tconst indices = [];\r\n\r\n\t\tconst geometryIndex = geometry.index;\r\n\t\tconst geometryPosition = geometry.attributes.position;\r\n\t\tlet version = 0;\r\n\r\n\t\tif ( geometryIndex !== null ) {\r\n\r\n\t\t\tconst array = geometryIndex.array;\r\n\t\t\tversion = geometryIndex.version;\r\n\r\n\t\t\tfor ( let i = 0, l = array.length; i < l; i += 3 ) {\r\n\r\n\t\t\t\tconst a = array[ i + 0 ];\r\n\t\t\t\tconst b = array[ i + 1 ];\r\n\t\t\t\tconst c = array[ i + 2 ];\r\n\r\n\t\t\t\tindices.push( a, b, b, c, c, a );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( geometryPosition !== undefined ) {\r\n\r\n\t\t\tconst array = geometryPosition.array;\r\n\t\t\tversion = geometryPosition.version;\r\n\r\n\t\t\tfor ( let i = 0, l = ( array.length / 3 ) - 1; i < l; i += 3 ) {\r\n\r\n\t\t\t\tconst a = i + 0;\r\n\t\t\t\tconst b = i + 1;\r\n\t\t\t\tconst c = i + 2;\r\n\r\n\t\t\t\tindices.push( a, b, b, c, c, a );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tconst attribute = new ( arrayNeedsUint32( indices ) ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );\r\n\t\tattribute.version = version;\r\n\r\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates\r\n\r\n\t\t//\r\n\r\n\t\tconst previousAttribute = wireframeAttributes.get( geometry );\r\n\r\n\t\tif ( previousAttribute ) attributes.remove( previousAttribute );\r\n\r\n\t\t//\r\n\r\n\t\twireframeAttributes.set( geometry, attribute );\r\n\r\n\t}\r\n\r\n\tfunction getWireframeAttribute( geometry ) {\r\n\r\n\t\tconst currentAttribute = wireframeAttributes.get( geometry );\r\n\r\n\t\tif ( currentAttribute ) {\r\n\r\n\t\t\tconst geometryIndex = geometry.index;\r\n\r\n\t\t\tif ( geometryIndex !== null ) {\r\n\r\n\t\t\t\t// if the attribute is obsolete, create a new one\r\n\r\n\t\t\t\tif ( currentAttribute.version < geometryIndex.version ) {\r\n\r\n\t\t\t\t\tupdateWireframeAttribute( geometry );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tupdateWireframeAttribute( geometry );\r\n\r\n\t\t}\r\n\r\n\t\treturn wireframeAttributes.get( geometry );\r\n\r\n\t}\r\n\r\n\treturn {\r\n\r\n\t\tget: get,\r\n\t\tupdate: update,\r\n\r\n\t\tgetWireframeAttribute: getWireframeAttribute\r\n\r\n\t};\r\n\r\n}\r\n\r\nfunction WebGLIndexedBufferRenderer( gl, extensions, info ) {\r\n\r\n\tlet mode;\r\n\r\n\tfunction setMode( value ) {\r\n\r\n\t\tmode = value;\r\n\r\n\t}\r\n\r\n\tlet type, bytesPerElement;\r\n\r\n\tfunction setIndex( value ) {\r\n\r\n\t\ttype = value.type;\r\n\t\tbytesPerElement = value.bytesPerElement;\r\n\r\n\t}\r\n\r\n\tfunction render( start, count ) {\r\n\r\n\t\tgl.drawElements( mode, count, type, start * bytesPerElement );\r\n\r\n\t\tinfo.update( count, mode, 1 );\r\n\r\n\t}\r\n\r\n\tfunction renderInstances( start, count, primcount ) {\r\n\r\n\t\tif ( primcount === 0 ) return;\r\n\r\n\t\tgl.drawElementsInstanced( mode, count, type, start * bytesPerElement, primcount );\r\n\r\n\t\tinfo.update( count, mode, primcount );\r\n\r\n\t}\r\n\r\n\tfunction renderMultiDraw( starts, counts, drawCount ) {\r\n\r\n\t\tif ( drawCount === 0 ) return;\r\n\r\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\r\n\t\textension.multiDrawElementsWEBGL( mode, counts, 0, type, starts, 0, drawCount );\r\n\r\n\t\tlet elementCount = 0;\r\n\t\tfor ( let i = 0; i < drawCount; i ++ ) {\r\n\r\n\t\t\telementCount += counts[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tinfo.update( elementCount, mode, 1 );\r\n\r\n\r\n\t}\r\n\r\n\tfunction renderMultiDrawInstances( starts, counts, drawCount, primcount ) {\r\n\r\n\t\tif ( drawCount === 0 ) return;\r\n\r\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\r\n\r\n\t\tif ( extension === null ) {\r\n\r\n\t\t\tfor ( let i = 0; i < starts.length; i ++ ) {\r\n\r\n\t\t\t\trenderInstances( starts[ i ] / bytesPerElement, counts[ i ], primcount[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\textension.multiDrawElementsInstancedWEBGL( mode, counts, 0, type, starts, 0, primcount, 0, drawCount );\r\n\r\n\t\t\tlet elementCount = 0;\r\n\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\r\n\r\n\t\t\t\telementCount += counts[ i ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( let i = 0; i < primcount.length; i ++ ) {\r\n\r\n\t\t\t\tinfo.update( elementCount, mode, primcount[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tthis.setMode = setMode;\r\n\tthis.setIndex = setIndex;\r\n\tthis.render = render;\r\n\tthis.renderInstances = renderInstances;\r\n\tthis.renderMultiDraw = renderMultiDraw;\r\n\tthis.renderMultiDrawInstances = renderMultiDrawInstances;\r\n\r\n}\r\n\r\nfunction WebGLInfo( gl ) {\r\n\r\n\tconst memory = {\r\n\t\tgeometries: 0,\r\n\t\ttextures: 0\r\n\t};\r\n\r\n\tconst render = {\r\n\t\tframe: 0,\r\n\t\tcalls: 0,\r\n\t\ttriangles: 0,\r\n\t\tpoints: 0,\r\n\t\tlines: 0\r\n\t};\r\n\r\n\tfunction update( count, mode, instanceCount ) {\r\n\r\n\t\trender.calls ++;\r\n\r\n\t\tswitch ( mode ) {\r\n\r\n\t\t\tcase gl.TRIANGLES:\r\n\t\t\t\trender.triangles += instanceCount * ( count / 3 );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase gl.LINES:\r\n\t\t\t\trender.lines += instanceCount * ( count / 2 );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase gl.LINE_STRIP:\r\n\t\t\t\trender.lines += instanceCount * ( count - 1 );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase gl.LINE_LOOP:\r\n\t\t\t\trender.lines += instanceCount * count;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase gl.POINTS:\r\n\t\t\t\trender.points += instanceCount * count;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tdefault:\r\n\t\t\t\tconsole.error( 'THREE.WebGLInfo: Unknown draw mode:', mode );\r\n\t\t\t\tbreak;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction reset() {\r\n\r\n\t\trender.calls = 0;\r\n\t\trender.triangles = 0;\r\n\t\trender.points = 0;\r\n\t\trender.lines = 0;\r\n\r\n\t}\r\n\r\n\treturn {\r\n\t\tmemory: memory,\r\n\t\trender: render,\r\n\t\tprograms: null,\r\n\t\tautoReset: true,\r\n\t\treset: reset,\r\n\t\tupdate: update\r\n\t};\r\n\r\n}\r\n\r\nfunction WebGLMorphtargets( gl, capabilities, textures ) {\r\n\r\n\tconst morphTextures = new WeakMap();\r\n\tconst morph = new Vector4();\r\n\r\n\tfunction update( object, geometry, program ) {\r\n\r\n\t\tconst objectInfluences = object.morphTargetInfluences;\r\n\r\n\t\t// the following encodes morph targets into an array of data textures. Each layer represents a single morph target.\r\n\r\n\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\r\n\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\r\n\r\n\t\tlet entry = morphTextures.get( geometry );\r\n\r\n\t\tif ( entry === undefined || entry.count !== morphTargetsCount ) {\r\n\r\n\t\t\tif ( entry !== undefined ) entry.texture.dispose();\r\n\r\n\t\t\tconst hasMorphPosition = geometry.morphAttributes.position !== undefined;\r\n\t\t\tconst hasMorphNormals = geometry.morphAttributes.normal !== undefined;\r\n\t\t\tconst hasMorphColors = geometry.morphAttributes.color !== undefined;\r\n\r\n\t\t\tconst morphTargets = geometry.morphAttributes.position || [];\r\n\t\t\tconst morphNormals = geometry.morphAttributes.normal || [];\r\n\t\t\tconst morphColors = geometry.morphAttributes.color || [];\r\n\r\n\t\t\tlet vertexDataCount = 0;\r\n\r\n\t\t\tif ( hasMorphPosition === true ) vertexDataCount = 1;\r\n\t\t\tif ( hasMorphNormals === true ) vertexDataCount = 2;\r\n\t\t\tif ( hasMorphColors === true ) vertexDataCount = 3;\r\n\r\n\t\t\tlet width = geometry.attributes.position.count * vertexDataCount;\r\n\t\t\tlet height = 1;\r\n\r\n\t\t\tif ( width > capabilities.maxTextureSize ) {\r\n\r\n\t\t\t\theight = Math.ceil( width / capabilities.maxTextureSize );\r\n\t\t\t\twidth = capabilities.maxTextureSize;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst buffer = new Float32Array( width * height * 4 * morphTargetsCount );\r\n\r\n\t\t\tconst texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );\r\n\t\t\ttexture.type = FloatType;\r\n\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\t// fill buffer\r\n\r\n\t\t\tconst vertexDataStride = vertexDataCount * 4;\r\n\r\n\t\t\tfor ( let i = 0; i < morphTargetsCount; i ++ ) {\r\n\r\n\t\t\t\tconst morphTarget = morphTargets[ i ];\r\n\t\t\t\tconst morphNormal = morphNormals[ i ];\r\n\t\t\t\tconst morphColor = morphColors[ i ];\r\n\r\n\t\t\t\tconst offset = width * height * 4 * i;\r\n\r\n\t\t\t\tfor ( let j = 0; j < morphTarget.count; j ++ ) {\r\n\r\n\t\t\t\t\tconst stride = j * vertexDataStride;\r\n\r\n\t\t\t\t\tif ( hasMorphPosition === true ) {\r\n\r\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphTarget, j );\r\n\r\n\t\t\t\t\t\tbuffer[ offset + stride + 0 ] = morph.x;\r\n\t\t\t\t\t\tbuffer[ offset + stride + 1 ] = morph.y;\r\n\t\t\t\t\t\tbuffer[ offset + stride + 2 ] = morph.z;\r\n\t\t\t\t\t\tbuffer[ offset + stride + 3 ] = 0;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( hasMorphNormals === true ) {\r\n\r\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphNormal, j );\r\n\r\n\t\t\t\t\t\tbuffer[ offset + stride + 4 ] = morph.x;\r\n\t\t\t\t\t\tbuffer[ offset + stride + 5 ] = morph.y;\r\n\t\t\t\t\t\tbuffer[ offset + stride + 6 ] = morph.z;\r\n\t\t\t\t\t\tbuffer[ offset + stride + 7 ] = 0;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( hasMorphColors === true ) {\r\n\r\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphColor, j );\r\n\r\n\t\t\t\t\t\tbuffer[ offset + stride + 8 ] = morph.x;\r\n\t\t\t\t\t\tbuffer[ offset + stride + 9 ] = morph.y;\r\n\t\t\t\t\t\tbuffer[ offset + stride + 10 ] = morph.z;\r\n\t\t\t\t\t\tbuffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tentry = {\r\n\t\t\t\tcount: morphTargetsCount,\r\n\t\t\t\ttexture: texture,\r\n\t\t\t\tsize: new Vector2( width, height )\r\n\t\t\t};\r\n\r\n\t\t\tmorphTextures.set( geometry, entry );\r\n\r\n\t\t\tfunction disposeTexture() {\r\n\r\n\t\t\t\ttexture.dispose();\r\n\r\n\t\t\t\tmorphTextures.delete( geometry );\r\n\r\n\t\t\t\tgeometry.removeEventListener( 'dispose', disposeTexture );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgeometry.addEventListener( 'dispose', disposeTexture );\r\n\r\n\t\t}\r\n\r\n\t\t//\r\n\t\tif ( object.isInstancedMesh === true && object.morphTexture !== null ) {\r\n\r\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTexture', object.morphTexture, textures );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tlet morphInfluencesSum = 0;\r\n\r\n\t\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\r\n\r\n\t\t\t\tmorphInfluencesSum += objectInfluences[ i ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\r\n\r\n\r\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );\r\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );\r\n\r\n\t\t}\r\n\r\n\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );\r\n\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );\r\n\r\n\t}\r\n\r\n\treturn {\r\n\r\n\t\tupdate: update\r\n\r\n\t};\r\n\r\n}\r\n\r\nfunction WebGLObjects( gl, geometries, attributes, info ) {\r\n\r\n\tlet updateMap = new WeakMap();\r\n\r\n\tfunction update( object ) {\r\n\r\n\t\tconst frame = info.render.frame;\r\n\r\n\t\tconst geometry = object.geometry;\r\n\t\tconst buffergeometry = geometries.get( object, geometry );\r\n\r\n\t\t// Update once per frame\r\n\r\n\t\tif ( updateMap.get( buffergeometry ) !== frame ) {\r\n\r\n\t\t\tgeometries.update( buffergeometry );\r\n\r\n\t\t\tupdateMap.set( buffergeometry, frame );\r\n\r\n\t\t}\r\n\r\n\t\tif ( object.isInstancedMesh ) {\r\n\r\n\t\t\tif ( object.hasEventListener( 'dispose', onInstancedMeshDispose ) === false ) {\r\n\r\n\t\t\t\tobject.addEventListener( 'dispose', onInstancedMeshDispose );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( updateMap.get( object ) !== frame ) {\r\n\r\n\t\t\t\tattributes.update( object.instanceMatrix, gl.ARRAY_BUFFER );\r\n\r\n\t\t\t\tif ( object.instanceColor !== null ) {\r\n\r\n\t\t\t\t\tattributes.update( object.instanceColor, gl.ARRAY_BUFFER );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tupdateMap.set( object, frame );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( object.isSkinnedMesh ) {\r\n\r\n\t\t\tconst skeleton = object.skeleton;\r\n\r\n\t\t\tif ( updateMap.get( skeleton ) !== frame ) {\r\n\r\n\t\t\t\tskeleton.update();\r\n\r\n\t\t\t\tupdateMap.set( skeleton, frame );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn buffergeometry;\r\n\r\n\t}\r\n\r\n\tfunction dispose() {\r\n\r\n\t\tupdateMap = new WeakMap();\r\n\r\n\t}\r\n\r\n\tfunction onInstancedMeshDispose( event ) {\r\n\r\n\t\tconst instancedMesh = event.target;\r\n\r\n\t\tinstancedMesh.removeEventListener( 'dispose', onInstancedMeshDispose );\r\n\r\n\t\tattributes.remove( instancedMesh.instanceMatrix );\r\n\r\n\t\tif ( instancedMesh.instanceColor !== null ) attributes.remove( instancedMesh.instanceColor );\r\n\r\n\t}\r\n\r\n\treturn {\r\n\r\n\t\tupdate: update,\r\n\t\tdispose: dispose\r\n\r\n\t};\r\n\r\n}\r\n\r\nclass DepthTexture extends Texture {\r\n\r\n\tconstructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format = DepthFormat ) {\r\n\r\n\t\tif ( format !== DepthFormat && format !== DepthStencilFormat ) {\r\n\r\n\t\t\tthrow new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );\r\n\r\n\t\t}\r\n\r\n\t\tif ( type === undefined && format === DepthFormat ) type = UnsignedIntType;\r\n\t\tif ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;\r\n\r\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\r\n\r\n\t\tthis.isDepthTexture = true;\r\n\r\n\t\tthis.image = { width: width, height: height };\r\n\r\n\t\tthis.magFilter = magFilter !== undefined ? magFilter : NearestFilter;\r\n\t\tthis.minFilter = minFilter !== undefined ? minFilter : NearestFilter;\r\n\r\n\t\tthis.flipY = false;\r\n\t\tthis.generateMipmaps = false;\r\n\r\n\t\tthis.compareFunction = null;\r\n\r\n\t}\r\n\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.compareFunction = source.compareFunction;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON( meta ) {\r\n\r\n\t\tconst data = super.toJSON( meta );\r\n\r\n\t\tif ( this.compareFunction !== null ) data.compareFunction = this.compareFunction;\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Uniforms of a program.\r\n * Those form a tree structure with a special top-level container for the root,\r\n * which you get by calling 'new WebGLUniforms( gl, program )'.\r\n *\r\n *\r\n * Properties of inner nodes including the top-level container:\r\n *\r\n * .seq - array of nested uniforms\r\n * .map - nested uniforms by name\r\n *\r\n *\r\n * Methods of all nodes except the top-level container:\r\n *\r\n * .setValue( gl, value, [textures] )\r\n *\r\n * \t\tuploads a uniform value(s)\r\n * \tthe 'textures' parameter is needed for sampler uniforms\r\n *\r\n *\r\n * Static methods of the top-level container (textures factorizations):\r\n *\r\n * .upload( gl, seq, values, textures )\r\n *\r\n * \t\tsets uniforms in 'seq' to 'values[id].value'\r\n *\r\n * .seqWithValue( seq, values ) : filteredSeq\r\n *\r\n * \t\tfilters 'seq' entries with corresponding entry in values\r\n *\r\n *\r\n * Methods of the top-level container (textures factorizations):\r\n *\r\n * .setValue( gl, name, value, textures )\r\n *\r\n * \t\tsets uniform with name 'name' to 'value'\r\n *\r\n * .setOptional( gl, obj, prop )\r\n *\r\n * \t\tlike .set for an optional property of the object\r\n *\r\n */\r\n\r\n\r\nconst emptyTexture = /*@__PURE__*/ new Texture();\r\n\r\nconst emptyShadowTexture = /*@__PURE__*/ new DepthTexture( 1, 1 );\r\n\r\nconst emptyArrayTexture = /*@__PURE__*/ new DataArrayTexture();\r\nconst empty3dTexture = /*@__PURE__*/ new Data3DTexture();\r\nconst emptyCubeTexture = /*@__PURE__*/ new CubeTexture();\r\n\r\n// --- Utilities ---\r\n\r\n// Array Caches (provide typed arrays for temporary by size)\r\n\r\nconst arrayCacheF32 = [];\r\nconst arrayCacheI32 = [];\r\n\r\n// Float32Array caches used for uploading Matrix uniforms\r\n\r\nconst mat4array = new Float32Array( 16 );\r\nconst mat3array = new Float32Array( 9 );\r\nconst mat2array = new Float32Array( 4 );\r\n\r\n// Flattening for arrays of vectors and matrices\r\n\r\nfunction flatten( array, nBlocks, blockSize ) {\r\n\r\n\tconst firstElem = array[ 0 ];\r\n\r\n\tif ( firstElem <= 0 || firstElem > 0 ) return array;\r\n\t// unoptimized: ! isNaN( firstElem )\r\n\t// see http://jacksondunstan.com/articles/983\r\n\r\n\tconst n = nBlocks * blockSize;\r\n\tlet r = arrayCacheF32[ n ];\r\n\r\n\tif ( r === undefined ) {\r\n\r\n\t\tr = new Float32Array( n );\r\n\t\tarrayCacheF32[ n ] = r;\r\n\r\n\t}\r\n\r\n\tif ( nBlocks !== 0 ) {\r\n\r\n\t\tfirstElem.toArray( r, 0 );\r\n\r\n\t\tfor ( let i = 1, offset = 0; i !== nBlocks; ++ i ) {\r\n\r\n\t\t\toffset += blockSize;\r\n\t\t\tarray[ i ].toArray( r, offset );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn r;\r\n\r\n}\r\n\r\nfunction arraysEqual( a, b ) {\r\n\r\n\tif ( a.length !== b.length ) return false;\r\n\r\n\tfor ( let i = 0, l = a.length; i < l; i ++ ) {\r\n\r\n\t\tif ( a[ i ] !== b[ i ] ) return false;\r\n\r\n\t}\r\n\r\n\treturn true;\r\n\r\n}\r\n\r\nfunction copyArray( a, b ) {\r\n\r\n\tfor ( let i = 0, l = b.length; i < l; i ++ ) {\r\n\r\n\t\ta[ i ] = b[ i ];\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Texture unit allocation\r\n\r\nfunction allocTexUnits( textures, n ) {\r\n\r\n\tlet r = arrayCacheI32[ n ];\r\n\r\n\tif ( r === undefined ) {\r\n\r\n\t\tr = new Int32Array( n );\r\n\t\tarrayCacheI32[ n ] = r;\r\n\r\n\t}\r\n\r\n\tfor ( let i = 0; i !== n; ++ i ) {\r\n\r\n\t\tr[ i ] = textures.allocateTextureUnit();\r\n\r\n\t}\r\n\r\n\treturn r;\r\n\r\n}\r\n\r\n// --- Setters ---\r\n\r\n// Note: Defining these methods externally, because they come in a bunch\r\n// and this way their names minify.\r\n\r\n// Single scalar\r\n\r\nfunction setValueV1f( gl, v ) {\r\n\r\n\tconst cache = this.cache;\r\n\r\n\tif ( cache[ 0 ] === v ) return;\r\n\r\n\tgl.uniform1f( this.addr, v );\r\n\r\n\tcache[ 0 ] = v;\r\n\r\n}\r\n\r\n// Single float vector (from flat array or THREE.VectorN)\r\n\r\nfunction setValueV2f( gl, v ) {\r\n\r\n\tconst cache = this.cache;\r\n\r\n\tif ( v.x !== undefined ) {\r\n\r\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\r\n\r\n\t\t\tgl.uniform2f( this.addr, v.x, v.y );\r\n\r\n\t\t\tcache[ 0 ] = v.x;\r\n\t\t\tcache[ 1 ] = v.y;\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\tif ( arraysEqual( cache, v ) ) return;\r\n\r\n\t\tgl.uniform2fv( this.addr, v );\r\n\r\n\t\tcopyArray( cache, v );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction setValueV3f( gl, v ) {\r\n\r\n\tconst cache = this.cache;\r\n\r\n\tif ( v.x !== undefined ) {\r\n\r\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\r\n\r\n\t\t\tgl.uniform3f( this.addr, v.x, v.y, v.z );\r\n\r\n\t\t\tcache[ 0 ] = v.x;\r\n\t\t\tcache[ 1 ] = v.y;\r\n\t\t\tcache[ 2 ] = v.z;\r\n\r\n\t\t}\r\n\r\n\t} else if ( v.r !== undefined ) {\r\n\r\n\t\tif ( cache[ 0 ] !== v.r || cache[ 1 ] !== v.g || cache[ 2 ] !== v.b ) {\r\n\r\n\t\t\tgl.uniform3f( this.addr, v.r, v.g, v.b );\r\n\r\n\t\t\tcache[ 0 ] = v.r;\r\n\t\t\tcache[ 1 ] = v.g;\r\n\t\t\tcache[ 2 ] = v.b;\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\tif ( arraysEqual( cache, v ) ) return;\r\n\r\n\t\tgl.uniform3fv( this.addr, v );\r\n\r\n\t\tcopyArray( cache, v );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction setValueV4f( gl, v ) {\r\n\r\n\tconst cache = this.cache;\r\n\r\n\tif ( v.x !== undefined ) {\r\n\r\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\r\n\r\n\t\t\tgl.uniform4f( this.addr, v.x, v.y, v.z, v.w );\r\n\r\n\t\t\tcache[ 0 ] = v.x;\r\n\t\t\tcache[ 1 ] = v.y;\r\n\t\t\tcache[ 2 ] = v.z;\r\n\t\t\tcache[ 3 ] = v.w;\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\tif ( arraysEqual( cache, v ) ) return;\r\n\r\n\t\tgl.uniform4fv( this.addr, v );\r\n\r\n\t\tcopyArray( cache, v );\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Single matrix (from flat array or THREE.MatrixN)\r\n\r\nfunction setValueM2( gl, v ) {\r\n\r\n\tconst cache = this.cache;\r\n\tconst elements = v.elements;\r\n\r\n\tif ( elements === undefined ) {\r\n\r\n\t\tif ( arraysEqual( cache, v ) ) return;\r\n\r\n\t\tgl.uniformMatrix2fv( this.addr, false, v );\r\n\r\n\t\tcopyArray( cache, v );\r\n\r\n\t} else {\r\n\r\n\t\tif ( arraysEqual( cache, elements ) ) return;\r\n\r\n\t\tmat2array.set( elements );\r\n\r\n\t\tgl.uniformMatrix2fv( this.addr, false, mat2array );\r\n\r\n\t\tcopyArray( cache, elements );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction setValueM3( gl, v ) {\r\n\r\n\tconst cache = this.cache;\r\n\tconst elements = v.elements;\r\n\r\n\tif ( elements === undefined ) {\r\n\r\n\t\tif ( arraysEqual( cache, v ) ) return;\r\n\r\n\t\tgl.uniformMatrix3fv( this.addr, false, v );\r\n\r\n\t\tcopyArray( cache, v );\r\n\r\n\t} else {\r\n\r\n\t\tif ( arraysEqual( cache, elements ) ) return;\r\n\r\n\t\tmat3array.set( elements );\r\n\r\n\t\tgl.uniformMatrix3fv( this.addr, false, mat3array );\r\n\r\n\t\tcopyArray( cache, elements );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction setValueM4( gl, v ) {\r\n\r\n\tconst cache = this.cache;\r\n\tconst elements = v.elements;\r\n\r\n\tif ( elements === undefined ) {\r\n\r\n\t\tif ( arraysEqual( cache, v ) ) return;\r\n\r\n\t\tgl.uniformMatrix4fv( this.addr, false, v );\r\n\r\n\t\tcopyArray( cache, v );\r\n\r\n\t} else {\r\n\r\n\t\tif ( arraysEqual( cache, elements ) ) return;\r\n\r\n\t\tmat4array.set( elements );\r\n\r\n\t\tgl.uniformMatrix4fv( this.addr, false, mat4array );\r\n\r\n\t\tcopyArray( cache, elements );\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Single integer / boolean\r\n\r\nfunction setValueV1i( gl, v ) {\r\n\r\n\tconst cache = this.cache;\r\n\r\n\tif ( cache[ 0 ] === v ) return;\r\n\r\n\tgl.uniform1i( this.addr, v );\r\n\r\n\tcache[ 0 ] = v;\r\n\r\n}\r\n\r\n// Single integer / boolean vector (from flat array or THREE.VectorN)\r\n\r\nfunction setValueV2i( gl, v ) {\r\n\r\n\tconst cache = this.cache;\r\n\r\n\tif ( v.x !== undefined ) {\r\n\r\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\r\n\r\n\t\t\tgl.uniform2i( this.addr, v.x, v.y );\r\n\r\n\t\t\tcache[ 0 ] = v.x;\r\n\t\t\tcache[ 1 ] = v.y;\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\tif ( arraysEqual( cache, v ) ) return;\r\n\r\n\t\tgl.uniform2iv( this.addr, v );\r\n\r\n\t\tcopyArray( cache, v );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction setValueV3i( gl, v ) {\r\n\r\n\tconst cache = this.cache;\r\n\r\n\tif ( v.x !== undefined ) {\r\n\r\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\r\n\r\n\t\t\tgl.uniform3i( this.addr, v.x, v.y, v.z );\r\n\r\n\t\t\tcache[ 0 ] = v.x;\r\n\t\t\tcache[ 1 ] = v.y;\r\n\t\t\tcache[ 2 ] = v.z;\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\tif ( arraysEqual( cache, v ) ) return;\r\n\r\n\t\tgl.uniform3iv( this.addr, v );\r\n\r\n\t\tcopyArray( cache, v );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction setValueV4i( gl, v ) {\r\n\r\n\tconst cache = this.cache;\r\n\r\n\tif ( v.x !== undefined ) {\r\n\r\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\r\n\r\n\t\t\tgl.uniform4i( this.addr, v.x, v.y, v.z, v.w );\r\n\r\n\t\t\tcache[ 0 ] = v.x;\r\n\t\t\tcache[ 1 ] = v.y;\r\n\t\t\tcache[ 2 ] = v.z;\r\n\t\t\tcache[ 3 ] = v.w;\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\tif ( arraysEqual( cache, v ) ) return;\r\n\r\n\t\tgl.uniform4iv( this.addr, v );\r\n\r\n\t\tcopyArray( cache, v );\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Single unsigned integer\r\n\r\nfunction setValueV1ui( gl, v ) {\r\n\r\n\tconst cache = this.cache;\r\n\r\n\tif ( cache[ 0 ] === v ) return;\r\n\r\n\tgl.uniform1ui( this.addr, v );\r\n\r\n\tcache[ 0 ] = v;\r\n\r\n}\r\n\r\n// Single unsigned integer vector (from flat array or THREE.VectorN)\r\n\r\nfunction setValueV2ui( gl, v ) {\r\n\r\n\tconst cache = this.cache;\r\n\r\n\tif ( v.x !== undefined ) {\r\n\r\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\r\n\r\n\t\t\tgl.uniform2ui( this.addr, v.x, v.y );\r\n\r\n\t\t\tcache[ 0 ] = v.x;\r\n\t\t\tcache[ 1 ] = v.y;\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\tif ( arraysEqual( cache, v ) ) return;\r\n\r\n\t\tgl.uniform2uiv( this.addr, v );\r\n\r\n\t\tcopyArray( cache, v );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction setValueV3ui( gl, v ) {\r\n\r\n\tconst cache = this.cache;\r\n\r\n\tif ( v.x !== undefined ) {\r\n\r\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\r\n\r\n\t\t\tgl.uniform3ui( this.addr, v.x, v.y, v.z );\r\n\r\n\t\t\tcache[ 0 ] = v.x;\r\n\t\t\tcache[ 1 ] = v.y;\r\n\t\t\tcache[ 2 ] = v.z;\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\tif ( arraysEqual( cache, v ) ) return;\r\n\r\n\t\tgl.uniform3uiv( this.addr, v );\r\n\r\n\t\tcopyArray( cache, v );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction setValueV4ui( gl, v ) {\r\n\r\n\tconst cache = this.cache;\r\n\r\n\tif ( v.x !== undefined ) {\r\n\r\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\r\n\r\n\t\t\tgl.uniform4ui( this.addr, v.x, v.y, v.z, v.w );\r\n\r\n\t\t\tcache[ 0 ] = v.x;\r\n\t\t\tcache[ 1 ] = v.y;\r\n\t\t\tcache[ 2 ] = v.z;\r\n\t\t\tcache[ 3 ] = v.w;\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\tif ( arraysEqual( cache, v ) ) return;\r\n\r\n\t\tgl.uniform4uiv( this.addr, v );\r\n\r\n\t\tcopyArray( cache, v );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\n// Single texture (2D / Cube)\r\n\r\nfunction setValueT1( gl, v, textures ) {\r\n\r\n\tconst cache = this.cache;\r\n\tconst unit = textures.allocateTextureUnit();\r\n\r\n\tif ( cache[ 0 ] !== unit ) {\r\n\r\n\t\tgl.uniform1i( this.addr, unit );\r\n\t\tcache[ 0 ] = unit;\r\n\r\n\t}\r\n\r\n\tlet emptyTexture2D;\r\n\r\n\tif ( this.type === gl.SAMPLER_2D_SHADOW ) {\r\n\r\n\t\temptyShadowTexture.compareFunction = LessEqualCompare; // #28670\r\n\t\temptyTexture2D = emptyShadowTexture;\r\n\r\n\t} else {\r\n\r\n\t\temptyTexture2D = emptyTexture;\r\n\r\n\t}\r\n\r\n\ttextures.setTexture2D( v || emptyTexture2D, unit );\r\n\r\n}\r\n\r\nfunction setValueT3D1( gl, v, textures ) {\r\n\r\n\tconst cache = this.cache;\r\n\tconst unit = textures.allocateTextureUnit();\r\n\r\n\tif ( cache[ 0 ] !== unit ) {\r\n\r\n\t\tgl.uniform1i( this.addr, unit );\r\n\t\tcache[ 0 ] = unit;\r\n\r\n\t}\r\n\r\n\ttextures.setTexture3D( v || empty3dTexture, unit );\r\n\r\n}\r\n\r\nfunction setValueT6( gl, v, textures ) {\r\n\r\n\tconst cache = this.cache;\r\n\tconst unit = textures.allocateTextureUnit();\r\n\r\n\tif ( cache[ 0 ] !== unit ) {\r\n\r\n\t\tgl.uniform1i( this.addr, unit );\r\n\t\tcache[ 0 ] = unit;\r\n\r\n\t}\r\n\r\n\ttextures.setTextureCube( v || emptyCubeTexture, unit );\r\n\r\n}\r\n\r\nfunction setValueT2DArray1( gl, v, textures ) {\r\n\r\n\tconst cache = this.cache;\r\n\tconst unit = textures.allocateTextureUnit();\r\n\r\n\tif ( cache[ 0 ] !== unit ) {\r\n\r\n\t\tgl.uniform1i( this.addr, unit );\r\n\t\tcache[ 0 ] = unit;\r\n\r\n\t}\r\n\r\n\ttextures.setTexture2DArray( v || emptyArrayTexture, unit );\r\n\r\n}\r\n\r\n// Helper to pick the right setter for the singular case\r\n\r\nfunction getSingularSetter( type ) {\r\n\r\n\tswitch ( type ) {\r\n\r\n\t\tcase 0x1406: return setValueV1f; // FLOAT\r\n\t\tcase 0x8b50: return setValueV2f; // _VEC2\r\n\t\tcase 0x8b51: return setValueV3f; // _VEC3\r\n\t\tcase 0x8b52: return setValueV4f; // _VEC4\r\n\r\n\t\tcase 0x8b5a: return setValueM2; // _MAT2\r\n\t\tcase 0x8b5b: return setValueM3; // _MAT3\r\n\t\tcase 0x8b5c: return setValueM4; // _MAT4\r\n\r\n\t\tcase 0x1404: case 0x8b56: return setValueV1i; // INT, BOOL\r\n\t\tcase 0x8b53: case 0x8b57: return setValueV2i; // _VEC2\r\n\t\tcase 0x8b54: case 0x8b58: return setValueV3i; // _VEC3\r\n\t\tcase 0x8b55: case 0x8b59: return setValueV4i; // _VEC4\r\n\r\n\t\tcase 0x1405: return setValueV1ui; // UINT\r\n\t\tcase 0x8dc6: return setValueV2ui; // _VEC2\r\n\t\tcase 0x8dc7: return setValueV3ui; // _VEC3\r\n\t\tcase 0x8dc8: return setValueV4ui; // _VEC4\r\n\r\n\t\tcase 0x8b5e: // SAMPLER_2D\r\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\r\n\t\tcase 0x8dca: // INT_SAMPLER_2D\r\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\r\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\r\n\t\t\treturn setValueT1;\r\n\r\n\t\tcase 0x8b5f: // SAMPLER_3D\r\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\r\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\r\n\t\t\treturn setValueT3D1;\r\n\r\n\t\tcase 0x8b60: // SAMPLER_CUBE\r\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\r\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\r\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\r\n\t\t\treturn setValueT6;\r\n\r\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\r\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\r\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\r\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\r\n\t\t\treturn setValueT2DArray1;\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\n// Array of scalars\r\n\r\nfunction setValueV1fArray( gl, v ) {\r\n\r\n\tgl.uniform1fv( this.addr, v );\r\n\r\n}\r\n\r\n// Array of vectors (from flat array or array of THREE.VectorN)\r\n\r\nfunction setValueV2fArray( gl, v ) {\r\n\r\n\tconst data = flatten( v, this.size, 2 );\r\n\r\n\tgl.uniform2fv( this.addr, data );\r\n\r\n}\r\n\r\nfunction setValueV3fArray( gl, v ) {\r\n\r\n\tconst data = flatten( v, this.size, 3 );\r\n\r\n\tgl.uniform3fv( this.addr, data );\r\n\r\n}\r\n\r\nfunction setValueV4fArray( gl, v ) {\r\n\r\n\tconst data = flatten( v, this.size, 4 );\r\n\r\n\tgl.uniform4fv( this.addr, data );\r\n\r\n}\r\n\r\n// Array of matrices (from flat array or array of THREE.MatrixN)\r\n\r\nfunction setValueM2Array( gl, v ) {\r\n\r\n\tconst data = flatten( v, this.size, 4 );\r\n\r\n\tgl.uniformMatrix2fv( this.addr, false, data );\r\n\r\n}\r\n\r\nfunction setValueM3Array( gl, v ) {\r\n\r\n\tconst data = flatten( v, this.size, 9 );\r\n\r\n\tgl.uniformMatrix3fv( this.addr, false, data );\r\n\r\n}\r\n\r\nfunction setValueM4Array( gl, v ) {\r\n\r\n\tconst data = flatten( v, this.size, 16 );\r\n\r\n\tgl.uniformMatrix4fv( this.addr, false, data );\r\n\r\n}\r\n\r\n// Array of integer / boolean\r\n\r\nfunction setValueV1iArray( gl, v ) {\r\n\r\n\tgl.uniform1iv( this.addr, v );\r\n\r\n}\r\n\r\n// Array of integer / boolean vectors (from flat array)\r\n\r\nfunction setValueV2iArray( gl, v ) {\r\n\r\n\tgl.uniform2iv( this.addr, v );\r\n\r\n}\r\n\r\nfunction setValueV3iArray( gl, v ) {\r\n\r\n\tgl.uniform3iv( this.addr, v );\r\n\r\n}\r\n\r\nfunction setValueV4iArray( gl, v ) {\r\n\r\n\tgl.uniform4iv( this.addr, v );\r\n\r\n}\r\n\r\n// Array of unsigned integer\r\n\r\nfunction setValueV1uiArray( gl, v ) {\r\n\r\n\tgl.uniform1uiv( this.addr, v );\r\n\r\n}\r\n\r\n// Array of unsigned integer vectors (from flat array)\r\n\r\nfunction setValueV2uiArray( gl, v ) {\r\n\r\n\tgl.uniform2uiv( this.addr, v );\r\n\r\n}\r\n\r\nfunction setValueV3uiArray( gl, v ) {\r\n\r\n\tgl.uniform3uiv( this.addr, v );\r\n\r\n}\r\n\r\nfunction setValueV4uiArray( gl, v ) {\r\n\r\n\tgl.uniform4uiv( this.addr, v );\r\n\r\n}\r\n\r\n\r\n// Array of textures (2D / 3D / Cube / 2DArray)\r\n\r\nfunction setValueT1Array( gl, v, textures ) {\r\n\r\n\tconst cache = this.cache;\r\n\r\n\tconst n = v.length;\r\n\r\n\tconst units = allocTexUnits( textures, n );\r\n\r\n\tif ( ! arraysEqual( cache, units ) ) {\r\n\r\n\t\tgl.uniform1iv( this.addr, units );\r\n\r\n\t\tcopyArray( cache, units );\r\n\r\n\t}\r\n\r\n\tfor ( let i = 0; i !== n; ++ i ) {\r\n\r\n\t\ttextures.setTexture2D( v[ i ] || emptyTexture, units[ i ] );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction setValueT3DArray( gl, v, textures ) {\r\n\r\n\tconst cache = this.cache;\r\n\r\n\tconst n = v.length;\r\n\r\n\tconst units = allocTexUnits( textures, n );\r\n\r\n\tif ( ! arraysEqual( cache, units ) ) {\r\n\r\n\t\tgl.uniform1iv( this.addr, units );\r\n\r\n\t\tcopyArray( cache, units );\r\n\r\n\t}\r\n\r\n\tfor ( let i = 0; i !== n; ++ i ) {\r\n\r\n\t\ttextures.setTexture3D( v[ i ] || empty3dTexture, units[ i ] );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction setValueT6Array( gl, v, textures ) {\r\n\r\n\tconst cache = this.cache;\r\n\r\n\tconst n = v.length;\r\n\r\n\tconst units = allocTexUnits( textures, n );\r\n\r\n\tif ( ! arraysEqual( cache, units ) ) {\r\n\r\n\t\tgl.uniform1iv( this.addr, units );\r\n\r\n\t\tcopyArray( cache, units );\r\n\r\n\t}\r\n\r\n\tfor ( let i = 0; i !== n; ++ i ) {\r\n\r\n\t\ttextures.setTextureCube( v[ i ] || emptyCubeTexture, units[ i ] );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction setValueT2DArrayArray( gl, v, textures ) {\r\n\r\n\tconst cache = this.cache;\r\n\r\n\tconst n = v.length;\r\n\r\n\tconst units = allocTexUnits( textures, n );\r\n\r\n\tif ( ! arraysEqual( cache, units ) ) {\r\n\r\n\t\tgl.uniform1iv( this.addr, units );\r\n\r\n\t\tcopyArray( cache, units );\r\n\r\n\t}\r\n\r\n\tfor ( let i = 0; i !== n; ++ i ) {\r\n\r\n\t\ttextures.setTexture2DArray( v[ i ] || emptyArrayTexture, units[ i ] );\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\n// Helper to pick the right setter for a pure (bottom-level) array\r\n\r\nfunction getPureArraySetter( type ) {\r\n\r\n\tswitch ( type ) {\r\n\r\n\t\tcase 0x1406: return setValueV1fArray; // FLOAT\r\n\t\tcase 0x8b50: return setValueV2fArray; // _VEC2\r\n\t\tcase 0x8b51: return setValueV3fArray; // _VEC3\r\n\t\tcase 0x8b52: return setValueV4fArray; // _VEC4\r\n\r\n\t\tcase 0x8b5a: return setValueM2Array; // _MAT2\r\n\t\tcase 0x8b5b: return setValueM3Array; // _MAT3\r\n\t\tcase 0x8b5c: return setValueM4Array; // _MAT4\r\n\r\n\t\tcase 0x1404: case 0x8b56: return setValueV1iArray; // INT, BOOL\r\n\t\tcase 0x8b53: case 0x8b57: return setValueV2iArray; // _VEC2\r\n\t\tcase 0x8b54: case 0x8b58: return setValueV3iArray; // _VEC3\r\n\t\tcase 0x8b55: case 0x8b59: return setValueV4iArray; // _VEC4\r\n\r\n\t\tcase 0x1405: return setValueV1uiArray; // UINT\r\n\t\tcase 0x8dc6: return setValueV2uiArray; // _VEC2\r\n\t\tcase 0x8dc7: return setValueV3uiArray; // _VEC3\r\n\t\tcase 0x8dc8: return setValueV4uiArray; // _VEC4\r\n\r\n\t\tcase 0x8b5e: // SAMPLER_2D\r\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\r\n\t\tcase 0x8dca: // INT_SAMPLER_2D\r\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\r\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\r\n\t\t\treturn setValueT1Array;\r\n\r\n\t\tcase 0x8b5f: // SAMPLER_3D\r\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\r\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\r\n\t\t\treturn setValueT3DArray;\r\n\r\n\t\tcase 0x8b60: // SAMPLER_CUBE\r\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\r\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\r\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\r\n\t\t\treturn setValueT6Array;\r\n\r\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\r\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\r\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\r\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\r\n\t\t\treturn setValueT2DArrayArray;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// --- Uniform Classes ---\r\n\r\nclass SingleUniform {\r\n\r\n\tconstructor( id, activeInfo, addr ) {\r\n\r\n\t\tthis.id = id;\r\n\t\tthis.addr = addr;\r\n\t\tthis.cache = [];\r\n\t\tthis.type = activeInfo.type;\r\n\t\tthis.setValue = getSingularSetter( activeInfo.type );\r\n\r\n\t\t// this.path = activeInfo.name; // DEBUG\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass PureArrayUniform {\r\n\r\n\tconstructor( id, activeInfo, addr ) {\r\n\r\n\t\tthis.id = id;\r\n\t\tthis.addr = addr;\r\n\t\tthis.cache = [];\r\n\t\tthis.type = activeInfo.type;\r\n\t\tthis.size = activeInfo.size;\r\n\t\tthis.setValue = getPureArraySetter( activeInfo.type );\r\n\r\n\t\t// this.path = activeInfo.name; // DEBUG\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass StructuredUniform {\r\n\r\n\tconstructor( id ) {\r\n\r\n\t\tthis.id = id;\r\n\r\n\t\tthis.seq = [];\r\n\t\tthis.map = {};\r\n\r\n\t}\r\n\r\n\tsetValue( gl, value, textures ) {\r\n\r\n\t\tconst seq = this.seq;\r\n\r\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\r\n\r\n\t\t\tconst u = seq[ i ];\r\n\t\t\tu.setValue( gl, value[ u.id ], textures );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// --- Top-level ---\r\n\r\n// Parser - builds up the property tree from the path strings\r\n\r\nconst RePathPart = /(\\w+)(\\])?(\\[|\\.)?/g;\r\n\r\n// extracts\r\n// \t- the identifier (member name or array index)\r\n// - followed by an optional right bracket (found when array index)\r\n// - followed by an optional left bracket or dot (type of subscript)\r\n//\r\n// Note: These portions can be read in a non-overlapping fashion and\r\n// allow straightforward parsing of the hierarchy that WebGL encodes\r\n// in the uniform names.\r\n\r\nfunction addUniform( container, uniformObject ) {\r\n\r\n\tcontainer.seq.push( uniformObject );\r\n\tcontainer.map[ uniformObject.id ] = uniformObject;\r\n\r\n}\r\n\r\nfunction parseUniform( activeInfo, addr, container ) {\r\n\r\n\tconst path = activeInfo.name,\r\n\t\tpathLength = path.length;\r\n\r\n\t// reset RegExp object, because of the early exit of a previous run\r\n\tRePathPart.lastIndex = 0;\r\n\r\n\twhile ( true ) {\r\n\r\n\t\tconst match = RePathPart.exec( path ),\r\n\t\t\tmatchEnd = RePathPart.lastIndex;\r\n\r\n\t\tlet id = match[ 1 ];\r\n\t\tconst idIsIndex = match[ 2 ] === ']',\r\n\t\t\tsubscript = match[ 3 ];\r\n\r\n\t\tif ( idIsIndex ) id = id | 0; // convert to integer\r\n\r\n\t\tif ( subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength ) {\r\n\r\n\t\t\t// bare name or \"pure\" bottom-level array \"[0]\" suffix\r\n\r\n\t\t\taddUniform( container, subscript === undefined ?\r\n\t\t\t\tnew SingleUniform( id, activeInfo, addr ) :\r\n\t\t\t\tnew PureArrayUniform( id, activeInfo, addr ) );\r\n\r\n\t\t\tbreak;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// step into inner node / create it in case it doesn't exist\r\n\r\n\t\t\tconst map = container.map;\r\n\t\t\tlet next = map[ id ];\r\n\r\n\t\t\tif ( next === undefined ) {\r\n\r\n\t\t\t\tnext = new StructuredUniform( id );\r\n\t\t\t\taddUniform( container, next );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcontainer = next;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Root Container\r\n\r\nclass WebGLUniforms {\r\n\r\n\tconstructor( gl, program ) {\r\n\r\n\t\tthis.seq = [];\r\n\t\tthis.map = {};\r\n\r\n\t\tconst n = gl.getProgramParameter( program, gl.ACTIVE_UNIFORMS );\r\n\r\n\t\tfor ( let i = 0; i < n; ++ i ) {\r\n\r\n\t\t\tconst info = gl.getActiveUniform( program, i ),\r\n\t\t\t\taddr = gl.getUniformLocation( program, info.name );\r\n\r\n\t\t\tparseUniform( info, addr, this );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tsetValue( gl, name, value, textures ) {\r\n\r\n\t\tconst u = this.map[ name ];\r\n\r\n\t\tif ( u !== undefined ) u.setValue( gl, value, textures );\r\n\r\n\t}\r\n\r\n\tsetOptional( gl, object, name ) {\r\n\r\n\t\tconst v = object[ name ];\r\n\r\n\t\tif ( v !== undefined ) this.setValue( gl, name, v );\r\n\r\n\t}\r\n\r\n\tstatic upload( gl, seq, values, textures ) {\r\n\r\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\r\n\r\n\t\t\tconst u = seq[ i ],\r\n\t\t\t\tv = values[ u.id ];\r\n\r\n\t\t\tif ( v.needsUpdate !== false ) {\r\n\r\n\t\t\t\t// note: always updating when .needsUpdate is undefined\r\n\t\t\t\tu.setValue( gl, v.value, textures );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tstatic seqWithValue( seq, values ) {\r\n\r\n\t\tconst r = [];\r\n\r\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\r\n\r\n\t\t\tconst u = seq[ i ];\r\n\t\t\tif ( u.id in values ) r.push( u );\r\n\r\n\t\t}\r\n\r\n\t\treturn r;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction WebGLShader( gl, type, string ) {\r\n\r\n\tconst shader = gl.createShader( type );\r\n\r\n\tgl.shaderSource( shader, string );\r\n\tgl.compileShader( shader );\r\n\r\n\treturn shader;\r\n\r\n}\r\n\r\n// From https://www.khronos.org/registry/webgl/extensions/KHR_parallel_shader_compile/\r\nconst COMPLETION_STATUS_KHR = 0x91B1;\r\n\r\nlet programIdCount = 0;\r\n\r\nfunction handleSource( string, errorLine ) {\r\n\r\n\tconst lines = string.split( '\\n' );\r\n\tconst lines2 = [];\r\n\r\n\tconst from = Math.max( errorLine - 6, 0 );\r\n\tconst to = Math.min( errorLine + 6, lines.length );\r\n\r\n\tfor ( let i = from; i < to; i ++ ) {\r\n\r\n\t\tconst line = i + 1;\r\n\t\tlines2.push( `${line === errorLine ? '>' : ' '} ${line}: ${lines[ i ]}` );\r\n\r\n\t}\r\n\r\n\treturn lines2.join( '\\n' );\r\n\r\n}\r\n\r\nfunction getEncodingComponents( colorSpace ) {\r\n\r\n\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\r\n\tconst encodingPrimaries = ColorManagement.getPrimaries( colorSpace );\r\n\r\n\tlet gamutMapping;\r\n\r\n\tif ( workingPrimaries === encodingPrimaries ) {\r\n\r\n\t\tgamutMapping = '';\r\n\r\n\t} else if ( workingPrimaries === P3Primaries && encodingPrimaries === Rec709Primaries ) {\r\n\r\n\t\tgamutMapping = 'LinearDisplayP3ToLinearSRGB';\r\n\r\n\t} else if ( workingPrimaries === Rec709Primaries && encodingPrimaries === P3Primaries ) {\r\n\r\n\t\tgamutMapping = 'LinearSRGBToLinearDisplayP3';\r\n\r\n\t}\r\n\r\n\tswitch ( colorSpace ) {\r\n\r\n\t\tcase LinearSRGBColorSpace:\r\n\t\tcase LinearDisplayP3ColorSpace:\r\n\t\t\treturn [ gamutMapping, 'LinearTransferOETF' ];\r\n\r\n\t\tcase SRGBColorSpace:\r\n\t\tcase DisplayP3ColorSpace:\r\n\t\t\treturn [ gamutMapping, 'sRGBTransferOETF' ];\r\n\r\n\t\tdefault:\r\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported color space:', colorSpace );\r\n\t\t\treturn [ gamutMapping, 'LinearTransferOETF' ];\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getShaderErrors( gl, shader, type ) {\r\n\r\n\tconst status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );\r\n\tconst errors = gl.getShaderInfoLog( shader ).trim();\r\n\r\n\tif ( status && errors === '' ) return '';\r\n\r\n\tconst errorMatches = /ERROR: 0:(\\d+)/.exec( errors );\r\n\tif ( errorMatches ) {\r\n\r\n\t\t// --enable-privileged-webgl-extension\r\n\t\t// console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );\r\n\r\n\t\tconst errorLine = parseInt( errorMatches[ 1 ] );\r\n\t\treturn type.toUpperCase() + '\\n\\n' + errors + '\\n\\n' + handleSource( gl.getShaderSource( shader ), errorLine );\r\n\r\n\t} else {\r\n\r\n\t\treturn errors;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getTexelEncodingFunction( functionName, colorSpace ) {\r\n\r\n\tconst components = getEncodingComponents( colorSpace );\r\n\treturn `vec4 ${functionName}( vec4 value ) { return ${components[ 0 ]}( ${components[ 1 ]}( value ) ); }`;\r\n\r\n}\r\n\r\nfunction getToneMappingFunction( functionName, toneMapping ) {\r\n\r\n\tlet toneMappingName;\r\n\r\n\tswitch ( toneMapping ) {\r\n\r\n\t\tcase LinearToneMapping:\r\n\t\t\ttoneMappingName = 'Linear';\r\n\t\t\tbreak;\r\n\r\n\t\tcase ReinhardToneMapping:\r\n\t\t\ttoneMappingName = 'Reinhard';\r\n\t\t\tbreak;\r\n\r\n\t\tcase CineonToneMapping:\r\n\t\t\ttoneMappingName = 'Cineon';\r\n\t\t\tbreak;\r\n\r\n\t\tcase ACESFilmicToneMapping:\r\n\t\t\ttoneMappingName = 'ACESFilmic';\r\n\t\t\tbreak;\r\n\r\n\t\tcase AgXToneMapping:\r\n\t\t\ttoneMappingName = 'AgX';\r\n\t\t\tbreak;\r\n\r\n\t\tcase NeutralToneMapping:\r\n\t\t\ttoneMappingName = 'Neutral';\r\n\t\t\tbreak;\r\n\r\n\t\tcase CustomToneMapping:\r\n\t\t\ttoneMappingName = 'Custom';\r\n\t\t\tbreak;\r\n\r\n\t\tdefault:\r\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported toneMapping:', toneMapping );\r\n\t\t\ttoneMappingName = 'Linear';\r\n\r\n\t}\r\n\r\n\treturn 'vec3 ' + functionName + '( vec3 color ) { return ' + toneMappingName + 'ToneMapping( color ); }';\r\n\r\n}\r\n\r\nconst _v0$1 = /*@__PURE__*/ new Vector3();\r\n\r\nfunction getLuminanceFunction() {\r\n\r\n\tColorManagement.getLuminanceCoefficients( _v0$1 );\r\n\r\n\tconst r = _v0$1.x.toFixed( 4 );\r\n\tconst g = _v0$1.y.toFixed( 4 );\r\n\tconst b = _v0$1.z.toFixed( 4 );\r\n\r\n\treturn [\r\n\r\n\t\t'float luminance( const in vec3 rgb ) {',\r\n\r\n\t\t`\tconst vec3 weights = vec3( ${ r }, ${ g }, ${ b } );`,\r\n\r\n\t\t'\treturn dot( weights, rgb );',\r\n\r\n\t\t'}'\r\n\r\n\t].join( '\\n' );\r\n\r\n}\r\n\r\nfunction generateVertexExtensions( parameters ) {\r\n\r\n\tconst chunks = [\r\n\t\tparameters.extensionClipCullDistance ? '#extension GL_ANGLE_clip_cull_distance : require' : '',\r\n\t\tparameters.extensionMultiDraw ? '#extension GL_ANGLE_multi_draw : require' : '',\r\n\t];\r\n\r\n\treturn chunks.filter( filterEmptyLine ).join( '\\n' );\r\n\r\n}\r\n\r\nfunction generateDefines( defines ) {\r\n\r\n\tconst chunks = [];\r\n\r\n\tfor ( const name in defines ) {\r\n\r\n\t\tconst value = defines[ name ];\r\n\r\n\t\tif ( value === false ) continue;\r\n\r\n\t\tchunks.push( '#define ' + name + ' ' + value );\r\n\r\n\t}\r\n\r\n\treturn chunks.join( '\\n' );\r\n\r\n}\r\n\r\nfunction fetchAttributeLocations( gl, program ) {\r\n\r\n\tconst attributes = {};\r\n\r\n\tconst n = gl.getProgramParameter( program, gl.ACTIVE_ATTRIBUTES );\r\n\r\n\tfor ( let i = 0; i < n; i ++ ) {\r\n\r\n\t\tconst info = gl.getActiveAttrib( program, i );\r\n\t\tconst name = info.name;\r\n\r\n\t\tlet locationSize = 1;\r\n\t\tif ( info.type === gl.FLOAT_MAT2 ) locationSize = 2;\r\n\t\tif ( info.type === gl.FLOAT_MAT3 ) locationSize = 3;\r\n\t\tif ( info.type === gl.FLOAT_MAT4 ) locationSize = 4;\r\n\r\n\t\t// console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );\r\n\r\n\t\tattributes[ name ] = {\r\n\t\t\ttype: info.type,\r\n\t\t\tlocation: gl.getAttribLocation( program, name ),\r\n\t\t\tlocationSize: locationSize\r\n\t\t};\r\n\r\n\t}\r\n\r\n\treturn attributes;\r\n\r\n}\r\n\r\nfunction filterEmptyLine( string ) {\r\n\r\n\treturn string !== '';\r\n\r\n}\r\n\r\nfunction replaceLightNums( string, parameters ) {\r\n\r\n\tconst numSpotLightCoords = parameters.numSpotLightShadows + parameters.numSpotLightMaps - parameters.numSpotLightShadowsWithMaps;\r\n\r\n\treturn string\r\n\t\t.replace( /NUM_DIR_LIGHTS/g, parameters.numDirLights )\r\n\t\t.replace( /NUM_SPOT_LIGHTS/g, parameters.numSpotLights )\r\n\t\t.replace( /NUM_SPOT_LIGHT_MAPS/g, parameters.numSpotLightMaps )\r\n\t\t.replace( /NUM_SPOT_LIGHT_COORDS/g, numSpotLightCoords )\r\n\t\t.replace( /NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights )\r\n\t\t.replace( /NUM_POINT_LIGHTS/g, parameters.numPointLights )\r\n\t\t.replace( /NUM_HEMI_LIGHTS/g, parameters.numHemiLights )\r\n\t\t.replace( /NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows )\r\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, parameters.numSpotLightShadowsWithMaps )\r\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows )\r\n\t\t.replace( /NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows );\r\n\r\n}\r\n\r\nfunction replaceClippingPlaneNums( string, parameters ) {\r\n\r\n\treturn string\r\n\t\t.replace( /NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes )\r\n\t\t.replace( /UNION_CLIPPING_PLANES/g, ( parameters.numClippingPlanes - parameters.numClipIntersection ) );\r\n\r\n}\r\n\r\n// Resolve Includes\r\n\r\nconst includePattern = /^[ \\t]*#include +<([\\w\\d./]+)>/gm;\r\n\r\nfunction resolveIncludes( string ) {\r\n\r\n\treturn string.replace( includePattern, includeReplacer );\r\n\r\n}\r\n\r\nconst shaderChunkMap = new Map();\r\n\r\nfunction includeReplacer( match, include ) {\r\n\r\n\tlet string = ShaderChunk[ include ];\r\n\r\n\tif ( string === undefined ) {\r\n\r\n\t\tconst newInclude = shaderChunkMap.get( include );\r\n\r\n\t\tif ( newInclude !== undefined ) {\r\n\r\n\t\t\tstring = ShaderChunk[ newInclude ];\r\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Shader chunk \"%s\" has been deprecated. Use \"%s\" instead.', include, newInclude );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthrow new Error( 'Can not resolve #include <' + include + '>' );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn resolveIncludes( string );\r\n\r\n}\r\n\r\n// Unroll Loops\r\n\r\nconst unrollLoopPattern = /#pragma unroll_loop_start\\s+for\\s*\\(\\s*int\\s+i\\s*=\\s*(\\d+)\\s*;\\s*i\\s*<\\s*(\\d+)\\s*;\\s*i\\s*\\+\\+\\s*\\)\\s*{([\\s\\S]+?)}\\s+#pragma unroll_loop_end/g;\r\n\r\nfunction unrollLoops( string ) {\r\n\r\n\treturn string.replace( unrollLoopPattern, loopReplacer );\r\n\r\n}\r\n\r\nfunction loopReplacer( match, start, end, snippet ) {\r\n\r\n\tlet string = '';\r\n\r\n\tfor ( let i = parseInt( start ); i < parseInt( end ); i ++ ) {\r\n\r\n\t\tstring += snippet\r\n\t\t\t.replace( /\\[\\s*i\\s*\\]/g, '[ ' + i + ' ]' )\r\n\t\t\t.replace( /UNROLLED_LOOP_INDEX/g, i );\r\n\r\n\t}\r\n\r\n\treturn string;\r\n\r\n}\r\n\r\n//\r\n\r\nfunction generatePrecision( parameters ) {\r\n\r\n\tlet precisionstring = `precision ${parameters.precision} float;\r\n\tprecision ${parameters.precision} int;\r\n\tprecision ${parameters.precision} sampler2D;\r\n\tprecision ${parameters.precision} samplerCube;\r\n\tprecision ${parameters.precision} sampler3D;\r\n\tprecision ${parameters.precision} sampler2DArray;\r\n\tprecision ${parameters.precision} sampler2DShadow;\r\n\tprecision ${parameters.precision} samplerCubeShadow;\r\n\tprecision ${parameters.precision} sampler2DArrayShadow;\r\n\tprecision ${parameters.precision} isampler2D;\r\n\tprecision ${parameters.precision} isampler3D;\r\n\tprecision ${parameters.precision} isamplerCube;\r\n\tprecision ${parameters.precision} isampler2DArray;\r\n\tprecision ${parameters.precision} usampler2D;\r\n\tprecision ${parameters.precision} usampler3D;\r\n\tprecision ${parameters.precision} usamplerCube;\r\n\tprecision ${parameters.precision} usampler2DArray;\r\n\t`;\r\n\r\n\tif ( parameters.precision === 'highp' ) {\r\n\r\n\t\tprecisionstring += '\\n#define HIGH_PRECISION';\r\n\r\n\t} else if ( parameters.precision === 'mediump' ) {\r\n\r\n\t\tprecisionstring += '\\n#define MEDIUM_PRECISION';\r\n\r\n\t} else if ( parameters.precision === 'lowp' ) {\r\n\r\n\t\tprecisionstring += '\\n#define LOW_PRECISION';\r\n\r\n\t}\r\n\r\n\treturn precisionstring;\r\n\r\n}\r\n\r\nfunction generateShadowMapTypeDefine( parameters ) {\r\n\r\n\tlet shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC';\r\n\r\n\tif ( parameters.shadowMapType === PCFShadowMap ) {\r\n\r\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF';\r\n\r\n\t} else if ( parameters.shadowMapType === PCFSoftShadowMap ) {\r\n\r\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT';\r\n\r\n\t} else if ( parameters.shadowMapType === VSMShadowMap ) {\r\n\r\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_VSM';\r\n\r\n\t}\r\n\r\n\treturn shadowMapTypeDefine;\r\n\r\n}\r\n\r\nfunction generateEnvMapTypeDefine( parameters ) {\r\n\r\n\tlet envMapTypeDefine = 'ENVMAP_TYPE_CUBE';\r\n\r\n\tif ( parameters.envMap ) {\r\n\r\n\t\tswitch ( parameters.envMapMode ) {\r\n\r\n\t\t\tcase CubeReflectionMapping:\r\n\t\t\tcase CubeRefractionMapping:\r\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE';\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CubeUVReflectionMapping:\r\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV';\r\n\t\t\t\tbreak;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn envMapTypeDefine;\r\n\r\n}\r\n\r\nfunction generateEnvMapModeDefine( parameters ) {\r\n\r\n\tlet envMapModeDefine = 'ENVMAP_MODE_REFLECTION';\r\n\r\n\tif ( parameters.envMap ) {\r\n\r\n\t\tswitch ( parameters.envMapMode ) {\r\n\r\n\t\t\tcase CubeRefractionMapping:\r\n\r\n\t\t\t\tenvMapModeDefine = 'ENVMAP_MODE_REFRACTION';\r\n\t\t\t\tbreak;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn envMapModeDefine;\r\n\r\n}\r\n\r\nfunction generateEnvMapBlendingDefine( parameters ) {\r\n\r\n\tlet envMapBlendingDefine = 'ENVMAP_BLENDING_NONE';\r\n\r\n\tif ( parameters.envMap ) {\r\n\r\n\t\tswitch ( parameters.combine ) {\r\n\r\n\t\t\tcase MultiplyOperation:\r\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase MixOperation:\r\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MIX';\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase AddOperation:\r\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_ADD';\r\n\t\t\t\tbreak;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn envMapBlendingDefine;\r\n\r\n}\r\n\r\nfunction generateCubeUVSize( parameters ) {\r\n\r\n\tconst imageHeight = parameters.envMapCubeUVHeight;\r\n\r\n\tif ( imageHeight === null ) return null;\r\n\r\n\tconst maxMip = Math.log2( imageHeight ) - 2;\r\n\r\n\tconst texelHeight = 1.0 / imageHeight;\r\n\r\n\tconst texelWidth = 1.0 / ( 3 * Math.max( Math.pow( 2, maxMip ), 7 * 16 ) );\r\n\r\n\treturn { texelWidth, texelHeight, maxMip };\r\n\r\n}\r\n\r\nfunction WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {\r\n\r\n\t// TODO Send this event to Three.js DevTools\r\n\t// console.log( 'WebGLProgram', cacheKey );\r\n\r\n\tconst gl = renderer.getContext();\r\n\r\n\tconst defines = parameters.defines;\r\n\r\n\tlet vertexShader = parameters.vertexShader;\r\n\tlet fragmentShader = parameters.fragmentShader;\r\n\r\n\tconst shadowMapTypeDefine = generateShadowMapTypeDefine( parameters );\r\n\tconst envMapTypeDefine = generateEnvMapTypeDefine( parameters );\r\n\tconst envMapModeDefine = generateEnvMapModeDefine( parameters );\r\n\tconst envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );\r\n\tconst envMapCubeUVSize = generateCubeUVSize( parameters );\r\n\r\n\tconst customVertexExtensions = generateVertexExtensions( parameters );\r\n\r\n\tconst customDefines = generateDefines( defines );\r\n\r\n\tconst program = gl.createProgram();\r\n\r\n\tlet prefixVertex, prefixFragment;\r\n\tlet versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\\n' : '';\r\n\r\n\tif ( parameters.isRawShaderMaterial ) {\r\n\r\n\t\tprefixVertex = [\r\n\r\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\r\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\r\n\r\n\t\t\tcustomDefines\r\n\r\n\t\t].filter( filterEmptyLine ).join( '\\n' );\r\n\r\n\t\tif ( prefixVertex.length > 0 ) {\r\n\r\n\t\t\tprefixVertex += '\\n';\r\n\r\n\t\t}\r\n\r\n\t\tprefixFragment = [\r\n\r\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\r\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\r\n\r\n\t\t\tcustomDefines\r\n\r\n\t\t].filter( filterEmptyLine ).join( '\\n' );\r\n\r\n\t\tif ( prefixFragment.length > 0 ) {\r\n\r\n\t\t\tprefixFragment += '\\n';\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\tprefixVertex = [\r\n\r\n\t\t\tgeneratePrecision( parameters ),\r\n\r\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\r\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\r\n\r\n\t\t\tcustomDefines,\r\n\r\n\t\t\tparameters.extensionClipCullDistance ? '#define USE_CLIP_DISTANCE' : '',\r\n\t\t\tparameters.batching ? '#define USE_BATCHING' : '',\r\n\t\t\tparameters.batchingColor ? '#define USE_BATCHING_COLOR' : '',\r\n\t\t\tparameters.instancing ? '#define USE_INSTANCING' : '',\r\n\t\t\tparameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',\r\n\t\t\tparameters.instancingMorph ? '#define USE_INSTANCING_MORPH' : '',\r\n\r\n\t\t\tparameters.useFog && parameters.fog ? '#define USE_FOG' : '',\r\n\t\t\tparameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',\r\n\r\n\t\t\tparameters.map ? '#define USE_MAP' : '',\r\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\r\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\r\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\r\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\r\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\r\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\r\n\t\t\tparameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',\r\n\t\t\tparameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',\r\n\t\t\tparameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',\r\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\r\n\r\n\t\t\tparameters.anisotropy ? '#define USE_ANISOTROPY' : '',\r\n\t\t\tparameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',\r\n\r\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\r\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\r\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\r\n\r\n\t\t\tparameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',\r\n\t\t\tparameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',\r\n\r\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\r\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '',\r\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',\r\n\r\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\r\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\r\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\r\n\t\t\tparameters.alphaHash ? '#define USE_ALPHAHASH' : '',\r\n\r\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\r\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\r\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\r\n\r\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '',\r\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '',\r\n\r\n\t\t\t//\r\n\r\n\t\t\tparameters.mapUv ? '#define MAP_UV ' + parameters.mapUv : '',\r\n\t\t\tparameters.alphaMapUv ? '#define ALPHAMAP_UV ' + parameters.alphaMapUv : '',\r\n\t\t\tparameters.lightMapUv ? '#define LIGHTMAP_UV ' + parameters.lightMapUv : '',\r\n\t\t\tparameters.aoMapUv ? '#define AOMAP_UV ' + parameters.aoMapUv : '',\r\n\t\t\tparameters.emissiveMapUv ? '#define EMISSIVEMAP_UV ' + parameters.emissiveMapUv : '',\r\n\t\t\tparameters.bumpMapUv ? '#define BUMPMAP_UV ' + parameters.bumpMapUv : '',\r\n\t\t\tparameters.normalMapUv ? '#define NORMALMAP_UV ' + parameters.normalMapUv : '',\r\n\t\t\tparameters.displacementMapUv ? '#define DISPLACEMENTMAP_UV ' + parameters.displacementMapUv : '',\r\n\r\n\t\t\tparameters.metalnessMapUv ? '#define METALNESSMAP_UV ' + parameters.metalnessMapUv : '',\r\n\t\t\tparameters.roughnessMapUv ? '#define ROUGHNESSMAP_UV ' + parameters.roughnessMapUv : '',\r\n\r\n\t\t\tparameters.anisotropyMapUv ? '#define ANISOTROPYMAP_UV ' + parameters.anisotropyMapUv : '',\r\n\r\n\t\t\tparameters.clearcoatMapUv ? '#define CLEARCOATMAP_UV ' + parameters.clearcoatMapUv : '',\r\n\t\t\tparameters.clearcoatNormalMapUv ? '#define CLEARCOAT_NORMALMAP_UV ' + parameters.clearcoatNormalMapUv : '',\r\n\t\t\tparameters.clearcoatRoughnessMapUv ? '#define CLEARCOAT_ROUGHNESSMAP_UV ' + parameters.clearcoatRoughnessMapUv : '',\r\n\r\n\t\t\tparameters.iridescenceMapUv ? '#define IRIDESCENCEMAP_UV ' + parameters.iridescenceMapUv : '',\r\n\t\t\tparameters.iridescenceThicknessMapUv ? '#define IRIDESCENCE_THICKNESSMAP_UV ' + parameters.iridescenceThicknessMapUv : '',\r\n\r\n\t\t\tparameters.sheenColorMapUv ? '#define SHEEN_COLORMAP_UV ' + parameters.sheenColorMapUv : '',\r\n\t\t\tparameters.sheenRoughnessMapUv ? '#define SHEEN_ROUGHNESSMAP_UV ' + parameters.sheenRoughnessMapUv : '',\r\n\r\n\t\t\tparameters.specularMapUv ? '#define SPECULARMAP_UV ' + parameters.specularMapUv : '',\r\n\t\t\tparameters.specularColorMapUv ? '#define SPECULAR_COLORMAP_UV ' + parameters.specularColorMapUv : '',\r\n\t\t\tparameters.specularIntensityMapUv ? '#define SPECULAR_INTENSITYMAP_UV ' + parameters.specularIntensityMapUv : '',\r\n\r\n\t\t\tparameters.transmissionMapUv ? '#define TRANSMISSIONMAP_UV ' + parameters.transmissionMapUv : '',\r\n\t\t\tparameters.thicknessMapUv ? '#define THICKNESSMAP_UV ' + parameters.thicknessMapUv : '',\r\n\r\n\t\t\t//\r\n\r\n\t\t\tparameters.vertexTangents && parameters.flatShading === false ? '#define USE_TANGENT' : '',\r\n\t\t\tparameters.vertexColors ? '#define USE_COLOR' : '',\r\n\t\t\tparameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',\r\n\t\t\tparameters.vertexUv1s ? '#define USE_UV1' : '',\r\n\t\t\tparameters.vertexUv2s ? '#define USE_UV2' : '',\r\n\t\t\tparameters.vertexUv3s ? '#define USE_UV3' : '',\r\n\r\n\t\t\tparameters.pointsUvs ? '#define USE_POINTS_UV' : '',\r\n\r\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\r\n\r\n\t\t\tparameters.skinning ? '#define USE_SKINNING' : '',\r\n\r\n\t\t\tparameters.morphTargets ? '#define USE_MORPHTARGETS' : '',\r\n\t\t\tparameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',\r\n\t\t\t( parameters.morphColors ) ? '#define USE_MORPHCOLORS' : '',\r\n\t\t\t( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',\r\n\t\t\t( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',\r\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\r\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\r\n\r\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\r\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\r\n\r\n\t\t\tparameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',\r\n\r\n\t\t\tparameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',\r\n\r\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\r\n\r\n\t\t\t'uniform mat4 modelMatrix;',\r\n\t\t\t'uniform mat4 modelViewMatrix;',\r\n\t\t\t'uniform mat4 projectionMatrix;',\r\n\t\t\t'uniform mat4 viewMatrix;',\r\n\t\t\t'uniform mat3 normalMatrix;',\r\n\t\t\t'uniform vec3 cameraPosition;',\r\n\t\t\t'uniform bool isOrthographic;',\r\n\r\n\t\t\t'#ifdef USE_INSTANCING',\r\n\r\n\t\t\t'\tattribute mat4 instanceMatrix;',\r\n\r\n\t\t\t'#endif',\r\n\r\n\t\t\t'#ifdef USE_INSTANCING_COLOR',\r\n\r\n\t\t\t'\tattribute vec3 instanceColor;',\r\n\r\n\t\t\t'#endif',\r\n\r\n\t\t\t'#ifdef USE_INSTANCING_MORPH',\r\n\r\n\t\t\t'\tuniform sampler2D morphTexture;',\r\n\r\n\t\t\t'#endif',\r\n\r\n\t\t\t'attribute vec3 position;',\r\n\t\t\t'attribute vec3 normal;',\r\n\t\t\t'attribute vec2 uv;',\r\n\r\n\t\t\t'#ifdef USE_UV1',\r\n\r\n\t\t\t'\tattribute vec2 uv1;',\r\n\r\n\t\t\t'#endif',\r\n\r\n\t\t\t'#ifdef USE_UV2',\r\n\r\n\t\t\t'\tattribute vec2 uv2;',\r\n\r\n\t\t\t'#endif',\r\n\r\n\t\t\t'#ifdef USE_UV3',\r\n\r\n\t\t\t'\tattribute vec2 uv3;',\r\n\r\n\t\t\t'#endif',\r\n\r\n\t\t\t'#ifdef USE_TANGENT',\r\n\r\n\t\t\t'\tattribute vec4 tangent;',\r\n\r\n\t\t\t'#endif',\r\n\r\n\t\t\t'#if defined( USE_COLOR_ALPHA )',\r\n\r\n\t\t\t'\tattribute vec4 color;',\r\n\r\n\t\t\t'#elif defined( USE_COLOR )',\r\n\r\n\t\t\t'\tattribute vec3 color;',\r\n\r\n\t\t\t'#endif',\r\n\r\n\t\t\t'#ifdef USE_SKINNING',\r\n\r\n\t\t\t'\tattribute vec4 skinIndex;',\r\n\t\t\t'\tattribute vec4 skinWeight;',\r\n\r\n\t\t\t'#endif',\r\n\r\n\t\t\t'\\n'\r\n\r\n\t\t].filter( filterEmptyLine ).join( '\\n' );\r\n\r\n\t\tprefixFragment = [\r\n\r\n\t\t\tgeneratePrecision( parameters ),\r\n\r\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\r\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\r\n\r\n\t\t\tcustomDefines,\r\n\r\n\t\t\tparameters.useFog && parameters.fog ? '#define USE_FOG' : '',\r\n\t\t\tparameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',\r\n\r\n\t\t\tparameters.alphaToCoverage ? '#define ALPHA_TO_COVERAGE' : '',\r\n\t\t\tparameters.map ? '#define USE_MAP' : '',\r\n\t\t\tparameters.matcap ? '#define USE_MATCAP' : '',\r\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\r\n\t\t\tparameters.envMap ? '#define ' + envMapTypeDefine : '',\r\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\r\n\t\t\tparameters.envMap ? '#define ' + envMapBlendingDefine : '',\r\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_TEXEL_WIDTH ' + envMapCubeUVSize.texelWidth : '',\r\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_TEXEL_HEIGHT ' + envMapCubeUVSize.texelHeight : '',\r\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_MAX_MIP ' + envMapCubeUVSize.maxMip + '.0' : '',\r\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\r\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\r\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\r\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\r\n\t\t\tparameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',\r\n\t\t\tparameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',\r\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\r\n\r\n\t\t\tparameters.anisotropy ? '#define USE_ANISOTROPY' : '',\r\n\t\t\tparameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',\r\n\r\n\t\t\tparameters.clearcoat ? '#define USE_CLEARCOAT' : '',\r\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\r\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\r\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\r\n\r\n\t\t\tparameters.dispersion ? '#define USE_DISPERSION' : '',\r\n\r\n\t\t\tparameters.iridescence ? '#define USE_IRIDESCENCE' : '',\r\n\t\t\tparameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',\r\n\t\t\tparameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',\r\n\r\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\r\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '',\r\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',\r\n\r\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\r\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\r\n\r\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\r\n\t\t\tparameters.alphaTest ? '#define USE_ALPHATEST' : '',\r\n\t\t\tparameters.alphaHash ? '#define USE_ALPHAHASH' : '',\r\n\r\n\t\t\tparameters.sheen ? '#define USE_SHEEN' : '',\r\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '',\r\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '',\r\n\r\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\r\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\r\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\r\n\r\n\t\t\tparameters.vertexTangents && parameters.flatShading === false ? '#define USE_TANGENT' : '',\r\n\t\t\tparameters.vertexColors || parameters.instancingColor || parameters.batchingColor ? '#define USE_COLOR' : '',\r\n\t\t\tparameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',\r\n\t\t\tparameters.vertexUv1s ? '#define USE_UV1' : '',\r\n\t\t\tparameters.vertexUv2s ? '#define USE_UV2' : '',\r\n\t\t\tparameters.vertexUv3s ? '#define USE_UV3' : '',\r\n\r\n\t\t\tparameters.pointsUvs ? '#define USE_POINTS_UV' : '',\r\n\r\n\t\t\tparameters.gradientMap ? '#define USE_GRADIENTMAP' : '',\r\n\r\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\r\n\r\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\r\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\r\n\r\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\r\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\r\n\r\n\t\t\tparameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '',\r\n\r\n\t\t\tparameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',\r\n\r\n\t\t\tparameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',\r\n\r\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\r\n\r\n\t\t\t'uniform mat4 viewMatrix;',\r\n\t\t\t'uniform vec3 cameraPosition;',\r\n\t\t\t'uniform bool isOrthographic;',\r\n\r\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? '#define TONE_MAPPING' : '',\r\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? ShaderChunk[ 'tonemapping_pars_fragment' ] : '', // this code is required here because it is used by the toneMapping() function defined below\r\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '',\r\n\r\n\t\t\tparameters.dithering ? '#define DITHERING' : '',\r\n\t\t\tparameters.opaque ? '#define OPAQUE' : '',\r\n\r\n\t\t\tShaderChunk[ 'colorspace_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below\r\n\t\t\tgetTexelEncodingFunction( 'linearToOutputTexel', parameters.outputColorSpace ),\r\n\t\t\tgetLuminanceFunction(),\r\n\r\n\t\t\tparameters.useDepthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '',\r\n\r\n\t\t\t'\\n'\r\n\r\n\t\t].filter( filterEmptyLine ).join( '\\n' );\r\n\r\n\t}\r\n\r\n\tvertexShader = resolveIncludes( vertexShader );\r\n\tvertexShader = replaceLightNums( vertexShader, parameters );\r\n\tvertexShader = replaceClippingPlaneNums( vertexShader, parameters );\r\n\r\n\tfragmentShader = resolveIncludes( fragmentShader );\r\n\tfragmentShader = replaceLightNums( fragmentShader, parameters );\r\n\tfragmentShader = replaceClippingPlaneNums( fragmentShader, parameters );\r\n\r\n\tvertexShader = unrollLoops( vertexShader );\r\n\tfragmentShader = unrollLoops( fragmentShader );\r\n\r\n\tif ( parameters.isRawShaderMaterial !== true ) {\r\n\r\n\t\t// GLSL 3.0 conversion for built-in materials and ShaderMaterial\r\n\r\n\t\tversionString = '#version 300 es\\n';\r\n\r\n\t\tprefixVertex = [\r\n\t\t\tcustomVertexExtensions,\r\n\t\t\t'#define attribute in',\r\n\t\t\t'#define varying out',\r\n\t\t\t'#define texture2D texture'\r\n\t\t].join( '\\n' ) + '\\n' + prefixVertex;\r\n\r\n\t\tprefixFragment = [\r\n\t\t\t'#define varying in',\r\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',\r\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',\r\n\t\t\t'#define gl_FragDepthEXT gl_FragDepth',\r\n\t\t\t'#define texture2D texture',\r\n\t\t\t'#define textureCube texture',\r\n\t\t\t'#define texture2DProj textureProj',\r\n\t\t\t'#define texture2DLodEXT textureLod',\r\n\t\t\t'#define texture2DProjLodEXT textureProjLod',\r\n\t\t\t'#define textureCubeLodEXT textureLod',\r\n\t\t\t'#define texture2DGradEXT textureGrad',\r\n\t\t\t'#define texture2DProjGradEXT textureProjGrad',\r\n\t\t\t'#define textureCubeGradEXT textureGrad'\r\n\t\t].join( '\\n' ) + '\\n' + prefixFragment;\r\n\r\n\t}\r\n\r\n\tconst vertexGlsl = versionString + prefixVertex + vertexShader;\r\n\tconst fragmentGlsl = versionString + prefixFragment + fragmentShader;\r\n\r\n\t// console.log( '*VERTEX*', vertexGlsl );\r\n\t// console.log( '*FRAGMENT*', fragmentGlsl );\r\n\r\n\tconst glVertexShader = WebGLShader( gl, gl.VERTEX_SHADER, vertexGlsl );\r\n\tconst glFragmentShader = WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentGlsl );\r\n\r\n\tgl.attachShader( program, glVertexShader );\r\n\tgl.attachShader( program, glFragmentShader );\r\n\r\n\t// Force a particular attribute to index 0.\r\n\r\n\tif ( parameters.index0AttributeName !== undefined ) {\r\n\r\n\t\tgl.bindAttribLocation( program, 0, parameters.index0AttributeName );\r\n\r\n\t} else if ( parameters.morphTargets === true ) {\r\n\r\n\t\t// programs with morphTargets displace position out of attribute 0\r\n\t\tgl.bindAttribLocation( program, 0, 'position' );\r\n\r\n\t}\r\n\r\n\tgl.linkProgram( program );\r\n\r\n\tfunction onFirstUse( self ) {\r\n\r\n\t\t// check for link errors\r\n\t\tif ( renderer.debug.checkShaderErrors ) {\r\n\r\n\t\t\tconst programLog = gl.getProgramInfoLog( program ).trim();\r\n\t\t\tconst vertexLog = gl.getShaderInfoLog( glVertexShader ).trim();\r\n\t\t\tconst fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim();\r\n\r\n\t\t\tlet runnable = true;\r\n\t\t\tlet haveDiagnostics = true;\r\n\r\n\t\t\tif ( gl.getProgramParameter( program, gl.LINK_STATUS ) === false ) {\r\n\r\n\t\t\t\trunnable = false;\r\n\r\n\t\t\t\tif ( typeof renderer.debug.onShaderError === 'function' ) {\r\n\r\n\t\t\t\t\trenderer.debug.onShaderError( gl, program, glVertexShader, glFragmentShader );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// default error reporting\r\n\r\n\t\t\t\t\tconst vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );\r\n\t\t\t\t\tconst fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );\r\n\r\n\t\t\t\t\tconsole.error(\r\n\t\t\t\t\t\t'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +\r\n\t\t\t\t\t\t'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\\n\\n' +\r\n\t\t\t\t\t\t'Material Name: ' + self.name + '\\n' +\r\n\t\t\t\t\t\t'Material Type: ' + self.type + '\\n\\n' +\r\n\t\t\t\t\t\t'Program Info Log: ' + programLog + '\\n' +\r\n\t\t\t\t\t\tvertexErrors + '\\n' +\r\n\t\t\t\t\t\tfragmentErrors\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( programLog !== '' ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLProgram: Program Info Log:', programLog );\r\n\r\n\t\t\t} else if ( vertexLog === '' || fragmentLog === '' ) {\r\n\r\n\t\t\t\thaveDiagnostics = false;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( haveDiagnostics ) {\r\n\r\n\t\t\t\tself.diagnostics = {\r\n\r\n\t\t\t\t\trunnable: runnable,\r\n\r\n\t\t\t\t\tprogramLog: programLog,\r\n\r\n\t\t\t\t\tvertexShader: {\r\n\r\n\t\t\t\t\t\tlog: vertexLog,\r\n\t\t\t\t\t\tprefix: prefixVertex\r\n\r\n\t\t\t\t\t},\r\n\r\n\t\t\t\t\tfragmentShader: {\r\n\r\n\t\t\t\t\t\tlog: fragmentLog,\r\n\t\t\t\t\t\tprefix: prefixFragment\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t};\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// Clean up\r\n\r\n\t\t// Crashes in iOS9 and iOS10. #18402\r\n\t\t// gl.detachShader( program, glVertexShader );\r\n\t\t// gl.detachShader( program, glFragmentShader );\r\n\r\n\t\tgl.deleteShader( glVertexShader );\r\n\t\tgl.deleteShader( glFragmentShader );\r\n\r\n\t\tcachedUniforms = new WebGLUniforms( gl, program );\r\n\t\tcachedAttributes = fetchAttributeLocations( gl, program );\r\n\r\n\t}\r\n\r\n\t// set up caching for uniform locations\r\n\r\n\tlet cachedUniforms;\r\n\r\n\tthis.getUniforms = function () {\r\n\r\n\t\tif ( cachedUniforms === undefined ) {\r\n\r\n\t\t\t// Populates cachedUniforms and cachedAttributes\r\n\t\t\tonFirstUse( this );\r\n\r\n\t\t}\r\n\r\n\t\treturn cachedUniforms;\r\n\r\n\t};\r\n\r\n\t// set up caching for attribute locations\r\n\r\n\tlet cachedAttributes;\r\n\r\n\tthis.getAttributes = function () {\r\n\r\n\t\tif ( cachedAttributes === undefined ) {\r\n\r\n\t\t\t// Populates cachedAttributes and cachedUniforms\r\n\t\t\tonFirstUse( this );\r\n\r\n\t\t}\r\n\r\n\t\treturn cachedAttributes;\r\n\r\n\t};\r\n\r\n\t// indicate when the program is ready to be used. if the KHR_parallel_shader_compile extension isn't supported,\r\n\t// flag the program as ready immediately. It may cause a stall when it's first used.\r\n\r\n\tlet programReady = ( parameters.rendererExtensionParallelShaderCompile === false );\r\n\r\n\tthis.isReady = function () {\r\n\r\n\t\tif ( programReady === false ) {\r\n\r\n\t\t\tprogramReady = gl.getProgramParameter( program, COMPLETION_STATUS_KHR );\r\n\r\n\t\t}\r\n\r\n\t\treturn programReady;\r\n\r\n\t};\r\n\r\n\t// free resource\r\n\r\n\tthis.destroy = function () {\r\n\r\n\t\tbindingStates.releaseStatesOfProgram( this );\r\n\r\n\t\tgl.deleteProgram( program );\r\n\t\tthis.program = undefined;\r\n\r\n\t};\r\n\r\n\t//\r\n\r\n\tthis.type = parameters.shaderType;\r\n\tthis.name = parameters.shaderName;\r\n\tthis.id = programIdCount ++;\r\n\tthis.cacheKey = cacheKey;\r\n\tthis.usedTimes = 1;\r\n\tthis.program = program;\r\n\tthis.vertexShader = glVertexShader;\r\n\tthis.fragmentShader = glFragmentShader;\r\n\r\n\treturn this;\r\n\r\n}\r\n\r\nlet _id$1 = 0;\r\n\r\nclass WebGLShaderCache {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.shaderCache = new Map();\r\n\t\tthis.materialCache = new Map();\r\n\r\n\t}\r\n\r\n\tupdate( material ) {\r\n\r\n\t\tconst vertexShader = material.vertexShader;\r\n\t\tconst fragmentShader = material.fragmentShader;\r\n\r\n\t\tconst vertexShaderStage = this._getShaderStage( vertexShader );\r\n\t\tconst fragmentShaderStage = this._getShaderStage( fragmentShader );\r\n\r\n\t\tconst materialShaders = this._getShaderCacheForMaterial( material );\r\n\r\n\t\tif ( materialShaders.has( vertexShaderStage ) === false ) {\r\n\r\n\t\t\tmaterialShaders.add( vertexShaderStage );\r\n\t\t\tvertexShaderStage.usedTimes ++;\r\n\r\n\t\t}\r\n\r\n\t\tif ( materialShaders.has( fragmentShaderStage ) === false ) {\r\n\r\n\t\t\tmaterialShaders.add( fragmentShaderStage );\r\n\t\t\tfragmentShaderStage.usedTimes ++;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tremove( material ) {\r\n\r\n\t\tconst materialShaders = this.materialCache.get( material );\r\n\r\n\t\tfor ( const shaderStage of materialShaders ) {\r\n\r\n\t\t\tshaderStage.usedTimes --;\r\n\r\n\t\t\tif ( shaderStage.usedTimes === 0 ) this.shaderCache.delete( shaderStage.code );\r\n\r\n\t\t}\r\n\r\n\t\tthis.materialCache.delete( material );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetVertexShaderID( material ) {\r\n\r\n\t\treturn this._getShaderStage( material.vertexShader ).id;\r\n\r\n\t}\r\n\r\n\tgetFragmentShaderID( material ) {\r\n\r\n\t\treturn this._getShaderStage( material.fragmentShader ).id;\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.shaderCache.clear();\r\n\t\tthis.materialCache.clear();\r\n\r\n\t}\r\n\r\n\t_getShaderCacheForMaterial( material ) {\r\n\r\n\t\tconst cache = this.materialCache;\r\n\t\tlet set = cache.get( material );\r\n\r\n\t\tif ( set === undefined ) {\r\n\r\n\t\t\tset = new Set();\r\n\t\t\tcache.set( material, set );\r\n\r\n\t\t}\r\n\r\n\t\treturn set;\r\n\r\n\t}\r\n\r\n\t_getShaderStage( code ) {\r\n\r\n\t\tconst cache = this.shaderCache;\r\n\t\tlet stage = cache.get( code );\r\n\r\n\t\tif ( stage === undefined ) {\r\n\r\n\t\t\tstage = new WebGLShaderStage( code );\r\n\t\t\tcache.set( code, stage );\r\n\r\n\t\t}\r\n\r\n\t\treturn stage;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass WebGLShaderStage {\r\n\r\n\tconstructor( code ) {\r\n\r\n\t\tthis.id = _id$1 ++;\r\n\r\n\t\tthis.code = code;\r\n\t\tthis.usedTimes = 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping ) {\r\n\r\n\tconst _programLayers = new Layers();\r\n\tconst _customShaders = new WebGLShaderCache();\r\n\tconst _activeChannels = new Set();\r\n\tconst programs = [];\r\n\r\n\tconst logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;\r\n\tconst SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;\r\n\r\n\tlet precision = capabilities.precision;\r\n\r\n\tconst shaderIDs = {\r\n\t\tMeshDepthMaterial: 'depth',\r\n\t\tMeshDistanceMaterial: 'distanceRGBA',\r\n\t\tMeshNormalMaterial: 'normal',\r\n\t\tMeshBasicMaterial: 'basic',\r\n\t\tMeshLambertMaterial: 'lambert',\r\n\t\tMeshPhongMaterial: 'phong',\r\n\t\tMeshToonMaterial: 'toon',\r\n\t\tMeshStandardMaterial: 'physical',\r\n\t\tMeshPhysicalMaterial: 'physical',\r\n\t\tMeshMatcapMaterial: 'matcap',\r\n\t\tLineBasicMaterial: 'basic',\r\n\t\tLineDashedMaterial: 'dashed',\r\n\t\tPointsMaterial: 'points',\r\n\t\tShadowMaterial: 'shadow',\r\n\t\tSpriteMaterial: 'sprite'\r\n\t};\r\n\r\n\tfunction getChannel( value ) {\r\n\r\n\t\t_activeChannels.add( value );\r\n\r\n\t\tif ( value === 0 ) return 'uv';\r\n\r\n\t\treturn `uv${ value }`;\r\n\r\n\t}\r\n\r\n\tfunction getParameters( material, lights, shadows, scene, object ) {\r\n\r\n\t\tconst fog = scene.fog;\r\n\t\tconst geometry = object.geometry;\r\n\t\tconst environment = material.isMeshStandardMaterial ? scene.environment : null;\r\n\r\n\t\tconst envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );\r\n\t\tconst envMapCubeUVHeight = ( !! envMap ) && ( envMap.mapping === CubeUVReflectionMapping ) ? envMap.image.height : null;\r\n\r\n\t\tconst shaderID = shaderIDs[ material.type ];\r\n\r\n\t\t// heuristics to create shader parameters according to lights in the scene\r\n\t\t// (not to blow over maxLights budget)\r\n\r\n\t\tif ( material.precision !== null ) {\r\n\r\n\t\t\tprecision = capabilities.getMaxPrecision( material.precision );\r\n\r\n\t\t\tif ( precision !== material.precision ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t//\r\n\r\n\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\r\n\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\r\n\r\n\t\tlet morphTextureStride = 0;\r\n\r\n\t\tif ( geometry.morphAttributes.position !== undefined ) morphTextureStride = 1;\r\n\t\tif ( geometry.morphAttributes.normal !== undefined ) morphTextureStride = 2;\r\n\t\tif ( geometry.morphAttributes.color !== undefined ) morphTextureStride = 3;\r\n\r\n\t\t//\r\n\r\n\t\tlet vertexShader, fragmentShader;\r\n\t\tlet customVertexShaderID, customFragmentShaderID;\r\n\r\n\t\tif ( shaderID ) {\r\n\r\n\t\t\tconst shader = ShaderLib[ shaderID ];\r\n\r\n\t\t\tvertexShader = shader.vertexShader;\r\n\t\t\tfragmentShader = shader.fragmentShader;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tvertexShader = material.vertexShader;\r\n\t\t\tfragmentShader = material.fragmentShader;\r\n\r\n\t\t\t_customShaders.update( material );\r\n\r\n\t\t\tcustomVertexShaderID = _customShaders.getVertexShaderID( material );\r\n\t\t\tcustomFragmentShaderID = _customShaders.getFragmentShaderID( material );\r\n\r\n\t\t}\r\n\r\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\r\n\r\n\t\tconst IS_INSTANCEDMESH = object.isInstancedMesh === true;\r\n\t\tconst IS_BATCHEDMESH = object.isBatchedMesh === true;\r\n\r\n\t\tconst HAS_MAP = !! material.map;\r\n\t\tconst HAS_MATCAP = !! material.matcap;\r\n\t\tconst HAS_ENVMAP = !! envMap;\r\n\t\tconst HAS_AOMAP = !! material.aoMap;\r\n\t\tconst HAS_LIGHTMAP = !! material.lightMap;\r\n\t\tconst HAS_BUMPMAP = !! material.bumpMap;\r\n\t\tconst HAS_NORMALMAP = !! material.normalMap;\r\n\t\tconst HAS_DISPLACEMENTMAP = !! material.displacementMap;\r\n\t\tconst HAS_EMISSIVEMAP = !! material.emissiveMap;\r\n\r\n\t\tconst HAS_METALNESSMAP = !! material.metalnessMap;\r\n\t\tconst HAS_ROUGHNESSMAP = !! material.roughnessMap;\r\n\r\n\t\tconst HAS_ANISOTROPY = material.anisotropy > 0;\r\n\t\tconst HAS_CLEARCOAT = material.clearcoat > 0;\r\n\t\tconst HAS_DISPERSION = material.dispersion > 0;\r\n\t\tconst HAS_IRIDESCENCE = material.iridescence > 0;\r\n\t\tconst HAS_SHEEN = material.sheen > 0;\r\n\t\tconst HAS_TRANSMISSION = material.transmission > 0;\r\n\r\n\t\tconst HAS_ANISOTROPYMAP = HAS_ANISOTROPY && !! material.anisotropyMap;\r\n\r\n\t\tconst HAS_CLEARCOATMAP = HAS_CLEARCOAT && !! material.clearcoatMap;\r\n\t\tconst HAS_CLEARCOAT_NORMALMAP = HAS_CLEARCOAT && !! material.clearcoatNormalMap;\r\n\t\tconst HAS_CLEARCOAT_ROUGHNESSMAP = HAS_CLEARCOAT && !! material.clearcoatRoughnessMap;\r\n\r\n\t\tconst HAS_IRIDESCENCEMAP = HAS_IRIDESCENCE && !! material.iridescenceMap;\r\n\t\tconst HAS_IRIDESCENCE_THICKNESSMAP = HAS_IRIDESCENCE && !! material.iridescenceThicknessMap;\r\n\r\n\t\tconst HAS_SHEEN_COLORMAP = HAS_SHEEN && !! material.sheenColorMap;\r\n\t\tconst HAS_SHEEN_ROUGHNESSMAP = HAS_SHEEN && !! material.sheenRoughnessMap;\r\n\r\n\t\tconst HAS_SPECULARMAP = !! material.specularMap;\r\n\t\tconst HAS_SPECULAR_COLORMAP = !! material.specularColorMap;\r\n\t\tconst HAS_SPECULAR_INTENSITYMAP = !! material.specularIntensityMap;\r\n\r\n\t\tconst HAS_TRANSMISSIONMAP = HAS_TRANSMISSION && !! material.transmissionMap;\r\n\t\tconst HAS_THICKNESSMAP = HAS_TRANSMISSION && !! material.thicknessMap;\r\n\r\n\t\tconst HAS_GRADIENTMAP = !! material.gradientMap;\r\n\r\n\t\tconst HAS_ALPHAMAP = !! material.alphaMap;\r\n\r\n\t\tconst HAS_ALPHATEST = material.alphaTest > 0;\r\n\r\n\t\tconst HAS_ALPHAHASH = !! material.alphaHash;\r\n\r\n\t\tconst HAS_EXTENSIONS = !! material.extensions;\r\n\r\n\t\tlet toneMapping = NoToneMapping;\r\n\r\n\t\tif ( material.toneMapped ) {\r\n\r\n\t\t\tif ( currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true ) {\r\n\r\n\t\t\t\ttoneMapping = renderer.toneMapping;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconst parameters = {\r\n\r\n\t\t\tshaderID: shaderID,\r\n\t\t\tshaderType: material.type,\r\n\t\t\tshaderName: material.name,\r\n\r\n\t\t\tvertexShader: vertexShader,\r\n\t\t\tfragmentShader: fragmentShader,\r\n\t\t\tdefines: material.defines,\r\n\r\n\t\t\tcustomVertexShaderID: customVertexShaderID,\r\n\t\t\tcustomFragmentShaderID: customFragmentShaderID,\r\n\r\n\t\t\tisRawShaderMaterial: material.isRawShaderMaterial === true,\r\n\t\t\tglslVersion: material.glslVersion,\r\n\r\n\t\t\tprecision: precision,\r\n\r\n\t\t\tbatching: IS_BATCHEDMESH,\r\n\t\t\tbatchingColor: IS_BATCHEDMESH && object._colorsTexture !== null,\r\n\t\t\tinstancing: IS_INSTANCEDMESH,\r\n\t\t\tinstancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,\r\n\t\t\tinstancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,\r\n\r\n\t\t\tsupportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,\r\n\t\t\toutputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace ),\r\n\t\t\talphaToCoverage: !! material.alphaToCoverage,\r\n\r\n\t\t\tmap: HAS_MAP,\r\n\t\t\tmatcap: HAS_MATCAP,\r\n\t\t\tenvMap: HAS_ENVMAP,\r\n\t\t\tenvMapMode: HAS_ENVMAP && envMap.mapping,\r\n\t\t\tenvMapCubeUVHeight: envMapCubeUVHeight,\r\n\t\t\taoMap: HAS_AOMAP,\r\n\t\t\tlightMap: HAS_LIGHTMAP,\r\n\t\t\tbumpMap: HAS_BUMPMAP,\r\n\t\t\tnormalMap: HAS_NORMALMAP,\r\n\t\t\tdisplacementMap: SUPPORTS_VERTEX_TEXTURES && HAS_DISPLACEMENTMAP,\r\n\t\t\temissiveMap: HAS_EMISSIVEMAP,\r\n\r\n\t\t\tnormalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap,\r\n\t\t\tnormalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap,\r\n\r\n\t\t\tmetalnessMap: HAS_METALNESSMAP,\r\n\t\t\troughnessMap: HAS_ROUGHNESSMAP,\r\n\r\n\t\t\tanisotropy: HAS_ANISOTROPY,\r\n\t\t\tanisotropyMap: HAS_ANISOTROPYMAP,\r\n\r\n\t\t\tclearcoat: HAS_CLEARCOAT,\r\n\t\t\tclearcoatMap: HAS_CLEARCOATMAP,\r\n\t\t\tclearcoatNormalMap: HAS_CLEARCOAT_NORMALMAP,\r\n\t\t\tclearcoatRoughnessMap: HAS_CLEARCOAT_ROUGHNESSMAP,\r\n\r\n\t\t\tdispersion: HAS_DISPERSION,\r\n\r\n\t\t\tiridescence: HAS_IRIDESCENCE,\r\n\t\t\tiridescenceMap: HAS_IRIDESCENCEMAP,\r\n\t\t\tiridescenceThicknessMap: HAS_IRIDESCENCE_THICKNESSMAP,\r\n\r\n\t\t\tsheen: HAS_SHEEN,\r\n\t\t\tsheenColorMap: HAS_SHEEN_COLORMAP,\r\n\t\t\tsheenRoughnessMap: HAS_SHEEN_ROUGHNESSMAP,\r\n\r\n\t\t\tspecularMap: HAS_SPECULARMAP,\r\n\t\t\tspecularColorMap: HAS_SPECULAR_COLORMAP,\r\n\t\t\tspecularIntensityMap: HAS_SPECULAR_INTENSITYMAP,\r\n\r\n\t\t\ttransmission: HAS_TRANSMISSION,\r\n\t\t\ttransmissionMap: HAS_TRANSMISSIONMAP,\r\n\t\t\tthicknessMap: HAS_THICKNESSMAP,\r\n\r\n\t\t\tgradientMap: HAS_GRADIENTMAP,\r\n\r\n\t\t\topaque: material.transparent === false && material.blending === NormalBlending && material.alphaToCoverage === false,\r\n\r\n\t\t\talphaMap: HAS_ALPHAMAP,\r\n\t\t\talphaTest: HAS_ALPHATEST,\r\n\t\t\talphaHash: HAS_ALPHAHASH,\r\n\r\n\t\t\tcombine: material.combine,\r\n\r\n\t\t\t//\r\n\r\n\t\t\tmapUv: HAS_MAP && getChannel( material.map.channel ),\r\n\t\t\taoMapUv: HAS_AOMAP && getChannel( material.aoMap.channel ),\r\n\t\t\tlightMapUv: HAS_LIGHTMAP && getChannel( material.lightMap.channel ),\r\n\t\t\tbumpMapUv: HAS_BUMPMAP && getChannel( material.bumpMap.channel ),\r\n\t\t\tnormalMapUv: HAS_NORMALMAP && getChannel( material.normalMap.channel ),\r\n\t\t\tdisplacementMapUv: HAS_DISPLACEMENTMAP && getChannel( material.displacementMap.channel ),\r\n\t\t\temissiveMapUv: HAS_EMISSIVEMAP && getChannel( material.emissiveMap.channel ),\r\n\r\n\t\t\tmetalnessMapUv: HAS_METALNESSMAP && getChannel( material.metalnessMap.channel ),\r\n\t\t\troughnessMapUv: HAS_ROUGHNESSMAP && getChannel( material.roughnessMap.channel ),\r\n\r\n\t\t\tanisotropyMapUv: HAS_ANISOTROPYMAP && getChannel( material.anisotropyMap.channel ),\r\n\r\n\t\t\tclearcoatMapUv: HAS_CLEARCOATMAP && getChannel( material.clearcoatMap.channel ),\r\n\t\t\tclearcoatNormalMapUv: HAS_CLEARCOAT_NORMALMAP && getChannel( material.clearcoatNormalMap.channel ),\r\n\t\t\tclearcoatRoughnessMapUv: HAS_CLEARCOAT_ROUGHNESSMAP && getChannel( material.clearcoatRoughnessMap.channel ),\r\n\r\n\t\t\tiridescenceMapUv: HAS_IRIDESCENCEMAP && getChannel( material.iridescenceMap.channel ),\r\n\t\t\tiridescenceThicknessMapUv: HAS_IRIDESCENCE_THICKNESSMAP && getChannel( material.iridescenceThicknessMap.channel ),\r\n\r\n\t\t\tsheenColorMapUv: HAS_SHEEN_COLORMAP && getChannel( material.sheenColorMap.channel ),\r\n\t\t\tsheenRoughnessMapUv: HAS_SHEEN_ROUGHNESSMAP && getChannel( material.sheenRoughnessMap.channel ),\r\n\r\n\t\t\tspecularMapUv: HAS_SPECULARMAP && getChannel( material.specularMap.channel ),\r\n\t\t\tspecularColorMapUv: HAS_SPECULAR_COLORMAP && getChannel( material.specularColorMap.channel ),\r\n\t\t\tspecularIntensityMapUv: HAS_SPECULAR_INTENSITYMAP && getChannel( material.specularIntensityMap.channel ),\r\n\r\n\t\t\ttransmissionMapUv: HAS_TRANSMISSIONMAP && getChannel( material.transmissionMap.channel ),\r\n\t\t\tthicknessMapUv: HAS_THICKNESSMAP && getChannel( material.thicknessMap.channel ),\r\n\r\n\t\t\talphaMapUv: HAS_ALPHAMAP && getChannel( material.alphaMap.channel ),\r\n\r\n\t\t\t//\r\n\r\n\t\t\tvertexTangents: !! geometry.attributes.tangent && ( HAS_NORMALMAP || HAS_ANISOTROPY ),\r\n\t\t\tvertexColors: material.vertexColors,\r\n\t\t\tvertexAlphas: material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4,\r\n\r\n\t\t\tpointsUvs: object.isPoints === true && !! geometry.attributes.uv && ( HAS_MAP || HAS_ALPHAMAP ),\r\n\r\n\t\t\tfog: !! fog,\r\n\t\t\tuseFog: material.fog === true,\r\n\t\t\tfogExp2: ( !! fog && fog.isFogExp2 ),\r\n\r\n\t\t\tflatShading: material.flatShading === true,\r\n\r\n\t\t\tsizeAttenuation: material.sizeAttenuation === true,\r\n\t\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\r\n\r\n\t\t\tskinning: object.isSkinnedMesh === true,\r\n\r\n\t\t\tmorphTargets: geometry.morphAttributes.position !== undefined,\r\n\t\t\tmorphNormals: geometry.morphAttributes.normal !== undefined,\r\n\t\t\tmorphColors: geometry.morphAttributes.color !== undefined,\r\n\t\t\tmorphTargetsCount: morphTargetsCount,\r\n\t\t\tmorphTextureStride: morphTextureStride,\r\n\r\n\t\t\tnumDirLights: lights.directional.length,\r\n\t\t\tnumPointLights: lights.point.length,\r\n\t\t\tnumSpotLights: lights.spot.length,\r\n\t\t\tnumSpotLightMaps: lights.spotLightMap.length,\r\n\t\t\tnumRectAreaLights: lights.rectArea.length,\r\n\t\t\tnumHemiLights: lights.hemi.length,\r\n\r\n\t\t\tnumDirLightShadows: lights.directionalShadowMap.length,\r\n\t\t\tnumPointLightShadows: lights.pointShadowMap.length,\r\n\t\t\tnumSpotLightShadows: lights.spotShadowMap.length,\r\n\t\t\tnumSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,\r\n\r\n\t\t\tnumLightProbes: lights.numLightProbes,\r\n\r\n\t\t\tnumClippingPlanes: clipping.numPlanes,\r\n\t\t\tnumClipIntersection: clipping.numIntersection,\r\n\r\n\t\t\tdithering: material.dithering,\r\n\r\n\t\t\tshadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,\r\n\t\t\tshadowMapType: renderer.shadowMap.type,\r\n\r\n\t\t\ttoneMapping: toneMapping,\r\n\r\n\t\t\tdecodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( ColorManagement.getTransfer( material.map.colorSpace ) === SRGBTransfer ),\r\n\r\n\t\t\tpremultipliedAlpha: material.premultipliedAlpha,\r\n\r\n\t\t\tdoubleSided: material.side === DoubleSide,\r\n\t\t\tflipSided: material.side === BackSide,\r\n\r\n\t\t\tuseDepthPacking: material.depthPacking >= 0,\r\n\t\t\tdepthPacking: material.depthPacking || 0,\r\n\r\n\t\t\tindex0AttributeName: material.index0AttributeName,\r\n\r\n\t\t\textensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance === true && extensions.has( 'WEBGL_clip_cull_distance' ),\r\n\t\t\textensionMultiDraw: ( HAS_EXTENSIONS && material.extensions.multiDraw === true || IS_BATCHEDMESH ) && extensions.has( 'WEBGL_multi_draw' ),\r\n\r\n\t\t\trendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),\r\n\r\n\t\t\tcustomProgramCacheKey: material.customProgramCacheKey()\r\n\r\n\t\t};\r\n\r\n\t\t// the usage of getChannel() determines the active texture channels for this shader\r\n\r\n\t\tparameters.vertexUv1s = _activeChannels.has( 1 );\r\n\t\tparameters.vertexUv2s = _activeChannels.has( 2 );\r\n\t\tparameters.vertexUv3s = _activeChannels.has( 3 );\r\n\r\n\t\t_activeChannels.clear();\r\n\r\n\t\treturn parameters;\r\n\r\n\t}\r\n\r\n\tfunction getProgramCacheKey( parameters ) {\r\n\r\n\t\tconst array = [];\r\n\r\n\t\tif ( parameters.shaderID ) {\r\n\r\n\t\t\tarray.push( parameters.shaderID );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tarray.push( parameters.customVertexShaderID );\r\n\t\t\tarray.push( parameters.customFragmentShaderID );\r\n\r\n\t\t}\r\n\r\n\t\tif ( parameters.defines !== undefined ) {\r\n\r\n\t\t\tfor ( const name in parameters.defines ) {\r\n\r\n\t\t\t\tarray.push( name );\r\n\t\t\t\tarray.push( parameters.defines[ name ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( parameters.isRawShaderMaterial === false ) {\r\n\r\n\t\t\tgetProgramCacheKeyParameters( array, parameters );\r\n\t\t\tgetProgramCacheKeyBooleans( array, parameters );\r\n\t\t\tarray.push( renderer.outputColorSpace );\r\n\r\n\t\t}\r\n\r\n\t\tarray.push( parameters.customProgramCacheKey );\r\n\r\n\t\treturn array.join();\r\n\r\n\t}\r\n\r\n\tfunction getProgramCacheKeyParameters( array, parameters ) {\r\n\r\n\t\tarray.push( parameters.precision );\r\n\t\tarray.push( parameters.outputColorSpace );\r\n\t\tarray.push( parameters.envMapMode );\r\n\t\tarray.push( parameters.envMapCubeUVHeight );\r\n\t\tarray.push( parameters.mapUv );\r\n\t\tarray.push( parameters.alphaMapUv );\r\n\t\tarray.push( parameters.lightMapUv );\r\n\t\tarray.push( parameters.aoMapUv );\r\n\t\tarray.push( parameters.bumpMapUv );\r\n\t\tarray.push( parameters.normalMapUv );\r\n\t\tarray.push( parameters.displacementMapUv );\r\n\t\tarray.push( parameters.emissiveMapUv );\r\n\t\tarray.push( parameters.metalnessMapUv );\r\n\t\tarray.push( parameters.roughnessMapUv );\r\n\t\tarray.push( parameters.anisotropyMapUv );\r\n\t\tarray.push( parameters.clearcoatMapUv );\r\n\t\tarray.push( parameters.clearcoatNormalMapUv );\r\n\t\tarray.push( parameters.clearcoatRoughnessMapUv );\r\n\t\tarray.push( parameters.iridescenceMapUv );\r\n\t\tarray.push( parameters.iridescenceThicknessMapUv );\r\n\t\tarray.push( parameters.sheenColorMapUv );\r\n\t\tarray.push( parameters.sheenRoughnessMapUv );\r\n\t\tarray.push( parameters.specularMapUv );\r\n\t\tarray.push( parameters.specularColorMapUv );\r\n\t\tarray.push( parameters.specularIntensityMapUv );\r\n\t\tarray.push( parameters.transmissionMapUv );\r\n\t\tarray.push( parameters.thicknessMapUv );\r\n\t\tarray.push( parameters.combine );\r\n\t\tarray.push( parameters.fogExp2 );\r\n\t\tarray.push( parameters.sizeAttenuation );\r\n\t\tarray.push( parameters.morphTargetsCount );\r\n\t\tarray.push( parameters.morphAttributeCount );\r\n\t\tarray.push( parameters.numDirLights );\r\n\t\tarray.push( parameters.numPointLights );\r\n\t\tarray.push( parameters.numSpotLights );\r\n\t\tarray.push( parameters.numSpotLightMaps );\r\n\t\tarray.push( parameters.numHemiLights );\r\n\t\tarray.push( parameters.numRectAreaLights );\r\n\t\tarray.push( parameters.numDirLightShadows );\r\n\t\tarray.push( parameters.numPointLightShadows );\r\n\t\tarray.push( parameters.numSpotLightShadows );\r\n\t\tarray.push( parameters.numSpotLightShadowsWithMaps );\r\n\t\tarray.push( parameters.numLightProbes );\r\n\t\tarray.push( parameters.shadowMapType );\r\n\t\tarray.push( parameters.toneMapping );\r\n\t\tarray.push( parameters.numClippingPlanes );\r\n\t\tarray.push( parameters.numClipIntersection );\r\n\t\tarray.push( parameters.depthPacking );\r\n\r\n\t}\r\n\r\n\tfunction getProgramCacheKeyBooleans( array, parameters ) {\r\n\r\n\t\t_programLayers.disableAll();\r\n\r\n\t\tif ( parameters.supportsVertexTextures )\r\n\t\t\t_programLayers.enable( 0 );\r\n\t\tif ( parameters.instancing )\r\n\t\t\t_programLayers.enable( 1 );\r\n\t\tif ( parameters.instancingColor )\r\n\t\t\t_programLayers.enable( 2 );\r\n\t\tif ( parameters.instancingMorph )\r\n\t\t\t_programLayers.enable( 3 );\r\n\t\tif ( parameters.matcap )\r\n\t\t\t_programLayers.enable( 4 );\r\n\t\tif ( parameters.envMap )\r\n\t\t\t_programLayers.enable( 5 );\r\n\t\tif ( parameters.normalMapObjectSpace )\r\n\t\t\t_programLayers.enable( 6 );\r\n\t\tif ( parameters.normalMapTangentSpace )\r\n\t\t\t_programLayers.enable( 7 );\r\n\t\tif ( parameters.clearcoat )\r\n\t\t\t_programLayers.enable( 8 );\r\n\t\tif ( parameters.iridescence )\r\n\t\t\t_programLayers.enable( 9 );\r\n\t\tif ( parameters.alphaTest )\r\n\t\t\t_programLayers.enable( 10 );\r\n\t\tif ( parameters.vertexColors )\r\n\t\t\t_programLayers.enable( 11 );\r\n\t\tif ( parameters.vertexAlphas )\r\n\t\t\t_programLayers.enable( 12 );\r\n\t\tif ( parameters.vertexUv1s )\r\n\t\t\t_programLayers.enable( 13 );\r\n\t\tif ( parameters.vertexUv2s )\r\n\t\t\t_programLayers.enable( 14 );\r\n\t\tif ( parameters.vertexUv3s )\r\n\t\t\t_programLayers.enable( 15 );\r\n\t\tif ( parameters.vertexTangents )\r\n\t\t\t_programLayers.enable( 16 );\r\n\t\tif ( parameters.anisotropy )\r\n\t\t\t_programLayers.enable( 17 );\r\n\t\tif ( parameters.alphaHash )\r\n\t\t\t_programLayers.enable( 18 );\r\n\t\tif ( parameters.batching )\r\n\t\t\t_programLayers.enable( 19 );\r\n\t\tif ( parameters.dispersion )\r\n\t\t\t_programLayers.enable( 20 );\r\n\t\tif ( parameters.batchingColor )\r\n\t\t\t_programLayers.enable( 21 );\r\n\r\n\t\tarray.push( _programLayers.mask );\r\n\t\t_programLayers.disableAll();\r\n\r\n\t\tif ( parameters.fog )\r\n\t\t\t_programLayers.enable( 0 );\r\n\t\tif ( parameters.useFog )\r\n\t\t\t_programLayers.enable( 1 );\r\n\t\tif ( parameters.flatShading )\r\n\t\t\t_programLayers.enable( 2 );\r\n\t\tif ( parameters.logarithmicDepthBuffer )\r\n\t\t\t_programLayers.enable( 3 );\r\n\t\tif ( parameters.skinning )\r\n\t\t\t_programLayers.enable( 4 );\r\n\t\tif ( parameters.morphTargets )\r\n\t\t\t_programLayers.enable( 5 );\r\n\t\tif ( parameters.morphNormals )\r\n\t\t\t_programLayers.enable( 6 );\r\n\t\tif ( parameters.morphColors )\r\n\t\t\t_programLayers.enable( 7 );\r\n\t\tif ( parameters.premultipliedAlpha )\r\n\t\t\t_programLayers.enable( 8 );\r\n\t\tif ( parameters.shadowMapEnabled )\r\n\t\t\t_programLayers.enable( 9 );\r\n\t\tif ( parameters.doubleSided )\r\n\t\t\t_programLayers.enable( 10 );\r\n\t\tif ( parameters.flipSided )\r\n\t\t\t_programLayers.enable( 11 );\r\n\t\tif ( parameters.useDepthPacking )\r\n\t\t\t_programLayers.enable( 12 );\r\n\t\tif ( parameters.dithering )\r\n\t\t\t_programLayers.enable( 13 );\r\n\t\tif ( parameters.transmission )\r\n\t\t\t_programLayers.enable( 14 );\r\n\t\tif ( parameters.sheen )\r\n\t\t\t_programLayers.enable( 15 );\r\n\t\tif ( parameters.opaque )\r\n\t\t\t_programLayers.enable( 16 );\r\n\t\tif ( parameters.pointsUvs )\r\n\t\t\t_programLayers.enable( 17 );\r\n\t\tif ( parameters.decodeVideoTexture )\r\n\t\t\t_programLayers.enable( 18 );\r\n\t\tif ( parameters.alphaToCoverage )\r\n\t\t\t_programLayers.enable( 19 );\r\n\r\n\t\tarray.push( _programLayers.mask );\r\n\r\n\t}\r\n\r\n\tfunction getUniforms( material ) {\r\n\r\n\t\tconst shaderID = shaderIDs[ material.type ];\r\n\t\tlet uniforms;\r\n\r\n\t\tif ( shaderID ) {\r\n\r\n\t\t\tconst shader = ShaderLib[ shaderID ];\r\n\t\t\tuniforms = UniformsUtils.clone( shader.uniforms );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tuniforms = material.uniforms;\r\n\r\n\t\t}\r\n\r\n\t\treturn uniforms;\r\n\r\n\t}\r\n\r\n\tfunction acquireProgram( parameters, cacheKey ) {\r\n\r\n\t\tlet program;\r\n\r\n\t\t// Check if code has been already compiled\r\n\t\tfor ( let p = 0, pl = programs.length; p < pl; p ++ ) {\r\n\r\n\t\t\tconst preexistingProgram = programs[ p ];\r\n\r\n\t\t\tif ( preexistingProgram.cacheKey === cacheKey ) {\r\n\r\n\t\t\t\tprogram = preexistingProgram;\r\n\t\t\t\t++ program.usedTimes;\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( program === undefined ) {\r\n\r\n\t\t\tprogram = new WebGLProgram( renderer, cacheKey, parameters, bindingStates );\r\n\t\t\tprograms.push( program );\r\n\r\n\t\t}\r\n\r\n\t\treturn program;\r\n\r\n\t}\r\n\r\n\tfunction releaseProgram( program ) {\r\n\r\n\t\tif ( -- program.usedTimes === 0 ) {\r\n\r\n\t\t\t// Remove from unordered set\r\n\t\t\tconst i = programs.indexOf( program );\r\n\t\t\tprograms[ i ] = programs[ programs.length - 1 ];\r\n\t\t\tprograms.pop();\r\n\r\n\t\t\t// Free WebGL resources\r\n\t\t\tprogram.destroy();\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction releaseShaderCache( material ) {\r\n\r\n\t\t_customShaders.remove( material );\r\n\r\n\t}\r\n\r\n\tfunction dispose() {\r\n\r\n\t\t_customShaders.dispose();\r\n\r\n\t}\r\n\r\n\treturn {\r\n\t\tgetParameters: getParameters,\r\n\t\tgetProgramCacheKey: getProgramCacheKey,\r\n\t\tgetUniforms: getUniforms,\r\n\t\tacquireProgram: acquireProgram,\r\n\t\treleaseProgram: releaseProgram,\r\n\t\treleaseShaderCache: releaseShaderCache,\r\n\t\t// Exposed for resource monitoring & error feedback via renderer.info:\r\n\t\tprograms: programs,\r\n\t\tdispose: dispose\r\n\t};\r\n\r\n}\r\n\r\nfunction WebGLProperties() {\r\n\r\n\tlet properties = new WeakMap();\r\n\r\n\tfunction has( object ) {\r\n\r\n\t\treturn properties.has( object );\r\n\r\n\t}\r\n\r\n\tfunction get( object ) {\r\n\r\n\t\tlet map = properties.get( object );\r\n\r\n\t\tif ( map === undefined ) {\r\n\r\n\t\t\tmap = {};\r\n\t\t\tproperties.set( object, map );\r\n\r\n\t\t}\r\n\r\n\t\treturn map;\r\n\r\n\t}\r\n\r\n\tfunction remove( object ) {\r\n\r\n\t\tproperties.delete( object );\r\n\r\n\t}\r\n\r\n\tfunction update( object, key, value ) {\r\n\r\n\t\tproperties.get( object )[ key ] = value;\r\n\r\n\t}\r\n\r\n\tfunction dispose() {\r\n\r\n\t\tproperties = new WeakMap();\r\n\r\n\t}\r\n\r\n\treturn {\r\n\t\thas: has,\r\n\t\tget: get,\r\n\t\tremove: remove,\r\n\t\tupdate: update,\r\n\t\tdispose: dispose\r\n\t};\r\n\r\n}\r\n\r\nfunction painterSortStable( a, b ) {\r\n\r\n\tif ( a.groupOrder !== b.groupOrder ) {\r\n\r\n\t\treturn a.groupOrder - b.groupOrder;\r\n\r\n\t} else if ( a.renderOrder !== b.renderOrder ) {\r\n\r\n\t\treturn a.renderOrder - b.renderOrder;\r\n\r\n\t} else if ( a.material.id !== b.material.id ) {\r\n\r\n\t\treturn a.material.id - b.material.id;\r\n\r\n\t} else if ( a.z !== b.z ) {\r\n\r\n\t\treturn a.z - b.z;\r\n\r\n\t} else {\r\n\r\n\t\treturn a.id - b.id;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction reversePainterSortStable( a, b ) {\r\n\r\n\tif ( a.groupOrder !== b.groupOrder ) {\r\n\r\n\t\treturn a.groupOrder - b.groupOrder;\r\n\r\n\t} else if ( a.renderOrder !== b.renderOrder ) {\r\n\r\n\t\treturn a.renderOrder - b.renderOrder;\r\n\r\n\t} else if ( a.z !== b.z ) {\r\n\r\n\t\treturn b.z - a.z;\r\n\r\n\t} else {\r\n\r\n\t\treturn a.id - b.id;\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nfunction WebGLRenderList() {\r\n\r\n\tconst renderItems = [];\r\n\tlet renderItemsIndex = 0;\r\n\r\n\tconst opaque = [];\r\n\tconst transmissive = [];\r\n\tconst transparent = [];\r\n\r\n\tfunction init() {\r\n\r\n\t\trenderItemsIndex = 0;\r\n\r\n\t\topaque.length = 0;\r\n\t\ttransmissive.length = 0;\r\n\t\ttransparent.length = 0;\r\n\r\n\t}\r\n\r\n\tfunction getNextRenderItem( object, geometry, material, groupOrder, z, group ) {\r\n\r\n\t\tlet renderItem = renderItems[ renderItemsIndex ];\r\n\r\n\t\tif ( renderItem === undefined ) {\r\n\r\n\t\t\trenderItem = {\r\n\t\t\t\tid: object.id,\r\n\t\t\t\tobject: object,\r\n\t\t\t\tgeometry: geometry,\r\n\t\t\t\tmaterial: material,\r\n\t\t\t\tgroupOrder: groupOrder,\r\n\t\t\t\trenderOrder: object.renderOrder,\r\n\t\t\t\tz: z,\r\n\t\t\t\tgroup: group\r\n\t\t\t};\r\n\r\n\t\t\trenderItems[ renderItemsIndex ] = renderItem;\r\n\r\n\t\t} else {\r\n\r\n\t\t\trenderItem.id = object.id;\r\n\t\t\trenderItem.object = object;\r\n\t\t\trenderItem.geometry = geometry;\r\n\t\t\trenderItem.material = material;\r\n\t\t\trenderItem.groupOrder = groupOrder;\r\n\t\t\trenderItem.renderOrder = object.renderOrder;\r\n\t\t\trenderItem.z = z;\r\n\t\t\trenderItem.group = group;\r\n\r\n\t\t}\r\n\r\n\t\trenderItemsIndex ++;\r\n\r\n\t\treturn renderItem;\r\n\r\n\t}\r\n\r\n\tfunction push( object, geometry, material, groupOrder, z, group ) {\r\n\r\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\r\n\r\n\t\tif ( material.transmission > 0.0 ) {\r\n\r\n\t\t\ttransmissive.push( renderItem );\r\n\r\n\t\t} else if ( material.transparent === true ) {\r\n\r\n\t\t\ttransparent.push( renderItem );\r\n\r\n\t\t} else {\r\n\r\n\t\t\topaque.push( renderItem );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction unshift( object, geometry, material, groupOrder, z, group ) {\r\n\r\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\r\n\r\n\t\tif ( material.transmission > 0.0 ) {\r\n\r\n\t\t\ttransmissive.unshift( renderItem );\r\n\r\n\t\t} else if ( material.transparent === true ) {\r\n\r\n\t\t\ttransparent.unshift( renderItem );\r\n\r\n\t\t} else {\r\n\r\n\t\t\topaque.unshift( renderItem );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction sort( customOpaqueSort, customTransparentSort ) {\r\n\r\n\t\tif ( opaque.length > 1 ) opaque.sort( customOpaqueSort || painterSortStable );\r\n\t\tif ( transmissive.length > 1 ) transmissive.sort( customTransparentSort || reversePainterSortStable );\r\n\t\tif ( transparent.length > 1 ) transparent.sort( customTransparentSort || reversePainterSortStable );\r\n\r\n\t}\r\n\r\n\tfunction finish() {\r\n\r\n\t\t// Clear references from inactive renderItems in the list\r\n\r\n\t\tfor ( let i = renderItemsIndex, il = renderItems.length; i < il; i ++ ) {\r\n\r\n\t\t\tconst renderItem = renderItems[ i ];\r\n\r\n\t\t\tif ( renderItem.id === null ) break;\r\n\r\n\t\t\trenderItem.id = null;\r\n\t\t\trenderItem.object = null;\r\n\t\t\trenderItem.geometry = null;\r\n\t\t\trenderItem.material = null;\r\n\t\t\trenderItem.group = null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn {\r\n\r\n\t\topaque: opaque,\r\n\t\ttransmissive: transmissive,\r\n\t\ttransparent: transparent,\r\n\r\n\t\tinit: init,\r\n\t\tpush: push,\r\n\t\tunshift: unshift,\r\n\t\tfinish: finish,\r\n\r\n\t\tsort: sort\r\n\t};\r\n\r\n}\r\n\r\nfunction WebGLRenderLists() {\r\n\r\n\tlet lists = new WeakMap();\r\n\r\n\tfunction get( scene, renderCallDepth ) {\r\n\r\n\t\tconst listArray = lists.get( scene );\r\n\t\tlet list;\r\n\r\n\t\tif ( listArray === undefined ) {\r\n\r\n\t\t\tlist = new WebGLRenderList();\r\n\t\t\tlists.set( scene, [ list ] );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tif ( renderCallDepth >= listArray.length ) {\r\n\r\n\t\t\t\tlist = new WebGLRenderList();\r\n\t\t\t\tlistArray.push( list );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlist = listArray[ renderCallDepth ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn list;\r\n\r\n\t}\r\n\r\n\tfunction dispose() {\r\n\r\n\t\tlists = new WeakMap();\r\n\r\n\t}\r\n\r\n\treturn {\r\n\t\tget: get,\r\n\t\tdispose: dispose\r\n\t};\r\n\r\n}\r\n\r\nfunction UniformsCache() {\r\n\r\n\tconst lights = {};\r\n\r\n\treturn {\r\n\r\n\t\tget: function ( light ) {\r\n\r\n\t\t\tif ( lights[ light.id ] !== undefined ) {\r\n\r\n\t\t\t\treturn lights[ light.id ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlet uniforms;\r\n\r\n\t\t\tswitch ( light.type ) {\r\n\r\n\t\t\t\tcase 'DirectionalLight':\r\n\t\t\t\t\tuniforms = {\r\n\t\t\t\t\t\tdirection: new Vector3(),\r\n\t\t\t\t\t\tcolor: new Color()\r\n\t\t\t\t\t};\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'SpotLight':\r\n\t\t\t\t\tuniforms = {\r\n\t\t\t\t\t\tposition: new Vector3(),\r\n\t\t\t\t\t\tdirection: new Vector3(),\r\n\t\t\t\t\t\tcolor: new Color(),\r\n\t\t\t\t\t\tdistance: 0,\r\n\t\t\t\t\t\tconeCos: 0,\r\n\t\t\t\t\t\tpenumbraCos: 0,\r\n\t\t\t\t\t\tdecay: 0\r\n\t\t\t\t\t};\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'PointLight':\r\n\t\t\t\t\tuniforms = {\r\n\t\t\t\t\t\tposition: new Vector3(),\r\n\t\t\t\t\t\tcolor: new Color(),\r\n\t\t\t\t\t\tdistance: 0,\r\n\t\t\t\t\t\tdecay: 0\r\n\t\t\t\t\t};\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'HemisphereLight':\r\n\t\t\t\t\tuniforms = {\r\n\t\t\t\t\t\tdirection: new Vector3(),\r\n\t\t\t\t\t\tskyColor: new Color(),\r\n\t\t\t\t\t\tgroundColor: new Color()\r\n\t\t\t\t\t};\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'RectAreaLight':\r\n\t\t\t\t\tuniforms = {\r\n\t\t\t\t\t\tcolor: new Color(),\r\n\t\t\t\t\t\tposition: new Vector3(),\r\n\t\t\t\t\t\thalfWidth: new Vector3(),\r\n\t\t\t\t\t\thalfHeight: new Vector3()\r\n\t\t\t\t\t};\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlights[ light.id ] = uniforms;\r\n\r\n\t\t\treturn uniforms;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n}\r\n\r\nfunction ShadowUniformsCache() {\r\n\r\n\tconst lights = {};\r\n\r\n\treturn {\r\n\r\n\t\tget: function ( light ) {\r\n\r\n\t\t\tif ( lights[ light.id ] !== undefined ) {\r\n\r\n\t\t\t\treturn lights[ light.id ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlet uniforms;\r\n\r\n\t\t\tswitch ( light.type ) {\r\n\r\n\t\t\t\tcase 'DirectionalLight':\r\n\t\t\t\t\tuniforms = {\r\n\t\t\t\t\t\tshadowIntensity: 1,\r\n\t\t\t\t\t\tshadowBias: 0,\r\n\t\t\t\t\t\tshadowNormalBias: 0,\r\n\t\t\t\t\t\tshadowRadius: 1,\r\n\t\t\t\t\t\tshadowMapSize: new Vector2()\r\n\t\t\t\t\t};\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'SpotLight':\r\n\t\t\t\t\tuniforms = {\r\n\t\t\t\t\t\tshadowIntensity: 1,\r\n\t\t\t\t\t\tshadowBias: 0,\r\n\t\t\t\t\t\tshadowNormalBias: 0,\r\n\t\t\t\t\t\tshadowRadius: 1,\r\n\t\t\t\t\t\tshadowMapSize: new Vector2()\r\n\t\t\t\t\t};\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'PointLight':\r\n\t\t\t\t\tuniforms = {\r\n\t\t\t\t\t\tshadowIntensity: 1,\r\n\t\t\t\t\t\tshadowBias: 0,\r\n\t\t\t\t\t\tshadowNormalBias: 0,\r\n\t\t\t\t\t\tshadowRadius: 1,\r\n\t\t\t\t\t\tshadowMapSize: new Vector2(),\r\n\t\t\t\t\t\tshadowCameraNear: 1,\r\n\t\t\t\t\t\tshadowCameraFar: 1000\r\n\t\t\t\t\t};\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t// TODO (abelnation): set RectAreaLight shadow uniforms\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlights[ light.id ] = uniforms;\r\n\r\n\t\t\treturn uniforms;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n}\r\n\r\n\r\n\r\nlet nextVersion = 0;\r\n\r\nfunction shadowCastingAndTexturingLightsFirst( lightA, lightB ) {\r\n\r\n\treturn ( lightB.castShadow ? 2 : 0 ) - ( lightA.castShadow ? 2 : 0 ) + ( lightB.map ? 1 : 0 ) - ( lightA.map ? 1 : 0 );\r\n\r\n}\r\n\r\nfunction WebGLLights( extensions ) {\r\n\r\n\tconst cache = new UniformsCache();\r\n\r\n\tconst shadowCache = ShadowUniformsCache();\r\n\r\n\tconst state = {\r\n\r\n\t\tversion: 0,\r\n\r\n\t\thash: {\r\n\t\t\tdirectionalLength: - 1,\r\n\t\t\tpointLength: - 1,\r\n\t\t\tspotLength: - 1,\r\n\t\t\trectAreaLength: - 1,\r\n\t\t\themiLength: - 1,\r\n\r\n\t\t\tnumDirectionalShadows: - 1,\r\n\t\t\tnumPointShadows: - 1,\r\n\t\t\tnumSpotShadows: - 1,\r\n\t\t\tnumSpotMaps: - 1,\r\n\r\n\t\t\tnumLightProbes: - 1\r\n\t\t},\r\n\r\n\t\tambient: [ 0, 0, 0 ],\r\n\t\tprobe: [],\r\n\t\tdirectional: [],\r\n\t\tdirectionalShadow: [],\r\n\t\tdirectionalShadowMap: [],\r\n\t\tdirectionalShadowMatrix: [],\r\n\t\tspot: [],\r\n\t\tspotLightMap: [],\r\n\t\tspotShadow: [],\r\n\t\tspotShadowMap: [],\r\n\t\tspotLightMatrix: [],\r\n\t\trectArea: [],\r\n\t\trectAreaLTC1: null,\r\n\t\trectAreaLTC2: null,\r\n\t\tpoint: [],\r\n\t\tpointShadow: [],\r\n\t\tpointShadowMap: [],\r\n\t\tpointShadowMatrix: [],\r\n\t\themi: [],\r\n\t\tnumSpotLightShadowsWithMaps: 0,\r\n\t\tnumLightProbes: 0\r\n\r\n\t};\r\n\r\n\tfor ( let i = 0; i < 9; i ++ ) state.probe.push( new Vector3() );\r\n\r\n\tconst vector3 = new Vector3();\r\n\tconst matrix4 = new Matrix4();\r\n\tconst matrix42 = new Matrix4();\r\n\r\n\tfunction setup( lights ) {\r\n\r\n\t\tlet r = 0, g = 0, b = 0;\r\n\r\n\t\tfor ( let i = 0; i < 9; i ++ ) state.probe[ i ].set( 0, 0, 0 );\r\n\r\n\t\tlet directionalLength = 0;\r\n\t\tlet pointLength = 0;\r\n\t\tlet spotLength = 0;\r\n\t\tlet rectAreaLength = 0;\r\n\t\tlet hemiLength = 0;\r\n\r\n\t\tlet numDirectionalShadows = 0;\r\n\t\tlet numPointShadows = 0;\r\n\t\tlet numSpotShadows = 0;\r\n\t\tlet numSpotMaps = 0;\r\n\t\tlet numSpotShadowsWithMaps = 0;\r\n\r\n\t\tlet numLightProbes = 0;\r\n\r\n\t\t// ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]\r\n\t\tlights.sort( shadowCastingAndTexturingLightsFirst );\r\n\r\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst light = lights[ i ];\r\n\r\n\t\t\tconst color = light.color;\r\n\t\t\tconst intensity = light.intensity;\r\n\t\t\tconst distance = light.distance;\r\n\r\n\t\t\tconst shadowMap = ( light.shadow && light.shadow.map ) ? light.shadow.map.texture : null;\r\n\r\n\t\t\tif ( light.isAmbientLight ) {\r\n\r\n\t\t\t\tr += color.r * intensity;\r\n\t\t\t\tg += color.g * intensity;\r\n\t\t\t\tb += color.b * intensity;\r\n\r\n\t\t\t} else if ( light.isLightProbe ) {\r\n\r\n\t\t\t\tfor ( let j = 0; j < 9; j ++ ) {\r\n\r\n\t\t\t\t\tstate.probe[ j ].addScaledVector( light.sh.coefficients[ j ], intensity );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tnumLightProbes ++;\r\n\r\n\t\t\t} else if ( light.isDirectionalLight ) {\r\n\r\n\t\t\t\tconst uniforms = cache.get( light );\r\n\r\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity );\r\n\r\n\t\t\t\tif ( light.castShadow ) {\r\n\r\n\t\t\t\t\tconst shadow = light.shadow;\r\n\r\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\r\n\r\n\t\t\t\t\tshadowUniforms.shadowIntensity = shadow.intensity;\r\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\r\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\r\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\r\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\r\n\r\n\t\t\t\t\tstate.directionalShadow[ directionalLength ] = shadowUniforms;\r\n\t\t\t\t\tstate.directionalShadowMap[ directionalLength ] = shadowMap;\r\n\t\t\t\t\tstate.directionalShadowMatrix[ directionalLength ] = light.shadow.matrix;\r\n\r\n\t\t\t\t\tnumDirectionalShadows ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tstate.directional[ directionalLength ] = uniforms;\r\n\r\n\t\t\t\tdirectionalLength ++;\r\n\r\n\t\t\t} else if ( light.isSpotLight ) {\r\n\r\n\t\t\t\tconst uniforms = cache.get( light );\r\n\r\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\r\n\r\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity );\r\n\t\t\t\tuniforms.distance = distance;\r\n\r\n\t\t\t\tuniforms.coneCos = Math.cos( light.angle );\r\n\t\t\t\tuniforms.penumbraCos = Math.cos( light.angle * ( 1 - light.penumbra ) );\r\n\t\t\t\tuniforms.decay = light.decay;\r\n\r\n\t\t\t\tstate.spot[ spotLength ] = uniforms;\r\n\r\n\t\t\t\tconst shadow = light.shadow;\r\n\r\n\t\t\t\tif ( light.map ) {\r\n\r\n\t\t\t\t\tstate.spotLightMap[ numSpotMaps ] = light.map;\r\n\t\t\t\t\tnumSpotMaps ++;\r\n\r\n\t\t\t\t\t// make sure the lightMatrix is up to date\r\n\t\t\t\t\t// TODO : do it if required only\r\n\t\t\t\t\tshadow.updateMatrices( light );\r\n\r\n\t\t\t\t\tif ( light.castShadow ) numSpotShadowsWithMaps ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tstate.spotLightMatrix[ spotLength ] = shadow.matrix;\r\n\r\n\t\t\t\tif ( light.castShadow ) {\r\n\r\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\r\n\r\n\t\t\t\t\tshadowUniforms.shadowIntensity = shadow.intensity;\r\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\r\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\r\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\r\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\r\n\r\n\t\t\t\t\tstate.spotShadow[ spotLength ] = shadowUniforms;\r\n\t\t\t\t\tstate.spotShadowMap[ spotLength ] = shadowMap;\r\n\r\n\t\t\t\t\tnumSpotShadows ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tspotLength ++;\r\n\r\n\t\t\t} else if ( light.isRectAreaLight ) {\r\n\r\n\t\t\t\tconst uniforms = cache.get( light );\r\n\r\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity );\r\n\r\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\r\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\r\n\r\n\t\t\t\tstate.rectArea[ rectAreaLength ] = uniforms;\r\n\r\n\t\t\t\trectAreaLength ++;\r\n\r\n\t\t\t} else if ( light.isPointLight ) {\r\n\r\n\t\t\t\tconst uniforms = cache.get( light );\r\n\r\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity );\r\n\t\t\t\tuniforms.distance = light.distance;\r\n\t\t\t\tuniforms.decay = light.decay;\r\n\r\n\t\t\t\tif ( light.castShadow ) {\r\n\r\n\t\t\t\t\tconst shadow = light.shadow;\r\n\r\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\r\n\r\n\t\t\t\t\tshadowUniforms.shadowIntensity = shadow.intensity;\r\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\r\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\r\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\r\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\r\n\t\t\t\t\tshadowUniforms.shadowCameraNear = shadow.camera.near;\r\n\t\t\t\t\tshadowUniforms.shadowCameraFar = shadow.camera.far;\r\n\r\n\t\t\t\t\tstate.pointShadow[ pointLength ] = shadowUniforms;\r\n\t\t\t\t\tstate.pointShadowMap[ pointLength ] = shadowMap;\r\n\t\t\t\t\tstate.pointShadowMatrix[ pointLength ] = light.shadow.matrix;\r\n\r\n\t\t\t\t\tnumPointShadows ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tstate.point[ pointLength ] = uniforms;\r\n\r\n\t\t\t\tpointLength ++;\r\n\r\n\t\t\t} else if ( light.isHemisphereLight ) {\r\n\r\n\t\t\t\tconst uniforms = cache.get( light );\r\n\r\n\t\t\t\tuniforms.skyColor.copy( light.color ).multiplyScalar( intensity );\r\n\t\t\t\tuniforms.groundColor.copy( light.groundColor ).multiplyScalar( intensity );\r\n\r\n\t\t\t\tstate.hemi[ hemiLength ] = uniforms;\r\n\r\n\t\t\t\themiLength ++;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( rectAreaLength > 0 ) {\r\n\r\n\t\t\tif ( extensions.has( 'OES_texture_float_linear' ) === true ) {\r\n\r\n\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;\r\n\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_HALF_1;\r\n\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_HALF_2;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tstate.ambient[ 0 ] = r;\r\n\t\tstate.ambient[ 1 ] = g;\r\n\t\tstate.ambient[ 2 ] = b;\r\n\r\n\t\tconst hash = state.hash;\r\n\r\n\t\tif ( hash.directionalLength !== directionalLength ||\r\n\t\t\thash.pointLength !== pointLength ||\r\n\t\t\thash.spotLength !== spotLength ||\r\n\t\t\thash.rectAreaLength !== rectAreaLength ||\r\n\t\t\thash.hemiLength !== hemiLength ||\r\n\t\t\thash.numDirectionalShadows !== numDirectionalShadows ||\r\n\t\t\thash.numPointShadows !== numPointShadows ||\r\n\t\t\thash.numSpotShadows !== numSpotShadows ||\r\n\t\t\thash.numSpotMaps !== numSpotMaps ||\r\n\t\t\thash.numLightProbes !== numLightProbes ) {\r\n\r\n\t\t\tstate.directional.length = directionalLength;\r\n\t\t\tstate.spot.length = spotLength;\r\n\t\t\tstate.rectArea.length = rectAreaLength;\r\n\t\t\tstate.point.length = pointLength;\r\n\t\t\tstate.hemi.length = hemiLength;\r\n\r\n\t\t\tstate.directionalShadow.length = numDirectionalShadows;\r\n\t\t\tstate.directionalShadowMap.length = numDirectionalShadows;\r\n\t\t\tstate.pointShadow.length = numPointShadows;\r\n\t\t\tstate.pointShadowMap.length = numPointShadows;\r\n\t\t\tstate.spotShadow.length = numSpotShadows;\r\n\t\t\tstate.spotShadowMap.length = numSpotShadows;\r\n\t\t\tstate.directionalShadowMatrix.length = numDirectionalShadows;\r\n\t\t\tstate.pointShadowMatrix.length = numPointShadows;\r\n\t\t\tstate.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;\r\n\t\t\tstate.spotLightMap.length = numSpotMaps;\r\n\t\t\tstate.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;\r\n\t\t\tstate.numLightProbes = numLightProbes;\r\n\r\n\t\t\thash.directionalLength = directionalLength;\r\n\t\t\thash.pointLength = pointLength;\r\n\t\t\thash.spotLength = spotLength;\r\n\t\t\thash.rectAreaLength = rectAreaLength;\r\n\t\t\thash.hemiLength = hemiLength;\r\n\r\n\t\t\thash.numDirectionalShadows = numDirectionalShadows;\r\n\t\t\thash.numPointShadows = numPointShadows;\r\n\t\t\thash.numSpotShadows = numSpotShadows;\r\n\t\t\thash.numSpotMaps = numSpotMaps;\r\n\r\n\t\t\thash.numLightProbes = numLightProbes;\r\n\r\n\t\t\tstate.version = nextVersion ++;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction setupView( lights, camera ) {\r\n\r\n\t\tlet directionalLength = 0;\r\n\t\tlet pointLength = 0;\r\n\t\tlet spotLength = 0;\r\n\t\tlet rectAreaLength = 0;\r\n\t\tlet hemiLength = 0;\r\n\r\n\t\tconst viewMatrix = camera.matrixWorldInverse;\r\n\r\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst light = lights[ i ];\r\n\r\n\t\t\tif ( light.isDirectionalLight ) {\r\n\r\n\t\t\t\tconst uniforms = state.directional[ directionalLength ];\r\n\r\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\r\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\r\n\t\t\t\tuniforms.direction.sub( vector3 );\r\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\r\n\r\n\t\t\t\tdirectionalLength ++;\r\n\r\n\t\t\t} else if ( light.isSpotLight ) {\r\n\r\n\t\t\t\tconst uniforms = state.spot[ spotLength ];\r\n\r\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\r\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\r\n\r\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\r\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\r\n\t\t\t\tuniforms.direction.sub( vector3 );\r\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\r\n\r\n\t\t\t\tspotLength ++;\r\n\r\n\t\t\t} else if ( light.isRectAreaLight ) {\r\n\r\n\t\t\t\tconst uniforms = state.rectArea[ rectAreaLength ];\r\n\r\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\r\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\r\n\r\n\t\t\t\t// extract local rotation of light to derive width/height half vectors\r\n\t\t\t\tmatrix42.identity();\r\n\t\t\t\tmatrix4.copy( light.matrixWorld );\r\n\t\t\t\tmatrix4.premultiply( viewMatrix );\r\n\t\t\t\tmatrix42.extractRotation( matrix4 );\r\n\r\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\r\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\r\n\r\n\t\t\t\tuniforms.halfWidth.applyMatrix4( matrix42 );\r\n\t\t\t\tuniforms.halfHeight.applyMatrix4( matrix42 );\r\n\r\n\t\t\t\trectAreaLength ++;\r\n\r\n\t\t\t} else if ( light.isPointLight ) {\r\n\r\n\t\t\t\tconst uniforms = state.point[ pointLength ];\r\n\r\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\r\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\r\n\r\n\t\t\t\tpointLength ++;\r\n\r\n\t\t\t} else if ( light.isHemisphereLight ) {\r\n\r\n\t\t\t\tconst uniforms = state.hemi[ hemiLength ];\r\n\r\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\r\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\r\n\r\n\t\t\t\themiLength ++;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn {\r\n\t\tsetup: setup,\r\n\t\tsetupView: setupView,\r\n\t\tstate: state\r\n\t};\r\n\r\n}\r\n\r\nfunction WebGLRenderState( extensions ) {\r\n\r\n\tconst lights = new WebGLLights( extensions );\r\n\r\n\tconst lightsArray = [];\r\n\tconst shadowsArray = [];\r\n\r\n\tfunction init( camera ) {\r\n\r\n\t\tstate.camera = camera;\r\n\r\n\t\tlightsArray.length = 0;\r\n\t\tshadowsArray.length = 0;\r\n\r\n\t}\r\n\r\n\tfunction pushLight( light ) {\r\n\r\n\t\tlightsArray.push( light );\r\n\r\n\t}\r\n\r\n\tfunction pushShadow( shadowLight ) {\r\n\r\n\t\tshadowsArray.push( shadowLight );\r\n\r\n\t}\r\n\r\n\tfunction setupLights() {\r\n\r\n\t\tlights.setup( lightsArray );\r\n\r\n\t}\r\n\r\n\tfunction setupLightsView( camera ) {\r\n\r\n\t\tlights.setupView( lightsArray, camera );\r\n\r\n\t}\r\n\r\n\tconst state = {\r\n\t\tlightsArray: lightsArray,\r\n\t\tshadowsArray: shadowsArray,\r\n\r\n\t\tcamera: null,\r\n\r\n\t\tlights: lights,\r\n\r\n\t\ttransmissionRenderTarget: {}\r\n\t};\r\n\r\n\treturn {\r\n\t\tinit: init,\r\n\t\tstate: state,\r\n\t\tsetupLights: setupLights,\r\n\t\tsetupLightsView: setupLightsView,\r\n\r\n\t\tpushLight: pushLight,\r\n\t\tpushShadow: pushShadow\r\n\t};\r\n\r\n}\r\n\r\nfunction WebGLRenderStates( extensions ) {\r\n\r\n\tlet renderStates = new WeakMap();\r\n\r\n\tfunction get( scene, renderCallDepth = 0 ) {\r\n\r\n\t\tconst renderStateArray = renderStates.get( scene );\r\n\t\tlet renderState;\r\n\r\n\t\tif ( renderStateArray === undefined ) {\r\n\r\n\t\t\trenderState = new WebGLRenderState( extensions );\r\n\t\t\trenderStates.set( scene, [ renderState ] );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tif ( renderCallDepth >= renderStateArray.length ) {\r\n\r\n\t\t\t\trenderState = new WebGLRenderState( extensions );\r\n\t\t\t\trenderStateArray.push( renderState );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\trenderState = renderStateArray[ renderCallDepth ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn renderState;\r\n\r\n\t}\r\n\r\n\tfunction dispose() {\r\n\r\n\t\trenderStates = new WeakMap();\r\n\r\n\t}\r\n\r\n\treturn {\r\n\t\tget: get,\r\n\t\tdispose: dispose\r\n\t};\r\n\r\n}\r\n\r\nclass MeshDepthMaterial extends Material {\r\n\r\n\tconstructor( parameters ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isMeshDepthMaterial = true;\r\n\r\n\t\tthis.type = 'MeshDepthMaterial';\r\n\r\n\t\tthis.depthPacking = BasicDepthPacking;\r\n\r\n\t\tthis.map = null;\r\n\r\n\t\tthis.alphaMap = null;\r\n\r\n\t\tthis.displacementMap = null;\r\n\t\tthis.displacementScale = 1;\r\n\t\tthis.displacementBias = 0;\r\n\r\n\t\tthis.wireframe = false;\r\n\t\tthis.wireframeLinewidth = 1;\r\n\r\n\t\tthis.setValues( parameters );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.depthPacking = source.depthPacking;\r\n\r\n\t\tthis.map = source.map;\r\n\r\n\t\tthis.alphaMap = source.alphaMap;\r\n\r\n\t\tthis.displacementMap = source.displacementMap;\r\n\t\tthis.displacementScale = source.displacementScale;\r\n\t\tthis.displacementBias = source.displacementBias;\r\n\r\n\t\tthis.wireframe = source.wireframe;\r\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshDistanceMaterial extends Material {\r\n\r\n\tconstructor( parameters ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isMeshDistanceMaterial = true;\r\n\r\n\t\tthis.type = 'MeshDistanceMaterial';\r\n\r\n\t\tthis.map = null;\r\n\r\n\t\tthis.alphaMap = null;\r\n\r\n\t\tthis.displacementMap = null;\r\n\t\tthis.displacementScale = 1;\r\n\t\tthis.displacementBias = 0;\r\n\r\n\t\tthis.setValues( parameters );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.map = source.map;\r\n\r\n\t\tthis.alphaMap = source.alphaMap;\r\n\r\n\t\tthis.displacementMap = source.displacementMap;\r\n\t\tthis.displacementScale = source.displacementScale;\r\n\t\tthis.displacementBias = source.displacementBias;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst vertex = \"void main() {\\n\\tgl_Position = vec4( position, 1.0 );\\n}\";\r\n\r\nconst fragment = \"uniform sampler2D shadow_pass;\\nuniform vec2 resolution;\\nuniform float radius;\\n#include \\nvoid main() {\\n\\tconst float samples = float( VSM_SAMPLES );\\n\\tfloat mean = 0.0;\\n\\tfloat squared_mean = 0.0;\\n\\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\\n\\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\\n\\tfor ( float i = 0.0; i < samples; i ++ ) {\\n\\t\\tfloat uvOffset = uvStart + i * uvStride;\\n\\t\\t#ifdef HORIZONTAL_PASS\\n\\t\\t\\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\\n\\t\\t\\tmean += distribution.x;\\n\\t\\t\\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\\n\\t\\t#else\\n\\t\\t\\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\\n\\t\\t\\tmean += depth;\\n\\t\\t\\tsquared_mean += depth * depth;\\n\\t\\t#endif\\n\\t}\\n\\tmean = mean / samples;\\n\\tsquared_mean = squared_mean / samples;\\n\\tfloat std_dev = sqrt( squared_mean - mean * mean );\\n\\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\\n}\";\r\n\r\nfunction WebGLShadowMap( renderer, objects, capabilities ) {\r\n\r\n\tlet _frustum = new Frustum();\r\n\r\n\tconst _shadowMapSize = new Vector2(),\r\n\t\t_viewportSize = new Vector2(),\r\n\r\n\t\t_viewport = new Vector4(),\r\n\r\n\t\t_depthMaterial = new MeshDepthMaterial( { depthPacking: RGBADepthPacking } ),\r\n\t\t_distanceMaterial = new MeshDistanceMaterial(),\r\n\r\n\t\t_materialCache = {},\r\n\r\n\t\t_maxTextureSize = capabilities.maxTextureSize;\r\n\r\n\tconst shadowSide = { [ FrontSide ]: BackSide, [ BackSide ]: FrontSide, [ DoubleSide ]: DoubleSide };\r\n\r\n\tconst shadowMaterialVertical = new ShaderMaterial( {\r\n\t\tdefines: {\r\n\t\t\tVSM_SAMPLES: 8\r\n\t\t},\r\n\t\tuniforms: {\r\n\t\t\tshadow_pass: { value: null },\r\n\t\t\tresolution: { value: new Vector2() },\r\n\t\t\tradius: { value: 4.0 }\r\n\t\t},\r\n\r\n\t\tvertexShader: vertex,\r\n\t\tfragmentShader: fragment\r\n\r\n\t} );\r\n\r\n\tconst shadowMaterialHorizontal = shadowMaterialVertical.clone();\r\n\tshadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1;\r\n\r\n\tconst fullScreenTri = new BufferGeometry();\r\n\tfullScreenTri.setAttribute(\r\n\t\t'position',\r\n\t\tnew BufferAttribute(\r\n\t\t\tnew Float32Array( [ - 1, - 1, 0.5, 3, - 1, 0.5, - 1, 3, 0.5 ] ),\r\n\t\t\t3\r\n\t\t)\r\n\t);\r\n\r\n\tconst fullScreenMesh = new Mesh( fullScreenTri, shadowMaterialVertical );\r\n\r\n\tconst scope = this;\r\n\r\n\tthis.enabled = false;\r\n\r\n\tthis.autoUpdate = true;\r\n\tthis.needsUpdate = false;\r\n\r\n\tthis.type = PCFShadowMap;\r\n\tlet _previousType = this.type;\r\n\r\n\tthis.render = function ( lights, scene, camera ) {\r\n\r\n\t\tif ( scope.enabled === false ) return;\r\n\t\tif ( scope.autoUpdate === false && scope.needsUpdate === false ) return;\r\n\r\n\t\tif ( lights.length === 0 ) return;\r\n\r\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\r\n\t\tconst activeCubeFace = renderer.getActiveCubeFace();\r\n\t\tconst activeMipmapLevel = renderer.getActiveMipmapLevel();\r\n\r\n\t\tconst _state = renderer.state;\r\n\r\n\t\t// Set GL state for depth map.\r\n\t\t_state.setBlending( NoBlending );\r\n\t\t_state.buffers.color.setClear( 1, 1, 1, 1 );\r\n\t\t_state.buffers.depth.setTest( true );\r\n\t\t_state.setScissorTest( false );\r\n\r\n\t\t// check for shadow map type changes\r\n\r\n\t\tconst toVSM = ( _previousType !== VSMShadowMap && this.type === VSMShadowMap );\r\n\t\tconst fromVSM = ( _previousType === VSMShadowMap && this.type !== VSMShadowMap );\r\n\r\n\t\t// render depth map\r\n\r\n\t\tfor ( let i = 0, il = lights.length; i < il; i ++ ) {\r\n\r\n\t\t\tconst light = lights[ i ];\r\n\t\t\tconst shadow = light.shadow;\r\n\r\n\t\t\tif ( shadow === undefined ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLShadowMap:', light, 'has no shadow.' );\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( shadow.autoUpdate === false && shadow.needsUpdate === false ) continue;\r\n\r\n\t\t\t_shadowMapSize.copy( shadow.mapSize );\r\n\r\n\t\t\tconst shadowFrameExtents = shadow.getFrameExtents();\r\n\r\n\t\t\t_shadowMapSize.multiply( shadowFrameExtents );\r\n\r\n\t\t\t_viewportSize.copy( shadow.mapSize );\r\n\r\n\t\t\tif ( _shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize ) {\r\n\r\n\t\t\t\tif ( _shadowMapSize.x > _maxTextureSize ) {\r\n\r\n\t\t\t\t\t_viewportSize.x = Math.floor( _maxTextureSize / shadowFrameExtents.x );\r\n\t\t\t\t\t_shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x;\r\n\t\t\t\t\tshadow.mapSize.x = _viewportSize.x;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( _shadowMapSize.y > _maxTextureSize ) {\r\n\r\n\t\t\t\t\t_viewportSize.y = Math.floor( _maxTextureSize / shadowFrameExtents.y );\r\n\t\t\t\t\t_shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y;\r\n\t\t\t\t\tshadow.mapSize.y = _viewportSize.y;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( shadow.map === null || toVSM === true || fromVSM === true ) {\r\n\r\n\t\t\t\tconst pars = ( this.type !== VSMShadowMap ) ? { minFilter: NearestFilter, magFilter: NearestFilter } : {};\r\n\r\n\t\t\t\tif ( shadow.map !== null ) {\r\n\r\n\t\t\t\t\tshadow.map.dispose();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tshadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );\r\n\t\t\t\tshadow.map.texture.name = light.name + '.shadowMap';\r\n\r\n\t\t\t\tshadow.camera.updateProjectionMatrix();\r\n\r\n\t\t\t}\r\n\r\n\t\t\trenderer.setRenderTarget( shadow.map );\r\n\t\t\trenderer.clear();\r\n\r\n\t\t\tconst viewportCount = shadow.getViewportCount();\r\n\r\n\t\t\tfor ( let vp = 0; vp < viewportCount; vp ++ ) {\r\n\r\n\t\t\t\tconst viewport = shadow.getViewport( vp );\r\n\r\n\t\t\t\t_viewport.set(\r\n\t\t\t\t\t_viewportSize.x * viewport.x,\r\n\t\t\t\t\t_viewportSize.y * viewport.y,\r\n\t\t\t\t\t_viewportSize.x * viewport.z,\r\n\t\t\t\t\t_viewportSize.y * viewport.w\r\n\t\t\t\t);\r\n\r\n\t\t\t\t_state.viewport( _viewport );\r\n\r\n\t\t\t\tshadow.updateMatrices( light, vp );\r\n\r\n\t\t\t\t_frustum = shadow.getFrustum();\r\n\r\n\t\t\t\trenderObject( scene, camera, shadow.camera, light, this.type );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// do blur pass for VSM\r\n\r\n\t\t\tif ( shadow.isPointLightShadow !== true && this.type === VSMShadowMap ) {\r\n\r\n\t\t\t\tVSMPass( shadow, camera );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tshadow.needsUpdate = false;\r\n\r\n\t\t}\r\n\r\n\t\t_previousType = this.type;\r\n\r\n\t\tscope.needsUpdate = false;\r\n\r\n\t\trenderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipmapLevel );\r\n\r\n\t};\r\n\r\n\tfunction VSMPass( shadow, camera ) {\r\n\r\n\t\tconst geometry = objects.update( fullScreenMesh );\r\n\r\n\t\tif ( shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples ) {\r\n\r\n\t\t\tshadowMaterialVertical.defines.VSM_SAMPLES = shadow.blurSamples;\r\n\t\t\tshadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples;\r\n\r\n\t\t\tshadowMaterialVertical.needsUpdate = true;\r\n\t\t\tshadowMaterialHorizontal.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t\tif ( shadow.mapPass === null ) {\r\n\r\n\t\t\tshadow.mapPass = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y );\r\n\r\n\t\t}\r\n\r\n\t\t// vertical pass\r\n\r\n\t\tshadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;\r\n\t\tshadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;\r\n\t\tshadowMaterialVertical.uniforms.radius.value = shadow.radius;\r\n\t\trenderer.setRenderTarget( shadow.mapPass );\r\n\t\trenderer.clear();\r\n\t\trenderer.renderBufferDirect( camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null );\r\n\r\n\t\t// horizontal pass\r\n\r\n\t\tshadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;\r\n\t\tshadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;\r\n\t\tshadowMaterialHorizontal.uniforms.radius.value = shadow.radius;\r\n\t\trenderer.setRenderTarget( shadow.map );\r\n\t\trenderer.clear();\r\n\t\trenderer.renderBufferDirect( camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null );\r\n\r\n\t}\r\n\r\n\tfunction getDepthMaterial( object, material, light, type ) {\r\n\r\n\t\tlet result = null;\r\n\r\n\t\tconst customMaterial = ( light.isPointLight === true ) ? object.customDistanceMaterial : object.customDepthMaterial;\r\n\r\n\t\tif ( customMaterial !== undefined ) {\r\n\r\n\t\t\tresult = customMaterial;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult = ( light.isPointLight === true ) ? _distanceMaterial : _depthMaterial;\r\n\r\n\t\t\tif ( ( renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||\r\n\t\t\t\t( material.displacementMap && material.displacementScale !== 0 ) ||\r\n\t\t\t\t( material.alphaMap && material.alphaTest > 0 ) ||\r\n\t\t\t\t( material.map && material.alphaTest > 0 ) ) {\r\n\r\n\t\t\t\t// in this case we need a unique material instance reflecting the\r\n\t\t\t\t// appropriate state\r\n\r\n\t\t\t\tconst keyA = result.uuid, keyB = material.uuid;\r\n\r\n\t\t\t\tlet materialsForVariant = _materialCache[ keyA ];\r\n\r\n\t\t\t\tif ( materialsForVariant === undefined ) {\r\n\r\n\t\t\t\t\tmaterialsForVariant = {};\r\n\t\t\t\t\t_materialCache[ keyA ] = materialsForVariant;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet cachedMaterial = materialsForVariant[ keyB ];\r\n\r\n\t\t\t\tif ( cachedMaterial === undefined ) {\r\n\r\n\t\t\t\t\tcachedMaterial = result.clone();\r\n\t\t\t\t\tmaterialsForVariant[ keyB ] = cachedMaterial;\r\n\t\t\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tresult = cachedMaterial;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tresult.visible = material.visible;\r\n\t\tresult.wireframe = material.wireframe;\r\n\r\n\t\tif ( type === VSMShadowMap ) {\r\n\r\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : material.side;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : shadowSide[ material.side ];\r\n\r\n\t\t}\r\n\r\n\t\tresult.alphaMap = material.alphaMap;\r\n\t\tresult.alphaTest = material.alphaTest;\r\n\t\tresult.map = material.map;\r\n\r\n\t\tresult.clipShadows = material.clipShadows;\r\n\t\tresult.clippingPlanes = material.clippingPlanes;\r\n\t\tresult.clipIntersection = material.clipIntersection;\r\n\r\n\t\tresult.displacementMap = material.displacementMap;\r\n\t\tresult.displacementScale = material.displacementScale;\r\n\t\tresult.displacementBias = material.displacementBias;\r\n\r\n\t\tresult.wireframeLinewidth = material.wireframeLinewidth;\r\n\t\tresult.linewidth = material.linewidth;\r\n\r\n\t\tif ( light.isPointLight === true && result.isMeshDistanceMaterial === true ) {\r\n\r\n\t\t\tconst materialProperties = renderer.properties.get( result );\r\n\t\t\tmaterialProperties.light = light;\r\n\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\tfunction renderObject( object, camera, shadowCamera, light, type ) {\r\n\r\n\t\tif ( object.visible === false ) return;\r\n\r\n\t\tconst visible = object.layers.test( camera.layers );\r\n\r\n\t\tif ( visible && ( object.isMesh || object.isLine || object.isPoints ) ) {\r\n\r\n\t\t\tif ( ( object.castShadow || ( object.receiveShadow && type === VSMShadowMap ) ) && ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) ) {\r\n\r\n\t\t\t\tobject.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld );\r\n\r\n\t\t\t\tconst geometry = objects.update( object );\r\n\t\t\t\tconst material = object.material;\r\n\r\n\t\t\t\tif ( Array.isArray( material ) ) {\r\n\r\n\t\t\t\t\tconst groups = geometry.groups;\r\n\r\n\t\t\t\t\tfor ( let k = 0, kl = groups.length; k < kl; k ++ ) {\r\n\r\n\t\t\t\t\t\tconst group = groups[ k ];\r\n\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\r\n\r\n\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\r\n\r\n\t\t\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, groupMaterial, light, type );\r\n\r\n\t\t\t\t\t\t\tobject.onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, group );\r\n\r\n\t\t\t\t\t\t\trenderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );\r\n\r\n\t\t\t\t\t\t\tobject.onAfterShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, group );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else if ( material.visible ) {\r\n\r\n\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, material, light, type );\r\n\r\n\t\t\t\t\tobject.onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, null );\r\n\r\n\t\t\t\t\trenderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );\r\n\r\n\t\t\t\t\tobject.onAfterShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial, null );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconst children = object.children;\r\n\r\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\r\n\r\n\t\t\trenderObject( children[ i ], camera, shadowCamera, light, type );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction onMaterialDispose( event ) {\r\n\r\n\t\tconst material = event.target;\r\n\r\n\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\r\n\r\n\t\t// make sure to remove the unique distance/depth materials used for shadow map rendering\r\n\r\n\t\tfor ( const id in _materialCache ) {\r\n\r\n\t\t\tconst cache = _materialCache[ id ];\r\n\r\n\t\t\tconst uuid = event.target.uuid;\r\n\r\n\t\t\tif ( uuid in cache ) {\r\n\r\n\t\t\t\tconst shadowMaterial = cache[ uuid ];\r\n\t\t\t\tshadowMaterial.dispose();\r\n\t\t\t\tdelete cache[ uuid ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction WebGLState( gl ) {\r\n\r\n\tfunction ColorBuffer() {\r\n\r\n\t\tlet locked = false;\r\n\r\n\t\tconst color = new Vector4();\r\n\t\tlet currentColorMask = null;\r\n\t\tconst currentColorClear = new Vector4( 0, 0, 0, 0 );\r\n\r\n\t\treturn {\r\n\r\n\t\t\tsetMask: function ( colorMask ) {\r\n\r\n\t\t\t\tif ( currentColorMask !== colorMask && ! locked ) {\r\n\r\n\t\t\t\t\tgl.colorMask( colorMask, colorMask, colorMask, colorMask );\r\n\t\t\t\t\tcurrentColorMask = colorMask;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\r\n\t\t\tsetLocked: function ( lock ) {\r\n\r\n\t\t\t\tlocked = lock;\r\n\r\n\t\t\t},\r\n\r\n\t\t\tsetClear: function ( r, g, b, a, premultipliedAlpha ) {\r\n\r\n\t\t\t\tif ( premultipliedAlpha === true ) {\r\n\r\n\t\t\t\t\tr *= a; g *= a; b *= a;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tcolor.set( r, g, b, a );\r\n\r\n\t\t\t\tif ( currentColorClear.equals( color ) === false ) {\r\n\r\n\t\t\t\t\tgl.clearColor( r, g, b, a );\r\n\t\t\t\t\tcurrentColorClear.copy( color );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\r\n\t\t\treset: function () {\r\n\r\n\t\t\t\tlocked = false;\r\n\r\n\t\t\t\tcurrentColorMask = null;\r\n\t\t\t\tcurrentColorClear.set( - 1, 0, 0, 0 ); // set to invalid state\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tfunction DepthBuffer() {\r\n\r\n\t\tlet locked = false;\r\n\r\n\t\tlet currentDepthMask = null;\r\n\t\tlet currentDepthFunc = null;\r\n\t\tlet currentDepthClear = null;\r\n\r\n\t\treturn {\r\n\r\n\t\t\tsetTest: function ( depthTest ) {\r\n\r\n\t\t\t\tif ( depthTest ) {\r\n\r\n\t\t\t\t\tenable( gl.DEPTH_TEST );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tdisable( gl.DEPTH_TEST );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\r\n\t\t\tsetMask: function ( depthMask ) {\r\n\r\n\t\t\t\tif ( currentDepthMask !== depthMask && ! locked ) {\r\n\r\n\t\t\t\t\tgl.depthMask( depthMask );\r\n\t\t\t\t\tcurrentDepthMask = depthMask;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\r\n\t\t\tsetFunc: function ( depthFunc ) {\r\n\r\n\t\t\t\tif ( currentDepthFunc !== depthFunc ) {\r\n\r\n\t\t\t\t\tswitch ( depthFunc ) {\r\n\r\n\t\t\t\t\t\tcase NeverDepth:\r\n\r\n\t\t\t\t\t\t\tgl.depthFunc( gl.NEVER );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase AlwaysDepth:\r\n\r\n\t\t\t\t\t\t\tgl.depthFunc( gl.ALWAYS );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase LessDepth:\r\n\r\n\t\t\t\t\t\t\tgl.depthFunc( gl.LESS );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase LessEqualDepth:\r\n\r\n\t\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase EqualDepth:\r\n\r\n\t\t\t\t\t\t\tgl.depthFunc( gl.EQUAL );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase GreaterEqualDepth:\r\n\r\n\t\t\t\t\t\t\tgl.depthFunc( gl.GEQUAL );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase GreaterDepth:\r\n\r\n\t\t\t\t\t\t\tgl.depthFunc( gl.GREATER );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase NotEqualDepth:\r\n\r\n\t\t\t\t\t\t\tgl.depthFunc( gl.NOTEQUAL );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tdefault:\r\n\r\n\t\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tcurrentDepthFunc = depthFunc;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\r\n\t\t\tsetLocked: function ( lock ) {\r\n\r\n\t\t\t\tlocked = lock;\r\n\r\n\t\t\t},\r\n\r\n\t\t\tsetClear: function ( depth ) {\r\n\r\n\t\t\t\tif ( currentDepthClear !== depth ) {\r\n\r\n\t\t\t\t\tgl.clearDepth( depth );\r\n\t\t\t\t\tcurrentDepthClear = depth;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\r\n\t\t\treset: function () {\r\n\r\n\t\t\t\tlocked = false;\r\n\r\n\t\t\t\tcurrentDepthMask = null;\r\n\t\t\t\tcurrentDepthFunc = null;\r\n\t\t\t\tcurrentDepthClear = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tfunction StencilBuffer() {\r\n\r\n\t\tlet locked = false;\r\n\r\n\t\tlet currentStencilMask = null;\r\n\t\tlet currentStencilFunc = null;\r\n\t\tlet currentStencilRef = null;\r\n\t\tlet currentStencilFuncMask = null;\r\n\t\tlet currentStencilFail = null;\r\n\t\tlet currentStencilZFail = null;\r\n\t\tlet currentStencilZPass = null;\r\n\t\tlet currentStencilClear = null;\r\n\r\n\t\treturn {\r\n\r\n\t\t\tsetTest: function ( stencilTest ) {\r\n\r\n\t\t\t\tif ( ! locked ) {\r\n\r\n\t\t\t\t\tif ( stencilTest ) {\r\n\r\n\t\t\t\t\t\tenable( gl.STENCIL_TEST );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tdisable( gl.STENCIL_TEST );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\r\n\t\t\tsetMask: function ( stencilMask ) {\r\n\r\n\t\t\t\tif ( currentStencilMask !== stencilMask && ! locked ) {\r\n\r\n\t\t\t\t\tgl.stencilMask( stencilMask );\r\n\t\t\t\t\tcurrentStencilMask = stencilMask;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\r\n\t\t\tsetFunc: function ( stencilFunc, stencilRef, stencilMask ) {\r\n\r\n\t\t\t\tif ( currentStencilFunc !== stencilFunc ||\r\n\t\t\t\t currentStencilRef !== stencilRef ||\r\n\t\t\t\t currentStencilFuncMask !== stencilMask ) {\r\n\r\n\t\t\t\t\tgl.stencilFunc( stencilFunc, stencilRef, stencilMask );\r\n\r\n\t\t\t\t\tcurrentStencilFunc = stencilFunc;\r\n\t\t\t\t\tcurrentStencilRef = stencilRef;\r\n\t\t\t\t\tcurrentStencilFuncMask = stencilMask;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\r\n\t\t\tsetOp: function ( stencilFail, stencilZFail, stencilZPass ) {\r\n\r\n\t\t\t\tif ( currentStencilFail !== stencilFail ||\r\n\t\t\t\t currentStencilZFail !== stencilZFail ||\r\n\t\t\t\t currentStencilZPass !== stencilZPass ) {\r\n\r\n\t\t\t\t\tgl.stencilOp( stencilFail, stencilZFail, stencilZPass );\r\n\r\n\t\t\t\t\tcurrentStencilFail = stencilFail;\r\n\t\t\t\t\tcurrentStencilZFail = stencilZFail;\r\n\t\t\t\t\tcurrentStencilZPass = stencilZPass;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\r\n\t\t\tsetLocked: function ( lock ) {\r\n\r\n\t\t\t\tlocked = lock;\r\n\r\n\t\t\t},\r\n\r\n\t\t\tsetClear: function ( stencil ) {\r\n\r\n\t\t\t\tif ( currentStencilClear !== stencil ) {\r\n\r\n\t\t\t\t\tgl.clearStencil( stencil );\r\n\t\t\t\t\tcurrentStencilClear = stencil;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\r\n\t\t\treset: function () {\r\n\r\n\t\t\t\tlocked = false;\r\n\r\n\t\t\t\tcurrentStencilMask = null;\r\n\t\t\t\tcurrentStencilFunc = null;\r\n\t\t\t\tcurrentStencilRef = null;\r\n\t\t\t\tcurrentStencilFuncMask = null;\r\n\t\t\t\tcurrentStencilFail = null;\r\n\t\t\t\tcurrentStencilZFail = null;\r\n\t\t\t\tcurrentStencilZPass = null;\r\n\t\t\t\tcurrentStencilClear = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tconst colorBuffer = new ColorBuffer();\r\n\tconst depthBuffer = new DepthBuffer();\r\n\tconst stencilBuffer = new StencilBuffer();\r\n\r\n\tconst uboBindings = new WeakMap();\r\n\tconst uboProgramMap = new WeakMap();\r\n\r\n\tlet enabledCapabilities = {};\r\n\r\n\tlet currentBoundFramebuffers = {};\r\n\tlet currentDrawbuffers = new WeakMap();\r\n\tlet defaultDrawbuffers = [];\r\n\r\n\tlet currentProgram = null;\r\n\r\n\tlet currentBlendingEnabled = false;\r\n\tlet currentBlending = null;\r\n\tlet currentBlendEquation = null;\r\n\tlet currentBlendSrc = null;\r\n\tlet currentBlendDst = null;\r\n\tlet currentBlendEquationAlpha = null;\r\n\tlet currentBlendSrcAlpha = null;\r\n\tlet currentBlendDstAlpha = null;\r\n\tlet currentBlendColor = new Color( 0, 0, 0 );\r\n\tlet currentBlendAlpha = 0;\r\n\tlet currentPremultipledAlpha = false;\r\n\r\n\tlet currentFlipSided = null;\r\n\tlet currentCullFace = null;\r\n\r\n\tlet currentLineWidth = null;\r\n\r\n\tlet currentPolygonOffsetFactor = null;\r\n\tlet currentPolygonOffsetUnits = null;\r\n\r\n\tconst maxTextures = gl.getParameter( gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS );\r\n\r\n\tlet lineWidthAvailable = false;\r\n\tlet version = 0;\r\n\tconst glVersion = gl.getParameter( gl.VERSION );\r\n\r\n\tif ( glVersion.indexOf( 'WebGL' ) !== - 1 ) {\r\n\r\n\t\tversion = parseFloat( /^WebGL (\\d)/.exec( glVersion )[ 1 ] );\r\n\t\tlineWidthAvailable = ( version >= 1.0 );\r\n\r\n\t} else if ( glVersion.indexOf( 'OpenGL ES' ) !== - 1 ) {\r\n\r\n\t\tversion = parseFloat( /^OpenGL ES (\\d)/.exec( glVersion )[ 1 ] );\r\n\t\tlineWidthAvailable = ( version >= 2.0 );\r\n\r\n\t}\r\n\r\n\tlet currentTextureSlot = null;\r\n\tlet currentBoundTextures = {};\r\n\r\n\tconst scissorParam = gl.getParameter( gl.SCISSOR_BOX );\r\n\tconst viewportParam = gl.getParameter( gl.VIEWPORT );\r\n\r\n\tconst currentScissor = new Vector4().fromArray( scissorParam );\r\n\tconst currentViewport = new Vector4().fromArray( viewportParam );\r\n\r\n\tfunction createTexture( type, target, count, dimensions ) {\r\n\r\n\t\tconst data = new Uint8Array( 4 ); // 4 is required to match default unpack alignment of 4.\r\n\t\tconst texture = gl.createTexture();\r\n\r\n\t\tgl.bindTexture( type, texture );\r\n\t\tgl.texParameteri( type, gl.TEXTURE_MIN_FILTER, gl.NEAREST );\r\n\t\tgl.texParameteri( type, gl.TEXTURE_MAG_FILTER, gl.NEAREST );\r\n\r\n\t\tfor ( let i = 0; i < count; i ++ ) {\r\n\r\n\t\t\tif ( type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY ) {\r\n\r\n\t\t\t\tgl.texImage3D( target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tgl.texImage2D( target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn texture;\r\n\r\n\t}\r\n\r\n\tconst emptyTextures = {};\r\n\temptyTextures[ gl.TEXTURE_2D ] = createTexture( gl.TEXTURE_2D, gl.TEXTURE_2D, 1 );\r\n\temptyTextures[ gl.TEXTURE_CUBE_MAP ] = createTexture( gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6 );\r\n\temptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );\r\n\temptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );\r\n\r\n\t// init\r\n\r\n\tcolorBuffer.setClear( 0, 0, 0, 1 );\r\n\tdepthBuffer.setClear( 1 );\r\n\tstencilBuffer.setClear( 0 );\r\n\r\n\tenable( gl.DEPTH_TEST );\r\n\tdepthBuffer.setFunc( LessEqualDepth );\r\n\r\n\tsetFlipSided( false );\r\n\tsetCullFace( CullFaceBack );\r\n\tenable( gl.CULL_FACE );\r\n\r\n\tsetBlending( NoBlending );\r\n\r\n\t//\r\n\r\n\tfunction enable( id ) {\r\n\r\n\t\tif ( enabledCapabilities[ id ] !== true ) {\r\n\r\n\t\t\tgl.enable( id );\r\n\t\t\tenabledCapabilities[ id ] = true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction disable( id ) {\r\n\r\n\t\tif ( enabledCapabilities[ id ] !== false ) {\r\n\r\n\t\t\tgl.disable( id );\r\n\t\t\tenabledCapabilities[ id ] = false;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction bindFramebuffer( target, framebuffer ) {\r\n\r\n\t\tif ( currentBoundFramebuffers[ target ] !== framebuffer ) {\r\n\r\n\t\t\tgl.bindFramebuffer( target, framebuffer );\r\n\r\n\t\t\tcurrentBoundFramebuffers[ target ] = framebuffer;\r\n\r\n\t\t\t// gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER\r\n\r\n\t\t\tif ( target === gl.DRAW_FRAMEBUFFER ) {\r\n\r\n\t\t\t\tcurrentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( target === gl.FRAMEBUFFER ) {\r\n\r\n\t\t\t\tcurrentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\tfunction drawBuffers( renderTarget, framebuffer ) {\r\n\r\n\t\tlet drawBuffers = defaultDrawbuffers;\r\n\r\n\t\tlet needsUpdate = false;\r\n\r\n\t\tif ( renderTarget ) {\r\n\r\n\t\t\tdrawBuffers = currentDrawbuffers.get( framebuffer );\r\n\r\n\t\t\tif ( drawBuffers === undefined ) {\r\n\r\n\t\t\t\tdrawBuffers = [];\r\n\t\t\t\tcurrentDrawbuffers.set( framebuffer, drawBuffers );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst textures = renderTarget.textures;\r\n\r\n\t\t\tif ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {\r\n\r\n\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tdrawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdrawBuffers.length = textures.length;\r\n\r\n\t\t\t\tneedsUpdate = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tif ( drawBuffers[ 0 ] !== gl.BACK ) {\r\n\r\n\t\t\t\tdrawBuffers[ 0 ] = gl.BACK;\r\n\r\n\t\t\t\tneedsUpdate = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( needsUpdate ) {\r\n\r\n\t\t\tgl.drawBuffers( drawBuffers );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction useProgram( program ) {\r\n\r\n\t\tif ( currentProgram !== program ) {\r\n\r\n\t\t\tgl.useProgram( program );\r\n\r\n\t\t\tcurrentProgram = program;\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\tconst equationToGL = {\r\n\t\t[ AddEquation ]: gl.FUNC_ADD,\r\n\t\t[ SubtractEquation ]: gl.FUNC_SUBTRACT,\r\n\t\t[ ReverseSubtractEquation ]: gl.FUNC_REVERSE_SUBTRACT\r\n\t};\r\n\r\n\tequationToGL[ MinEquation ] = gl.MIN;\r\n\tequationToGL[ MaxEquation ] = gl.MAX;\r\n\r\n\tconst factorToGL = {\r\n\t\t[ ZeroFactor ]: gl.ZERO,\r\n\t\t[ OneFactor ]: gl.ONE,\r\n\t\t[ SrcColorFactor ]: gl.SRC_COLOR,\r\n\t\t[ SrcAlphaFactor ]: gl.SRC_ALPHA,\r\n\t\t[ SrcAlphaSaturateFactor ]: gl.SRC_ALPHA_SATURATE,\r\n\t\t[ DstColorFactor ]: gl.DST_COLOR,\r\n\t\t[ DstAlphaFactor ]: gl.DST_ALPHA,\r\n\t\t[ OneMinusSrcColorFactor ]: gl.ONE_MINUS_SRC_COLOR,\r\n\t\t[ OneMinusSrcAlphaFactor ]: gl.ONE_MINUS_SRC_ALPHA,\r\n\t\t[ OneMinusDstColorFactor ]: gl.ONE_MINUS_DST_COLOR,\r\n\t\t[ OneMinusDstAlphaFactor ]: gl.ONE_MINUS_DST_ALPHA,\r\n\t\t[ ConstantColorFactor ]: gl.CONSTANT_COLOR,\r\n\t\t[ OneMinusConstantColorFactor ]: gl.ONE_MINUS_CONSTANT_COLOR,\r\n\t\t[ ConstantAlphaFactor ]: gl.CONSTANT_ALPHA,\r\n\t\t[ OneMinusConstantAlphaFactor ]: gl.ONE_MINUS_CONSTANT_ALPHA\r\n\t};\r\n\r\n\tfunction setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, blendColor, blendAlpha, premultipliedAlpha ) {\r\n\r\n\t\tif ( blending === NoBlending ) {\r\n\r\n\t\t\tif ( currentBlendingEnabled === true ) {\r\n\r\n\t\t\t\tdisable( gl.BLEND );\r\n\t\t\t\tcurrentBlendingEnabled = false;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tif ( currentBlendingEnabled === false ) {\r\n\r\n\t\t\tenable( gl.BLEND );\r\n\t\t\tcurrentBlendingEnabled = true;\r\n\r\n\t\t}\r\n\r\n\t\tif ( blending !== CustomBlending ) {\r\n\r\n\t\t\tif ( blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha ) {\r\n\r\n\t\t\t\tif ( currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation ) {\r\n\r\n\t\t\t\t\tgl.blendEquation( gl.FUNC_ADD );\r\n\r\n\t\t\t\t\tcurrentBlendEquation = AddEquation;\r\n\t\t\t\t\tcurrentBlendEquationAlpha = AddEquation;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( premultipliedAlpha ) {\r\n\r\n\t\t\t\t\tswitch ( blending ) {\r\n\r\n\t\t\t\t\t\tcase NormalBlending:\r\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase AdditiveBlending:\r\n\t\t\t\t\t\t\tgl.blendFunc( gl.ONE, gl.ONE );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase SubtractiveBlending:\r\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase MultiplyBlending:\r\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tswitch ( blending ) {\r\n\r\n\t\t\t\t\t\tcase NormalBlending:\r\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase AdditiveBlending:\r\n\t\t\t\t\t\t\tgl.blendFunc( gl.SRC_ALPHA, gl.ONE );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase SubtractiveBlending:\r\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase MultiplyBlending:\r\n\t\t\t\t\t\t\tgl.blendFunc( gl.ZERO, gl.SRC_COLOR );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tcurrentBlendSrc = null;\r\n\t\t\t\tcurrentBlendDst = null;\r\n\t\t\t\tcurrentBlendSrcAlpha = null;\r\n\t\t\t\tcurrentBlendDstAlpha = null;\r\n\t\t\t\tcurrentBlendColor.set( 0, 0, 0 );\r\n\t\t\t\tcurrentBlendAlpha = 0;\r\n\r\n\t\t\t\tcurrentBlending = blending;\r\n\t\t\t\tcurrentPremultipledAlpha = premultipliedAlpha;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\t// custom blending\r\n\r\n\t\tblendEquationAlpha = blendEquationAlpha || blendEquation;\r\n\t\tblendSrcAlpha = blendSrcAlpha || blendSrc;\r\n\t\tblendDstAlpha = blendDstAlpha || blendDst;\r\n\r\n\t\tif ( blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha ) {\r\n\r\n\t\t\tgl.blendEquationSeparate( equationToGL[ blendEquation ], equationToGL[ blendEquationAlpha ] );\r\n\r\n\t\t\tcurrentBlendEquation = blendEquation;\r\n\t\t\tcurrentBlendEquationAlpha = blendEquationAlpha;\r\n\r\n\t\t}\r\n\r\n\t\tif ( blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha ) {\r\n\r\n\t\t\tgl.blendFuncSeparate( factorToGL[ blendSrc ], factorToGL[ blendDst ], factorToGL[ blendSrcAlpha ], factorToGL[ blendDstAlpha ] );\r\n\r\n\t\t\tcurrentBlendSrc = blendSrc;\r\n\t\t\tcurrentBlendDst = blendDst;\r\n\t\t\tcurrentBlendSrcAlpha = blendSrcAlpha;\r\n\t\t\tcurrentBlendDstAlpha = blendDstAlpha;\r\n\r\n\t\t}\r\n\r\n\t\tif ( blendColor.equals( currentBlendColor ) === false || blendAlpha !== currentBlendAlpha ) {\r\n\r\n\t\t\tgl.blendColor( blendColor.r, blendColor.g, blendColor.b, blendAlpha );\r\n\r\n\t\t\tcurrentBlendColor.copy( blendColor );\r\n\t\t\tcurrentBlendAlpha = blendAlpha;\r\n\r\n\t\t}\r\n\r\n\t\tcurrentBlending = blending;\r\n\t\tcurrentPremultipledAlpha = false;\r\n\r\n\t}\r\n\r\n\tfunction setMaterial( material, frontFaceCW ) {\r\n\r\n\t\tmaterial.side === DoubleSide\r\n\t\t\t? disable( gl.CULL_FACE )\r\n\t\t\t: enable( gl.CULL_FACE );\r\n\r\n\t\tlet flipSided = ( material.side === BackSide );\r\n\t\tif ( frontFaceCW ) flipSided = ! flipSided;\r\n\r\n\t\tsetFlipSided( flipSided );\r\n\r\n\t\t( material.blending === NormalBlending && material.transparent === false )\r\n\t\t\t? setBlending( NoBlending )\r\n\t\t\t: setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.blendColor, material.blendAlpha, material.premultipliedAlpha );\r\n\r\n\t\tdepthBuffer.setFunc( material.depthFunc );\r\n\t\tdepthBuffer.setTest( material.depthTest );\r\n\t\tdepthBuffer.setMask( material.depthWrite );\r\n\t\tcolorBuffer.setMask( material.colorWrite );\r\n\r\n\t\tconst stencilWrite = material.stencilWrite;\r\n\t\tstencilBuffer.setTest( stencilWrite );\r\n\t\tif ( stencilWrite ) {\r\n\r\n\t\t\tstencilBuffer.setMask( material.stencilWriteMask );\r\n\t\t\tstencilBuffer.setFunc( material.stencilFunc, material.stencilRef, material.stencilFuncMask );\r\n\t\t\tstencilBuffer.setOp( material.stencilFail, material.stencilZFail, material.stencilZPass );\r\n\r\n\t\t}\r\n\r\n\t\tsetPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );\r\n\r\n\t\tmaterial.alphaToCoverage === true\r\n\t\t\t? enable( gl.SAMPLE_ALPHA_TO_COVERAGE )\r\n\t\t\t: disable( gl.SAMPLE_ALPHA_TO_COVERAGE );\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tfunction setFlipSided( flipSided ) {\r\n\r\n\t\tif ( currentFlipSided !== flipSided ) {\r\n\r\n\t\t\tif ( flipSided ) {\r\n\r\n\t\t\t\tgl.frontFace( gl.CW );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tgl.frontFace( gl.CCW );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcurrentFlipSided = flipSided;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction setCullFace( cullFace ) {\r\n\r\n\t\tif ( cullFace !== CullFaceNone ) {\r\n\r\n\t\t\tenable( gl.CULL_FACE );\r\n\r\n\t\t\tif ( cullFace !== currentCullFace ) {\r\n\r\n\t\t\t\tif ( cullFace === CullFaceBack ) {\r\n\r\n\t\t\t\t\tgl.cullFace( gl.BACK );\r\n\r\n\t\t\t\t} else if ( cullFace === CullFaceFront ) {\r\n\r\n\t\t\t\t\tgl.cullFace( gl.FRONT );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tgl.cullFace( gl.FRONT_AND_BACK );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tdisable( gl.CULL_FACE );\r\n\r\n\t\t}\r\n\r\n\t\tcurrentCullFace = cullFace;\r\n\r\n\t}\r\n\r\n\tfunction setLineWidth( width ) {\r\n\r\n\t\tif ( width !== currentLineWidth ) {\r\n\r\n\t\t\tif ( lineWidthAvailable ) gl.lineWidth( width );\r\n\r\n\t\t\tcurrentLineWidth = width;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction setPolygonOffset( polygonOffset, factor, units ) {\r\n\r\n\t\tif ( polygonOffset ) {\r\n\r\n\t\t\tenable( gl.POLYGON_OFFSET_FILL );\r\n\r\n\t\t\tif ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) {\r\n\r\n\t\t\t\tgl.polygonOffset( factor, units );\r\n\r\n\t\t\t\tcurrentPolygonOffsetFactor = factor;\r\n\t\t\t\tcurrentPolygonOffsetUnits = units;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tdisable( gl.POLYGON_OFFSET_FILL );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction setScissorTest( scissorTest ) {\r\n\r\n\t\tif ( scissorTest ) {\r\n\r\n\t\t\tenable( gl.SCISSOR_TEST );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tdisable( gl.SCISSOR_TEST );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// texture\r\n\r\n\tfunction activeTexture( webglSlot ) {\r\n\r\n\t\tif ( webglSlot === undefined ) webglSlot = gl.TEXTURE0 + maxTextures - 1;\r\n\r\n\t\tif ( currentTextureSlot !== webglSlot ) {\r\n\r\n\t\t\tgl.activeTexture( webglSlot );\r\n\t\t\tcurrentTextureSlot = webglSlot;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction bindTexture( webglType, webglTexture, webglSlot ) {\r\n\r\n\t\tif ( webglSlot === undefined ) {\r\n\r\n\t\t\tif ( currentTextureSlot === null ) {\r\n\r\n\t\t\t\twebglSlot = gl.TEXTURE0 + maxTextures - 1;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\twebglSlot = currentTextureSlot;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tlet boundTexture = currentBoundTextures[ webglSlot ];\r\n\r\n\t\tif ( boundTexture === undefined ) {\r\n\r\n\t\t\tboundTexture = { type: undefined, texture: undefined };\r\n\t\t\tcurrentBoundTextures[ webglSlot ] = boundTexture;\r\n\r\n\t\t}\r\n\r\n\t\tif ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) {\r\n\r\n\t\t\tif ( currentTextureSlot !== webglSlot ) {\r\n\r\n\t\t\t\tgl.activeTexture( webglSlot );\r\n\t\t\t\tcurrentTextureSlot = webglSlot;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgl.bindTexture( webglType, webglTexture || emptyTextures[ webglType ] );\r\n\r\n\t\t\tboundTexture.type = webglType;\r\n\t\t\tboundTexture.texture = webglTexture;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction unbindTexture() {\r\n\r\n\t\tconst boundTexture = currentBoundTextures[ currentTextureSlot ];\r\n\r\n\t\tif ( boundTexture !== undefined && boundTexture.type !== undefined ) {\r\n\r\n\t\t\tgl.bindTexture( boundTexture.type, null );\r\n\r\n\t\t\tboundTexture.type = undefined;\r\n\t\t\tboundTexture.texture = undefined;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction compressedTexImage2D() {\r\n\r\n\t\ttry {\r\n\r\n\t\t\tgl.compressedTexImage2D.apply( gl, arguments );\r\n\r\n\t\t} catch ( error ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction compressedTexImage3D() {\r\n\r\n\t\ttry {\r\n\r\n\t\t\tgl.compressedTexImage3D.apply( gl, arguments );\r\n\r\n\t\t} catch ( error ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction texSubImage2D() {\r\n\r\n\t\ttry {\r\n\r\n\t\t\tgl.texSubImage2D.apply( gl, arguments );\r\n\r\n\t\t} catch ( error ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction texSubImage3D() {\r\n\r\n\t\ttry {\r\n\r\n\t\t\tgl.texSubImage3D.apply( gl, arguments );\r\n\r\n\t\t} catch ( error ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction compressedTexSubImage2D() {\r\n\r\n\t\ttry {\r\n\r\n\t\t\tgl.compressedTexSubImage2D.apply( gl, arguments );\r\n\r\n\t\t} catch ( error ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction compressedTexSubImage3D() {\r\n\r\n\t\ttry {\r\n\r\n\t\t\tgl.compressedTexSubImage3D.apply( gl, arguments );\r\n\r\n\t\t} catch ( error ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction texStorage2D() {\r\n\r\n\t\ttry {\r\n\r\n\t\t\tgl.texStorage2D.apply( gl, arguments );\r\n\r\n\t\t} catch ( error ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction texStorage3D() {\r\n\r\n\t\ttry {\r\n\r\n\t\t\tgl.texStorage3D.apply( gl, arguments );\r\n\r\n\t\t} catch ( error ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction texImage2D() {\r\n\r\n\t\ttry {\r\n\r\n\t\t\tgl.texImage2D.apply( gl, arguments );\r\n\r\n\t\t} catch ( error ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction texImage3D() {\r\n\r\n\t\ttry {\r\n\r\n\t\t\tgl.texImage3D.apply( gl, arguments );\r\n\r\n\t\t} catch ( error ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tfunction scissor( scissor ) {\r\n\r\n\t\tif ( currentScissor.equals( scissor ) === false ) {\r\n\r\n\t\t\tgl.scissor( scissor.x, scissor.y, scissor.z, scissor.w );\r\n\t\t\tcurrentScissor.copy( scissor );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction viewport( viewport ) {\r\n\r\n\t\tif ( currentViewport.equals( viewport ) === false ) {\r\n\r\n\t\t\tgl.viewport( viewport.x, viewport.y, viewport.z, viewport.w );\r\n\t\t\tcurrentViewport.copy( viewport );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction updateUBOMapping( uniformsGroup, program ) {\r\n\r\n\t\tlet mapping = uboProgramMap.get( program );\r\n\r\n\t\tif ( mapping === undefined ) {\r\n\r\n\t\t\tmapping = new WeakMap();\r\n\r\n\t\t\tuboProgramMap.set( program, mapping );\r\n\r\n\t\t}\r\n\r\n\t\tlet blockIndex = mapping.get( uniformsGroup );\r\n\r\n\t\tif ( blockIndex === undefined ) {\r\n\r\n\t\t\tblockIndex = gl.getUniformBlockIndex( program, uniformsGroup.name );\r\n\r\n\t\t\tmapping.set( uniformsGroup, blockIndex );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction uniformBlockBinding( uniformsGroup, program ) {\r\n\r\n\t\tconst mapping = uboProgramMap.get( program );\r\n\t\tconst blockIndex = mapping.get( uniformsGroup );\r\n\r\n\t\tif ( uboBindings.get( program ) !== blockIndex ) {\r\n\r\n\t\t\t// bind shader specific block index to global block point\r\n\t\t\tgl.uniformBlockBinding( program, blockIndex, uniformsGroup.__bindingPointIndex );\r\n\r\n\t\t\tuboBindings.set( program, blockIndex );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tfunction reset() {\r\n\r\n\t\t// reset state\r\n\r\n\t\tgl.disable( gl.BLEND );\r\n\t\tgl.disable( gl.CULL_FACE );\r\n\t\tgl.disable( gl.DEPTH_TEST );\r\n\t\tgl.disable( gl.POLYGON_OFFSET_FILL );\r\n\t\tgl.disable( gl.SCISSOR_TEST );\r\n\t\tgl.disable( gl.STENCIL_TEST );\r\n\t\tgl.disable( gl.SAMPLE_ALPHA_TO_COVERAGE );\r\n\r\n\t\tgl.blendEquation( gl.FUNC_ADD );\r\n\t\tgl.blendFunc( gl.ONE, gl.ZERO );\r\n\t\tgl.blendFuncSeparate( gl.ONE, gl.ZERO, gl.ONE, gl.ZERO );\r\n\t\tgl.blendColor( 0, 0, 0, 0 );\r\n\r\n\t\tgl.colorMask( true, true, true, true );\r\n\t\tgl.clearColor( 0, 0, 0, 0 );\r\n\r\n\t\tgl.depthMask( true );\r\n\t\tgl.depthFunc( gl.LESS );\r\n\t\tgl.clearDepth( 1 );\r\n\r\n\t\tgl.stencilMask( 0xffffffff );\r\n\t\tgl.stencilFunc( gl.ALWAYS, 0, 0xffffffff );\r\n\t\tgl.stencilOp( gl.KEEP, gl.KEEP, gl.KEEP );\r\n\t\tgl.clearStencil( 0 );\r\n\r\n\t\tgl.cullFace( gl.BACK );\r\n\t\tgl.frontFace( gl.CCW );\r\n\r\n\t\tgl.polygonOffset( 0, 0 );\r\n\r\n\t\tgl.activeTexture( gl.TEXTURE0 );\r\n\r\n\t\tgl.bindFramebuffer( gl.FRAMEBUFFER, null );\r\n\t\tgl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );\r\n\t\tgl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );\r\n\r\n\t\tgl.useProgram( null );\r\n\r\n\t\tgl.lineWidth( 1 );\r\n\r\n\t\tgl.scissor( 0, 0, gl.canvas.width, gl.canvas.height );\r\n\t\tgl.viewport( 0, 0, gl.canvas.width, gl.canvas.height );\r\n\r\n\t\t// reset internals\r\n\r\n\t\tenabledCapabilities = {};\r\n\r\n\t\tcurrentTextureSlot = null;\r\n\t\tcurrentBoundTextures = {};\r\n\r\n\t\tcurrentBoundFramebuffers = {};\r\n\t\tcurrentDrawbuffers = new WeakMap();\r\n\t\tdefaultDrawbuffers = [];\r\n\r\n\t\tcurrentProgram = null;\r\n\r\n\t\tcurrentBlendingEnabled = false;\r\n\t\tcurrentBlending = null;\r\n\t\tcurrentBlendEquation = null;\r\n\t\tcurrentBlendSrc = null;\r\n\t\tcurrentBlendDst = null;\r\n\t\tcurrentBlendEquationAlpha = null;\r\n\t\tcurrentBlendSrcAlpha = null;\r\n\t\tcurrentBlendDstAlpha = null;\r\n\t\tcurrentBlendColor = new Color( 0, 0, 0 );\r\n\t\tcurrentBlendAlpha = 0;\r\n\t\tcurrentPremultipledAlpha = false;\r\n\r\n\t\tcurrentFlipSided = null;\r\n\t\tcurrentCullFace = null;\r\n\r\n\t\tcurrentLineWidth = null;\r\n\r\n\t\tcurrentPolygonOffsetFactor = null;\r\n\t\tcurrentPolygonOffsetUnits = null;\r\n\r\n\t\tcurrentScissor.set( 0, 0, gl.canvas.width, gl.canvas.height );\r\n\t\tcurrentViewport.set( 0, 0, gl.canvas.width, gl.canvas.height );\r\n\r\n\t\tcolorBuffer.reset();\r\n\t\tdepthBuffer.reset();\r\n\t\tstencilBuffer.reset();\r\n\r\n\t}\r\n\r\n\treturn {\r\n\r\n\t\tbuffers: {\r\n\t\t\tcolor: colorBuffer,\r\n\t\t\tdepth: depthBuffer,\r\n\t\t\tstencil: stencilBuffer\r\n\t\t},\r\n\r\n\t\tenable: enable,\r\n\t\tdisable: disable,\r\n\r\n\t\tbindFramebuffer: bindFramebuffer,\r\n\t\tdrawBuffers: drawBuffers,\r\n\r\n\t\tuseProgram: useProgram,\r\n\r\n\t\tsetBlending: setBlending,\r\n\t\tsetMaterial: setMaterial,\r\n\r\n\t\tsetFlipSided: setFlipSided,\r\n\t\tsetCullFace: setCullFace,\r\n\r\n\t\tsetLineWidth: setLineWidth,\r\n\t\tsetPolygonOffset: setPolygonOffset,\r\n\r\n\t\tsetScissorTest: setScissorTest,\r\n\r\n\t\tactiveTexture: activeTexture,\r\n\t\tbindTexture: bindTexture,\r\n\t\tunbindTexture: unbindTexture,\r\n\t\tcompressedTexImage2D: compressedTexImage2D,\r\n\t\tcompressedTexImage3D: compressedTexImage3D,\r\n\t\ttexImage2D: texImage2D,\r\n\t\ttexImage3D: texImage3D,\r\n\r\n\t\tupdateUBOMapping: updateUBOMapping,\r\n\t\tuniformBlockBinding: uniformBlockBinding,\r\n\r\n\t\ttexStorage2D: texStorage2D,\r\n\t\ttexStorage3D: texStorage3D,\r\n\t\ttexSubImage2D: texSubImage2D,\r\n\t\ttexSubImage3D: texSubImage3D,\r\n\t\tcompressedTexSubImage2D: compressedTexSubImage2D,\r\n\t\tcompressedTexSubImage3D: compressedTexSubImage3D,\r\n\r\n\t\tscissor: scissor,\r\n\t\tviewport: viewport,\r\n\r\n\t\treset: reset\r\n\r\n\t};\r\n\r\n}\r\n\r\nfunction contain( texture, aspect ) {\r\n\r\n\tconst imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;\r\n\r\n\tif ( imageAspect > aspect ) {\r\n\r\n\t\ttexture.repeat.x = 1;\r\n\t\ttexture.repeat.y = imageAspect / aspect;\r\n\r\n\t\ttexture.offset.x = 0;\r\n\t\ttexture.offset.y = ( 1 - texture.repeat.y ) / 2;\r\n\r\n\t} else {\r\n\r\n\t\ttexture.repeat.x = aspect / imageAspect;\r\n\t\ttexture.repeat.y = 1;\r\n\r\n\t\ttexture.offset.x = ( 1 - texture.repeat.x ) / 2;\r\n\t\ttexture.offset.y = 0;\r\n\r\n\t}\r\n\r\n\treturn texture;\r\n\r\n}\r\n\r\nfunction cover( texture, aspect ) {\r\n\r\n\tconst imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;\r\n\r\n\tif ( imageAspect > aspect ) {\r\n\r\n\t\ttexture.repeat.x = aspect / imageAspect;\r\n\t\ttexture.repeat.y = 1;\r\n\r\n\t\ttexture.offset.x = ( 1 - texture.repeat.x ) / 2;\r\n\t\ttexture.offset.y = 0;\r\n\r\n\t} else {\r\n\r\n\t\ttexture.repeat.x = 1;\r\n\t\ttexture.repeat.y = imageAspect / aspect;\r\n\r\n\t\ttexture.offset.x = 0;\r\n\t\ttexture.offset.y = ( 1 - texture.repeat.y ) / 2;\r\n\r\n\t}\r\n\r\n\treturn texture;\r\n\r\n}\r\n\r\nfunction fill( texture ) {\r\n\r\n\ttexture.repeat.x = 1;\r\n\ttexture.repeat.y = 1;\r\n\r\n\ttexture.offset.x = 0;\r\n\ttexture.offset.y = 0;\r\n\r\n\treturn texture;\r\n\r\n}\r\n\r\n\r\n\r\n/**\r\n * Given the width, height, format, and type of a texture. Determines how many\r\n * bytes must be used to represent the texture.\r\n */\r\nfunction getByteLength( width, height, format, type ) {\r\n\r\n\tconst typeByteLength = getTextureTypeByteLength( type );\r\n\r\n\tswitch ( format ) {\r\n\r\n\t\t// https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml\r\n\t\tcase AlphaFormat:\r\n\t\t\treturn width * height;\r\n\t\tcase LuminanceFormat:\r\n\t\t\treturn width * height;\r\n\t\tcase LuminanceAlphaFormat:\r\n\t\t\treturn width * height * 2;\r\n\t\tcase RedFormat:\r\n\t\t\treturn ( ( width * height ) / typeByteLength.components ) * typeByteLength.byteLength;\r\n\t\tcase RedIntegerFormat:\r\n\t\t\treturn ( ( width * height ) / typeByteLength.components ) * typeByteLength.byteLength;\r\n\t\tcase RGFormat:\r\n\t\t\treturn ( ( width * height * 2 ) / typeByteLength.components ) * typeByteLength.byteLength;\r\n\t\tcase RGIntegerFormat:\r\n\t\t\treturn ( ( width * height * 2 ) / typeByteLength.components ) * typeByteLength.byteLength;\r\n\t\tcase RGBFormat:\r\n\t\t\treturn ( ( width * height * 3 ) / typeByteLength.components ) * typeByteLength.byteLength;\r\n\t\tcase RGBAFormat:\r\n\t\t\treturn ( ( width * height * 4 ) / typeByteLength.components ) * typeByteLength.byteLength;\r\n\t\tcase RGBAIntegerFormat:\r\n\t\t\treturn ( ( width * height * 4 ) / typeByteLength.components ) * typeByteLength.byteLength;\r\n\r\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_s3tc_srgb/\r\n\t\tcase RGB_S3TC_DXT1_Format:\r\n\t\tcase RGBA_S3TC_DXT1_Format:\r\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;\r\n\t\tcase RGBA_S3TC_DXT3_Format:\r\n\t\tcase RGBA_S3TC_DXT5_Format:\r\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\r\n\r\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_pvrtc/\r\n\t\tcase RGB_PVRTC_2BPPV1_Format:\r\n\t\tcase RGBA_PVRTC_2BPPV1_Format:\r\n\t\t\treturn ( Math.max( width, 16 ) * Math.max( height, 8 ) ) / 4;\r\n\t\tcase RGB_PVRTC_4BPPV1_Format:\r\n\t\tcase RGBA_PVRTC_4BPPV1_Format:\r\n\t\t\treturn ( Math.max( width, 8 ) * Math.max( height, 8 ) ) / 2;\r\n\r\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_etc/\r\n\t\tcase RGB_ETC1_Format:\r\n\t\tcase RGB_ETC2_Format:\r\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;\r\n\t\tcase RGBA_ETC2_EAC_Format:\r\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\r\n\r\n\t\t// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/\r\n\t\tcase RGBA_ASTC_4x4_Format:\r\n\t\t\treturn Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\r\n\t\tcase RGBA_ASTC_5x4_Format:\r\n\t\t\treturn Math.floor( ( width + 4 ) / 5 ) * Math.floor( ( height + 3 ) / 4 ) * 16;\r\n\t\tcase RGBA_ASTC_5x5_Format:\r\n\t\t\treturn Math.floor( ( width + 4 ) / 5 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\r\n\t\tcase RGBA_ASTC_6x5_Format:\r\n\t\t\treturn Math.floor( ( width + 5 ) / 6 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\r\n\t\tcase RGBA_ASTC_6x6_Format:\r\n\t\t\treturn Math.floor( ( width + 5 ) / 6 ) * Math.floor( ( height + 5 ) / 6 ) * 16;\r\n\t\tcase RGBA_ASTC_8x5_Format:\r\n\t\t\treturn Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\r\n\t\tcase RGBA_ASTC_8x6_Format:\r\n\t\t\treturn Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 5 ) / 6 ) * 16;\r\n\t\tcase RGBA_ASTC_8x8_Format:\r\n\t\t\treturn Math.floor( ( width + 7 ) / 8 ) * Math.floor( ( height + 7 ) / 8 ) * 16;\r\n\t\tcase RGBA_ASTC_10x5_Format:\r\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 4 ) / 5 ) * 16;\r\n\t\tcase RGBA_ASTC_10x6_Format:\r\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 5 ) / 6 ) * 16;\r\n\t\tcase RGBA_ASTC_10x8_Format:\r\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 7 ) / 8 ) * 16;\r\n\t\tcase RGBA_ASTC_10x10_Format:\r\n\t\t\treturn Math.floor( ( width + 9 ) / 10 ) * Math.floor( ( height + 9 ) / 10 ) * 16;\r\n\t\tcase RGBA_ASTC_12x10_Format:\r\n\t\t\treturn Math.floor( ( width + 11 ) / 12 ) * Math.floor( ( height + 9 ) / 10 ) * 16;\r\n\t\tcase RGBA_ASTC_12x12_Format:\r\n\t\t\treturn Math.floor( ( width + 11 ) / 12 ) * Math.floor( ( height + 11 ) / 12 ) * 16;\r\n\r\n\t\t// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_bptc/\r\n\t\tcase RGBA_BPTC_Format:\r\n\t\tcase RGB_BPTC_SIGNED_Format:\r\n\t\tcase RGB_BPTC_UNSIGNED_Format:\r\n\t\t\treturn Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 16;\r\n\r\n\t\t// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_rgtc/\r\n\t\tcase RED_RGTC1_Format:\r\n\t\tcase SIGNED_RED_RGTC1_Format:\r\n\t\t\treturn Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 8;\r\n\t\tcase RED_GREEN_RGTC2_Format:\r\n\t\tcase SIGNED_RED_GREEN_RGTC2_Format:\r\n\t\t\treturn Math.ceil( width / 4 ) * Math.ceil( height / 4 ) * 16;\r\n\r\n\t}\r\n\r\n\tthrow new Error(\r\n\t\t`Unable to determine texture byte length for ${format} format.`,\r\n\t);\r\n\r\n}\r\n\r\nfunction getTextureTypeByteLength( type ) {\r\n\r\n\tswitch ( type ) {\r\n\r\n\t\tcase UnsignedByteType:\r\n\t\tcase ByteType:\r\n\t\t\treturn { byteLength: 1, components: 1 };\r\n\t\tcase UnsignedShortType:\r\n\t\tcase ShortType:\r\n\t\tcase HalfFloatType:\r\n\t\t\treturn { byteLength: 2, components: 1 };\r\n\t\tcase UnsignedShort4444Type:\r\n\t\tcase UnsignedShort5551Type:\r\n\t\t\treturn { byteLength: 2, components: 4 };\r\n\t\tcase UnsignedIntType:\r\n\t\tcase IntType:\r\n\t\tcase FloatType:\r\n\t\t\treturn { byteLength: 4, components: 1 };\r\n\t\tcase UnsignedInt5999Type:\r\n\t\t\treturn { byteLength: 4, components: 3 };\r\n\r\n\t}\r\n\r\n\tthrow new Error( `Unknown texture type ${type}.` );\r\n\r\n}\r\n\r\nconst TextureUtils = {\r\n\tcontain,\r\n\tcover,\r\n\tfill,\r\n\tgetByteLength\r\n};\r\n\r\nfunction WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {\r\n\r\n\tconst multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;\r\n\tconst supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );\r\n\r\n\tconst _imageDimensions = new Vector2();\r\n\tconst _videoTextures = new WeakMap();\r\n\tlet _canvas;\r\n\r\n\tconst _sources = new WeakMap(); // maps WebglTexture objects to instances of Source\r\n\r\n\t// cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,\r\n\t// also OffscreenCanvas.getContext(\"webgl\"), but not OffscreenCanvas.getContext(\"2d\")!\r\n\t// Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).\r\n\r\n\tlet useOffscreenCanvas = false;\r\n\r\n\ttry {\r\n\r\n\t\tuseOffscreenCanvas = typeof OffscreenCanvas !== 'undefined'\r\n\t\t\t// eslint-disable-next-line compat/compat\r\n\t\t\t&& ( new OffscreenCanvas( 1, 1 ).getContext( '2d' ) ) !== null;\r\n\r\n\t} catch ( err ) {\r\n\r\n\t\t// Ignore any errors\r\n\r\n\t}\r\n\r\n\tfunction createCanvas( width, height ) {\r\n\r\n\t\t// Use OffscreenCanvas when available. Specially needed in web workers\r\n\r\n\t\treturn useOffscreenCanvas ?\r\n\t\t\t// eslint-disable-next-line compat/compat\r\n\t\t\tnew OffscreenCanvas( width, height ) : createElementNS( 'canvas' );\r\n\r\n\t}\r\n\r\n\tfunction resizeImage( image, needsNewCanvas, maxSize ) {\r\n\r\n\t\tlet scale = 1;\r\n\r\n\t\tconst dimensions = getDimensions( image );\r\n\r\n\t\t// handle case if texture exceeds max size\r\n\r\n\t\tif ( dimensions.width > maxSize || dimensions.height > maxSize ) {\r\n\r\n\t\t\tscale = maxSize / Math.max( dimensions.width, dimensions.height );\r\n\r\n\t\t}\r\n\r\n\t\t// only perform resize if necessary\r\n\r\n\t\tif ( scale < 1 ) {\r\n\r\n\t\t\t// only perform resize for certain image types\r\n\r\n\t\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\r\n\t\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\r\n\t\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ||\r\n\t\t\t\t( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) ) {\r\n\r\n\t\t\t\tconst width = Math.floor( scale * dimensions.width );\r\n\t\t\t\tconst height = Math.floor( scale * dimensions.height );\r\n\r\n\t\t\t\tif ( _canvas === undefined ) _canvas = createCanvas( width, height );\r\n\r\n\t\t\t\t// cube textures can't reuse the same canvas\r\n\r\n\t\t\t\tconst canvas = needsNewCanvas ? createCanvas( width, height ) : _canvas;\r\n\r\n\t\t\t\tcanvas.width = width;\r\n\t\t\t\tcanvas.height = height;\r\n\r\n\t\t\t\tconst context = canvas.getContext( '2d' );\r\n\t\t\t\tcontext.drawImage( image, 0, 0, width, height );\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + dimensions.width + 'x' + dimensions.height + ') to (' + width + 'x' + height + ').' );\r\n\r\n\t\t\t\treturn canvas;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif ( 'data' in image ) {\r\n\r\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + dimensions.width + 'x' + dimensions.height + ').' );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn image;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn image;\r\n\r\n\t}\r\n\r\n\tfunction textureNeedsGenerateMipmaps( texture ) {\r\n\r\n\t\treturn texture.generateMipmaps && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;\r\n\r\n\t}\r\n\r\n\tfunction generateMipmap( target ) {\r\n\r\n\t\t_gl.generateMipmap( target );\r\n\r\n\t}\r\n\r\n\tfunction getInternalFormat( internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false ) {\r\n\r\n\t\tif ( internalFormatName !== null ) {\r\n\r\n\t\t\tif ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];\r\n\r\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \\'' + internalFormatName + '\\'' );\r\n\r\n\t\t}\r\n\r\n\t\tlet internalFormat = glFormat;\r\n\r\n\t\tif ( glFormat === _gl.RED ) {\r\n\r\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.R32F;\r\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.R16F;\r\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8;\r\n\r\n\t\t}\r\n\r\n\t\tif ( glFormat === _gl.RED_INTEGER ) {\r\n\r\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8UI;\r\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.R16UI;\r\n\t\t\tif ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.R32UI;\r\n\t\t\tif ( glType === _gl.BYTE ) internalFormat = _gl.R8I;\r\n\t\t\tif ( glType === _gl.SHORT ) internalFormat = _gl.R16I;\r\n\t\t\tif ( glType === _gl.INT ) internalFormat = _gl.R32I;\r\n\r\n\t\t}\r\n\r\n\t\tif ( glFormat === _gl.RG ) {\r\n\r\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.RG32F;\r\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RG16F;\r\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8;\r\n\r\n\t\t}\r\n\r\n\t\tif ( glFormat === _gl.RG_INTEGER ) {\r\n\r\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8UI;\r\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RG16UI;\r\n\t\t\tif ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RG32UI;\r\n\t\t\tif ( glType === _gl.BYTE ) internalFormat = _gl.RG8I;\r\n\t\t\tif ( glType === _gl.SHORT ) internalFormat = _gl.RG16I;\r\n\t\t\tif ( glType === _gl.INT ) internalFormat = _gl.RG32I;\r\n\r\n\t\t}\r\n\r\n\t\tif ( glFormat === _gl.RGB ) {\r\n\r\n\t\t\tif ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;\r\n\r\n\t\t}\r\n\r\n\t\tif ( glFormat === _gl.RGBA ) {\r\n\r\n\t\t\tconst transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );\r\n\r\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.RGBA32F;\r\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RGBA16F;\r\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( transfer === SRGBTransfer ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;\r\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT_4_4_4_4 ) internalFormat = _gl.RGBA4;\r\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT_5_5_5_1 ) internalFormat = _gl.RGB5_A1;\r\n\r\n\t\t}\r\n\r\n\t\tif ( internalFormat === _gl.R16F || internalFormat === _gl.R32F ||\r\n\t\t\tinternalFormat === _gl.RG16F || internalFormat === _gl.RG32F ||\r\n\t\t\tinternalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F ) {\r\n\r\n\t\t\textensions.get( 'EXT_color_buffer_float' );\r\n\r\n\t\t}\r\n\r\n\t\treturn internalFormat;\r\n\r\n\t}\r\n\r\n\tfunction getInternalDepthFormat( useStencil, depthType ) {\r\n\r\n\t\tlet glInternalFormat;\r\n\t\tif ( useStencil ) {\r\n\r\n\t\t\tif ( depthType === null || depthType === UnsignedIntType || depthType === UnsignedInt248Type ) {\r\n\r\n\t\t\t\tglInternalFormat = _gl.DEPTH24_STENCIL8;\r\n\r\n\t\t\t} else if ( depthType === FloatType ) {\r\n\r\n\t\t\t\tglInternalFormat = _gl.DEPTH32F_STENCIL8;\r\n\r\n\t\t\t} else if ( depthType === UnsignedShortType ) {\r\n\r\n\t\t\t\tglInternalFormat = _gl.DEPTH24_STENCIL8;\r\n\t\t\t\tconsole.warn( 'DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tif ( depthType === null || depthType === UnsignedIntType || depthType === UnsignedInt248Type ) {\r\n\r\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT24;\r\n\r\n\t\t\t} else if ( depthType === FloatType ) {\r\n\r\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT32F;\r\n\r\n\t\t\t} else if ( depthType === UnsignedShortType ) {\r\n\r\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT16;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn glInternalFormat;\r\n\r\n\t}\r\n\r\n\tfunction getMipLevels( texture, image ) {\r\n\r\n\t\tif ( textureNeedsGenerateMipmaps( texture ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {\r\n\r\n\t\t\treturn Math.log2( Math.max( image.width, image.height ) ) + 1;\r\n\r\n\t\t} else if ( texture.mipmaps !== undefined && texture.mipmaps.length > 0 ) {\r\n\r\n\t\t\t// user-defined mipmaps\r\n\r\n\t\t\treturn texture.mipmaps.length;\r\n\r\n\t\t} else if ( texture.isCompressedTexture && Array.isArray( texture.image ) ) {\r\n\r\n\t\t\treturn image.mipmaps.length;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// texture without mipmaps (only base level)\r\n\r\n\t\t\treturn 1;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tfunction onTextureDispose( event ) {\r\n\r\n\t\tconst texture = event.target;\r\n\r\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\r\n\r\n\t\tdeallocateTexture( texture );\r\n\r\n\t\tif ( texture.isVideoTexture ) {\r\n\r\n\t\t\t_videoTextures.delete( texture );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction onRenderTargetDispose( event ) {\r\n\r\n\t\tconst renderTarget = event.target;\r\n\r\n\t\trenderTarget.removeEventListener( 'dispose', onRenderTargetDispose );\r\n\r\n\t\tdeallocateRenderTarget( renderTarget );\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tfunction deallocateTexture( texture ) {\r\n\r\n\t\tconst textureProperties = properties.get( texture );\r\n\r\n\t\tif ( textureProperties.__webglInit === undefined ) return;\r\n\r\n\t\t// check if it's necessary to remove the WebGLTexture object\r\n\r\n\t\tconst source = texture.source;\r\n\t\tconst webglTextures = _sources.get( source );\r\n\r\n\t\tif ( webglTextures ) {\r\n\r\n\t\t\tconst webglTexture = webglTextures[ textureProperties.__cacheKey ];\r\n\t\t\twebglTexture.usedTimes --;\r\n\r\n\t\t\t// the WebGLTexture object is not used anymore, remove it\r\n\r\n\t\t\tif ( webglTexture.usedTimes === 0 ) {\r\n\r\n\t\t\t\tdeleteTexture( texture );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// remove the weak map entry if no WebGLTexture uses the source anymore\r\n\r\n\t\t\tif ( Object.keys( webglTextures ).length === 0 ) {\r\n\r\n\t\t\t\t_sources.delete( source );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tproperties.remove( texture );\r\n\r\n\t}\r\n\r\n\tfunction deleteTexture( texture ) {\r\n\r\n\t\tconst textureProperties = properties.get( texture );\r\n\t\t_gl.deleteTexture( textureProperties.__webglTexture );\r\n\r\n\t\tconst source = texture.source;\r\n\t\tconst webglTextures = _sources.get( source );\r\n\t\tdelete webglTextures[ textureProperties.__cacheKey ];\r\n\r\n\t\tinfo.memory.textures --;\r\n\r\n\t}\r\n\r\n\tfunction deallocateRenderTarget( renderTarget ) {\r\n\r\n\t\tconst renderTargetProperties = properties.get( renderTarget );\r\n\r\n\t\tif ( renderTarget.depthTexture ) {\r\n\r\n\t\t\trenderTarget.depthTexture.dispose();\r\n\r\n\t\t}\r\n\r\n\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\r\n\r\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\t\tif ( Array.isArray( renderTargetProperties.__webglFramebuffer[ i ] ) ) {\r\n\r\n\t\t\t\t\tfor ( let level = 0; level < renderTargetProperties.__webglFramebuffer[ i ].length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ][ level ] );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tif ( Array.isArray( renderTargetProperties.__webglFramebuffer ) ) {\r\n\r\n\t\t\t\tfor ( let level = 0; level < renderTargetProperties.__webglFramebuffer.length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ level ] );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer );\r\n\t\t\tif ( renderTargetProperties.__webglMultisampledFramebuffer ) _gl.deleteFramebuffer( renderTargetProperties.__webglMultisampledFramebuffer );\r\n\r\n\t\t\tif ( renderTargetProperties.__webglColorRenderbuffer ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < renderTargetProperties.__webglColorRenderbuffer.length; i ++ ) {\r\n\r\n\t\t\t\t\tif ( renderTargetProperties.__webglColorRenderbuffer[ i ] ) _gl.deleteRenderbuffer( renderTargetProperties.__webglColorRenderbuffer[ i ] );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( renderTargetProperties.__webglDepthRenderbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthRenderbuffer );\r\n\r\n\t\t}\r\n\r\n\t\tconst textures = renderTarget.textures;\r\n\r\n\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\r\n\r\n\t\t\tconst attachmentProperties = properties.get( textures[ i ] );\r\n\r\n\t\t\tif ( attachmentProperties.__webglTexture ) {\r\n\r\n\t\t\t\t_gl.deleteTexture( attachmentProperties.__webglTexture );\r\n\r\n\t\t\t\tinfo.memory.textures --;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tproperties.remove( textures[ i ] );\r\n\r\n\t\t}\r\n\r\n\t\tproperties.remove( renderTarget );\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tlet textureUnits = 0;\r\n\r\n\tfunction resetTextureUnits() {\r\n\r\n\t\ttextureUnits = 0;\r\n\r\n\t}\r\n\r\n\tfunction allocateTextureUnit() {\r\n\r\n\t\tconst textureUnit = textureUnits;\r\n\r\n\t\tif ( textureUnit >= capabilities.maxTextures ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + capabilities.maxTextures );\r\n\r\n\t\t}\r\n\r\n\t\ttextureUnits += 1;\r\n\r\n\t\treturn textureUnit;\r\n\r\n\t}\r\n\r\n\tfunction getTextureCacheKey( texture ) {\r\n\r\n\t\tconst array = [];\r\n\r\n\t\tarray.push( texture.wrapS );\r\n\t\tarray.push( texture.wrapT );\r\n\t\tarray.push( texture.wrapR || 0 );\r\n\t\tarray.push( texture.magFilter );\r\n\t\tarray.push( texture.minFilter );\r\n\t\tarray.push( texture.anisotropy );\r\n\t\tarray.push( texture.internalFormat );\r\n\t\tarray.push( texture.format );\r\n\t\tarray.push( texture.type );\r\n\t\tarray.push( texture.generateMipmaps );\r\n\t\tarray.push( texture.premultiplyAlpha );\r\n\t\tarray.push( texture.flipY );\r\n\t\tarray.push( texture.unpackAlignment );\r\n\t\tarray.push( texture.colorSpace );\r\n\r\n\t\treturn array.join();\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tfunction setTexture2D( texture, slot ) {\r\n\r\n\t\tconst textureProperties = properties.get( texture );\r\n\r\n\t\tif ( texture.isVideoTexture ) updateVideoTexture( texture );\r\n\r\n\t\tif ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {\r\n\r\n\t\t\tconst image = texture.image;\r\n\r\n\t\t\tif ( image === null ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but no image data found.' );\r\n\r\n\t\t\t} else if ( image.complete === false ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but image is incomplete' );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tuploadTexture( textureProperties, texture, slot );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tstate.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\r\n\r\n\t}\r\n\r\n\tfunction setTexture2DArray( texture, slot ) {\r\n\r\n\t\tconst textureProperties = properties.get( texture );\r\n\r\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\r\n\r\n\t\t\tuploadTexture( textureProperties, texture, slot );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tstate.bindTexture( _gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\r\n\r\n\t}\r\n\r\n\tfunction setTexture3D( texture, slot ) {\r\n\r\n\t\tconst textureProperties = properties.get( texture );\r\n\r\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\r\n\r\n\t\t\tuploadTexture( textureProperties, texture, slot );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tstate.bindTexture( _gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\r\n\r\n\t}\r\n\r\n\tfunction setTextureCube( texture, slot ) {\r\n\r\n\t\tconst textureProperties = properties.get( texture );\r\n\r\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\r\n\r\n\t\t\tuploadCubeTexture( textureProperties, texture, slot );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\r\n\r\n\t}\r\n\r\n\tconst wrappingToGL = {\r\n\t\t[ RepeatWrapping ]: _gl.REPEAT,\r\n\t\t[ ClampToEdgeWrapping ]: _gl.CLAMP_TO_EDGE,\r\n\t\t[ MirroredRepeatWrapping ]: _gl.MIRRORED_REPEAT\r\n\t};\r\n\r\n\tconst filterToGL = {\r\n\t\t[ NearestFilter ]: _gl.NEAREST,\r\n\t\t[ NearestMipmapNearestFilter ]: _gl.NEAREST_MIPMAP_NEAREST,\r\n\t\t[ NearestMipmapLinearFilter ]: _gl.NEAREST_MIPMAP_LINEAR,\r\n\r\n\t\t[ LinearFilter ]: _gl.LINEAR,\r\n\t\t[ LinearMipmapNearestFilter ]: _gl.LINEAR_MIPMAP_NEAREST,\r\n\t\t[ LinearMipmapLinearFilter ]: _gl.LINEAR_MIPMAP_LINEAR\r\n\t};\r\n\r\n\tconst compareToGL = {\r\n\t\t[ NeverCompare ]: _gl.NEVER,\r\n\t\t[ AlwaysCompare ]: _gl.ALWAYS,\r\n\t\t[ LessCompare ]: _gl.LESS,\r\n\t\t[ LessEqualCompare ]: _gl.LEQUAL,\r\n\t\t[ EqualCompare ]: _gl.EQUAL,\r\n\t\t[ GreaterEqualCompare ]: _gl.GEQUAL,\r\n\t\t[ GreaterCompare ]: _gl.GREATER,\r\n\t\t[ NotEqualCompare ]: _gl.NOTEQUAL\r\n\t};\r\n\r\n\tfunction setTextureParameters( textureType, texture ) {\r\n\r\n\t\tif ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false &&\r\n\t\t\t( texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter ||\r\n\t\t\ttexture.minFilter === LinearFilter || texture.minFilter === LinearMipmapNearestFilter || texture.minFilter === NearestMipmapLinearFilter || texture.minFilter === LinearMipmapLinearFilter ) ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.' );\r\n\r\n\t\t}\r\n\r\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );\r\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );\r\n\r\n\t\tif ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {\r\n\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );\r\n\r\n\t\t}\r\n\r\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );\r\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );\r\n\r\n\t\tif ( texture.compareFunction ) {\r\n\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE );\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_FUNC, compareToGL[ texture.compareFunction ] );\r\n\r\n\t\t}\r\n\r\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\r\n\r\n\t\t\tif ( texture.magFilter === NearestFilter ) return;\r\n\t\t\tif ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;\r\n\t\t\tif ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension\r\n\r\n\t\t\tif ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {\r\n\r\n\t\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\r\n\t\t\t\t_gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) );\r\n\t\t\t\tproperties.get( texture ).__currentAnisotropy = texture.anisotropy;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction initTexture( textureProperties, texture ) {\r\n\r\n\t\tlet forceUpload = false;\r\n\r\n\t\tif ( textureProperties.__webglInit === undefined ) {\r\n\r\n\t\t\ttextureProperties.__webglInit = true;\r\n\r\n\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\r\n\r\n\t\t}\r\n\r\n\t\t// create Source <-> WebGLTextures mapping if necessary\r\n\r\n\t\tconst source = texture.source;\r\n\t\tlet webglTextures = _sources.get( source );\r\n\r\n\t\tif ( webglTextures === undefined ) {\r\n\r\n\t\t\twebglTextures = {};\r\n\t\t\t_sources.set( source, webglTextures );\r\n\r\n\t\t}\r\n\r\n\t\t// check if there is already a WebGLTexture object for the given texture parameters\r\n\r\n\t\tconst textureCacheKey = getTextureCacheKey( texture );\r\n\r\n\t\tif ( textureCacheKey !== textureProperties.__cacheKey ) {\r\n\r\n\t\t\t// if not, create a new instance of WebGLTexture\r\n\r\n\t\t\tif ( webglTextures[ textureCacheKey ] === undefined ) {\r\n\r\n\t\t\t\t// create new entry\r\n\r\n\t\t\t\twebglTextures[ textureCacheKey ] = {\r\n\t\t\t\t\ttexture: _gl.createTexture(),\r\n\t\t\t\t\tusedTimes: 0\r\n\t\t\t\t};\r\n\r\n\t\t\t\tinfo.memory.textures ++;\r\n\r\n\t\t\t\t// when a new instance of WebGLTexture was created, a texture upload is required\r\n\t\t\t\t// even if the image contents are identical\r\n\r\n\t\t\t\tforceUpload = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t\twebglTextures[ textureCacheKey ].usedTimes ++;\r\n\r\n\t\t\t// every time the texture cache key changes, it's necessary to check if an instance of\r\n\t\t\t// WebGLTexture can be deleted in order to avoid a memory leak.\r\n\r\n\t\t\tconst webglTexture = webglTextures[ textureProperties.__cacheKey ];\r\n\r\n\t\t\tif ( webglTexture !== undefined ) {\r\n\r\n\t\t\t\twebglTextures[ textureProperties.__cacheKey ].usedTimes --;\r\n\r\n\t\t\t\tif ( webglTexture.usedTimes === 0 ) {\r\n\r\n\t\t\t\t\tdeleteTexture( texture );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// store references to cache key and WebGLTexture object\r\n\r\n\t\t\ttextureProperties.__cacheKey = textureCacheKey;\r\n\t\t\ttextureProperties.__webglTexture = webglTextures[ textureCacheKey ].texture;\r\n\r\n\t\t}\r\n\r\n\t\treturn forceUpload;\r\n\r\n\t}\r\n\r\n\tfunction uploadTexture( textureProperties, texture, slot ) {\r\n\r\n\t\tlet textureType = _gl.TEXTURE_2D;\r\n\r\n\t\tif ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) textureType = _gl.TEXTURE_2D_ARRAY;\r\n\t\tif ( texture.isData3DTexture ) textureType = _gl.TEXTURE_3D;\r\n\r\n\t\tconst forceUpload = initTexture( textureProperties, texture );\r\n\t\tconst source = texture.source;\r\n\r\n\t\tstate.bindTexture( textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\r\n\r\n\t\tconst sourceProperties = properties.get( source );\r\n\r\n\t\tif ( source.version !== sourceProperties.__version || forceUpload === true ) {\r\n\r\n\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\r\n\r\n\t\t\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\r\n\t\t\tconst texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );\r\n\t\t\tconst unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;\r\n\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );\r\n\r\n\t\t\tlet image = resizeImage( texture.image, false, capabilities.maxTextureSize );\r\n\t\t\timage = verifyColorSpace( texture, image );\r\n\r\n\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\r\n\r\n\t\t\tconst glType = utils.convert( texture.type );\r\n\t\t\tlet glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );\r\n\r\n\t\t\tsetTextureParameters( textureType, texture );\r\n\r\n\t\t\tlet mipmap;\r\n\t\t\tconst mipmaps = texture.mipmaps;\r\n\r\n\t\t\tconst useTexStorage = ( texture.isVideoTexture !== true );\r\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\r\n\t\t\tconst dataReady = source.dataReady;\r\n\t\t\tconst levels = getMipLevels( texture, image );\r\n\r\n\t\t\tif ( texture.isDepthTexture ) {\r\n\r\n\t\t\t\tglInternalFormat = getInternalDepthFormat( texture.format === DepthStencilFormat, texture.type );\r\n\r\n\t\t\t\t//\r\n\r\n\t\t\t\tif ( allocateMemory ) {\r\n\r\n\t\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, 1, glInternalFormat, image.width, image.height );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( texture.isDataTexture ) {\r\n\r\n\t\t\t\t// use manually created mipmaps if available\r\n\t\t\t\t// if there are no manual mipmaps\r\n\t\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\r\n\r\n\t\t\t\tif ( mipmaps.length > 0 ) {\r\n\r\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\r\n\r\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\r\n\r\n\t\t\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\t\t\tif ( dataReady ) {\r\n\r\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttexture.generateMipmaps = false;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\t\tif ( allocateMemory ) {\r\n\r\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( dataReady ) {\r\n\r\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( texture.isCompressedTexture ) {\r\n\r\n\t\t\t\tif ( texture.isCompressedArrayTexture ) {\r\n\r\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\r\n\r\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height, image.depth );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\r\n\r\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\r\n\r\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\r\n\r\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\t\t\t\t\tif ( dataReady ) {\r\n\r\n\t\t\t\t\t\t\t\t\t\tif ( texture.layerUpdates.size > 0 ) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tconst layerByteLength = getByteLength( mipmap.width, mipmap.height, texture.format, texture.type );\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tfor ( const layerIndex of texture.layerUpdates ) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tconst layerData = mipmap.data.subarray(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tlayerIndex * layerByteLength / mipmap.data.BYTES_PER_ELEMENT,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t( layerIndex + 1 ) * layerByteLength / mipmap.data.BYTES_PER_ELEMENT\r\n\t\t\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, layerIndex, mipmap.width, mipmap.height, 1, glFormat, layerData, 0, 0 );\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\ttexture.clearLayerUpdates();\r\n\r\n\t\t\t\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0 );\r\n\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0 );\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\t\t\t\tif ( dataReady ) {\r\n\r\n\t\t\t\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data );\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\r\n\r\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\r\n\r\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\r\n\r\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\r\n\r\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\t\t\t\t\tif ( dataReady ) {\r\n\r\n\t\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );\r\n\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\t\t\t\tif ( dataReady ) {\r\n\r\n\t\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( texture.isDataArrayTexture ) {\r\n\r\n\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\tif ( allocateMemory ) {\r\n\r\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, image.width, image.height, image.depth );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( dataReady ) {\r\n\r\n\t\t\t\t\t\tif ( texture.layerUpdates.size > 0 ) {\r\n\r\n\t\t\t\t\t\t\tconst layerByteLength = getByteLength( image.width, image.height, texture.format, texture.type );\r\n\r\n\t\t\t\t\t\t\tfor ( const layerIndex of texture.layerUpdates ) {\r\n\r\n\t\t\t\t\t\t\t\tconst layerData = image.data.subarray(\r\n\t\t\t\t\t\t\t\t\tlayerIndex * layerByteLength / image.data.BYTES_PER_ELEMENT,\r\n\t\t\t\t\t\t\t\t\t( layerIndex + 1 ) * layerByteLength / image.data.BYTES_PER_ELEMENT\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, layerIndex, image.width, image.height, 1, glFormat, glType, layerData );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\ttexture.clearLayerUpdates();\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( texture.isData3DTexture ) {\r\n\r\n\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\tif ( allocateMemory ) {\r\n\r\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_3D, levels, glInternalFormat, image.width, image.height, image.depth );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( dataReady ) {\r\n\r\n\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( texture.isFramebufferTexture ) {\r\n\r\n\t\t\t\tif ( allocateMemory ) {\r\n\r\n\t\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tlet width = image.width, height = image.height;\r\n\r\n\t\t\t\t\t\tfor ( let i = 0; i < levels; i ++ ) {\r\n\r\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, width, height, 0, glFormat, glType, null );\r\n\r\n\t\t\t\t\t\t\twidth >>= 1;\r\n\t\t\t\t\t\t\theight >>= 1;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// regular Texture (image, video, canvas)\r\n\r\n\t\t\t\t// use manually created mipmaps if available\r\n\t\t\t\t// if there are no manual mipmaps\r\n\t\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\r\n\r\n\t\t\t\tif ( mipmaps.length > 0 ) {\r\n\r\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\r\n\r\n\t\t\t\t\t\tconst dimensions = getDimensions( mipmaps[ 0 ] );\r\n\r\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\r\n\r\n\t\t\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\t\t\tif ( dataReady ) {\r\n\r\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttexture.generateMipmaps = false;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\t\tif ( allocateMemory ) {\r\n\r\n\t\t\t\t\t\t\tconst dimensions = getDimensions( image );\r\n\r\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( dataReady ) {\r\n\r\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\r\n\r\n\t\t\t\tgenerateMipmap( textureType );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tsourceProperties.__version = source.version;\r\n\r\n\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\r\n\r\n\t\t}\r\n\r\n\t\ttextureProperties.__version = texture.version;\r\n\r\n\t}\r\n\r\n\tfunction uploadCubeTexture( textureProperties, texture, slot ) {\r\n\r\n\t\tif ( texture.image.length !== 6 ) return;\r\n\r\n\t\tconst forceUpload = initTexture( textureProperties, texture );\r\n\t\tconst source = texture.source;\r\n\r\n\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\r\n\r\n\t\tconst sourceProperties = properties.get( source );\r\n\r\n\t\tif ( source.version !== sourceProperties.__version || forceUpload === true ) {\r\n\r\n\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\r\n\r\n\t\t\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\r\n\t\t\tconst texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );\r\n\t\t\tconst unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;\r\n\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );\r\n\r\n\t\t\tconst isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );\r\n\t\t\tconst isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );\r\n\r\n\t\t\tconst cubeImage = [];\r\n\r\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\t\tif ( ! isCompressed && ! isDataTexture ) {\r\n\r\n\t\t\t\t\tcubeImage[ i ] = resizeImage( texture.image[ i ], true, capabilities.maxCubemapSize );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tcubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tcubeImage[ i ] = verifyColorSpace( texture, cubeImage[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst image = cubeImage[ 0 ],\r\n\t\t\t\tglFormat = utils.convert( texture.format, texture.colorSpace ),\r\n\t\t\t\tglType = utils.convert( texture.type ),\r\n\t\t\t\tglInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\r\n\r\n\t\t\tconst useTexStorage = ( texture.isVideoTexture !== true );\r\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\r\n\t\t\tconst dataReady = source.dataReady;\r\n\t\t\tlet levels = getMipLevels( texture, image );\r\n\r\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );\r\n\r\n\t\t\tlet mipmaps;\r\n\r\n\t\t\tif ( isCompressed ) {\r\n\r\n\t\t\t\tif ( useTexStorage && allocateMemory ) {\r\n\r\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, image.width, image.height );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\t\t\tmipmaps = cubeImage[ i ].mipmaps;\r\n\r\n\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\r\n\r\n\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\r\n\r\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\r\n\r\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\r\n\r\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\t\t\t\t\tif ( dataReady ) {\r\n\r\n\t\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );\r\n\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()' );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\t\t\t\tif ( dataReady ) {\r\n\r\n\t\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tmipmaps = texture.mipmaps;\r\n\r\n\t\t\t\tif ( useTexStorage && allocateMemory ) {\r\n\r\n\t\t\t\t\t// TODO: Uniformly handle mipmap definitions\r\n\t\t\t\t\t// Normal textures and compressed cube textures define base level + mips with their mipmap array\r\n\t\t\t\t\t// Uncompressed cube textures use their mipmap array only for mips (no base level)\r\n\r\n\t\t\t\t\tif ( mipmaps.length > 0 ) levels ++;\r\n\r\n\t\t\t\t\tconst dimensions = getDimensions( cubeImage[ 0 ] );\r\n\r\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, dimensions.width, dimensions.height );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\t\t\tif ( isDataTexture ) {\r\n\r\n\t\t\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\t\t\tif ( dataReady ) {\r\n\r\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, cubeImage[ i ].width, cubeImage[ i ].height, glFormat, glType, cubeImage[ i ].data );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\r\n\r\n\t\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\r\n\t\t\t\t\t\t\tconst mipmapImage = mipmap.image[ i ].image;\r\n\r\n\t\t\t\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\t\t\t\tif ( dataReady ) {\r\n\r\n\t\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data );\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\t\t\tif ( dataReady ) {\r\n\r\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, glFormat, glType, cubeImage[ i ] );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[ i ] );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\r\n\r\n\t\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\r\n\r\n\t\t\t\t\t\t\tif ( useTexStorage ) {\r\n\r\n\t\t\t\t\t\t\t\tif ( dataReady ) {\r\n\r\n\t\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[ i ] );\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[ i ] );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\r\n\r\n\t\t\t\t// We assume images for cube map have the same size.\r\n\t\t\t\tgenerateMipmap( _gl.TEXTURE_CUBE_MAP );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tsourceProperties.__version = source.version;\r\n\r\n\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\r\n\r\n\t\t}\r\n\r\n\t\ttextureProperties.__version = texture.version;\r\n\r\n\t}\r\n\r\n\t// Render targets\r\n\r\n\t// Setup storage for target texture and bind it to correct framebuffer\r\n\tfunction setupFrameBufferTexture( framebuffer, renderTarget, texture, attachment, textureTarget, level ) {\r\n\r\n\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\r\n\t\tconst glType = utils.convert( texture.type );\r\n\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\r\n\t\tconst renderTargetProperties = properties.get( renderTarget );\r\n\r\n\t\tif ( ! renderTargetProperties.__hasExternalTextures ) {\r\n\r\n\t\t\tconst width = Math.max( 1, renderTarget.width >> level );\r\n\t\t\tconst height = Math.max( 1, renderTarget.height >> level );\r\n\r\n\t\t\tif ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {\r\n\r\n\t\t\t\tstate.texImage3D( textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tstate.texImage2D( textureTarget, level, glInternalFormat, width, height, 0, glFormat, glType, null );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\r\n\r\n\t\tif ( useMultisampledRTT( renderTarget ) ) {\r\n\r\n\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, 0, getRenderTargetSamples( renderTarget ) );\r\n\r\n\t\t} else if ( textureTarget === _gl.TEXTURE_2D || ( textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z ) ) { // see #24753\r\n\r\n\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, level );\r\n\r\n\t\t}\r\n\r\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\r\n\r\n\t}\r\n\r\n\t// Setup storage for internal depth/stencil buffers and bind to correct framebuffer\r\n\tfunction setupRenderBufferStorage( renderbuffer, renderTarget, isMultisample ) {\r\n\r\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );\r\n\r\n\t\tif ( renderTarget.depthBuffer ) {\r\n\r\n\t\t\t// retrieve the depth attachment types\r\n\t\t\tconst depthTexture = renderTarget.depthTexture;\r\n\t\t\tconst depthType = depthTexture && depthTexture.isDepthTexture ? depthTexture.type : null;\r\n\t\t\tconst glInternalFormat = getInternalDepthFormat( renderTarget.stencilBuffer, depthType );\r\n\t\t\tconst glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\r\n\r\n\t\t\t// set up the attachment\r\n\t\t\tconst samples = getRenderTargetSamples( renderTarget );\r\n\t\t\tconst isUseMultisampledRTT = useMultisampledRTT( renderTarget );\r\n\t\t\tif ( isUseMultisampledRTT ) {\r\n\r\n\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\r\n\r\n\t\t\t} else if ( isMultisample ) {\r\n\r\n\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, glAttachmentType, _gl.RENDERBUFFER, renderbuffer );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst textures = renderTarget.textures;\r\n\r\n\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\r\n\r\n\t\t\t\tconst texture = textures[ i ];\r\n\r\n\t\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\r\n\t\t\t\tconst glType = utils.convert( texture.type );\r\n\t\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\r\n\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\r\n\r\n\t\t\t\tif ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {\r\n\r\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\r\n\r\n\t\t\t\t} else if ( useMultisampledRTT( renderTarget ) ) {\r\n\r\n\t\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\r\n\r\n\t}\r\n\r\n\t// Setup resources for a Depth Texture for a FBO (needs an extension)\r\n\tfunction setupDepthTexture( framebuffer, renderTarget ) {\r\n\r\n\t\tconst isCube = ( renderTarget && renderTarget.isWebGLCubeRenderTarget );\r\n\t\tif ( isCube ) throw new Error( 'Depth Texture with cube render targets is not supported' );\r\n\r\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\r\n\r\n\t\tif ( ! ( renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture ) ) {\r\n\r\n\t\t\tthrow new Error( 'renderTarget.depthTexture must be an instance of THREE.DepthTexture' );\r\n\r\n\t\t}\r\n\r\n\t\t// upload an empty depth texture with framebuffer size\r\n\t\tif ( ! properties.get( renderTarget.depthTexture ).__webglTexture ||\r\n\t\t\t\trenderTarget.depthTexture.image.width !== renderTarget.width ||\r\n\t\t\t\trenderTarget.depthTexture.image.height !== renderTarget.height ) {\r\n\r\n\t\t\trenderTarget.depthTexture.image.width = renderTarget.width;\r\n\t\t\trenderTarget.depthTexture.image.height = renderTarget.height;\r\n\t\t\trenderTarget.depthTexture.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t\tsetTexture2D( renderTarget.depthTexture, 0 );\r\n\r\n\t\tconst webglDepthTexture = properties.get( renderTarget.depthTexture ).__webglTexture;\r\n\t\tconst samples = getRenderTargetSamples( renderTarget );\r\n\r\n\t\tif ( renderTarget.depthTexture.format === DepthFormat ) {\r\n\r\n\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\r\n\r\n\t\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {\r\n\r\n\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\r\n\r\n\t\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthrow new Error( 'Unknown depthTexture format' );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Setup GL resources for a non-texture depth buffer\r\n\tfunction setupDepthRenderbuffer( renderTarget ) {\r\n\r\n\t\tconst renderTargetProperties = properties.get( renderTarget );\r\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\r\n\r\n\t\t// if the bound depth texture has changed\r\n\t\tif ( renderTargetProperties.__boundDepthTexture !== renderTarget.depthTexture ) {\r\n\r\n\t\t\t// fire the dispose event to get rid of stored state associated with the previously bound depth buffer\r\n\t\t\tconst depthTexture = renderTarget.depthTexture;\r\n\t\t\tif ( renderTargetProperties.__depthDisposeCallback ) {\r\n\r\n\t\t\t\trenderTargetProperties.__depthDisposeCallback();\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// set up dispose listeners to track when the currently attached buffer is implicitly unbound\r\n\t\t\tif ( depthTexture ) {\r\n\r\n\t\t\t\tconst disposeEvent = () => {\r\n\r\n\t\t\t\t\tdelete renderTargetProperties.__boundDepthTexture;\r\n\t\t\t\t\tdelete renderTargetProperties.__depthDisposeCallback;\r\n\t\t\t\t\tdepthTexture.removeEventListener( 'dispose', disposeEvent );\r\n\r\n\t\t\t\t};\r\n\r\n\t\t\t\tdepthTexture.addEventListener( 'dispose', disposeEvent );\r\n\t\t\t\trenderTargetProperties.__depthDisposeCallback = disposeEvent;\r\n\r\n\t\t\t}\r\n\r\n\t\t\trenderTargetProperties.__boundDepthTexture = depthTexture;\r\n\r\n\t\t}\r\n\r\n\t\tif ( renderTarget.depthTexture && ! renderTargetProperties.__autoAllocateDepthBuffer ) {\r\n\r\n\t\t\tif ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' );\r\n\r\n\t\t\tsetupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tif ( isCube ) {\r\n\r\n\t\t\t\trenderTargetProperties.__webglDepthbuffer = [];\r\n\r\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ i ] );\r\n\r\n\t\t\t\t\tif ( renderTargetProperties.__webglDepthbuffer[ i ] === undefined ) {\r\n\r\n\t\t\t\t\t\trenderTargetProperties.__webglDepthbuffer[ i ] = _gl.createRenderbuffer();\r\n\t\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer[ i ], renderTarget, false );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t// attach buffer if it's been created already\r\n\t\t\t\t\t\tconst glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\r\n\t\t\t\t\t\tconst renderbuffer = renderTargetProperties.__webglDepthbuffer[ i ];\r\n\t\t\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );\r\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, glAttachmentType, _gl.RENDERBUFFER, renderbuffer );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\r\n\r\n\t\t\t\tif ( renderTargetProperties.__webglDepthbuffer === undefined ) {\r\n\r\n\t\t\t\t\trenderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();\r\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget, false );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// attach buffer if it's been created already\r\n\t\t\t\t\tconst glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\r\n\t\t\t\t\tconst renderbuffer = renderTargetProperties.__webglDepthbuffer;\r\n\t\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );\r\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, glAttachmentType, _gl.RENDERBUFFER, renderbuffer );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\r\n\r\n\t}\r\n\r\n\t// rebind framebuffer with external textures\r\n\tfunction rebindTextures( renderTarget, colorTexture, depthTexture ) {\r\n\r\n\t\tconst renderTargetProperties = properties.get( renderTarget );\r\n\r\n\t\tif ( colorTexture !== undefined ) {\r\n\r\n\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, 0 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( depthTexture !== undefined ) {\r\n\r\n\t\t\tsetupDepthRenderbuffer( renderTarget );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Set up GL resources for the render target\r\n\tfunction setupRenderTarget( renderTarget ) {\r\n\r\n\t\tconst texture = renderTarget.texture;\r\n\r\n\t\tconst renderTargetProperties = properties.get( renderTarget );\r\n\t\tconst textureProperties = properties.get( texture );\r\n\r\n\t\trenderTarget.addEventListener( 'dispose', onRenderTargetDispose );\r\n\r\n\t\tconst textures = renderTarget.textures;\r\n\r\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\r\n\t\tconst isMultipleRenderTargets = ( textures.length > 1 );\r\n\r\n\t\tif ( ! isMultipleRenderTargets ) {\r\n\r\n\t\t\tif ( textureProperties.__webglTexture === undefined ) {\r\n\r\n\t\t\t\ttextureProperties.__webglTexture = _gl.createTexture();\r\n\r\n\t\t\t}\r\n\r\n\t\t\ttextureProperties.__version = texture.version;\r\n\t\t\tinfo.memory.textures ++;\r\n\r\n\t\t}\r\n\r\n\t\t// Setup framebuffer\r\n\r\n\t\tif ( isCube ) {\r\n\r\n\t\t\trenderTargetProperties.__webglFramebuffer = [];\r\n\r\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\t\tif ( texture.mipmaps && texture.mipmaps.length > 0 ) {\r\n\r\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = [];\r\n\r\n\t\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\r\n\r\n\t\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ][ level ] = _gl.createFramebuffer();\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = _gl.createFramebuffer();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tif ( texture.mipmaps && texture.mipmaps.length > 0 ) {\r\n\r\n\t\t\t\trenderTargetProperties.__webglFramebuffer = [];\r\n\r\n\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\r\n\r\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ level ] = _gl.createFramebuffer();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\trenderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( isMultipleRenderTargets ) {\r\n\r\n\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tconst attachmentProperties = properties.get( textures[ i ] );\r\n\r\n\t\t\t\t\tif ( attachmentProperties.__webglTexture === undefined ) {\r\n\r\n\t\t\t\t\t\tattachmentProperties.__webglTexture = _gl.createTexture();\r\n\r\n\t\t\t\t\t\tinfo.memory.textures ++;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( ( renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {\r\n\r\n\t\t\t\trenderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();\r\n\t\t\t\trenderTargetProperties.__webglColorRenderbuffer = [];\r\n\r\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\r\n\r\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\r\n\r\n\t\t\t\t\tconst texture = textures[ i ];\r\n\t\t\t\t\trenderTargetProperties.__webglColorRenderbuffer[ i ] = _gl.createRenderbuffer();\r\n\r\n\t\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\r\n\r\n\t\t\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\r\n\t\t\t\t\tconst glType = utils.convert( texture.type );\r\n\t\t\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, renderTarget.isXRRenderTarget === true );\r\n\t\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\r\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\r\n\r\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\r\n\r\n\t\t\t\tif ( renderTarget.depthBuffer ) {\r\n\r\n\t\t\t\t\trenderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer();\r\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// Setup color buffer\r\n\r\n\t\tif ( isCube ) {\r\n\r\n\t\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture );\r\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );\r\n\r\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\t\tif ( texture.mipmaps && texture.mipmaps.length > 0 ) {\r\n\r\n\t\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\r\n\r\n\t\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ][ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\r\n\r\n\t\t\t\tgenerateMipmap( _gl.TEXTURE_CUBE_MAP );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tstate.unbindTexture();\r\n\r\n\t\t} else if ( isMultipleRenderTargets ) {\r\n\r\n\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tconst attachment = textures[ i ];\r\n\t\t\t\tconst attachmentProperties = properties.get( attachment );\r\n\r\n\t\t\t\tstate.bindTexture( _gl.TEXTURE_2D, attachmentProperties.__webglTexture );\r\n\t\t\t\tsetTextureParameters( _gl.TEXTURE_2D, attachment );\r\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0 );\r\n\r\n\t\t\t\tif ( textureNeedsGenerateMipmaps( attachment ) ) {\r\n\r\n\t\t\t\t\tgenerateMipmap( _gl.TEXTURE_2D );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tstate.unbindTexture();\r\n\r\n\t\t} else {\r\n\r\n\t\t\tlet glTextureType = _gl.TEXTURE_2D;\r\n\r\n\t\t\tif ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {\r\n\r\n\t\t\t\tglTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tstate.bindTexture( glTextureType, textureProperties.__webglTexture );\r\n\t\t\tsetTextureParameters( glTextureType, texture );\r\n\r\n\t\t\tif ( texture.mipmaps && texture.mipmaps.length > 0 ) {\r\n\r\n\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\r\n\r\n\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, level );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\r\n\r\n\t\t\t\tgenerateMipmap( glTextureType );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tstate.unbindTexture();\r\n\r\n\t\t}\r\n\r\n\t\t// Setup depth and stencil buffers\r\n\r\n\t\tif ( renderTarget.depthBuffer ) {\r\n\r\n\t\t\tsetupDepthRenderbuffer( renderTarget );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction updateRenderTargetMipmap( renderTarget ) {\r\n\r\n\t\tconst textures = renderTarget.textures;\r\n\r\n\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\r\n\r\n\t\t\tconst texture = textures[ i ];\r\n\r\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\r\n\r\n\t\t\t\tconst target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D;\r\n\t\t\t\tconst webglTexture = properties.get( texture ).__webglTexture;\r\n\r\n\t\t\t\tstate.bindTexture( target, webglTexture );\r\n\t\t\t\tgenerateMipmap( target );\r\n\t\t\t\tstate.unbindTexture();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tconst invalidationArrayRead = [];\r\n\tconst invalidationArrayDraw = [];\r\n\r\n\tfunction updateMultisampleRenderTarget( renderTarget ) {\r\n\r\n\t\tif ( renderTarget.samples > 0 ) {\r\n\r\n\t\t\tif ( useMultisampledRTT( renderTarget ) === false ) {\r\n\r\n\t\t\t\tconst textures = renderTarget.textures;\r\n\t\t\t\tconst width = renderTarget.width;\r\n\t\t\t\tconst height = renderTarget.height;\r\n\t\t\t\tlet mask = _gl.COLOR_BUFFER_BIT;\r\n\t\t\t\tconst depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\r\n\t\t\t\tconst renderTargetProperties = properties.get( renderTarget );\r\n\t\t\t\tconst isMultipleRenderTargets = ( textures.length > 1 );\r\n\r\n\t\t\t\t// If MRT we need to remove FBO attachments\r\n\t\t\t\tif ( isMultipleRenderTargets ) {\r\n\r\n\t\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\r\n\r\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\r\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, null );\r\n\r\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\r\n\t\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, null, 0 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\r\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\r\n\r\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\r\n\r\n\t\t\t\t\tif ( renderTarget.resolveDepthBuffer ) {\r\n\r\n\t\t\t\t\t\tif ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT;\r\n\r\n\t\t\t\t\t\t// resolving stencil is slow with a D3D backend. disable it for all transmission render targets (see #27799)\r\n\r\n\t\t\t\t\t\tif ( renderTarget.stencilBuffer && renderTarget.resolveStencilBuffer ) mask |= _gl.STENCIL_BUFFER_BIT;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( isMultipleRenderTargets ) {\r\n\r\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\r\n\r\n\t\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\r\n\t\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST );\r\n\r\n\t\t\t\t\tif ( supportsInvalidateFramebuffer === true ) {\r\n\r\n\t\t\t\t\t\tinvalidationArrayRead.length = 0;\r\n\t\t\t\t\t\tinvalidationArrayDraw.length = 0;\r\n\r\n\t\t\t\t\t\tinvalidationArrayRead.push( _gl.COLOR_ATTACHMENT0 + i );\r\n\r\n\t\t\t\t\t\tif ( renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false ) {\r\n\r\n\t\t\t\t\t\t\tinvalidationArrayRead.push( depthStyle );\r\n\t\t\t\t\t\t\tinvalidationArrayDraw.push( depthStyle );\r\n\r\n\t\t\t\t\t\t\t_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, invalidationArrayDraw );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, invalidationArrayRead );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );\r\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );\r\n\r\n\t\t\t\t// If MRT since pre-blit we removed the FBO we need to reconstruct the attachments\r\n\t\t\t\tif ( isMultipleRenderTargets ) {\r\n\r\n\t\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\r\n\r\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\r\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\r\n\r\n\t\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\r\n\r\n\t\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\r\n\t\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, webglTexture, 0 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif ( renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false && supportsInvalidateFramebuffer ) {\r\n\r\n\t\t\t\t\tconst depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\r\n\r\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction getRenderTargetSamples( renderTarget ) {\r\n\r\n\t\treturn Math.min( capabilities.maxSamples, renderTarget.samples );\r\n\r\n\t}\r\n\r\n\tfunction useMultisampledRTT( renderTarget ) {\r\n\r\n\t\tconst renderTargetProperties = properties.get( renderTarget );\r\n\r\n\t\treturn renderTarget.samples > 0 && extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTargetProperties.__useRenderToTexture !== false;\r\n\r\n\t}\r\n\r\n\tfunction updateVideoTexture( texture ) {\r\n\r\n\t\tconst frame = info.render.frame;\r\n\r\n\t\t// Check the last frame we updated the VideoTexture\r\n\r\n\t\tif ( _videoTextures.get( texture ) !== frame ) {\r\n\r\n\t\t\t_videoTextures.set( texture, frame );\r\n\t\t\ttexture.update();\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction verifyColorSpace( texture, image ) {\r\n\r\n\t\tconst colorSpace = texture.colorSpace;\r\n\t\tconst format = texture.format;\r\n\t\tconst type = texture.type;\r\n\r\n\t\tif ( texture.isCompressedTexture === true || texture.isVideoTexture === true ) return image;\r\n\r\n\t\tif ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {\r\n\r\n\t\t\t// sRGB\r\n\r\n\t\t\tif ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {\r\n\r\n\t\t\t\t// in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format\r\n\r\n\t\t\t\tif ( format !== RGBAFormat || type !== UnsignedByteType ) {\r\n\r\n\t\t\t\t\tconsole.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconsole.error( 'THREE.WebGLTextures: Unsupported texture color space:', colorSpace );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn image;\r\n\r\n\t}\r\n\r\n\tfunction getDimensions( image ) {\r\n\r\n\t\tif ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) {\r\n\r\n\t\t\t// if intrinsic data are not available, fallback to width/height\r\n\r\n\t\t\t_imageDimensions.width = image.naturalWidth || image.width;\r\n\t\t\t_imageDimensions.height = image.naturalHeight || image.height;\r\n\r\n\t\t} else if ( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) {\r\n\r\n\t\t\t_imageDimensions.width = image.displayWidth;\r\n\t\t\t_imageDimensions.height = image.displayHeight;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_imageDimensions.width = image.width;\r\n\t\t\t_imageDimensions.height = image.height;\r\n\r\n\t\t}\r\n\r\n\t\treturn _imageDimensions;\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tthis.allocateTextureUnit = allocateTextureUnit;\r\n\tthis.resetTextureUnits = resetTextureUnits;\r\n\r\n\tthis.setTexture2D = setTexture2D;\r\n\tthis.setTexture2DArray = setTexture2DArray;\r\n\tthis.setTexture3D = setTexture3D;\r\n\tthis.setTextureCube = setTextureCube;\r\n\tthis.rebindTextures = rebindTextures;\r\n\tthis.setupRenderTarget = setupRenderTarget;\r\n\tthis.updateRenderTargetMipmap = updateRenderTargetMipmap;\r\n\tthis.updateMultisampleRenderTarget = updateMultisampleRenderTarget;\r\n\tthis.setupDepthRenderbuffer = setupDepthRenderbuffer;\r\n\tthis.setupFrameBufferTexture = setupFrameBufferTexture;\r\n\tthis.useMultisampledRTT = useMultisampledRTT;\r\n\r\n}\r\n\r\nfunction WebGLUtils( gl, extensions ) {\r\n\r\n\tfunction convert( p, colorSpace = NoColorSpace ) {\r\n\r\n\t\tlet extension;\r\n\r\n\t\tconst transfer = ColorManagement.getTransfer( colorSpace );\r\n\r\n\t\tif ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;\r\n\t\tif ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;\r\n\t\tif ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;\r\n\t\tif ( p === UnsignedInt5999Type ) return gl.UNSIGNED_INT_5_9_9_9_REV;\r\n\r\n\t\tif ( p === ByteType ) return gl.BYTE;\r\n\t\tif ( p === ShortType ) return gl.SHORT;\r\n\t\tif ( p === UnsignedShortType ) return gl.UNSIGNED_SHORT;\r\n\t\tif ( p === IntType ) return gl.INT;\r\n\t\tif ( p === UnsignedIntType ) return gl.UNSIGNED_INT;\r\n\t\tif ( p === FloatType ) return gl.FLOAT;\r\n\t\tif ( p === HalfFloatType ) return gl.HALF_FLOAT;\r\n\r\n\t\tif ( p === AlphaFormat ) return gl.ALPHA;\r\n\t\tif ( p === RGBFormat ) return gl.RGB;\r\n\t\tif ( p === RGBAFormat ) return gl.RGBA;\r\n\t\tif ( p === LuminanceFormat ) return gl.LUMINANCE;\r\n\t\tif ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;\r\n\t\tif ( p === DepthFormat ) return gl.DEPTH_COMPONENT;\r\n\t\tif ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;\r\n\r\n\t\t// WebGL2 formats.\r\n\r\n\t\tif ( p === RedFormat ) return gl.RED;\r\n\t\tif ( p === RedIntegerFormat ) return gl.RED_INTEGER;\r\n\t\tif ( p === RGFormat ) return gl.RG;\r\n\t\tif ( p === RGIntegerFormat ) return gl.RG_INTEGER;\r\n\t\tif ( p === RGBAIntegerFormat ) return gl.RGBA_INTEGER;\r\n\r\n\t\t// S3TC\r\n\r\n\t\tif ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {\r\n\r\n\t\t\tif ( transfer === SRGBTransfer ) {\r\n\r\n\t\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc_srgb' );\r\n\r\n\t\t\t\tif ( extension !== null ) {\r\n\r\n\t\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT;\r\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;\r\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;\r\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn null;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc' );\r\n\r\n\t\t\t\tif ( extension !== null ) {\r\n\r\n\t\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;\r\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;\r\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;\r\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn null;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// PVRTC\r\n\r\n\t\tif ( p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format ) {\r\n\r\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_pvrtc' );\r\n\r\n\t\t\tif ( extension !== null ) {\r\n\r\n\t\t\t\tif ( p === RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;\r\n\t\t\t\tif ( p === RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;\r\n\t\t\t\tif ( p === RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;\r\n\t\t\t\tif ( p === RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\treturn null;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// ETC\r\n\r\n\t\tif ( p === RGB_ETC1_Format || p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {\r\n\r\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_etc' );\r\n\r\n\t\t\tif ( extension !== null ) {\r\n\r\n\t\t\t\tif ( p === RGB_ETC1_Format || p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;\r\n\t\t\t\tif ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\treturn null;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// ASTC\r\n\r\n\t\tif ( p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format ||\r\n\t\t\tp === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format ||\r\n\t\t\tp === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format ||\r\n\t\t\tp === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format ||\r\n\t\t\tp === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format ) {\r\n\r\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_astc' );\r\n\r\n\t\t\tif ( extension !== null ) {\r\n\r\n\t\t\t\tif ( p === RGBA_ASTC_4x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;\r\n\t\t\t\tif ( p === RGBA_ASTC_5x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;\r\n\t\t\t\tif ( p === RGBA_ASTC_5x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;\r\n\t\t\t\tif ( p === RGBA_ASTC_6x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;\r\n\t\t\t\tif ( p === RGBA_ASTC_6x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;\r\n\t\t\t\tif ( p === RGBA_ASTC_8x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;\r\n\t\t\t\tif ( p === RGBA_ASTC_8x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;\r\n\t\t\t\tif ( p === RGBA_ASTC_8x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;\r\n\t\t\t\tif ( p === RGBA_ASTC_10x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;\r\n\t\t\t\tif ( p === RGBA_ASTC_10x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;\r\n\t\t\t\tif ( p === RGBA_ASTC_10x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;\r\n\t\t\t\tif ( p === RGBA_ASTC_10x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;\r\n\t\t\t\tif ( p === RGBA_ASTC_12x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;\r\n\t\t\t\tif ( p === RGBA_ASTC_12x12_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\treturn null;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// BPTC\r\n\r\n\t\tif ( p === RGBA_BPTC_Format || p === RGB_BPTC_SIGNED_Format || p === RGB_BPTC_UNSIGNED_Format ) {\r\n\r\n\t\t\textension = extensions.get( 'EXT_texture_compression_bptc' );\r\n\r\n\t\t\tif ( extension !== null ) {\r\n\r\n\t\t\t\tif ( p === RGBA_BPTC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;\r\n\t\t\t\tif ( p === RGB_BPTC_SIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;\r\n\t\t\t\tif ( p === RGB_BPTC_UNSIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\treturn null;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// RGTC\r\n\r\n\t\tif ( p === RED_RGTC1_Format || p === SIGNED_RED_RGTC1_Format || p === RED_GREEN_RGTC2_Format || p === SIGNED_RED_GREEN_RGTC2_Format ) {\r\n\r\n\t\t\textension = extensions.get( 'EXT_texture_compression_rgtc' );\r\n\r\n\t\t\tif ( extension !== null ) {\r\n\r\n\t\t\t\tif ( p === RGBA_BPTC_Format ) return extension.COMPRESSED_RED_RGTC1_EXT;\r\n\t\t\t\tif ( p === SIGNED_RED_RGTC1_Format ) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;\r\n\t\t\t\tif ( p === RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;\r\n\t\t\t\tif ( p === SIGNED_RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\treturn null;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t//\r\n\r\n\t\tif ( p === UnsignedInt248Type ) return gl.UNSIGNED_INT_24_8;\r\n\r\n\t\t// if \"p\" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)\r\n\r\n\t\treturn ( gl[ p ] !== undefined ) ? gl[ p ] : null;\r\n\r\n\t}\r\n\r\n\treturn { convert: convert };\r\n\r\n}\r\n\r\nclass ArrayCamera extends PerspectiveCamera {\r\n\r\n\tconstructor( array = [] ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isArrayCamera = true;\r\n\r\n\t\tthis.cameras = array;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Group extends Object3D {\r\n\r\n\tconstructor() {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isGroup = true;\r\n\r\n\t\tthis.type = 'Group';\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _moveEvent = { type: 'move' };\r\n\r\nclass WebXRController {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis._targetRay = null;\r\n\t\tthis._grip = null;\r\n\t\tthis._hand = null;\r\n\r\n\t}\r\n\r\n\tgetHandSpace() {\r\n\r\n\t\tif ( this._hand === null ) {\r\n\r\n\t\t\tthis._hand = new Group();\r\n\t\t\tthis._hand.matrixAutoUpdate = false;\r\n\t\t\tthis._hand.visible = false;\r\n\r\n\t\t\tthis._hand.joints = {};\r\n\t\t\tthis._hand.inputState = { pinching: false };\r\n\r\n\t\t}\r\n\r\n\t\treturn this._hand;\r\n\r\n\t}\r\n\r\n\tgetTargetRaySpace() {\r\n\r\n\t\tif ( this._targetRay === null ) {\r\n\r\n\t\t\tthis._targetRay = new Group();\r\n\t\t\tthis._targetRay.matrixAutoUpdate = false;\r\n\t\t\tthis._targetRay.visible = false;\r\n\t\t\tthis._targetRay.hasLinearVelocity = false;\r\n\t\t\tthis._targetRay.linearVelocity = new Vector3();\r\n\t\t\tthis._targetRay.hasAngularVelocity = false;\r\n\t\t\tthis._targetRay.angularVelocity = new Vector3();\r\n\r\n\t\t}\r\n\r\n\t\treturn this._targetRay;\r\n\r\n\t}\r\n\r\n\tgetGripSpace() {\r\n\r\n\t\tif ( this._grip === null ) {\r\n\r\n\t\t\tthis._grip = new Group();\r\n\t\t\tthis._grip.matrixAutoUpdate = false;\r\n\t\t\tthis._grip.visible = false;\r\n\t\t\tthis._grip.hasLinearVelocity = false;\r\n\t\t\tthis._grip.linearVelocity = new Vector3();\r\n\t\t\tthis._grip.hasAngularVelocity = false;\r\n\t\t\tthis._grip.angularVelocity = new Vector3();\r\n\r\n\t\t}\r\n\r\n\t\treturn this._grip;\r\n\r\n\t}\r\n\r\n\tdispatchEvent( event ) {\r\n\r\n\t\tif ( this._targetRay !== null ) {\r\n\r\n\t\t\tthis._targetRay.dispatchEvent( event );\r\n\r\n\t\t}\r\n\r\n\t\tif ( this._grip !== null ) {\r\n\r\n\t\t\tthis._grip.dispatchEvent( event );\r\n\r\n\t\t}\r\n\r\n\t\tif ( this._hand !== null ) {\r\n\r\n\t\t\tthis._hand.dispatchEvent( event );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tconnect( inputSource ) {\r\n\r\n\t\tif ( inputSource && inputSource.hand ) {\r\n\r\n\t\t\tconst hand = this._hand;\r\n\r\n\t\t\tif ( hand ) {\r\n\r\n\t\t\t\tfor ( const inputjoint of inputSource.hand.values() ) {\r\n\r\n\t\t\t\t\t// Initialize hand with joints when connected\r\n\t\t\t\t\tthis._getHandJoint( hand, inputjoint );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.dispatchEvent( { type: 'connected', data: inputSource } );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdisconnect( inputSource ) {\r\n\r\n\t\tthis.dispatchEvent( { type: 'disconnected', data: inputSource } );\r\n\r\n\t\tif ( this._targetRay !== null ) {\r\n\r\n\t\t\tthis._targetRay.visible = false;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this._grip !== null ) {\r\n\r\n\t\t\tthis._grip.visible = false;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this._hand !== null ) {\r\n\r\n\t\t\tthis._hand.visible = false;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tupdate( inputSource, frame, referenceSpace ) {\r\n\r\n\t\tlet inputPose = null;\r\n\t\tlet gripPose = null;\r\n\t\tlet handPose = null;\r\n\r\n\t\tconst targetRay = this._targetRay;\r\n\t\tconst grip = this._grip;\r\n\t\tconst hand = this._hand;\r\n\r\n\t\tif ( inputSource && frame.session.visibilityState !== 'visible-blurred' ) {\r\n\r\n\t\t\tif ( hand && inputSource.hand ) {\r\n\r\n\t\t\t\thandPose = true;\r\n\r\n\t\t\t\tfor ( const inputjoint of inputSource.hand.values() ) {\r\n\r\n\t\t\t\t\t// Update the joints groups with the XRJoint poses\r\n\t\t\t\t\tconst jointPose = frame.getJointPose( inputjoint, referenceSpace );\r\n\r\n\t\t\t\t\t// The transform of this joint will be updated with the joint pose on each frame\r\n\t\t\t\t\tconst joint = this._getHandJoint( hand, inputjoint );\r\n\r\n\t\t\t\t\tif ( jointPose !== null ) {\r\n\r\n\t\t\t\t\t\tjoint.matrix.fromArray( jointPose.transform.matrix );\r\n\t\t\t\t\t\tjoint.matrix.decompose( joint.position, joint.rotation, joint.scale );\r\n\t\t\t\t\t\tjoint.matrixWorldNeedsUpdate = true;\r\n\t\t\t\t\t\tjoint.jointRadius = jointPose.radius;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tjoint.visible = jointPose !== null;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Custom events\r\n\r\n\t\t\t\t// Check pinchz\r\n\t\t\t\tconst indexTip = hand.joints[ 'index-finger-tip' ];\r\n\t\t\t\tconst thumbTip = hand.joints[ 'thumb-tip' ];\r\n\t\t\t\tconst distance = indexTip.position.distanceTo( thumbTip.position );\r\n\r\n\t\t\t\tconst distanceToPinch = 0.02;\r\n\t\t\t\tconst threshold = 0.005;\r\n\r\n\t\t\t\tif ( hand.inputState.pinching && distance > distanceToPinch + threshold ) {\r\n\r\n\t\t\t\t\thand.inputState.pinching = false;\r\n\t\t\t\t\tthis.dispatchEvent( {\r\n\t\t\t\t\t\ttype: 'pinchend',\r\n\t\t\t\t\t\thandedness: inputSource.handedness,\r\n\t\t\t\t\t\ttarget: this\r\n\t\t\t\t\t} );\r\n\r\n\t\t\t\t} else if ( ! hand.inputState.pinching && distance <= distanceToPinch - threshold ) {\r\n\r\n\t\t\t\t\thand.inputState.pinching = true;\r\n\t\t\t\t\tthis.dispatchEvent( {\r\n\t\t\t\t\t\ttype: 'pinchstart',\r\n\t\t\t\t\t\thandedness: inputSource.handedness,\r\n\t\t\t\t\t\ttarget: this\r\n\t\t\t\t\t} );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif ( grip !== null && inputSource.gripSpace ) {\r\n\r\n\t\t\t\t\tgripPose = frame.getPose( inputSource.gripSpace, referenceSpace );\r\n\r\n\t\t\t\t\tif ( gripPose !== null ) {\r\n\r\n\t\t\t\t\t\tgrip.matrix.fromArray( gripPose.transform.matrix );\r\n\t\t\t\t\t\tgrip.matrix.decompose( grip.position, grip.rotation, grip.scale );\r\n\t\t\t\t\t\tgrip.matrixWorldNeedsUpdate = true;\r\n\r\n\t\t\t\t\t\tif ( gripPose.linearVelocity ) {\r\n\r\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = true;\r\n\t\t\t\t\t\t\tgrip.linearVelocity.copy( gripPose.linearVelocity );\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = false;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( gripPose.angularVelocity ) {\r\n\r\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = true;\r\n\t\t\t\t\t\t\tgrip.angularVelocity.copy( gripPose.angularVelocity );\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = false;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( targetRay !== null ) {\r\n\r\n\t\t\t\tinputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );\r\n\r\n\t\t\t\t// Some runtimes (namely Vive Cosmos with Vive OpenXR Runtime) have only grip space and ray space is equal to it\r\n\t\t\t\tif ( inputPose === null && gripPose !== null ) {\r\n\r\n\t\t\t\t\tinputPose = gripPose;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( inputPose !== null ) {\r\n\r\n\t\t\t\t\ttargetRay.matrix.fromArray( inputPose.transform.matrix );\r\n\t\t\t\t\ttargetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale );\r\n\t\t\t\t\ttargetRay.matrixWorldNeedsUpdate = true;\r\n\r\n\t\t\t\t\tif ( inputPose.linearVelocity ) {\r\n\r\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = true;\r\n\t\t\t\t\t\ttargetRay.linearVelocity.copy( inputPose.linearVelocity );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = false;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( inputPose.angularVelocity ) {\r\n\r\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = true;\r\n\t\t\t\t\t\ttargetRay.angularVelocity.copy( inputPose.angularVelocity );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = false;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis.dispatchEvent( _moveEvent );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t}\r\n\r\n\t\tif ( targetRay !== null ) {\r\n\r\n\t\t\ttargetRay.visible = ( inputPose !== null );\r\n\r\n\t\t}\r\n\r\n\t\tif ( grip !== null ) {\r\n\r\n\t\t\tgrip.visible = ( gripPose !== null );\r\n\r\n\t\t}\r\n\r\n\t\tif ( hand !== null ) {\r\n\r\n\t\t\thand.visible = ( handPose !== null );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t// private method\r\n\r\n\t_getHandJoint( hand, inputjoint ) {\r\n\r\n\t\tif ( hand.joints[ inputjoint.jointName ] === undefined ) {\r\n\r\n\t\t\tconst joint = new Group();\r\n\t\t\tjoint.matrixAutoUpdate = false;\r\n\t\t\tjoint.visible = false;\r\n\t\t\thand.joints[ inputjoint.jointName ] = joint;\r\n\r\n\t\t\thand.add( joint );\r\n\r\n\t\t}\r\n\r\n\t\treturn hand.joints[ inputjoint.jointName ];\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _occlusion_vertex = `\r\nvoid main() {\r\n\r\n\tgl_Position = vec4( position, 1.0 );\r\n\r\n}`;\r\n\r\nconst _occlusion_fragment = `\r\nuniform sampler2DArray depthColor;\r\nuniform float depthWidth;\r\nuniform float depthHeight;\r\n\r\nvoid main() {\r\n\r\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\r\n\r\n\tif ( coord.x >= 1.0 ) {\r\n\r\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\r\n\r\n\t} else {\r\n\r\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\r\n\r\n\t}\r\n\r\n}`;\r\n\r\nclass WebXRDepthSensing {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.texture = null;\r\n\t\tthis.mesh = null;\r\n\r\n\t\tthis.depthNear = 0;\r\n\t\tthis.depthFar = 0;\r\n\r\n\t}\r\n\r\n\tinit( renderer, depthData, renderState ) {\r\n\r\n\t\tif ( this.texture === null ) {\r\n\r\n\t\t\tconst texture = new Texture();\r\n\r\n\t\t\tconst texProps = renderer.properties.get( texture );\r\n\t\t\ttexProps.__webglTexture = depthData.texture;\r\n\r\n\t\t\tif ( ( depthData.depthNear != renderState.depthNear ) || ( depthData.depthFar != renderState.depthFar ) ) {\r\n\r\n\t\t\t\tthis.depthNear = depthData.depthNear;\r\n\t\t\t\tthis.depthFar = depthData.depthFar;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.texture = texture;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tgetMesh( cameraXR ) {\r\n\r\n\t\tif ( this.texture !== null ) {\r\n\r\n\t\t\tif ( this.mesh === null ) {\r\n\r\n\t\t\t\tconst viewport = cameraXR.cameras[ 0 ].viewport;\r\n\t\t\t\tconst material = new ShaderMaterial( {\r\n\t\t\t\t\tvertexShader: _occlusion_vertex,\r\n\t\t\t\t\tfragmentShader: _occlusion_fragment,\r\n\t\t\t\t\tuniforms: {\r\n\t\t\t\t\t\tdepthColor: { value: this.texture },\r\n\t\t\t\t\t\tdepthWidth: { value: viewport.z },\r\n\t\t\t\t\t\tdepthHeight: { value: viewport.w }\r\n\t\t\t\t\t}\r\n\t\t\t\t} );\r\n\r\n\t\t\t\tthis.mesh = new Mesh( new PlaneGeometry( 20, 20 ), material );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn this.mesh;\r\n\r\n\t}\r\n\r\n\treset() {\r\n\r\n\t\tthis.texture = null;\r\n\t\tthis.mesh = null;\r\n\r\n\t}\r\n\r\n\tgetDepthTexture() {\r\n\r\n\t\treturn this.texture;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass WebXRManager extends EventDispatcher {\r\n\r\n\tconstructor( renderer, gl ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\tlet session = null;\r\n\r\n\t\tlet framebufferScaleFactor = 1.0;\r\n\r\n\t\tlet referenceSpace = null;\r\n\t\tlet referenceSpaceType = 'local-floor';\r\n\t\t// Set default foveation to maximum.\r\n\t\tlet foveation = 1.0;\r\n\t\tlet customReferenceSpace = null;\r\n\r\n\t\tlet pose = null;\r\n\t\tlet glBinding = null;\r\n\t\tlet glProjLayer = null;\r\n\t\tlet glBaseLayer = null;\r\n\t\tlet xrFrame = null;\r\n\r\n\t\tconst depthSensing = new WebXRDepthSensing();\r\n\t\tconst attributes = gl.getContextAttributes();\r\n\r\n\t\tlet initialRenderTarget = null;\r\n\t\tlet newRenderTarget = null;\r\n\r\n\t\tconst controllers = [];\r\n\t\tconst controllerInputSources = [];\r\n\r\n\t\tconst currentSize = new Vector2();\r\n\t\tlet currentPixelRatio = null;\r\n\r\n\t\t//\r\n\r\n\t\tconst cameraL = new PerspectiveCamera();\r\n\t\tcameraL.layers.enable( 1 );\r\n\t\tcameraL.viewport = new Vector4();\r\n\r\n\t\tconst cameraR = new PerspectiveCamera();\r\n\t\tcameraR.layers.enable( 2 );\r\n\t\tcameraR.viewport = new Vector4();\r\n\r\n\t\tconst cameras = [ cameraL, cameraR ];\r\n\r\n\t\tconst cameraXR = new ArrayCamera();\r\n\t\tcameraXR.layers.enable( 1 );\r\n\t\tcameraXR.layers.enable( 2 );\r\n\r\n\t\tlet _currentDepthNear = null;\r\n\t\tlet _currentDepthFar = null;\r\n\r\n\t\t//\r\n\r\n\t\tthis.cameraAutoUpdate = true;\r\n\t\tthis.enabled = false;\r\n\r\n\t\tthis.isPresenting = false;\r\n\r\n\t\tthis.getController = function ( index ) {\r\n\r\n\t\t\tlet controller = controllers[ index ];\r\n\r\n\t\t\tif ( controller === undefined ) {\r\n\r\n\t\t\t\tcontroller = new WebXRController();\r\n\t\t\t\tcontrollers[ index ] = controller;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn controller.getTargetRaySpace();\r\n\r\n\t\t};\r\n\r\n\t\tthis.getControllerGrip = function ( index ) {\r\n\r\n\t\t\tlet controller = controllers[ index ];\r\n\r\n\t\t\tif ( controller === undefined ) {\r\n\r\n\t\t\t\tcontroller = new WebXRController();\r\n\t\t\t\tcontrollers[ index ] = controller;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn controller.getGripSpace();\r\n\r\n\t\t};\r\n\r\n\t\tthis.getHand = function ( index ) {\r\n\r\n\t\t\tlet controller = controllers[ index ];\r\n\r\n\t\t\tif ( controller === undefined ) {\r\n\r\n\t\t\t\tcontroller = new WebXRController();\r\n\t\t\t\tcontrollers[ index ] = controller;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn controller.getHandSpace();\r\n\r\n\t\t};\r\n\r\n\t\t//\r\n\r\n\t\tfunction onSessionEvent( event ) {\r\n\r\n\t\t\tconst controllerIndex = controllerInputSources.indexOf( event.inputSource );\r\n\r\n\t\t\tif ( controllerIndex === - 1 ) {\r\n\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst controller = controllers[ controllerIndex ];\r\n\r\n\t\t\tif ( controller !== undefined ) {\r\n\r\n\t\t\t\tcontroller.update( event.inputSource, event.frame, customReferenceSpace || referenceSpace );\r\n\t\t\t\tcontroller.dispatchEvent( { type: event.type, data: event.inputSource } );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction onSessionEnd() {\r\n\r\n\t\t\tsession.removeEventListener( 'select', onSessionEvent );\r\n\t\t\tsession.removeEventListener( 'selectstart', onSessionEvent );\r\n\t\t\tsession.removeEventListener( 'selectend', onSessionEvent );\r\n\t\t\tsession.removeEventListener( 'squeeze', onSessionEvent );\r\n\t\t\tsession.removeEventListener( 'squeezestart', onSessionEvent );\r\n\t\t\tsession.removeEventListener( 'squeezeend', onSessionEvent );\r\n\t\t\tsession.removeEventListener( 'end', onSessionEnd );\r\n\t\t\tsession.removeEventListener( 'inputsourceschange', onInputSourcesChange );\r\n\r\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\r\n\r\n\t\t\t\tconst inputSource = controllerInputSources[ i ];\r\n\r\n\t\t\t\tif ( inputSource === null ) continue;\r\n\r\n\t\t\t\tcontrollerInputSources[ i ] = null;\r\n\r\n\t\t\t\tcontrollers[ i ].disconnect( inputSource );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_currentDepthNear = null;\r\n\t\t\t_currentDepthFar = null;\r\n\r\n\t\t\tdepthSensing.reset();\r\n\r\n\t\t\t// restore framebuffer/rendering state\r\n\r\n\t\t\trenderer.setRenderTarget( initialRenderTarget );\r\n\r\n\t\t\tglBaseLayer = null;\r\n\t\t\tglProjLayer = null;\r\n\t\t\tglBinding = null;\r\n\t\t\tsession = null;\r\n\t\t\tnewRenderTarget = null;\r\n\r\n\t\t\t//\r\n\r\n\t\t\tanimation.stop();\r\n\r\n\t\t\tscope.isPresenting = false;\r\n\r\n\t\t\trenderer.setPixelRatio( currentPixelRatio );\r\n\t\t\trenderer.setSize( currentSize.width, currentSize.height, false );\r\n\r\n\t\t\tscope.dispatchEvent( { type: 'sessionend' } );\r\n\r\n\t\t}\r\n\r\n\t\tthis.setFramebufferScaleFactor = function ( value ) {\r\n\r\n\t\t\tframebufferScaleFactor = value;\r\n\r\n\t\t\tif ( scope.isPresenting === true ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebXRManager: Cannot change framebuffer scale while presenting.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tthis.setReferenceSpaceType = function ( value ) {\r\n\r\n\t\t\treferenceSpaceType = value;\r\n\r\n\t\t\tif ( scope.isPresenting === true ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebXRManager: Cannot change reference space type while presenting.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tthis.getReferenceSpace = function () {\r\n\r\n\t\t\treturn customReferenceSpace || referenceSpace;\r\n\r\n\t\t};\r\n\r\n\t\tthis.setReferenceSpace = function ( space ) {\r\n\r\n\t\t\tcustomReferenceSpace = space;\r\n\r\n\t\t};\r\n\r\n\t\tthis.getBaseLayer = function () {\r\n\r\n\t\t\treturn glProjLayer !== null ? glProjLayer : glBaseLayer;\r\n\r\n\t\t};\r\n\r\n\t\tthis.getBinding = function () {\r\n\r\n\t\t\treturn glBinding;\r\n\r\n\t\t};\r\n\r\n\t\tthis.getFrame = function () {\r\n\r\n\t\t\treturn xrFrame;\r\n\r\n\t\t};\r\n\r\n\t\tthis.getSession = function () {\r\n\r\n\t\t\treturn session;\r\n\r\n\t\t};\r\n\r\n\t\tthis.setSession = async function ( value ) {\r\n\r\n\t\t\tsession = value;\r\n\r\n\t\t\tif ( session !== null ) {\r\n\r\n\t\t\t\tinitialRenderTarget = renderer.getRenderTarget();\r\n\r\n\t\t\t\tsession.addEventListener( 'select', onSessionEvent );\r\n\t\t\t\tsession.addEventListener( 'selectstart', onSessionEvent );\r\n\t\t\t\tsession.addEventListener( 'selectend', onSessionEvent );\r\n\t\t\t\tsession.addEventListener( 'squeeze', onSessionEvent );\r\n\t\t\t\tsession.addEventListener( 'squeezestart', onSessionEvent );\r\n\t\t\t\tsession.addEventListener( 'squeezeend', onSessionEvent );\r\n\t\t\t\tsession.addEventListener( 'end', onSessionEnd );\r\n\t\t\t\tsession.addEventListener( 'inputsourceschange', onInputSourcesChange );\r\n\r\n\t\t\t\tif ( attributes.xrCompatible !== true ) {\r\n\r\n\t\t\t\t\tawait gl.makeXRCompatible();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tcurrentPixelRatio = renderer.getPixelRatio();\r\n\t\t\t\trenderer.getSize( currentSize );\r\n\r\n\t\t\t\tif ( session.renderState.layers === undefined ) {\r\n\r\n\t\t\t\t\tconst layerInit = {\r\n\t\t\t\t\t\tantialias: attributes.antialias,\r\n\t\t\t\t\t\talpha: true,\r\n\t\t\t\t\t\tdepth: attributes.depth,\r\n\t\t\t\t\t\tstencil: attributes.stencil,\r\n\t\t\t\t\t\tframebufferScaleFactor: framebufferScaleFactor\r\n\t\t\t\t\t};\r\n\r\n\t\t\t\t\tglBaseLayer = new XRWebGLLayer( session, gl, layerInit );\r\n\r\n\t\t\t\t\tsession.updateRenderState( { baseLayer: glBaseLayer } );\r\n\r\n\t\t\t\t\trenderer.setPixelRatio( 1 );\r\n\t\t\t\t\trenderer.setSize( glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, false );\r\n\r\n\t\t\t\t\tnewRenderTarget = new WebGLRenderTarget(\r\n\t\t\t\t\t\tglBaseLayer.framebufferWidth,\r\n\t\t\t\t\t\tglBaseLayer.framebufferHeight,\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tformat: RGBAFormat,\r\n\t\t\t\t\t\t\ttype: UnsignedByteType,\r\n\t\t\t\t\t\t\tcolorSpace: renderer.outputColorSpace,\r\n\t\t\t\t\t\t\tstencilBuffer: attributes.stencil\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tlet depthFormat = null;\r\n\t\t\t\t\tlet depthType = null;\r\n\t\t\t\t\tlet glDepthFormat = null;\r\n\r\n\t\t\t\t\tif ( attributes.depth ) {\r\n\r\n\t\t\t\t\t\tglDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;\r\n\t\t\t\t\t\tdepthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat;\r\n\t\t\t\t\t\tdepthType = attributes.stencil ? UnsignedInt248Type : UnsignedIntType;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst projectionlayerInit = {\r\n\t\t\t\t\t\tcolorFormat: gl.RGBA8,\r\n\t\t\t\t\t\tdepthFormat: glDepthFormat,\r\n\t\t\t\t\t\tscaleFactor: framebufferScaleFactor\r\n\t\t\t\t\t};\r\n\r\n\t\t\t\t\tglBinding = new XRWebGLBinding( session, gl );\r\n\r\n\t\t\t\t\tglProjLayer = glBinding.createProjectionLayer( projectionlayerInit );\r\n\r\n\t\t\t\t\tsession.updateRenderState( { layers: [ glProjLayer ] } );\r\n\r\n\t\t\t\t\trenderer.setPixelRatio( 1 );\r\n\t\t\t\t\trenderer.setSize( glProjLayer.textureWidth, glProjLayer.textureHeight, false );\r\n\r\n\t\t\t\t\tnewRenderTarget = new WebGLRenderTarget(\r\n\t\t\t\t\t\tglProjLayer.textureWidth,\r\n\t\t\t\t\t\tglProjLayer.textureHeight,\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tformat: RGBAFormat,\r\n\t\t\t\t\t\t\ttype: UnsignedByteType,\r\n\t\t\t\t\t\t\tdepthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),\r\n\t\t\t\t\t\t\tstencilBuffer: attributes.stencil,\r\n\t\t\t\t\t\t\tcolorSpace: renderer.outputColorSpace,\r\n\t\t\t\t\t\t\tsamples: attributes.antialias ? 4 : 0,\r\n\t\t\t\t\t\t\tresolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false )\r\n\t\t\t\t\t\t} );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tnewRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278\r\n\r\n\t\t\t\tthis.setFoveation( foveation );\r\n\r\n\t\t\t\tcustomReferenceSpace = null;\r\n\t\t\t\treferenceSpace = await session.requestReferenceSpace( referenceSpaceType );\r\n\r\n\t\t\t\tanimation.setContext( session );\r\n\t\t\t\tanimation.start();\r\n\r\n\t\t\t\tscope.isPresenting = true;\r\n\r\n\t\t\t\tscope.dispatchEvent( { type: 'sessionstart' } );\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tthis.getEnvironmentBlendMode = function () {\r\n\r\n\t\t\tif ( session !== null ) {\r\n\r\n\t\t\t\treturn session.environmentBlendMode;\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tthis.getDepthTexture = function () {\r\n\r\n\t\t\treturn depthSensing.getDepthTexture();\r\n\r\n\t\t};\r\n\r\n\t\tfunction onInputSourcesChange( event ) {\r\n\r\n\t\t\t// Notify disconnected\r\n\r\n\t\t\tfor ( let i = 0; i < event.removed.length; i ++ ) {\r\n\r\n\t\t\t\tconst inputSource = event.removed[ i ];\r\n\t\t\t\tconst index = controllerInputSources.indexOf( inputSource );\r\n\r\n\t\t\t\tif ( index >= 0 ) {\r\n\r\n\t\t\t\t\tcontrollerInputSources[ index ] = null;\r\n\t\t\t\t\tcontrollers[ index ].disconnect( inputSource );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Notify connected\r\n\r\n\t\t\tfor ( let i = 0; i < event.added.length; i ++ ) {\r\n\r\n\t\t\t\tconst inputSource = event.added[ i ];\r\n\r\n\t\t\t\tlet controllerIndex = controllerInputSources.indexOf( inputSource );\r\n\r\n\t\t\t\tif ( controllerIndex === - 1 ) {\r\n\r\n\t\t\t\t\t// Assign input source a controller that currently has no input source\r\n\r\n\t\t\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\r\n\r\n\t\t\t\t\t\tif ( i >= controllerInputSources.length ) {\r\n\r\n\t\t\t\t\t\t\tcontrollerInputSources.push( inputSource );\r\n\t\t\t\t\t\t\tcontrollerIndex = i;\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t} else if ( controllerInputSources[ i ] === null ) {\r\n\r\n\t\t\t\t\t\t\tcontrollerInputSources[ i ] = inputSource;\r\n\t\t\t\t\t\t\tcontrollerIndex = i;\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// If all controllers do currently receive input we ignore new ones\r\n\r\n\t\t\t\t\tif ( controllerIndex === - 1 ) break;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst controller = controllers[ controllerIndex ];\r\n\r\n\t\t\t\tif ( controller ) {\r\n\r\n\t\t\t\t\tcontroller.connect( inputSource );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t//\r\n\r\n\t\tconst cameraLPos = new Vector3();\r\n\t\tconst cameraRPos = new Vector3();\r\n\r\n\t\t/**\r\n\t\t * Assumes 2 cameras that are parallel and share an X-axis, and that\r\n\t\t * the cameras' projection and world matrices have already been set.\r\n\t\t * And that near and far planes are identical for both cameras.\r\n\t\t * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765\r\n\t\t */\r\n\t\tfunction setProjectionFromUnion( camera, cameraL, cameraR ) {\r\n\r\n\t\t\tcameraLPos.setFromMatrixPosition( cameraL.matrixWorld );\r\n\t\t\tcameraRPos.setFromMatrixPosition( cameraR.matrixWorld );\r\n\r\n\t\t\tconst ipd = cameraLPos.distanceTo( cameraRPos );\r\n\r\n\t\t\tconst projL = cameraL.projectionMatrix.elements;\r\n\t\t\tconst projR = cameraR.projectionMatrix.elements;\r\n\r\n\t\t\t// VR systems will have identical far and near planes, and\r\n\t\t\t// most likely identical top and bottom frustum extents.\r\n\t\t\t// Use the left camera for these values.\r\n\t\t\tconst near = projL[ 14 ] / ( projL[ 10 ] - 1 );\r\n\t\t\tconst far = projL[ 14 ] / ( projL[ 10 ] + 1 );\r\n\t\t\tconst topFov = ( projL[ 9 ] + 1 ) / projL[ 5 ];\r\n\t\t\tconst bottomFov = ( projL[ 9 ] - 1 ) / projL[ 5 ];\r\n\r\n\t\t\tconst leftFov = ( projL[ 8 ] - 1 ) / projL[ 0 ];\r\n\t\t\tconst rightFov = ( projR[ 8 ] + 1 ) / projR[ 0 ];\r\n\t\t\tconst left = near * leftFov;\r\n\t\t\tconst right = near * rightFov;\r\n\r\n\t\t\t// Calculate the new camera's position offset from the\r\n\t\t\t// left camera. xOffset should be roughly half `ipd`.\r\n\t\t\tconst zOffset = ipd / ( - leftFov + rightFov );\r\n\t\t\tconst xOffset = zOffset * - leftFov;\r\n\r\n\t\t\t// TODO: Better way to apply this offset?\r\n\t\t\tcameraL.matrixWorld.decompose( camera.position, camera.quaternion, camera.scale );\r\n\t\t\tcamera.translateX( xOffset );\r\n\t\t\tcamera.translateZ( zOffset );\r\n\t\t\tcamera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );\r\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\r\n\r\n\t\t\t// Check if the projection uses an infinite far plane.\r\n\t\t\tif ( projL[ 10 ] === - 1.0 ) {\r\n\r\n\t\t\t\t// Use the projection matrix from the left eye.\r\n\t\t\t\t// The camera offset is sufficient to include the view volumes\r\n\t\t\t\t// of both eyes (assuming symmetric projections).\r\n\t\t\t\tcamera.projectionMatrix.copy( cameraL.projectionMatrix );\r\n\t\t\t\tcamera.projectionMatrixInverse.copy( cameraL.projectionMatrixInverse );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// Find the union of the frustum values of the cameras and scale\r\n\t\t\t\t// the values so that the near plane's position does not change in world space,\r\n\t\t\t\t// although must now be relative to the new union camera.\r\n\t\t\t\tconst near2 = near + zOffset;\r\n\t\t\t\tconst far2 = far + zOffset;\r\n\t\t\t\tconst left2 = left - xOffset;\r\n\t\t\t\tconst right2 = right + ( ipd - xOffset );\r\n\t\t\t\tconst top2 = topFov * far / far2 * near2;\r\n\t\t\t\tconst bottom2 = bottomFov * far / far2 * near2;\r\n\r\n\t\t\t\tcamera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );\r\n\t\t\t\tcamera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction updateCamera( camera, parent ) {\r\n\r\n\t\t\tif ( parent === null ) {\r\n\r\n\t\t\t\tcamera.matrixWorld.copy( camera.matrix );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tcamera.matrixWorld.multiplyMatrices( parent.matrixWorld, camera.matrix );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\r\n\r\n\t\t}\r\n\r\n\t\tthis.updateCamera = function ( camera ) {\r\n\r\n\t\t\tif ( session === null ) return;\r\n\r\n\t\t\tlet depthNear = camera.near;\r\n\t\t\tlet depthFar = camera.far;\r\n\r\n\t\t\tif ( depthSensing.texture !== null ) {\r\n\r\n\t\t\t\tif ( depthSensing.depthNear > 0 ) depthNear = depthSensing.depthNear;\r\n\t\t\t\tif ( depthSensing.depthFar > 0 ) depthFar = depthSensing.depthFar;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcameraXR.near = cameraR.near = cameraL.near = depthNear;\r\n\t\t\tcameraXR.far = cameraR.far = cameraL.far = depthFar;\r\n\r\n\t\t\tif ( _currentDepthNear !== cameraXR.near || _currentDepthFar !== cameraXR.far ) {\r\n\r\n\t\t\t\t// Note that the new renderState won't apply until the next frame. See #18320\r\n\r\n\t\t\t\tsession.updateRenderState( {\r\n\t\t\t\t\tdepthNear: cameraXR.near,\r\n\t\t\t\t\tdepthFar: cameraXR.far\r\n\t\t\t\t} );\r\n\r\n\t\t\t\t_currentDepthNear = cameraXR.near;\r\n\t\t\t\t_currentDepthFar = cameraXR.far;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst parent = camera.parent;\r\n\t\t\tconst cameras = cameraXR.cameras;\r\n\r\n\t\t\tupdateCamera( cameraXR, parent );\r\n\r\n\t\t\tfor ( let i = 0; i < cameras.length; i ++ ) {\r\n\r\n\t\t\t\tupdateCamera( cameras[ i ], parent );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// update projection matrix for proper view frustum culling\r\n\r\n\t\t\tif ( cameras.length === 2 ) {\r\n\r\n\t\t\t\tsetProjectionFromUnion( cameraXR, cameraL, cameraR );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// assume single camera setup (AR)\r\n\r\n\t\t\t\tcameraXR.projectionMatrix.copy( cameraL.projectionMatrix );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// update user camera and its children\r\n\r\n\t\t\tupdateUserCamera( camera, cameraXR, parent );\r\n\r\n\t\t};\r\n\r\n\t\tfunction updateUserCamera( camera, cameraXR, parent ) {\r\n\r\n\t\t\tif ( parent === null ) {\r\n\r\n\t\t\t\tcamera.matrix.copy( cameraXR.matrixWorld );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tcamera.matrix.copy( parent.matrixWorld );\r\n\t\t\t\tcamera.matrix.invert();\r\n\t\t\t\tcamera.matrix.multiply( cameraXR.matrixWorld );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcamera.matrix.decompose( camera.position, camera.quaternion, camera.scale );\r\n\t\t\tcamera.updateMatrixWorld( true );\r\n\r\n\t\t\tcamera.projectionMatrix.copy( cameraXR.projectionMatrix );\r\n\t\t\tcamera.projectionMatrixInverse.copy( cameraXR.projectionMatrixInverse );\r\n\r\n\t\t\tif ( camera.isPerspectiveCamera ) {\r\n\r\n\t\t\t\tcamera.fov = RAD2DEG * 2 * Math.atan( 1 / camera.projectionMatrix.elements[ 5 ] );\r\n\t\t\t\tcamera.zoom = 1;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.getCamera = function () {\r\n\r\n\t\t\treturn cameraXR;\r\n\r\n\t\t};\r\n\r\n\t\tthis.getFoveation = function () {\r\n\r\n\t\t\tif ( glProjLayer === null && glBaseLayer === null ) {\r\n\r\n\t\t\t\treturn undefined;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn foveation;\r\n\r\n\t\t};\r\n\r\n\t\tthis.setFoveation = function ( value ) {\r\n\r\n\t\t\t// 0 = no foveation = full resolution\r\n\t\t\t// 1 = maximum foveation = the edges render at lower resolution\r\n\r\n\t\t\tfoveation = value;\r\n\r\n\t\t\tif ( glProjLayer !== null ) {\r\n\r\n\t\t\t\tglProjLayer.fixedFoveation = value;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined ) {\r\n\r\n\t\t\t\tglBaseLayer.fixedFoveation = value;\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tthis.hasDepthSensing = function () {\r\n\r\n\t\t\treturn depthSensing.texture !== null;\r\n\r\n\t\t};\r\n\r\n\t\tthis.getDepthSensingMesh = function () {\r\n\r\n\t\t\treturn depthSensing.getMesh( cameraXR );\r\n\r\n\t\t};\r\n\r\n\t\t// Animation Loop\r\n\r\n\t\tlet onAnimationFrameCallback = null;\r\n\r\n\t\tfunction onAnimationFrame( time, frame ) {\r\n\r\n\t\t\tpose = frame.getViewerPose( customReferenceSpace || referenceSpace );\r\n\t\t\txrFrame = frame;\r\n\r\n\t\t\tif ( pose !== null ) {\r\n\r\n\t\t\t\tconst views = pose.views;\r\n\r\n\t\t\t\tif ( glBaseLayer !== null ) {\r\n\r\n\t\t\t\t\trenderer.setRenderTargetFramebuffer( newRenderTarget, glBaseLayer.framebuffer );\r\n\t\t\t\t\trenderer.setRenderTarget( newRenderTarget );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet cameraXRNeedsUpdate = false;\r\n\r\n\t\t\t\t// check if it's necessary to rebuild cameraXR's camera list\r\n\r\n\t\t\t\tif ( views.length !== cameraXR.cameras.length ) {\r\n\r\n\t\t\t\t\tcameraXR.cameras.length = 0;\r\n\t\t\t\t\tcameraXRNeedsUpdate = true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor ( let i = 0; i < views.length; i ++ ) {\r\n\r\n\t\t\t\t\tconst view = views[ i ];\r\n\r\n\t\t\t\t\tlet viewport = null;\r\n\r\n\t\t\t\t\tif ( glBaseLayer !== null ) {\r\n\r\n\t\t\t\t\t\tviewport = glBaseLayer.getViewport( view );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tconst glSubImage = glBinding.getViewSubImage( glProjLayer, view );\r\n\t\t\t\t\t\tviewport = glSubImage.viewport;\r\n\r\n\t\t\t\t\t\t// For side-by-side projection, we only produce a single texture for both eyes.\r\n\t\t\t\t\t\tif ( i === 0 ) {\r\n\r\n\t\t\t\t\t\t\trenderer.setRenderTargetTextures(\r\n\t\t\t\t\t\t\t\tnewRenderTarget,\r\n\t\t\t\t\t\t\t\tglSubImage.colorTexture,\r\n\t\t\t\t\t\t\t\tglProjLayer.ignoreDepthValues ? undefined : glSubImage.depthStencilTexture );\r\n\r\n\t\t\t\t\t\t\trenderer.setRenderTarget( newRenderTarget );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tlet camera = cameras[ i ];\r\n\r\n\t\t\t\t\tif ( camera === undefined ) {\r\n\r\n\t\t\t\t\t\tcamera = new PerspectiveCamera();\r\n\t\t\t\t\t\tcamera.layers.enable( i );\r\n\t\t\t\t\t\tcamera.viewport = new Vector4();\r\n\t\t\t\t\t\tcameras[ i ] = camera;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tcamera.matrix.fromArray( view.transform.matrix );\r\n\t\t\t\t\tcamera.matrix.decompose( camera.position, camera.quaternion, camera.scale );\r\n\t\t\t\t\tcamera.projectionMatrix.fromArray( view.projectionMatrix );\r\n\t\t\t\t\tcamera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();\r\n\t\t\t\t\tcamera.viewport.set( viewport.x, viewport.y, viewport.width, viewport.height );\r\n\r\n\t\t\t\t\tif ( i === 0 ) {\r\n\r\n\t\t\t\t\t\tcameraXR.matrix.copy( camera.matrix );\r\n\t\t\t\t\t\tcameraXR.matrix.decompose( cameraXR.position, cameraXR.quaternion, cameraXR.scale );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( cameraXRNeedsUpdate === true ) {\r\n\r\n\t\t\t\t\t\tcameraXR.cameras.push( camera );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//\r\n\r\n\t\t\t\tconst enabledFeatures = session.enabledFeatures;\r\n\r\n\t\t\t\tif ( enabledFeatures && enabledFeatures.includes( 'depth-sensing' ) ) {\r\n\r\n\t\t\t\t\tconst depthData = glBinding.getDepthInformation( views[ 0 ] );\r\n\r\n\t\t\t\t\tif ( depthData && depthData.isValid && depthData.texture ) {\r\n\r\n\t\t\t\t\t\tdepthSensing.init( renderer, depthData, session.renderState );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\r\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\r\n\r\n\t\t\t\tconst inputSource = controllerInputSources[ i ];\r\n\t\t\t\tconst controller = controllers[ i ];\r\n\r\n\t\t\t\tif ( inputSource !== null && controller !== undefined ) {\r\n\r\n\t\t\t\t\tcontroller.update( inputSource, frame, customReferenceSpace || referenceSpace );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );\r\n\r\n\t\t\tif ( frame.detectedPlanes ) {\r\n\r\n\t\t\t\tscope.dispatchEvent( { type: 'planesdetected', data: frame } );\r\n\r\n\t\t\t}\r\n\r\n\t\t\txrFrame = null;\r\n\r\n\t\t}\r\n\r\n\t\tconst animation = new WebGLAnimation();\r\n\r\n\t\tanimation.setAnimationLoop( onAnimationFrame );\r\n\r\n\t\tthis.setAnimationLoop = function ( callback ) {\r\n\r\n\t\t\tonAnimationFrameCallback = callback;\r\n\r\n\t\t};\r\n\r\n\t\tthis.dispose = function () {};\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _e1 = /*@__PURE__*/ new Euler();\r\nconst _m1 = /*@__PURE__*/ new Matrix4();\r\n\r\nfunction WebGLMaterials( renderer, properties ) {\r\n\r\n\tfunction refreshTransformUniform( map, uniform ) {\r\n\r\n\t\tif ( map.matrixAutoUpdate === true ) {\r\n\r\n\t\t\tmap.updateMatrix();\r\n\r\n\t\t}\r\n\r\n\t\tuniform.value.copy( map.matrix );\r\n\r\n\t}\r\n\r\n\tfunction refreshFogUniforms( uniforms, fog ) {\r\n\r\n\t\tfog.color.getRGB( uniforms.fogColor.value, getUnlitUniformColorSpace( renderer ) );\r\n\r\n\t\tif ( fog.isFog ) {\r\n\r\n\t\t\tuniforms.fogNear.value = fog.near;\r\n\t\t\tuniforms.fogFar.value = fog.far;\r\n\r\n\t\t} else if ( fog.isFogExp2 ) {\r\n\r\n\t\t\tuniforms.fogDensity.value = fog.density;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction refreshMaterialUniforms( uniforms, material, pixelRatio, height, transmissionRenderTarget ) {\r\n\r\n\t\tif ( material.isMeshBasicMaterial ) {\r\n\r\n\t\t\trefreshUniformsCommon( uniforms, material );\r\n\r\n\t\t} else if ( material.isMeshLambertMaterial ) {\r\n\r\n\t\t\trefreshUniformsCommon( uniforms, material );\r\n\r\n\t\t} else if ( material.isMeshToonMaterial ) {\r\n\r\n\t\t\trefreshUniformsCommon( uniforms, material );\r\n\t\t\trefreshUniformsToon( uniforms, material );\r\n\r\n\t\t} else if ( material.isMeshPhongMaterial ) {\r\n\r\n\t\t\trefreshUniformsCommon( uniforms, material );\r\n\t\t\trefreshUniformsPhong( uniforms, material );\r\n\r\n\t\t} else if ( material.isMeshStandardMaterial ) {\r\n\r\n\t\t\trefreshUniformsCommon( uniforms, material );\r\n\t\t\trefreshUniformsStandard( uniforms, material );\r\n\r\n\t\t\tif ( material.isMeshPhysicalMaterial ) {\r\n\r\n\t\t\t\trefreshUniformsPhysical( uniforms, material, transmissionRenderTarget );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( material.isMeshMatcapMaterial ) {\r\n\r\n\t\t\trefreshUniformsCommon( uniforms, material );\r\n\t\t\trefreshUniformsMatcap( uniforms, material );\r\n\r\n\t\t} else if ( material.isMeshDepthMaterial ) {\r\n\r\n\t\t\trefreshUniformsCommon( uniforms, material );\r\n\r\n\t\t} else if ( material.isMeshDistanceMaterial ) {\r\n\r\n\t\t\trefreshUniformsCommon( uniforms, material );\r\n\t\t\trefreshUniformsDistance( uniforms, material );\r\n\r\n\t\t} else if ( material.isMeshNormalMaterial ) {\r\n\r\n\t\t\trefreshUniformsCommon( uniforms, material );\r\n\r\n\t\t} else if ( material.isLineBasicMaterial ) {\r\n\r\n\t\t\trefreshUniformsLine( uniforms, material );\r\n\r\n\t\t\tif ( material.isLineDashedMaterial ) {\r\n\r\n\t\t\t\trefreshUniformsDash( uniforms, material );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( material.isPointsMaterial ) {\r\n\r\n\t\t\trefreshUniformsPoints( uniforms, material, pixelRatio, height );\r\n\r\n\t\t} else if ( material.isSpriteMaterial ) {\r\n\r\n\t\t\trefreshUniformsSprites( uniforms, material );\r\n\r\n\t\t} else if ( material.isShadowMaterial ) {\r\n\r\n\t\t\tuniforms.color.value.copy( material.color );\r\n\t\t\tuniforms.opacity.value = material.opacity;\r\n\r\n\t\t} else if ( material.isShaderMaterial ) {\r\n\r\n\t\t\tmaterial.uniformsNeedUpdate = false; // #15581\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsCommon( uniforms, material ) {\r\n\r\n\t\tuniforms.opacity.value = material.opacity;\r\n\r\n\t\tif ( material.color ) {\r\n\r\n\t\t\tuniforms.diffuse.value.copy( material.color );\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.emissive ) {\r\n\r\n\t\t\tuniforms.emissive.value.copy( material.emissive ).multiplyScalar( material.emissiveIntensity );\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.map ) {\r\n\r\n\t\t\tuniforms.map.value = material.map;\r\n\r\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.alphaMap ) {\r\n\r\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\r\n\r\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.bumpMap ) {\r\n\r\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\r\n\r\n\t\t\trefreshTransformUniform( material.bumpMap, uniforms.bumpMapTransform );\r\n\r\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\r\n\r\n\t\t\tif ( material.side === BackSide ) {\r\n\r\n\t\t\t\tuniforms.bumpScale.value *= - 1;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.normalMap ) {\r\n\r\n\t\t\tuniforms.normalMap.value = material.normalMap;\r\n\r\n\t\t\trefreshTransformUniform( material.normalMap, uniforms.normalMapTransform );\r\n\r\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\r\n\r\n\t\t\tif ( material.side === BackSide ) {\r\n\r\n\t\t\t\tuniforms.normalScale.value.negate();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.displacementMap ) {\r\n\r\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\r\n\r\n\t\t\trefreshTransformUniform( material.displacementMap, uniforms.displacementMapTransform );\r\n\r\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\r\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.emissiveMap ) {\r\n\r\n\t\t\tuniforms.emissiveMap.value = material.emissiveMap;\r\n\r\n\t\t\trefreshTransformUniform( material.emissiveMap, uniforms.emissiveMapTransform );\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.specularMap ) {\r\n\r\n\t\t\tuniforms.specularMap.value = material.specularMap;\r\n\r\n\t\t\trefreshTransformUniform( material.specularMap, uniforms.specularMapTransform );\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.alphaTest > 0 ) {\r\n\r\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\r\n\r\n\t\t}\r\n\r\n\t\tconst materialProperties = properties.get( material );\r\n\r\n\t\tconst envMap = materialProperties.envMap;\r\n\t\tconst envMapRotation = materialProperties.envMapRotation;\r\n\r\n\t\tif ( envMap ) {\r\n\r\n\t\t\tuniforms.envMap.value = envMap;\r\n\r\n\t\t\t_e1.copy( envMapRotation );\r\n\r\n\t\t\t// accommodate left-handed frame\r\n\t\t\t_e1.x *= - 1; _e1.y *= - 1; _e1.z *= - 1;\r\n\r\n\t\t\tif ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) {\r\n\r\n\t\t\t\t// environment maps which are not cube render targets or PMREMs follow a different convention\r\n\t\t\t\t_e1.y *= - 1;\r\n\t\t\t\t_e1.z *= - 1;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuniforms.envMapRotation.value.setFromMatrix4( _m1.makeRotationFromEuler( _e1 ) );\r\n\r\n\t\t\tuniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;\r\n\r\n\t\t\tuniforms.reflectivity.value = material.reflectivity;\r\n\t\t\tuniforms.ior.value = material.ior;\r\n\t\t\tuniforms.refractionRatio.value = material.refractionRatio;\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.lightMap ) {\r\n\r\n\t\t\tuniforms.lightMap.value = material.lightMap;\r\n\t\t\tuniforms.lightMapIntensity.value = material.lightMapIntensity;\r\n\r\n\t\t\trefreshTransformUniform( material.lightMap, uniforms.lightMapTransform );\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.aoMap ) {\r\n\r\n\t\t\tuniforms.aoMap.value = material.aoMap;\r\n\t\t\tuniforms.aoMapIntensity.value = material.aoMapIntensity;\r\n\r\n\t\t\trefreshTransformUniform( material.aoMap, uniforms.aoMapTransform );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsLine( uniforms, material ) {\r\n\r\n\t\tuniforms.diffuse.value.copy( material.color );\r\n\t\tuniforms.opacity.value = material.opacity;\r\n\r\n\t\tif ( material.map ) {\r\n\r\n\t\t\tuniforms.map.value = material.map;\r\n\r\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsDash( uniforms, material ) {\r\n\r\n\t\tuniforms.dashSize.value = material.dashSize;\r\n\t\tuniforms.totalSize.value = material.dashSize + material.gapSize;\r\n\t\tuniforms.scale.value = material.scale;\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsPoints( uniforms, material, pixelRatio, height ) {\r\n\r\n\t\tuniforms.diffuse.value.copy( material.color );\r\n\t\tuniforms.opacity.value = material.opacity;\r\n\t\tuniforms.size.value = material.size * pixelRatio;\r\n\t\tuniforms.scale.value = height * 0.5;\r\n\r\n\t\tif ( material.map ) {\r\n\r\n\t\t\tuniforms.map.value = material.map;\r\n\r\n\t\t\trefreshTransformUniform( material.map, uniforms.uvTransform );\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.alphaMap ) {\r\n\r\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\r\n\r\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.alphaTest > 0 ) {\r\n\r\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsSprites( uniforms, material ) {\r\n\r\n\t\tuniforms.diffuse.value.copy( material.color );\r\n\t\tuniforms.opacity.value = material.opacity;\r\n\t\tuniforms.rotation.value = material.rotation;\r\n\r\n\t\tif ( material.map ) {\r\n\r\n\t\t\tuniforms.map.value = material.map;\r\n\r\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.alphaMap ) {\r\n\r\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\r\n\r\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.alphaTest > 0 ) {\r\n\r\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsPhong( uniforms, material ) {\r\n\r\n\t\tuniforms.specular.value.copy( material.specular );\r\n\t\tuniforms.shininess.value = Math.max( material.shininess, 1e-4 ); // to prevent pow( 0.0, 0.0 )\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsToon( uniforms, material ) {\r\n\r\n\t\tif ( material.gradientMap ) {\r\n\r\n\t\t\tuniforms.gradientMap.value = material.gradientMap;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsStandard( uniforms, material ) {\r\n\r\n\t\tuniforms.metalness.value = material.metalness;\r\n\r\n\t\tif ( material.metalnessMap ) {\r\n\r\n\t\t\tuniforms.metalnessMap.value = material.metalnessMap;\r\n\r\n\t\t\trefreshTransformUniform( material.metalnessMap, uniforms.metalnessMapTransform );\r\n\r\n\t\t}\r\n\r\n\t\tuniforms.roughness.value = material.roughness;\r\n\r\n\t\tif ( material.roughnessMap ) {\r\n\r\n\t\t\tuniforms.roughnessMap.value = material.roughnessMap;\r\n\r\n\t\t\trefreshTransformUniform( material.roughnessMap, uniforms.roughnessMapTransform );\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.envMap ) {\r\n\r\n\t\t\t//uniforms.envMap.value = material.envMap; // part of uniforms common\r\n\r\n\t\t\tuniforms.envMapIntensity.value = material.envMapIntensity;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsPhysical( uniforms, material, transmissionRenderTarget ) {\r\n\r\n\t\tuniforms.ior.value = material.ior; // also part of uniforms common\r\n\r\n\t\tif ( material.sheen > 0 ) {\r\n\r\n\t\t\tuniforms.sheenColor.value.copy( material.sheenColor ).multiplyScalar( material.sheen );\r\n\r\n\t\t\tuniforms.sheenRoughness.value = material.sheenRoughness;\r\n\r\n\t\t\tif ( material.sheenColorMap ) {\r\n\r\n\t\t\t\tuniforms.sheenColorMap.value = material.sheenColorMap;\r\n\r\n\t\t\t\trefreshTransformUniform( material.sheenColorMap, uniforms.sheenColorMapTransform );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( material.sheenRoughnessMap ) {\r\n\r\n\t\t\t\tuniforms.sheenRoughnessMap.value = material.sheenRoughnessMap;\r\n\r\n\t\t\t\trefreshTransformUniform( material.sheenRoughnessMap, uniforms.sheenRoughnessMapTransform );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.clearcoat > 0 ) {\r\n\r\n\t\t\tuniforms.clearcoat.value = material.clearcoat;\r\n\t\t\tuniforms.clearcoatRoughness.value = material.clearcoatRoughness;\r\n\r\n\t\t\tif ( material.clearcoatMap ) {\r\n\r\n\t\t\t\tuniforms.clearcoatMap.value = material.clearcoatMap;\r\n\r\n\t\t\t\trefreshTransformUniform( material.clearcoatMap, uniforms.clearcoatMapTransform );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( material.clearcoatRoughnessMap ) {\r\n\r\n\t\t\t\tuniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap;\r\n\r\n\t\t\t\trefreshTransformUniform( material.clearcoatRoughnessMap, uniforms.clearcoatRoughnessMapTransform );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( material.clearcoatNormalMap ) {\r\n\r\n\t\t\t\tuniforms.clearcoatNormalMap.value = material.clearcoatNormalMap;\r\n\r\n\t\t\t\trefreshTransformUniform( material.clearcoatNormalMap, uniforms.clearcoatNormalMapTransform );\r\n\r\n\t\t\t\tuniforms.clearcoatNormalScale.value.copy( material.clearcoatNormalScale );\r\n\r\n\t\t\t\tif ( material.side === BackSide ) {\r\n\r\n\t\t\t\t\tuniforms.clearcoatNormalScale.value.negate();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.dispersion > 0 ) {\r\n\r\n\t\t\tuniforms.dispersion.value = material.dispersion;\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.iridescence > 0 ) {\r\n\r\n\t\t\tuniforms.iridescence.value = material.iridescence;\r\n\t\t\tuniforms.iridescenceIOR.value = material.iridescenceIOR;\r\n\t\t\tuniforms.iridescenceThicknessMinimum.value = material.iridescenceThicknessRange[ 0 ];\r\n\t\t\tuniforms.iridescenceThicknessMaximum.value = material.iridescenceThicknessRange[ 1 ];\r\n\r\n\t\t\tif ( material.iridescenceMap ) {\r\n\r\n\t\t\t\tuniforms.iridescenceMap.value = material.iridescenceMap;\r\n\r\n\t\t\t\trefreshTransformUniform( material.iridescenceMap, uniforms.iridescenceMapTransform );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( material.iridescenceThicknessMap ) {\r\n\r\n\t\t\t\tuniforms.iridescenceThicknessMap.value = material.iridescenceThicknessMap;\r\n\r\n\t\t\t\trefreshTransformUniform( material.iridescenceThicknessMap, uniforms.iridescenceThicknessMapTransform );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.transmission > 0 ) {\r\n\r\n\t\t\tuniforms.transmission.value = material.transmission;\r\n\t\t\tuniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture;\r\n\t\t\tuniforms.transmissionSamplerSize.value.set( transmissionRenderTarget.width, transmissionRenderTarget.height );\r\n\r\n\t\t\tif ( material.transmissionMap ) {\r\n\r\n\t\t\t\tuniforms.transmissionMap.value = material.transmissionMap;\r\n\r\n\t\t\t\trefreshTransformUniform( material.transmissionMap, uniforms.transmissionMapTransform );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuniforms.thickness.value = material.thickness;\r\n\r\n\t\t\tif ( material.thicknessMap ) {\r\n\r\n\t\t\t\tuniforms.thicknessMap.value = material.thicknessMap;\r\n\r\n\t\t\t\trefreshTransformUniform( material.thicknessMap, uniforms.thicknessMapTransform );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuniforms.attenuationDistance.value = material.attenuationDistance;\r\n\t\t\tuniforms.attenuationColor.value.copy( material.attenuationColor );\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.anisotropy > 0 ) {\r\n\r\n\t\t\tuniforms.anisotropyVector.value.set( material.anisotropy * Math.cos( material.anisotropyRotation ), material.anisotropy * Math.sin( material.anisotropyRotation ) );\r\n\r\n\t\t\tif ( material.anisotropyMap ) {\r\n\r\n\t\t\t\tuniforms.anisotropyMap.value = material.anisotropyMap;\r\n\r\n\t\t\t\trefreshTransformUniform( material.anisotropyMap, uniforms.anisotropyMapTransform );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tuniforms.specularIntensity.value = material.specularIntensity;\r\n\t\tuniforms.specularColor.value.copy( material.specularColor );\r\n\r\n\t\tif ( material.specularColorMap ) {\r\n\r\n\t\t\tuniforms.specularColorMap.value = material.specularColorMap;\r\n\r\n\t\t\trefreshTransformUniform( material.specularColorMap, uniforms.specularColorMapTransform );\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.specularIntensityMap ) {\r\n\r\n\t\t\tuniforms.specularIntensityMap.value = material.specularIntensityMap;\r\n\r\n\t\t\trefreshTransformUniform( material.specularIntensityMap, uniforms.specularIntensityMapTransform );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsMatcap( uniforms, material ) {\r\n\r\n\t\tif ( material.matcap ) {\r\n\r\n\t\t\tuniforms.matcap.value = material.matcap;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsDistance( uniforms, material ) {\r\n\r\n\t\tconst light = properties.get( material ).light;\r\n\r\n\t\tuniforms.referencePosition.value.setFromMatrixPosition( light.matrixWorld );\r\n\t\tuniforms.nearDistance.value = light.shadow.camera.near;\r\n\t\tuniforms.farDistance.value = light.shadow.camera.far;\r\n\r\n\t}\r\n\r\n\treturn {\r\n\t\trefreshFogUniforms: refreshFogUniforms,\r\n\t\trefreshMaterialUniforms: refreshMaterialUniforms\r\n\t};\r\n\r\n}\r\n\r\nfunction WebGLUniformsGroups( gl, info, capabilities, state ) {\r\n\r\n\tlet buffers = {};\r\n\tlet updateList = {};\r\n\tlet allocatedBindingPoints = [];\r\n\r\n\tconst maxBindingPoints = gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ); // binding points are global whereas block indices are per shader program\r\n\r\n\tfunction bind( uniformsGroup, program ) {\r\n\r\n\t\tconst webglProgram = program.program;\r\n\t\tstate.uniformBlockBinding( uniformsGroup, webglProgram );\r\n\r\n\t}\r\n\r\n\tfunction update( uniformsGroup, program ) {\r\n\r\n\t\tlet buffer = buffers[ uniformsGroup.id ];\r\n\r\n\t\tif ( buffer === undefined ) {\r\n\r\n\t\t\tprepareUniformsGroup( uniformsGroup );\r\n\r\n\t\t\tbuffer = createBuffer( uniformsGroup );\r\n\t\t\tbuffers[ uniformsGroup.id ] = buffer;\r\n\r\n\t\t\tuniformsGroup.addEventListener( 'dispose', onUniformsGroupsDispose );\r\n\r\n\t\t}\r\n\r\n\t\t// ensure to update the binding points/block indices mapping for this program\r\n\r\n\t\tconst webglProgram = program.program;\r\n\t\tstate.updateUBOMapping( uniformsGroup, webglProgram );\r\n\r\n\t\t// update UBO once per frame\r\n\r\n\t\tconst frame = info.render.frame;\r\n\r\n\t\tif ( updateList[ uniformsGroup.id ] !== frame ) {\r\n\r\n\t\t\tupdateBufferData( uniformsGroup );\r\n\r\n\t\t\tupdateList[ uniformsGroup.id ] = frame;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction createBuffer( uniformsGroup ) {\r\n\r\n\t\t// the setup of an UBO is independent of a particular shader program but global\r\n\r\n\t\tconst bindingPointIndex = allocateBindingPointIndex();\r\n\t\tuniformsGroup.__bindingPointIndex = bindingPointIndex;\r\n\r\n\t\tconst buffer = gl.createBuffer();\r\n\t\tconst size = uniformsGroup.__size;\r\n\t\tconst usage = uniformsGroup.usage;\r\n\r\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, buffer );\r\n\t\tgl.bufferData( gl.UNIFORM_BUFFER, size, usage );\r\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, null );\r\n\t\tgl.bindBufferBase( gl.UNIFORM_BUFFER, bindingPointIndex, buffer );\r\n\r\n\t\treturn buffer;\r\n\r\n\t}\r\n\r\n\tfunction allocateBindingPointIndex() {\r\n\r\n\t\tfor ( let i = 0; i < maxBindingPoints; i ++ ) {\r\n\r\n\t\t\tif ( allocatedBindingPoints.indexOf( i ) === - 1 ) {\r\n\r\n\t\t\t\tallocatedBindingPoints.push( i );\r\n\t\t\t\treturn i;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconsole.error( 'THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.' );\r\n\r\n\t\treturn 0;\r\n\r\n\t}\r\n\r\n\tfunction updateBufferData( uniformsGroup ) {\r\n\r\n\t\tconst buffer = buffers[ uniformsGroup.id ];\r\n\t\tconst uniforms = uniformsGroup.uniforms;\r\n\t\tconst cache = uniformsGroup.__cache;\r\n\r\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, buffer );\r\n\r\n\t\tfor ( let i = 0, il = uniforms.length; i < il; i ++ ) {\r\n\r\n\t\t\tconst uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];\r\n\r\n\t\t\tfor ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\tconst uniform = uniformArray[ j ];\r\n\r\n\t\t\t\tif ( hasUniformChanged( uniform, i, j, cache ) === true ) {\r\n\r\n\t\t\t\t\tconst offset = uniform.__offset;\r\n\r\n\t\t\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\r\n\r\n\t\t\t\t\tlet arrayOffset = 0;\r\n\r\n\t\t\t\t\tfor ( let k = 0; k < values.length; k ++ ) {\r\n\r\n\t\t\t\t\t\tconst value = values[ k ];\r\n\r\n\t\t\t\t\t\tconst info = getUniformSize( value );\r\n\r\n\t\t\t\t\t\t// TODO add integer and struct support\r\n\t\t\t\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\r\n\r\n\t\t\t\t\t\t\tuniform.__data[ 0 ] = value;\r\n\t\t\t\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );\r\n\r\n\t\t\t\t\t\t} else if ( value.isMatrix3 ) {\r\n\r\n\t\t\t\t\t\t\t// manually converting 3x3 to 3x4\r\n\r\n\t\t\t\t\t\t\tuniform.__data[ 0 ] = value.elements[ 0 ];\r\n\t\t\t\t\t\t\tuniform.__data[ 1 ] = value.elements[ 1 ];\r\n\t\t\t\t\t\t\tuniform.__data[ 2 ] = value.elements[ 2 ];\r\n\t\t\t\t\t\t\tuniform.__data[ 3 ] = 0;\r\n\t\t\t\t\t\t\tuniform.__data[ 4 ] = value.elements[ 3 ];\r\n\t\t\t\t\t\t\tuniform.__data[ 5 ] = value.elements[ 4 ];\r\n\t\t\t\t\t\t\tuniform.__data[ 6 ] = value.elements[ 5 ];\r\n\t\t\t\t\t\t\tuniform.__data[ 7 ] = 0;\r\n\t\t\t\t\t\t\tuniform.__data[ 8 ] = value.elements[ 6 ];\r\n\t\t\t\t\t\t\tuniform.__data[ 9 ] = value.elements[ 7 ];\r\n\t\t\t\t\t\t\tuniform.__data[ 10 ] = value.elements[ 8 ];\r\n\t\t\t\t\t\t\tuniform.__data[ 11 ] = 0;\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tvalue.toArray( uniform.__data, arrayOffset );\r\n\r\n\t\t\t\t\t\t\tarrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, null );\r\n\r\n\t}\r\n\r\n\tfunction hasUniformChanged( uniform, index, indexArray, cache ) {\r\n\r\n\t\tconst value = uniform.value;\r\n\t\tconst indexString = index + '_' + indexArray;\r\n\r\n\t\tif ( cache[ indexString ] === undefined ) {\r\n\r\n\t\t\t// cache entry does not exist so far\r\n\r\n\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\r\n\r\n\t\t\t\tcache[ indexString ] = value;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tcache[ indexString ] = value.clone();\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst cachedObject = cache[ indexString ];\r\n\r\n\t\t\t// compare current value with cached entry\r\n\r\n\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\r\n\r\n\t\t\t\tif ( cachedObject !== value ) {\r\n\r\n\t\t\t\t\tcache[ indexString ] = value;\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif ( cachedObject.equals( value ) === false ) {\r\n\r\n\t\t\t\t\tcachedObject.copy( value );\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\tfunction prepareUniformsGroup( uniformsGroup ) {\r\n\r\n\t\t// determine total buffer size according to the STD140 layout\r\n\t\t// Hint: STD140 is the only supported layout in WebGL 2\r\n\r\n\t\tconst uniforms = uniformsGroup.uniforms;\r\n\r\n\t\tlet offset = 0; // global buffer offset in bytes\r\n\t\tconst chunkSize = 16; // size of a chunk in bytes\r\n\r\n\t\tfor ( let i = 0, l = uniforms.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];\r\n\r\n\t\t\tfor ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\tconst uniform = uniformArray[ j ];\r\n\r\n\t\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\r\n\r\n\t\t\t\tfor ( let k = 0, kl = values.length; k < kl; k ++ ) {\r\n\r\n\t\t\t\t\tconst value = values[ k ];\r\n\r\n\t\t\t\t\tconst info = getUniformSize( value );\r\n\r\n\t\t\t\t\tconst chunkOffset = offset % chunkSize; // offset in the current chunk\r\n\t\t\t\t\tconst chunkPadding = chunkOffset % info.boundary; // required padding to match boundary\r\n\t\t\t\t\tconst chunkStart = chunkOffset + chunkPadding; // the start position in the current chunk for the data\r\n\r\n\t\t\t\t\toffset += chunkPadding;\r\n\r\n\t\t\t\t\t// Check for chunk overflow\r\n\t\t\t\t\tif ( chunkStart !== 0 && ( chunkSize - chunkStart ) < info.storage ) {\r\n\r\n\t\t\t\t\t\t// Add padding and adjust offset\r\n\t\t\t\t\t\toffset += ( chunkSize - chunkStart );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// the following two properties will be used for partial buffer updates\r\n\t\t\t\t\tuniform.__data = new Float32Array( info.storage / Float32Array.BYTES_PER_ELEMENT );\r\n\t\t\t\t\tuniform.__offset = offset;\r\n\r\n\t\t\t\t\t// Update the global offset\r\n\t\t\t\t\toffset += info.storage;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// ensure correct final padding\r\n\r\n\t\tconst chunkOffset = offset % chunkSize;\r\n\r\n\t\tif ( chunkOffset > 0 ) offset += ( chunkSize - chunkOffset );\r\n\r\n\t\t//\r\n\r\n\t\tuniformsGroup.__size = offset;\r\n\t\tuniformsGroup.__cache = {};\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tfunction getUniformSize( value ) {\r\n\r\n\t\tconst info = {\r\n\t\t\tboundary: 0, // bytes\r\n\t\t\tstorage: 0 // bytes\r\n\t\t};\r\n\r\n\t\t// determine sizes according to STD140\r\n\r\n\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\r\n\r\n\t\t\t// float/int/bool\r\n\r\n\t\t\tinfo.boundary = 4;\r\n\t\t\tinfo.storage = 4;\r\n\r\n\t\t} else if ( value.isVector2 ) {\r\n\r\n\t\t\t// vec2\r\n\r\n\t\t\tinfo.boundary = 8;\r\n\t\t\tinfo.storage = 8;\r\n\r\n\t\t} else if ( value.isVector3 || value.isColor ) {\r\n\r\n\t\t\t// vec3\r\n\r\n\t\t\tinfo.boundary = 16;\r\n\t\t\tinfo.storage = 12; // evil: vec3 must start on a 16-byte boundary but it only consumes 12 bytes\r\n\r\n\t\t} else if ( value.isVector4 ) {\r\n\r\n\t\t\t// vec4\r\n\r\n\t\t\tinfo.boundary = 16;\r\n\t\t\tinfo.storage = 16;\r\n\r\n\t\t} else if ( value.isMatrix3 ) {\r\n\r\n\t\t\t// mat3 (in STD140 a 3x3 matrix is represented as 3x4)\r\n\r\n\t\t\tinfo.boundary = 48;\r\n\t\t\tinfo.storage = 48;\r\n\r\n\t\t} else if ( value.isMatrix4 ) {\r\n\r\n\t\t\t// mat4\r\n\r\n\t\t\tinfo.boundary = 64;\r\n\t\t\tinfo.storage = 64;\r\n\r\n\t\t} else if ( value.isTexture ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.' );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Unsupported uniform value type.', value );\r\n\r\n\t\t}\r\n\r\n\t\treturn info;\r\n\r\n\t}\r\n\r\n\tfunction onUniformsGroupsDispose( event ) {\r\n\r\n\t\tconst uniformsGroup = event.target;\r\n\r\n\t\tuniformsGroup.removeEventListener( 'dispose', onUniformsGroupsDispose );\r\n\r\n\t\tconst index = allocatedBindingPoints.indexOf( uniformsGroup.__bindingPointIndex );\r\n\t\tallocatedBindingPoints.splice( index, 1 );\r\n\r\n\t\tgl.deleteBuffer( buffers[ uniformsGroup.id ] );\r\n\r\n\t\tdelete buffers[ uniformsGroup.id ];\r\n\t\tdelete updateList[ uniformsGroup.id ];\r\n\r\n\t}\r\n\r\n\tfunction dispose() {\r\n\r\n\t\tfor ( const id in buffers ) {\r\n\r\n\t\t\tgl.deleteBuffer( buffers[ id ] );\r\n\r\n\t\t}\r\n\r\n\t\tallocatedBindingPoints = [];\r\n\t\tbuffers = {};\r\n\t\tupdateList = {};\r\n\r\n\t}\r\n\r\n\treturn {\r\n\r\n\t\tbind: bind,\r\n\t\tupdate: update,\r\n\r\n\t\tdispose: dispose\r\n\r\n\t};\r\n\r\n}\r\n\r\nclass WebGLRenderer {\r\n\r\n\tconstructor( parameters = {} ) {\r\n\r\n\t\tconst {\r\n\t\t\tcanvas = createCanvasElement(),\r\n\t\t\tcontext = null,\r\n\t\t\tdepth = true,\r\n\t\t\tstencil = false,\r\n\t\t\talpha = false,\r\n\t\t\tantialias = false,\r\n\t\t\tpremultipliedAlpha = true,\r\n\t\t\tpreserveDrawingBuffer = false,\r\n\t\t\tpowerPreference = 'default',\r\n\t\t\tfailIfMajorPerformanceCaveat = false,\r\n\t\t} = parameters;\r\n\r\n\t\tthis.isWebGLRenderer = true;\r\n\r\n\t\tlet _alpha;\r\n\r\n\t\tif ( context !== null ) {\r\n\r\n\t\t\tif ( typeof WebGLRenderingContext !== 'undefined' && context instanceof WebGLRenderingContext ) {\r\n\r\n\t\t\t\tthrow new Error( 'THREE.WebGLRenderer: WebGL 1 is not supported since r163.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_alpha = context.getContextAttributes().alpha;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_alpha = alpha;\r\n\r\n\t\t}\r\n\r\n\t\tconst uintClearColor = new Uint32Array( 4 );\r\n\t\tconst intClearColor = new Int32Array( 4 );\r\n\r\n\t\tlet currentRenderList = null;\r\n\t\tlet currentRenderState = null;\r\n\r\n\t\t// render() can be called from within a callback triggered by another render.\r\n\t\t// We track this so that the nested render call gets its list and state isolated from the parent render call.\r\n\r\n\t\tconst renderListStack = [];\r\n\t\tconst renderStateStack = [];\r\n\r\n\t\t// public properties\r\n\r\n\t\tthis.domElement = canvas;\r\n\r\n\t\t// Debug configuration container\r\n\t\tthis.debug = {\r\n\r\n\t\t\t/**\r\n\t\t\t * Enables error checking and reporting when shader programs are being compiled\r\n\t\t\t * @type {boolean}\r\n\t\t\t */\r\n\t\t\tcheckShaderErrors: true,\r\n\t\t\t/**\r\n\t\t\t * Callback for custom error reporting.\r\n\t\t\t * @type {?Function}\r\n\t\t\t */\r\n\t\t\tonShaderError: null\r\n\t\t};\r\n\r\n\t\t// clearing\r\n\r\n\t\tthis.autoClear = true;\r\n\t\tthis.autoClearColor = true;\r\n\t\tthis.autoClearDepth = true;\r\n\t\tthis.autoClearStencil = true;\r\n\r\n\t\t// scene graph\r\n\r\n\t\tthis.sortObjects = true;\r\n\r\n\t\t// user-defined clipping\r\n\r\n\t\tthis.clippingPlanes = [];\r\n\t\tthis.localClippingEnabled = false;\r\n\r\n\t\t// physically based shading\r\n\r\n\t\tthis._outputColorSpace = SRGBColorSpace;\r\n\r\n\t\t// tone mapping\r\n\r\n\t\tthis.toneMapping = NoToneMapping;\r\n\t\tthis.toneMappingExposure = 1.0;\r\n\r\n\t\t// internal properties\r\n\r\n\t\tconst _this = this;\r\n\r\n\t\tlet _isContextLost = false;\r\n\r\n\t\t// internal state cache\r\n\r\n\t\tlet _currentActiveCubeFace = 0;\r\n\t\tlet _currentActiveMipmapLevel = 0;\r\n\t\tlet _currentRenderTarget = null;\r\n\t\tlet _currentMaterialId = - 1;\r\n\r\n\t\tlet _currentCamera = null;\r\n\r\n\t\tconst _currentViewport = new Vector4();\r\n\t\tconst _currentScissor = new Vector4();\r\n\t\tlet _currentScissorTest = null;\r\n\r\n\t\tconst _currentClearColor = new Color( 0x000000 );\r\n\t\tlet _currentClearAlpha = 0;\r\n\r\n\t\t//\r\n\r\n\t\tlet _width = canvas.width;\r\n\t\tlet _height = canvas.height;\r\n\r\n\t\tlet _pixelRatio = 1;\r\n\t\tlet _opaqueSort = null;\r\n\t\tlet _transparentSort = null;\r\n\r\n\t\tconst _viewport = new Vector4( 0, 0, _width, _height );\r\n\t\tconst _scissor = new Vector4( 0, 0, _width, _height );\r\n\t\tlet _scissorTest = false;\r\n\r\n\t\t// frustum\r\n\r\n\t\tconst _frustum = new Frustum();\r\n\r\n\t\t// clipping\r\n\r\n\t\tlet _clippingEnabled = false;\r\n\t\tlet _localClippingEnabled = false;\r\n\r\n\t\t// camera matrices cache\r\n\r\n\t\tconst _projScreenMatrix = new Matrix4();\r\n\r\n\t\tconst _vector3 = new Vector3();\r\n\r\n\t\tconst _vector4 = new Vector4();\r\n\r\n\t\tconst _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };\r\n\r\n\t\tlet _renderBackground = false;\r\n\r\n\t\tfunction getTargetPixelRatio() {\r\n\r\n\t\t\treturn _currentRenderTarget === null ? _pixelRatio : 1;\r\n\r\n\t\t}\r\n\r\n\t\t// initialize\r\n\r\n\t\tlet _gl = context;\r\n\r\n\t\tfunction getContext( contextName, contextAttributes ) {\r\n\r\n\t\t\treturn canvas.getContext( contextName, contextAttributes );\r\n\r\n\t\t}\r\n\r\n\t\ttry {\r\n\r\n\t\t\tconst contextAttributes = {\r\n\t\t\t\talpha: true,\r\n\t\t\t\tdepth,\r\n\t\t\t\tstencil,\r\n\t\t\t\tantialias,\r\n\t\t\t\tpremultipliedAlpha,\r\n\t\t\t\tpreserveDrawingBuffer,\r\n\t\t\t\tpowerPreference,\r\n\t\t\t\tfailIfMajorPerformanceCaveat,\r\n\t\t\t};\r\n\r\n\t\t\t// OffscreenCanvas does not have setAttribute, see #22811\r\n\t\t\tif ( 'setAttribute' in canvas ) canvas.setAttribute( 'data-engine', `three.js r${REVISION}` );\r\n\r\n\t\t\t// event listeners must be registered before WebGL context is created, see #12753\r\n\t\t\tcanvas.addEventListener( 'webglcontextlost', onContextLost, false );\r\n\t\t\tcanvas.addEventListener( 'webglcontextrestored', onContextRestore, false );\r\n\t\t\tcanvas.addEventListener( 'webglcontextcreationerror', onContextCreationError, false );\r\n\r\n\t\t\tif ( _gl === null ) {\r\n\r\n\t\t\t\tconst contextName = 'webgl2';\r\n\r\n\t\t\t\t_gl = getContext( contextName, contextAttributes );\r\n\r\n\t\t\t\tif ( _gl === null ) {\r\n\r\n\t\t\t\t\tif ( getContext( contextName ) ) {\r\n\r\n\t\t\t\t\t\tthrow new Error( 'Error creating WebGL context with your selected attributes.' );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tthrow new Error( 'Error creating WebGL context.' );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} catch ( error ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLRenderer: ' + error.message );\r\n\t\t\tthrow error;\r\n\r\n\t\t}\r\n\r\n\t\tlet extensions, capabilities, state, info;\r\n\t\tlet properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;\r\n\t\tlet programCache, materials, renderLists, renderStates, clipping, shadowMap;\r\n\r\n\t\tlet background, morphtargets, bufferRenderer, indexedBufferRenderer;\r\n\r\n\t\tlet utils, bindingStates, uniformsGroups;\r\n\r\n\t\tfunction initGLContext() {\r\n\r\n\t\t\textensions = new WebGLExtensions( _gl );\r\n\t\t\textensions.init();\r\n\r\n\t\t\tutils = new WebGLUtils( _gl, extensions );\r\n\r\n\t\t\tcapabilities = new WebGLCapabilities( _gl, extensions, parameters, utils );\r\n\r\n\t\t\tstate = new WebGLState( _gl );\r\n\r\n\t\t\tinfo = new WebGLInfo( _gl );\r\n\t\t\tproperties = new WebGLProperties();\r\n\t\t\ttextures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );\r\n\t\t\tcubemaps = new WebGLCubeMaps( _this );\r\n\t\t\tcubeuvmaps = new WebGLCubeUVMaps( _this );\r\n\t\t\tattributes = new WebGLAttributes( _gl );\r\n\t\t\tbindingStates = new WebGLBindingStates( _gl, attributes );\r\n\t\t\tgeometries = new WebGLGeometries( _gl, attributes, info, bindingStates );\r\n\t\t\tobjects = new WebGLObjects( _gl, geometries, attributes, info );\r\n\t\t\tmorphtargets = new WebGLMorphtargets( _gl, capabilities, textures );\r\n\t\t\tclipping = new WebGLClipping( properties );\r\n\t\t\tprogramCache = new WebGLPrograms( _this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping );\r\n\t\t\tmaterials = new WebGLMaterials( _this, properties );\r\n\t\t\trenderLists = new WebGLRenderLists();\r\n\t\t\trenderStates = new WebGLRenderStates( extensions );\r\n\t\t\tbackground = new WebGLBackground( _this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha );\r\n\t\t\tshadowMap = new WebGLShadowMap( _this, objects, capabilities );\r\n\t\t\tuniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );\r\n\r\n\t\t\tbufferRenderer = new WebGLBufferRenderer( _gl, extensions, info );\r\n\t\t\tindexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info );\r\n\r\n\t\t\tinfo.programs = programCache.programs;\r\n\r\n\t\t\t_this.capabilities = capabilities;\r\n\t\t\t_this.extensions = extensions;\r\n\t\t\t_this.properties = properties;\r\n\t\t\t_this.renderLists = renderLists;\r\n\t\t\t_this.shadowMap = shadowMap;\r\n\t\t\t_this.state = state;\r\n\t\t\t_this.info = info;\r\n\r\n\t\t}\r\n\r\n\t\tinitGLContext();\r\n\r\n\t\t// xr\r\n\r\n\t\tconst xr = new WebXRManager( _this, _gl );\r\n\r\n\t\tthis.xr = xr;\r\n\r\n\t\t// API\r\n\r\n\t\tthis.getContext = function () {\r\n\r\n\t\t\treturn _gl;\r\n\r\n\t\t};\r\n\r\n\t\tthis.getContextAttributes = function () {\r\n\r\n\t\t\treturn _gl.getContextAttributes();\r\n\r\n\t\t};\r\n\r\n\t\tthis.forceContextLoss = function () {\r\n\r\n\t\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\r\n\t\t\tif ( extension ) extension.loseContext();\r\n\r\n\t\t};\r\n\r\n\t\tthis.forceContextRestore = function () {\r\n\r\n\t\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\r\n\t\t\tif ( extension ) extension.restoreContext();\r\n\r\n\t\t};\r\n\r\n\t\tthis.getPixelRatio = function () {\r\n\r\n\t\t\treturn _pixelRatio;\r\n\r\n\t\t};\r\n\r\n\t\tthis.setPixelRatio = function ( value ) {\r\n\r\n\t\t\tif ( value === undefined ) return;\r\n\r\n\t\t\t_pixelRatio = value;\r\n\r\n\t\t\tthis.setSize( _width, _height, false );\r\n\r\n\t\t};\r\n\r\n\t\tthis.getSize = function ( target ) {\r\n\r\n\t\t\treturn target.set( _width, _height );\r\n\r\n\t\t};\r\n\r\n\t\tthis.setSize = function ( width, height, updateStyle = true ) {\r\n\r\n\t\t\tif ( xr.isPresenting ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Can\\'t change size while VR device is presenting.' );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_width = width;\r\n\t\t\t_height = height;\r\n\r\n\t\t\tcanvas.width = Math.floor( width * _pixelRatio );\r\n\t\t\tcanvas.height = Math.floor( height * _pixelRatio );\r\n\r\n\t\t\tif ( updateStyle === true ) {\r\n\r\n\t\t\t\tcanvas.style.width = width + 'px';\r\n\t\t\t\tcanvas.style.height = height + 'px';\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.setViewport( 0, 0, width, height );\r\n\r\n\t\t};\r\n\r\n\t\tthis.getDrawingBufferSize = function ( target ) {\r\n\r\n\t\t\treturn target.set( _width * _pixelRatio, _height * _pixelRatio ).floor();\r\n\r\n\t\t};\r\n\r\n\t\tthis.setDrawingBufferSize = function ( width, height, pixelRatio ) {\r\n\r\n\t\t\t_width = width;\r\n\t\t\t_height = height;\r\n\r\n\t\t\t_pixelRatio = pixelRatio;\r\n\r\n\t\t\tcanvas.width = Math.floor( width * pixelRatio );\r\n\t\t\tcanvas.height = Math.floor( height * pixelRatio );\r\n\r\n\t\t\tthis.setViewport( 0, 0, width, height );\r\n\r\n\t\t};\r\n\r\n\t\tthis.getCurrentViewport = function ( target ) {\r\n\r\n\t\t\treturn target.copy( _currentViewport );\r\n\r\n\t\t};\r\n\r\n\t\tthis.getViewport = function ( target ) {\r\n\r\n\t\t\treturn target.copy( _viewport );\r\n\r\n\t\t};\r\n\r\n\t\tthis.setViewport = function ( x, y, width, height ) {\r\n\r\n\t\t\tif ( x.isVector4 ) {\r\n\r\n\t\t\t\t_viewport.set( x.x, x.y, x.z, x.w );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_viewport.set( x, y, width, height );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tstate.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).round() );\r\n\r\n\t\t};\r\n\r\n\t\tthis.getScissor = function ( target ) {\r\n\r\n\t\t\treturn target.copy( _scissor );\r\n\r\n\t\t};\r\n\r\n\t\tthis.setScissor = function ( x, y, width, height ) {\r\n\r\n\t\t\tif ( x.isVector4 ) {\r\n\r\n\t\t\t\t_scissor.set( x.x, x.y, x.z, x.w );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_scissor.set( x, y, width, height );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tstate.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).round() );\r\n\r\n\t\t};\r\n\r\n\t\tthis.getScissorTest = function () {\r\n\r\n\t\t\treturn _scissorTest;\r\n\r\n\t\t};\r\n\r\n\t\tthis.setScissorTest = function ( boolean ) {\r\n\r\n\t\t\tstate.setScissorTest( _scissorTest = boolean );\r\n\r\n\t\t};\r\n\r\n\t\tthis.setOpaqueSort = function ( method ) {\r\n\r\n\t\t\t_opaqueSort = method;\r\n\r\n\t\t};\r\n\r\n\t\tthis.setTransparentSort = function ( method ) {\r\n\r\n\t\t\t_transparentSort = method;\r\n\r\n\t\t};\r\n\r\n\t\t// Clearing\r\n\r\n\t\tthis.getClearColor = function ( target ) {\r\n\r\n\t\t\treturn target.copy( background.getClearColor() );\r\n\r\n\t\t};\r\n\r\n\t\tthis.setClearColor = function () {\r\n\r\n\t\t\tbackground.setClearColor.apply( background, arguments );\r\n\r\n\t\t};\r\n\r\n\t\tthis.getClearAlpha = function () {\r\n\r\n\t\t\treturn background.getClearAlpha();\r\n\r\n\t\t};\r\n\r\n\t\tthis.setClearAlpha = function () {\r\n\r\n\t\t\tbackground.setClearAlpha.apply( background, arguments );\r\n\r\n\t\t};\r\n\r\n\t\tthis.clear = function ( color = true, depth = true, stencil = true ) {\r\n\r\n\t\t\tlet bits = 0;\r\n\r\n\t\t\tif ( color ) {\r\n\r\n\t\t\t\t// check if we're trying to clear an integer target\r\n\t\t\t\tlet isIntegerFormat = false;\r\n\t\t\t\tif ( _currentRenderTarget !== null ) {\r\n\r\n\t\t\t\t\tconst targetFormat = _currentRenderTarget.texture.format;\r\n\t\t\t\t\tisIntegerFormat = targetFormat === RGBAIntegerFormat ||\r\n\t\t\t\t\t\ttargetFormat === RGIntegerFormat ||\r\n\t\t\t\t\t\ttargetFormat === RedIntegerFormat;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// use the appropriate clear functions to clear the target if it's a signed\r\n\t\t\t\t// or unsigned integer target\r\n\t\t\t\tif ( isIntegerFormat ) {\r\n\r\n\t\t\t\t\tconst targetType = _currentRenderTarget.texture.type;\r\n\t\t\t\t\tconst isUnsignedType = targetType === UnsignedByteType ||\r\n\t\t\t\t\t\ttargetType === UnsignedIntType ||\r\n\t\t\t\t\t\ttargetType === UnsignedShortType ||\r\n\t\t\t\t\t\ttargetType === UnsignedInt248Type ||\r\n\t\t\t\t\t\ttargetType === UnsignedShort4444Type ||\r\n\t\t\t\t\t\ttargetType === UnsignedShort5551Type;\r\n\r\n\t\t\t\t\tconst clearColor = background.getClearColor();\r\n\t\t\t\t\tconst a = background.getClearAlpha();\r\n\t\t\t\t\tconst r = clearColor.r;\r\n\t\t\t\t\tconst g = clearColor.g;\r\n\t\t\t\t\tconst b = clearColor.b;\r\n\r\n\t\t\t\t\tif ( isUnsignedType ) {\r\n\r\n\t\t\t\t\t\tuintClearColor[ 0 ] = r;\r\n\t\t\t\t\t\tuintClearColor[ 1 ] = g;\r\n\t\t\t\t\t\tuintClearColor[ 2 ] = b;\r\n\t\t\t\t\t\tuintClearColor[ 3 ] = a;\r\n\t\t\t\t\t\t_gl.clearBufferuiv( _gl.COLOR, 0, uintClearColor );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tintClearColor[ 0 ] = r;\r\n\t\t\t\t\t\tintClearColor[ 1 ] = g;\r\n\t\t\t\t\t\tintClearColor[ 2 ] = b;\r\n\t\t\t\t\t\tintClearColor[ 3 ] = a;\r\n\t\t\t\t\t\t_gl.clearBufferiv( _gl.COLOR, 0, intClearColor );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tbits |= _gl.COLOR_BUFFER_BIT;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( depth ) bits |= _gl.DEPTH_BUFFER_BIT;\r\n\t\t\tif ( stencil ) {\r\n\r\n\t\t\t\tbits |= _gl.STENCIL_BUFFER_BIT;\r\n\t\t\t\tthis.state.buffers.stencil.setMask( 0xffffffff );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.clear( bits );\r\n\r\n\t\t};\r\n\r\n\t\tthis.clearColor = function () {\r\n\r\n\t\t\tthis.clear( true, false, false );\r\n\r\n\t\t};\r\n\r\n\t\tthis.clearDepth = function () {\r\n\r\n\t\t\tthis.clear( false, true, false );\r\n\r\n\t\t};\r\n\r\n\t\tthis.clearStencil = function () {\r\n\r\n\t\t\tthis.clear( false, false, true );\r\n\r\n\t\t};\r\n\r\n\t\t//\r\n\r\n\t\tthis.dispose = function () {\r\n\r\n\t\t\tcanvas.removeEventListener( 'webglcontextlost', onContextLost, false );\r\n\t\t\tcanvas.removeEventListener( 'webglcontextrestored', onContextRestore, false );\r\n\t\t\tcanvas.removeEventListener( 'webglcontextcreationerror', onContextCreationError, false );\r\n\r\n\t\t\trenderLists.dispose();\r\n\t\t\trenderStates.dispose();\r\n\t\t\tproperties.dispose();\r\n\t\t\tcubemaps.dispose();\r\n\t\t\tcubeuvmaps.dispose();\r\n\t\t\tobjects.dispose();\r\n\t\t\tbindingStates.dispose();\r\n\t\t\tuniformsGroups.dispose();\r\n\t\t\tprogramCache.dispose();\r\n\r\n\t\t\txr.dispose();\r\n\r\n\t\t\txr.removeEventListener( 'sessionstart', onXRSessionStart );\r\n\t\t\txr.removeEventListener( 'sessionend', onXRSessionEnd );\r\n\r\n\t\t\tanimation.stop();\r\n\r\n\t\t};\r\n\r\n\t\t// Events\r\n\r\n\t\tfunction onContextLost( event ) {\r\n\r\n\t\t\tevent.preventDefault();\r\n\r\n\t\t\tconsole.log( 'THREE.WebGLRenderer: Context Lost.' );\r\n\r\n\t\t\t_isContextLost = true;\r\n\r\n\t\t}\r\n\r\n\t\tfunction onContextRestore( /* event */ ) {\r\n\r\n\t\t\tconsole.log( 'THREE.WebGLRenderer: Context Restored.' );\r\n\r\n\t\t\t_isContextLost = false;\r\n\r\n\t\t\tconst infoAutoReset = info.autoReset;\r\n\t\t\tconst shadowMapEnabled = shadowMap.enabled;\r\n\t\t\tconst shadowMapAutoUpdate = shadowMap.autoUpdate;\r\n\t\t\tconst shadowMapNeedsUpdate = shadowMap.needsUpdate;\r\n\t\t\tconst shadowMapType = shadowMap.type;\r\n\r\n\t\t\tinitGLContext();\r\n\r\n\t\t\tinfo.autoReset = infoAutoReset;\r\n\t\t\tshadowMap.enabled = shadowMapEnabled;\r\n\t\t\tshadowMap.autoUpdate = shadowMapAutoUpdate;\r\n\t\t\tshadowMap.needsUpdate = shadowMapNeedsUpdate;\r\n\t\t\tshadowMap.type = shadowMapType;\r\n\r\n\t\t}\r\n\r\n\t\tfunction onContextCreationError( event ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLRenderer: A WebGL context could not be created. Reason: ', event.statusMessage );\r\n\r\n\t\t}\r\n\r\n\t\tfunction onMaterialDispose( event ) {\r\n\r\n\t\t\tconst material = event.target;\r\n\r\n\t\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\r\n\r\n\t\t\tdeallocateMaterial( material );\r\n\r\n\t\t}\r\n\r\n\t\t// Buffer deallocation\r\n\r\n\t\tfunction deallocateMaterial( material ) {\r\n\r\n\t\t\treleaseMaterialProgramReferences( material );\r\n\r\n\t\t\tproperties.remove( material );\r\n\r\n\t\t}\r\n\r\n\r\n\t\tfunction releaseMaterialProgramReferences( material ) {\r\n\r\n\t\t\tconst programs = properties.get( material ).programs;\r\n\r\n\t\t\tif ( programs !== undefined ) {\r\n\r\n\t\t\t\tprograms.forEach( function ( program ) {\r\n\r\n\t\t\t\t\tprogramCache.releaseProgram( program );\r\n\r\n\t\t\t\t} );\r\n\r\n\t\t\t\tif ( material.isShaderMaterial ) {\r\n\r\n\t\t\t\t\tprogramCache.releaseShaderCache( material );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// Buffer rendering\r\n\r\n\t\tthis.renderBufferDirect = function ( camera, scene, geometry, material, object, group ) {\r\n\r\n\t\t\tif ( scene === null ) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)\r\n\r\n\t\t\tconst frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );\r\n\r\n\t\t\tconst program = setProgram( camera, scene, geometry, material, object );\r\n\r\n\t\t\tstate.setMaterial( material, frontFaceCW );\r\n\r\n\t\t\t//\r\n\r\n\t\t\tlet index = geometry.index;\r\n\t\t\tlet rangeFactor = 1;\r\n\r\n\t\t\tif ( material.wireframe === true ) {\r\n\r\n\t\t\t\tindex = geometries.getWireframeAttribute( geometry );\r\n\r\n\t\t\t\tif ( index === undefined ) return;\r\n\r\n\t\t\t\trangeFactor = 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\r\n\t\t\tconst drawRange = geometry.drawRange;\r\n\t\t\tconst position = geometry.attributes.position;\r\n\r\n\t\t\tlet drawStart = drawRange.start * rangeFactor;\r\n\t\t\tlet drawEnd = ( drawRange.start + drawRange.count ) * rangeFactor;\r\n\r\n\t\t\tif ( group !== null ) {\r\n\r\n\t\t\t\tdrawStart = Math.max( drawStart, group.start * rangeFactor );\r\n\t\t\t\tdrawEnd = Math.min( drawEnd, ( group.start + group.count ) * rangeFactor );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( index !== null ) {\r\n\r\n\t\t\t\tdrawStart = Math.max( drawStart, 0 );\r\n\t\t\t\tdrawEnd = Math.min( drawEnd, index.count );\r\n\r\n\t\t\t} else if ( position !== undefined && position !== null ) {\r\n\r\n\t\t\t\tdrawStart = Math.max( drawStart, 0 );\r\n\t\t\t\tdrawEnd = Math.min( drawEnd, position.count );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst drawCount = drawEnd - drawStart;\r\n\r\n\t\t\tif ( drawCount < 0 || drawCount === Infinity ) return;\r\n\r\n\t\t\t//\r\n\r\n\t\t\tbindingStates.setup( object, material, program, geometry, index );\r\n\r\n\t\t\tlet attribute;\r\n\t\t\tlet renderer = bufferRenderer;\r\n\r\n\t\t\tif ( index !== null ) {\r\n\r\n\t\t\t\tattribute = attributes.get( index );\r\n\r\n\t\t\t\trenderer = indexedBufferRenderer;\r\n\t\t\t\trenderer.setIndex( attribute );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\r\n\t\t\tif ( object.isMesh ) {\r\n\r\n\t\t\t\tif ( material.wireframe === true ) {\r\n\r\n\t\t\t\t\tstate.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() );\r\n\t\t\t\t\trenderer.setMode( _gl.LINES );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\trenderer.setMode( _gl.TRIANGLES );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( object.isLine ) {\r\n\r\n\t\t\t\tlet lineWidth = material.linewidth;\r\n\r\n\t\t\t\tif ( lineWidth === undefined ) lineWidth = 1; // Not using Line*Material\r\n\r\n\t\t\t\tstate.setLineWidth( lineWidth * getTargetPixelRatio() );\r\n\r\n\t\t\t\tif ( object.isLineSegments ) {\r\n\r\n\t\t\t\t\trenderer.setMode( _gl.LINES );\r\n\r\n\t\t\t\t} else if ( object.isLineLoop ) {\r\n\r\n\t\t\t\t\trenderer.setMode( _gl.LINE_LOOP );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\trenderer.setMode( _gl.LINE_STRIP );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( object.isPoints ) {\r\n\r\n\t\t\t\trenderer.setMode( _gl.POINTS );\r\n\r\n\t\t\t} else if ( object.isSprite ) {\r\n\r\n\t\t\t\trenderer.setMode( _gl.TRIANGLES );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( object.isBatchedMesh ) {\r\n\r\n\t\t\t\tif ( object._multiDrawInstances !== null ) {\r\n\r\n\t\t\t\t\trenderer.renderMultiDrawInstances( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif ( ! extensions.get( 'WEBGL_multi_draw' ) ) {\r\n\r\n\t\t\t\t\t\tconst starts = object._multiDrawStarts;\r\n\t\t\t\t\t\tconst counts = object._multiDrawCounts;\r\n\t\t\t\t\t\tconst drawCount = object._multiDrawCount;\r\n\t\t\t\t\t\tconst bytesPerElement = index ? attributes.get( index ).bytesPerElement : 1;\r\n\t\t\t\t\t\tconst uniforms = properties.get( material ).currentProgram.getUniforms();\r\n\t\t\t\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\r\n\r\n\t\t\t\t\t\t\tuniforms.setValue( _gl, '_gl_DrawID', i );\r\n\t\t\t\t\t\t\trenderer.render( starts[ i ] / bytesPerElement, counts[ i ] );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\trenderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( object.isInstancedMesh ) {\r\n\r\n\t\t\t\trenderer.renderInstances( drawStart, drawCount, object.count );\r\n\r\n\t\t\t} else if ( geometry.isInstancedBufferGeometry ) {\r\n\r\n\t\t\t\tconst maxInstanceCount = geometry._maxInstanceCount !== undefined ? geometry._maxInstanceCount : Infinity;\r\n\t\t\t\tconst instanceCount = Math.min( geometry.instanceCount, maxInstanceCount );\r\n\r\n\t\t\t\trenderer.renderInstances( drawStart, drawCount, instanceCount );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\trenderer.render( drawStart, drawCount );\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\t// Compile\r\n\r\n\t\tfunction prepareMaterial( material, scene, object ) {\r\n\r\n\t\t\tif ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {\r\n\r\n\t\t\t\tmaterial.side = BackSide;\r\n\t\t\t\tmaterial.needsUpdate = true;\r\n\t\t\t\tgetProgram( material, scene, object );\r\n\r\n\t\t\t\tmaterial.side = FrontSide;\r\n\t\t\t\tmaterial.needsUpdate = true;\r\n\t\t\t\tgetProgram( material, scene, object );\r\n\r\n\t\t\t\tmaterial.side = DoubleSide;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tgetProgram( material, scene, object );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.compile = function ( scene, camera, targetScene = null ) {\r\n\r\n\t\t\tif ( targetScene === null ) targetScene = scene;\r\n\r\n\t\t\tcurrentRenderState = renderStates.get( targetScene );\r\n\t\t\tcurrentRenderState.init( camera );\r\n\r\n\t\t\trenderStateStack.push( currentRenderState );\r\n\r\n\t\t\t// gather lights from both the target scene and the new object that will be added to the scene.\r\n\r\n\t\t\ttargetScene.traverseVisible( function ( object ) {\r\n\r\n\t\t\t\tif ( object.isLight && object.layers.test( camera.layers ) ) {\r\n\r\n\t\t\t\t\tcurrentRenderState.pushLight( object );\r\n\r\n\t\t\t\t\tif ( object.castShadow ) {\r\n\r\n\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t\tif ( scene !== targetScene ) {\r\n\r\n\t\t\t\tscene.traverseVisible( function ( object ) {\r\n\r\n\t\t\t\t\tif ( object.isLight && object.layers.test( camera.layers ) ) {\r\n\r\n\t\t\t\t\t\tcurrentRenderState.pushLight( object );\r\n\r\n\t\t\t\t\t\tif ( object.castShadow ) {\r\n\r\n\t\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcurrentRenderState.setupLights();\r\n\r\n\t\t\t// Only initialize materials in the new scene, not the targetScene.\r\n\r\n\t\t\tconst materials = new Set();\r\n\r\n\t\t\tscene.traverse( function ( object ) {\r\n\r\n\t\t\t\tconst material = object.material;\r\n\r\n\t\t\t\tif ( material ) {\r\n\r\n\t\t\t\t\tif ( Array.isArray( material ) ) {\r\n\r\n\t\t\t\t\t\tfor ( let i = 0; i < material.length; i ++ ) {\r\n\r\n\t\t\t\t\t\t\tconst material2 = material[ i ];\r\n\r\n\t\t\t\t\t\t\tprepareMaterial( material2, targetScene, object );\r\n\t\t\t\t\t\t\tmaterials.add( material2 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tprepareMaterial( material, targetScene, object );\r\n\t\t\t\t\t\tmaterials.add( material );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t\trenderStateStack.pop();\r\n\t\t\tcurrentRenderState = null;\r\n\r\n\t\t\treturn materials;\r\n\r\n\t\t};\r\n\r\n\t\t// compileAsync\r\n\r\n\t\tthis.compileAsync = function ( scene, camera, targetScene = null ) {\r\n\r\n\t\t\tconst materials = this.compile( scene, camera, targetScene );\r\n\r\n\t\t\t// Wait for all the materials in the new object to indicate that they're\r\n\t\t\t// ready to be used before resolving the promise.\r\n\r\n\t\t\treturn new Promise( ( resolve ) => {\r\n\r\n\t\t\t\tfunction checkMaterialsReady() {\r\n\r\n\t\t\t\t\tmaterials.forEach( function ( material ) {\r\n\r\n\t\t\t\t\t\tconst materialProperties = properties.get( material );\r\n\t\t\t\t\t\tconst program = materialProperties.currentProgram;\r\n\r\n\t\t\t\t\t\tif ( program.isReady() ) {\r\n\r\n\t\t\t\t\t\t\t// remove any programs that report they're ready to use from the list\r\n\t\t\t\t\t\t\tmaterials.delete( material );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} );\r\n\r\n\t\t\t\t\t// once the list of compiling materials is empty, call the callback\r\n\r\n\t\t\t\t\tif ( materials.size === 0 ) {\r\n\r\n\t\t\t\t\t\tresolve( scene );\r\n\t\t\t\t\t\treturn;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// if some materials are still not ready, wait a bit and check again\r\n\r\n\t\t\t\t\tsetTimeout( checkMaterialsReady, 10 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( extensions.get( 'KHR_parallel_shader_compile' ) !== null ) {\r\n\r\n\t\t\t\t\t// If we can check the compilation status of the materials without\r\n\t\t\t\t\t// blocking then do so right away.\r\n\r\n\t\t\t\t\tcheckMaterialsReady();\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// Otherwise start by waiting a bit to give the materials we just\r\n\t\t\t\t\t// initialized a chance to finish.\r\n\r\n\t\t\t\t\tsetTimeout( checkMaterialsReady, 10 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t};\r\n\r\n\t\t// Animation Loop\r\n\r\n\t\tlet onAnimationFrameCallback = null;\r\n\r\n\t\tfunction onAnimationFrame( time ) {\r\n\r\n\t\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time );\r\n\r\n\t\t}\r\n\r\n\t\tfunction onXRSessionStart() {\r\n\r\n\t\t\tanimation.stop();\r\n\r\n\t\t}\r\n\r\n\t\tfunction onXRSessionEnd() {\r\n\r\n\t\t\tanimation.start();\r\n\r\n\t\t}\r\n\r\n\t\tconst animation = new WebGLAnimation();\r\n\t\tanimation.setAnimationLoop( onAnimationFrame );\r\n\r\n\t\tif ( typeof self !== 'undefined' ) animation.setContext( self );\r\n\r\n\t\tthis.setAnimationLoop = function ( callback ) {\r\n\r\n\t\t\tonAnimationFrameCallback = callback;\r\n\t\t\txr.setAnimationLoop( callback );\r\n\r\n\t\t\t( callback === null ) ? animation.stop() : animation.start();\r\n\r\n\t\t};\r\n\r\n\t\txr.addEventListener( 'sessionstart', onXRSessionStart );\r\n\t\txr.addEventListener( 'sessionend', onXRSessionEnd );\r\n\r\n\t\t// Rendering\r\n\r\n\t\tthis.render = function ( scene, camera ) {\r\n\r\n\t\t\tif ( camera !== undefined && camera.isCamera !== true ) {\r\n\r\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.' );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( _isContextLost === true ) return;\r\n\r\n\t\t\t// update scene graph\r\n\r\n\t\t\tif ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();\r\n\r\n\t\t\t// update camera matrices and frustum\r\n\r\n\t\t\tif ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();\r\n\r\n\t\t\tif ( xr.enabled === true && xr.isPresenting === true ) {\r\n\r\n\t\t\t\tif ( xr.cameraAutoUpdate === true ) xr.updateCamera( camera );\r\n\r\n\t\t\t\tcamera = xr.getCamera(); // use XR camera for rendering\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\t\t\tif ( scene.isScene === true ) scene.onBeforeRender( _this, scene, camera, _currentRenderTarget );\r\n\r\n\t\t\tcurrentRenderState = renderStates.get( scene, renderStateStack.length );\r\n\t\t\tcurrentRenderState.init( camera );\r\n\r\n\t\t\trenderStateStack.push( currentRenderState );\r\n\r\n\t\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\r\n\t\t\t_frustum.setFromProjectionMatrix( _projScreenMatrix );\r\n\r\n\t\t\t_localClippingEnabled = this.localClippingEnabled;\r\n\t\t\t_clippingEnabled = clipping.init( this.clippingPlanes, _localClippingEnabled );\r\n\r\n\t\t\tcurrentRenderList = renderLists.get( scene, renderListStack.length );\r\n\t\t\tcurrentRenderList.init();\r\n\r\n\t\t\trenderListStack.push( currentRenderList );\r\n\r\n\t\t\tif ( xr.enabled === true && xr.isPresenting === true ) {\r\n\r\n\t\t\t\tconst depthSensingMesh = _this.xr.getDepthSensingMesh();\r\n\r\n\t\t\t\tif ( depthSensingMesh !== null ) {\r\n\r\n\t\t\t\t\tprojectObject( depthSensingMesh, camera, - Infinity, _this.sortObjects );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tprojectObject( scene, camera, 0, _this.sortObjects );\r\n\r\n\t\t\tcurrentRenderList.finish();\r\n\r\n\t\t\tif ( _this.sortObjects === true ) {\r\n\r\n\t\t\t\tcurrentRenderList.sort( _opaqueSort, _transparentSort );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_renderBackground = xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false;\r\n\t\t\tif ( _renderBackground ) {\r\n\r\n\t\t\t\tbackground.addToRenderList( currentRenderList, scene );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\r\n\t\t\tthis.info.render.frame ++;\r\n\r\n\t\t\tif ( _clippingEnabled === true ) clipping.beginShadows();\r\n\r\n\t\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\r\n\r\n\t\t\tshadowMap.render( shadowsArray, scene, camera );\r\n\r\n\t\t\tif ( _clippingEnabled === true ) clipping.endShadows();\r\n\r\n\t\t\t//\r\n\r\n\t\t\tif ( this.info.autoReset === true ) this.info.reset();\r\n\r\n\t\t\t// render scene\r\n\r\n\t\t\tconst opaqueObjects = currentRenderList.opaque;\r\n\t\t\tconst transmissiveObjects = currentRenderList.transmissive;\r\n\r\n\t\t\tcurrentRenderState.setupLights();\r\n\r\n\t\t\tif ( camera.isArrayCamera ) {\r\n\r\n\t\t\t\tconst cameras = camera.cameras;\r\n\r\n\t\t\t\tif ( transmissiveObjects.length > 0 ) {\r\n\r\n\t\t\t\t\tfor ( let i = 0, l = cameras.length; i < l; i ++ ) {\r\n\r\n\t\t\t\t\t\tconst camera2 = cameras[ i ];\r\n\r\n\t\t\t\t\t\trenderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera2 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( _renderBackground ) background.render( scene );\r\n\r\n\t\t\t\tfor ( let i = 0, l = cameras.length; i < l; i ++ ) {\r\n\r\n\t\t\t\t\tconst camera2 = cameras[ i ];\r\n\r\n\t\t\t\t\trenderScene( currentRenderList, scene, camera2, camera2.viewport );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );\r\n\r\n\t\t\t\tif ( _renderBackground ) background.render( scene );\r\n\r\n\t\t\t\trenderScene( currentRenderList, scene, camera );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\r\n\t\t\tif ( _currentRenderTarget !== null ) {\r\n\r\n\t\t\t\t// resolve multisample renderbuffers to a single-sample texture if necessary\r\n\r\n\t\t\t\ttextures.updateMultisampleRenderTarget( _currentRenderTarget );\r\n\r\n\t\t\t\t// Generate mipmap if we're using any kind of mipmap filtering\r\n\r\n\t\t\t\ttextures.updateRenderTargetMipmap( _currentRenderTarget );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\r\n\t\t\tif ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );\r\n\r\n\t\t\t// _gl.finish();\r\n\r\n\t\t\tbindingStates.resetDefaultState();\r\n\t\t\t_currentMaterialId = - 1;\r\n\t\t\t_currentCamera = null;\r\n\r\n\t\t\trenderStateStack.pop();\r\n\r\n\t\t\tif ( renderStateStack.length > 0 ) {\r\n\r\n\t\t\t\tcurrentRenderState = renderStateStack[ renderStateStack.length - 1 ];\r\n\r\n\t\t\t\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, currentRenderState.state.camera );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tcurrentRenderState = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\trenderListStack.pop();\r\n\r\n\t\t\tif ( renderListStack.length > 0 ) {\r\n\r\n\t\t\t\tcurrentRenderList = renderListStack[ renderListStack.length - 1 ];\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tcurrentRenderList = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tfunction projectObject( object, camera, groupOrder, sortObjects ) {\r\n\r\n\t\t\tif ( object.visible === false ) return;\r\n\r\n\t\t\tconst visible = object.layers.test( camera.layers );\r\n\r\n\t\t\tif ( visible ) {\r\n\r\n\t\t\t\tif ( object.isGroup ) {\r\n\r\n\t\t\t\t\tgroupOrder = object.renderOrder;\r\n\r\n\t\t\t\t} else if ( object.isLOD ) {\r\n\r\n\t\t\t\t\tif ( object.autoUpdate === true ) object.update( camera );\r\n\r\n\t\t\t\t} else if ( object.isLight ) {\r\n\r\n\t\t\t\t\tcurrentRenderState.pushLight( object );\r\n\r\n\t\t\t\t\tif ( object.castShadow ) {\r\n\r\n\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else if ( object.isSprite ) {\r\n\r\n\t\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsSprite( object ) ) {\r\n\r\n\t\t\t\t\t\tif ( sortObjects ) {\r\n\r\n\t\t\t\t\t\t\t_vector4.setFromMatrixPosition( object.matrixWorld )\r\n\t\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tconst geometry = objects.update( object );\r\n\t\t\t\t\t\tconst material = object.material;\r\n\r\n\t\t\t\t\t\tif ( material.visible ) {\r\n\r\n\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector4.z, null );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else if ( object.isMesh || object.isLine || object.isPoints ) {\r\n\r\n\t\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) {\r\n\r\n\t\t\t\t\t\tconst geometry = objects.update( object );\r\n\t\t\t\t\t\tconst material = object.material;\r\n\r\n\t\t\t\t\t\tif ( sortObjects ) {\r\n\r\n\t\t\t\t\t\t\tif ( object.boundingSphere !== undefined ) {\r\n\r\n\t\t\t\t\t\t\t\tif ( object.boundingSphere === null ) object.computeBoundingSphere();\r\n\t\t\t\t\t\t\t\t_vector4.copy( object.boundingSphere.center );\r\n\r\n\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\r\n\t\t\t\t\t\t\t\t_vector4.copy( geometry.boundingSphere.center );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t_vector4\r\n\t\t\t\t\t\t\t\t.applyMatrix4( object.matrixWorld )\r\n\t\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( Array.isArray( material ) ) {\r\n\r\n\t\t\t\t\t\t\tconst groups = geometry.groups;\r\n\r\n\t\t\t\t\t\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\r\n\r\n\t\t\t\t\t\t\t\tconst group = groups[ i ];\r\n\t\t\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\r\n\r\n\t\t\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\r\n\r\n\t\t\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, groupMaterial, groupOrder, _vector4.z, group );\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t} else if ( material.visible ) {\r\n\r\n\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector4.z, null );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst children = object.children;\r\n\r\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tprojectObject( children[ i ], camera, groupOrder, sortObjects );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction renderScene( currentRenderList, scene, camera, viewport ) {\r\n\r\n\t\t\tconst opaqueObjects = currentRenderList.opaque;\r\n\t\t\tconst transmissiveObjects = currentRenderList.transmissive;\r\n\t\t\tconst transparentObjects = currentRenderList.transparent;\r\n\r\n\t\t\tcurrentRenderState.setupLightsView( camera );\r\n\r\n\t\t\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, camera );\r\n\r\n\t\t\tif ( viewport ) state.viewport( _currentViewport.copy( viewport ) );\r\n\r\n\t\t\tif ( opaqueObjects.length > 0 ) renderObjects( opaqueObjects, scene, camera );\r\n\t\t\tif ( transmissiveObjects.length > 0 ) renderObjects( transmissiveObjects, scene, camera );\r\n\t\t\tif ( transparentObjects.length > 0 ) renderObjects( transparentObjects, scene, camera );\r\n\r\n\t\t\t// Ensure depth buffer writing is enabled so it can be cleared on next render\r\n\r\n\t\t\tstate.buffers.depth.setTest( true );\r\n\t\t\tstate.buffers.depth.setMask( true );\r\n\t\t\tstate.buffers.color.setMask( true );\r\n\r\n\t\t\tstate.setPolygonOffset( false );\r\n\r\n\t\t}\r\n\r\n\t\tfunction renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera ) {\r\n\r\n\t\t\tconst overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\r\n\r\n\t\t\tif ( overrideMaterial !== null ) {\r\n\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( currentRenderState.state.transmissionRenderTarget[ camera.id ] === undefined ) {\r\n\r\n\t\t\t\tcurrentRenderState.state.transmissionRenderTarget[ camera.id ] = new WebGLRenderTarget( 1, 1, {\r\n\t\t\t\t\tgenerateMipmaps: true,\r\n\t\t\t\t\ttype: ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) ) ? HalfFloatType : UnsignedByteType,\r\n\t\t\t\t\tminFilter: LinearMipmapLinearFilter,\r\n\t\t\t\t\tsamples: 4,\r\n\t\t\t\t\tstencilBuffer: stencil,\r\n\t\t\t\t\tresolveDepthBuffer: false,\r\n\t\t\t\t\tresolveStencilBuffer: false,\r\n\t\t\t\t\tcolorSpace: ColorManagement.workingColorSpace,\r\n\t\t\t\t} );\r\n\r\n\t\t\t\t// debug\r\n\r\n\t\t\t\t/*\r\n\t\t\t\tconst geometry = new PlaneGeometry();\r\n\t\t\t\tconst material = new MeshBasicMaterial( { map: _transmissionRenderTarget.texture } );\r\n\r\n\t\t\t\tconst mesh = new Mesh( geometry, material );\r\n\t\t\t\tscene.add( mesh );\r\n\t\t\t\t*/\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst transmissionRenderTarget = currentRenderState.state.transmissionRenderTarget[ camera.id ];\r\n\r\n\t\t\tconst activeViewport = camera.viewport || _currentViewport;\r\n\t\t\ttransmissionRenderTarget.setSize( activeViewport.z, activeViewport.w );\r\n\r\n\t\t\t//\r\n\r\n\t\t\tconst currentRenderTarget = _this.getRenderTarget();\r\n\t\t\t_this.setRenderTarget( transmissionRenderTarget );\r\n\r\n\t\t\t_this.getClearColor( _currentClearColor );\r\n\t\t\t_currentClearAlpha = _this.getClearAlpha();\r\n\t\t\tif ( _currentClearAlpha < 1 ) _this.setClearColor( 0xffffff, 0.5 );\r\n\r\n\t\t\t_this.clear();\r\n\r\n\t\t\tif ( _renderBackground ) background.render( scene );\r\n\r\n\t\t\t// Turn off the features which can affect the frag color for opaque objects pass.\r\n\t\t\t// Otherwise they are applied twice in opaque objects pass and transmission objects pass.\r\n\t\t\tconst currentToneMapping = _this.toneMapping;\r\n\t\t\t_this.toneMapping = NoToneMapping;\r\n\r\n\t\t\t// Remove viewport from camera to avoid nested render calls resetting viewport to it (e.g Reflector).\r\n\t\t\t// Transmission render pass requires viewport to match the transmissionRenderTarget.\r\n\t\t\tconst currentCameraViewport = camera.viewport;\r\n\t\t\tif ( camera.viewport !== undefined ) camera.viewport = undefined;\r\n\r\n\t\t\tcurrentRenderState.setupLightsView( camera );\r\n\r\n\t\t\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, camera );\r\n\r\n\t\t\trenderObjects( opaqueObjects, scene, camera );\r\n\r\n\t\t\ttextures.updateMultisampleRenderTarget( transmissionRenderTarget );\r\n\t\t\ttextures.updateRenderTargetMipmap( transmissionRenderTarget );\r\n\r\n\t\t\tif ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === false ) { // see #28131\r\n\r\n\t\t\t\tlet renderTargetNeedsUpdate = false;\r\n\r\n\t\t\t\tfor ( let i = 0, l = transmissiveObjects.length; i < l; i ++ ) {\r\n\r\n\t\t\t\t\tconst renderItem = transmissiveObjects[ i ];\r\n\r\n\t\t\t\t\tconst object = renderItem.object;\r\n\t\t\t\t\tconst geometry = renderItem.geometry;\r\n\t\t\t\t\tconst material = renderItem.material;\r\n\t\t\t\t\tconst group = renderItem.group;\r\n\r\n\t\t\t\t\tif ( material.side === DoubleSide && object.layers.test( camera.layers ) ) {\r\n\r\n\t\t\t\t\t\tconst currentSide = material.side;\r\n\r\n\t\t\t\t\t\tmaterial.side = BackSide;\r\n\t\t\t\t\t\tmaterial.needsUpdate = true;\r\n\r\n\t\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\r\n\r\n\t\t\t\t\t\tmaterial.side = currentSide;\r\n\t\t\t\t\t\tmaterial.needsUpdate = true;\r\n\r\n\t\t\t\t\t\trenderTargetNeedsUpdate = true;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( renderTargetNeedsUpdate === true ) {\r\n\r\n\t\t\t\t\ttextures.updateMultisampleRenderTarget( transmissionRenderTarget );\r\n\t\t\t\t\ttextures.updateRenderTargetMipmap( transmissionRenderTarget );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_this.setRenderTarget( currentRenderTarget );\r\n\r\n\t\t\t_this.setClearColor( _currentClearColor, _currentClearAlpha );\r\n\r\n\t\t\tif ( currentCameraViewport !== undefined ) camera.viewport = currentCameraViewport;\r\n\r\n\t\t\t_this.toneMapping = currentToneMapping;\r\n\r\n\t\t}\r\n\r\n\t\tfunction renderObjects( renderList, scene, camera ) {\r\n\r\n\t\t\tconst overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\r\n\r\n\t\t\tfor ( let i = 0, l = renderList.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tconst renderItem = renderList[ i ];\r\n\r\n\t\t\t\tconst object = renderItem.object;\r\n\t\t\t\tconst geometry = renderItem.geometry;\r\n\t\t\t\tconst material = overrideMaterial === null ? renderItem.material : overrideMaterial;\r\n\t\t\t\tconst group = renderItem.group;\r\n\r\n\t\t\t\tif ( object.layers.test( camera.layers ) ) {\r\n\r\n\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction renderObject( object, scene, camera, geometry, material, group ) {\r\n\r\n\t\t\tobject.onBeforeRender( _this, scene, camera, geometry, material, group );\r\n\r\n\t\t\tobject.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );\r\n\t\t\tobject.normalMatrix.getNormalMatrix( object.modelViewMatrix );\r\n\r\n\t\t\tmaterial.onBeforeRender( _this, scene, camera, geometry, object, group );\r\n\r\n\t\t\tif ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {\r\n\r\n\t\t\t\tmaterial.side = BackSide;\r\n\t\t\t\tmaterial.needsUpdate = true;\r\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\r\n\r\n\t\t\t\tmaterial.side = FrontSide;\r\n\t\t\t\tmaterial.needsUpdate = true;\r\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\r\n\r\n\t\t\t\tmaterial.side = DoubleSide;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobject.onAfterRender( _this, scene, camera, geometry, material, group );\r\n\r\n\t\t}\r\n\r\n\t\tfunction getProgram( material, scene, object ) {\r\n\r\n\t\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\r\n\r\n\t\t\tconst materialProperties = properties.get( material );\r\n\r\n\t\t\tconst lights = currentRenderState.state.lights;\r\n\t\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\r\n\r\n\t\t\tconst lightsStateVersion = lights.state.version;\r\n\r\n\t\t\tconst parameters = programCache.getParameters( material, lights.state, shadowsArray, scene, object );\r\n\t\t\tconst programCacheKey = programCache.getProgramCacheKey( parameters );\r\n\r\n\t\t\tlet programs = materialProperties.programs;\r\n\r\n\t\t\t// always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change\r\n\r\n\t\t\tmaterialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;\r\n\t\t\tmaterialProperties.fog = scene.fog;\r\n\t\t\tmaterialProperties.envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || materialProperties.environment );\r\n\t\t\tmaterialProperties.envMapRotation = ( materialProperties.environment !== null && material.envMap === null ) ? scene.environmentRotation : material.envMapRotation;\r\n\r\n\t\t\tif ( programs === undefined ) {\r\n\r\n\t\t\t\t// new material\r\n\r\n\t\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\r\n\r\n\t\t\t\tprograms = new Map();\r\n\t\t\t\tmaterialProperties.programs = programs;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlet program = programs.get( programCacheKey );\r\n\r\n\t\t\tif ( program !== undefined ) {\r\n\r\n\t\t\t\t// early out if program and light state is identical\r\n\r\n\t\t\t\tif ( materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion ) {\r\n\r\n\t\t\t\t\tupdateCommonMaterialProperties( material, parameters );\r\n\r\n\t\t\t\t\treturn program;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tparameters.uniforms = programCache.getUniforms( material );\r\n\r\n\t\t\t\tmaterial.onBeforeCompile( parameters, _this );\r\n\r\n\t\t\t\tprogram = programCache.acquireProgram( parameters, programCacheKey );\r\n\t\t\t\tprograms.set( programCacheKey, program );\r\n\r\n\t\t\t\tmaterialProperties.uniforms = parameters.uniforms;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst uniforms = materialProperties.uniforms;\r\n\r\n\t\t\tif ( ( ! material.isShaderMaterial && ! material.isRawShaderMaterial ) || material.clipping === true ) {\r\n\r\n\t\t\t\tuniforms.clippingPlanes = clipping.uniform;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tupdateCommonMaterialProperties( material, parameters );\r\n\r\n\t\t\t// store the light setup it was created for\r\n\r\n\t\t\tmaterialProperties.needsLights = materialNeedsLights( material );\r\n\t\t\tmaterialProperties.lightsStateVersion = lightsStateVersion;\r\n\r\n\t\t\tif ( materialProperties.needsLights ) {\r\n\r\n\t\t\t\t// wire up the material to this renderer's lighting state\r\n\r\n\t\t\t\tuniforms.ambientLightColor.value = lights.state.ambient;\r\n\t\t\t\tuniforms.lightProbe.value = lights.state.probe;\r\n\t\t\t\tuniforms.directionalLights.value = lights.state.directional;\r\n\t\t\t\tuniforms.directionalLightShadows.value = lights.state.directionalShadow;\r\n\t\t\t\tuniforms.spotLights.value = lights.state.spot;\r\n\t\t\t\tuniforms.spotLightShadows.value = lights.state.spotShadow;\r\n\t\t\t\tuniforms.rectAreaLights.value = lights.state.rectArea;\r\n\t\t\t\tuniforms.ltc_1.value = lights.state.rectAreaLTC1;\r\n\t\t\t\tuniforms.ltc_2.value = lights.state.rectAreaLTC2;\r\n\t\t\t\tuniforms.pointLights.value = lights.state.point;\r\n\t\t\t\tuniforms.pointLightShadows.value = lights.state.pointShadow;\r\n\t\t\t\tuniforms.hemisphereLights.value = lights.state.hemi;\r\n\r\n\t\t\t\tuniforms.directionalShadowMap.value = lights.state.directionalShadowMap;\r\n\t\t\t\tuniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;\r\n\t\t\t\tuniforms.spotShadowMap.value = lights.state.spotShadowMap;\r\n\t\t\t\tuniforms.spotLightMatrix.value = lights.state.spotLightMatrix;\r\n\t\t\t\tuniforms.spotLightMap.value = lights.state.spotLightMap;\r\n\t\t\t\tuniforms.pointShadowMap.value = lights.state.pointShadowMap;\r\n\t\t\t\tuniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;\r\n\t\t\t\t// TODO (abelnation): add area lights shadow info to uniforms\r\n\r\n\t\t\t}\r\n\r\n\t\t\tmaterialProperties.currentProgram = program;\r\n\t\t\tmaterialProperties.uniformsList = null;\r\n\r\n\t\t\treturn program;\r\n\r\n\t\t}\r\n\r\n\t\tfunction getUniformList( materialProperties ) {\r\n\r\n\t\t\tif ( materialProperties.uniformsList === null ) {\r\n\r\n\t\t\t\tconst progUniforms = materialProperties.currentProgram.getUniforms();\r\n\t\t\t\tmaterialProperties.uniformsList = WebGLUniforms.seqWithValue( progUniforms.seq, materialProperties.uniforms );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn materialProperties.uniformsList;\r\n\r\n\t\t}\r\n\r\n\t\tfunction updateCommonMaterialProperties( material, parameters ) {\r\n\r\n\t\t\tconst materialProperties = properties.get( material );\r\n\r\n\t\t\tmaterialProperties.outputColorSpace = parameters.outputColorSpace;\r\n\t\t\tmaterialProperties.batching = parameters.batching;\r\n\t\t\tmaterialProperties.batchingColor = parameters.batchingColor;\r\n\t\t\tmaterialProperties.instancing = parameters.instancing;\r\n\t\t\tmaterialProperties.instancingColor = parameters.instancingColor;\r\n\t\t\tmaterialProperties.instancingMorph = parameters.instancingMorph;\r\n\t\t\tmaterialProperties.skinning = parameters.skinning;\r\n\t\t\tmaterialProperties.morphTargets = parameters.morphTargets;\r\n\t\t\tmaterialProperties.morphNormals = parameters.morphNormals;\r\n\t\t\tmaterialProperties.morphColors = parameters.morphColors;\r\n\t\t\tmaterialProperties.morphTargetsCount = parameters.morphTargetsCount;\r\n\t\t\tmaterialProperties.numClippingPlanes = parameters.numClippingPlanes;\r\n\t\t\tmaterialProperties.numIntersection = parameters.numClipIntersection;\r\n\t\t\tmaterialProperties.vertexAlphas = parameters.vertexAlphas;\r\n\t\t\tmaterialProperties.vertexTangents = parameters.vertexTangents;\r\n\t\t\tmaterialProperties.toneMapping = parameters.toneMapping;\r\n\r\n\t\t}\r\n\r\n\t\tfunction setProgram( camera, scene, geometry, material, object ) {\r\n\r\n\t\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\r\n\r\n\t\t\ttextures.resetTextureUnits();\r\n\r\n\t\t\tconst fog = scene.fog;\r\n\t\t\tconst environment = material.isMeshStandardMaterial ? scene.environment : null;\r\n\t\t\tconst colorSpace = ( _currentRenderTarget === null ) ? _this.outputColorSpace : ( _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace );\r\n\t\t\tconst envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );\r\n\t\t\tconst vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;\r\n\t\t\tconst vertexTangents = !! geometry.attributes.tangent && ( !! material.normalMap || material.anisotropy > 0 );\r\n\t\t\tconst morphTargets = !! geometry.morphAttributes.position;\r\n\t\t\tconst morphNormals = !! geometry.morphAttributes.normal;\r\n\t\t\tconst morphColors = !! geometry.morphAttributes.color;\r\n\r\n\t\t\tlet toneMapping = NoToneMapping;\r\n\r\n\t\t\tif ( material.toneMapped ) {\r\n\r\n\t\t\t\tif ( _currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true ) {\r\n\r\n\t\t\t\t\ttoneMapping = _this.toneMapping;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\r\n\t\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\r\n\r\n\t\t\tconst materialProperties = properties.get( material );\r\n\t\t\tconst lights = currentRenderState.state.lights;\r\n\r\n\t\t\tif ( _clippingEnabled === true ) {\r\n\r\n\t\t\t\tif ( _localClippingEnabled === true || camera !== _currentCamera ) {\r\n\r\n\t\t\t\t\tconst useCache =\r\n\t\t\t\t\t\tcamera === _currentCamera &&\r\n\t\t\t\t\t\tmaterial.id === _currentMaterialId;\r\n\r\n\t\t\t\t\t// we might want to call this function with some ClippingGroup\r\n\t\t\t\t\t// object instead of the material, once it becomes feasible\r\n\t\t\t\t\t// (#8465, #8379)\r\n\t\t\t\t\tclipping.setState( material, camera, useCache );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\r\n\t\t\tlet needsProgramChange = false;\r\n\r\n\t\t\tif ( material.version === materialProperties.__version ) {\r\n\r\n\t\t\t\tif ( materialProperties.needsLights && ( materialProperties.lightsStateVersion !== lights.state.version ) ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( materialProperties.outputColorSpace !== colorSpace ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( object.isBatchedMesh && materialProperties.batching === false ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( ! object.isBatchedMesh && materialProperties.batching === true ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( object.isBatchedMesh && materialProperties.batchingColor === true && object.colorTexture === null ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( object.isBatchedMesh && materialProperties.batchingColor === false && object.colorTexture !== null ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancing === false ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( ! object.isInstancedMesh && materialProperties.instancing === true ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( object.isSkinnedMesh && materialProperties.skinning === false ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( ! object.isSkinnedMesh && materialProperties.skinning === true ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingColor === true && object.instanceColor === null ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingColor === false && object.instanceColor !== null ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingMorph === true && object.morphTexture === null ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingMorph === false && object.morphTexture !== null ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( materialProperties.envMap !== envMap ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( material.fog === true && materialProperties.fog !== fog ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( materialProperties.numClippingPlanes !== undefined &&\r\n\t\t\t\t\t( materialProperties.numClippingPlanes !== clipping.numPlanes ||\r\n\t\t\t\t\tmaterialProperties.numIntersection !== clipping.numIntersection ) ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( materialProperties.vertexAlphas !== vertexAlphas ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( materialProperties.vertexTangents !== vertexTangents ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( materialProperties.morphTargets !== morphTargets ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( materialProperties.morphNormals !== morphNormals ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( materialProperties.morphColors !== morphColors ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( materialProperties.toneMapping !== toneMapping ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t} else if ( materialProperties.morphTargetsCount !== morphTargetsCount ) {\r\n\r\n\t\t\t\t\tneedsProgramChange = true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tneedsProgramChange = true;\r\n\t\t\t\tmaterialProperties.__version = material.version;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\r\n\t\t\tlet program = materialProperties.currentProgram;\r\n\r\n\t\t\tif ( needsProgramChange === true ) {\r\n\r\n\t\t\t\tprogram = getProgram( material, scene, object );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlet refreshProgram = false;\r\n\t\t\tlet refreshMaterial = false;\r\n\t\t\tlet refreshLights = false;\r\n\r\n\t\t\tconst p_uniforms = program.getUniforms(),\r\n\t\t\t\tm_uniforms = materialProperties.uniforms;\r\n\r\n\t\t\tif ( state.useProgram( program.program ) ) {\r\n\r\n\t\t\t\trefreshProgram = true;\r\n\t\t\t\trefreshMaterial = true;\r\n\t\t\t\trefreshLights = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( material.id !== _currentMaterialId ) {\r\n\r\n\t\t\t\t_currentMaterialId = material.id;\r\n\r\n\t\t\t\trefreshMaterial = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( refreshProgram || _currentCamera !== camera ) {\r\n\r\n\t\t\t\t// common camera uniforms\r\n\r\n\t\t\t\tp_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );\r\n\t\t\t\tp_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );\r\n\r\n\t\t\t\tconst uCamPos = p_uniforms.map.cameraPosition;\r\n\r\n\t\t\t\tif ( uCamPos !== undefined ) {\r\n\r\n\t\t\t\t\tuCamPos.setValue( _gl, _vector3.setFromMatrixPosition( camera.matrixWorld ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( capabilities.logarithmicDepthBuffer ) {\r\n\r\n\t\t\t\t\tp_uniforms.setValue( _gl, 'logDepthBufFC',\r\n\t\t\t\t\t\t2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// consider moving isOrthographic to UniformLib and WebGLMaterials, see https://github.com/mrdoob/three.js/pull/26467#issuecomment-1645185067\r\n\r\n\t\t\t\tif ( material.isMeshPhongMaterial ||\r\n\t\t\t\t\tmaterial.isMeshToonMaterial ||\r\n\t\t\t\t\tmaterial.isMeshLambertMaterial ||\r\n\t\t\t\t\tmaterial.isMeshBasicMaterial ||\r\n\t\t\t\t\tmaterial.isMeshStandardMaterial ||\r\n\t\t\t\t\tmaterial.isShaderMaterial ) {\r\n\r\n\t\t\t\t\tp_uniforms.setValue( _gl, 'isOrthographic', camera.isOrthographicCamera === true );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( _currentCamera !== camera ) {\r\n\r\n\t\t\t\t\t_currentCamera = camera;\r\n\r\n\t\t\t\t\t// lighting uniforms depend on the camera so enforce an update\r\n\t\t\t\t\t// now, in case this material supports lights - or later, when\r\n\t\t\t\t\t// the next material that does gets activated:\r\n\r\n\t\t\t\t\trefreshMaterial = true;\t\t// set to true on material change\r\n\t\t\t\t\trefreshLights = true;\t\t// remains set until update done\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// skinning and morph target uniforms must be set even if material didn't change\r\n\t\t\t// auto-setting of texture unit for bone and morph texture must go before other textures\r\n\t\t\t// otherwise textures used for skinning and morphing can take over texture units reserved for other material textures\r\n\r\n\t\t\tif ( object.isSkinnedMesh ) {\r\n\r\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrix' );\r\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrixInverse' );\r\n\r\n\t\t\t\tconst skeleton = object.skeleton;\r\n\r\n\t\t\t\tif ( skeleton ) {\r\n\r\n\t\t\t\t\tif ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();\r\n\r\n\t\t\t\t\tp_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( object.isBatchedMesh ) {\r\n\r\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'batchingTexture' );\r\n\t\t\t\tp_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );\r\n\r\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'batchingIdTexture' );\r\n\t\t\t\tp_uniforms.setValue( _gl, 'batchingIdTexture', object._indirectTexture, textures );\r\n\r\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'batchingColorTexture' );\r\n\t\t\t\tif ( object._colorsTexture !== null ) {\r\n\r\n\t\t\t\t\tp_uniforms.setValue( _gl, 'batchingColorTexture', object._colorsTexture, textures );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst morphAttributes = geometry.morphAttributes;\r\n\r\n\t\t\tif ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined ) ) {\r\n\r\n\t\t\t\tmorphtargets.update( object, geometry, program );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) {\r\n\r\n\t\t\t\tmaterialProperties.receiveShadow = object.receiveShadow;\r\n\t\t\t\tp_uniforms.setValue( _gl, 'receiveShadow', object.receiveShadow );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// https://github.com/mrdoob/three.js/pull/24467#issuecomment-1209031512\r\n\r\n\t\t\tif ( material.isMeshGouraudMaterial && material.envMap !== null ) {\r\n\r\n\t\t\t\tm_uniforms.envMap.value = envMap;\r\n\r\n\t\t\t\tm_uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( material.isMeshStandardMaterial && material.envMap === null && scene.environment !== null ) {\r\n\r\n\t\t\t\tm_uniforms.envMapIntensity.value = scene.environmentIntensity;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( refreshMaterial ) {\r\n\r\n\t\t\t\tp_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );\r\n\r\n\t\t\t\tif ( materialProperties.needsLights ) {\r\n\r\n\t\t\t\t\t// the current material requires lighting info\r\n\r\n\t\t\t\t\t// note: all lighting uniforms are always set correctly\r\n\t\t\t\t\t// they simply reference the renderer's state for their\r\n\t\t\t\t\t// values\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// use the current material's .needsUpdate flags to set\r\n\t\t\t\t\t// the GL state when required\r\n\r\n\t\t\t\t\tmarkUniformsLightsNeedsUpdate( m_uniforms, refreshLights );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// refresh uniforms common to several materials\r\n\r\n\t\t\t\tif ( fog && material.fog === true ) {\r\n\r\n\t\t\t\t\tmaterials.refreshFogUniforms( m_uniforms, fog );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tmaterials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget[ camera.id ] );\r\n\r\n\t\t\t\tWebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( material.isShaderMaterial && material.uniformsNeedUpdate === true ) {\r\n\r\n\t\t\t\tWebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );\r\n\t\t\t\tmaterial.uniformsNeedUpdate = false;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( material.isSpriteMaterial ) {\r\n\r\n\t\t\t\tp_uniforms.setValue( _gl, 'center', object.center );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// common matrices\r\n\r\n\t\t\tp_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );\r\n\t\t\tp_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );\r\n\t\t\tp_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );\r\n\r\n\t\t\t// UBOs\r\n\r\n\t\t\tif ( material.isShaderMaterial || material.isRawShaderMaterial ) {\r\n\r\n\t\t\t\tconst groups = material.uniformsGroups;\r\n\r\n\t\t\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\r\n\r\n\t\t\t\t\tconst group = groups[ i ];\r\n\r\n\t\t\t\t\tuniformsGroups.update( group, program );\r\n\t\t\t\t\tuniformsGroups.bind( group, program );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn program;\r\n\r\n\t\t}\r\n\r\n\t\t// If uniforms are marked as clean, they don't need to be loaded to the GPU.\r\n\r\n\t\tfunction markUniformsLightsNeedsUpdate( uniforms, value ) {\r\n\r\n\t\t\tuniforms.ambientLightColor.needsUpdate = value;\r\n\t\t\tuniforms.lightProbe.needsUpdate = value;\r\n\r\n\t\t\tuniforms.directionalLights.needsUpdate = value;\r\n\t\t\tuniforms.directionalLightShadows.needsUpdate = value;\r\n\t\t\tuniforms.pointLights.needsUpdate = value;\r\n\t\t\tuniforms.pointLightShadows.needsUpdate = value;\r\n\t\t\tuniforms.spotLights.needsUpdate = value;\r\n\t\t\tuniforms.spotLightShadows.needsUpdate = value;\r\n\t\t\tuniforms.rectAreaLights.needsUpdate = value;\r\n\t\t\tuniforms.hemisphereLights.needsUpdate = value;\r\n\r\n\t\t}\r\n\r\n\t\tfunction materialNeedsLights( material ) {\r\n\r\n\t\t\treturn material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial ||\r\n\t\t\t\tmaterial.isMeshStandardMaterial || material.isShadowMaterial ||\r\n\t\t\t\t( material.isShaderMaterial && material.lights === true );\r\n\r\n\t\t}\r\n\r\n\t\tthis.getActiveCubeFace = function () {\r\n\r\n\t\t\treturn _currentActiveCubeFace;\r\n\r\n\t\t};\r\n\r\n\t\tthis.getActiveMipmapLevel = function () {\r\n\r\n\t\t\treturn _currentActiveMipmapLevel;\r\n\r\n\t\t};\r\n\r\n\t\tthis.getRenderTarget = function () {\r\n\r\n\t\t\treturn _currentRenderTarget;\r\n\r\n\t\t};\r\n\r\n\t\tthis.setRenderTargetTextures = function ( renderTarget, colorTexture, depthTexture ) {\r\n\r\n\t\t\tproperties.get( renderTarget.texture ).__webglTexture = colorTexture;\r\n\t\t\tproperties.get( renderTarget.depthTexture ).__webglTexture = depthTexture;\r\n\r\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\r\n\t\t\trenderTargetProperties.__hasExternalTextures = true;\r\n\r\n\t\t\trenderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;\r\n\r\n\t\t\tif ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {\r\n\r\n\t\t\t\t// The multisample_render_to_texture extension doesn't work properly if there\r\n\t\t\t\t// are midframe flushes and an external depth buffer. Disable use of the extension.\r\n\t\t\t\tif ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {\r\n\r\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );\r\n\t\t\t\t\trenderTargetProperties.__useRenderToTexture = false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tthis.setRenderTargetFramebuffer = function ( renderTarget, defaultFramebuffer ) {\r\n\r\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\r\n\t\t\trenderTargetProperties.__webglFramebuffer = defaultFramebuffer;\r\n\t\t\trenderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === undefined;\r\n\r\n\t\t};\r\n\r\n\t\tthis.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {\r\n\r\n\t\t\t_currentRenderTarget = renderTarget;\r\n\t\t\t_currentActiveCubeFace = activeCubeFace;\r\n\t\t\t_currentActiveMipmapLevel = activeMipmapLevel;\r\n\r\n\t\t\tlet useDefaultFramebuffer = true;\r\n\t\t\tlet framebuffer = null;\r\n\t\t\tlet isCube = false;\r\n\t\t\tlet isRenderTarget3D = false;\r\n\r\n\t\t\tif ( renderTarget ) {\r\n\r\n\t\t\t\tconst renderTargetProperties = properties.get( renderTarget );\r\n\r\n\t\t\t\tif ( renderTargetProperties.__useDefaultFramebuffer !== undefined ) {\r\n\r\n\t\t\t\t\t// We need to make sure to rebind the framebuffer.\r\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\r\n\t\t\t\t\tuseDefaultFramebuffer = false;\r\n\r\n\t\t\t\t} else if ( renderTargetProperties.__webglFramebuffer === undefined ) {\r\n\r\n\t\t\t\t\ttextures.setupRenderTarget( renderTarget );\r\n\r\n\t\t\t\t} else if ( renderTargetProperties.__hasExternalTextures ) {\r\n\r\n\t\t\t\t\t// Color and depth texture must be rebound in order for the swapchain to update.\r\n\t\t\t\t\ttextures.rebindTextures( renderTarget, properties.get( renderTarget.texture ).__webglTexture, properties.get( renderTarget.depthTexture ).__webglTexture );\r\n\r\n\t\t\t\t} else if ( renderTarget.depthBuffer ) {\r\n\r\n\t\t\t\t\t// check if the depth texture is already bound to the frame buffer and that it's been initialized\r\n\t\t\t\t\tconst depthTexture = renderTarget.depthTexture;\r\n\t\t\t\t\tif ( renderTargetProperties.__boundDepthTexture !== depthTexture ) {\r\n\r\n\t\t\t\t\t\t// check if the depth texture is compatible\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tdepthTexture !== null &&\r\n\t\t\t\t\t\t\tproperties.has( depthTexture ) &&\r\n\t\t\t\t\t\t\t( renderTarget.width !== depthTexture.image.width || renderTarget.height !== depthTexture.image.height )\r\n\t\t\t\t\t\t) {\r\n\r\n\t\t\t\t\t\t\tthrow new Error( 'WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.' );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// Swap the depth buffer to the currently attached one\r\n\t\t\t\t\t\ttextures.setupDepthRenderbuffer( renderTarget );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst texture = renderTarget.texture;\r\n\r\n\t\t\t\tif ( texture.isData3DTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture ) {\r\n\r\n\t\t\t\t\tisRenderTarget3D = true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst __webglFramebuffer = properties.get( renderTarget ).__webglFramebuffer;\r\n\r\n\t\t\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\r\n\r\n\t\t\t\t\tif ( Array.isArray( __webglFramebuffer[ activeCubeFace ] ) ) {\r\n\r\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace ][ activeMipmapLevel ];\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace ];\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tisCube = true;\r\n\r\n\t\t\t\t} else if ( ( renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {\r\n\r\n\t\t\t\t\tframebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif ( Array.isArray( __webglFramebuffer ) ) {\r\n\r\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeMipmapLevel ];\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tframebuffer = __webglFramebuffer;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t_currentViewport.copy( renderTarget.viewport );\r\n\t\t\t\t_currentScissor.copy( renderTarget.scissor );\r\n\t\t\t\t_currentScissorTest = renderTarget.scissorTest;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor();\r\n\t\t\t\t_currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor();\r\n\t\t\t\t_currentScissorTest = _scissorTest;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\r\n\r\n\t\t\tif ( framebufferBound && useDefaultFramebuffer ) {\r\n\r\n\t\t\t\tstate.drawBuffers( renderTarget, framebuffer );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tstate.viewport( _currentViewport );\r\n\t\t\tstate.scissor( _currentScissor );\r\n\t\t\tstate.setScissorTest( _currentScissorTest );\r\n\r\n\t\t\tif ( isCube ) {\r\n\r\n\t\t\t\tconst textureProperties = properties.get( renderTarget.texture );\r\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel );\r\n\r\n\t\t\t} else if ( isRenderTarget3D ) {\r\n\r\n\t\t\t\tconst textureProperties = properties.get( renderTarget.texture );\r\n\t\t\t\tconst layer = activeCubeFace || 0;\r\n\t\t\t\t_gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel || 0, layer );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_currentMaterialId = - 1; // reset current material to ensure correct uniform bindings\r\n\r\n\t\t};\r\n\r\n\t\tthis.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {\r\n\r\n\t\t\tif ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {\r\n\r\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlet framebuffer = properties.get( renderTarget ).__webglFramebuffer;\r\n\r\n\t\t\tif ( renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined ) {\r\n\r\n\t\t\t\tframebuffer = framebuffer[ activeCubeFaceIndex ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( framebuffer ) {\r\n\r\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\r\n\r\n\t\t\t\ttry {\r\n\r\n\t\t\t\t\tconst texture = renderTarget.texture;\r\n\t\t\t\t\tconst textureFormat = texture.format;\r\n\t\t\t\t\tconst textureType = texture.type;\r\n\r\n\t\t\t\t\tif ( ! capabilities.textureFormatReadable( textureFormat ) ) {\r\n\r\n\t\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );\r\n\t\t\t\t\t\treturn;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( ! capabilities.textureTypeReadable( textureType ) ) {\r\n\r\n\t\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );\r\n\t\t\t\t\t\treturn;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)\r\n\r\n\t\t\t\t\tif ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {\r\n\r\n\t\t\t\t\t\t_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), buffer );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} finally {\r\n\r\n\t\t\t\t\t// restore framebuffer of current render target if necessary\r\n\r\n\t\t\t\t\tconst framebuffer = ( _currentRenderTarget !== null ) ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;\r\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tthis.readRenderTargetPixelsAsync = async function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {\r\n\r\n\t\t\tif ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {\r\n\r\n\t\t\t\tthrow new Error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlet framebuffer = properties.get( renderTarget ).__webglFramebuffer;\r\n\t\t\tif ( renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined ) {\r\n\r\n\t\t\t\tframebuffer = framebuffer[ activeCubeFaceIndex ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( framebuffer ) {\r\n\r\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\r\n\r\n\t\t\t\ttry {\r\n\r\n\t\t\t\t\tconst texture = renderTarget.texture;\r\n\t\t\t\t\tconst textureFormat = texture.format;\r\n\t\t\t\t\tconst textureType = texture.type;\r\n\r\n\t\t\t\t\tif ( ! capabilities.textureFormatReadable( textureFormat ) ) {\r\n\r\n\t\t\t\t\t\tthrow new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( ! capabilities.textureTypeReadable( textureType ) ) {\r\n\r\n\t\t\t\t\t\tthrow new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)\r\n\t\t\t\t\tif ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {\r\n\r\n\t\t\t\t\t\tconst glBuffer = _gl.createBuffer();\r\n\t\t\t\t\t\t_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );\r\n\t\t\t\t\t\t_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );\r\n\t\t\t\t\t\t_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );\r\n\t\t\t\t\t\t_gl.flush();\r\n\r\n\t\t\t\t\t\t// check if the commands have finished every 8 ms\r\n\t\t\t\t\t\tconst sync = _gl.fenceSync( _gl.SYNC_GPU_COMMANDS_COMPLETE, 0 );\r\n\t\t\t\t\t\tawait probeAsync( _gl, sync, 4 );\r\n\r\n\t\t\t\t\t\ttry {\r\n\r\n\t\t\t\t\t\t\t_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );\r\n\t\t\t\t\t\t\t_gl.getBufferSubData( _gl.PIXEL_PACK_BUFFER, 0, buffer );\r\n\r\n\t\t\t\t\t\t} finally {\r\n\r\n\t\t\t\t\t\t\t_gl.deleteBuffer( glBuffer );\r\n\t\t\t\t\t\t\t_gl.deleteSync( sync );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn buffer;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} finally {\r\n\r\n\t\t\t\t\t// restore framebuffer of current render target if necessary\r\n\r\n\t\t\t\t\tconst framebuffer = ( _currentRenderTarget !== null ) ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;\r\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tthis.copyFramebufferToTexture = function ( texture, position = null, level = 0 ) {\r\n\r\n\t\t\t// support previous signature with position first\r\n\t\t\tif ( texture.isTexture !== true ) {\r\n\r\n\t\t\t\t// @deprecated, r165\r\n\t\t\t\twarnOnce( 'WebGLRenderer: copyFramebufferToTexture function signature has changed.' );\r\n\r\n\t\t\t\tposition = arguments[ 0 ] || null;\r\n\t\t\t\ttexture = arguments[ 1 ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst levelScale = Math.pow( 2, - level );\r\n\t\t\tconst width = Math.floor( texture.image.width * levelScale );\r\n\t\t\tconst height = Math.floor( texture.image.height * levelScale );\r\n\r\n\t\t\tconst x = position !== null ? position.x : 0;\r\n\t\t\tconst y = position !== null ? position.y : 0;\r\n\r\n\t\t\ttextures.setTexture2D( texture, 0 );\r\n\r\n\t\t\t_gl.copyTexSubImage2D( _gl.TEXTURE_2D, level, 0, 0, x, y, width, height );\r\n\r\n\t\t\tstate.unbindTexture();\r\n\r\n\t\t};\r\n\r\n\t\tthis.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {\r\n\r\n\t\t\t// support previous signature with dstPosition first\r\n\t\t\tif ( srcTexture.isTexture !== true ) {\r\n\r\n\t\t\t\t// @deprecated, r165\r\n\t\t\t\twarnOnce( 'WebGLRenderer: copyTextureToTexture function signature has changed.' );\r\n\r\n\t\t\t\tdstPosition = arguments[ 0 ] || null;\r\n\t\t\t\tsrcTexture = arguments[ 1 ];\r\n\t\t\t\tdstTexture = arguments[ 2 ];\r\n\t\t\t\tlevel = arguments[ 3 ] || 0;\r\n\t\t\t\tsrcRegion = null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlet width, height, minX, minY;\r\n\t\t\tlet dstX, dstY;\r\n\t\t\tif ( srcRegion !== null ) {\r\n\r\n\t\t\t\twidth = srcRegion.max.x - srcRegion.min.x;\r\n\t\t\t\theight = srcRegion.max.y - srcRegion.min.y;\r\n\t\t\t\tminX = srcRegion.min.x;\r\n\t\t\t\tminY = srcRegion.min.y;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\twidth = srcTexture.image.width;\r\n\t\t\t\theight = srcTexture.image.height;\r\n\t\t\t\tminX = 0;\r\n\t\t\t\tminY = 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( dstPosition !== null ) {\r\n\r\n\t\t\t\tdstX = dstPosition.x;\r\n\t\t\t\tdstY = dstPosition.y;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tdstX = 0;\r\n\t\t\t\tdstY = 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst glFormat = utils.convert( dstTexture.format );\r\n\t\t\tconst glType = utils.convert( dstTexture.type );\r\n\r\n\t\t\ttextures.setTexture2D( dstTexture, 0 );\r\n\r\n\t\t\t// As another texture upload may have changed pixelStorei\r\n\t\t\t// parameters, make sure they are correct for the dstTexture\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );\r\n\r\n\t\t\tconst currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );\r\n\t\t\tconst currentUnpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );\r\n\t\t\tconst currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );\r\n\t\t\tconst currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );\r\n\t\t\tconst currentUnpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );\r\n\r\n\t\t\tconst image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;\r\n\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, minX );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );\r\n\r\n\t\t\tif ( srcTexture.isDataTexture ) {\r\n\r\n\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, width, height, glFormat, glType, image.data );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif ( srcTexture.isCompressedTexture ) {\r\n\r\n\t\t\t\t\t_gl.compressedTexSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, image.width, image.height, glFormat, image.data );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, width, height, glFormat, glType, image );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );\r\n\r\n\t\t\t// Generate mipmaps only when copying level 0\r\n\t\t\tif ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( _gl.TEXTURE_2D );\r\n\r\n\t\t\tstate.unbindTexture();\r\n\r\n\t\t};\r\n\r\n\t\tthis.copyTextureToTexture3D = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {\r\n\r\n\t\t\t// support previous signature with source box first\r\n\t\t\tif ( srcTexture.isTexture !== true ) {\r\n\r\n\t\t\t\t// @deprecated, r165\r\n\t\t\t\twarnOnce( 'WebGLRenderer: copyTextureToTexture3D function signature has changed.' );\r\n\r\n\t\t\t\tsrcRegion = arguments[ 0 ] || null;\r\n\t\t\t\tdstPosition = arguments[ 1 ] || null;\r\n\t\t\t\tsrcTexture = arguments[ 2 ];\r\n\t\t\t\tdstTexture = arguments[ 3 ];\r\n\t\t\t\tlevel = arguments[ 4 ] || 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlet width, height, depth, minX, minY, minZ;\r\n\t\t\tlet dstX, dstY, dstZ;\r\n\t\t\tconst image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;\r\n\t\t\tif ( srcRegion !== null ) {\r\n\r\n\t\t\t\twidth = srcRegion.max.x - srcRegion.min.x;\r\n\t\t\t\theight = srcRegion.max.y - srcRegion.min.y;\r\n\t\t\t\tdepth = srcRegion.max.z - srcRegion.min.z;\r\n\t\t\t\tminX = srcRegion.min.x;\r\n\t\t\t\tminY = srcRegion.min.y;\r\n\t\t\t\tminZ = srcRegion.min.z;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\twidth = image.width;\r\n\t\t\t\theight = image.height;\r\n\t\t\t\tdepth = image.depth;\r\n\t\t\t\tminX = 0;\r\n\t\t\t\tminY = 0;\r\n\t\t\t\tminZ = 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( dstPosition !== null ) {\r\n\r\n\t\t\t\tdstX = dstPosition.x;\r\n\t\t\t\tdstY = dstPosition.y;\r\n\t\t\t\tdstZ = dstPosition.z;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tdstX = 0;\r\n\t\t\t\tdstY = 0;\r\n\t\t\t\tdstZ = 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst glFormat = utils.convert( dstTexture.format );\r\n\t\t\tconst glType = utils.convert( dstTexture.type );\r\n\t\t\tlet glTarget;\r\n\r\n\t\t\tif ( dstTexture.isData3DTexture ) {\r\n\r\n\t\t\t\ttextures.setTexture3D( dstTexture, 0 );\r\n\t\t\t\tglTarget = _gl.TEXTURE_3D;\r\n\r\n\t\t\t} else if ( dstTexture.isDataArrayTexture || dstTexture.isCompressedArrayTexture ) {\r\n\r\n\t\t\t\ttextures.setTexture2DArray( dstTexture, 0 );\r\n\t\t\t\tglTarget = _gl.TEXTURE_2D_ARRAY;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.' );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );\r\n\r\n\t\t\tconst currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );\r\n\t\t\tconst currentUnpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );\r\n\t\t\tconst currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );\r\n\t\t\tconst currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );\r\n\t\t\tconst currentUnpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );\r\n\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, minX );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, minZ );\r\n\r\n\t\t\tif ( srcTexture.isDataTexture || srcTexture.isData3DTexture ) {\r\n\r\n\t\t\t\t_gl.texSubImage3D( glTarget, level, dstX, dstY, dstZ, width, height, depth, glFormat, glType, image.data );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif ( dstTexture.isCompressedArrayTexture ) {\r\n\r\n\t\t\t\t\t_gl.compressedTexSubImage3D( glTarget, level, dstX, dstY, dstZ, width, height, depth, glFormat, image.data );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t_gl.texSubImage3D( glTarget, level, dstX, dstY, dstZ, width, height, depth, glFormat, glType, image );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );\r\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );\r\n\r\n\t\t\t// Generate mipmaps only when copying level 0\r\n\t\t\tif ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( glTarget );\r\n\r\n\t\t\tstate.unbindTexture();\r\n\r\n\t\t};\r\n\r\n\t\tthis.initRenderTarget = function ( target ) {\r\n\r\n\t\t\tif ( properties.get( target ).__webglFramebuffer === undefined ) {\r\n\r\n\t\t\t\ttextures.setupRenderTarget( target );\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tthis.initTexture = function ( texture ) {\r\n\r\n\t\t\tif ( texture.isCubeTexture ) {\r\n\r\n\t\t\t\ttextures.setTextureCube( texture, 0 );\r\n\r\n\t\t\t} else if ( texture.isData3DTexture ) {\r\n\r\n\t\t\t\ttextures.setTexture3D( texture, 0 );\r\n\r\n\t\t\t} else if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) {\r\n\r\n\t\t\t\ttextures.setTexture2DArray( texture, 0 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\ttextures.setTexture2D( texture, 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tstate.unbindTexture();\r\n\r\n\t\t};\r\n\r\n\t\tthis.resetState = function () {\r\n\r\n\t\t\t_currentActiveCubeFace = 0;\r\n\t\t\t_currentActiveMipmapLevel = 0;\r\n\t\t\t_currentRenderTarget = null;\r\n\r\n\t\t\tstate.reset();\r\n\t\t\tbindingStates.reset();\r\n\r\n\t\t};\r\n\r\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\r\n\r\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tget coordinateSystem() {\r\n\r\n\t\treturn WebGLCoordinateSystem;\r\n\r\n\t}\r\n\r\n\tget outputColorSpace() {\r\n\r\n\t\treturn this._outputColorSpace;\r\n\r\n\t}\r\n\r\n\tset outputColorSpace( colorSpace ) {\r\n\r\n\t\tthis._outputColorSpace = colorSpace;\r\n\r\n\t\tconst gl = this.getContext();\r\n\t\tgl.drawingBufferColorSpace = colorSpace === DisplayP3ColorSpace ? 'display-p3' : 'srgb';\r\n\t\tgl.unpackColorSpace = ColorManagement.workingColorSpace === LinearDisplayP3ColorSpace ? 'display-p3' : 'srgb';\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass FogExp2 {\r\n\r\n\tconstructor( color, density = 0.00025 ) {\r\n\r\n\t\tthis.isFogExp2 = true;\r\n\r\n\t\tthis.name = '';\r\n\r\n\t\tthis.color = new Color( color );\r\n\t\tthis.density = density;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new FogExp2( this.color, this.density );\r\n\r\n\t}\r\n\r\n\ttoJSON( /* meta */ ) {\r\n\r\n\t\treturn {\r\n\t\t\ttype: 'FogExp2',\r\n\t\t\tname: this.name,\r\n\t\t\tcolor: this.color.getHex(),\r\n\t\t\tdensity: this.density\r\n\t\t};\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Fog {\r\n\r\n\tconstructor( color, near = 1, far = 1000 ) {\r\n\r\n\t\tthis.isFog = true;\r\n\r\n\t\tthis.name = '';\r\n\r\n\t\tthis.color = new Color( color );\r\n\r\n\t\tthis.near = near;\r\n\t\tthis.far = far;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new Fog( this.color, this.near, this.far );\r\n\r\n\t}\r\n\r\n\ttoJSON( /* meta */ ) {\r\n\r\n\t\treturn {\r\n\t\t\ttype: 'Fog',\r\n\t\t\tname: this.name,\r\n\t\t\tcolor: this.color.getHex(),\r\n\t\t\tnear: this.near,\r\n\t\t\tfar: this.far\r\n\t\t};\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Scene extends Object3D {\r\n\r\n\tconstructor() {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isScene = true;\r\n\r\n\t\tthis.type = 'Scene';\r\n\r\n\t\tthis.background = null;\r\n\t\tthis.environment = null;\r\n\t\tthis.fog = null;\r\n\r\n\t\tthis.backgroundBlurriness = 0;\r\n\t\tthis.backgroundIntensity = 1;\r\n\t\tthis.backgroundRotation = new Euler();\r\n\r\n\t\tthis.environmentIntensity = 1;\r\n\t\tthis.environmentRotation = new Euler();\r\n\r\n\t\tthis.overrideMaterial = null;\r\n\r\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\r\n\r\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcopy( source, recursive ) {\r\n\r\n\t\tsuper.copy( source, recursive );\r\n\r\n\t\tif ( source.background !== null ) this.background = source.background.clone();\r\n\t\tif ( source.environment !== null ) this.environment = source.environment.clone();\r\n\t\tif ( source.fog !== null ) this.fog = source.fog.clone();\r\n\r\n\t\tthis.backgroundBlurriness = source.backgroundBlurriness;\r\n\t\tthis.backgroundIntensity = source.backgroundIntensity;\r\n\t\tthis.backgroundRotation.copy( source.backgroundRotation );\r\n\r\n\t\tthis.environmentIntensity = source.environmentIntensity;\r\n\t\tthis.environmentRotation.copy( source.environmentRotation );\r\n\r\n\t\tif ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();\r\n\r\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON( meta ) {\r\n\r\n\t\tconst data = super.toJSON( meta );\r\n\r\n\t\tif ( this.fog !== null ) data.object.fog = this.fog.toJSON();\r\n\r\n\t\tif ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;\r\n\t\tif ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;\r\n\t\tdata.object.backgroundRotation = this.backgroundRotation.toArray();\r\n\r\n\t\tif ( this.environmentIntensity !== 1 ) data.object.environmentIntensity = this.environmentIntensity;\r\n\t\tdata.object.environmentRotation = this.environmentRotation.toArray();\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass InterleavedBuffer {\r\n\r\n\tconstructor( array, stride ) {\r\n\r\n\t\tthis.isInterleavedBuffer = true;\r\n\r\n\t\tthis.array = array;\r\n\t\tthis.stride = stride;\r\n\t\tthis.count = array !== undefined ? array.length / stride : 0;\r\n\r\n\t\tthis.usage = StaticDrawUsage;\r\n\t\tthis._updateRange = { offset: 0, count: - 1 };\r\n\t\tthis.updateRanges = [];\r\n\r\n\t\tthis.version = 0;\r\n\r\n\t\tthis.uuid = generateUUID();\r\n\r\n\t}\r\n\r\n\tonUploadCallback() {}\r\n\r\n\tset needsUpdate( value ) {\r\n\r\n\t\tif ( value === true ) this.version ++;\r\n\r\n\t}\r\n\r\n\tget updateRange() {\r\n\r\n\t\twarnOnce( 'THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159\r\n\t\treturn this._updateRange;\r\n\r\n\t}\r\n\r\n\tsetUsage( value ) {\r\n\r\n\t\tthis.usage = value;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\taddUpdateRange( start, count ) {\r\n\r\n\t\tthis.updateRanges.push( { start, count } );\r\n\r\n\t}\r\n\r\n\tclearUpdateRanges() {\r\n\r\n\t\tthis.updateRanges.length = 0;\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.array = new source.array.constructor( source.array );\r\n\t\tthis.count = source.count;\r\n\t\tthis.stride = source.stride;\r\n\t\tthis.usage = source.usage;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcopyAt( index1, attribute, index2 ) {\r\n\r\n\t\tindex1 *= this.stride;\r\n\t\tindex2 *= attribute.stride;\r\n\r\n\t\tfor ( let i = 0, l = this.stride; i < l; i ++ ) {\r\n\r\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tset( value, offset = 0 ) {\r\n\r\n\t\tthis.array.set( value, offset );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclone( data ) {\r\n\r\n\t\tif ( data.arrayBuffers === undefined ) {\r\n\r\n\t\t\tdata.arrayBuffers = {};\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.array.buffer._uuid === undefined ) {\r\n\r\n\t\t\tthis.array.buffer._uuid = generateUUID();\r\n\r\n\t\t}\r\n\r\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\r\n\r\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = this.array.slice( 0 ).buffer;\r\n\r\n\t\t}\r\n\r\n\t\tconst array = new this.array.constructor( data.arrayBuffers[ this.array.buffer._uuid ] );\r\n\r\n\t\tconst ib = new this.constructor( array, this.stride );\r\n\t\tib.setUsage( this.usage );\r\n\r\n\t\treturn ib;\r\n\r\n\t}\r\n\r\n\tonUpload( callback ) {\r\n\r\n\t\tthis.onUploadCallback = callback;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON( data ) {\r\n\r\n\t\tif ( data.arrayBuffers === undefined ) {\r\n\r\n\t\t\tdata.arrayBuffers = {};\r\n\r\n\t\t}\r\n\r\n\t\t// generate UUID for array buffer if necessary\r\n\r\n\t\tif ( this.array.buffer._uuid === undefined ) {\r\n\r\n\t\t\tthis.array.buffer._uuid = generateUUID();\r\n\r\n\t\t}\r\n\r\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\r\n\r\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = Array.from( new Uint32Array( this.array.buffer ) );\r\n\r\n\t\t}\r\n\r\n\t\t//\r\n\r\n\t\treturn {\r\n\t\t\tuuid: this.uuid,\r\n\t\t\tbuffer: this.array.buffer._uuid,\r\n\t\t\ttype: this.array.constructor.name,\r\n\t\t\tstride: this.stride\r\n\t\t};\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _vector$6 = /*@__PURE__*/ new Vector3();\r\n\r\nclass InterleavedBufferAttribute {\r\n\r\n\tconstructor( interleavedBuffer, itemSize, offset, normalized = false ) {\r\n\r\n\t\tthis.isInterleavedBufferAttribute = true;\r\n\r\n\t\tthis.name = '';\r\n\r\n\t\tthis.data = interleavedBuffer;\r\n\t\tthis.itemSize = itemSize;\r\n\t\tthis.offset = offset;\r\n\r\n\t\tthis.normalized = normalized;\r\n\r\n\t}\r\n\r\n\tget count() {\r\n\r\n\t\treturn this.data.count;\r\n\r\n\t}\r\n\r\n\tget array() {\r\n\r\n\t\treturn this.data.array;\r\n\r\n\t}\r\n\r\n\tset needsUpdate( value ) {\r\n\r\n\t\tthis.data.needsUpdate = value;\r\n\r\n\t}\r\n\r\n\tapplyMatrix4( m ) {\r\n\r\n\t\tfor ( let i = 0, l = this.data.count; i < l; i ++ ) {\r\n\r\n\t\t\t_vector$6.fromBufferAttribute( this, i );\r\n\r\n\t\t\t_vector$6.applyMatrix4( m );\r\n\r\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tapplyNormalMatrix( m ) {\r\n\r\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\r\n\r\n\t\t\t_vector$6.fromBufferAttribute( this, i );\r\n\r\n\t\t\t_vector$6.applyNormalMatrix( m );\r\n\r\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttransformDirection( m ) {\r\n\r\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\r\n\r\n\t\t\t_vector$6.fromBufferAttribute( this, i );\r\n\r\n\t\t\t_vector$6.transformDirection( m );\r\n\r\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetComponent( index, component ) {\r\n\r\n\t\tlet value = this.array[ index * this.data.stride + this.offset + component ];\r\n\r\n\t\tif ( this.normalized ) value = denormalize( value, this.array );\r\n\r\n\t\treturn value;\r\n\r\n\t}\r\n\r\n\tsetComponent( index, component, value ) {\r\n\r\n\t\tif ( this.normalized ) value = normalize( value, this.array );\r\n\r\n\t\tthis.data.array[ index * this.data.stride + this.offset + component ] = value;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetX( index, x ) {\r\n\r\n\t\tif ( this.normalized ) x = normalize( x, this.array );\r\n\r\n\t\tthis.data.array[ index * this.data.stride + this.offset ] = x;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetY( index, y ) {\r\n\r\n\t\tif ( this.normalized ) y = normalize( y, this.array );\r\n\r\n\t\tthis.data.array[ index * this.data.stride + this.offset + 1 ] = y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetZ( index, z ) {\r\n\r\n\t\tif ( this.normalized ) z = normalize( z, this.array );\r\n\r\n\t\tthis.data.array[ index * this.data.stride + this.offset + 2 ] = z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetW( index, w ) {\r\n\r\n\t\tif ( this.normalized ) w = normalize( w, this.array );\r\n\r\n\t\tthis.data.array[ index * this.data.stride + this.offset + 3 ] = w;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetX( index ) {\r\n\r\n\t\tlet x = this.data.array[ index * this.data.stride + this.offset ];\r\n\r\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\r\n\r\n\t\treturn x;\r\n\r\n\t}\r\n\r\n\tgetY( index ) {\r\n\r\n\t\tlet y = this.data.array[ index * this.data.stride + this.offset + 1 ];\r\n\r\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\r\n\r\n\t\treturn y;\r\n\r\n\t}\r\n\r\n\tgetZ( index ) {\r\n\r\n\t\tlet z = this.data.array[ index * this.data.stride + this.offset + 2 ];\r\n\r\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\r\n\r\n\t\treturn z;\r\n\r\n\t}\r\n\r\n\tgetW( index ) {\r\n\r\n\t\tlet w = this.data.array[ index * this.data.stride + this.offset + 3 ];\r\n\r\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\r\n\r\n\t\treturn w;\r\n\r\n\t}\r\n\r\n\tsetXY( index, x, y ) {\r\n\r\n\t\tindex = index * this.data.stride + this.offset;\r\n\r\n\t\tif ( this.normalized ) {\r\n\r\n\t\t\tx = normalize( x, this.array );\r\n\t\t\ty = normalize( y, this.array );\r\n\r\n\t\t}\r\n\r\n\t\tthis.data.array[ index + 0 ] = x;\r\n\t\tthis.data.array[ index + 1 ] = y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetXYZ( index, x, y, z ) {\r\n\r\n\t\tindex = index * this.data.stride + this.offset;\r\n\r\n\t\tif ( this.normalized ) {\r\n\r\n\t\t\tx = normalize( x, this.array );\r\n\t\t\ty = normalize( y, this.array );\r\n\t\t\tz = normalize( z, this.array );\r\n\r\n\t\t}\r\n\r\n\t\tthis.data.array[ index + 0 ] = x;\r\n\t\tthis.data.array[ index + 1 ] = y;\r\n\t\tthis.data.array[ index + 2 ] = z;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetXYZW( index, x, y, z, w ) {\r\n\r\n\t\tindex = index * this.data.stride + this.offset;\r\n\r\n\t\tif ( this.normalized ) {\r\n\r\n\t\t\tx = normalize( x, this.array );\r\n\t\t\ty = normalize( y, this.array );\r\n\t\t\tz = normalize( z, this.array );\r\n\t\t\tw = normalize( w, this.array );\r\n\r\n\t\t}\r\n\r\n\t\tthis.data.array[ index + 0 ] = x;\r\n\t\tthis.data.array[ index + 1 ] = y;\r\n\t\tthis.data.array[ index + 2 ] = z;\r\n\t\tthis.data.array[ index + 3 ] = w;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclone( data ) {\r\n\r\n\t\tif ( data === undefined ) {\r\n\r\n\t\t\tconsole.log( 'THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.' );\r\n\r\n\t\t\tconst array = [];\r\n\r\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\r\n\r\n\t\t\t\tconst index = i * this.data.stride + this.offset;\r\n\r\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\r\n\r\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn new BufferAttribute( new this.array.constructor( array ), this.itemSize, this.normalized );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tif ( data.interleavedBuffers === undefined ) {\r\n\r\n\t\t\t\tdata.interleavedBuffers = {};\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\r\n\r\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.clone( data );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn new InterleavedBufferAttribute( data.interleavedBuffers[ this.data.uuid ], this.itemSize, this.offset, this.normalized );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ttoJSON( data ) {\r\n\r\n\t\tif ( data === undefined ) {\r\n\r\n\t\t\tconsole.log( 'THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.' );\r\n\r\n\t\t\tconst array = [];\r\n\r\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\r\n\r\n\t\t\t\tconst index = i * this.data.stride + this.offset;\r\n\r\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\r\n\r\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// de-interleave data and save it as an ordinary buffer attribute for now\r\n\r\n\t\t\treturn {\r\n\t\t\t\titemSize: this.itemSize,\r\n\t\t\t\ttype: this.array.constructor.name,\r\n\t\t\t\tarray: array,\r\n\t\t\t\tnormalized: this.normalized\r\n\t\t\t};\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// save as true interleaved attribute\r\n\r\n\t\t\tif ( data.interleavedBuffers === undefined ) {\r\n\r\n\t\t\t\tdata.interleavedBuffers = {};\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\r\n\r\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.toJSON( data );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn {\r\n\t\t\t\tisInterleavedBufferAttribute: true,\r\n\t\t\t\titemSize: this.itemSize,\r\n\t\t\t\tdata: this.data.uuid,\r\n\t\t\t\toffset: this.offset,\r\n\t\t\t\tnormalized: this.normalized\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass SpriteMaterial extends Material {\r\n\r\n\tconstructor( parameters ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isSpriteMaterial = true;\r\n\r\n\t\tthis.type = 'SpriteMaterial';\r\n\r\n\t\tthis.color = new Color( 0xffffff );\r\n\r\n\t\tthis.map = null;\r\n\r\n\t\tthis.alphaMap = null;\r\n\r\n\t\tthis.rotation = 0;\r\n\r\n\t\tthis.sizeAttenuation = true;\r\n\r\n\t\tthis.transparent = true;\r\n\r\n\t\tthis.fog = true;\r\n\r\n\t\tthis.setValues( parameters );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.color.copy( source.color );\r\n\r\n\t\tthis.map = source.map;\r\n\r\n\t\tthis.alphaMap = source.alphaMap;\r\n\r\n\t\tthis.rotation = source.rotation;\r\n\r\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\r\n\r\n\t\tthis.fog = source.fog;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nlet _geometry;\r\n\r\nconst _intersectPoint = /*@__PURE__*/ new Vector3();\r\nconst _worldScale = /*@__PURE__*/ new Vector3();\r\nconst _mvPosition = /*@__PURE__*/ new Vector3();\r\n\r\nconst _alignedPosition = /*@__PURE__*/ new Vector2();\r\nconst _rotatedPosition = /*@__PURE__*/ new Vector2();\r\nconst _viewWorldMatrix = /*@__PURE__*/ new Matrix4();\r\n\r\nconst _vA = /*@__PURE__*/ new Vector3();\r\nconst _vB = /*@__PURE__*/ new Vector3();\r\nconst _vC = /*@__PURE__*/ new Vector3();\r\n\r\nconst _uvA = /*@__PURE__*/ new Vector2();\r\nconst _uvB = /*@__PURE__*/ new Vector2();\r\nconst _uvC = /*@__PURE__*/ new Vector2();\r\n\r\nclass Sprite extends Object3D {\r\n\r\n\tconstructor( material = new SpriteMaterial() ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isSprite = true;\r\n\r\n\t\tthis.type = 'Sprite';\r\n\r\n\t\tif ( _geometry === undefined ) {\r\n\r\n\t\t\t_geometry = new BufferGeometry();\r\n\r\n\t\t\tconst float32Array = new Float32Array( [\r\n\t\t\t\t- 0.5, - 0.5, 0, 0, 0,\r\n\t\t\t\t0.5, - 0.5, 0, 1, 0,\r\n\t\t\t\t0.5, 0.5, 0, 1, 1,\r\n\t\t\t\t- 0.5, 0.5, 0, 0, 1\r\n\t\t\t] );\r\n\r\n\t\t\tconst interleavedBuffer = new InterleavedBuffer( float32Array, 5 );\r\n\r\n\t\t\t_geometry.setIndex( [ 0, 1, 2,\t0, 2, 3 ] );\r\n\t\t\t_geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );\r\n\t\t\t_geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );\r\n\r\n\t\t}\r\n\r\n\t\tthis.geometry = _geometry;\r\n\t\tthis.material = material;\r\n\r\n\t\tthis.center = new Vector2( 0.5, 0.5 );\r\n\r\n\t}\r\n\r\n\traycast( raycaster, intersects ) {\r\n\r\n\t\tif ( raycaster.camera === null ) {\r\n\r\n\t\t\tconsole.error( 'THREE.Sprite: \"Raycaster.camera\" needs to be set in order to raycast against sprites.' );\r\n\r\n\t\t}\r\n\r\n\t\t_worldScale.setFromMatrixScale( this.matrixWorld );\r\n\r\n\t\t_viewWorldMatrix.copy( raycaster.camera.matrixWorld );\r\n\t\tthis.modelViewMatrix.multiplyMatrices( raycaster.camera.matrixWorldInverse, this.matrixWorld );\r\n\r\n\t\t_mvPosition.setFromMatrixPosition( this.modelViewMatrix );\r\n\r\n\t\tif ( raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false ) {\r\n\r\n\t\t\t_worldScale.multiplyScalar( - _mvPosition.z );\r\n\r\n\t\t}\r\n\r\n\t\tconst rotation = this.material.rotation;\r\n\t\tlet sin, cos;\r\n\r\n\t\tif ( rotation !== 0 ) {\r\n\r\n\t\t\tcos = Math.cos( rotation );\r\n\t\t\tsin = Math.sin( rotation );\r\n\r\n\t\t}\r\n\r\n\t\tconst center = this.center;\r\n\r\n\t\ttransformVertex( _vA.set( - 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\r\n\t\ttransformVertex( _vB.set( 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\r\n\t\ttransformVertex( _vC.set( 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\r\n\r\n\t\t_uvA.set( 0, 0 );\r\n\t\t_uvB.set( 1, 0 );\r\n\t\t_uvC.set( 1, 1 );\r\n\r\n\t\t// check first triangle\r\n\t\tlet intersect = raycaster.ray.intersectTriangle( _vA, _vB, _vC, false, _intersectPoint );\r\n\r\n\t\tif ( intersect === null ) {\r\n\r\n\t\t\t// check second triangle\r\n\t\t\ttransformVertex( _vB.set( - 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\r\n\t\t\t_uvB.set( 0, 1 );\r\n\r\n\t\t\tintersect = raycaster.ray.intersectTriangle( _vA, _vC, _vB, false, _intersectPoint );\r\n\t\t\tif ( intersect === null ) {\r\n\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconst distance = raycaster.ray.origin.distanceTo( _intersectPoint );\r\n\r\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\r\n\r\n\t\tintersects.push( {\r\n\r\n\t\t\tdistance: distance,\r\n\t\t\tpoint: _intersectPoint.clone(),\r\n\t\t\tuv: Triangle.getInterpolation( _intersectPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() ),\r\n\t\t\tface: null,\r\n\t\t\tobject: this\r\n\r\n\t\t} );\r\n\r\n\t}\r\n\r\n\tcopy( source, recursive ) {\r\n\r\n\t\tsuper.copy( source, recursive );\r\n\r\n\t\tif ( source.center !== undefined ) this.center.copy( source.center );\r\n\r\n\t\tthis.material = source.material;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) {\r\n\r\n\t// compute position in camera space\r\n\t_alignedPosition.subVectors( vertexPosition, center ).addScalar( 0.5 ).multiply( scale );\r\n\r\n\t// to check if rotation is not zero\r\n\tif ( sin !== undefined ) {\r\n\r\n\t\t_rotatedPosition.x = ( cos * _alignedPosition.x ) - ( sin * _alignedPosition.y );\r\n\t\t_rotatedPosition.y = ( sin * _alignedPosition.x ) + ( cos * _alignedPosition.y );\r\n\r\n\t} else {\r\n\r\n\t\t_rotatedPosition.copy( _alignedPosition );\r\n\r\n\t}\r\n\r\n\r\n\tvertexPosition.copy( mvPosition );\r\n\tvertexPosition.x += _rotatedPosition.x;\r\n\tvertexPosition.y += _rotatedPosition.y;\r\n\r\n\t// transform to world space\r\n\tvertexPosition.applyMatrix4( _viewWorldMatrix );\r\n\r\n}\r\n\r\nconst _v1$2 = /*@__PURE__*/ new Vector3();\r\nconst _v2$1 = /*@__PURE__*/ new Vector3();\r\n\r\nclass LOD extends Object3D {\r\n\r\n\tconstructor() {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis._currentLevel = 0;\r\n\r\n\t\tthis.type = 'LOD';\r\n\r\n\t\tObject.defineProperties( this, {\r\n\t\t\tlevels: {\r\n\t\t\t\tenumerable: true,\r\n\t\t\t\tvalue: []\r\n\t\t\t},\r\n\t\t\tisLOD: {\r\n\t\t\t\tvalue: true,\r\n\t\t\t}\r\n\t\t} );\r\n\r\n\t\tthis.autoUpdate = true;\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source, false );\r\n\r\n\t\tconst levels = source.levels;\r\n\r\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst level = levels[ i ];\r\n\r\n\t\t\tthis.addLevel( level.object.clone(), level.distance, level.hysteresis );\r\n\r\n\t\t}\r\n\r\n\t\tthis.autoUpdate = source.autoUpdate;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\taddLevel( object, distance = 0, hysteresis = 0 ) {\r\n\r\n\t\tdistance = Math.abs( distance );\r\n\r\n\t\tconst levels = this.levels;\r\n\r\n\t\tlet l;\r\n\r\n\t\tfor ( l = 0; l < levels.length; l ++ ) {\r\n\r\n\t\t\tif ( distance < levels[ l ].distance ) {\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tlevels.splice( l, 0, { distance: distance, hysteresis: hysteresis, object: object } );\r\n\r\n\t\tthis.add( object );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetCurrentLevel() {\r\n\r\n\t\treturn this._currentLevel;\r\n\r\n\t}\r\n\r\n\r\n\r\n\tgetObjectForDistance( distance ) {\r\n\r\n\t\tconst levels = this.levels;\r\n\r\n\t\tif ( levels.length > 0 ) {\r\n\r\n\t\t\tlet i, l;\r\n\r\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tlet levelDistance = levels[ i ].distance;\r\n\r\n\t\t\t\tif ( levels[ i ].object.visible ) {\r\n\r\n\t\t\t\t\tlevelDistance -= levelDistance * levels[ i ].hysteresis;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( distance < levelDistance ) {\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn levels[ i - 1 ].object;\r\n\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\r\n\t}\r\n\r\n\traycast( raycaster, intersects ) {\r\n\r\n\t\tconst levels = this.levels;\r\n\r\n\t\tif ( levels.length > 0 ) {\r\n\r\n\t\t\t_v1$2.setFromMatrixPosition( this.matrixWorld );\r\n\r\n\t\t\tconst distance = raycaster.ray.origin.distanceTo( _v1$2 );\r\n\r\n\t\t\tthis.getObjectForDistance( distance ).raycast( raycaster, intersects );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdate( camera ) {\r\n\r\n\t\tconst levels = this.levels;\r\n\r\n\t\tif ( levels.length > 1 ) {\r\n\r\n\t\t\t_v1$2.setFromMatrixPosition( camera.matrixWorld );\r\n\t\t\t_v2$1.setFromMatrixPosition( this.matrixWorld );\r\n\r\n\t\t\tconst distance = _v1$2.distanceTo( _v2$1 ) / camera.zoom;\r\n\r\n\t\t\tlevels[ 0 ].object.visible = true;\r\n\r\n\t\t\tlet i, l;\r\n\r\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tlet levelDistance = levels[ i ].distance;\r\n\r\n\t\t\t\tif ( levels[ i ].object.visible ) {\r\n\r\n\t\t\t\t\tlevelDistance -= levelDistance * levels[ i ].hysteresis;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( distance >= levelDistance ) {\r\n\r\n\t\t\t\t\tlevels[ i - 1 ].object.visible = false;\r\n\t\t\t\t\tlevels[ i ].object.visible = true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis._currentLevel = i - 1;\r\n\r\n\t\t\tfor ( ; i < l; i ++ ) {\r\n\r\n\t\t\t\tlevels[ i ].object.visible = false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ttoJSON( meta ) {\r\n\r\n\t\tconst data = super.toJSON( meta );\r\n\r\n\t\tif ( this.autoUpdate === false ) data.object.autoUpdate = false;\r\n\r\n\t\tdata.object.levels = [];\r\n\r\n\t\tconst levels = this.levels;\r\n\r\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst level = levels[ i ];\r\n\r\n\t\t\tdata.object.levels.push( {\r\n\t\t\t\tobject: level.object.uuid,\r\n\t\t\t\tdistance: level.distance,\r\n\t\t\t\thysteresis: level.hysteresis\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _basePosition = /*@__PURE__*/ new Vector3();\r\n\r\nconst _skinIndex = /*@__PURE__*/ new Vector4();\r\nconst _skinWeight = /*@__PURE__*/ new Vector4();\r\n\r\nconst _vector3 = /*@__PURE__*/ new Vector3();\r\nconst _matrix4 = /*@__PURE__*/ new Matrix4();\r\nconst _vertex = /*@__PURE__*/ new Vector3();\r\n\r\nconst _sphere$4 = /*@__PURE__*/ new Sphere();\r\nconst _inverseMatrix$2 = /*@__PURE__*/ new Matrix4();\r\nconst _ray$2 = /*@__PURE__*/ new Ray();\r\n\r\nclass SkinnedMesh extends Mesh {\r\n\r\n\tconstructor( geometry, material ) {\r\n\r\n\t\tsuper( geometry, material );\r\n\r\n\t\tthis.isSkinnedMesh = true;\r\n\r\n\t\tthis.type = 'SkinnedMesh';\r\n\r\n\t\tthis.bindMode = AttachedBindMode;\r\n\t\tthis.bindMatrix = new Matrix4();\r\n\t\tthis.bindMatrixInverse = new Matrix4();\r\n\r\n\t\tthis.boundingBox = null;\r\n\t\tthis.boundingSphere = null;\r\n\r\n\t}\r\n\r\n\tcomputeBoundingBox() {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\r\n\t\tif ( this.boundingBox === null ) {\r\n\r\n\t\t\tthis.boundingBox = new Box3();\r\n\r\n\t\t}\r\n\r\n\t\tthis.boundingBox.makeEmpty();\r\n\r\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\r\n\r\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\r\n\r\n\t\t\tthis.getVertexPosition( i, _vertex );\r\n\t\t\tthis.boundingBox.expandByPoint( _vertex );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcomputeBoundingSphere() {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\r\n\t\tif ( this.boundingSphere === null ) {\r\n\r\n\t\t\tthis.boundingSphere = new Sphere();\r\n\r\n\t\t}\r\n\r\n\t\tthis.boundingSphere.makeEmpty();\r\n\r\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\r\n\r\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\r\n\r\n\t\t\tthis.getVertexPosition( i, _vertex );\r\n\t\t\tthis.boundingSphere.expandByPoint( _vertex );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcopy( source, recursive ) {\r\n\r\n\t\tsuper.copy( source, recursive );\r\n\r\n\t\tthis.bindMode = source.bindMode;\r\n\t\tthis.bindMatrix.copy( source.bindMatrix );\r\n\t\tthis.bindMatrixInverse.copy( source.bindMatrixInverse );\r\n\r\n\t\tthis.skeleton = source.skeleton;\r\n\r\n\t\tif ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();\r\n\t\tif ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\traycast( raycaster, intersects ) {\r\n\r\n\t\tconst material = this.material;\r\n\t\tconst matrixWorld = this.matrixWorld;\r\n\r\n\t\tif ( material === undefined ) return;\r\n\r\n\t\t// test with bounding sphere in world space\r\n\r\n\t\tif ( this.boundingSphere === null ) this.computeBoundingSphere();\r\n\r\n\t\t_sphere$4.copy( this.boundingSphere );\r\n\t\t_sphere$4.applyMatrix4( matrixWorld );\r\n\r\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$4 ) === false ) return;\r\n\r\n\t\t// convert ray to local space of skinned mesh\r\n\r\n\t\t_inverseMatrix$2.copy( matrixWorld ).invert();\r\n\t\t_ray$2.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$2 );\r\n\r\n\t\t// test with bounding box in local space\r\n\r\n\t\tif ( this.boundingBox !== null ) {\r\n\r\n\t\t\tif ( _ray$2.intersectsBox( this.boundingBox ) === false ) return;\r\n\r\n\t\t}\r\n\r\n\t\t// test for intersections with geometry\r\n\r\n\t\tthis._computeIntersections( raycaster, intersects, _ray$2 );\r\n\r\n\t}\r\n\r\n\tgetVertexPosition( index, target ) {\r\n\r\n\t\tsuper.getVertexPosition( index, target );\r\n\r\n\t\tthis.applyBoneTransform( index, target );\r\n\r\n\t\treturn target;\r\n\r\n\t}\r\n\r\n\tbind( skeleton, bindMatrix ) {\r\n\r\n\t\tthis.skeleton = skeleton;\r\n\r\n\t\tif ( bindMatrix === undefined ) {\r\n\r\n\t\t\tthis.updateMatrixWorld( true );\r\n\r\n\t\t\tthis.skeleton.calculateInverses();\r\n\r\n\t\t\tbindMatrix = this.matrixWorld;\r\n\r\n\t\t}\r\n\r\n\t\tthis.bindMatrix.copy( bindMatrix );\r\n\t\tthis.bindMatrixInverse.copy( bindMatrix ).invert();\r\n\r\n\t}\r\n\r\n\tpose() {\r\n\r\n\t\tthis.skeleton.pose();\r\n\r\n\t}\r\n\r\n\tnormalizeSkinWeights() {\r\n\r\n\t\tconst vector = new Vector4();\r\n\r\n\t\tconst skinWeight = this.geometry.attributes.skinWeight;\r\n\r\n\t\tfor ( let i = 0, l = skinWeight.count; i < l; i ++ ) {\r\n\r\n\t\t\tvector.fromBufferAttribute( skinWeight, i );\r\n\r\n\t\t\tconst scale = 1.0 / vector.manhattanLength();\r\n\r\n\t\t\tif ( scale !== Infinity ) {\r\n\r\n\t\t\t\tvector.multiplyScalar( scale );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tvector.set( 1, 0, 0, 0 ); // do something reasonable\r\n\r\n\t\t\t}\r\n\r\n\t\t\tskinWeight.setXYZW( i, vector.x, vector.y, vector.z, vector.w );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( force ) {\r\n\r\n\t\tsuper.updateMatrixWorld( force );\r\n\r\n\t\tif ( this.bindMode === AttachedBindMode ) {\r\n\r\n\t\t\tthis.bindMatrixInverse.copy( this.matrixWorld ).invert();\r\n\r\n\t\t} else if ( this.bindMode === DetachedBindMode ) {\r\n\r\n\t\t\tthis.bindMatrixInverse.copy( this.bindMatrix ).invert();\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconsole.warn( 'THREE.SkinnedMesh: Unrecognized bindMode: ' + this.bindMode );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tapplyBoneTransform( index, vector ) {\r\n\r\n\t\tconst skeleton = this.skeleton;\r\n\t\tconst geometry = this.geometry;\r\n\r\n\t\t_skinIndex.fromBufferAttribute( geometry.attributes.skinIndex, index );\r\n\t\t_skinWeight.fromBufferAttribute( geometry.attributes.skinWeight, index );\r\n\r\n\t\t_basePosition.copy( vector ).applyMatrix4( this.bindMatrix );\r\n\r\n\t\tvector.set( 0, 0, 0 );\r\n\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tconst weight = _skinWeight.getComponent( i );\r\n\r\n\t\t\tif ( weight !== 0 ) {\r\n\r\n\t\t\t\tconst boneIndex = _skinIndex.getComponent( i );\r\n\r\n\t\t\t\t_matrix4.multiplyMatrices( skeleton.bones[ boneIndex ].matrixWorld, skeleton.boneInverses[ boneIndex ] );\r\n\r\n\t\t\t\tvector.addScaledVector( _vector3.copy( _basePosition ).applyMatrix4( _matrix4 ), weight );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn vector.applyMatrix4( this.bindMatrixInverse );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Bone extends Object3D {\r\n\r\n\tconstructor() {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isBone = true;\r\n\r\n\t\tthis.type = 'Bone';\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass DataTexture extends Texture {\r\n\r\n\tconstructor( data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, colorSpace ) {\r\n\r\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\r\n\r\n\t\tthis.isDataTexture = true;\r\n\r\n\t\tthis.image = { data: data, width: width, height: height };\r\n\r\n\t\tthis.generateMipmaps = false;\r\n\t\tthis.flipY = false;\r\n\t\tthis.unpackAlignment = 1;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _offsetMatrix = /*@__PURE__*/ new Matrix4();\r\nconst _identityMatrix$1 = /*@__PURE__*/ new Matrix4();\r\n\r\nclass Skeleton {\r\n\r\n\tconstructor( bones = [], boneInverses = [] ) {\r\n\r\n\t\tthis.uuid = generateUUID();\r\n\r\n\t\tthis.bones = bones.slice( 0 );\r\n\t\tthis.boneInverses = boneInverses;\r\n\t\tthis.boneMatrices = null;\r\n\r\n\t\tthis.boneTexture = null;\r\n\r\n\t\tthis.init();\r\n\r\n\t}\r\n\r\n\tinit() {\r\n\r\n\t\tconst bones = this.bones;\r\n\t\tconst boneInverses = this.boneInverses;\r\n\r\n\t\tthis.boneMatrices = new Float32Array( bones.length * 16 );\r\n\r\n\t\t// calculate inverse bone matrices if necessary\r\n\r\n\t\tif ( boneInverses.length === 0 ) {\r\n\r\n\t\t\tthis.calculateInverses();\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// handle special case\r\n\r\n\t\t\tif ( bones.length !== boneInverses.length ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.' );\r\n\r\n\t\t\t\tthis.boneInverses = [];\r\n\r\n\t\t\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tthis.boneInverses.push( new Matrix4() );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcalculateInverses() {\r\n\r\n\t\tthis.boneInverses.length = 0;\r\n\r\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\r\n\r\n\t\t\tconst inverse = new Matrix4();\r\n\r\n\t\t\tif ( this.bones[ i ] ) {\r\n\r\n\t\t\t\tinverse.copy( this.bones[ i ].matrixWorld ).invert();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.boneInverses.push( inverse );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tpose() {\r\n\r\n\t\t// recover the bind-time world matrices\r\n\r\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\r\n\r\n\t\t\tconst bone = this.bones[ i ];\r\n\r\n\t\t\tif ( bone ) {\r\n\r\n\t\t\t\tbone.matrixWorld.copy( this.boneInverses[ i ] ).invert();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// compute the local matrices, positions, rotations and scales\r\n\r\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\r\n\r\n\t\t\tconst bone = this.bones[ i ];\r\n\r\n\t\t\tif ( bone ) {\r\n\r\n\t\t\t\tif ( bone.parent && bone.parent.isBone ) {\r\n\r\n\t\t\t\t\tbone.matrix.copy( bone.parent.matrixWorld ).invert();\r\n\t\t\t\t\tbone.matrix.multiply( bone.matrixWorld );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tbone.matrix.copy( bone.matrixWorld );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbone.matrix.decompose( bone.position, bone.quaternion, bone.scale );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst bones = this.bones;\r\n\t\tconst boneInverses = this.boneInverses;\r\n\t\tconst boneMatrices = this.boneMatrices;\r\n\t\tconst boneTexture = this.boneTexture;\r\n\r\n\t\t// flatten bone matrices to array\r\n\r\n\t\tfor ( let i = 0, il = bones.length; i < il; i ++ ) {\r\n\r\n\t\t\t// compute the offset between the current and the original transform\r\n\r\n\t\t\tconst matrix = bones[ i ] ? bones[ i ].matrixWorld : _identityMatrix$1;\r\n\r\n\t\t\t_offsetMatrix.multiplyMatrices( matrix, boneInverses[ i ] );\r\n\t\t\t_offsetMatrix.toArray( boneMatrices, i * 16 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( boneTexture !== null ) {\r\n\r\n\t\t\tboneTexture.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new Skeleton( this.bones, this.boneInverses );\r\n\r\n\t}\r\n\r\n\tcomputeBoneTexture() {\r\n\r\n\t\t// layout (1 matrix = 4 pixels)\r\n\t\t// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\r\n\t\t// with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8)\r\n\t\t// 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16)\r\n\t\t// 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32)\r\n\t\t// 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)\r\n\r\n\t\tlet size = Math.sqrt( this.bones.length * 4 ); // 4 pixels needed for 1 matrix\r\n\t\tsize = Math.ceil( size / 4 ) * 4;\r\n\t\tsize = Math.max( size, 4 );\r\n\r\n\t\tconst boneMatrices = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel\r\n\t\tboneMatrices.set( this.boneMatrices ); // copy current values\r\n\r\n\t\tconst boneTexture = new DataTexture( boneMatrices, size, size, RGBAFormat, FloatType );\r\n\t\tboneTexture.needsUpdate = true;\r\n\r\n\t\tthis.boneMatrices = boneMatrices;\r\n\t\tthis.boneTexture = boneTexture;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetBoneByName( name ) {\r\n\r\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\r\n\r\n\t\t\tconst bone = this.bones[ i ];\r\n\r\n\t\t\tif ( bone.name === name ) {\r\n\r\n\t\t\t\treturn bone;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn undefined;\r\n\r\n\t}\r\n\r\n\tdispose( ) {\r\n\r\n\t\tif ( this.boneTexture !== null ) {\r\n\r\n\t\t\tthis.boneTexture.dispose();\r\n\r\n\t\t\tthis.boneTexture = null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfromJSON( json, bones ) {\r\n\r\n\t\tthis.uuid = json.uuid;\r\n\r\n\t\tfor ( let i = 0, l = json.bones.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst uuid = json.bones[ i ];\r\n\t\t\tlet bone = bones[ uuid ];\r\n\r\n\t\t\tif ( bone === undefined ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.Skeleton: No bone found with UUID:', uuid );\r\n\t\t\t\tbone = new Bone();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.bones.push( bone );\r\n\t\t\tthis.boneInverses.push( new Matrix4().fromArray( json.boneInverses[ i ] ) );\r\n\r\n\t\t}\r\n\r\n\t\tthis.init();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = {\r\n\t\t\tmetadata: {\r\n\t\t\t\tversion: 4.6,\r\n\t\t\t\ttype: 'Skeleton',\r\n\t\t\t\tgenerator: 'Skeleton.toJSON'\r\n\t\t\t},\r\n\t\t\tbones: [],\r\n\t\t\tboneInverses: []\r\n\t\t};\r\n\r\n\t\tdata.uuid = this.uuid;\r\n\r\n\t\tconst bones = this.bones;\r\n\t\tconst boneInverses = this.boneInverses;\r\n\r\n\t\tfor ( let i = 0, l = bones.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst bone = bones[ i ];\r\n\t\t\tdata.bones.push( bone.uuid );\r\n\r\n\t\t\tconst boneInverse = boneInverses[ i ];\r\n\t\t\tdata.boneInverses.push( boneInverse.toArray() );\r\n\r\n\t\t}\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass InstancedBufferAttribute extends BufferAttribute {\r\n\r\n\tconstructor( array, itemSize, normalized, meshPerAttribute = 1 ) {\r\n\r\n\t\tsuper( array, itemSize, normalized );\r\n\r\n\t\tthis.isInstancedBufferAttribute = true;\r\n\r\n\t\tthis.meshPerAttribute = meshPerAttribute;\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = super.toJSON();\r\n\r\n\t\tdata.meshPerAttribute = this.meshPerAttribute;\r\n\r\n\t\tdata.isInstancedBufferAttribute = true;\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _instanceLocalMatrix = /*@__PURE__*/ new Matrix4();\r\nconst _instanceWorldMatrix = /*@__PURE__*/ new Matrix4();\r\n\r\nconst _instanceIntersects = [];\r\n\r\nconst _box3 = /*@__PURE__*/ new Box3();\r\nconst _identity = /*@__PURE__*/ new Matrix4();\r\nconst _mesh$1 = /*@__PURE__*/ new Mesh();\r\nconst _sphere$3 = /*@__PURE__*/ new Sphere();\r\n\r\nclass InstancedMesh extends Mesh {\r\n\r\n\tconstructor( geometry, material, count ) {\r\n\r\n\t\tsuper( geometry, material );\r\n\r\n\t\tthis.isInstancedMesh = true;\r\n\r\n\t\tthis.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );\r\n\t\tthis.instanceColor = null;\r\n\t\tthis.morphTexture = null;\r\n\r\n\t\tthis.count = count;\r\n\r\n\t\tthis.boundingBox = null;\r\n\t\tthis.boundingSphere = null;\r\n\r\n\t\tfor ( let i = 0; i < count; i ++ ) {\r\n\r\n\t\t\tthis.setMatrixAt( i, _identity );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcomputeBoundingBox() {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tconst count = this.count;\r\n\r\n\t\tif ( this.boundingBox === null ) {\r\n\r\n\t\t\tthis.boundingBox = new Box3();\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry.boundingBox === null ) {\r\n\r\n\t\t\tgeometry.computeBoundingBox();\r\n\r\n\t\t}\r\n\r\n\t\tthis.boundingBox.makeEmpty();\r\n\r\n\t\tfor ( let i = 0; i < count; i ++ ) {\r\n\r\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\r\n\r\n\t\t\t_box3.copy( geometry.boundingBox ).applyMatrix4( _instanceLocalMatrix );\r\n\r\n\t\t\tthis.boundingBox.union( _box3 );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcomputeBoundingSphere() {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tconst count = this.count;\r\n\r\n\t\tif ( this.boundingSphere === null ) {\r\n\r\n\t\t\tthis.boundingSphere = new Sphere();\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry.boundingSphere === null ) {\r\n\r\n\t\t\tgeometry.computeBoundingSphere();\r\n\r\n\t\t}\r\n\r\n\t\tthis.boundingSphere.makeEmpty();\r\n\r\n\t\tfor ( let i = 0; i < count; i ++ ) {\r\n\r\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\r\n\r\n\t\t\t_sphere$3.copy( geometry.boundingSphere ).applyMatrix4( _instanceLocalMatrix );\r\n\r\n\t\t\tthis.boundingSphere.union( _sphere$3 );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcopy( source, recursive ) {\r\n\r\n\t\tsuper.copy( source, recursive );\r\n\r\n\t\tthis.instanceMatrix.copy( source.instanceMatrix );\r\n\r\n\t\tif ( source.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();\r\n\t\tif ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();\r\n\r\n\t\tthis.count = source.count;\r\n\r\n\t\tif ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();\r\n\t\tif ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetColorAt( index, color ) {\r\n\r\n\t\tcolor.fromArray( this.instanceColor.array, index * 3 );\r\n\r\n\t}\r\n\r\n\tgetMatrixAt( index, matrix ) {\r\n\r\n\t\tmatrix.fromArray( this.instanceMatrix.array, index * 16 );\r\n\r\n\t}\r\n\r\n\tgetMorphAt( index, object ) {\r\n\r\n\t\tconst objectInfluences = object.morphTargetInfluences;\r\n\r\n\t\tconst array = this.morphTexture.source.data.data;\r\n\r\n\t\tconst len = objectInfluences.length + 1; // All influences + the baseInfluenceSum\r\n\r\n\t\tconst dataIndex = index * len + 1; // Skip the baseInfluenceSum at the beginning\r\n\r\n\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\r\n\r\n\t\t\tobjectInfluences[ i ] = array[ dataIndex + i ];\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\traycast( raycaster, intersects ) {\r\n\r\n\t\tconst matrixWorld = this.matrixWorld;\r\n\t\tconst raycastTimes = this.count;\r\n\r\n\t\t_mesh$1.geometry = this.geometry;\r\n\t\t_mesh$1.material = this.material;\r\n\r\n\t\tif ( _mesh$1.material === undefined ) return;\r\n\r\n\t\t// test with bounding sphere first\r\n\r\n\t\tif ( this.boundingSphere === null ) this.computeBoundingSphere();\r\n\r\n\t\t_sphere$3.copy( this.boundingSphere );\r\n\t\t_sphere$3.applyMatrix4( matrixWorld );\r\n\r\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$3 ) === false ) return;\r\n\r\n\t\t// now test each instance\r\n\r\n\t\tfor ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {\r\n\r\n\t\t\t// calculate the world matrix for each instance\r\n\r\n\t\t\tthis.getMatrixAt( instanceId, _instanceLocalMatrix );\r\n\r\n\t\t\t_instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix );\r\n\r\n\t\t\t// the mesh represents this single instance\r\n\r\n\t\t\t_mesh$1.matrixWorld = _instanceWorldMatrix;\r\n\r\n\t\t\t_mesh$1.raycast( raycaster, _instanceIntersects );\r\n\r\n\t\t\t// process the result of raycast\r\n\r\n\t\t\tfor ( let i = 0, l = _instanceIntersects.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tconst intersect = _instanceIntersects[ i ];\r\n\t\t\t\tintersect.instanceId = instanceId;\r\n\t\t\t\tintersect.object = this;\r\n\t\t\t\tintersects.push( intersect );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_instanceIntersects.length = 0;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tsetColorAt( index, color ) {\r\n\r\n\t\tif ( this.instanceColor === null ) {\r\n\r\n\t\t\tthis.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ).fill( 1 ), 3 );\r\n\r\n\t\t}\r\n\r\n\t\tcolor.toArray( this.instanceColor.array, index * 3 );\r\n\r\n\t}\r\n\r\n\tsetMatrixAt( index, matrix ) {\r\n\r\n\t\tmatrix.toArray( this.instanceMatrix.array, index * 16 );\r\n\r\n\t}\r\n\r\n\tsetMorphAt( index, object ) {\r\n\r\n\t\tconst objectInfluences = object.morphTargetInfluences;\r\n\r\n\t\tconst len = objectInfluences.length + 1; // morphBaseInfluence + all influences\r\n\r\n\t\tif ( this.morphTexture === null ) {\r\n\r\n\t\t\tthis.morphTexture = new DataTexture( new Float32Array( len * this.count ), len, this.count, RedFormat, FloatType );\r\n\r\n\t\t}\r\n\r\n\t\tconst array = this.morphTexture.source.data.data;\r\n\r\n\t\tlet morphInfluencesSum = 0;\r\n\r\n\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\r\n\r\n\t\t\tmorphInfluencesSum += objectInfluences[ i ];\r\n\r\n\t\t}\r\n\r\n\t\tconst morphBaseInfluence = this.geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\r\n\r\n\t\tconst dataIndex = len * index;\r\n\r\n\t\tarray[ dataIndex ] = morphBaseInfluence;\r\n\r\n\t\tarray.set( objectInfluences, dataIndex + 1 );\r\n\r\n\t}\r\n\r\n\tupdateMorphTargets() {\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.dispatchEvent( { type: 'dispose' } );\r\n\r\n\t\tif ( this.morphTexture !== null ) {\r\n\r\n\t\t\tthis.morphTexture.dispose();\r\n\t\t\tthis.morphTexture = null;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction sortOpaque( a, b ) {\r\n\r\n\treturn a.z - b.z;\r\n\r\n}\r\n\r\nfunction sortTransparent( a, b ) {\r\n\r\n\treturn b.z - a.z;\r\n\r\n}\r\n\r\nclass MultiDrawRenderList {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.index = 0;\r\n\t\tthis.pool = [];\r\n\t\tthis.list = [];\r\n\r\n\t}\r\n\r\n\tpush( drawRange, z, index ) {\r\n\r\n\t\tconst pool = this.pool;\r\n\t\tconst list = this.list;\r\n\t\tif ( this.index >= pool.length ) {\r\n\r\n\t\t\tpool.push( {\r\n\r\n\t\t\t\tstart: - 1,\r\n\t\t\t\tcount: - 1,\r\n\t\t\t\tz: - 1,\r\n\t\t\t\tindex: - 1,\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\tconst item = pool[ this.index ];\r\n\t\tlist.push( item );\r\n\t\tthis.index ++;\r\n\r\n\t\titem.start = drawRange.start;\r\n\t\titem.count = drawRange.count;\r\n\t\titem.z = z;\r\n\t\titem.index = index;\r\n\r\n\t}\r\n\r\n\treset() {\r\n\r\n\t\tthis.list.length = 0;\r\n\t\tthis.index = 0;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _matrix$1 = /*@__PURE__*/ new Matrix4();\r\nconst _invMatrixWorld = /*@__PURE__*/ new Matrix4();\r\nconst _identityMatrix = /*@__PURE__*/ new Matrix4();\r\nconst _whiteColor = /*@__PURE__*/ new Color( 1, 1, 1 );\r\nconst _projScreenMatrix$2 = /*@__PURE__*/ new Matrix4();\r\nconst _frustum = /*@__PURE__*/ new Frustum();\r\nconst _box$1 = /*@__PURE__*/ new Box3();\r\nconst _sphere$2 = /*@__PURE__*/ new Sphere();\r\nconst _vector$5 = /*@__PURE__*/ new Vector3();\r\nconst _forward = /*@__PURE__*/ new Vector3();\r\nconst _temp = /*@__PURE__*/ new Vector3();\r\nconst _renderList = /*@__PURE__*/ new MultiDrawRenderList();\r\nconst _mesh = /*@__PURE__*/ new Mesh();\r\nconst _batchIntersects = [];\r\n\r\n// @TODO: SkinnedMesh support?\r\n// @TODO: geometry.groups support?\r\n// @TODO: geometry.drawRange support?\r\n// @TODO: geometry.morphAttributes support?\r\n// @TODO: Support uniform parameter per geometry\r\n// @TODO: Add an \"optimize\" function to pack geometry and remove data gaps\r\n\r\n// copies data from attribute \"src\" into \"target\" starting at \"targetOffset\"\r\nfunction copyAttributeData( src, target, targetOffset = 0 ) {\r\n\r\n\tconst itemSize = target.itemSize;\r\n\tif ( src.isInterleavedBufferAttribute || src.array.constructor !== target.array.constructor ) {\r\n\r\n\t\t// use the component getters and setters if the array data cannot\r\n\t\t// be copied directly\r\n\t\tconst vertexCount = src.count;\r\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\r\n\r\n\t\t\tfor ( let c = 0; c < itemSize; c ++ ) {\r\n\r\n\t\t\t\ttarget.setComponent( i + targetOffset, c, src.getComponent( i, c ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\t// faster copy approach using typed array set function\r\n\t\ttarget.array.set( src.array, targetOffset * itemSize );\r\n\r\n\t}\r\n\r\n\ttarget.needsUpdate = true;\r\n\r\n}\r\n\r\nclass BatchedMesh extends Mesh {\r\n\r\n\tget maxInstanceCount() {\r\n\r\n\t\treturn this._maxInstanceCount;\r\n\r\n\t}\r\n\r\n\tconstructor( maxInstanceCount, maxVertexCount, maxIndexCount = maxVertexCount * 2, material ) {\r\n\r\n\t\tsuper( new BufferGeometry(), material );\r\n\r\n\t\tthis.isBatchedMesh = true;\r\n\t\tthis.perObjectFrustumCulled = true;\r\n\t\tthis.sortObjects = true;\r\n\t\tthis.boundingBox = null;\r\n\t\tthis.boundingSphere = null;\r\n\t\tthis.customSort = null;\r\n\r\n\t\t// stores visible, active, and geometry id per object\r\n\t\tthis._drawInfo = [];\r\n\r\n\t\t// geometry information\r\n\t\tthis._drawRanges = [];\r\n\t\tthis._reservedRanges = [];\r\n\t\tthis._bounds = [];\r\n\r\n\t\tthis._maxInstanceCount = maxInstanceCount;\r\n\t\tthis._maxVertexCount = maxVertexCount;\r\n\t\tthis._maxIndexCount = maxIndexCount;\r\n\r\n\t\tthis._geometryInitialized = false;\r\n\t\tthis._geometryCount = 0;\r\n\t\tthis._multiDrawCounts = new Int32Array( maxInstanceCount );\r\n\t\tthis._multiDrawStarts = new Int32Array( maxInstanceCount );\r\n\t\tthis._multiDrawCount = 0;\r\n\t\tthis._multiDrawInstances = null;\r\n\t\tthis._visibilityChanged = true;\r\n\r\n\t\t// Local matrix per geometry by using data texture\r\n\t\tthis._matricesTexture = null;\r\n\t\tthis._indirectTexture = null;\r\n\t\tthis._colorsTexture = null;\r\n\r\n\t\tthis._initMatricesTexture();\r\n\t\tthis._initIndirectTexture();\r\n\r\n\t}\r\n\r\n\t_initMatricesTexture() {\r\n\r\n\t\t// layout (1 matrix = 4 pixels)\r\n\t\t// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\r\n\t\t// with 8x8 pixel texture max 16 matrices * 4 pixels = (8 * 8)\r\n\t\t// 16x16 pixel texture max 64 matrices * 4 pixels = (16 * 16)\r\n\t\t// 32x32 pixel texture max 256 matrices * 4 pixels = (32 * 32)\r\n\t\t// 64x64 pixel texture max 1024 matrices * 4 pixels = (64 * 64)\r\n\r\n\t\tlet size = Math.sqrt( this._maxInstanceCount * 4 ); // 4 pixels needed for 1 matrix\r\n\t\tsize = Math.ceil( size / 4 ) * 4;\r\n\t\tsize = Math.max( size, 4 );\r\n\r\n\t\tconst matricesArray = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel\r\n\t\tconst matricesTexture = new DataTexture( matricesArray, size, size, RGBAFormat, FloatType );\r\n\r\n\t\tthis._matricesTexture = matricesTexture;\r\n\r\n\t}\r\n\r\n\t_initIndirectTexture() {\r\n\r\n\t\tlet size = Math.sqrt( this._maxInstanceCount );\r\n\t\tsize = Math.ceil( size );\r\n\r\n\t\tconst indirectArray = new Uint32Array( size * size );\r\n\t\tconst indirectTexture = new DataTexture( indirectArray, size, size, RedIntegerFormat, UnsignedIntType );\r\n\r\n\t\tthis._indirectTexture = indirectTexture;\r\n\r\n\t}\r\n\r\n\t_initColorsTexture() {\r\n\r\n\t\tlet size = Math.sqrt( this._maxInstanceCount );\r\n\t\tsize = Math.ceil( size );\r\n\r\n\t\t// 4 floats per RGBA pixel initialized to white\r\n\t\tconst colorsArray = new Float32Array( size * size * 4 ).fill( 1 );\r\n\t\tconst colorsTexture = new DataTexture( colorsArray, size, size, RGBAFormat, FloatType );\r\n\t\tcolorsTexture.colorSpace = ColorManagement.workingColorSpace;\r\n\r\n\t\tthis._colorsTexture = colorsTexture;\r\n\r\n\t}\r\n\r\n\t_initializeGeometry( reference ) {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tconst maxVertexCount = this._maxVertexCount;\r\n\t\tconst maxIndexCount = this._maxIndexCount;\r\n\t\tif ( this._geometryInitialized === false ) {\r\n\r\n\t\t\tfor ( const attributeName in reference.attributes ) {\r\n\r\n\t\t\t\tconst srcAttribute = reference.getAttribute( attributeName );\r\n\t\t\t\tconst { array, itemSize, normalized } = srcAttribute;\r\n\r\n\t\t\t\tconst dstArray = new array.constructor( maxVertexCount * itemSize );\r\n\t\t\t\tconst dstAttribute = new BufferAttribute( dstArray, itemSize, normalized );\r\n\r\n\t\t\t\tgeometry.setAttribute( attributeName, dstAttribute );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( reference.getIndex() !== null ) {\r\n\r\n\t\t\t\t// Reserve last u16 index for primitive restart.\r\n\t\t\t\tconst indexArray = maxVertexCount > 65535\r\n\t\t\t\t\t? new Uint32Array( maxIndexCount )\r\n\t\t\t\t\t: new Uint16Array( maxIndexCount );\r\n\r\n\t\t\t\tgeometry.setIndex( new BufferAttribute( indexArray, 1 ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis._geometryInitialized = true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Make sure the geometry is compatible with the existing combined geometry attributes\r\n\t_validateGeometry( geometry ) {\r\n\r\n\t\t// check to ensure the geometries are using consistent attributes and indices\r\n\t\tconst batchGeometry = this.geometry;\r\n\t\tif ( Boolean( geometry.getIndex() ) !== Boolean( batchGeometry.getIndex() ) ) {\r\n\r\n\t\t\tthrow new Error( 'BatchedMesh: All geometries must consistently have \"index\".' );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( const attributeName in batchGeometry.attributes ) {\r\n\r\n\t\t\tif ( ! geometry.hasAttribute( attributeName ) ) {\r\n\r\n\t\t\t\tthrow new Error( `BatchedMesh: Added geometry missing \"${ attributeName }\". All geometries must have consistent attributes.` );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst srcAttribute = geometry.getAttribute( attributeName );\r\n\t\t\tconst dstAttribute = batchGeometry.getAttribute( attributeName );\r\n\t\t\tif ( srcAttribute.itemSize !== dstAttribute.itemSize || srcAttribute.normalized !== dstAttribute.normalized ) {\r\n\r\n\t\t\t\tthrow new Error( 'BatchedMesh: All attributes must have a consistent itemSize and normalized value.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tsetCustomSort( func ) {\r\n\r\n\t\tthis.customSort = func;\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcomputeBoundingBox() {\r\n\r\n\t\tif ( this.boundingBox === null ) {\r\n\r\n\t\t\tthis.boundingBox = new Box3();\r\n\r\n\t\t}\r\n\r\n\t\tconst boundingBox = this.boundingBox;\r\n\t\tconst drawInfo = this._drawInfo;\r\n\r\n\t\tboundingBox.makeEmpty();\r\n\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\r\n\r\n\t\t\tif ( drawInfo[ i ].active === false ) continue;\r\n\r\n\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\r\n\t\t\tthis.getMatrixAt( i, _matrix$1 );\r\n\t\t\tthis.getBoundingBoxAt( geometryId, _box$1 ).applyMatrix4( _matrix$1 );\r\n\t\t\tboundingBox.union( _box$1 );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcomputeBoundingSphere() {\r\n\r\n\t\tif ( this.boundingSphere === null ) {\r\n\r\n\t\t\tthis.boundingSphere = new Sphere();\r\n\r\n\t\t}\r\n\r\n\t\tconst boundingSphere = this.boundingSphere;\r\n\t\tconst drawInfo = this._drawInfo;\r\n\r\n\t\tboundingSphere.makeEmpty();\r\n\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\r\n\r\n\t\t\tif ( drawInfo[ i ].active === false ) continue;\r\n\r\n\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\r\n\t\t\tthis.getMatrixAt( i, _matrix$1 );\r\n\t\t\tthis.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );\r\n\t\t\tboundingSphere.union( _sphere$2 );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\taddInstance( geometryId ) {\r\n\r\n\t\t// ensure we're not over geometry\r\n\t\tif ( this._drawInfo.length >= this._maxInstanceCount ) {\r\n\r\n\t\t\tthrow new Error( 'BatchedMesh: Maximum item count reached.' );\r\n\r\n\t\t}\r\n\r\n\t\tthis._drawInfo.push( {\r\n\r\n\t\t\tvisible: true,\r\n\t\t\tactive: true,\r\n\t\t\tgeometryIndex: geometryId,\r\n\r\n\t\t} );\r\n\r\n\t\t// initialize the matrix\r\n\t\tconst drawId = this._drawInfo.length - 1;\r\n\t\tconst matricesTexture = this._matricesTexture;\r\n\t\tconst matricesArray = matricesTexture.image.data;\r\n\t\t_identityMatrix.toArray( matricesArray, drawId * 16 );\r\n\t\tmatricesTexture.needsUpdate = true;\r\n\r\n\t\tconst colorsTexture = this._colorsTexture;\r\n\t\tif ( colorsTexture ) {\r\n\r\n\t\t\t_whiteColor.toArray( colorsTexture.image.data, drawId * 4 );\r\n\t\t\tcolorsTexture.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t\treturn drawId;\r\n\r\n\t}\r\n\r\n\taddGeometry( geometry, vertexCount = - 1, indexCount = - 1 ) {\r\n\r\n\t\tthis._initializeGeometry( geometry );\r\n\r\n\t\tthis._validateGeometry( geometry );\r\n\r\n\t\t// ensure we're not over geometry\r\n\t\tif ( this._drawInfo.length >= this._maxInstanceCount ) {\r\n\r\n\t\t\tthrow new Error( 'BatchedMesh: Maximum item count reached.' );\r\n\r\n\t\t}\r\n\r\n\t\t// get the necessary range fo the geometry\r\n\t\tconst reservedRange = {\r\n\t\t\tvertexStart: - 1,\r\n\t\t\tvertexCount: - 1,\r\n\t\t\tindexStart: - 1,\r\n\t\t\tindexCount: - 1,\r\n\t\t};\r\n\r\n\t\tlet lastRange = null;\r\n\t\tconst reservedRanges = this._reservedRanges;\r\n\t\tconst drawRanges = this._drawRanges;\r\n\t\tconst bounds = this._bounds;\r\n\t\tif ( this._geometryCount !== 0 ) {\r\n\r\n\t\t\tlastRange = reservedRanges[ reservedRanges.length - 1 ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( vertexCount === - 1 ) {\r\n\r\n\t\t\treservedRange.vertexCount = geometry.getAttribute( 'position' ).count;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treservedRange.vertexCount = vertexCount;\r\n\r\n\t\t}\r\n\r\n\t\tif ( lastRange === null ) {\r\n\r\n\t\t\treservedRange.vertexStart = 0;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treservedRange.vertexStart = lastRange.vertexStart + lastRange.vertexCount;\r\n\r\n\t\t}\r\n\r\n\t\tconst index = geometry.getIndex();\r\n\t\tconst hasIndex = index !== null;\r\n\t\tif ( hasIndex ) {\r\n\r\n\t\t\tif ( indexCount\t=== - 1 ) {\r\n\r\n\t\t\t\treservedRange.indexCount = index.count;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\treservedRange.indexCount = indexCount;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( lastRange === null ) {\r\n\r\n\t\t\t\treservedRange.indexStart = 0;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\treservedRange.indexStart = lastRange.indexStart + lastRange.indexCount;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\treservedRange.indexStart !== - 1 &&\r\n\t\t\treservedRange.indexStart + reservedRange.indexCount > this._maxIndexCount ||\r\n\t\t\treservedRange.vertexStart + reservedRange.vertexCount > this._maxVertexCount\r\n\t\t) {\r\n\r\n\t\t\tthrow new Error( 'BatchedMesh: Reserved space request exceeds the maximum buffer size.' );\r\n\r\n\t\t}\r\n\r\n\t\t// update id\r\n\t\tconst geometryId = this._geometryCount;\r\n\t\tthis._geometryCount ++;\r\n\r\n\t\t// add the reserved range and draw range objects\r\n\t\treservedRanges.push( reservedRange );\r\n\t\tdrawRanges.push( {\r\n\t\t\tstart: hasIndex ? reservedRange.indexStart : reservedRange.vertexStart,\r\n\t\t\tcount: - 1\r\n\t\t} );\r\n\t\tbounds.push( {\r\n\t\t\tboxInitialized: false,\r\n\t\t\tbox: new Box3(),\r\n\r\n\t\t\tsphereInitialized: false,\r\n\t\t\tsphere: new Sphere()\r\n\t\t} );\r\n\r\n\t\t// update the geometry\r\n\t\tthis.setGeometryAt( geometryId, geometry );\r\n\r\n\t\treturn geometryId;\r\n\r\n\t}\r\n\r\n\tsetGeometryAt( geometryId, geometry ) {\r\n\r\n\t\tif ( geometryId >= this._geometryCount ) {\r\n\r\n\t\t\tthrow new Error( 'BatchedMesh: Maximum geometry count reached.' );\r\n\r\n\t\t}\r\n\r\n\t\tthis._validateGeometry( geometry );\r\n\r\n\t\tconst batchGeometry = this.geometry;\r\n\t\tconst hasIndex = batchGeometry.getIndex() !== null;\r\n\t\tconst dstIndex = batchGeometry.getIndex();\r\n\t\tconst srcIndex = geometry.getIndex();\r\n\t\tconst reservedRange = this._reservedRanges[ geometryId ];\r\n\t\tif (\r\n\t\t\thasIndex &&\r\n\t\t\tsrcIndex.count > reservedRange.indexCount ||\r\n\t\t\tgeometry.attributes.position.count > reservedRange.vertexCount\r\n\t\t) {\r\n\r\n\t\t\tthrow new Error( 'BatchedMesh: Reserved space not large enough for provided geometry.' );\r\n\r\n\t\t}\r\n\r\n\t\t// copy geometry over\r\n\t\tconst vertexStart = reservedRange.vertexStart;\r\n\t\tconst vertexCount = reservedRange.vertexCount;\r\n\t\tfor ( const attributeName in batchGeometry.attributes ) {\r\n\r\n\t\t\t// copy attribute data\r\n\t\t\tconst srcAttribute = geometry.getAttribute( attributeName );\r\n\t\t\tconst dstAttribute = batchGeometry.getAttribute( attributeName );\r\n\t\t\tcopyAttributeData( srcAttribute, dstAttribute, vertexStart );\r\n\r\n\t\t\t// fill the rest in with zeroes\r\n\t\t\tconst itemSize = srcAttribute.itemSize;\r\n\t\t\tfor ( let i = srcAttribute.count, l = vertexCount; i < l; i ++ ) {\r\n\r\n\t\t\t\tconst index = vertexStart + i;\r\n\t\t\t\tfor ( let c = 0; c < itemSize; c ++ ) {\r\n\r\n\t\t\t\t\tdstAttribute.setComponent( index, c, 0 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdstAttribute.needsUpdate = true;\r\n\t\t\tdstAttribute.addUpdateRange( vertexStart * itemSize, vertexCount * itemSize );\r\n\r\n\t\t}\r\n\r\n\t\t// copy index\r\n\t\tif ( hasIndex ) {\r\n\r\n\t\t\tconst indexStart = reservedRange.indexStart;\r\n\r\n\t\t\t// copy index data over\r\n\t\t\tfor ( let i = 0; i < srcIndex.count; i ++ ) {\r\n\r\n\t\t\t\tdstIndex.setX( indexStart + i, vertexStart + srcIndex.getX( i ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// fill the rest in with zeroes\r\n\t\t\tfor ( let i = srcIndex.count, l = reservedRange.indexCount; i < l; i ++ ) {\r\n\r\n\t\t\t\tdstIndex.setX( indexStart + i, vertexStart );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdstIndex.needsUpdate = true;\r\n\t\t\tdstIndex.addUpdateRange( indexStart, reservedRange.indexCount );\r\n\r\n\t\t}\r\n\r\n\t\t// store the bounding boxes\r\n\t\tconst bound = this._bounds[ geometryId ];\r\n\t\tif ( geometry.boundingBox !== null ) {\r\n\r\n\t\t\tbound.box.copy( geometry.boundingBox );\r\n\t\t\tbound.boxInitialized = true;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tbound.boxInitialized = false;\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry.boundingSphere !== null ) {\r\n\r\n\t\t\tbound.sphere.copy( geometry.boundingSphere );\r\n\t\t\tbound.sphereInitialized = true;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tbound.sphereInitialized = false;\r\n\r\n\t\t}\r\n\r\n\t\t// set drawRange count\r\n\t\tconst drawRange = this._drawRanges[ geometryId ];\r\n\t\tconst posAttr = geometry.getAttribute( 'position' );\r\n\t\tdrawRange.count = hasIndex ? srcIndex.count : posAttr.count;\r\n\t\tthis._visibilityChanged = true;\r\n\r\n\t\treturn geometryId;\r\n\r\n\t}\r\n\r\n\t/*\r\n\tdeleteGeometry( geometryId ) {\r\n\r\n\t\t// TODO: delete geometry and associated instances\r\n\r\n\t}\r\n\t*/\r\n\r\n\t/*\r\n\tdeleteInstance( instanceId ) {\r\n\r\n\t\t// Note: User needs to call optimize() afterward to pack the data.\r\n\r\n\t\tconst drawInfo = this._drawInfo;\r\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tdrawInfo[ instanceId ].active = false;\r\n\t\tthis._visibilityChanged = true;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\t*/\r\n\r\n\t// get bounding box and compute it if it doesn't exist\r\n\tgetBoundingBoxAt( geometryId, target ) {\r\n\r\n\t\tif ( geometryId >= this._geometryCount ) {\r\n\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\t// compute bounding box\r\n\t\tconst bound = this._bounds[ geometryId ];\r\n\t\tconst box = bound.box;\r\n\t\tconst geometry = this.geometry;\r\n\t\tif ( bound.boxInitialized === false ) {\r\n\r\n\t\t\tbox.makeEmpty();\r\n\r\n\t\t\tconst index = geometry.index;\r\n\t\t\tconst position = geometry.attributes.position;\r\n\t\t\tconst drawRange = this._drawRanges[ geometryId ];\r\n\t\t\tfor ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {\r\n\r\n\t\t\t\tlet iv = i;\r\n\t\t\t\tif ( index ) {\r\n\r\n\t\t\t\t\tiv = index.getX( iv );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbox.expandByPoint( _vector$5.fromBufferAttribute( position, iv ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbound.boxInitialized = true;\r\n\r\n\t\t}\r\n\r\n\t\ttarget.copy( box );\r\n\t\treturn target;\r\n\r\n\t}\r\n\r\n\t// get bounding sphere and compute it if it doesn't exist\r\n\tgetBoundingSphereAt( geometryId, target ) {\r\n\r\n\t\tif ( geometryId >= this._geometryCount ) {\r\n\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\t// compute bounding sphere\r\n\t\tconst bound = this._bounds[ geometryId ];\r\n\t\tconst sphere = bound.sphere;\r\n\t\tconst geometry = this.geometry;\r\n\t\tif ( bound.sphereInitialized === false ) {\r\n\r\n\t\t\tsphere.makeEmpty();\r\n\r\n\t\t\tthis.getBoundingBoxAt( geometryId, _box$1 );\r\n\t\t\t_box$1.getCenter( sphere.center );\r\n\r\n\t\t\tconst index = geometry.index;\r\n\t\t\tconst position = geometry.attributes.position;\r\n\t\t\tconst drawRange = this._drawRanges[ geometryId ];\r\n\r\n\t\t\tlet maxRadiusSq = 0;\r\n\t\t\tfor ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {\r\n\r\n\t\t\t\tlet iv = i;\r\n\t\t\t\tif ( index ) {\r\n\r\n\t\t\t\t\tiv = index.getX( iv );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t_vector$5.fromBufferAttribute( position, iv );\r\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, sphere.center.distanceToSquared( _vector$5 ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tsphere.radius = Math.sqrt( maxRadiusSq );\r\n\t\t\tbound.sphereInitialized = true;\r\n\r\n\t\t}\r\n\r\n\t\ttarget.copy( sphere );\r\n\t\treturn target;\r\n\r\n\t}\r\n\r\n\tsetMatrixAt( instanceId, matrix ) {\r\n\r\n\t\t// @TODO: Map geometryId to index of the arrays because\r\n\t\t// optimize() can make geometryId mismatch the index\r\n\r\n\t\tconst drawInfo = this._drawInfo;\r\n\t\tconst matricesTexture = this._matricesTexture;\r\n\t\tconst matricesArray = this._matricesTexture.image.data;\r\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tmatrix.toArray( matricesArray, instanceId * 16 );\r\n\t\tmatricesTexture.needsUpdate = true;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetMatrixAt( instanceId, matrix ) {\r\n\r\n\t\tconst drawInfo = this._drawInfo;\r\n\t\tconst matricesArray = this._matricesTexture.image.data;\r\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\r\n\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\treturn matrix.fromArray( matricesArray, instanceId * 16 );\r\n\r\n\t}\r\n\r\n\tsetColorAt( instanceId, color ) {\r\n\r\n\t\tif ( this._colorsTexture === null ) {\r\n\r\n\t\t\tthis._initColorsTexture();\r\n\r\n\t\t}\r\n\r\n\t\t// @TODO: Map id to index of the arrays because\r\n\t\t// optimize() can make id mismatch the index\r\n\r\n\t\tconst colorsTexture = this._colorsTexture;\r\n\t\tconst colorsArray = this._colorsTexture.image.data;\r\n\t\tconst drawInfo = this._drawInfo;\r\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tcolor.toArray( colorsArray, instanceId * 4 );\r\n\t\tcolorsTexture.needsUpdate = true;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetColorAt( instanceId, color ) {\r\n\r\n\t\tconst colorsArray = this._colorsTexture.image.data;\r\n\t\tconst drawInfo = this._drawInfo;\r\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\r\n\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\treturn color.fromArray( colorsArray, instanceId * 4 );\r\n\r\n\t}\r\n\r\n\tsetVisibleAt( instanceId, value ) {\r\n\r\n\t\t// if the geometry is out of range, not active, or visibility state\r\n\t\t// does not change then return early\r\n\t\tconst drawInfo = this._drawInfo;\r\n\t\tif (\r\n\t\t\tinstanceId >= drawInfo.length ||\r\n\t\t\tdrawInfo[ instanceId ].active === false ||\r\n\t\t\tdrawInfo[ instanceId ].visible === value\r\n\t\t) {\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tdrawInfo[ instanceId ].visible = value;\r\n\t\tthis._visibilityChanged = true;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetVisibleAt( instanceId ) {\r\n\r\n\t\t// return early if the geometry is out of range or not active\r\n\t\tconst drawInfo = this._drawInfo;\r\n\t\tif ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t\treturn drawInfo[ instanceId ].visible;\r\n\r\n\t}\r\n\r\n\traycast( raycaster, intersects ) {\r\n\r\n\t\tconst drawInfo = this._drawInfo;\r\n\t\tconst drawRanges = this._drawRanges;\r\n\t\tconst matrixWorld = this.matrixWorld;\r\n\t\tconst batchGeometry = this.geometry;\r\n\r\n\t\t// iterate over each geometry\r\n\t\t_mesh.material = this.material;\r\n\t\t_mesh.geometry.index = batchGeometry.index;\r\n\t\t_mesh.geometry.attributes = batchGeometry.attributes;\r\n\t\tif ( _mesh.geometry.boundingBox === null ) {\r\n\r\n\t\t\t_mesh.geometry.boundingBox = new Box3();\r\n\r\n\t\t}\r\n\r\n\t\tif ( _mesh.geometry.boundingSphere === null ) {\r\n\r\n\t\t\t_mesh.geometry.boundingSphere = new Sphere();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\r\n\r\n\t\t\tif ( ! drawInfo[ i ].visible || ! drawInfo[ i ].active ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\r\n\t\t\tconst drawRange = drawRanges[ geometryId ];\r\n\t\t\t_mesh.geometry.setDrawRange( drawRange.start, drawRange.count );\r\n\r\n\t\t\t// ge the intersects\r\n\t\t\tthis.getMatrixAt( i, _mesh.matrixWorld ).premultiply( matrixWorld );\r\n\t\t\tthis.getBoundingBoxAt( geometryId, _mesh.geometry.boundingBox );\r\n\t\t\tthis.getBoundingSphereAt( geometryId, _mesh.geometry.boundingSphere );\r\n\t\t\t_mesh.raycast( raycaster, _batchIntersects );\r\n\r\n\t\t\t// add batch id to the intersects\r\n\t\t\tfor ( let j = 0, l = _batchIntersects.length; j < l; j ++ ) {\r\n\r\n\t\t\t\tconst intersect = _batchIntersects[ j ];\r\n\t\t\t\tintersect.object = this;\r\n\t\t\t\tintersect.batchId = i;\r\n\t\t\t\tintersects.push( intersect );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_batchIntersects.length = 0;\r\n\r\n\t\t}\r\n\r\n\t\t_mesh.material = null;\r\n\t\t_mesh.geometry.index = null;\r\n\t\t_mesh.geometry.attributes = {};\r\n\t\t_mesh.geometry.setDrawRange( 0, Infinity );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.geometry = source.geometry.clone();\r\n\t\tthis.perObjectFrustumCulled = source.perObjectFrustumCulled;\r\n\t\tthis.sortObjects = source.sortObjects;\r\n\t\tthis.boundingBox = source.boundingBox !== null ? source.boundingBox.clone() : null;\r\n\t\tthis.boundingSphere = source.boundingSphere !== null ? source.boundingSphere.clone() : null;\r\n\r\n\t\tthis._drawRanges = source._drawRanges.map( range => ( { ...range } ) );\r\n\t\tthis._reservedRanges = source._reservedRanges.map( range => ( { ...range } ) );\r\n\r\n\t\tthis._drawInfo = source._drawInfo.map( inf => ( { ...inf } ) );\r\n\t\tthis._bounds = source._bounds.map( bound => ( {\r\n\t\t\tboxInitialized: bound.boxInitialized,\r\n\t\t\tbox: bound.box.clone(),\r\n\r\n\t\t\tsphereInitialized: bound.sphereInitialized,\r\n\t\t\tsphere: bound.sphere.clone()\r\n\t\t} ) );\r\n\r\n\t\tthis._maxInstanceCount = source._maxInstanceCount;\r\n\t\tthis._maxVertexCount = source._maxVertexCount;\r\n\t\tthis._maxIndexCount = source._maxIndexCount;\r\n\r\n\t\tthis._geometryInitialized = source._geometryInitialized;\r\n\t\tthis._geometryCount = source._geometryCount;\r\n\t\tthis._multiDrawCounts = source._multiDrawCounts.slice();\r\n\t\tthis._multiDrawStarts = source._multiDrawStarts.slice();\r\n\r\n\t\tthis._matricesTexture = source._matricesTexture.clone();\r\n\t\tthis._matricesTexture.image.data = this._matricesTexture.image.data.slice();\r\n\r\n\t\tif ( this._colorsTexture !== null ) {\r\n\r\n\t\t\tthis._colorsTexture = source._colorsTexture.clone();\r\n\t\t\tthis._colorsTexture.image.data = this._colorsTexture.image.data.slice();\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\t// Assuming the geometry is not shared with other meshes\r\n\t\tthis.geometry.dispose();\r\n\r\n\t\tthis._matricesTexture.dispose();\r\n\t\tthis._matricesTexture = null;\r\n\r\n\t\tthis._indirectTexture.dispose();\r\n\t\tthis._indirectTexture = null;\r\n\r\n\t\tif ( this._colorsTexture !== null ) {\r\n\r\n\t\t\tthis._colorsTexture.dispose();\r\n\t\t\tthis._colorsTexture = null;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tonBeforeRender( renderer, scene, camera, geometry, material/*, _group*/ ) {\r\n\r\n\t\t// if visibility has not changed and frustum culling and object sorting is not required\r\n\t\t// then skip iterating over all items\r\n\t\tif ( ! this._visibilityChanged && ! this.perObjectFrustumCulled && ! this.sortObjects ) {\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\t// the indexed version of the multi draw function requires specifying the start\r\n\t\t// offset in bytes.\r\n\t\tconst index = geometry.getIndex();\r\n\t\tconst bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;\r\n\r\n\t\tconst drawInfo = this._drawInfo;\r\n\t\tconst multiDrawStarts = this._multiDrawStarts;\r\n\t\tconst multiDrawCounts = this._multiDrawCounts;\r\n\t\tconst drawRanges = this._drawRanges;\r\n\t\tconst perObjectFrustumCulled = this.perObjectFrustumCulled;\r\n\t\tconst indirectTexture = this._indirectTexture;\r\n\t\tconst indirectArray = indirectTexture.image.data;\r\n\r\n\t\t// prepare the frustum in the local frame\r\n\t\tif ( perObjectFrustumCulled ) {\r\n\r\n\t\t\t_projScreenMatrix$2\r\n\t\t\t\t.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )\r\n\t\t\t\t.multiply( this.matrixWorld );\r\n\t\t\t_frustum.setFromProjectionMatrix(\r\n\t\t\t\t_projScreenMatrix$2,\r\n\t\t\t\trenderer.coordinateSystem\r\n\t\t\t);\r\n\r\n\t\t}\r\n\r\n\t\tlet count = 0;\r\n\t\tif ( this.sortObjects ) {\r\n\r\n\t\t\t// get the camera position in the local frame\r\n\t\t\t_invMatrixWorld.copy( this.matrixWorld ).invert();\r\n\t\t\t_vector$5.setFromMatrixPosition( camera.matrixWorld ).applyMatrix4( _invMatrixWorld );\r\n\t\t\t_forward.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld ).transformDirection( _invMatrixWorld );\r\n\r\n\t\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tif ( drawInfo[ i ].visible && drawInfo[ i ].active ) {\r\n\r\n\t\t\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\r\n\r\n\t\t\t\t\t// get the bounds in world space\r\n\t\t\t\t\tthis.getMatrixAt( i, _matrix$1 );\r\n\t\t\t\t\tthis.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );\r\n\r\n\t\t\t\t\t// determine whether the batched geometry is within the frustum\r\n\t\t\t\t\tlet culled = false;\r\n\t\t\t\t\tif ( perObjectFrustumCulled ) {\r\n\r\n\t\t\t\t\t\tculled = ! _frustum.intersectsSphere( _sphere$2 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( ! culled ) {\r\n\r\n\t\t\t\t\t\t// get the distance from camera used for sorting\r\n\t\t\t\t\t\tconst z = _temp.subVectors( _sphere$2.center, _vector$5 ).dot( _forward );\r\n\t\t\t\t\t\t_renderList.push( drawRanges[ geometryId ], z, i );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Sort the draw ranges and prep for rendering\r\n\t\t\tconst list = _renderList.list;\r\n\t\t\tconst customSort = this.customSort;\r\n\t\t\tif ( customSort === null ) {\r\n\r\n\t\t\t\tlist.sort( material.transparent ? sortTransparent : sortOpaque );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tcustomSort.call( this, list, camera );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( let i = 0, l = list.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tconst item = list[ i ];\r\n\t\t\t\tmultiDrawStarts[ count ] = item.start * bytesPerElement;\r\n\t\t\t\tmultiDrawCounts[ count ] = item.count;\r\n\t\t\t\tindirectArray[ count ] = item.index;\r\n\t\t\t\tcount ++;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_renderList.reset();\r\n\r\n\t\t} else {\r\n\r\n\t\t\tfor ( let i = 0, l = drawInfo.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tif ( drawInfo[ i ].visible && drawInfo[ i ].active ) {\r\n\r\n\t\t\t\t\tconst geometryId = drawInfo[ i ].geometryIndex;\r\n\r\n\t\t\t\t\t// determine whether the batched geometry is within the frustum\r\n\t\t\t\t\tlet culled = false;\r\n\t\t\t\t\tif ( perObjectFrustumCulled ) {\r\n\r\n\t\t\t\t\t\t// get the bounds in world space\r\n\t\t\t\t\t\tthis.getMatrixAt( i, _matrix$1 );\r\n\t\t\t\t\t\tthis.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );\r\n\t\t\t\t\t\tculled = ! _frustum.intersectsSphere( _sphere$2 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( ! culled ) {\r\n\r\n\t\t\t\t\t\tconst range = drawRanges[ geometryId ];\r\n\t\t\t\t\t\tmultiDrawStarts[ count ] = range.start * bytesPerElement;\r\n\t\t\t\t\t\tmultiDrawCounts[ count ] = range.count;\r\n\t\t\t\t\t\tindirectArray[ count ] = i;\r\n\t\t\t\t\t\tcount ++;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tindirectTexture.needsUpdate = true;\r\n\t\tthis._multiDrawCount = count;\r\n\t\tthis._visibilityChanged = false;\r\n\r\n\t}\r\n\r\n\tonBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial/* , group */ ) {\r\n\r\n\t\tthis.onBeforeRender( renderer, null, shadowCamera, geometry, depthMaterial );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass LineBasicMaterial extends Material {\r\n\r\n\tconstructor( parameters ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isLineBasicMaterial = true;\r\n\r\n\t\tthis.type = 'LineBasicMaterial';\r\n\r\n\t\tthis.color = new Color( 0xffffff );\r\n\r\n\t\tthis.map = null;\r\n\r\n\t\tthis.linewidth = 1;\r\n\t\tthis.linecap = 'round';\r\n\t\tthis.linejoin = 'round';\r\n\r\n\t\tthis.fog = true;\r\n\r\n\t\tthis.setValues( parameters );\r\n\r\n\t}\r\n\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.color.copy( source.color );\r\n\r\n\t\tthis.map = source.map;\r\n\r\n\t\tthis.linewidth = source.linewidth;\r\n\t\tthis.linecap = source.linecap;\r\n\t\tthis.linejoin = source.linejoin;\r\n\r\n\t\tthis.fog = source.fog;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _vStart = /*@__PURE__*/ new Vector3();\r\nconst _vEnd = /*@__PURE__*/ new Vector3();\r\n\r\nconst _inverseMatrix$1 = /*@__PURE__*/ new Matrix4();\r\nconst _ray$1 = /*@__PURE__*/ new Ray();\r\nconst _sphere$1 = /*@__PURE__*/ new Sphere();\r\n\r\nconst _intersectPointOnRay = /*@__PURE__*/ new Vector3();\r\nconst _intersectPointOnSegment = /*@__PURE__*/ new Vector3();\r\n\r\nclass Line extends Object3D {\r\n\r\n\tconstructor( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isLine = true;\r\n\r\n\t\tthis.type = 'Line';\r\n\r\n\t\tthis.geometry = geometry;\r\n\t\tthis.material = material;\r\n\r\n\t\tthis.updateMorphTargets();\r\n\r\n\t}\r\n\r\n\tcopy( source, recursive ) {\r\n\r\n\t\tsuper.copy( source, recursive );\r\n\r\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\r\n\t\tthis.geometry = source.geometry;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcomputeLineDistances() {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\r\n\t\t// we assume non-indexed geometry\r\n\r\n\t\tif ( geometry.index === null ) {\r\n\r\n\t\t\tconst positionAttribute = geometry.attributes.position;\r\n\t\t\tconst lineDistances = [ 0 ];\r\n\r\n\t\t\tfor ( let i = 1, l = positionAttribute.count; i < l; i ++ ) {\r\n\r\n\t\t\t\t_vStart.fromBufferAttribute( positionAttribute, i - 1 );\r\n\t\t\t\t_vEnd.fromBufferAttribute( positionAttribute, i );\r\n\r\n\t\t\t\tlineDistances[ i ] = lineDistances[ i - 1 ];\r\n\t\t\t\tlineDistances[ i ] += _vStart.distanceTo( _vEnd );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconsole.warn( 'THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\traycast( raycaster, intersects ) {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tconst matrixWorld = this.matrixWorld;\r\n\t\tconst threshold = raycaster.params.Line.threshold;\r\n\t\tconst drawRange = geometry.drawRange;\r\n\r\n\t\t// Checking boundingSphere distance to ray\r\n\r\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\r\n\r\n\t\t_sphere$1.copy( geometry.boundingSphere );\r\n\t\t_sphere$1.applyMatrix4( matrixWorld );\r\n\t\t_sphere$1.radius += threshold;\r\n\r\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$1 ) === false ) return;\r\n\r\n\t\t//\r\n\r\n\t\t_inverseMatrix$1.copy( matrixWorld ).invert();\r\n\t\t_ray$1.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$1 );\r\n\r\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\r\n\t\tconst localThresholdSq = localThreshold * localThreshold;\r\n\r\n\t\tconst step = this.isLineSegments ? 2 : 1;\r\n\r\n\t\tconst index = geometry.index;\r\n\t\tconst attributes = geometry.attributes;\r\n\t\tconst positionAttribute = attributes.position;\r\n\r\n\t\tif ( index !== null ) {\r\n\r\n\t\t\tconst start = Math.max( 0, drawRange.start );\r\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\r\n\r\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\r\n\r\n\t\t\t\tconst a = index.getX( i );\r\n\t\t\t\tconst b = index.getX( i + 1 );\r\n\r\n\t\t\t\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b );\r\n\r\n\t\t\t\tif ( intersect ) {\r\n\r\n\t\t\t\t\tintersects.push( intersect );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( this.isLineLoop ) {\r\n\r\n\t\t\t\tconst a = index.getX( end - 1 );\r\n\t\t\t\tconst b = index.getX( start );\r\n\r\n\t\t\t\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b );\r\n\r\n\t\t\t\tif ( intersect ) {\r\n\r\n\t\t\t\t\tintersects.push( intersect );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst start = Math.max( 0, drawRange.start );\r\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\r\n\r\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\r\n\r\n\t\t\t\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, i, i + 1 );\r\n\r\n\t\t\t\tif ( intersect ) {\r\n\r\n\t\t\t\t\tintersects.push( intersect );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( this.isLineLoop ) {\r\n\r\n\t\t\t\tconst intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, end - 1, start );\r\n\r\n\t\t\t\tif ( intersect ) {\r\n\r\n\t\t\t\t\tintersects.push( intersect );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMorphTargets() {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\r\n\t\tconst morphAttributes = geometry.morphAttributes;\r\n\t\tconst keys = Object.keys( morphAttributes );\r\n\r\n\t\tif ( keys.length > 0 ) {\r\n\r\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\r\n\r\n\t\t\tif ( morphAttribute !== undefined ) {\r\n\r\n\t\t\t\tthis.morphTargetInfluences = [];\r\n\t\t\t\tthis.morphTargetDictionary = {};\r\n\r\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\r\n\r\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\r\n\r\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\r\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {\r\n\r\n\tconst positionAttribute = object.geometry.attributes.position;\r\n\r\n\t_vStart.fromBufferAttribute( positionAttribute, a );\r\n\t_vEnd.fromBufferAttribute( positionAttribute, b );\r\n\r\n\tconst distSq = ray.distanceSqToSegment( _vStart, _vEnd, _intersectPointOnRay, _intersectPointOnSegment );\r\n\r\n\tif ( distSq > thresholdSq ) return;\r\n\r\n\t_intersectPointOnRay.applyMatrix4( object.matrixWorld ); // Move back to world space for distance calculation\r\n\r\n\tconst distance = raycaster.ray.origin.distanceTo( _intersectPointOnRay );\r\n\r\n\tif ( distance < raycaster.near || distance > raycaster.far ) return;\r\n\r\n\treturn {\r\n\r\n\t\tdistance: distance,\r\n\t\t// What do we want? intersection point on the ray or on the segment??\r\n\t\t// point: raycaster.ray.at( distance ),\r\n\t\tpoint: _intersectPointOnSegment.clone().applyMatrix4( object.matrixWorld ),\r\n\t\tindex: a,\r\n\t\tface: null,\r\n\t\tfaceIndex: null,\r\n\t\tobject: object\r\n\r\n\t};\r\n\r\n}\r\n\r\nconst _start = /*@__PURE__*/ new Vector3();\r\nconst _end = /*@__PURE__*/ new Vector3();\r\n\r\nclass LineSegments extends Line {\r\n\r\n\tconstructor( geometry, material ) {\r\n\r\n\t\tsuper( geometry, material );\r\n\r\n\t\tthis.isLineSegments = true;\r\n\r\n\t\tthis.type = 'LineSegments';\r\n\r\n\t}\r\n\r\n\tcomputeLineDistances() {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\r\n\t\t// we assume non-indexed geometry\r\n\r\n\t\tif ( geometry.index === null ) {\r\n\r\n\t\t\tconst positionAttribute = geometry.attributes.position;\r\n\t\t\tconst lineDistances = [];\r\n\r\n\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i += 2 ) {\r\n\r\n\t\t\t\t_start.fromBufferAttribute( positionAttribute, i );\r\n\t\t\t\t_end.fromBufferAttribute( positionAttribute, i + 1 );\r\n\r\n\t\t\t\tlineDistances[ i ] = ( i === 0 ) ? 0 : lineDistances[ i - 1 ];\r\n\t\t\t\tlineDistances[ i + 1 ] = lineDistances[ i ] + _start.distanceTo( _end );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconsole.warn( 'THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass LineLoop extends Line {\r\n\r\n\tconstructor( geometry, material ) {\r\n\r\n\t\tsuper( geometry, material );\r\n\r\n\t\tthis.isLineLoop = true;\r\n\r\n\t\tthis.type = 'LineLoop';\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass PointsMaterial extends Material {\r\n\r\n\tconstructor( parameters ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isPointsMaterial = true;\r\n\r\n\t\tthis.type = 'PointsMaterial';\r\n\r\n\t\tthis.color = new Color( 0xffffff );\r\n\r\n\t\tthis.map = null;\r\n\r\n\t\tthis.alphaMap = null;\r\n\r\n\t\tthis.size = 1;\r\n\t\tthis.sizeAttenuation = true;\r\n\r\n\t\tthis.fog = true;\r\n\r\n\t\tthis.setValues( parameters );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.color.copy( source.color );\r\n\r\n\t\tthis.map = source.map;\r\n\r\n\t\tthis.alphaMap = source.alphaMap;\r\n\r\n\t\tthis.size = source.size;\r\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\r\n\r\n\t\tthis.fog = source.fog;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _inverseMatrix = /*@__PURE__*/ new Matrix4();\r\nconst _ray = /*@__PURE__*/ new Ray();\r\nconst _sphere = /*@__PURE__*/ new Sphere();\r\nconst _position$2 = /*@__PURE__*/ new Vector3();\r\n\r\nclass Points extends Object3D {\r\n\r\n\tconstructor( geometry = new BufferGeometry(), material = new PointsMaterial() ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isPoints = true;\r\n\r\n\t\tthis.type = 'Points';\r\n\r\n\t\tthis.geometry = geometry;\r\n\t\tthis.material = material;\r\n\r\n\t\tthis.updateMorphTargets();\r\n\r\n\t}\r\n\r\n\tcopy( source, recursive ) {\r\n\r\n\t\tsuper.copy( source, recursive );\r\n\r\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\r\n\t\tthis.geometry = source.geometry;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\traycast( raycaster, intersects ) {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tconst matrixWorld = this.matrixWorld;\r\n\t\tconst threshold = raycaster.params.Points.threshold;\r\n\t\tconst drawRange = geometry.drawRange;\r\n\r\n\t\t// Checking boundingSphere distance to ray\r\n\r\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\r\n\r\n\t\t_sphere.copy( geometry.boundingSphere );\r\n\t\t_sphere.applyMatrix4( matrixWorld );\r\n\t\t_sphere.radius += threshold;\r\n\r\n\t\tif ( raycaster.ray.intersectsSphere( _sphere ) === false ) return;\r\n\r\n\t\t//\r\n\r\n\t\t_inverseMatrix.copy( matrixWorld ).invert();\r\n\t\t_ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix );\r\n\r\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\r\n\t\tconst localThresholdSq = localThreshold * localThreshold;\r\n\r\n\t\tconst index = geometry.index;\r\n\t\tconst attributes = geometry.attributes;\r\n\t\tconst positionAttribute = attributes.position;\r\n\r\n\t\tif ( index !== null ) {\r\n\r\n\t\t\tconst start = Math.max( 0, drawRange.start );\r\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\r\n\r\n\t\t\tfor ( let i = start, il = end; i < il; i ++ ) {\r\n\r\n\t\t\t\tconst a = index.getX( i );\r\n\r\n\t\t\t\t_position$2.fromBufferAttribute( positionAttribute, a );\r\n\r\n\t\t\t\ttestPoint( _position$2, a, localThresholdSq, matrixWorld, raycaster, intersects, this );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst start = Math.max( 0, drawRange.start );\r\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\r\n\r\n\t\t\tfor ( let i = start, l = end; i < l; i ++ ) {\r\n\r\n\t\t\t\t_position$2.fromBufferAttribute( positionAttribute, i );\r\n\r\n\t\t\t\ttestPoint( _position$2, i, localThresholdSq, matrixWorld, raycaster, intersects, this );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tupdateMorphTargets() {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\r\n\t\tconst morphAttributes = geometry.morphAttributes;\r\n\t\tconst keys = Object.keys( morphAttributes );\r\n\r\n\t\tif ( keys.length > 0 ) {\r\n\r\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\r\n\r\n\t\t\tif ( morphAttribute !== undefined ) {\r\n\r\n\t\t\t\tthis.morphTargetInfluences = [];\r\n\t\t\t\tthis.morphTargetDictionary = {};\r\n\r\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\r\n\r\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\r\n\r\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\r\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction testPoint( point, index, localThresholdSq, matrixWorld, raycaster, intersects, object ) {\r\n\r\n\tconst rayPointDistanceSq = _ray.distanceSqToPoint( point );\r\n\r\n\tif ( rayPointDistanceSq < localThresholdSq ) {\r\n\r\n\t\tconst intersectPoint = new Vector3();\r\n\r\n\t\t_ray.closestPointToPoint( point, intersectPoint );\r\n\t\tintersectPoint.applyMatrix4( matrixWorld );\r\n\r\n\t\tconst distance = raycaster.ray.origin.distanceTo( intersectPoint );\r\n\r\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\r\n\r\n\t\tintersects.push( {\r\n\r\n\t\t\tdistance: distance,\r\n\t\t\tdistanceToRay: Math.sqrt( rayPointDistanceSq ),\r\n\t\t\tpoint: intersectPoint,\r\n\t\t\tindex: index,\r\n\t\t\tface: null,\r\n\t\t\tobject: object\r\n\r\n\t\t} );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass VideoTexture extends Texture {\r\n\r\n\tconstructor( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\r\n\r\n\t\tsuper( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\r\n\r\n\t\tthis.isVideoTexture = true;\r\n\r\n\t\tthis.minFilter = minFilter !== undefined ? minFilter : LinearFilter;\r\n\t\tthis.magFilter = magFilter !== undefined ? magFilter : LinearFilter;\r\n\r\n\t\tthis.generateMipmaps = false;\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\tfunction updateVideo() {\r\n\r\n\t\t\tscope.needsUpdate = true;\r\n\t\t\tvideo.requestVideoFrameCallback( updateVideo );\r\n\r\n\t\t}\r\n\r\n\t\tif ( 'requestVideoFrameCallback' in video ) {\r\n\r\n\t\t\tvideo.requestVideoFrameCallback( updateVideo );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor( this.image ).copy( this );\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst video = this.image;\r\n\t\tconst hasVideoFrameCallback = 'requestVideoFrameCallback' in video;\r\n\r\n\t\tif ( hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA ) {\r\n\r\n\t\t\tthis.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass FramebufferTexture extends Texture {\r\n\r\n\tconstructor( width, height ) {\r\n\r\n\t\tsuper( { width, height } );\r\n\r\n\t\tthis.isFramebufferTexture = true;\r\n\r\n\t\tthis.magFilter = NearestFilter;\r\n\t\tthis.minFilter = NearestFilter;\r\n\r\n\t\tthis.generateMipmaps = false;\r\n\r\n\t\tthis.needsUpdate = true;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass CompressedTexture extends Texture {\r\n\r\n\tconstructor( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, colorSpace ) {\r\n\r\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\r\n\r\n\t\tthis.isCompressedTexture = true;\r\n\r\n\t\tthis.image = { width: width, height: height };\r\n\t\tthis.mipmaps = mipmaps;\r\n\r\n\t\t// no flipping for cube textures\r\n\t\t// (also flipping doesn't work for compressed textures )\r\n\r\n\t\tthis.flipY = false;\r\n\r\n\t\t// can't generate mipmaps for compressed textures\r\n\t\t// mips must be embedded in DDS files\r\n\r\n\t\tthis.generateMipmaps = false;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass CompressedArrayTexture extends CompressedTexture {\r\n\r\n\tconstructor( mipmaps, width, height, depth, format, type ) {\r\n\r\n\t\tsuper( mipmaps, width, height, format, type );\r\n\r\n\t\tthis.isCompressedArrayTexture = true;\r\n\t\tthis.image.depth = depth;\r\n\t\tthis.wrapR = ClampToEdgeWrapping;\r\n\r\n\t\tthis.layerUpdates = new Set();\r\n\r\n\t}\r\n\r\n\taddLayerUpdate( layerIndex ) {\r\n\r\n\t\tthis.layerUpdates.add( layerIndex );\r\n\r\n\t}\r\n\r\n\tclearLayerUpdates() {\r\n\r\n\t\tthis.layerUpdates.clear();\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass CompressedCubeTexture extends CompressedTexture {\r\n\r\n\tconstructor( images, format, type ) {\r\n\r\n\t\tsuper( undefined, images[ 0 ].width, images[ 0 ].height, format, type, CubeReflectionMapping );\r\n\r\n\t\tthis.isCompressedCubeTexture = true;\r\n\t\tthis.isCubeTexture = true;\r\n\r\n\t\tthis.image = images;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass CanvasTexture extends Texture {\r\n\r\n\tconstructor( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\r\n\r\n\t\tsuper( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\r\n\r\n\t\tthis.isCanvasTexture = true;\r\n\r\n\t\tthis.needsUpdate = true;\r\n\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Extensible curve object.\r\n *\r\n * Some common of curve methods:\r\n * .getPoint( t, optionalTarget ), .getTangent( t, optionalTarget )\r\n * .getPointAt( u, optionalTarget ), .getTangentAt( u, optionalTarget )\r\n * .getPoints(), .getSpacedPoints()\r\n * .getLength()\r\n * .updateArcLengths()\r\n *\r\n * This following curves inherit from THREE.Curve:\r\n *\r\n * -- 2D curves --\r\n * THREE.ArcCurve\r\n * THREE.CubicBezierCurve\r\n * THREE.EllipseCurve\r\n * THREE.LineCurve\r\n * THREE.QuadraticBezierCurve\r\n * THREE.SplineCurve\r\n *\r\n * -- 3D curves --\r\n * THREE.CatmullRomCurve3\r\n * THREE.CubicBezierCurve3\r\n * THREE.LineCurve3\r\n * THREE.QuadraticBezierCurve3\r\n *\r\n * A series of curves can be represented as a THREE.CurvePath.\r\n *\r\n **/\r\n\r\nclass Curve {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.type = 'Curve';\r\n\r\n\t\tthis.arcLengthDivisions = 200;\r\n\r\n\t}\r\n\r\n\t// Virtual base class method to overwrite and implement in subclasses\r\n\t//\t- t [0 .. 1]\r\n\r\n\tgetPoint( /* t, optionalTarget */ ) {\r\n\r\n\t\tconsole.warn( 'THREE.Curve: .getPoint() not implemented.' );\r\n\t\treturn null;\r\n\r\n\t}\r\n\r\n\t// Get point at relative position in curve according to arc length\r\n\t// - u [0 .. 1]\r\n\r\n\tgetPointAt( u, optionalTarget ) {\r\n\r\n\t\tconst t = this.getUtoTmapping( u );\r\n\t\treturn this.getPoint( t, optionalTarget );\r\n\r\n\t}\r\n\r\n\t// Get sequence of points using getPoint( t )\r\n\r\n\tgetPoints( divisions = 5 ) {\r\n\r\n\t\tconst points = [];\r\n\r\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\r\n\r\n\t\t\tpoints.push( this.getPoint( d / divisions ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn points;\r\n\r\n\t}\r\n\r\n\t// Get sequence of points using getPointAt( u )\r\n\r\n\tgetSpacedPoints( divisions = 5 ) {\r\n\r\n\t\tconst points = [];\r\n\r\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\r\n\r\n\t\t\tpoints.push( this.getPointAt( d / divisions ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn points;\r\n\r\n\t}\r\n\r\n\t// Get total curve arc length\r\n\r\n\tgetLength() {\r\n\r\n\t\tconst lengths = this.getLengths();\r\n\t\treturn lengths[ lengths.length - 1 ];\r\n\r\n\t}\r\n\r\n\t// Get list of cumulative segment lengths\r\n\r\n\tgetLengths( divisions = this.arcLengthDivisions ) {\r\n\r\n\t\tif ( this.cacheArcLengths &&\r\n\t\t\t( this.cacheArcLengths.length === divisions + 1 ) &&\r\n\t\t\t! this.needsUpdate ) {\r\n\r\n\t\t\treturn this.cacheArcLengths;\r\n\r\n\t\t}\r\n\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t\tconst cache = [];\r\n\t\tlet current, last = this.getPoint( 0 );\r\n\t\tlet sum = 0;\r\n\r\n\t\tcache.push( 0 );\r\n\r\n\t\tfor ( let p = 1; p <= divisions; p ++ ) {\r\n\r\n\t\t\tcurrent = this.getPoint( p / divisions );\r\n\t\t\tsum += current.distanceTo( last );\r\n\t\t\tcache.push( sum );\r\n\t\t\tlast = current;\r\n\r\n\t\t}\r\n\r\n\t\tthis.cacheArcLengths = cache;\r\n\r\n\t\treturn cache; // { sums: cache, sum: sum }; Sum is in the last element.\r\n\r\n\t}\r\n\r\n\tupdateArcLengths() {\r\n\r\n\t\tthis.needsUpdate = true;\r\n\t\tthis.getLengths();\r\n\r\n\t}\r\n\r\n\t// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant\r\n\r\n\tgetUtoTmapping( u, distance ) {\r\n\r\n\t\tconst arcLengths = this.getLengths();\r\n\r\n\t\tlet i = 0;\r\n\t\tconst il = arcLengths.length;\r\n\r\n\t\tlet targetArcLength; // The targeted u distance value to get\r\n\r\n\t\tif ( distance ) {\r\n\r\n\t\t\ttargetArcLength = distance;\r\n\r\n\t\t} else {\r\n\r\n\t\t\ttargetArcLength = u * arcLengths[ il - 1 ];\r\n\r\n\t\t}\r\n\r\n\t\t// binary search for the index with largest value smaller than target u distance\r\n\r\n\t\tlet low = 0, high = il - 1, comparison;\r\n\r\n\t\twhile ( low <= high ) {\r\n\r\n\t\t\ti = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats\r\n\r\n\t\t\tcomparison = arcLengths[ i ] - targetArcLength;\r\n\r\n\t\t\tif ( comparison < 0 ) {\r\n\r\n\t\t\t\tlow = i + 1;\r\n\r\n\t\t\t} else if ( comparison > 0 ) {\r\n\r\n\t\t\t\thigh = i - 1;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\thigh = i;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t\t// DONE\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\ti = high;\r\n\r\n\t\tif ( arcLengths[ i ] === targetArcLength ) {\r\n\r\n\t\t\treturn i / ( il - 1 );\r\n\r\n\t\t}\r\n\r\n\t\t// we could get finer grain at lengths, or use simple interpolation between two points\r\n\r\n\t\tconst lengthBefore = arcLengths[ i ];\r\n\t\tconst lengthAfter = arcLengths[ i + 1 ];\r\n\r\n\t\tconst segmentLength = lengthAfter - lengthBefore;\r\n\r\n\t\t// determine where we are between the 'before' and 'after' points\r\n\r\n\t\tconst segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength;\r\n\r\n\t\t// add that fractional amount to t\r\n\r\n\t\tconst t = ( i + segmentFraction ) / ( il - 1 );\r\n\r\n\t\treturn t;\r\n\r\n\t}\r\n\r\n\t// Returns a unit vector tangent at t\r\n\t// In case any sub curve does not implement its tangent derivation,\r\n\t// 2 points a small delta apart will be used to find its gradient\r\n\t// which seems to give a reasonable approximation\r\n\r\n\tgetTangent( t, optionalTarget ) {\r\n\r\n\t\tconst delta = 0.0001;\r\n\t\tlet t1 = t - delta;\r\n\t\tlet t2 = t + delta;\r\n\r\n\t\t// Capping in case of danger\r\n\r\n\t\tif ( t1 < 0 ) t1 = 0;\r\n\t\tif ( t2 > 1 ) t2 = 1;\r\n\r\n\t\tconst pt1 = this.getPoint( t1 );\r\n\t\tconst pt2 = this.getPoint( t2 );\r\n\r\n\t\tconst tangent = optionalTarget || ( ( pt1.isVector2 ) ? new Vector2() : new Vector3() );\r\n\r\n\t\ttangent.copy( pt2 ).sub( pt1 ).normalize();\r\n\r\n\t\treturn tangent;\r\n\r\n\t}\r\n\r\n\tgetTangentAt( u, optionalTarget ) {\r\n\r\n\t\tconst t = this.getUtoTmapping( u );\r\n\t\treturn this.getTangent( t, optionalTarget );\r\n\r\n\t}\r\n\r\n\tcomputeFrenetFrames( segments, closed ) {\r\n\r\n\t\t// see http://www.cs.indiana.edu/pub/techreports/TR425.pdf\r\n\r\n\t\tconst normal = new Vector3();\r\n\r\n\t\tconst tangents = [];\r\n\t\tconst normals = [];\r\n\t\tconst binormals = [];\r\n\r\n\t\tconst vec = new Vector3();\r\n\t\tconst mat = new Matrix4();\r\n\r\n\t\t// compute the tangent vectors for each segment on the curve\r\n\r\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\r\n\r\n\t\t\tconst u = i / segments;\r\n\r\n\t\t\ttangents[ i ] = this.getTangentAt( u, new Vector3() );\r\n\r\n\t\t}\r\n\r\n\t\t// select an initial normal vector perpendicular to the first tangent vector,\r\n\t\t// and in the direction of the minimum tangent xyz component\r\n\r\n\t\tnormals[ 0 ] = new Vector3();\r\n\t\tbinormals[ 0 ] = new Vector3();\r\n\t\tlet min = Number.MAX_VALUE;\r\n\t\tconst tx = Math.abs( tangents[ 0 ].x );\r\n\t\tconst ty = Math.abs( tangents[ 0 ].y );\r\n\t\tconst tz = Math.abs( tangents[ 0 ].z );\r\n\r\n\t\tif ( tx <= min ) {\r\n\r\n\t\t\tmin = tx;\r\n\t\t\tnormal.set( 1, 0, 0 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( ty <= min ) {\r\n\r\n\t\t\tmin = ty;\r\n\t\t\tnormal.set( 0, 1, 0 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( tz <= min ) {\r\n\r\n\t\t\tnormal.set( 0, 0, 1 );\r\n\r\n\t\t}\r\n\r\n\t\tvec.crossVectors( tangents[ 0 ], normal ).normalize();\r\n\r\n\t\tnormals[ 0 ].crossVectors( tangents[ 0 ], vec );\r\n\t\tbinormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] );\r\n\r\n\r\n\t\t// compute the slowly-varying normal and binormal vectors for each segment on the curve\r\n\r\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\r\n\r\n\t\t\tnormals[ i ] = normals[ i - 1 ].clone();\r\n\r\n\t\t\tbinormals[ i ] = binormals[ i - 1 ].clone();\r\n\r\n\t\t\tvec.crossVectors( tangents[ i - 1 ], tangents[ i ] );\r\n\r\n\t\t\tif ( vec.length() > Number.EPSILON ) {\r\n\r\n\t\t\t\tvec.normalize();\r\n\r\n\t\t\t\tconst theta = Math.acos( clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors\r\n\r\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\r\n\r\n\t\t}\r\n\r\n\t\t// if the curve is closed, postprocess the vectors so the first and last normal vectors are the same\r\n\r\n\t\tif ( closed === true ) {\r\n\r\n\t\t\tlet theta = Math.acos( clamp( normals[ 0 ].dot( normals[ segments ] ), - 1, 1 ) );\r\n\t\t\ttheta /= segments;\r\n\r\n\t\t\tif ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ segments ] ) ) > 0 ) {\r\n\r\n\t\t\t\ttheta = - theta;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( let i = 1; i <= segments; i ++ ) {\r\n\r\n\t\t\t\t// twist a little...\r\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) );\r\n\t\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\ttangents: tangents,\r\n\t\t\tnormals: normals,\r\n\t\t\tbinormals: binormals\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.arcLengthDivisions = source.arcLengthDivisions;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = {\r\n\t\t\tmetadata: {\r\n\t\t\t\tversion: 4.6,\r\n\t\t\t\ttype: 'Curve',\r\n\t\t\t\tgenerator: 'Curve.toJSON'\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tdata.arcLengthDivisions = this.arcLengthDivisions;\r\n\t\tdata.type = this.type;\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n\tfromJSON( json ) {\r\n\r\n\t\tthis.arcLengthDivisions = json.arcLengthDivisions;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass EllipseCurve extends Curve {\r\n\r\n\tconstructor( aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0 ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isEllipseCurve = true;\r\n\r\n\t\tthis.type = 'EllipseCurve';\r\n\r\n\t\tthis.aX = aX;\r\n\t\tthis.aY = aY;\r\n\r\n\t\tthis.xRadius = xRadius;\r\n\t\tthis.yRadius = yRadius;\r\n\r\n\t\tthis.aStartAngle = aStartAngle;\r\n\t\tthis.aEndAngle = aEndAngle;\r\n\r\n\t\tthis.aClockwise = aClockwise;\r\n\r\n\t\tthis.aRotation = aRotation;\r\n\r\n\t}\r\n\r\n\tgetPoint( t, optionalTarget = new Vector2() ) {\r\n\r\n\t\tconst point = optionalTarget;\r\n\r\n\t\tconst twoPi = Math.PI * 2;\r\n\t\tlet deltaAngle = this.aEndAngle - this.aStartAngle;\r\n\t\tconst samePoints = Math.abs( deltaAngle ) < Number.EPSILON;\r\n\r\n\t\t// ensures that deltaAngle is 0 .. 2 PI\r\n\t\twhile ( deltaAngle < 0 ) deltaAngle += twoPi;\r\n\t\twhile ( deltaAngle > twoPi ) deltaAngle -= twoPi;\r\n\r\n\t\tif ( deltaAngle < Number.EPSILON ) {\r\n\r\n\t\t\tif ( samePoints ) {\r\n\r\n\t\t\t\tdeltaAngle = 0;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tdeltaAngle = twoPi;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.aClockwise === true && ! samePoints ) {\r\n\r\n\t\t\tif ( deltaAngle === twoPi ) {\r\n\r\n\t\t\t\tdeltaAngle = - twoPi;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tdeltaAngle = deltaAngle - twoPi;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconst angle = this.aStartAngle + t * deltaAngle;\r\n\t\tlet x = this.aX + this.xRadius * Math.cos( angle );\r\n\t\tlet y = this.aY + this.yRadius * Math.sin( angle );\r\n\r\n\t\tif ( this.aRotation !== 0 ) {\r\n\r\n\t\t\tconst cos = Math.cos( this.aRotation );\r\n\t\t\tconst sin = Math.sin( this.aRotation );\r\n\r\n\t\t\tconst tx = x - this.aX;\r\n\t\t\tconst ty = y - this.aY;\r\n\r\n\t\t\t// Rotate the point about the center of the ellipse.\r\n\t\t\tx = tx * cos - ty * sin + this.aX;\r\n\t\t\ty = tx * sin + ty * cos + this.aY;\r\n\r\n\t\t}\r\n\r\n\t\treturn point.set( x, y );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.aX = source.aX;\r\n\t\tthis.aY = source.aY;\r\n\r\n\t\tthis.xRadius = source.xRadius;\r\n\t\tthis.yRadius = source.yRadius;\r\n\r\n\t\tthis.aStartAngle = source.aStartAngle;\r\n\t\tthis.aEndAngle = source.aEndAngle;\r\n\r\n\t\tthis.aClockwise = source.aClockwise;\r\n\r\n\t\tthis.aRotation = source.aRotation;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = super.toJSON();\r\n\r\n\t\tdata.aX = this.aX;\r\n\t\tdata.aY = this.aY;\r\n\r\n\t\tdata.xRadius = this.xRadius;\r\n\t\tdata.yRadius = this.yRadius;\r\n\r\n\t\tdata.aStartAngle = this.aStartAngle;\r\n\t\tdata.aEndAngle = this.aEndAngle;\r\n\r\n\t\tdata.aClockwise = this.aClockwise;\r\n\r\n\t\tdata.aRotation = this.aRotation;\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n\tfromJSON( json ) {\r\n\r\n\t\tsuper.fromJSON( json );\r\n\r\n\t\tthis.aX = json.aX;\r\n\t\tthis.aY = json.aY;\r\n\r\n\t\tthis.xRadius = json.xRadius;\r\n\t\tthis.yRadius = json.yRadius;\r\n\r\n\t\tthis.aStartAngle = json.aStartAngle;\r\n\t\tthis.aEndAngle = json.aEndAngle;\r\n\r\n\t\tthis.aClockwise = json.aClockwise;\r\n\r\n\t\tthis.aRotation = json.aRotation;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass ArcCurve extends EllipseCurve {\r\n\r\n\tconstructor( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\r\n\r\n\t\tsuper( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\r\n\r\n\t\tthis.isArcCurve = true;\r\n\r\n\t\tthis.type = 'ArcCurve';\r\n\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Centripetal CatmullRom Curve - which is useful for avoiding\r\n * cusps and self-intersections in non-uniform catmull rom curves.\r\n * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf\r\n *\r\n * curve.type accepts centripetal(default), chordal and catmullrom\r\n * curve.tension is used for catmullrom which defaults to 0.5\r\n */\r\n\r\n\r\n/*\r\nBased on an optimized c++ solution in\r\n - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/\r\n - http://ideone.com/NoEbVM\r\n\r\nThis CubicPoly class could be used for reusing some variables and calculations,\r\nbut for three.js curve use, it could be possible inlined and flatten into a single function call\r\nwhich can be placed in CurveUtils.\r\n*/\r\n\r\nfunction CubicPoly() {\r\n\r\n\tlet c0 = 0, c1 = 0, c2 = 0, c3 = 0;\r\n\r\n\t/*\r\n\t * Compute coefficients for a cubic polynomial\r\n\t * p(s) = c0 + c1*s + c2*s^2 + c3*s^3\r\n\t * such that\r\n\t * p(0) = x0, p(1) = x1\r\n\t * and\r\n\t * p'(0) = t0, p'(1) = t1.\r\n\t */\r\n\tfunction init( x0, x1, t0, t1 ) {\r\n\r\n\t\tc0 = x0;\r\n\t\tc1 = t0;\r\n\t\tc2 = - 3 * x0 + 3 * x1 - 2 * t0 - t1;\r\n\t\tc3 = 2 * x0 - 2 * x1 + t0 + t1;\r\n\r\n\t}\r\n\r\n\treturn {\r\n\r\n\t\tinitCatmullRom: function ( x0, x1, x2, x3, tension ) {\r\n\r\n\t\t\tinit( x1, x2, tension * ( x2 - x0 ), tension * ( x3 - x1 ) );\r\n\r\n\t\t},\r\n\r\n\t\tinitNonuniformCatmullRom: function ( x0, x1, x2, x3, dt0, dt1, dt2 ) {\r\n\r\n\t\t\t// compute tangents when parameterized in [t1,t2]\r\n\t\t\tlet t1 = ( x1 - x0 ) / dt0 - ( x2 - x0 ) / ( dt0 + dt1 ) + ( x2 - x1 ) / dt1;\r\n\t\t\tlet t2 = ( x2 - x1 ) / dt1 - ( x3 - x1 ) / ( dt1 + dt2 ) + ( x3 - x2 ) / dt2;\r\n\r\n\t\t\t// rescale tangents for parametrization in [0,1]\r\n\t\t\tt1 *= dt1;\r\n\t\t\tt2 *= dt1;\r\n\r\n\t\t\tinit( x1, x2, t1, t2 );\r\n\r\n\t\t},\r\n\r\n\t\tcalc: function ( t ) {\r\n\r\n\t\t\tconst t2 = t * t;\r\n\t\t\tconst t3 = t2 * t;\r\n\t\t\treturn c0 + c1 * t + c2 * t2 + c3 * t3;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n}\r\n\r\n//\r\n\r\nconst tmp = /*@__PURE__*/ new Vector3();\r\nconst px = /*@__PURE__*/ new CubicPoly();\r\nconst py = /*@__PURE__*/ new CubicPoly();\r\nconst pz = /*@__PURE__*/ new CubicPoly();\r\n\r\nclass CatmullRomCurve3 extends Curve {\r\n\r\n\tconstructor( points = [], closed = false, curveType = 'centripetal', tension = 0.5 ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isCatmullRomCurve3 = true;\r\n\r\n\t\tthis.type = 'CatmullRomCurve3';\r\n\r\n\t\tthis.points = points;\r\n\t\tthis.closed = closed;\r\n\t\tthis.curveType = curveType;\r\n\t\tthis.tension = tension;\r\n\r\n\t}\r\n\r\n\tgetPoint( t, optionalTarget = new Vector3() ) {\r\n\r\n\t\tconst point = optionalTarget;\r\n\r\n\t\tconst points = this.points;\r\n\t\tconst l = points.length;\r\n\r\n\t\tconst p = ( l - ( this.closed ? 0 : 1 ) ) * t;\r\n\t\tlet intPoint = Math.floor( p );\r\n\t\tlet weight = p - intPoint;\r\n\r\n\t\tif ( this.closed ) {\r\n\r\n\t\t\tintPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / l ) + 1 ) * l;\r\n\r\n\t\t} else if ( weight === 0 && intPoint === l - 1 ) {\r\n\r\n\t\t\tintPoint = l - 2;\r\n\t\t\tweight = 1;\r\n\r\n\t\t}\r\n\r\n\t\tlet p0, p3; // 4 points (p1 & p2 defined below)\r\n\r\n\t\tif ( this.closed || intPoint > 0 ) {\r\n\r\n\t\t\tp0 = points[ ( intPoint - 1 ) % l ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// extrapolate first point\r\n\t\t\ttmp.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] );\r\n\t\t\tp0 = tmp;\r\n\r\n\t\t}\r\n\r\n\t\tconst p1 = points[ intPoint % l ];\r\n\t\tconst p2 = points[ ( intPoint + 1 ) % l ];\r\n\r\n\t\tif ( this.closed || intPoint + 2 < l ) {\r\n\r\n\t\t\tp3 = points[ ( intPoint + 2 ) % l ];\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// extrapolate last point\r\n\t\t\ttmp.subVectors( points[ l - 1 ], points[ l - 2 ] ).add( points[ l - 1 ] );\r\n\t\t\tp3 = tmp;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.curveType === 'centripetal' || this.curveType === 'chordal' ) {\r\n\r\n\t\t\t// init Centripetal / Chordal Catmull-Rom\r\n\t\t\tconst pow = this.curveType === 'chordal' ? 0.5 : 0.25;\r\n\t\t\tlet dt0 = Math.pow( p0.distanceToSquared( p1 ), pow );\r\n\t\t\tlet dt1 = Math.pow( p1.distanceToSquared( p2 ), pow );\r\n\t\t\tlet dt2 = Math.pow( p2.distanceToSquared( p3 ), pow );\r\n\r\n\t\t\t// safety check for repeated points\r\n\t\t\tif ( dt1 < 1e-4 ) dt1 = 1.0;\r\n\t\t\tif ( dt0 < 1e-4 ) dt0 = dt1;\r\n\t\t\tif ( dt2 < 1e-4 ) dt2 = dt1;\r\n\r\n\t\t\tpx.initNonuniformCatmullRom( p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2 );\r\n\t\t\tpy.initNonuniformCatmullRom( p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2 );\r\n\t\t\tpz.initNonuniformCatmullRom( p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2 );\r\n\r\n\t\t} else if ( this.curveType === 'catmullrom' ) {\r\n\r\n\t\t\tpx.initCatmullRom( p0.x, p1.x, p2.x, p3.x, this.tension );\r\n\t\t\tpy.initCatmullRom( p0.y, p1.y, p2.y, p3.y, this.tension );\r\n\t\t\tpz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, this.tension );\r\n\r\n\t\t}\r\n\r\n\t\tpoint.set(\r\n\t\t\tpx.calc( weight ),\r\n\t\t\tpy.calc( weight ),\r\n\t\t\tpz.calc( weight )\r\n\t\t);\r\n\r\n\t\treturn point;\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.points = [];\r\n\r\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst point = source.points[ i ];\r\n\r\n\t\t\tthis.points.push( point.clone() );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closed = source.closed;\r\n\t\tthis.curveType = source.curveType;\r\n\t\tthis.tension = source.tension;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = super.toJSON();\r\n\r\n\t\tdata.points = [];\r\n\r\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst point = this.points[ i ];\r\n\t\t\tdata.points.push( point.toArray() );\r\n\r\n\t\t}\r\n\r\n\t\tdata.closed = this.closed;\r\n\t\tdata.curveType = this.curveType;\r\n\t\tdata.tension = this.tension;\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n\tfromJSON( json ) {\r\n\r\n\t\tsuper.fromJSON( json );\r\n\r\n\t\tthis.points = [];\r\n\r\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst point = json.points[ i ];\r\n\t\t\tthis.points.push( new Vector3().fromArray( point ) );\r\n\r\n\t\t}\r\n\r\n\t\tthis.closed = json.closed;\r\n\t\tthis.curveType = json.curveType;\r\n\t\tthis.tension = json.tension;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Bezier Curves formulas obtained from\r\n * https://en.wikipedia.org/wiki/B%C3%A9zier_curve\r\n */\r\n\r\nfunction CatmullRom( t, p0, p1, p2, p3 ) {\r\n\r\n\tconst v0 = ( p2 - p0 ) * 0.5;\r\n\tconst v1 = ( p3 - p1 ) * 0.5;\r\n\tconst t2 = t * t;\r\n\tconst t3 = t * t2;\r\n\treturn ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;\r\n\r\n}\r\n\r\n//\r\n\r\nfunction QuadraticBezierP0( t, p ) {\r\n\r\n\tconst k = 1 - t;\r\n\treturn k * k * p;\r\n\r\n}\r\n\r\nfunction QuadraticBezierP1( t, p ) {\r\n\r\n\treturn 2 * ( 1 - t ) * t * p;\r\n\r\n}\r\n\r\nfunction QuadraticBezierP2( t, p ) {\r\n\r\n\treturn t * t * p;\r\n\r\n}\r\n\r\nfunction QuadraticBezier( t, p0, p1, p2 ) {\r\n\r\n\treturn QuadraticBezierP0( t, p0 ) + QuadraticBezierP1( t, p1 ) +\r\n\t\tQuadraticBezierP2( t, p2 );\r\n\r\n}\r\n\r\n//\r\n\r\nfunction CubicBezierP0( t, p ) {\r\n\r\n\tconst k = 1 - t;\r\n\treturn k * k * k * p;\r\n\r\n}\r\n\r\nfunction CubicBezierP1( t, p ) {\r\n\r\n\tconst k = 1 - t;\r\n\treturn 3 * k * k * t * p;\r\n\r\n}\r\n\r\nfunction CubicBezierP2( t, p ) {\r\n\r\n\treturn 3 * ( 1 - t ) * t * t * p;\r\n\r\n}\r\n\r\nfunction CubicBezierP3( t, p ) {\r\n\r\n\treturn t * t * t * p;\r\n\r\n}\r\n\r\nfunction CubicBezier( t, p0, p1, p2, p3 ) {\r\n\r\n\treturn CubicBezierP0( t, p0 ) + CubicBezierP1( t, p1 ) + CubicBezierP2( t, p2 ) +\r\n\t\tCubicBezierP3( t, p3 );\r\n\r\n}\r\n\r\nclass CubicBezierCurve extends Curve {\r\n\r\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2(), v3 = new Vector2() ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isCubicBezierCurve = true;\r\n\r\n\t\tthis.type = 'CubicBezierCurve';\r\n\r\n\t\tthis.v0 = v0;\r\n\t\tthis.v1 = v1;\r\n\t\tthis.v2 = v2;\r\n\t\tthis.v3 = v3;\r\n\r\n\t}\r\n\r\n\tgetPoint( t, optionalTarget = new Vector2() ) {\r\n\r\n\t\tconst point = optionalTarget;\r\n\r\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\r\n\r\n\t\tpoint.set(\r\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\r\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y )\r\n\t\t);\r\n\r\n\t\treturn point;\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.v0.copy( source.v0 );\r\n\t\tthis.v1.copy( source.v1 );\r\n\t\tthis.v2.copy( source.v2 );\r\n\t\tthis.v3.copy( source.v3 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = super.toJSON();\r\n\r\n\t\tdata.v0 = this.v0.toArray();\r\n\t\tdata.v1 = this.v1.toArray();\r\n\t\tdata.v2 = this.v2.toArray();\r\n\t\tdata.v3 = this.v3.toArray();\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n\tfromJSON( json ) {\r\n\r\n\t\tsuper.fromJSON( json );\r\n\r\n\t\tthis.v0.fromArray( json.v0 );\r\n\t\tthis.v1.fromArray( json.v1 );\r\n\t\tthis.v2.fromArray( json.v2 );\r\n\t\tthis.v3.fromArray( json.v3 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass CubicBezierCurve3 extends Curve {\r\n\r\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3(), v3 = new Vector3() ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isCubicBezierCurve3 = true;\r\n\r\n\t\tthis.type = 'CubicBezierCurve3';\r\n\r\n\t\tthis.v0 = v0;\r\n\t\tthis.v1 = v1;\r\n\t\tthis.v2 = v2;\r\n\t\tthis.v3 = v3;\r\n\r\n\t}\r\n\r\n\tgetPoint( t, optionalTarget = new Vector3() ) {\r\n\r\n\t\tconst point = optionalTarget;\r\n\r\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\r\n\r\n\t\tpoint.set(\r\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\r\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y ),\r\n\t\t\tCubicBezier( t, v0.z, v1.z, v2.z, v3.z )\r\n\t\t);\r\n\r\n\t\treturn point;\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.v0.copy( source.v0 );\r\n\t\tthis.v1.copy( source.v1 );\r\n\t\tthis.v2.copy( source.v2 );\r\n\t\tthis.v3.copy( source.v3 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = super.toJSON();\r\n\r\n\t\tdata.v0 = this.v0.toArray();\r\n\t\tdata.v1 = this.v1.toArray();\r\n\t\tdata.v2 = this.v2.toArray();\r\n\t\tdata.v3 = this.v3.toArray();\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n\tfromJSON( json ) {\r\n\r\n\t\tsuper.fromJSON( json );\r\n\r\n\t\tthis.v0.fromArray( json.v0 );\r\n\t\tthis.v1.fromArray( json.v1 );\r\n\t\tthis.v2.fromArray( json.v2 );\r\n\t\tthis.v3.fromArray( json.v3 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass LineCurve extends Curve {\r\n\r\n\tconstructor( v1 = new Vector2(), v2 = new Vector2() ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isLineCurve = true;\r\n\r\n\t\tthis.type = 'LineCurve';\r\n\r\n\t\tthis.v1 = v1;\r\n\t\tthis.v2 = v2;\r\n\r\n\t}\r\n\r\n\tgetPoint( t, optionalTarget = new Vector2() ) {\r\n\r\n\t\tconst point = optionalTarget;\r\n\r\n\t\tif ( t === 1 ) {\r\n\r\n\t\t\tpoint.copy( this.v2 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\r\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn point;\r\n\r\n\t}\r\n\r\n\t// Line curve is linear, so we can overwrite default getPointAt\r\n\tgetPointAt( u, optionalTarget ) {\r\n\r\n\t\treturn this.getPoint( u, optionalTarget );\r\n\r\n\t}\r\n\r\n\tgetTangent( t, optionalTarget = new Vector2() ) {\r\n\r\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\r\n\r\n\t}\r\n\r\n\tgetTangentAt( u, optionalTarget ) {\r\n\r\n\t\treturn this.getTangent( u, optionalTarget );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.v1.copy( source.v1 );\r\n\t\tthis.v2.copy( source.v2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = super.toJSON();\r\n\r\n\t\tdata.v1 = this.v1.toArray();\r\n\t\tdata.v2 = this.v2.toArray();\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n\tfromJSON( json ) {\r\n\r\n\t\tsuper.fromJSON( json );\r\n\r\n\t\tthis.v1.fromArray( json.v1 );\r\n\t\tthis.v2.fromArray( json.v2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass LineCurve3 extends Curve {\r\n\r\n\tconstructor( v1 = new Vector3(), v2 = new Vector3() ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isLineCurve3 = true;\r\n\r\n\t\tthis.type = 'LineCurve3';\r\n\r\n\t\tthis.v1 = v1;\r\n\t\tthis.v2 = v2;\r\n\r\n\t}\r\n\r\n\tgetPoint( t, optionalTarget = new Vector3() ) {\r\n\r\n\t\tconst point = optionalTarget;\r\n\r\n\t\tif ( t === 1 ) {\r\n\r\n\t\t\tpoint.copy( this.v2 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\r\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn point;\r\n\r\n\t}\r\n\r\n\t// Line curve is linear, so we can overwrite default getPointAt\r\n\tgetPointAt( u, optionalTarget ) {\r\n\r\n\t\treturn this.getPoint( u, optionalTarget );\r\n\r\n\t}\r\n\r\n\tgetTangent( t, optionalTarget = new Vector3() ) {\r\n\r\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\r\n\r\n\t}\r\n\r\n\tgetTangentAt( u, optionalTarget ) {\r\n\r\n\t\treturn this.getTangent( u, optionalTarget );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.v1.copy( source.v1 );\r\n\t\tthis.v2.copy( source.v2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = super.toJSON();\r\n\r\n\t\tdata.v1 = this.v1.toArray();\r\n\t\tdata.v2 = this.v2.toArray();\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n\tfromJSON( json ) {\r\n\r\n\t\tsuper.fromJSON( json );\r\n\r\n\t\tthis.v1.fromArray( json.v1 );\r\n\t\tthis.v2.fromArray( json.v2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass QuadraticBezierCurve extends Curve {\r\n\r\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2() ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isQuadraticBezierCurve = true;\r\n\r\n\t\tthis.type = 'QuadraticBezierCurve';\r\n\r\n\t\tthis.v0 = v0;\r\n\t\tthis.v1 = v1;\r\n\t\tthis.v2 = v2;\r\n\r\n\t}\r\n\r\n\tgetPoint( t, optionalTarget = new Vector2() ) {\r\n\r\n\t\tconst point = optionalTarget;\r\n\r\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\r\n\r\n\t\tpoint.set(\r\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\r\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y )\r\n\t\t);\r\n\r\n\t\treturn point;\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.v0.copy( source.v0 );\r\n\t\tthis.v1.copy( source.v1 );\r\n\t\tthis.v2.copy( source.v2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = super.toJSON();\r\n\r\n\t\tdata.v0 = this.v0.toArray();\r\n\t\tdata.v1 = this.v1.toArray();\r\n\t\tdata.v2 = this.v2.toArray();\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n\tfromJSON( json ) {\r\n\r\n\t\tsuper.fromJSON( json );\r\n\r\n\t\tthis.v0.fromArray( json.v0 );\r\n\t\tthis.v1.fromArray( json.v1 );\r\n\t\tthis.v2.fromArray( json.v2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass QuadraticBezierCurve3 extends Curve {\r\n\r\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3() ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isQuadraticBezierCurve3 = true;\r\n\r\n\t\tthis.type = 'QuadraticBezierCurve3';\r\n\r\n\t\tthis.v0 = v0;\r\n\t\tthis.v1 = v1;\r\n\t\tthis.v2 = v2;\r\n\r\n\t}\r\n\r\n\tgetPoint( t, optionalTarget = new Vector3() ) {\r\n\r\n\t\tconst point = optionalTarget;\r\n\r\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\r\n\r\n\t\tpoint.set(\r\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\r\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y ),\r\n\t\t\tQuadraticBezier( t, v0.z, v1.z, v2.z )\r\n\t\t);\r\n\r\n\t\treturn point;\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.v0.copy( source.v0 );\r\n\t\tthis.v1.copy( source.v1 );\r\n\t\tthis.v2.copy( source.v2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = super.toJSON();\r\n\r\n\t\tdata.v0 = this.v0.toArray();\r\n\t\tdata.v1 = this.v1.toArray();\r\n\t\tdata.v2 = this.v2.toArray();\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n\tfromJSON( json ) {\r\n\r\n\t\tsuper.fromJSON( json );\r\n\r\n\t\tthis.v0.fromArray( json.v0 );\r\n\t\tthis.v1.fromArray( json.v1 );\r\n\t\tthis.v2.fromArray( json.v2 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass SplineCurve extends Curve {\r\n\r\n\tconstructor( points = [] ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isSplineCurve = true;\r\n\r\n\t\tthis.type = 'SplineCurve';\r\n\r\n\t\tthis.points = points;\r\n\r\n\t}\r\n\r\n\tgetPoint( t, optionalTarget = new Vector2() ) {\r\n\r\n\t\tconst point = optionalTarget;\r\n\r\n\t\tconst points = this.points;\r\n\t\tconst p = ( points.length - 1 ) * t;\r\n\r\n\t\tconst intPoint = Math.floor( p );\r\n\t\tconst weight = p - intPoint;\r\n\r\n\t\tconst p0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ];\r\n\t\tconst p1 = points[ intPoint ];\r\n\t\tconst p2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];\r\n\t\tconst p3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];\r\n\r\n\t\tpoint.set(\r\n\t\t\tCatmullRom( weight, p0.x, p1.x, p2.x, p3.x ),\r\n\t\t\tCatmullRom( weight, p0.y, p1.y, p2.y, p3.y )\r\n\t\t);\r\n\r\n\t\treturn point;\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.points = [];\r\n\r\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst point = source.points[ i ];\r\n\r\n\t\t\tthis.points.push( point.clone() );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = super.toJSON();\r\n\r\n\t\tdata.points = [];\r\n\r\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst point = this.points[ i ];\r\n\t\t\tdata.points.push( point.toArray() );\r\n\r\n\t\t}\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n\tfromJSON( json ) {\r\n\r\n\t\tsuper.fromJSON( json );\r\n\r\n\t\tthis.points = [];\r\n\r\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst point = json.points[ i ];\r\n\t\t\tthis.points.push( new Vector2().fromArray( point ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nvar Curves = /*#__PURE__*/Object.freeze({\r\n\t__proto__: null,\r\n\tArcCurve: ArcCurve,\r\n\tCatmullRomCurve3: CatmullRomCurve3,\r\n\tCubicBezierCurve: CubicBezierCurve,\r\n\tCubicBezierCurve3: CubicBezierCurve3,\r\n\tEllipseCurve: EllipseCurve,\r\n\tLineCurve: LineCurve,\r\n\tLineCurve3: LineCurve3,\r\n\tQuadraticBezierCurve: QuadraticBezierCurve,\r\n\tQuadraticBezierCurve3: QuadraticBezierCurve3,\r\n\tSplineCurve: SplineCurve\r\n});\r\n\r\n/**************************************************************\r\n *\tCurved Path - a curve path is simply a array of connected\r\n * curves, but retains the api of a curve\r\n **************************************************************/\r\n\r\nclass CurvePath extends Curve {\r\n\r\n\tconstructor() {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'CurvePath';\r\n\r\n\t\tthis.curves = [];\r\n\t\tthis.autoClose = false; // Automatically closes the path\r\n\r\n\t}\r\n\r\n\tadd( curve ) {\r\n\r\n\t\tthis.curves.push( curve );\r\n\r\n\t}\r\n\r\n\tclosePath() {\r\n\r\n\t\t// Add a line curve if start and end of lines are not connected\r\n\t\tconst startPoint = this.curves[ 0 ].getPoint( 0 );\r\n\t\tconst endPoint = this.curves[ this.curves.length - 1 ].getPoint( 1 );\r\n\r\n\t\tif ( ! startPoint.equals( endPoint ) ) {\r\n\r\n\t\t\tconst lineType = ( startPoint.isVector2 === true ) ? 'LineCurve' : 'LineCurve3';\r\n\t\t\tthis.curves.push( new Curves[ lineType ]( endPoint, startPoint ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t// To get accurate point with reference to\r\n\t// entire path distance at time t,\r\n\t// following has to be done:\r\n\r\n\t// 1. Length of each sub path have to be known\r\n\t// 2. Locate and identify type of curve\r\n\t// 3. Get t for the curve\r\n\t// 4. Return curve.getPointAt(t')\r\n\r\n\tgetPoint( t, optionalTarget ) {\r\n\r\n\t\tconst d = t * this.getLength();\r\n\t\tconst curveLengths = this.getCurveLengths();\r\n\t\tlet i = 0;\r\n\r\n\t\t// To think about boundaries points.\r\n\r\n\t\twhile ( i < curveLengths.length ) {\r\n\r\n\t\t\tif ( curveLengths[ i ] >= d ) {\r\n\r\n\t\t\t\tconst diff = curveLengths[ i ] - d;\r\n\t\t\t\tconst curve = this.curves[ i ];\r\n\r\n\t\t\t\tconst segmentLength = curve.getLength();\r\n\t\t\t\tconst u = segmentLength === 0 ? 0 : 1 - diff / segmentLength;\r\n\r\n\t\t\t\treturn curve.getPointAt( u, optionalTarget );\r\n\r\n\t\t\t}\r\n\r\n\t\t\ti ++;\r\n\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\r\n\t\t// loop where sum != 0, sum > d , sum+1 1 && ! points[ points.length - 1 ].equals( points[ 0 ] ) ) {\r\n\r\n\t\t\tpoints.push( points[ 0 ] );\r\n\r\n\t\t}\r\n\r\n\t\treturn points;\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.curves = [];\r\n\r\n\t\tfor ( let i = 0, l = source.curves.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst curve = source.curves[ i ];\r\n\r\n\t\t\tthis.curves.push( curve.clone() );\r\n\r\n\t\t}\r\n\r\n\t\tthis.autoClose = source.autoClose;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = super.toJSON();\r\n\r\n\t\tdata.autoClose = this.autoClose;\r\n\t\tdata.curves = [];\r\n\r\n\t\tfor ( let i = 0, l = this.curves.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst curve = this.curves[ i ];\r\n\t\t\tdata.curves.push( curve.toJSON() );\r\n\r\n\t\t}\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n\tfromJSON( json ) {\r\n\r\n\t\tsuper.fromJSON( json );\r\n\r\n\t\tthis.autoClose = json.autoClose;\r\n\t\tthis.curves = [];\r\n\r\n\t\tfor ( let i = 0, l = json.curves.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst curve = json.curves[ i ];\r\n\t\t\tthis.curves.push( new Curves[ curve.type ]().fromJSON( curve ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Path extends CurvePath {\r\n\r\n\tconstructor( points ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'Path';\r\n\r\n\t\tthis.currentPoint = new Vector2();\r\n\r\n\t\tif ( points ) {\r\n\r\n\t\t\tthis.setFromPoints( points );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tsetFromPoints( points ) {\r\n\r\n\t\tthis.moveTo( points[ 0 ].x, points[ 0 ].y );\r\n\r\n\t\tfor ( let i = 1, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tthis.lineTo( points[ i ].x, points[ i ].y );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmoveTo( x, y ) {\r\n\r\n\t\tthis.currentPoint.set( x, y ); // TODO consider referencing vectors instead of copying?\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tlineTo( x, y ) {\r\n\r\n\t\tconst curve = new LineCurve( this.currentPoint.clone(), new Vector2( x, y ) );\r\n\t\tthis.curves.push( curve );\r\n\r\n\t\tthis.currentPoint.set( x, y );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\r\n\r\n\t\tconst curve = new QuadraticBezierCurve(\r\n\t\t\tthis.currentPoint.clone(),\r\n\t\t\tnew Vector2( aCPx, aCPy ),\r\n\t\t\tnew Vector2( aX, aY )\r\n\t\t);\r\n\r\n\t\tthis.curves.push( curve );\r\n\r\n\t\tthis.currentPoint.set( aX, aY );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\r\n\r\n\t\tconst curve = new CubicBezierCurve(\r\n\t\t\tthis.currentPoint.clone(),\r\n\t\t\tnew Vector2( aCP1x, aCP1y ),\r\n\t\t\tnew Vector2( aCP2x, aCP2y ),\r\n\t\t\tnew Vector2( aX, aY )\r\n\t\t);\r\n\r\n\t\tthis.curves.push( curve );\r\n\r\n\t\tthis.currentPoint.set( aX, aY );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsplineThru( pts /*Array of Vector*/ ) {\r\n\r\n\t\tconst npts = [ this.currentPoint.clone() ].concat( pts );\r\n\r\n\t\tconst curve = new SplineCurve( npts );\r\n\t\tthis.curves.push( curve );\r\n\r\n\t\tthis.currentPoint.copy( pts[ pts.length - 1 ] );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\r\n\r\n\t\tconst x0 = this.currentPoint.x;\r\n\t\tconst y0 = this.currentPoint.y;\r\n\r\n\t\tthis.absarc( aX + x0, aY + y0, aRadius,\r\n\t\t\taStartAngle, aEndAngle, aClockwise );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tabsarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\r\n\r\n\t\tthis.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\r\n\r\n\t\tconst x0 = this.currentPoint.x;\r\n\t\tconst y0 = this.currentPoint.y;\r\n\r\n\t\tthis.absellipse( aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tabsellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\r\n\r\n\t\tconst curve = new EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\r\n\r\n\t\tif ( this.curves.length > 0 ) {\r\n\r\n\t\t\t// if a previous curve is present, attempt to join\r\n\t\t\tconst firstPoint = curve.getPoint( 0 );\r\n\r\n\t\t\tif ( ! firstPoint.equals( this.currentPoint ) ) {\r\n\r\n\t\t\t\tthis.lineTo( firstPoint.x, firstPoint.y );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.curves.push( curve );\r\n\r\n\t\tconst lastPoint = curve.getPoint( 1 );\r\n\t\tthis.currentPoint.copy( lastPoint );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.currentPoint.copy( source.currentPoint );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = super.toJSON();\r\n\r\n\t\tdata.currentPoint = this.currentPoint.toArray();\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n\tfromJSON( json ) {\r\n\r\n\t\tsuper.fromJSON( json );\r\n\r\n\t\tthis.currentPoint.fromArray( json.currentPoint );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass LatheGeometry extends BufferGeometry {\r\n\r\n\tconstructor( points = [ new Vector2( 0, - 0.5 ), new Vector2( 0.5, 0 ), new Vector2( 0, 0.5 ) ], segments = 12, phiStart = 0, phiLength = Math.PI * 2 ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'LatheGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tpoints: points,\r\n\t\t\tsegments: segments,\r\n\t\t\tphiStart: phiStart,\r\n\t\t\tphiLength: phiLength\r\n\t\t};\r\n\r\n\t\tsegments = Math.floor( segments );\r\n\r\n\t\t// clamp phiLength so it's in range of [ 0, 2PI ]\r\n\r\n\t\tphiLength = clamp( phiLength, 0, Math.PI * 2 );\r\n\r\n\t\t// buffers\r\n\r\n\t\tconst indices = [];\r\n\t\tconst vertices = [];\r\n\t\tconst uvs = [];\r\n\t\tconst initNormals = [];\r\n\t\tconst normals = [];\r\n\r\n\t\t// helper variables\r\n\r\n\t\tconst inverseSegments = 1.0 / segments;\r\n\t\tconst vertex = new Vector3();\r\n\t\tconst uv = new Vector2();\r\n\t\tconst normal = new Vector3();\r\n\t\tconst curNormal = new Vector3();\r\n\t\tconst prevNormal = new Vector3();\r\n\t\tlet dx = 0;\r\n\t\tlet dy = 0;\r\n\r\n\t\t// pre-compute normals for initial \"meridian\"\r\n\r\n\t\tfor ( let j = 0; j <= ( points.length - 1 ); j ++ ) {\r\n\r\n\t\t\tswitch ( j ) {\r\n\r\n\t\t\t\tcase 0:\t\t\t\t// special handling for 1st vertex on path\r\n\r\n\t\t\t\t\tdx = points[ j + 1 ].x - points[ j ].x;\r\n\t\t\t\t\tdy = points[ j + 1 ].y - points[ j ].y;\r\n\r\n\t\t\t\t\tnormal.x = dy * 1.0;\r\n\t\t\t\t\tnormal.y = - dx;\r\n\t\t\t\t\tnormal.z = dy * 0.0;\r\n\r\n\t\t\t\t\tprevNormal.copy( normal );\r\n\r\n\t\t\t\t\tnormal.normalize();\r\n\r\n\t\t\t\t\tinitNormals.push( normal.x, normal.y, normal.z );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase ( points.length - 1 ):\t// special handling for last Vertex on path\r\n\r\n\t\t\t\t\tinitNormals.push( prevNormal.x, prevNormal.y, prevNormal.z );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tdefault:\t\t\t// default handling for all vertices in between\r\n\r\n\t\t\t\t\tdx = points[ j + 1 ].x - points[ j ].x;\r\n\t\t\t\t\tdy = points[ j + 1 ].y - points[ j ].y;\r\n\r\n\t\t\t\t\tnormal.x = dy * 1.0;\r\n\t\t\t\t\tnormal.y = - dx;\r\n\t\t\t\t\tnormal.z = dy * 0.0;\r\n\r\n\t\t\t\t\tcurNormal.copy( normal );\r\n\r\n\t\t\t\t\tnormal.x += prevNormal.x;\r\n\t\t\t\t\tnormal.y += prevNormal.y;\r\n\t\t\t\t\tnormal.z += prevNormal.z;\r\n\r\n\t\t\t\t\tnormal.normalize();\r\n\r\n\t\t\t\t\tinitNormals.push( normal.x, normal.y, normal.z );\r\n\r\n\t\t\t\t\tprevNormal.copy( curNormal );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// generate vertices, uvs and normals\r\n\r\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\r\n\r\n\t\t\tconst phi = phiStart + i * inverseSegments * phiLength;\r\n\r\n\t\t\tconst sin = Math.sin( phi );\r\n\t\t\tconst cos = Math.cos( phi );\r\n\r\n\t\t\tfor ( let j = 0; j <= ( points.length - 1 ); j ++ ) {\r\n\r\n\t\t\t\t// vertex\r\n\r\n\t\t\t\tvertex.x = points[ j ].x * sin;\r\n\t\t\t\tvertex.y = points[ j ].y;\r\n\t\t\t\tvertex.z = points[ j ].x * cos;\r\n\r\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\r\n\r\n\t\t\t\t// uv\r\n\r\n\t\t\t\tuv.x = i / segments;\r\n\t\t\t\tuv.y = j / ( points.length - 1 );\r\n\r\n\t\t\t\tuvs.push( uv.x, uv.y );\r\n\r\n\t\t\t\t// normal\r\n\r\n\t\t\t\tconst x = initNormals[ 3 * j + 0 ] * sin;\r\n\t\t\t\tconst y = initNormals[ 3 * j + 1 ];\r\n\t\t\t\tconst z = initNormals[ 3 * j + 0 ] * cos;\r\n\r\n\t\t\t\tnormals.push( x, y, z );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// indices\r\n\r\n\t\tfor ( let i = 0; i < segments; i ++ ) {\r\n\r\n\t\t\tfor ( let j = 0; j < ( points.length - 1 ); j ++ ) {\r\n\r\n\t\t\t\tconst base = j + i * points.length;\r\n\r\n\t\t\t\tconst a = base;\r\n\t\t\t\tconst b = base + points.length;\r\n\t\t\t\tconst c = base + points.length + 1;\r\n\t\t\t\tconst d = base + 1;\r\n\r\n\t\t\t\t// faces\r\n\r\n\t\t\t\tindices.push( a, b, d );\r\n\t\t\t\tindices.push( c, d, b );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// build geometry\r\n\r\n\t\tthis.setIndex( indices );\r\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\r\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.parameters = Object.assign( {}, source.parameters );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data ) {\r\n\r\n\t\treturn new LatheGeometry( data.points, data.segments, data.phiStart, data.phiLength );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass CapsuleGeometry extends LatheGeometry {\r\n\r\n\tconstructor( radius = 1, length = 1, capSegments = 4, radialSegments = 8 ) {\r\n\r\n\t\tconst path = new Path();\r\n\t\tpath.absarc( 0, - length / 2, radius, Math.PI * 1.5, 0 );\r\n\t\tpath.absarc( 0, length / 2, radius, 0, Math.PI * 0.5 );\r\n\r\n\t\tsuper( path.getPoints( capSegments ), radialSegments );\r\n\r\n\t\tthis.type = 'CapsuleGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tradius: radius,\r\n\t\t\tlength: length,\r\n\t\t\tcapSegments: capSegments,\r\n\t\t\tradialSegments: radialSegments,\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data ) {\r\n\r\n\t\treturn new CapsuleGeometry( data.radius, data.length, data.capSegments, data.radialSegments );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass CircleGeometry extends BufferGeometry {\r\n\r\n\tconstructor( radius = 1, segments = 32, thetaStart = 0, thetaLength = Math.PI * 2 ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'CircleGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tradius: radius,\r\n\t\t\tsegments: segments,\r\n\t\t\tthetaStart: thetaStart,\r\n\t\t\tthetaLength: thetaLength\r\n\t\t};\r\n\r\n\t\tsegments = Math.max( 3, segments );\r\n\r\n\t\t// buffers\r\n\r\n\t\tconst indices = [];\r\n\t\tconst vertices = [];\r\n\t\tconst normals = [];\r\n\t\tconst uvs = [];\r\n\r\n\t\t// helper variables\r\n\r\n\t\tconst vertex = new Vector3();\r\n\t\tconst uv = new Vector2();\r\n\r\n\t\t// center point\r\n\r\n\t\tvertices.push( 0, 0, 0 );\r\n\t\tnormals.push( 0, 0, 1 );\r\n\t\tuvs.push( 0.5, 0.5 );\r\n\r\n\t\tfor ( let s = 0, i = 3; s <= segments; s ++, i += 3 ) {\r\n\r\n\t\t\tconst segment = thetaStart + s / segments * thetaLength;\r\n\r\n\t\t\t// vertex\r\n\r\n\t\t\tvertex.x = radius * Math.cos( segment );\r\n\t\t\tvertex.y = radius * Math.sin( segment );\r\n\r\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\r\n\r\n\t\t\t// normal\r\n\r\n\t\t\tnormals.push( 0, 0, 1 );\r\n\r\n\t\t\t// uvs\r\n\r\n\t\t\tuv.x = ( vertices[ i ] / radius + 1 ) / 2;\r\n\t\t\tuv.y = ( vertices[ i + 1 ] / radius + 1 ) / 2;\r\n\r\n\t\t\tuvs.push( uv.x, uv.y );\r\n\r\n\t\t}\r\n\r\n\t\t// indices\r\n\r\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\r\n\r\n\t\t\tindices.push( i, i + 1, 0 );\r\n\r\n\t\t}\r\n\r\n\t\t// build geometry\r\n\r\n\t\tthis.setIndex( indices );\r\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\r\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.parameters = Object.assign( {}, source.parameters );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data ) {\r\n\r\n\t\treturn new CircleGeometry( data.radius, data.segments, data.thetaStart, data.thetaLength );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass CylinderGeometry extends BufferGeometry {\r\n\r\n\tconstructor( radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'CylinderGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tradiusTop: radiusTop,\r\n\t\t\tradiusBottom: radiusBottom,\r\n\t\t\theight: height,\r\n\t\t\tradialSegments: radialSegments,\r\n\t\t\theightSegments: heightSegments,\r\n\t\t\topenEnded: openEnded,\r\n\t\t\tthetaStart: thetaStart,\r\n\t\t\tthetaLength: thetaLength\r\n\t\t};\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\tradialSegments = Math.floor( radialSegments );\r\n\t\theightSegments = Math.floor( heightSegments );\r\n\r\n\t\t// buffers\r\n\r\n\t\tconst indices = [];\r\n\t\tconst vertices = [];\r\n\t\tconst normals = [];\r\n\t\tconst uvs = [];\r\n\r\n\t\t// helper variables\r\n\r\n\t\tlet index = 0;\r\n\t\tconst indexArray = [];\r\n\t\tconst halfHeight = height / 2;\r\n\t\tlet groupStart = 0;\r\n\r\n\t\t// generate geometry\r\n\r\n\t\tgenerateTorso();\r\n\r\n\t\tif ( openEnded === false ) {\r\n\r\n\t\t\tif ( radiusTop > 0 ) generateCap( true );\r\n\t\t\tif ( radiusBottom > 0 ) generateCap( false );\r\n\r\n\t\t}\r\n\r\n\t\t// build geometry\r\n\r\n\t\tthis.setIndex( indices );\r\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\r\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\r\n\r\n\t\tfunction generateTorso() {\r\n\r\n\t\t\tconst normal = new Vector3();\r\n\t\t\tconst vertex = new Vector3();\r\n\r\n\t\t\tlet groupCount = 0;\r\n\r\n\t\t\t// this will be used to calculate the normal\r\n\t\t\tconst slope = ( radiusBottom - radiusTop ) / height;\r\n\r\n\t\t\t// generate vertices, normals and uvs\r\n\r\n\t\t\tfor ( let y = 0; y <= heightSegments; y ++ ) {\r\n\r\n\t\t\t\tconst indexRow = [];\r\n\r\n\t\t\t\tconst v = y / heightSegments;\r\n\r\n\t\t\t\t// calculate the radius of the current row\r\n\r\n\t\t\t\tconst radius = v * ( radiusBottom - radiusTop ) + radiusTop;\r\n\r\n\t\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\r\n\r\n\t\t\t\t\tconst u = x / radialSegments;\r\n\r\n\t\t\t\t\tconst theta = u * thetaLength + thetaStart;\r\n\r\n\t\t\t\t\tconst sinTheta = Math.sin( theta );\r\n\t\t\t\t\tconst cosTheta = Math.cos( theta );\r\n\r\n\t\t\t\t\t// vertex\r\n\r\n\t\t\t\t\tvertex.x = radius * sinTheta;\r\n\t\t\t\t\tvertex.y = - v * height + halfHeight;\r\n\t\t\t\t\tvertex.z = radius * cosTheta;\r\n\t\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\r\n\r\n\t\t\t\t\t// normal\r\n\r\n\t\t\t\t\tnormal.set( sinTheta, slope, cosTheta ).normalize();\r\n\t\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\r\n\r\n\t\t\t\t\t// uv\r\n\r\n\t\t\t\t\tuvs.push( u, 1 - v );\r\n\r\n\t\t\t\t\t// save index of vertex in respective row\r\n\r\n\t\t\t\t\tindexRow.push( index ++ );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// now save vertices of the row in our index array\r\n\r\n\t\t\t\tindexArray.push( indexRow );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// generate indices\r\n\r\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\r\n\r\n\t\t\t\tfor ( let y = 0; y < heightSegments; y ++ ) {\r\n\r\n\t\t\t\t\t// we use the index array to access the correct indices\r\n\r\n\t\t\t\t\tconst a = indexArray[ y ][ x ];\r\n\t\t\t\t\tconst b = indexArray[ y + 1 ][ x ];\r\n\t\t\t\t\tconst c = indexArray[ y + 1 ][ x + 1 ];\r\n\t\t\t\t\tconst d = indexArray[ y ][ x + 1 ];\r\n\r\n\t\t\t\t\t// faces\r\n\r\n\t\t\t\t\tindices.push( a, b, d );\r\n\t\t\t\t\tindices.push( b, c, d );\r\n\r\n\t\t\t\t\t// update group counter\r\n\r\n\t\t\t\t\tgroupCount += 6;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// add a group to the geometry. this will ensure multi material support\r\n\r\n\t\t\tscope.addGroup( groupStart, groupCount, 0 );\r\n\r\n\t\t\t// calculate new start value for groups\r\n\r\n\t\t\tgroupStart += groupCount;\r\n\r\n\t\t}\r\n\r\n\t\tfunction generateCap( top ) {\r\n\r\n\t\t\t// save the index of the first center vertex\r\n\t\t\tconst centerIndexStart = index;\r\n\r\n\t\t\tconst uv = new Vector2();\r\n\t\t\tconst vertex = new Vector3();\r\n\r\n\t\t\tlet groupCount = 0;\r\n\r\n\t\t\tconst radius = ( top === true ) ? radiusTop : radiusBottom;\r\n\t\t\tconst sign = ( top === true ) ? 1 : - 1;\r\n\r\n\t\t\t// first we generate the center vertex data of the cap.\r\n\t\t\t// because the geometry needs one set of uvs per face,\r\n\t\t\t// we must generate a center vertex per face/segment\r\n\r\n\t\t\tfor ( let x = 1; x <= radialSegments; x ++ ) {\r\n\r\n\t\t\t\t// vertex\r\n\r\n\t\t\t\tvertices.push( 0, halfHeight * sign, 0 );\r\n\r\n\t\t\t\t// normal\r\n\r\n\t\t\t\tnormals.push( 0, sign, 0 );\r\n\r\n\t\t\t\t// uv\r\n\r\n\t\t\t\tuvs.push( 0.5, 0.5 );\r\n\r\n\t\t\t\t// increase index\r\n\r\n\t\t\t\tindex ++;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// save the index of the last center vertex\r\n\t\t\tconst centerIndexEnd = index;\r\n\r\n\t\t\t// now we generate the surrounding vertices, normals and uvs\r\n\r\n\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\r\n\r\n\t\t\t\tconst u = x / radialSegments;\r\n\t\t\t\tconst theta = u * thetaLength + thetaStart;\r\n\r\n\t\t\t\tconst cosTheta = Math.cos( theta );\r\n\t\t\t\tconst sinTheta = Math.sin( theta );\r\n\r\n\t\t\t\t// vertex\r\n\r\n\t\t\t\tvertex.x = radius * sinTheta;\r\n\t\t\t\tvertex.y = halfHeight * sign;\r\n\t\t\t\tvertex.z = radius * cosTheta;\r\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\r\n\r\n\t\t\t\t// normal\r\n\r\n\t\t\t\tnormals.push( 0, sign, 0 );\r\n\r\n\t\t\t\t// uv\r\n\r\n\t\t\t\tuv.x = ( cosTheta * 0.5 ) + 0.5;\r\n\t\t\t\tuv.y = ( sinTheta * 0.5 * sign ) + 0.5;\r\n\t\t\t\tuvs.push( uv.x, uv.y );\r\n\r\n\t\t\t\t// increase index\r\n\r\n\t\t\t\tindex ++;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// generate indices\r\n\r\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\r\n\r\n\t\t\t\tconst c = centerIndexStart + x;\r\n\t\t\t\tconst i = centerIndexEnd + x;\r\n\r\n\t\t\t\tif ( top === true ) {\r\n\r\n\t\t\t\t\t// face top\r\n\r\n\t\t\t\t\tindices.push( i, i + 1, c );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// face bottom\r\n\r\n\t\t\t\t\tindices.push( i + 1, i, c );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tgroupCount += 3;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// add a group to the geometry. this will ensure multi material support\r\n\r\n\t\t\tscope.addGroup( groupStart, groupCount, top === true ? 1 : 2 );\r\n\r\n\t\t\t// calculate new start value for groups\r\n\r\n\t\t\tgroupStart += groupCount;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.parameters = Object.assign( {}, source.parameters );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data ) {\r\n\r\n\t\treturn new CylinderGeometry( data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass ConeGeometry extends CylinderGeometry {\r\n\r\n\tconstructor( radius = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\r\n\r\n\t\tsuper( 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength );\r\n\r\n\t\tthis.type = 'ConeGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tradius: radius,\r\n\t\t\theight: height,\r\n\t\t\tradialSegments: radialSegments,\r\n\t\t\theightSegments: heightSegments,\r\n\t\t\topenEnded: openEnded,\r\n\t\t\tthetaStart: thetaStart,\r\n\t\t\tthetaLength: thetaLength\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data ) {\r\n\r\n\t\treturn new ConeGeometry( data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass PolyhedronGeometry extends BufferGeometry {\r\n\r\n\tconstructor( vertices = [], indices = [], radius = 1, detail = 0 ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'PolyhedronGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tvertices: vertices,\r\n\t\t\tindices: indices,\r\n\t\t\tradius: radius,\r\n\t\t\tdetail: detail\r\n\t\t};\r\n\r\n\t\t// default buffer data\r\n\r\n\t\tconst vertexBuffer = [];\r\n\t\tconst uvBuffer = [];\r\n\r\n\t\t// the subdivision creates the vertex buffer data\r\n\r\n\t\tsubdivide( detail );\r\n\r\n\t\t// all vertices should lie on a conceptual sphere with a given radius\r\n\r\n\t\tapplyRadius( radius );\r\n\r\n\t\t// finally, create the uv data\r\n\r\n\t\tgenerateUVs();\r\n\r\n\t\t// build non-indexed geometry\r\n\r\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertexBuffer, 3 ) );\r\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( vertexBuffer.slice(), 3 ) );\r\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvBuffer, 2 ) );\r\n\r\n\t\tif ( detail === 0 ) {\r\n\r\n\t\t\tthis.computeVertexNormals(); // flat normals\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.normalizeNormals(); // smooth normals\r\n\r\n\t\t}\r\n\r\n\t\t// helper functions\r\n\r\n\t\tfunction subdivide( detail ) {\r\n\r\n\t\t\tconst a = new Vector3();\r\n\t\t\tconst b = new Vector3();\r\n\t\t\tconst c = new Vector3();\r\n\r\n\t\t\t// iterate over all faces and apply a subdivision with the given detail value\r\n\r\n\t\t\tfor ( let i = 0; i < indices.length; i += 3 ) {\r\n\r\n\t\t\t\t// get the vertices of the face\r\n\r\n\t\t\t\tgetVertexByIndex( indices[ i + 0 ], a );\r\n\t\t\t\tgetVertexByIndex( indices[ i + 1 ], b );\r\n\t\t\t\tgetVertexByIndex( indices[ i + 2 ], c );\r\n\r\n\t\t\t\t// perform subdivision\r\n\r\n\t\t\t\tsubdivideFace( a, b, c, detail );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction subdivideFace( a, b, c, detail ) {\r\n\r\n\t\t\tconst cols = detail + 1;\r\n\r\n\t\t\t// we use this multidimensional array as a data structure for creating the subdivision\r\n\r\n\t\t\tconst v = [];\r\n\r\n\t\t\t// construct all of the vertices for this subdivision\r\n\r\n\t\t\tfor ( let i = 0; i <= cols; i ++ ) {\r\n\r\n\t\t\t\tv[ i ] = [];\r\n\r\n\t\t\t\tconst aj = a.clone().lerp( c, i / cols );\r\n\t\t\t\tconst bj = b.clone().lerp( c, i / cols );\r\n\r\n\t\t\t\tconst rows = cols - i;\r\n\r\n\t\t\t\tfor ( let j = 0; j <= rows; j ++ ) {\r\n\r\n\t\t\t\t\tif ( j === 0 && i === cols ) {\r\n\r\n\t\t\t\t\t\tv[ i ][ j ] = aj;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tv[ i ][ j ] = aj.clone().lerp( bj, j / rows );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// construct all of the faces\r\n\r\n\t\t\tfor ( let i = 0; i < cols; i ++ ) {\r\n\r\n\t\t\t\tfor ( let j = 0; j < 2 * ( cols - i ) - 1; j ++ ) {\r\n\r\n\t\t\t\t\tconst k = Math.floor( j / 2 );\r\n\r\n\t\t\t\t\tif ( j % 2 === 0 ) {\r\n\r\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\r\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\r\n\t\t\t\t\t\tpushVertex( v[ i ][ k ] );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\r\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k + 1 ] );\r\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction applyRadius( radius ) {\r\n\r\n\t\t\tconst vertex = new Vector3();\r\n\r\n\t\t\t// iterate over the entire buffer and apply the radius to each vertex\r\n\r\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\r\n\r\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\r\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\r\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\r\n\r\n\t\t\t\tvertex.normalize().multiplyScalar( radius );\r\n\r\n\t\t\t\tvertexBuffer[ i + 0 ] = vertex.x;\r\n\t\t\t\tvertexBuffer[ i + 1 ] = vertex.y;\r\n\t\t\t\tvertexBuffer[ i + 2 ] = vertex.z;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction generateUVs() {\r\n\r\n\t\t\tconst vertex = new Vector3();\r\n\r\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\r\n\r\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\r\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\r\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\r\n\r\n\t\t\t\tconst u = azimuth( vertex ) / 2 / Math.PI + 0.5;\r\n\t\t\t\tconst v = inclination( vertex ) / Math.PI + 0.5;\r\n\t\t\t\tuvBuffer.push( u, 1 - v );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcorrectUVs();\r\n\r\n\t\t\tcorrectSeam();\r\n\r\n\t\t}\r\n\r\n\t\tfunction correctSeam() {\r\n\r\n\t\t\t// handle case when face straddles the seam, see #3269\r\n\r\n\t\t\tfor ( let i = 0; i < uvBuffer.length; i += 6 ) {\r\n\r\n\t\t\t\t// uv data of a single face\r\n\r\n\t\t\t\tconst x0 = uvBuffer[ i + 0 ];\r\n\t\t\t\tconst x1 = uvBuffer[ i + 2 ];\r\n\t\t\t\tconst x2 = uvBuffer[ i + 4 ];\r\n\r\n\t\t\t\tconst max = Math.max( x0, x1, x2 );\r\n\t\t\t\tconst min = Math.min( x0, x1, x2 );\r\n\r\n\t\t\t\t// 0.9 is somewhat arbitrary\r\n\r\n\t\t\t\tif ( max > 0.9 && min < 0.1 ) {\r\n\r\n\t\t\t\t\tif ( x0 < 0.2 ) uvBuffer[ i + 0 ] += 1;\r\n\t\t\t\t\tif ( x1 < 0.2 ) uvBuffer[ i + 2 ] += 1;\r\n\t\t\t\t\tif ( x2 < 0.2 ) uvBuffer[ i + 4 ] += 1;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction pushVertex( vertex ) {\r\n\r\n\t\t\tvertexBuffer.push( vertex.x, vertex.y, vertex.z );\r\n\r\n\t\t}\r\n\r\n\t\tfunction getVertexByIndex( index, vertex ) {\r\n\r\n\t\t\tconst stride = index * 3;\r\n\r\n\t\t\tvertex.x = vertices[ stride + 0 ];\r\n\t\t\tvertex.y = vertices[ stride + 1 ];\r\n\t\t\tvertex.z = vertices[ stride + 2 ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction correctUVs() {\r\n\r\n\t\t\tconst a = new Vector3();\r\n\t\t\tconst b = new Vector3();\r\n\t\t\tconst c = new Vector3();\r\n\r\n\t\t\tconst centroid = new Vector3();\r\n\r\n\t\t\tconst uvA = new Vector2();\r\n\t\t\tconst uvB = new Vector2();\r\n\t\t\tconst uvC = new Vector2();\r\n\r\n\t\t\tfor ( let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6 ) {\r\n\r\n\t\t\t\ta.set( vertexBuffer[ i + 0 ], vertexBuffer[ i + 1 ], vertexBuffer[ i + 2 ] );\r\n\t\t\t\tb.set( vertexBuffer[ i + 3 ], vertexBuffer[ i + 4 ], vertexBuffer[ i + 5 ] );\r\n\t\t\t\tc.set( vertexBuffer[ i + 6 ], vertexBuffer[ i + 7 ], vertexBuffer[ i + 8 ] );\r\n\r\n\t\t\t\tuvA.set( uvBuffer[ j + 0 ], uvBuffer[ j + 1 ] );\r\n\t\t\t\tuvB.set( uvBuffer[ j + 2 ], uvBuffer[ j + 3 ] );\r\n\t\t\t\tuvC.set( uvBuffer[ j + 4 ], uvBuffer[ j + 5 ] );\r\n\r\n\t\t\t\tcentroid.copy( a ).add( b ).add( c ).divideScalar( 3 );\r\n\r\n\t\t\t\tconst azi = azimuth( centroid );\r\n\r\n\t\t\t\tcorrectUV( uvA, j + 0, a, azi );\r\n\t\t\t\tcorrectUV( uvB, j + 2, b, azi );\r\n\t\t\t\tcorrectUV( uvC, j + 4, c, azi );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction correctUV( uv, stride, vector, azimuth ) {\r\n\r\n\t\t\tif ( ( azimuth < 0 ) && ( uv.x === 1 ) ) {\r\n\r\n\t\t\t\tuvBuffer[ stride ] = uv.x - 1;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( ( vector.x === 0 ) && ( vector.z === 0 ) ) {\r\n\r\n\t\t\t\tuvBuffer[ stride ] = azimuth / 2 / Math.PI + 0.5;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// Angle around the Y axis, counter-clockwise when looking from above.\r\n\r\n\t\tfunction azimuth( vector ) {\r\n\r\n\t\t\treturn Math.atan2( vector.z, - vector.x );\r\n\r\n\t\t}\r\n\r\n\r\n\t\t// Angle above the XZ plane.\r\n\r\n\t\tfunction inclination( vector ) {\r\n\r\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.parameters = Object.assign( {}, source.parameters );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data ) {\r\n\r\n\t\treturn new PolyhedronGeometry( data.vertices, data.indices, data.radius, data.details );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass DodecahedronGeometry extends PolyhedronGeometry {\r\n\r\n\tconstructor( radius = 1, detail = 0 ) {\r\n\r\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\r\n\t\tconst r = 1 / t;\r\n\r\n\t\tconst vertices = [\r\n\r\n\t\t\t// (±1, ±1, ±1)\r\n\t\t\t- 1, - 1, - 1,\t- 1, - 1, 1,\r\n\t\t\t- 1, 1, - 1, - 1, 1, 1,\r\n\t\t\t1, - 1, - 1, 1, - 1, 1,\r\n\t\t\t1, 1, - 1, 1, 1, 1,\r\n\r\n\t\t\t// (0, ±1/φ, ±φ)\r\n\t\t\t0, - r, - t, 0, - r, t,\r\n\t\t\t0, r, - t, 0, r, t,\r\n\r\n\t\t\t// (±1/φ, ±φ, 0)\r\n\t\t\t- r, - t, 0, - r, t, 0,\r\n\t\t\tr, - t, 0, r, t, 0,\r\n\r\n\t\t\t// (±φ, 0, ±1/φ)\r\n\t\t\t- t, 0, - r, t, 0, - r,\r\n\t\t\t- t, 0, r, t, 0, r\r\n\t\t];\r\n\r\n\t\tconst indices = [\r\n\t\t\t3, 11, 7, \t3, 7, 15, \t3, 15, 13,\r\n\t\t\t7, 19, 17, \t7, 17, 6, \t7, 6, 15,\r\n\t\t\t17, 4, 8, \t17, 8, 10, \t17, 10, 6,\r\n\t\t\t8, 0, 16, \t8, 16, 2, \t8, 2, 10,\r\n\t\t\t0, 12, 1, \t0, 1, 18, \t0, 18, 16,\r\n\t\t\t6, 10, 2, \t6, 2, 13, \t6, 13, 15,\r\n\t\t\t2, 16, 18, \t2, 18, 3, \t2, 3, 13,\r\n\t\t\t18, 1, 9, \t18, 9, 11, \t18, 11, 3,\r\n\t\t\t4, 14, 12, \t4, 12, 0, \t4, 0, 8,\r\n\t\t\t11, 9, 5, \t11, 5, 19, \t11, 19, 7,\r\n\t\t\t19, 5, 14, \t19, 14, 4, \t19, 4, 17,\r\n\t\t\t1, 12, 14, \t1, 14, 5, \t1, 5, 9\r\n\t\t];\r\n\r\n\t\tsuper( vertices, indices, radius, detail );\r\n\r\n\t\tthis.type = 'DodecahedronGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tradius: radius,\r\n\t\t\tdetail: detail\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data ) {\r\n\r\n\t\treturn new DodecahedronGeometry( data.radius, data.detail );\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _v0 = /*@__PURE__*/ new Vector3();\r\nconst _v1$1 = /*@__PURE__*/ new Vector3();\r\nconst _normal = /*@__PURE__*/ new Vector3();\r\nconst _triangle = /*@__PURE__*/ new Triangle();\r\n\r\nclass EdgesGeometry extends BufferGeometry {\r\n\r\n\tconstructor( geometry = null, thresholdAngle = 1 ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'EdgesGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tgeometry: geometry,\r\n\t\t\tthresholdAngle: thresholdAngle\r\n\t\t};\r\n\r\n\t\tif ( geometry !== null ) {\r\n\r\n\t\t\tconst precisionPoints = 4;\r\n\t\t\tconst precision = Math.pow( 10, precisionPoints );\r\n\t\t\tconst thresholdDot = Math.cos( DEG2RAD * thresholdAngle );\r\n\r\n\t\t\tconst indexAttr = geometry.getIndex();\r\n\t\t\tconst positionAttr = geometry.getAttribute( 'position' );\r\n\t\t\tconst indexCount = indexAttr ? indexAttr.count : positionAttr.count;\r\n\r\n\t\t\tconst indexArr = [ 0, 0, 0 ];\r\n\t\t\tconst vertKeys = [ 'a', 'b', 'c' ];\r\n\t\t\tconst hashes = new Array( 3 );\r\n\r\n\t\t\tconst edgeData = {};\r\n\t\t\tconst vertices = [];\r\n\t\t\tfor ( let i = 0; i < indexCount; i += 3 ) {\r\n\r\n\t\t\t\tif ( indexAttr ) {\r\n\r\n\t\t\t\t\tindexArr[ 0 ] = indexAttr.getX( i );\r\n\t\t\t\t\tindexArr[ 1 ] = indexAttr.getX( i + 1 );\r\n\t\t\t\t\tindexArr[ 2 ] = indexAttr.getX( i + 2 );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tindexArr[ 0 ] = i;\r\n\t\t\t\t\tindexArr[ 1 ] = i + 1;\r\n\t\t\t\t\tindexArr[ 2 ] = i + 2;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst { a, b, c } = _triangle;\r\n\t\t\t\ta.fromBufferAttribute( positionAttr, indexArr[ 0 ] );\r\n\t\t\t\tb.fromBufferAttribute( positionAttr, indexArr[ 1 ] );\r\n\t\t\t\tc.fromBufferAttribute( positionAttr, indexArr[ 2 ] );\r\n\t\t\t\t_triangle.getNormal( _normal );\r\n\r\n\t\t\t\t// create hashes for the edge from the vertices\r\n\t\t\t\thashes[ 0 ] = `${ Math.round( a.x * precision ) },${ Math.round( a.y * precision ) },${ Math.round( a.z * precision ) }`;\r\n\t\t\t\thashes[ 1 ] = `${ Math.round( b.x * precision ) },${ Math.round( b.y * precision ) },${ Math.round( b.z * precision ) }`;\r\n\t\t\t\thashes[ 2 ] = `${ Math.round( c.x * precision ) },${ Math.round( c.y * precision ) },${ Math.round( c.z * precision ) }`;\r\n\r\n\t\t\t\t// skip degenerate triangles\r\n\t\t\t\tif ( hashes[ 0 ] === hashes[ 1 ] || hashes[ 1 ] === hashes[ 2 ] || hashes[ 2 ] === hashes[ 0 ] ) {\r\n\r\n\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// iterate over every edge\r\n\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\r\n\r\n\t\t\t\t\t// get the first and next vertex making up the edge\r\n\t\t\t\t\tconst jNext = ( j + 1 ) % 3;\r\n\t\t\t\t\tconst vecHash0 = hashes[ j ];\r\n\t\t\t\t\tconst vecHash1 = hashes[ jNext ];\r\n\t\t\t\t\tconst v0 = _triangle[ vertKeys[ j ] ];\r\n\t\t\t\t\tconst v1 = _triangle[ vertKeys[ jNext ] ];\r\n\r\n\t\t\t\t\tconst hash = `${ vecHash0 }_${ vecHash1 }`;\r\n\t\t\t\t\tconst reverseHash = `${ vecHash1 }_${ vecHash0 }`;\r\n\r\n\t\t\t\t\tif ( reverseHash in edgeData && edgeData[ reverseHash ] ) {\r\n\r\n\t\t\t\t\t\t// if we found a sibling edge add it into the vertex array if\r\n\t\t\t\t\t\t// it meets the angle threshold and delete the edge from the map.\r\n\t\t\t\t\t\tif ( _normal.dot( edgeData[ reverseHash ].normal ) <= thresholdDot ) {\r\n\r\n\t\t\t\t\t\t\tvertices.push( v0.x, v0.y, v0.z );\r\n\t\t\t\t\t\t\tvertices.push( v1.x, v1.y, v1.z );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tedgeData[ reverseHash ] = null;\r\n\r\n\t\t\t\t\t} else if ( ! ( hash in edgeData ) ) {\r\n\r\n\t\t\t\t\t\t// if we've already got an edge here then skip adding a new one\r\n\t\t\t\t\t\tedgeData[ hash ] = {\r\n\r\n\t\t\t\t\t\t\tindex0: indexArr[ j ],\r\n\t\t\t\t\t\t\tindex1: indexArr[ jNext ],\r\n\t\t\t\t\t\t\tnormal: _normal.clone(),\r\n\r\n\t\t\t\t\t\t};\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// iterate over all remaining, unmatched edges and add them to the vertex array\r\n\t\t\tfor ( const key in edgeData ) {\r\n\r\n\t\t\t\tif ( edgeData[ key ] ) {\r\n\r\n\t\t\t\t\tconst { index0, index1 } = edgeData[ key ];\r\n\t\t\t\t\t_v0.fromBufferAttribute( positionAttr, index0 );\r\n\t\t\t\t\t_v1$1.fromBufferAttribute( positionAttr, index1 );\r\n\r\n\t\t\t\t\tvertices.push( _v0.x, _v0.y, _v0.z );\r\n\t\t\t\t\tvertices.push( _v1$1.x, _v1$1.y, _v1$1.z );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.parameters = Object.assign( {}, source.parameters );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Shape extends Path {\r\n\r\n\tconstructor( points ) {\r\n\r\n\t\tsuper( points );\r\n\r\n\t\tthis.uuid = generateUUID();\r\n\r\n\t\tthis.type = 'Shape';\r\n\r\n\t\tthis.holes = [];\r\n\r\n\t}\r\n\r\n\tgetPointsHoles( divisions ) {\r\n\r\n\t\tconst holesPts = [];\r\n\r\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\r\n\r\n\t\t\tholesPts[ i ] = this.holes[ i ].getPoints( divisions );\r\n\r\n\t\t}\r\n\r\n\t\treturn holesPts;\r\n\r\n\t}\r\n\r\n\t// get points of shape and holes (keypoints based on segments parameter)\r\n\r\n\textractPoints( divisions ) {\r\n\r\n\t\treturn {\r\n\r\n\t\t\tshape: this.getPoints( divisions ),\r\n\t\t\tholes: this.getPointsHoles( divisions )\r\n\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.holes = [];\r\n\r\n\t\tfor ( let i = 0, l = source.holes.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst hole = source.holes[ i ];\r\n\r\n\t\t\tthis.holes.push( hole.clone() );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = super.toJSON();\r\n\r\n\t\tdata.uuid = this.uuid;\r\n\t\tdata.holes = [];\r\n\r\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst hole = this.holes[ i ];\r\n\t\t\tdata.holes.push( hole.toJSON() );\r\n\r\n\t\t}\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n\tfromJSON( json ) {\r\n\r\n\t\tsuper.fromJSON( json );\r\n\r\n\t\tthis.uuid = json.uuid;\r\n\t\tthis.holes = [];\r\n\r\n\t\tfor ( let i = 0, l = json.holes.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst hole = json.holes[ i ];\r\n\t\t\tthis.holes.push( new Path().fromJSON( hole ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Port from https://github.com/mapbox/earcut (v2.2.4)\r\n */\r\n\r\nconst Earcut = {\r\n\r\n\ttriangulate: function ( data, holeIndices, dim = 2 ) {\r\n\r\n\t\tconst hasHoles = holeIndices && holeIndices.length;\r\n\t\tconst outerLen = hasHoles ? holeIndices[ 0 ] * dim : data.length;\r\n\t\tlet outerNode = linkedList( data, 0, outerLen, dim, true );\r\n\t\tconst triangles = [];\r\n\r\n\t\tif ( ! outerNode || outerNode.next === outerNode.prev ) return triangles;\r\n\r\n\t\tlet minX, minY, maxX, maxY, x, y, invSize;\r\n\r\n\t\tif ( hasHoles ) outerNode = eliminateHoles( data, holeIndices, outerNode, dim );\r\n\r\n\t\t// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\r\n\t\tif ( data.length > 80 * dim ) {\r\n\r\n\t\t\tminX = maxX = data[ 0 ];\r\n\t\t\tminY = maxY = data[ 1 ];\r\n\r\n\t\t\tfor ( let i = dim; i < outerLen; i += dim ) {\r\n\r\n\t\t\t\tx = data[ i ];\r\n\t\t\t\ty = data[ i + 1 ];\r\n\t\t\t\tif ( x < minX ) minX = x;\r\n\t\t\t\tif ( y < minY ) minY = y;\r\n\t\t\t\tif ( x > maxX ) maxX = x;\r\n\t\t\t\tif ( y > maxY ) maxY = y;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// minX, minY and invSize are later used to transform coords into integers for z-order calculation\r\n\t\t\tinvSize = Math.max( maxX - minX, maxY - minY );\r\n\t\t\tinvSize = invSize !== 0 ? 32767 / invSize : 0;\r\n\r\n\t\t}\r\n\r\n\t\tearcutLinked( outerNode, triangles, dim, minX, minY, invSize, 0 );\r\n\r\n\t\treturn triangles;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// create a circular doubly linked list from polygon points in the specified winding order\r\nfunction linkedList( data, start, end, dim, clockwise ) {\r\n\r\n\tlet i, last;\r\n\r\n\tif ( clockwise === ( signedArea( data, start, end, dim ) > 0 ) ) {\r\n\r\n\t\tfor ( i = start; i < end; i += dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\r\n\r\n\t} else {\r\n\r\n\t\tfor ( i = end - dim; i >= start; i -= dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\r\n\r\n\t}\r\n\r\n\tif ( last && equals( last, last.next ) ) {\r\n\r\n\t\tremoveNode( last );\r\n\t\tlast = last.next;\r\n\r\n\t}\r\n\r\n\treturn last;\r\n\r\n}\r\n\r\n// eliminate colinear or duplicate points\r\nfunction filterPoints( start, end ) {\r\n\r\n\tif ( ! start ) return start;\r\n\tif ( ! end ) end = start;\r\n\r\n\tlet p = start,\r\n\t\tagain;\r\n\tdo {\r\n\r\n\t\tagain = false;\r\n\r\n\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\r\n\r\n\t\t\tremoveNode( p );\r\n\t\t\tp = end = p.prev;\r\n\t\t\tif ( p === p.next ) break;\r\n\t\t\tagain = true;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tp = p.next;\r\n\r\n\t\t}\r\n\r\n\t} while ( again || p !== end );\r\n\r\n\treturn end;\r\n\r\n}\r\n\r\n// main ear slicing loop which triangulates a polygon (given as a linked list)\r\nfunction earcutLinked( ear, triangles, dim, minX, minY, invSize, pass ) {\r\n\r\n\tif ( ! ear ) return;\r\n\r\n\t// interlink polygon nodes in z-order\r\n\tif ( ! pass && invSize ) indexCurve( ear, minX, minY, invSize );\r\n\r\n\tlet stop = ear,\r\n\t\tprev, next;\r\n\r\n\t// iterate through ears, slicing them one by one\r\n\twhile ( ear.prev !== ear.next ) {\r\n\r\n\t\tprev = ear.prev;\r\n\t\tnext = ear.next;\r\n\r\n\t\tif ( invSize ? isEarHashed( ear, minX, minY, invSize ) : isEar( ear ) ) {\r\n\r\n\t\t\t// cut off the triangle\r\n\t\t\ttriangles.push( prev.i / dim | 0 );\r\n\t\t\ttriangles.push( ear.i / dim | 0 );\r\n\t\t\ttriangles.push( next.i / dim | 0 );\r\n\r\n\t\t\tremoveNode( ear );\r\n\r\n\t\t\t// skipping the next vertex leads to less sliver triangles\r\n\t\t\tear = next.next;\r\n\t\t\tstop = next.next;\r\n\r\n\t\t\tcontinue;\r\n\r\n\t\t}\r\n\r\n\t\tear = next;\r\n\r\n\t\t// if we looped through the whole remaining polygon and can't find any more ears\r\n\t\tif ( ear === stop ) {\r\n\r\n\t\t\t// try filtering points and slicing again\r\n\t\t\tif ( ! pass ) {\r\n\r\n\t\t\t\tearcutLinked( filterPoints( ear ), triangles, dim, minX, minY, invSize, 1 );\r\n\r\n\t\t\t\t// if this didn't work, try curing all small self-intersections locally\r\n\r\n\t\t\t} else if ( pass === 1 ) {\r\n\r\n\t\t\t\tear = cureLocalIntersections( filterPoints( ear ), triangles, dim );\r\n\t\t\t\tearcutLinked( ear, triangles, dim, minX, minY, invSize, 2 );\r\n\r\n\t\t\t\t// as a last resort, try splitting the remaining polygon into two\r\n\r\n\t\t\t} else if ( pass === 2 ) {\r\n\r\n\t\t\t\tsplitEarcut( ear, triangles, dim, minX, minY, invSize );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbreak;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// check whether a polygon node forms a valid ear with adjacent nodes\r\nfunction isEar( ear ) {\r\n\r\n\tconst a = ear.prev,\r\n\t\tb = ear,\r\n\t\tc = ear.next;\r\n\r\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\r\n\r\n\t// now make sure we don't have other points inside the potential ear\r\n\tconst ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\r\n\r\n\t// triangle bbox; min & max are calculated like this for speed\r\n\tconst x0 = ax < bx ? ( ax < cx ? ax : cx ) : ( bx < cx ? bx : cx ),\r\n\t\ty0 = ay < by ? ( ay < cy ? ay : cy ) : ( by < cy ? by : cy ),\r\n\t\tx1 = ax > bx ? ( ax > cx ? ax : cx ) : ( bx > cx ? bx : cx ),\r\n\t\ty1 = ay > by ? ( ay > cy ? ay : cy ) : ( by > cy ? by : cy );\r\n\r\n\tlet p = c.next;\r\n\twhile ( p !== a ) {\r\n\r\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&\r\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) &&\r\n\t\t\tarea( p.prev, p, p.next ) >= 0 ) return false;\r\n\t\tp = p.next;\r\n\r\n\t}\r\n\r\n\treturn true;\r\n\r\n}\r\n\r\nfunction isEarHashed( ear, minX, minY, invSize ) {\r\n\r\n\tconst a = ear.prev,\r\n\t\tb = ear,\r\n\t\tc = ear.next;\r\n\r\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\r\n\r\n\tconst ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\r\n\r\n\t// triangle bbox; min & max are calculated like this for speed\r\n\tconst x0 = ax < bx ? ( ax < cx ? ax : cx ) : ( bx < cx ? bx : cx ),\r\n\t\ty0 = ay < by ? ( ay < cy ? ay : cy ) : ( by < cy ? by : cy ),\r\n\t\tx1 = ax > bx ? ( ax > cx ? ax : cx ) : ( bx > cx ? bx : cx ),\r\n\t\ty1 = ay > by ? ( ay > cy ? ay : cy ) : ( by > cy ? by : cy );\r\n\r\n\t// z-order range for the current triangle bbox;\r\n\tconst minZ = zOrder( x0, y0, minX, minY, invSize ),\r\n\t\tmaxZ = zOrder( x1, y1, minX, minY, invSize );\r\n\r\n\tlet p = ear.prevZ,\r\n\t\tn = ear.nextZ;\r\n\r\n\t// look for points inside the triangle in both directions\r\n\twhile ( p && p.z >= minZ && n && n.z <= maxZ ) {\r\n\r\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\r\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) && area( p.prev, p, p.next ) >= 0 ) return false;\r\n\t\tp = p.prevZ;\r\n\r\n\t\tif ( n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\r\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, n.x, n.y ) && area( n.prev, n, n.next ) >= 0 ) return false;\r\n\t\tn = n.nextZ;\r\n\r\n\t}\r\n\r\n\t// look for remaining points in decreasing z-order\r\n\twhile ( p && p.z >= minZ ) {\r\n\r\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\r\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) && area( p.prev, p, p.next ) >= 0 ) return false;\r\n\t\tp = p.prevZ;\r\n\r\n\t}\r\n\r\n\t// look for remaining points in increasing z-order\r\n\twhile ( n && n.z <= maxZ ) {\r\n\r\n\t\tif ( n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\r\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, n.x, n.y ) && area( n.prev, n, n.next ) >= 0 ) return false;\r\n\t\tn = n.nextZ;\r\n\r\n\t}\r\n\r\n\treturn true;\r\n\r\n}\r\n\r\n// go through all polygon nodes and cure small local self-intersections\r\nfunction cureLocalIntersections( start, triangles, dim ) {\r\n\r\n\tlet p = start;\r\n\tdo {\r\n\r\n\t\tconst a = p.prev,\r\n\t\t\tb = p.next.next;\r\n\r\n\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\r\n\r\n\t\t\ttriangles.push( a.i / dim | 0 );\r\n\t\t\ttriangles.push( p.i / dim | 0 );\r\n\t\t\ttriangles.push( b.i / dim | 0 );\r\n\r\n\t\t\t// remove two nodes involved\r\n\t\t\tremoveNode( p );\r\n\t\t\tremoveNode( p.next );\r\n\r\n\t\t\tp = start = b;\r\n\r\n\t\t}\r\n\r\n\t\tp = p.next;\r\n\r\n\t} while ( p !== start );\r\n\r\n\treturn filterPoints( p );\r\n\r\n}\r\n\r\n// try splitting polygon into two and triangulate them independently\r\nfunction splitEarcut( start, triangles, dim, minX, minY, invSize ) {\r\n\r\n\t// look for a valid diagonal that divides the polygon into two\r\n\tlet a = start;\r\n\tdo {\r\n\r\n\t\tlet b = a.next.next;\r\n\t\twhile ( b !== a.prev ) {\r\n\r\n\t\t\tif ( a.i !== b.i && isValidDiagonal( a, b ) ) {\r\n\r\n\t\t\t\t// split the polygon in two by the diagonal\r\n\t\t\t\tlet c = splitPolygon( a, b );\r\n\r\n\t\t\t\t// filter colinear points around the cuts\r\n\t\t\t\ta = filterPoints( a, a.next );\r\n\t\t\t\tc = filterPoints( c, c.next );\r\n\r\n\t\t\t\t// run earcut on each half\r\n\t\t\t\tearcutLinked( a, triangles, dim, minX, minY, invSize, 0 );\r\n\t\t\t\tearcutLinked( c, triangles, dim, minX, minY, invSize, 0 );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tb = b.next;\r\n\r\n\t\t}\r\n\r\n\t\ta = a.next;\r\n\r\n\t} while ( a !== start );\r\n\r\n}\r\n\r\n// link every hole into the outer loop, producing a single-ring polygon without holes\r\nfunction eliminateHoles( data, holeIndices, outerNode, dim ) {\r\n\r\n\tconst queue = [];\r\n\tlet i, len, start, end, list;\r\n\r\n\tfor ( i = 0, len = holeIndices.length; i < len; i ++ ) {\r\n\r\n\t\tstart = holeIndices[ i ] * dim;\r\n\t\tend = i < len - 1 ? holeIndices[ i + 1 ] * dim : data.length;\r\n\t\tlist = linkedList( data, start, end, dim, false );\r\n\t\tif ( list === list.next ) list.steiner = true;\r\n\t\tqueue.push( getLeftmost( list ) );\r\n\r\n\t}\r\n\r\n\tqueue.sort( compareX );\r\n\r\n\t// process holes from left to right\r\n\tfor ( i = 0; i < queue.length; i ++ ) {\r\n\r\n\t\touterNode = eliminateHole( queue[ i ], outerNode );\r\n\r\n\t}\r\n\r\n\treturn outerNode;\r\n\r\n}\r\n\r\nfunction compareX( a, b ) {\r\n\r\n\treturn a.x - b.x;\r\n\r\n}\r\n\r\n// find a bridge between vertices that connects hole with an outer ring and link it\r\nfunction eliminateHole( hole, outerNode ) {\r\n\r\n\tconst bridge = findHoleBridge( hole, outerNode );\r\n\tif ( ! bridge ) {\r\n\r\n\t\treturn outerNode;\r\n\r\n\t}\r\n\r\n\tconst bridgeReverse = splitPolygon( bridge, hole );\r\n\r\n\t// filter collinear points around the cuts\r\n\tfilterPoints( bridgeReverse, bridgeReverse.next );\r\n\treturn filterPoints( bridge, bridge.next );\r\n\r\n}\r\n\r\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\r\nfunction findHoleBridge( hole, outerNode ) {\r\n\r\n\tlet p = outerNode,\r\n\t\tqx = - Infinity,\r\n\t\tm;\r\n\r\n\tconst hx = hole.x, hy = hole.y;\r\n\r\n\t// find a segment intersected by a ray from the hole's leftmost point to the left;\r\n\t// segment's endpoint with lesser x will be potential connection point\r\n\tdo {\r\n\r\n\t\tif ( hy <= p.y && hy >= p.next.y && p.next.y !== p.y ) {\r\n\r\n\t\t\tconst x = p.x + ( hy - p.y ) * ( p.next.x - p.x ) / ( p.next.y - p.y );\r\n\t\t\tif ( x <= hx && x > qx ) {\r\n\r\n\t\t\t\tqx = x;\r\n\t\t\t\tm = p.x < p.next.x ? p : p.next;\r\n\t\t\t\tif ( x === hx ) return m; // hole touches outer segment; pick leftmost endpoint\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tp = p.next;\r\n\r\n\t} while ( p !== outerNode );\r\n\r\n\tif ( ! m ) return null;\r\n\r\n\t// look for points inside the triangle of hole point, segment intersection and endpoint;\r\n\t// if there are no points found, we have a valid connection;\r\n\t// otherwise choose the point of the minimum angle with the ray as connection point\r\n\r\n\tconst stop = m,\r\n\t\tmx = m.x,\r\n\t\tmy = m.y;\r\n\tlet tanMin = Infinity, tan;\r\n\r\n\tp = m;\r\n\r\n\tdo {\r\n\r\n\t\tif ( hx >= p.x && p.x >= mx && hx !== p.x &&\r\n\t\t\t\tpointInTriangle( hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y ) ) {\r\n\r\n\t\t\ttan = Math.abs( hy - p.y ) / ( hx - p.x ); // tangential\r\n\r\n\t\t\tif ( locallyInside( p, hole ) && ( tan < tanMin || ( tan === tanMin && ( p.x > m.x || ( p.x === m.x && sectorContainsSector( m, p ) ) ) ) ) ) {\r\n\r\n\t\t\t\tm = p;\r\n\t\t\t\ttanMin = tan;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tp = p.next;\r\n\r\n\t} while ( p !== stop );\r\n\r\n\treturn m;\r\n\r\n}\r\n\r\n// whether sector in vertex m contains sector in vertex p in the same coordinates\r\nfunction sectorContainsSector( m, p ) {\r\n\r\n\treturn area( m.prev, m, p.prev ) < 0 && area( p.next, m, m.next ) < 0;\r\n\r\n}\r\n\r\n// interlink polygon nodes in z-order\r\nfunction indexCurve( start, minX, minY, invSize ) {\r\n\r\n\tlet p = start;\r\n\tdo {\r\n\r\n\t\tif ( p.z === 0 ) p.z = zOrder( p.x, p.y, minX, minY, invSize );\r\n\t\tp.prevZ = p.prev;\r\n\t\tp.nextZ = p.next;\r\n\t\tp = p.next;\r\n\r\n\t} while ( p !== start );\r\n\r\n\tp.prevZ.nextZ = null;\r\n\tp.prevZ = null;\r\n\r\n\tsortLinked( p );\r\n\r\n}\r\n\r\n// Simon Tatham's linked list merge sort algorithm\r\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\r\nfunction sortLinked( list ) {\r\n\r\n\tlet i, p, q, e, tail, numMerges, pSize, qSize,\r\n\t\tinSize = 1;\r\n\r\n\tdo {\r\n\r\n\t\tp = list;\r\n\t\tlist = null;\r\n\t\ttail = null;\r\n\t\tnumMerges = 0;\r\n\r\n\t\twhile ( p ) {\r\n\r\n\t\t\tnumMerges ++;\r\n\t\t\tq = p;\r\n\t\t\tpSize = 0;\r\n\t\t\tfor ( i = 0; i < inSize; i ++ ) {\r\n\r\n\t\t\t\tpSize ++;\r\n\t\t\t\tq = q.nextZ;\r\n\t\t\t\tif ( ! q ) break;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tqSize = inSize;\r\n\r\n\t\t\twhile ( pSize > 0 || ( qSize > 0 && q ) ) {\r\n\r\n\t\t\t\tif ( pSize !== 0 && ( qSize === 0 || ! q || p.z <= q.z ) ) {\r\n\r\n\t\t\t\t\te = p;\r\n\t\t\t\t\tp = p.nextZ;\r\n\t\t\t\t\tpSize --;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\te = q;\r\n\t\t\t\t\tq = q.nextZ;\r\n\t\t\t\t\tqSize --;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( tail ) tail.nextZ = e;\r\n\t\t\t\telse list = e;\r\n\r\n\t\t\t\te.prevZ = tail;\r\n\t\t\t\ttail = e;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tp = q;\r\n\r\n\t\t}\r\n\r\n\t\ttail.nextZ = null;\r\n\t\tinSize *= 2;\r\n\r\n\t} while ( numMerges > 1 );\r\n\r\n\treturn list;\r\n\r\n}\r\n\r\n// z-order of a point given coords and inverse of the longer side of data bbox\r\nfunction zOrder( x, y, minX, minY, invSize ) {\r\n\r\n\t// coords are transformed into non-negative 15-bit integer range\r\n\tx = ( x - minX ) * invSize | 0;\r\n\ty = ( y - minY ) * invSize | 0;\r\n\r\n\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\r\n\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\r\n\tx = ( x | ( x << 2 ) ) & 0x33333333;\r\n\tx = ( x | ( x << 1 ) ) & 0x55555555;\r\n\r\n\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\r\n\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\r\n\ty = ( y | ( y << 2 ) ) & 0x33333333;\r\n\ty = ( y | ( y << 1 ) ) & 0x55555555;\r\n\r\n\treturn x | ( y << 1 );\r\n\r\n}\r\n\r\n// find the leftmost node of a polygon ring\r\nfunction getLeftmost( start ) {\r\n\r\n\tlet p = start,\r\n\t\tleftmost = start;\r\n\tdo {\r\n\r\n\t\tif ( p.x < leftmost.x || ( p.x === leftmost.x && p.y < leftmost.y ) ) leftmost = p;\r\n\t\tp = p.next;\r\n\r\n\t} while ( p !== start );\r\n\r\n\treturn leftmost;\r\n\r\n}\r\n\r\n// check if a point lies within a convex triangle\r\nfunction pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\r\n\r\n\treturn ( cx - px ) * ( ay - py ) >= ( ax - px ) * ( cy - py ) &&\r\n ( ax - px ) * ( by - py ) >= ( bx - px ) * ( ay - py ) &&\r\n ( bx - px ) * ( cy - py ) >= ( cx - px ) * ( by - py );\r\n\r\n}\r\n\r\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\r\nfunction isValidDiagonal( a, b ) {\r\n\r\n\treturn a.next.i !== b.i && a.prev.i !== b.i && ! intersectsPolygon( a, b ) && // dones't intersect other edges\r\n ( locallyInside( a, b ) && locallyInside( b, a ) && middleInside( a, b ) && // locally visible\r\n ( area( a.prev, a, b.prev ) || area( a, b.prev, b ) ) || // does not create opposite-facing sectors\r\n equals( a, b ) && area( a.prev, a, a.next ) > 0 && area( b.prev, b, b.next ) > 0 ); // special zero-length case\r\n\r\n}\r\n\r\n// signed area of a triangle\r\nfunction area( p, q, r ) {\r\n\r\n\treturn ( q.y - p.y ) * ( r.x - q.x ) - ( q.x - p.x ) * ( r.y - q.y );\r\n\r\n}\r\n\r\n// check if two points are equal\r\nfunction equals( p1, p2 ) {\r\n\r\n\treturn p1.x === p2.x && p1.y === p2.y;\r\n\r\n}\r\n\r\n// check if two segments intersect\r\nfunction intersects( p1, q1, p2, q2 ) {\r\n\r\n\tconst o1 = sign( area( p1, q1, p2 ) );\r\n\tconst o2 = sign( area( p1, q1, q2 ) );\r\n\tconst o3 = sign( area( p2, q2, p1 ) );\r\n\tconst o4 = sign( area( p2, q2, q1 ) );\r\n\r\n\tif ( o1 !== o2 && o3 !== o4 ) return true; // general case\r\n\r\n\tif ( o1 === 0 && onSegment( p1, p2, q1 ) ) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\r\n\tif ( o2 === 0 && onSegment( p1, q2, q1 ) ) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\r\n\tif ( o3 === 0 && onSegment( p2, p1, q2 ) ) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\r\n\tif ( o4 === 0 && onSegment( p2, q1, q2 ) ) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\r\n\r\n\treturn false;\r\n\r\n}\r\n\r\n// for collinear points p, q, r, check if point q lies on segment pr\r\nfunction onSegment( p, q, r ) {\r\n\r\n\treturn 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 );\r\n\r\n}\r\n\r\nfunction sign( num ) {\r\n\r\n\treturn num > 0 ? 1 : num < 0 ? - 1 : 0;\r\n\r\n}\r\n\r\n// check if a polygon diagonal intersects any polygon segments\r\nfunction intersectsPolygon( a, b ) {\r\n\r\n\tlet p = a;\r\n\tdo {\r\n\r\n\t\tif ( p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\r\n\t\t\tintersects( p, p.next, a, b ) ) return true;\r\n\t\tp = p.next;\r\n\r\n\t} while ( p !== a );\r\n\r\n\treturn false;\r\n\r\n}\r\n\r\n// check if a polygon diagonal is locally inside the polygon\r\nfunction locallyInside( a, b ) {\r\n\r\n\treturn area( a.prev, a, a.next ) < 0 ?\r\n\t\tarea( a, b, a.next ) >= 0 && area( a, a.prev, b ) >= 0 :\r\n\t\tarea( a, b, a.prev ) < 0 || area( a, a.next, b ) < 0;\r\n\r\n}\r\n\r\n// check if the middle point of a polygon diagonal is inside the polygon\r\nfunction middleInside( a, b ) {\r\n\r\n\tlet p = a,\r\n\t\tinside = false;\r\n\tconst px = ( a.x + b.x ) / 2,\r\n\t\tpy = ( a.y + b.y ) / 2;\r\n\tdo {\r\n\r\n\t\tif ( ( ( p.y > py ) !== ( p.next.y > py ) ) && p.next.y !== p.y &&\r\n\t\t\t( px < ( p.next.x - p.x ) * ( py - p.y ) / ( p.next.y - p.y ) + p.x ) )\r\n\t\t\tinside = ! inside;\r\n\t\tp = p.next;\r\n\r\n\t} while ( p !== a );\r\n\r\n\treturn inside;\r\n\r\n}\r\n\r\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\r\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\r\nfunction splitPolygon( a, b ) {\r\n\r\n\tconst a2 = new Node( a.i, a.x, a.y ),\r\n\t\tb2 = new Node( b.i, b.x, b.y ),\r\n\t\tan = a.next,\r\n\t\tbp = b.prev;\r\n\r\n\ta.next = b;\r\n\tb.prev = a;\r\n\r\n\ta2.next = an;\r\n\tan.prev = a2;\r\n\r\n\tb2.next = a2;\r\n\ta2.prev = b2;\r\n\r\n\tbp.next = b2;\r\n\tb2.prev = bp;\r\n\r\n\treturn b2;\r\n\r\n}\r\n\r\n// create a node and optionally link it with previous one (in a circular doubly linked list)\r\nfunction insertNode( i, x, y, last ) {\r\n\r\n\tconst p = new Node( i, x, y );\r\n\r\n\tif ( ! last ) {\r\n\r\n\t\tp.prev = p;\r\n\t\tp.next = p;\r\n\r\n\t} else {\r\n\r\n\t\tp.next = last.next;\r\n\t\tp.prev = last;\r\n\t\tlast.next.prev = p;\r\n\t\tlast.next = p;\r\n\r\n\t}\r\n\r\n\treturn p;\r\n\r\n}\r\n\r\nfunction removeNode( p ) {\r\n\r\n\tp.next.prev = p.prev;\r\n\tp.prev.next = p.next;\r\n\r\n\tif ( p.prevZ ) p.prevZ.nextZ = p.nextZ;\r\n\tif ( p.nextZ ) p.nextZ.prevZ = p.prevZ;\r\n\r\n}\r\n\r\nfunction Node( i, x, y ) {\r\n\r\n\t// vertex index in coordinates array\r\n\tthis.i = i;\r\n\r\n\t// vertex coordinates\r\n\tthis.x = x;\r\n\tthis.y = y;\r\n\r\n\t// previous and next vertex nodes in a polygon ring\r\n\tthis.prev = null;\r\n\tthis.next = null;\r\n\r\n\t// z-order curve value\r\n\tthis.z = 0;\r\n\r\n\t// previous and next nodes in z-order\r\n\tthis.prevZ = null;\r\n\tthis.nextZ = null;\r\n\r\n\t// indicates whether this is a steiner point\r\n\tthis.steiner = false;\r\n\r\n}\r\n\r\nfunction signedArea( data, start, end, dim ) {\r\n\r\n\tlet sum = 0;\r\n\tfor ( let i = start, j = end - dim; i < end; i += dim ) {\r\n\r\n\t\tsum += ( data[ j ] - data[ i ] ) * ( data[ i + 1 ] + data[ j + 1 ] );\r\n\t\tj = i;\r\n\r\n\t}\r\n\r\n\treturn sum;\r\n\r\n}\r\n\r\nclass ShapeUtils {\r\n\r\n\t// calculate area of the contour polygon\r\n\r\n\tstatic area( contour ) {\r\n\r\n\t\tconst n = contour.length;\r\n\t\tlet a = 0.0;\r\n\r\n\t\tfor ( let p = n - 1, q = 0; q < n; p = q ++ ) {\r\n\r\n\t\t\ta += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y;\r\n\r\n\t\t}\r\n\r\n\t\treturn a * 0.5;\r\n\r\n\t}\r\n\r\n\tstatic isClockWise( pts ) {\r\n\r\n\t\treturn ShapeUtils.area( pts ) < 0;\r\n\r\n\t}\r\n\r\n\tstatic triangulateShape( contour, holes ) {\r\n\r\n\t\tconst vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ]\r\n\t\tconst holeIndices = []; // array of hole indices\r\n\t\tconst faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ]\r\n\r\n\t\tremoveDupEndPts( contour );\r\n\t\taddContour( vertices, contour );\r\n\r\n\t\t//\r\n\r\n\t\tlet holeIndex = contour.length;\r\n\r\n\t\tholes.forEach( removeDupEndPts );\r\n\r\n\t\tfor ( let i = 0; i < holes.length; i ++ ) {\r\n\r\n\t\t\tholeIndices.push( holeIndex );\r\n\t\t\tholeIndex += holes[ i ].length;\r\n\t\t\taddContour( vertices, holes[ i ] );\r\n\r\n\t\t}\r\n\r\n\t\t//\r\n\r\n\t\tconst triangles = Earcut.triangulate( vertices, holeIndices );\r\n\r\n\t\t//\r\n\r\n\t\tfor ( let i = 0; i < triangles.length; i += 3 ) {\r\n\r\n\t\t\tfaces.push( triangles.slice( i, i + 3 ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn faces;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction removeDupEndPts( points ) {\r\n\r\n\tconst l = points.length;\r\n\r\n\tif ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) {\r\n\r\n\t\tpoints.pop();\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction addContour( vertices, contour ) {\r\n\r\n\tfor ( let i = 0; i < contour.length; i ++ ) {\r\n\r\n\t\tvertices.push( contour[ i ].x );\r\n\t\tvertices.push( contour[ i ].y );\r\n\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Creates extruded geometry from a path shape.\r\n *\r\n * parameters = {\r\n *\r\n * curveSegments: , // number of points on the curves\r\n * steps: , // number of points for z-side extrusions / used for subdividing segments of extrude spline too\r\n * depth: , // Depth to extrude the shape\r\n *\r\n * bevelEnabled: , // turn on bevel\r\n * bevelThickness: , // how deep into the original shape bevel goes\r\n * bevelSize: , // how far from shape outline (including bevelOffset) is bevel\r\n * bevelOffset: , // how far from shape outline does bevel start\r\n * bevelSegments: , // number of bevel layers\r\n *\r\n * extrudePath: // curve to extrude shape along\r\n *\r\n * UVGenerator: // object that provides UV generator functions\r\n *\r\n * }\r\n */\r\n\r\n\r\nclass ExtrudeGeometry extends BufferGeometry {\r\n\r\n\tconstructor( shapes = new Shape( [ new Vector2( 0.5, 0.5 ), new Vector2( - 0.5, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), options = {} ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'ExtrudeGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tshapes: shapes,\r\n\t\t\toptions: options\r\n\t\t};\r\n\r\n\t\tshapes = Array.isArray( shapes ) ? shapes : [ shapes ];\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\tconst verticesArray = [];\r\n\t\tconst uvArray = [];\r\n\r\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst shape = shapes[ i ];\r\n\t\t\taddShape( shape );\r\n\r\n\t\t}\r\n\r\n\t\t// build geometry\r\n\r\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( verticesArray, 3 ) );\r\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvArray, 2 ) );\r\n\r\n\t\tthis.computeVertexNormals();\r\n\r\n\t\t// functions\r\n\r\n\t\tfunction addShape( shape ) {\r\n\r\n\t\t\tconst placeholder = [];\r\n\r\n\t\t\t// options\r\n\r\n\t\t\tconst curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\r\n\t\t\tconst steps = options.steps !== undefined ? options.steps : 1;\r\n\t\t\tconst depth = options.depth !== undefined ? options.depth : 1;\r\n\r\n\t\t\tlet bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;\r\n\t\t\tlet bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 0.2;\r\n\t\t\tlet bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 0.1;\r\n\t\t\tlet bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;\r\n\t\t\tlet bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;\r\n\r\n\t\t\tconst extrudePath = options.extrudePath;\r\n\r\n\t\t\tconst uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator;\r\n\r\n\t\t\t//\r\n\r\n\t\t\tlet extrudePts, extrudeByPath = false;\r\n\t\t\tlet splineTube, binormal, normal, position2;\r\n\r\n\t\t\tif ( extrudePath ) {\r\n\r\n\t\t\t\textrudePts = extrudePath.getSpacedPoints( steps );\r\n\r\n\t\t\t\textrudeByPath = true;\r\n\t\t\t\tbevelEnabled = false; // bevels not supported for path extrusion\r\n\r\n\t\t\t\t// SETUP TNB variables\r\n\r\n\t\t\t\t// TODO1 - have a .isClosed in spline?\r\n\r\n\t\t\t\tsplineTube = extrudePath.computeFrenetFrames( steps, false );\r\n\r\n\t\t\t\t// console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);\r\n\r\n\t\t\t\tbinormal = new Vector3();\r\n\t\t\t\tnormal = new Vector3();\r\n\t\t\t\tposition2 = new Vector3();\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Safeguards if bevels are not enabled\r\n\r\n\t\t\tif ( ! bevelEnabled ) {\r\n\r\n\t\t\t\tbevelSegments = 0;\r\n\t\t\t\tbevelThickness = 0;\r\n\t\t\t\tbevelSize = 0;\r\n\t\t\t\tbevelOffset = 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Variables initialization\r\n\r\n\t\t\tconst shapePoints = shape.extractPoints( curveSegments );\r\n\r\n\t\t\tlet vertices = shapePoints.shape;\r\n\t\t\tconst holes = shapePoints.holes;\r\n\r\n\t\t\tconst reverse = ! ShapeUtils.isClockWise( vertices );\r\n\r\n\t\t\tif ( reverse ) {\r\n\r\n\t\t\t\tvertices = vertices.reverse();\r\n\r\n\t\t\t\t// Maybe we should also check if holes are in the opposite direction, just to be safe ...\r\n\r\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\t\t\tconst ahole = holes[ h ];\r\n\r\n\t\t\t\t\tif ( ShapeUtils.isClockWise( ahole ) ) {\r\n\r\n\t\t\t\t\t\tholes[ h ] = ahole.reverse();\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst faces = ShapeUtils.triangulateShape( vertices, holes );\r\n\r\n\t\t\t/* Vertices */\r\n\r\n\t\t\tconst contour = vertices; // vertices has all points but contour has only points of circumference\r\n\r\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\t\tconst ahole = holes[ h ];\r\n\r\n\t\t\t\tvertices = vertices.concat( ahole );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tfunction scalePt2( pt, vec, size ) {\r\n\r\n\t\t\t\tif ( ! vec ) console.error( 'THREE.ExtrudeGeometry: vec does not exist' );\r\n\r\n\t\t\t\treturn pt.clone().addScaledVector( vec, size );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst vlen = vertices.length, flen = faces.length;\r\n\r\n\r\n\t\t\t// Find directions for point movement\r\n\r\n\r\n\t\t\tfunction getBevelVec( inPt, inPrev, inNext ) {\r\n\r\n\t\t\t\t// computes for inPt the corresponding point inPt' on a new contour\r\n\t\t\t\t// shifted by 1 unit (length of normalized vector) to the left\r\n\t\t\t\t// if we walk along contour clockwise, this new contour is outside the old one\r\n\t\t\t\t//\r\n\t\t\t\t// inPt' is the intersection of the two lines parallel to the two\r\n\t\t\t\t// adjacent edges of inPt at a distance of 1 unit on the left side.\r\n\r\n\t\t\t\tlet v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt\r\n\r\n\t\t\t\t// good reading for geometry algorithms (here: line-line intersection)\r\n\t\t\t\t// http://geomalgorithms.com/a05-_intersect-1.html\r\n\r\n\t\t\t\tconst v_prev_x = inPt.x - inPrev.x,\r\n\t\t\t\t\tv_prev_y = inPt.y - inPrev.y;\r\n\t\t\t\tconst v_next_x = inNext.x - inPt.x,\r\n\t\t\t\t\tv_next_y = inNext.y - inPt.y;\r\n\r\n\t\t\t\tconst v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y );\r\n\r\n\t\t\t\t// check for collinear edges\r\n\t\t\t\tconst collinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x );\r\n\r\n\t\t\t\tif ( Math.abs( collinear0 ) > Number.EPSILON ) {\r\n\r\n\t\t\t\t\t// not collinear\r\n\r\n\t\t\t\t\t// length of vectors for normalizing\r\n\r\n\t\t\t\t\tconst v_prev_len = Math.sqrt( v_prev_lensq );\r\n\t\t\t\t\tconst v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y );\r\n\r\n\t\t\t\t\t// shift adjacent points by unit vectors to the left\r\n\r\n\t\t\t\t\tconst ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len );\r\n\t\t\t\t\tconst ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len );\r\n\r\n\t\t\t\t\tconst ptNextShift_x = ( inNext.x - v_next_y / v_next_len );\r\n\t\t\t\t\tconst ptNextShift_y = ( inNext.y + v_next_x / v_next_len );\r\n\r\n\t\t\t\t\t// scaling factor for v_prev to intersection point\r\n\r\n\t\t\t\t\tconst sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y -\r\n\t\t\t\t\t\t\t( ptNextShift_y - ptPrevShift_y ) * v_next_x ) /\r\n\t\t\t\t\t\t( v_prev_x * v_next_y - v_prev_y * v_next_x );\r\n\r\n\t\t\t\t\t// vector from inPt to intersection point\r\n\r\n\t\t\t\t\tv_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x );\r\n\t\t\t\t\tv_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y );\r\n\r\n\t\t\t\t\t// Don't normalize!, otherwise sharp corners become ugly\r\n\t\t\t\t\t// but prevent crazy spikes\r\n\t\t\t\t\tconst v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y );\r\n\t\t\t\t\tif ( v_trans_lensq <= 2 ) {\r\n\r\n\t\t\t\t\t\treturn new Vector2( v_trans_x, v_trans_y );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_trans_lensq / 2 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// handle special case of collinear edges\r\n\r\n\t\t\t\t\tlet direction_eq = false; // assumes: opposite\r\n\r\n\t\t\t\t\tif ( v_prev_x > Number.EPSILON ) {\r\n\r\n\t\t\t\t\t\tif ( v_next_x > Number.EPSILON ) {\r\n\r\n\t\t\t\t\t\t\tdirection_eq = true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tif ( v_prev_x < - Number.EPSILON ) {\r\n\r\n\t\t\t\t\t\t\tif ( v_next_x < - Number.EPSILON ) {\r\n\r\n\t\t\t\t\t\t\t\tdirection_eq = true;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tif ( Math.sign( v_prev_y ) === Math.sign( v_next_y ) ) {\r\n\r\n\t\t\t\t\t\t\t\tdirection_eq = true;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( direction_eq ) {\r\n\r\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight sequence\");\r\n\t\t\t\t\t\tv_trans_x = - v_prev_y;\r\n\t\t\t\t\t\tv_trans_y = v_prev_x;\r\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight spike\");\r\n\t\t\t\t\t\tv_trans_x = v_prev_x;\r\n\t\t\t\t\t\tv_trans_y = v_prev_y;\r\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq / 2 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn new Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tconst contourMovements = [];\r\n\r\n\t\t\tfor ( let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\r\n\r\n\t\t\t\tif ( j === il ) j = 0;\r\n\t\t\t\tif ( k === il ) k = 0;\r\n\r\n\t\t\t\t// (j)---(i)---(k)\r\n\t\t\t\t// console.log('i,j,k', i, j , k)\r\n\r\n\t\t\t\tcontourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst holesMovements = [];\r\n\t\t\tlet oneHoleMovements, verticesMovements = contourMovements.concat();\r\n\r\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\t\tconst ahole = holes[ h ];\r\n\r\n\t\t\t\toneHoleMovements = [];\r\n\r\n\t\t\t\tfor ( let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\r\n\r\n\t\t\t\t\tif ( j === il ) j = 0;\r\n\t\t\t\t\tif ( k === il ) k = 0;\r\n\r\n\t\t\t\t\t// (j)---(i)---(k)\r\n\t\t\t\t\toneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tholesMovements.push( oneHoleMovements );\r\n\t\t\t\tverticesMovements = verticesMovements.concat( oneHoleMovements );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\t// Loop bevelSegments, 1 for the front, 1 for the back\r\n\r\n\t\t\tfor ( let b = 0; b < bevelSegments; b ++ ) {\r\n\r\n\t\t\t\t//for ( b = bevelSegments; b > 0; b -- ) {\r\n\r\n\t\t\t\tconst t = b / bevelSegments;\r\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\r\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\r\n\r\n\t\t\t\t// contract shape\r\n\r\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\r\n\r\n\t\t\t\t\tv( vert.x, vert.y, - z );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// expand holes\r\n\r\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\t\t\tconst ahole = holes[ h ];\r\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\r\n\r\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\r\n\r\n\t\t\t\t\t\tv( vert.x, vert.y, - z );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst bs = bevelSize + bevelOffset;\r\n\r\n\t\t\t// Back facing vertices\r\n\r\n\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\r\n\r\n\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\r\n\r\n\t\t\t\tif ( ! extrudeByPath ) {\r\n\r\n\t\t\t\t\tv( vert.x, vert.y, 0 );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );\r\n\r\n\t\t\t\t\tnormal.copy( splineTube.normals[ 0 ] ).multiplyScalar( vert.x );\r\n\t\t\t\t\tbinormal.copy( splineTube.binormals[ 0 ] ).multiplyScalar( vert.y );\r\n\r\n\t\t\t\t\tposition2.copy( extrudePts[ 0 ] ).add( normal ).add( binormal );\r\n\r\n\t\t\t\t\tv( position2.x, position2.y, position2.z );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Add stepped vertices...\r\n\t\t\t// Including front facing vertices\r\n\r\n\t\t\tfor ( let s = 1; s <= steps; s ++ ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\r\n\r\n\t\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\r\n\r\n\t\t\t\t\tif ( ! extrudeByPath ) {\r\n\r\n\t\t\t\t\t\tv( vert.x, vert.y, depth / steps * s );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );\r\n\r\n\t\t\t\t\t\tnormal.copy( splineTube.normals[ s ] ).multiplyScalar( vert.x );\r\n\t\t\t\t\t\tbinormal.copy( splineTube.binormals[ s ] ).multiplyScalar( vert.y );\r\n\r\n\t\t\t\t\t\tposition2.copy( extrudePts[ s ] ).add( normal ).add( binormal );\r\n\r\n\t\t\t\t\t\tv( position2.x, position2.y, position2.z );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\t// Add bevel segments planes\r\n\r\n\t\t\t//for ( b = 1; b <= bevelSegments; b ++ ) {\r\n\t\t\tfor ( let b = bevelSegments - 1; b >= 0; b -- ) {\r\n\r\n\t\t\t\tconst t = b / bevelSegments;\r\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\r\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\r\n\r\n\t\t\t\t// contract shape\r\n\r\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\r\n\t\t\t\t\tv( vert.x, vert.y, depth + z );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// expand holes\r\n\r\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\t\t\tconst ahole = holes[ h ];\r\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\r\n\r\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\r\n\r\n\t\t\t\t\t\tif ( ! extrudeByPath ) {\r\n\r\n\t\t\t\t\t\t\tv( vert.x, vert.y, depth + z );\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tv( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t/* Faces */\r\n\r\n\t\t\t// Top and bottom faces\r\n\r\n\t\t\tbuildLidFaces();\r\n\r\n\t\t\t// Sides faces\r\n\r\n\t\t\tbuildSideFaces();\r\n\r\n\r\n\t\t\t///// Internal functions\r\n\r\n\t\t\tfunction buildLidFaces() {\r\n\r\n\t\t\t\tconst start = verticesArray.length / 3;\r\n\r\n\t\t\t\tif ( bevelEnabled ) {\r\n\r\n\t\t\t\t\tlet layer = 0; // steps + 1\r\n\t\t\t\t\tlet offset = vlen * layer;\r\n\r\n\t\t\t\t\t// Bottom faces\r\n\r\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\r\n\r\n\t\t\t\t\t\tconst face = faces[ i ];\r\n\t\t\t\t\t\tf3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tlayer = steps + bevelSegments * 2;\r\n\t\t\t\t\toffset = vlen * layer;\r\n\r\n\t\t\t\t\t// Top faces\r\n\r\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\r\n\r\n\t\t\t\t\t\tconst face = faces[ i ];\r\n\t\t\t\t\t\tf3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// Bottom faces\r\n\r\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\r\n\r\n\t\t\t\t\t\tconst face = faces[ i ];\r\n\t\t\t\t\t\tf3( face[ 2 ], face[ 1 ], face[ 0 ] );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Top faces\r\n\r\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\r\n\r\n\t\t\t\t\t\tconst face = faces[ i ];\r\n\t\t\t\t\t\tf3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Create faces for the z-sides of the shape\r\n\r\n\t\t\tfunction buildSideFaces() {\r\n\r\n\t\t\t\tconst start = verticesArray.length / 3;\r\n\t\t\t\tlet layeroffset = 0;\r\n\t\t\t\tsidewalls( contour, layeroffset );\r\n\t\t\t\tlayeroffset += contour.length;\r\n\r\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\t\t\tconst ahole = holes[ h ];\r\n\t\t\t\t\tsidewalls( ahole, layeroffset );\r\n\r\n\t\t\t\t\t//, true\r\n\t\t\t\t\tlayeroffset += ahole.length;\r\n\r\n\t\t\t\t}\r\n\r\n\r\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\r\n\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfunction sidewalls( contour, layeroffset ) {\r\n\r\n\t\t\t\tlet i = contour.length;\r\n\r\n\t\t\t\twhile ( -- i >= 0 ) {\r\n\r\n\t\t\t\t\tconst j = i;\r\n\t\t\t\t\tlet k = i - 1;\r\n\t\t\t\t\tif ( k < 0 ) k = contour.length - 1;\r\n\r\n\t\t\t\t\t//console.log('b', i,j, i-1, k,vertices.length);\r\n\r\n\t\t\t\t\tfor ( let s = 0, sl = ( steps + bevelSegments * 2 ); s < sl; s ++ ) {\r\n\r\n\t\t\t\t\t\tconst slen1 = vlen * s;\r\n\t\t\t\t\t\tconst slen2 = vlen * ( s + 1 );\r\n\r\n\t\t\t\t\t\tconst a = layeroffset + j + slen1,\r\n\t\t\t\t\t\t\tb = layeroffset + k + slen1,\r\n\t\t\t\t\t\t\tc = layeroffset + k + slen2,\r\n\t\t\t\t\t\t\td = layeroffset + j + slen2;\r\n\r\n\t\t\t\t\t\tf4( a, b, c, d );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfunction v( x, y, z ) {\r\n\r\n\t\t\t\tplaceholder.push( x );\r\n\t\t\t\tplaceholder.push( y );\r\n\t\t\t\tplaceholder.push( z );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tfunction f3( a, b, c ) {\r\n\r\n\t\t\t\taddVertex( a );\r\n\t\t\t\taddVertex( b );\r\n\t\t\t\taddVertex( c );\r\n\r\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\r\n\t\t\t\tconst uvs = uvgen.generateTopUV( scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\r\n\r\n\t\t\t\taddUV( uvs[ 0 ] );\r\n\t\t\t\taddUV( uvs[ 1 ] );\r\n\t\t\t\taddUV( uvs[ 2 ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfunction f4( a, b, c, d ) {\r\n\r\n\t\t\t\taddVertex( a );\r\n\t\t\t\taddVertex( b );\r\n\t\t\t\taddVertex( d );\r\n\r\n\t\t\t\taddVertex( b );\r\n\t\t\t\taddVertex( c );\r\n\t\t\t\taddVertex( d );\r\n\r\n\r\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\r\n\t\t\t\tconst uvs = uvgen.generateSideWallUV( scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\r\n\r\n\t\t\t\taddUV( uvs[ 0 ] );\r\n\t\t\t\taddUV( uvs[ 1 ] );\r\n\t\t\t\taddUV( uvs[ 3 ] );\r\n\r\n\t\t\t\taddUV( uvs[ 1 ] );\r\n\t\t\t\taddUV( uvs[ 2 ] );\r\n\t\t\t\taddUV( uvs[ 3 ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfunction addVertex( index ) {\r\n\r\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 0 ] );\r\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 1 ] );\r\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 2 ] );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tfunction addUV( vector2 ) {\r\n\r\n\t\t\t\tuvArray.push( vector2.x );\r\n\t\t\t\tuvArray.push( vector2.y );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.parameters = Object.assign( {}, source.parameters );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = super.toJSON();\r\n\r\n\t\tconst shapes = this.parameters.shapes;\r\n\t\tconst options = this.parameters.options;\r\n\r\n\t\treturn toJSON$1( shapes, options, data );\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data, shapes ) {\r\n\r\n\t\tconst geometryShapes = [];\r\n\r\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\r\n\r\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\r\n\r\n\t\t\tgeometryShapes.push( shape );\r\n\r\n\t\t}\r\n\r\n\t\tconst extrudePath = data.options.extrudePath;\r\n\r\n\t\tif ( extrudePath !== undefined ) {\r\n\r\n\t\t\tdata.options.extrudePath = new Curves[ extrudePath.type ]().fromJSON( extrudePath );\r\n\r\n\t\t}\r\n\r\n\t\treturn new ExtrudeGeometry( geometryShapes, data.options );\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst WorldUVGenerator = {\r\n\r\n\tgenerateTopUV: function ( geometry, vertices, indexA, indexB, indexC ) {\r\n\r\n\t\tconst a_x = vertices[ indexA * 3 ];\r\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\r\n\t\tconst b_x = vertices[ indexB * 3 ];\r\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\r\n\t\tconst c_x = vertices[ indexC * 3 ];\r\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\r\n\r\n\t\treturn [\r\n\t\t\tnew Vector2( a_x, a_y ),\r\n\t\t\tnew Vector2( b_x, b_y ),\r\n\t\t\tnew Vector2( c_x, c_y )\r\n\t\t];\r\n\r\n\t},\r\n\r\n\tgenerateSideWallUV: function ( geometry, vertices, indexA, indexB, indexC, indexD ) {\r\n\r\n\t\tconst a_x = vertices[ indexA * 3 ];\r\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\r\n\t\tconst a_z = vertices[ indexA * 3 + 2 ];\r\n\t\tconst b_x = vertices[ indexB * 3 ];\r\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\r\n\t\tconst b_z = vertices[ indexB * 3 + 2 ];\r\n\t\tconst c_x = vertices[ indexC * 3 ];\r\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\r\n\t\tconst c_z = vertices[ indexC * 3 + 2 ];\r\n\t\tconst d_x = vertices[ indexD * 3 ];\r\n\t\tconst d_y = vertices[ indexD * 3 + 1 ];\r\n\t\tconst d_z = vertices[ indexD * 3 + 2 ];\r\n\r\n\t\tif ( Math.abs( a_y - b_y ) < Math.abs( a_x - b_x ) ) {\r\n\r\n\t\t\treturn [\r\n\t\t\t\tnew Vector2( a_x, 1 - a_z ),\r\n\t\t\t\tnew Vector2( b_x, 1 - b_z ),\r\n\t\t\t\tnew Vector2( c_x, 1 - c_z ),\r\n\t\t\t\tnew Vector2( d_x, 1 - d_z )\r\n\t\t\t];\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn [\r\n\t\t\t\tnew Vector2( a_y, 1 - a_z ),\r\n\t\t\t\tnew Vector2( b_y, 1 - b_z ),\r\n\t\t\t\tnew Vector2( c_y, 1 - c_z ),\r\n\t\t\t\tnew Vector2( d_y, 1 - d_z )\r\n\t\t\t];\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\nfunction toJSON$1( shapes, options, data ) {\r\n\r\n\tdata.shapes = [];\r\n\r\n\tif ( Array.isArray( shapes ) ) {\r\n\r\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst shape = shapes[ i ];\r\n\r\n\t\t\tdata.shapes.push( shape.uuid );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\tdata.shapes.push( shapes.uuid );\r\n\r\n\t}\r\n\r\n\tdata.options = Object.assign( {}, options );\r\n\r\n\tif ( options.extrudePath !== undefined ) data.options.extrudePath = options.extrudePath.toJSON();\r\n\r\n\treturn data;\r\n\r\n}\r\n\r\nclass IcosahedronGeometry extends PolyhedronGeometry {\r\n\r\n\tconstructor( radius = 1, detail = 0 ) {\r\n\r\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\r\n\r\n\t\tconst vertices = [\r\n\t\t\t- 1, t, 0, \t1, t, 0, \t- 1, - t, 0, \t1, - t, 0,\r\n\t\t\t0, - 1, t, \t0, 1, t,\t0, - 1, - t, \t0, 1, - t,\r\n\t\t\tt, 0, - 1, \tt, 0, 1, \t- t, 0, - 1, \t- t, 0, 1\r\n\t\t];\r\n\r\n\t\tconst indices = [\r\n\t\t\t0, 11, 5, \t0, 5, 1, \t0, 1, 7, \t0, 7, 10, \t0, 10, 11,\r\n\t\t\t1, 5, 9, \t5, 11, 4,\t11, 10, 2,\t10, 7, 6,\t7, 1, 8,\r\n\t\t\t3, 9, 4, \t3, 4, 2,\t3, 2, 6,\t3, 6, 8,\t3, 8, 9,\r\n\t\t\t4, 9, 5, \t2, 4, 11,\t6, 2, 10,\t8, 6, 7,\t9, 8, 1\r\n\t\t];\r\n\r\n\t\tsuper( vertices, indices, radius, detail );\r\n\r\n\t\tthis.type = 'IcosahedronGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tradius: radius,\r\n\t\t\tdetail: detail\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data ) {\r\n\r\n\t\treturn new IcosahedronGeometry( data.radius, data.detail );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass OctahedronGeometry extends PolyhedronGeometry {\r\n\r\n\tconstructor( radius = 1, detail = 0 ) {\r\n\r\n\t\tconst vertices = [\r\n\t\t\t1, 0, 0, \t- 1, 0, 0,\t0, 1, 0,\r\n\t\t\t0, - 1, 0, \t0, 0, 1,\t0, 0, - 1\r\n\t\t];\r\n\r\n\t\tconst indices = [\r\n\t\t\t0, 2, 4,\t0, 4, 3,\t0, 3, 5,\r\n\t\t\t0, 5, 2,\t1, 2, 5,\t1, 5, 3,\r\n\t\t\t1, 3, 4,\t1, 4, 2\r\n\t\t];\r\n\r\n\t\tsuper( vertices, indices, radius, detail );\r\n\r\n\t\tthis.type = 'OctahedronGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tradius: radius,\r\n\t\t\tdetail: detail\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data ) {\r\n\r\n\t\treturn new OctahedronGeometry( data.radius, data.detail );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass RingGeometry extends BufferGeometry {\r\n\r\n\tconstructor( innerRadius = 0.5, outerRadius = 1, thetaSegments = 32, phiSegments = 1, thetaStart = 0, thetaLength = Math.PI * 2 ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'RingGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tinnerRadius: innerRadius,\r\n\t\t\touterRadius: outerRadius,\r\n\t\t\tthetaSegments: thetaSegments,\r\n\t\t\tphiSegments: phiSegments,\r\n\t\t\tthetaStart: thetaStart,\r\n\t\t\tthetaLength: thetaLength\r\n\t\t};\r\n\r\n\t\tthetaSegments = Math.max( 3, thetaSegments );\r\n\t\tphiSegments = Math.max( 1, phiSegments );\r\n\r\n\t\t// buffers\r\n\r\n\t\tconst indices = [];\r\n\t\tconst vertices = [];\r\n\t\tconst normals = [];\r\n\t\tconst uvs = [];\r\n\r\n\t\t// some helper variables\r\n\r\n\t\tlet radius = innerRadius;\r\n\t\tconst radiusStep = ( ( outerRadius - innerRadius ) / phiSegments );\r\n\t\tconst vertex = new Vector3();\r\n\t\tconst uv = new Vector2();\r\n\r\n\t\t// generate vertices, normals and uvs\r\n\r\n\t\tfor ( let j = 0; j <= phiSegments; j ++ ) {\r\n\r\n\t\t\tfor ( let i = 0; i <= thetaSegments; i ++ ) {\r\n\r\n\t\t\t\t// values are generate from the inside of the ring to the outside\r\n\r\n\t\t\t\tconst segment = thetaStart + i / thetaSegments * thetaLength;\r\n\r\n\t\t\t\t// vertex\r\n\r\n\t\t\t\tvertex.x = radius * Math.cos( segment );\r\n\t\t\t\tvertex.y = radius * Math.sin( segment );\r\n\r\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\r\n\r\n\t\t\t\t// normal\r\n\r\n\t\t\t\tnormals.push( 0, 0, 1 );\r\n\r\n\t\t\t\t// uv\r\n\r\n\t\t\t\tuv.x = ( vertex.x / outerRadius + 1 ) / 2;\r\n\t\t\t\tuv.y = ( vertex.y / outerRadius + 1 ) / 2;\r\n\r\n\t\t\t\tuvs.push( uv.x, uv.y );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// increase the radius for next row of vertices\r\n\r\n\t\t\tradius += radiusStep;\r\n\r\n\t\t}\r\n\r\n\t\t// indices\r\n\r\n\t\tfor ( let j = 0; j < phiSegments; j ++ ) {\r\n\r\n\t\t\tconst thetaSegmentLevel = j * ( thetaSegments + 1 );\r\n\r\n\t\t\tfor ( let i = 0; i < thetaSegments; i ++ ) {\r\n\r\n\t\t\t\tconst segment = i + thetaSegmentLevel;\r\n\r\n\t\t\t\tconst a = segment;\r\n\t\t\t\tconst b = segment + thetaSegments + 1;\r\n\t\t\t\tconst c = segment + thetaSegments + 2;\r\n\t\t\t\tconst d = segment + 1;\r\n\r\n\t\t\t\t// faces\r\n\r\n\t\t\t\tindices.push( a, b, d );\r\n\t\t\t\tindices.push( b, c, d );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// build geometry\r\n\r\n\t\tthis.setIndex( indices );\r\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\r\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.parameters = Object.assign( {}, source.parameters );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data ) {\r\n\r\n\t\treturn new RingGeometry( data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass ShapeGeometry extends BufferGeometry {\r\n\r\n\tconstructor( shapes = new Shape( [ new Vector2( 0, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), curveSegments = 12 ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'ShapeGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tshapes: shapes,\r\n\t\t\tcurveSegments: curveSegments\r\n\t\t};\r\n\r\n\t\t// buffers\r\n\r\n\t\tconst indices = [];\r\n\t\tconst vertices = [];\r\n\t\tconst normals = [];\r\n\t\tconst uvs = [];\r\n\r\n\t\t// helper variables\r\n\r\n\t\tlet groupStart = 0;\r\n\t\tlet groupCount = 0;\r\n\r\n\t\t// allow single and array values for \"shapes\" parameter\r\n\r\n\t\tif ( Array.isArray( shapes ) === false ) {\r\n\r\n\t\t\taddShape( shapes );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tfor ( let i = 0; i < shapes.length; i ++ ) {\r\n\r\n\t\t\t\taddShape( shapes[ i ] );\r\n\r\n\t\t\t\tthis.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support\r\n\r\n\t\t\t\tgroupStart += groupCount;\r\n\t\t\t\tgroupCount = 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// build geometry\r\n\r\n\t\tthis.setIndex( indices );\r\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\r\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\r\n\r\n\r\n\t\t// helper functions\r\n\r\n\t\tfunction addShape( shape ) {\r\n\r\n\t\t\tconst indexOffset = vertices.length / 3;\r\n\t\t\tconst points = shape.extractPoints( curveSegments );\r\n\r\n\t\t\tlet shapeVertices = points.shape;\r\n\t\t\tconst shapeHoles = points.holes;\r\n\r\n\t\t\t// check direction of vertices\r\n\r\n\t\t\tif ( ShapeUtils.isClockWise( shapeVertices ) === false ) {\r\n\r\n\t\t\t\tshapeVertices = shapeVertices.reverse();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\r\n\r\n\t\t\t\tif ( ShapeUtils.isClockWise( shapeHole ) === true ) {\r\n\r\n\t\t\t\t\tshapeHoles[ i ] = shapeHole.reverse();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst faces = ShapeUtils.triangulateShape( shapeVertices, shapeHoles );\r\n\r\n\t\t\t// join vertices of inner and outer paths to a single array\r\n\r\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\r\n\t\t\t\tshapeVertices = shapeVertices.concat( shapeHole );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// vertices, normals, uvs\r\n\r\n\t\t\tfor ( let i = 0, l = shapeVertices.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tconst vertex = shapeVertices[ i ];\r\n\r\n\t\t\t\tvertices.push( vertex.x, vertex.y, 0 );\r\n\t\t\t\tnormals.push( 0, 0, 1 );\r\n\t\t\t\tuvs.push( vertex.x, vertex.y ); // world uvs\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// indices\r\n\r\n\t\t\tfor ( let i = 0, l = faces.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tconst face = faces[ i ];\r\n\r\n\t\t\t\tconst a = face[ 0 ] + indexOffset;\r\n\t\t\t\tconst b = face[ 1 ] + indexOffset;\r\n\t\t\t\tconst c = face[ 2 ] + indexOffset;\r\n\r\n\t\t\t\tindices.push( a, b, c );\r\n\t\t\t\tgroupCount += 3;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.parameters = Object.assign( {}, source.parameters );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = super.toJSON();\r\n\r\n\t\tconst shapes = this.parameters.shapes;\r\n\r\n\t\treturn toJSON( shapes, data );\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data, shapes ) {\r\n\r\n\t\tconst geometryShapes = [];\r\n\r\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\r\n\r\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\r\n\r\n\t\t\tgeometryShapes.push( shape );\r\n\r\n\t\t}\r\n\r\n\t\treturn new ShapeGeometry( geometryShapes, data.curveSegments );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction toJSON( shapes, data ) {\r\n\r\n\tdata.shapes = [];\r\n\r\n\tif ( Array.isArray( shapes ) ) {\r\n\r\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst shape = shapes[ i ];\r\n\r\n\t\t\tdata.shapes.push( shape.uuid );\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\tdata.shapes.push( shapes.uuid );\r\n\r\n\t}\r\n\r\n\treturn data;\r\n\r\n}\r\n\r\nclass SphereGeometry extends BufferGeometry {\r\n\r\n\tconstructor( radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'SphereGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tradius: radius,\r\n\t\t\twidthSegments: widthSegments,\r\n\t\t\theightSegments: heightSegments,\r\n\t\t\tphiStart: phiStart,\r\n\t\t\tphiLength: phiLength,\r\n\t\t\tthetaStart: thetaStart,\r\n\t\t\tthetaLength: thetaLength\r\n\t\t};\r\n\r\n\t\twidthSegments = Math.max( 3, Math.floor( widthSegments ) );\r\n\t\theightSegments = Math.max( 2, Math.floor( heightSegments ) );\r\n\r\n\t\tconst thetaEnd = Math.min( thetaStart + thetaLength, Math.PI );\r\n\r\n\t\tlet index = 0;\r\n\t\tconst grid = [];\r\n\r\n\t\tconst vertex = new Vector3();\r\n\t\tconst normal = new Vector3();\r\n\r\n\t\t// buffers\r\n\r\n\t\tconst indices = [];\r\n\t\tconst vertices = [];\r\n\t\tconst normals = [];\r\n\t\tconst uvs = [];\r\n\r\n\t\t// generate vertices, normals and uvs\r\n\r\n\t\tfor ( let iy = 0; iy <= heightSegments; iy ++ ) {\r\n\r\n\t\t\tconst verticesRow = [];\r\n\r\n\t\t\tconst v = iy / heightSegments;\r\n\r\n\t\t\t// special case for the poles\r\n\r\n\t\t\tlet uOffset = 0;\r\n\r\n\t\t\tif ( iy === 0 && thetaStart === 0 ) {\r\n\r\n\t\t\t\tuOffset = 0.5 / widthSegments;\r\n\r\n\t\t\t} else if ( iy === heightSegments && thetaEnd === Math.PI ) {\r\n\r\n\t\t\t\tuOffset = - 0.5 / widthSegments;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( let ix = 0; ix <= widthSegments; ix ++ ) {\r\n\r\n\t\t\t\tconst u = ix / widthSegments;\r\n\r\n\t\t\t\t// vertex\r\n\r\n\t\t\t\tvertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\r\n\t\t\t\tvertex.y = radius * Math.cos( thetaStart + v * thetaLength );\r\n\t\t\t\tvertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\r\n\r\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\r\n\r\n\t\t\t\t// normal\r\n\r\n\t\t\t\tnormal.copy( vertex ).normalize();\r\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\r\n\r\n\t\t\t\t// uv\r\n\r\n\t\t\t\tuvs.push( u + uOffset, 1 - v );\r\n\r\n\t\t\t\tverticesRow.push( index ++ );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgrid.push( verticesRow );\r\n\r\n\t\t}\r\n\r\n\t\t// indices\r\n\r\n\t\tfor ( let iy = 0; iy < heightSegments; iy ++ ) {\r\n\r\n\t\t\tfor ( let ix = 0; ix < widthSegments; ix ++ ) {\r\n\r\n\t\t\t\tconst a = grid[ iy ][ ix + 1 ];\r\n\t\t\t\tconst b = grid[ iy ][ ix ];\r\n\t\t\t\tconst c = grid[ iy + 1 ][ ix ];\r\n\t\t\t\tconst d = grid[ iy + 1 ][ ix + 1 ];\r\n\r\n\t\t\t\tif ( iy !== 0 || thetaStart > 0 ) indices.push( a, b, d );\r\n\t\t\t\tif ( iy !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( b, c, d );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// build geometry\r\n\r\n\t\tthis.setIndex( indices );\r\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\r\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.parameters = Object.assign( {}, source.parameters );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data ) {\r\n\r\n\t\treturn new SphereGeometry( data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass TetrahedronGeometry extends PolyhedronGeometry {\r\n\r\n\tconstructor( radius = 1, detail = 0 ) {\r\n\r\n\t\tconst vertices = [\r\n\t\t\t1, 1, 1, \t- 1, - 1, 1, \t- 1, 1, - 1, \t1, - 1, - 1\r\n\t\t];\r\n\r\n\t\tconst indices = [\r\n\t\t\t2, 1, 0, \t0, 3, 2,\t1, 3, 0,\t2, 3, 1\r\n\t\t];\r\n\r\n\t\tsuper( vertices, indices, radius, detail );\r\n\r\n\t\tthis.type = 'TetrahedronGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tradius: radius,\r\n\t\t\tdetail: detail\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data ) {\r\n\r\n\t\treturn new TetrahedronGeometry( data.radius, data.detail );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass TorusGeometry extends BufferGeometry {\r\n\r\n\tconstructor( radius = 1, tube = 0.4, radialSegments = 12, tubularSegments = 48, arc = Math.PI * 2 ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'TorusGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tradius: radius,\r\n\t\t\ttube: tube,\r\n\t\t\tradialSegments: radialSegments,\r\n\t\t\ttubularSegments: tubularSegments,\r\n\t\t\tarc: arc\r\n\t\t};\r\n\r\n\t\tradialSegments = Math.floor( radialSegments );\r\n\t\ttubularSegments = Math.floor( tubularSegments );\r\n\r\n\t\t// buffers\r\n\r\n\t\tconst indices = [];\r\n\t\tconst vertices = [];\r\n\t\tconst normals = [];\r\n\t\tconst uvs = [];\r\n\r\n\t\t// helper variables\r\n\r\n\t\tconst center = new Vector3();\r\n\t\tconst vertex = new Vector3();\r\n\t\tconst normal = new Vector3();\r\n\r\n\t\t// generate vertices, normals and uvs\r\n\r\n\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\r\n\r\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\r\n\r\n\t\t\t\tconst u = i / tubularSegments * arc;\r\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\r\n\r\n\t\t\t\t// vertex\r\n\r\n\t\t\t\tvertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u );\r\n\t\t\t\tvertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u );\r\n\t\t\t\tvertex.z = tube * Math.sin( v );\r\n\r\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\r\n\r\n\t\t\t\t// normal\r\n\r\n\t\t\t\tcenter.x = radius * Math.cos( u );\r\n\t\t\t\tcenter.y = radius * Math.sin( u );\r\n\t\t\t\tnormal.subVectors( vertex, center ).normalize();\r\n\r\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\r\n\r\n\t\t\t\t// uv\r\n\r\n\t\t\t\tuvs.push( i / tubularSegments );\r\n\t\t\t\tuvs.push( j / radialSegments );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// generate indices\r\n\r\n\t\tfor ( let j = 1; j <= radialSegments; j ++ ) {\r\n\r\n\t\t\tfor ( let i = 1; i <= tubularSegments; i ++ ) {\r\n\r\n\t\t\t\t// indices\r\n\r\n\t\t\t\tconst a = ( tubularSegments + 1 ) * j + i - 1;\r\n\t\t\t\tconst b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1;\r\n\t\t\t\tconst c = ( tubularSegments + 1 ) * ( j - 1 ) + i;\r\n\t\t\t\tconst d = ( tubularSegments + 1 ) * j + i;\r\n\r\n\t\t\t\t// faces\r\n\r\n\t\t\t\tindices.push( a, b, d );\r\n\t\t\t\tindices.push( b, c, d );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// build geometry\r\n\r\n\t\tthis.setIndex( indices );\r\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\r\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.parameters = Object.assign( {}, source.parameters );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data ) {\r\n\r\n\t\treturn new TorusGeometry( data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass TorusKnotGeometry extends BufferGeometry {\r\n\r\n\tconstructor( radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3 ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'TorusKnotGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tradius: radius,\r\n\t\t\ttube: tube,\r\n\t\t\ttubularSegments: tubularSegments,\r\n\t\t\tradialSegments: radialSegments,\r\n\t\t\tp: p,\r\n\t\t\tq: q\r\n\t\t};\r\n\r\n\t\ttubularSegments = Math.floor( tubularSegments );\r\n\t\tradialSegments = Math.floor( radialSegments );\r\n\r\n\t\t// buffers\r\n\r\n\t\tconst indices = [];\r\n\t\tconst vertices = [];\r\n\t\tconst normals = [];\r\n\t\tconst uvs = [];\r\n\r\n\t\t// helper variables\r\n\r\n\t\tconst vertex = new Vector3();\r\n\t\tconst normal = new Vector3();\r\n\r\n\t\tconst P1 = new Vector3();\r\n\t\tconst P2 = new Vector3();\r\n\r\n\t\tconst B = new Vector3();\r\n\t\tconst T = new Vector3();\r\n\t\tconst N = new Vector3();\r\n\r\n\t\t// generate vertices, normals and uvs\r\n\r\n\t\tfor ( let i = 0; i <= tubularSegments; ++ i ) {\r\n\r\n\t\t\t// the radian \"u\" is used to calculate the position on the torus curve of the current tubular segment\r\n\r\n\t\t\tconst u = i / tubularSegments * p * Math.PI * 2;\r\n\r\n\t\t\t// now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead.\r\n\t\t\t// these points are used to create a special \"coordinate space\", which is necessary to calculate the correct vertex positions\r\n\r\n\t\t\tcalculatePositionOnCurve( u, p, q, radius, P1 );\r\n\t\t\tcalculatePositionOnCurve( u + 0.01, p, q, radius, P2 );\r\n\r\n\t\t\t// calculate orthonormal basis\r\n\r\n\t\t\tT.subVectors( P2, P1 );\r\n\t\t\tN.addVectors( P2, P1 );\r\n\t\t\tB.crossVectors( T, N );\r\n\t\t\tN.crossVectors( B, T );\r\n\r\n\t\t\t// normalize B, N. T can be ignored, we don't use it\r\n\r\n\t\t\tB.normalize();\r\n\t\t\tN.normalize();\r\n\r\n\t\t\tfor ( let j = 0; j <= radialSegments; ++ j ) {\r\n\r\n\t\t\t\t// now calculate the vertices. they are nothing more than an extrusion of the torus curve.\r\n\t\t\t\t// because we extrude a shape in the xy-plane, there is no need to calculate a z-value.\r\n\r\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\r\n\t\t\t\tconst cx = - tube * Math.cos( v );\r\n\t\t\t\tconst cy = tube * Math.sin( v );\r\n\r\n\t\t\t\t// now calculate the final vertex position.\r\n\t\t\t\t// first we orient the extrusion with our basis vectors, then we add it to the current position on the curve\r\n\r\n\t\t\t\tvertex.x = P1.x + ( cx * N.x + cy * B.x );\r\n\t\t\t\tvertex.y = P1.y + ( cx * N.y + cy * B.y );\r\n\t\t\t\tvertex.z = P1.z + ( cx * N.z + cy * B.z );\r\n\r\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\r\n\r\n\t\t\t\t// normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal)\r\n\r\n\t\t\t\tnormal.subVectors( vertex, P1 ).normalize();\r\n\r\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\r\n\r\n\t\t\t\t// uv\r\n\r\n\t\t\t\tuvs.push( i / tubularSegments );\r\n\t\t\t\tuvs.push( j / radialSegments );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// generate indices\r\n\r\n\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\r\n\r\n\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\r\n\r\n\t\t\t\t// indices\r\n\r\n\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\r\n\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\r\n\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\r\n\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\r\n\r\n\t\t\t\t// faces\r\n\r\n\t\t\t\tindices.push( a, b, d );\r\n\t\t\t\tindices.push( b, c, d );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// build geometry\r\n\r\n\t\tthis.setIndex( indices );\r\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\r\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\r\n\r\n\t\t// this function calculates the current position on the torus curve\r\n\r\n\t\tfunction calculatePositionOnCurve( u, p, q, radius, position ) {\r\n\r\n\t\t\tconst cu = Math.cos( u );\r\n\t\t\tconst su = Math.sin( u );\r\n\t\t\tconst quOverP = q / p * u;\r\n\t\t\tconst cs = Math.cos( quOverP );\r\n\r\n\t\t\tposition.x = radius * ( 2 + cs ) * 0.5 * cu;\r\n\t\t\tposition.y = radius * ( 2 + cs ) * su * 0.5;\r\n\t\t\tposition.z = radius * Math.sin( quOverP ) * 0.5;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.parameters = Object.assign( {}, source.parameters );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data ) {\r\n\r\n\t\treturn new TorusKnotGeometry( data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass TubeGeometry extends BufferGeometry {\r\n\r\n\tconstructor( path = new QuadraticBezierCurve3( new Vector3( - 1, - 1, 0 ), new Vector3( - 1, 1, 0 ), new Vector3( 1, 1, 0 ) ), tubularSegments = 64, radius = 1, radialSegments = 8, closed = false ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'TubeGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tpath: path,\r\n\t\t\ttubularSegments: tubularSegments,\r\n\t\t\tradius: radius,\r\n\t\t\tradialSegments: radialSegments,\r\n\t\t\tclosed: closed\r\n\t\t};\r\n\r\n\t\tconst frames = path.computeFrenetFrames( tubularSegments, closed );\r\n\r\n\t\t// expose internals\r\n\r\n\t\tthis.tangents = frames.tangents;\r\n\t\tthis.normals = frames.normals;\r\n\t\tthis.binormals = frames.binormals;\r\n\r\n\t\t// helper variables\r\n\r\n\t\tconst vertex = new Vector3();\r\n\t\tconst normal = new Vector3();\r\n\t\tconst uv = new Vector2();\r\n\t\tlet P = new Vector3();\r\n\r\n\t\t// buffer\r\n\r\n\t\tconst vertices = [];\r\n\t\tconst normals = [];\r\n\t\tconst uvs = [];\r\n\t\tconst indices = [];\r\n\r\n\t\t// create buffer data\r\n\r\n\t\tgenerateBufferData();\r\n\r\n\t\t// build geometry\r\n\r\n\t\tthis.setIndex( indices );\r\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\r\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\r\n\r\n\t\t// functions\r\n\r\n\t\tfunction generateBufferData() {\r\n\r\n\t\t\tfor ( let i = 0; i < tubularSegments; i ++ ) {\r\n\r\n\t\t\t\tgenerateSegment( i );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// if the geometry is not closed, generate the last row of vertices and normals\r\n\t\t\t// at the regular position on the given path\r\n\t\t\t//\r\n\t\t\t// if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ)\r\n\r\n\t\t\tgenerateSegment( ( closed === false ) ? tubularSegments : 0 );\r\n\r\n\t\t\t// uvs are generated in a separate function.\r\n\t\t\t// this makes it easy compute correct values for closed geometries\r\n\r\n\t\t\tgenerateUVs();\r\n\r\n\t\t\t// finally create faces\r\n\r\n\t\t\tgenerateIndices();\r\n\r\n\t\t}\r\n\r\n\t\tfunction generateSegment( i ) {\r\n\r\n\t\t\t// we use getPointAt to sample evenly distributed points from the given path\r\n\r\n\t\t\tP = path.getPointAt( i / tubularSegments, P );\r\n\r\n\t\t\t// retrieve corresponding normal and binormal\r\n\r\n\t\t\tconst N = frames.normals[ i ];\r\n\t\t\tconst B = frames.binormals[ i ];\r\n\r\n\t\t\t// generate normals and vertices for the current segment\r\n\r\n\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\r\n\r\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\r\n\r\n\t\t\t\tconst sin = Math.sin( v );\r\n\t\t\t\tconst cos = - Math.cos( v );\r\n\r\n\t\t\t\t// normal\r\n\r\n\t\t\t\tnormal.x = ( cos * N.x + sin * B.x );\r\n\t\t\t\tnormal.y = ( cos * N.y + sin * B.y );\r\n\t\t\t\tnormal.z = ( cos * N.z + sin * B.z );\r\n\t\t\t\tnormal.normalize();\r\n\r\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\r\n\r\n\t\t\t\t// vertex\r\n\r\n\t\t\t\tvertex.x = P.x + radius * normal.x;\r\n\t\t\t\tvertex.y = P.y + radius * normal.y;\r\n\t\t\t\tvertex.z = P.z + radius * normal.z;\r\n\r\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction generateIndices() {\r\n\r\n\t\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\r\n\r\n\t\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\r\n\r\n\t\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\r\n\t\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\r\n\t\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\r\n\t\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\r\n\r\n\t\t\t\t\t// faces\r\n\r\n\t\t\t\t\tindices.push( a, b, d );\r\n\t\t\t\t\tindices.push( b, c, d );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction generateUVs() {\r\n\r\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\r\n\r\n\t\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\r\n\r\n\t\t\t\t\tuv.x = i / tubularSegments;\r\n\t\t\t\t\tuv.y = j / radialSegments;\r\n\r\n\t\t\t\t\tuvs.push( uv.x, uv.y );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.parameters = Object.assign( {}, source.parameters );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = super.toJSON();\r\n\r\n\t\tdata.path = this.parameters.path.toJSON();\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n\tstatic fromJSON( data ) {\r\n\r\n\t\t// This only works for built-in curves (e.g. CatmullRomCurve3).\r\n\t\t// User defined curves or instances of CurvePath will not be deserialized.\r\n\t\treturn new TubeGeometry(\r\n\t\t\tnew Curves[ data.path.type ]().fromJSON( data.path ),\r\n\t\t\tdata.tubularSegments,\r\n\t\t\tdata.radius,\r\n\t\t\tdata.radialSegments,\r\n\t\t\tdata.closed\r\n\t\t);\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass WireframeGeometry extends BufferGeometry {\r\n\r\n\tconstructor( geometry = null ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'WireframeGeometry';\r\n\r\n\t\tthis.parameters = {\r\n\t\t\tgeometry: geometry\r\n\t\t};\r\n\r\n\t\tif ( geometry !== null ) {\r\n\r\n\t\t\t// buffer\r\n\r\n\t\t\tconst vertices = [];\r\n\t\t\tconst edges = new Set();\r\n\r\n\t\t\t// helper variables\r\n\r\n\t\t\tconst start = new Vector3();\r\n\t\t\tconst end = new Vector3();\r\n\r\n\t\t\tif ( geometry.index !== null ) {\r\n\r\n\t\t\t\t// indexed BufferGeometry\r\n\r\n\t\t\t\tconst position = geometry.attributes.position;\r\n\t\t\t\tconst indices = geometry.index;\r\n\t\t\t\tlet groups = geometry.groups;\r\n\r\n\t\t\t\tif ( groups.length === 0 ) {\r\n\r\n\t\t\t\t\tgroups = [ { start: 0, count: indices.count, materialIndex: 0 } ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// create a data structure that contains all edges without duplicates\r\n\r\n\t\t\t\tfor ( let o = 0, ol = groups.length; o < ol; ++ o ) {\r\n\r\n\t\t\t\t\tconst group = groups[ o ];\r\n\r\n\t\t\t\t\tconst groupStart = group.start;\r\n\t\t\t\t\tconst groupCount = group.count;\r\n\r\n\t\t\t\t\tfor ( let i = groupStart, l = ( groupStart + groupCount ); i < l; i += 3 ) {\r\n\r\n\t\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\r\n\r\n\t\t\t\t\t\t\tconst index1 = indices.getX( i + j );\r\n\t\t\t\t\t\t\tconst index2 = indices.getX( i + ( j + 1 ) % 3 );\r\n\r\n\t\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\r\n\t\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\r\n\r\n\t\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\r\n\r\n\t\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\r\n\t\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// non-indexed BufferGeometry\r\n\r\n\t\t\t\tconst position = geometry.attributes.position;\r\n\r\n\t\t\t\tfor ( let i = 0, l = ( position.count / 3 ); i < l; i ++ ) {\r\n\r\n\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\r\n\r\n\t\t\t\t\t\t// three edges per triangle, an edge is represented as (index1, index2)\r\n\t\t\t\t\t\t// e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)\r\n\r\n\t\t\t\t\t\tconst index1 = 3 * i + j;\r\n\t\t\t\t\t\tconst index2 = 3 * i + ( ( j + 1 ) % 3 );\r\n\r\n\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\r\n\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\r\n\r\n\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\r\n\r\n\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\r\n\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// build geometry\r\n\r\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.parameters = Object.assign( {}, source.parameters );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction isUniqueEdge( start, end, edges ) {\r\n\r\n\tconst hash1 = `${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}`;\r\n\tconst hash2 = `${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}`; // coincident edge\r\n\r\n\tif ( edges.has( hash1 ) === true || edges.has( hash2 ) === true ) {\r\n\r\n\t\treturn false;\r\n\r\n\t} else {\r\n\r\n\t\tedges.add( hash1 );\r\n\t\tedges.add( hash2 );\r\n\t\treturn true;\r\n\r\n\t}\r\n\r\n}\r\n\r\nvar Geometries = /*#__PURE__*/Object.freeze({\r\n\t__proto__: null,\r\n\tBoxGeometry: BoxGeometry,\r\n\tCapsuleGeometry: CapsuleGeometry,\r\n\tCircleGeometry: CircleGeometry,\r\n\tConeGeometry: ConeGeometry,\r\n\tCylinderGeometry: CylinderGeometry,\r\n\tDodecahedronGeometry: DodecahedronGeometry,\r\n\tEdgesGeometry: EdgesGeometry,\r\n\tExtrudeGeometry: ExtrudeGeometry,\r\n\tIcosahedronGeometry: IcosahedronGeometry,\r\n\tLatheGeometry: LatheGeometry,\r\n\tOctahedronGeometry: OctahedronGeometry,\r\n\tPlaneGeometry: PlaneGeometry,\r\n\tPolyhedronGeometry: PolyhedronGeometry,\r\n\tRingGeometry: RingGeometry,\r\n\tShapeGeometry: ShapeGeometry,\r\n\tSphereGeometry: SphereGeometry,\r\n\tTetrahedronGeometry: TetrahedronGeometry,\r\n\tTorusGeometry: TorusGeometry,\r\n\tTorusKnotGeometry: TorusKnotGeometry,\r\n\tTubeGeometry: TubeGeometry,\r\n\tWireframeGeometry: WireframeGeometry\r\n});\r\n\r\nclass ShadowMaterial extends Material {\r\n\r\n\tconstructor( parameters ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isShadowMaterial = true;\r\n\r\n\t\tthis.type = 'ShadowMaterial';\r\n\r\n\t\tthis.color = new Color( 0x000000 );\r\n\t\tthis.transparent = true;\r\n\r\n\t\tthis.fog = true;\r\n\r\n\t\tthis.setValues( parameters );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.color.copy( source.color );\r\n\r\n\t\tthis.fog = source.fog;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass RawShaderMaterial extends ShaderMaterial {\r\n\r\n\tconstructor( parameters ) {\r\n\r\n\t\tsuper( parameters );\r\n\r\n\t\tthis.isRawShaderMaterial = true;\r\n\r\n\t\tthis.type = 'RawShaderMaterial';\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshStandardMaterial extends Material {\r\n\r\n\tconstructor( parameters ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isMeshStandardMaterial = true;\r\n\r\n\t\tthis.defines = { 'STANDARD': '' };\r\n\r\n\t\tthis.type = 'MeshStandardMaterial';\r\n\r\n\t\tthis.color = new Color( 0xffffff ); // diffuse\r\n\t\tthis.roughness = 1.0;\r\n\t\tthis.metalness = 0.0;\r\n\r\n\t\tthis.map = null;\r\n\r\n\t\tthis.lightMap = null;\r\n\t\tthis.lightMapIntensity = 1.0;\r\n\r\n\t\tthis.aoMap = null;\r\n\t\tthis.aoMapIntensity = 1.0;\r\n\r\n\t\tthis.emissive = new Color( 0x000000 );\r\n\t\tthis.emissiveIntensity = 1.0;\r\n\t\tthis.emissiveMap = null;\r\n\r\n\t\tthis.bumpMap = null;\r\n\t\tthis.bumpScale = 1;\r\n\r\n\t\tthis.normalMap = null;\r\n\t\tthis.normalMapType = TangentSpaceNormalMap;\r\n\t\tthis.normalScale = new Vector2( 1, 1 );\r\n\r\n\t\tthis.displacementMap = null;\r\n\t\tthis.displacementScale = 1;\r\n\t\tthis.displacementBias = 0;\r\n\r\n\t\tthis.roughnessMap = null;\r\n\r\n\t\tthis.metalnessMap = null;\r\n\r\n\t\tthis.alphaMap = null;\r\n\r\n\t\tthis.envMap = null;\r\n\t\tthis.envMapRotation = new Euler();\r\n\t\tthis.envMapIntensity = 1.0;\r\n\r\n\t\tthis.wireframe = false;\r\n\t\tthis.wireframeLinewidth = 1;\r\n\t\tthis.wireframeLinecap = 'round';\r\n\t\tthis.wireframeLinejoin = 'round';\r\n\r\n\t\tthis.flatShading = false;\r\n\r\n\t\tthis.fog = true;\r\n\r\n\t\tthis.setValues( parameters );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.defines = { 'STANDARD': '' };\r\n\r\n\t\tthis.color.copy( source.color );\r\n\t\tthis.roughness = source.roughness;\r\n\t\tthis.metalness = source.metalness;\r\n\r\n\t\tthis.map = source.map;\r\n\r\n\t\tthis.lightMap = source.lightMap;\r\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\r\n\r\n\t\tthis.aoMap = source.aoMap;\r\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\r\n\r\n\t\tthis.emissive.copy( source.emissive );\r\n\t\tthis.emissiveMap = source.emissiveMap;\r\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\r\n\r\n\t\tthis.bumpMap = source.bumpMap;\r\n\t\tthis.bumpScale = source.bumpScale;\r\n\r\n\t\tthis.normalMap = source.normalMap;\r\n\t\tthis.normalMapType = source.normalMapType;\r\n\t\tthis.normalScale.copy( source.normalScale );\r\n\r\n\t\tthis.displacementMap = source.displacementMap;\r\n\t\tthis.displacementScale = source.displacementScale;\r\n\t\tthis.displacementBias = source.displacementBias;\r\n\r\n\t\tthis.roughnessMap = source.roughnessMap;\r\n\r\n\t\tthis.metalnessMap = source.metalnessMap;\r\n\r\n\t\tthis.alphaMap = source.alphaMap;\r\n\r\n\t\tthis.envMap = source.envMap;\r\n\t\tthis.envMapRotation.copy( source.envMapRotation );\r\n\t\tthis.envMapIntensity = source.envMapIntensity;\r\n\r\n\t\tthis.wireframe = source.wireframe;\r\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\r\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\r\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\r\n\r\n\t\tthis.flatShading = source.flatShading;\r\n\r\n\t\tthis.fog = source.fog;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshPhysicalMaterial extends MeshStandardMaterial {\r\n\r\n\tconstructor( parameters ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isMeshPhysicalMaterial = true;\r\n\r\n\t\tthis.defines = {\r\n\r\n\t\t\t'STANDARD': '',\r\n\t\t\t'PHYSICAL': ''\r\n\r\n\t\t};\r\n\r\n\t\tthis.type = 'MeshPhysicalMaterial';\r\n\r\n\t\tthis.anisotropyRotation = 0;\r\n\t\tthis.anisotropyMap = null;\r\n\r\n\t\tthis.clearcoatMap = null;\r\n\t\tthis.clearcoatRoughness = 0.0;\r\n\t\tthis.clearcoatRoughnessMap = null;\r\n\t\tthis.clearcoatNormalScale = new Vector2( 1, 1 );\r\n\t\tthis.clearcoatNormalMap = null;\r\n\r\n\t\tthis.ior = 1.5;\r\n\r\n\t\tObject.defineProperty( this, 'reflectivity', {\r\n\t\t\tget: function () {\r\n\r\n\t\t\t\treturn ( clamp( 2.5 * ( this.ior - 1 ) / ( this.ior + 1 ), 0, 1 ) );\r\n\r\n\t\t\t},\r\n\t\t\tset: function ( reflectivity ) {\r\n\r\n\t\t\t\tthis.ior = ( 1 + 0.4 * reflectivity ) / ( 1 - 0.4 * reflectivity );\r\n\r\n\t\t\t}\r\n\t\t} );\r\n\r\n\t\tthis.iridescenceMap = null;\r\n\t\tthis.iridescenceIOR = 1.3;\r\n\t\tthis.iridescenceThicknessRange = [ 100, 400 ];\r\n\t\tthis.iridescenceThicknessMap = null;\r\n\r\n\t\tthis.sheenColor = new Color( 0x000000 );\r\n\t\tthis.sheenColorMap = null;\r\n\t\tthis.sheenRoughness = 1.0;\r\n\t\tthis.sheenRoughnessMap = null;\r\n\r\n\t\tthis.transmissionMap = null;\r\n\r\n\t\tthis.thickness = 0;\r\n\t\tthis.thicknessMap = null;\r\n\t\tthis.attenuationDistance = Infinity;\r\n\t\tthis.attenuationColor = new Color( 1, 1, 1 );\r\n\r\n\t\tthis.specularIntensity = 1.0;\r\n\t\tthis.specularIntensityMap = null;\r\n\t\tthis.specularColor = new Color( 1, 1, 1 );\r\n\t\tthis.specularColorMap = null;\r\n\r\n\t\tthis._anisotropy = 0;\r\n\t\tthis._clearcoat = 0;\r\n\t\tthis._dispersion = 0;\r\n\t\tthis._iridescence = 0;\r\n\t\tthis._sheen = 0.0;\r\n\t\tthis._transmission = 0;\r\n\r\n\t\tthis.setValues( parameters );\r\n\r\n\t}\r\n\r\n\tget anisotropy() {\r\n\r\n\t\treturn this._anisotropy;\r\n\r\n\t}\r\n\r\n\tset anisotropy( value ) {\r\n\r\n\t\tif ( this._anisotropy > 0 !== value > 0 ) {\r\n\r\n\t\t\tthis.version ++;\r\n\r\n\t\t}\r\n\r\n\t\tthis._anisotropy = value;\r\n\r\n\t}\r\n\r\n\tget clearcoat() {\r\n\r\n\t\treturn this._clearcoat;\r\n\r\n\t}\r\n\r\n\tset clearcoat( value ) {\r\n\r\n\t\tif ( this._clearcoat > 0 !== value > 0 ) {\r\n\r\n\t\t\tthis.version ++;\r\n\r\n\t\t}\r\n\r\n\t\tthis._clearcoat = value;\r\n\r\n\t}\r\n\r\n\tget iridescence() {\r\n\r\n\t\treturn this._iridescence;\r\n\r\n\t}\r\n\r\n\tset iridescence( value ) {\r\n\r\n\t\tif ( this._iridescence > 0 !== value > 0 ) {\r\n\r\n\t\t\tthis.version ++;\r\n\r\n\t\t}\r\n\r\n\t\tthis._iridescence = value;\r\n\r\n\t}\r\n\r\n\tget dispersion() {\r\n\r\n\t\treturn this._dispersion;\r\n\r\n\t}\r\n\r\n\tset dispersion( value ) {\r\n\r\n\t\tif ( this._dispersion > 0 !== value > 0 ) {\r\n\r\n\t\t\tthis.version ++;\r\n\r\n\t\t}\r\n\r\n\t\tthis._dispersion = value;\r\n\r\n\t}\r\n\r\n\tget sheen() {\r\n\r\n\t\treturn this._sheen;\r\n\r\n\t}\r\n\r\n\tset sheen( value ) {\r\n\r\n\t\tif ( this._sheen > 0 !== value > 0 ) {\r\n\r\n\t\t\tthis.version ++;\r\n\r\n\t\t}\r\n\r\n\t\tthis._sheen = value;\r\n\r\n\t}\r\n\r\n\tget transmission() {\r\n\r\n\t\treturn this._transmission;\r\n\r\n\t}\r\n\r\n\tset transmission( value ) {\r\n\r\n\t\tif ( this._transmission > 0 !== value > 0 ) {\r\n\r\n\t\t\tthis.version ++;\r\n\r\n\t\t}\r\n\r\n\t\tthis._transmission = value;\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.defines = {\r\n\r\n\t\t\t'STANDARD': '',\r\n\t\t\t'PHYSICAL': ''\r\n\r\n\t\t};\r\n\r\n\t\tthis.anisotropy = source.anisotropy;\r\n\t\tthis.anisotropyRotation = source.anisotropyRotation;\r\n\t\tthis.anisotropyMap = source.anisotropyMap;\r\n\r\n\t\tthis.clearcoat = source.clearcoat;\r\n\t\tthis.clearcoatMap = source.clearcoatMap;\r\n\t\tthis.clearcoatRoughness = source.clearcoatRoughness;\r\n\t\tthis.clearcoatRoughnessMap = source.clearcoatRoughnessMap;\r\n\t\tthis.clearcoatNormalMap = source.clearcoatNormalMap;\r\n\t\tthis.clearcoatNormalScale.copy( source.clearcoatNormalScale );\r\n\r\n\t\tthis.dispersion = source.dispersion;\r\n\t\tthis.ior = source.ior;\r\n\r\n\t\tthis.iridescence = source.iridescence;\r\n\t\tthis.iridescenceMap = source.iridescenceMap;\r\n\t\tthis.iridescenceIOR = source.iridescenceIOR;\r\n\t\tthis.iridescenceThicknessRange = [ ...source.iridescenceThicknessRange ];\r\n\t\tthis.iridescenceThicknessMap = source.iridescenceThicknessMap;\r\n\r\n\t\tthis.sheen = source.sheen;\r\n\t\tthis.sheenColor.copy( source.sheenColor );\r\n\t\tthis.sheenColorMap = source.sheenColorMap;\r\n\t\tthis.sheenRoughness = source.sheenRoughness;\r\n\t\tthis.sheenRoughnessMap = source.sheenRoughnessMap;\r\n\r\n\t\tthis.transmission = source.transmission;\r\n\t\tthis.transmissionMap = source.transmissionMap;\r\n\r\n\t\tthis.thickness = source.thickness;\r\n\t\tthis.thicknessMap = source.thicknessMap;\r\n\t\tthis.attenuationDistance = source.attenuationDistance;\r\n\t\tthis.attenuationColor.copy( source.attenuationColor );\r\n\r\n\t\tthis.specularIntensity = source.specularIntensity;\r\n\t\tthis.specularIntensityMap = source.specularIntensityMap;\r\n\t\tthis.specularColor.copy( source.specularColor );\r\n\t\tthis.specularColorMap = source.specularColorMap;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshPhongMaterial extends Material {\r\n\r\n\tconstructor( parameters ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isMeshPhongMaterial = true;\r\n\r\n\t\tthis.type = 'MeshPhongMaterial';\r\n\r\n\t\tthis.color = new Color( 0xffffff ); // diffuse\r\n\t\tthis.specular = new Color( 0x111111 );\r\n\t\tthis.shininess = 30;\r\n\r\n\t\tthis.map = null;\r\n\r\n\t\tthis.lightMap = null;\r\n\t\tthis.lightMapIntensity = 1.0;\r\n\r\n\t\tthis.aoMap = null;\r\n\t\tthis.aoMapIntensity = 1.0;\r\n\r\n\t\tthis.emissive = new Color( 0x000000 );\r\n\t\tthis.emissiveIntensity = 1.0;\r\n\t\tthis.emissiveMap = null;\r\n\r\n\t\tthis.bumpMap = null;\r\n\t\tthis.bumpScale = 1;\r\n\r\n\t\tthis.normalMap = null;\r\n\t\tthis.normalMapType = TangentSpaceNormalMap;\r\n\t\tthis.normalScale = new Vector2( 1, 1 );\r\n\r\n\t\tthis.displacementMap = null;\r\n\t\tthis.displacementScale = 1;\r\n\t\tthis.displacementBias = 0;\r\n\r\n\t\tthis.specularMap = null;\r\n\r\n\t\tthis.alphaMap = null;\r\n\r\n\t\tthis.envMap = null;\r\n\t\tthis.envMapRotation = new Euler();\r\n\t\tthis.combine = MultiplyOperation;\r\n\t\tthis.reflectivity = 1;\r\n\t\tthis.refractionRatio = 0.98;\r\n\r\n\t\tthis.wireframe = false;\r\n\t\tthis.wireframeLinewidth = 1;\r\n\t\tthis.wireframeLinecap = 'round';\r\n\t\tthis.wireframeLinejoin = 'round';\r\n\r\n\t\tthis.flatShading = false;\r\n\r\n\t\tthis.fog = true;\r\n\r\n\t\tthis.setValues( parameters );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.color.copy( source.color );\r\n\t\tthis.specular.copy( source.specular );\r\n\t\tthis.shininess = source.shininess;\r\n\r\n\t\tthis.map = source.map;\r\n\r\n\t\tthis.lightMap = source.lightMap;\r\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\r\n\r\n\t\tthis.aoMap = source.aoMap;\r\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\r\n\r\n\t\tthis.emissive.copy( source.emissive );\r\n\t\tthis.emissiveMap = source.emissiveMap;\r\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\r\n\r\n\t\tthis.bumpMap = source.bumpMap;\r\n\t\tthis.bumpScale = source.bumpScale;\r\n\r\n\t\tthis.normalMap = source.normalMap;\r\n\t\tthis.normalMapType = source.normalMapType;\r\n\t\tthis.normalScale.copy( source.normalScale );\r\n\r\n\t\tthis.displacementMap = source.displacementMap;\r\n\t\tthis.displacementScale = source.displacementScale;\r\n\t\tthis.displacementBias = source.displacementBias;\r\n\r\n\t\tthis.specularMap = source.specularMap;\r\n\r\n\t\tthis.alphaMap = source.alphaMap;\r\n\r\n\t\tthis.envMap = source.envMap;\r\n\t\tthis.envMapRotation.copy( source.envMapRotation );\r\n\t\tthis.combine = source.combine;\r\n\t\tthis.reflectivity = source.reflectivity;\r\n\t\tthis.refractionRatio = source.refractionRatio;\r\n\r\n\t\tthis.wireframe = source.wireframe;\r\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\r\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\r\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\r\n\r\n\t\tthis.flatShading = source.flatShading;\r\n\r\n\t\tthis.fog = source.fog;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshToonMaterial extends Material {\r\n\r\n\tconstructor( parameters ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isMeshToonMaterial = true;\r\n\r\n\t\tthis.defines = { 'TOON': '' };\r\n\r\n\t\tthis.type = 'MeshToonMaterial';\r\n\r\n\t\tthis.color = new Color( 0xffffff );\r\n\r\n\t\tthis.map = null;\r\n\t\tthis.gradientMap = null;\r\n\r\n\t\tthis.lightMap = null;\r\n\t\tthis.lightMapIntensity = 1.0;\r\n\r\n\t\tthis.aoMap = null;\r\n\t\tthis.aoMapIntensity = 1.0;\r\n\r\n\t\tthis.emissive = new Color( 0x000000 );\r\n\t\tthis.emissiveIntensity = 1.0;\r\n\t\tthis.emissiveMap = null;\r\n\r\n\t\tthis.bumpMap = null;\r\n\t\tthis.bumpScale = 1;\r\n\r\n\t\tthis.normalMap = null;\r\n\t\tthis.normalMapType = TangentSpaceNormalMap;\r\n\t\tthis.normalScale = new Vector2( 1, 1 );\r\n\r\n\t\tthis.displacementMap = null;\r\n\t\tthis.displacementScale = 1;\r\n\t\tthis.displacementBias = 0;\r\n\r\n\t\tthis.alphaMap = null;\r\n\r\n\t\tthis.wireframe = false;\r\n\t\tthis.wireframeLinewidth = 1;\r\n\t\tthis.wireframeLinecap = 'round';\r\n\t\tthis.wireframeLinejoin = 'round';\r\n\r\n\t\tthis.fog = true;\r\n\r\n\t\tthis.setValues( parameters );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.color.copy( source.color );\r\n\r\n\t\tthis.map = source.map;\r\n\t\tthis.gradientMap = source.gradientMap;\r\n\r\n\t\tthis.lightMap = source.lightMap;\r\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\r\n\r\n\t\tthis.aoMap = source.aoMap;\r\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\r\n\r\n\t\tthis.emissive.copy( source.emissive );\r\n\t\tthis.emissiveMap = source.emissiveMap;\r\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\r\n\r\n\t\tthis.bumpMap = source.bumpMap;\r\n\t\tthis.bumpScale = source.bumpScale;\r\n\r\n\t\tthis.normalMap = source.normalMap;\r\n\t\tthis.normalMapType = source.normalMapType;\r\n\t\tthis.normalScale.copy( source.normalScale );\r\n\r\n\t\tthis.displacementMap = source.displacementMap;\r\n\t\tthis.displacementScale = source.displacementScale;\r\n\t\tthis.displacementBias = source.displacementBias;\r\n\r\n\t\tthis.alphaMap = source.alphaMap;\r\n\r\n\t\tthis.wireframe = source.wireframe;\r\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\r\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\r\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\r\n\r\n\t\tthis.fog = source.fog;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshNormalMaterial extends Material {\r\n\r\n\tconstructor( parameters ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isMeshNormalMaterial = true;\r\n\r\n\t\tthis.type = 'MeshNormalMaterial';\r\n\r\n\t\tthis.bumpMap = null;\r\n\t\tthis.bumpScale = 1;\r\n\r\n\t\tthis.normalMap = null;\r\n\t\tthis.normalMapType = TangentSpaceNormalMap;\r\n\t\tthis.normalScale = new Vector2( 1, 1 );\r\n\r\n\t\tthis.displacementMap = null;\r\n\t\tthis.displacementScale = 1;\r\n\t\tthis.displacementBias = 0;\r\n\r\n\t\tthis.wireframe = false;\r\n\t\tthis.wireframeLinewidth = 1;\r\n\r\n\t\tthis.flatShading = false;\r\n\r\n\t\tthis.setValues( parameters );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.bumpMap = source.bumpMap;\r\n\t\tthis.bumpScale = source.bumpScale;\r\n\r\n\t\tthis.normalMap = source.normalMap;\r\n\t\tthis.normalMapType = source.normalMapType;\r\n\t\tthis.normalScale.copy( source.normalScale );\r\n\r\n\t\tthis.displacementMap = source.displacementMap;\r\n\t\tthis.displacementScale = source.displacementScale;\r\n\t\tthis.displacementBias = source.displacementBias;\r\n\r\n\t\tthis.wireframe = source.wireframe;\r\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\r\n\r\n\t\tthis.flatShading = source.flatShading;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshLambertMaterial extends Material {\r\n\r\n\tconstructor( parameters ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isMeshLambertMaterial = true;\r\n\r\n\t\tthis.type = 'MeshLambertMaterial';\r\n\r\n\t\tthis.color = new Color( 0xffffff ); // diffuse\r\n\r\n\t\tthis.map = null;\r\n\r\n\t\tthis.lightMap = null;\r\n\t\tthis.lightMapIntensity = 1.0;\r\n\r\n\t\tthis.aoMap = null;\r\n\t\tthis.aoMapIntensity = 1.0;\r\n\r\n\t\tthis.emissive = new Color( 0x000000 );\r\n\t\tthis.emissiveIntensity = 1.0;\r\n\t\tthis.emissiveMap = null;\r\n\r\n\t\tthis.bumpMap = null;\r\n\t\tthis.bumpScale = 1;\r\n\r\n\t\tthis.normalMap = null;\r\n\t\tthis.normalMapType = TangentSpaceNormalMap;\r\n\t\tthis.normalScale = new Vector2( 1, 1 );\r\n\r\n\t\tthis.displacementMap = null;\r\n\t\tthis.displacementScale = 1;\r\n\t\tthis.displacementBias = 0;\r\n\r\n\t\tthis.specularMap = null;\r\n\r\n\t\tthis.alphaMap = null;\r\n\r\n\t\tthis.envMap = null;\r\n\t\tthis.envMapRotation = new Euler();\r\n\t\tthis.combine = MultiplyOperation;\r\n\t\tthis.reflectivity = 1;\r\n\t\tthis.refractionRatio = 0.98;\r\n\r\n\t\tthis.wireframe = false;\r\n\t\tthis.wireframeLinewidth = 1;\r\n\t\tthis.wireframeLinecap = 'round';\r\n\t\tthis.wireframeLinejoin = 'round';\r\n\r\n\t\tthis.flatShading = false;\r\n\r\n\t\tthis.fog = true;\r\n\r\n\t\tthis.setValues( parameters );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.color.copy( source.color );\r\n\r\n\t\tthis.map = source.map;\r\n\r\n\t\tthis.lightMap = source.lightMap;\r\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\r\n\r\n\t\tthis.aoMap = source.aoMap;\r\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\r\n\r\n\t\tthis.emissive.copy( source.emissive );\r\n\t\tthis.emissiveMap = source.emissiveMap;\r\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\r\n\r\n\t\tthis.bumpMap = source.bumpMap;\r\n\t\tthis.bumpScale = source.bumpScale;\r\n\r\n\t\tthis.normalMap = source.normalMap;\r\n\t\tthis.normalMapType = source.normalMapType;\r\n\t\tthis.normalScale.copy( source.normalScale );\r\n\r\n\t\tthis.displacementMap = source.displacementMap;\r\n\t\tthis.displacementScale = source.displacementScale;\r\n\t\tthis.displacementBias = source.displacementBias;\r\n\r\n\t\tthis.specularMap = source.specularMap;\r\n\r\n\t\tthis.alphaMap = source.alphaMap;\r\n\r\n\t\tthis.envMap = source.envMap;\r\n\t\tthis.envMapRotation.copy( source.envMapRotation );\r\n\t\tthis.combine = source.combine;\r\n\t\tthis.reflectivity = source.reflectivity;\r\n\t\tthis.refractionRatio = source.refractionRatio;\r\n\r\n\t\tthis.wireframe = source.wireframe;\r\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\r\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\r\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\r\n\r\n\t\tthis.flatShading = source.flatShading;\r\n\r\n\t\tthis.fog = source.fog;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MeshMatcapMaterial extends Material {\r\n\r\n\tconstructor( parameters ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isMeshMatcapMaterial = true;\r\n\r\n\t\tthis.defines = { 'MATCAP': '' };\r\n\r\n\t\tthis.type = 'MeshMatcapMaterial';\r\n\r\n\t\tthis.color = new Color( 0xffffff ); // diffuse\r\n\r\n\t\tthis.matcap = null;\r\n\r\n\t\tthis.map = null;\r\n\r\n\t\tthis.bumpMap = null;\r\n\t\tthis.bumpScale = 1;\r\n\r\n\t\tthis.normalMap = null;\r\n\t\tthis.normalMapType = TangentSpaceNormalMap;\r\n\t\tthis.normalScale = new Vector2( 1, 1 );\r\n\r\n\t\tthis.displacementMap = null;\r\n\t\tthis.displacementScale = 1;\r\n\t\tthis.displacementBias = 0;\r\n\r\n\t\tthis.alphaMap = null;\r\n\r\n\t\tthis.flatShading = false;\r\n\r\n\t\tthis.fog = true;\r\n\r\n\t\tthis.setValues( parameters );\r\n\r\n\t}\r\n\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.defines = { 'MATCAP': '' };\r\n\r\n\t\tthis.color.copy( source.color );\r\n\r\n\t\tthis.matcap = source.matcap;\r\n\r\n\t\tthis.map = source.map;\r\n\r\n\t\tthis.bumpMap = source.bumpMap;\r\n\t\tthis.bumpScale = source.bumpScale;\r\n\r\n\t\tthis.normalMap = source.normalMap;\r\n\t\tthis.normalMapType = source.normalMapType;\r\n\t\tthis.normalScale.copy( source.normalScale );\r\n\r\n\t\tthis.displacementMap = source.displacementMap;\r\n\t\tthis.displacementScale = source.displacementScale;\r\n\t\tthis.displacementBias = source.displacementBias;\r\n\r\n\t\tthis.alphaMap = source.alphaMap;\r\n\r\n\t\tthis.flatShading = source.flatShading;\r\n\r\n\t\tthis.fog = source.fog;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass LineDashedMaterial extends LineBasicMaterial {\r\n\r\n\tconstructor( parameters ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isLineDashedMaterial = true;\r\n\r\n\t\tthis.type = 'LineDashedMaterial';\r\n\r\n\t\tthis.scale = 1;\r\n\t\tthis.dashSize = 3;\r\n\t\tthis.gapSize = 1;\r\n\r\n\t\tthis.setValues( parameters );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.scale = source.scale;\r\n\t\tthis.dashSize = source.dashSize;\r\n\t\tthis.gapSize = source.gapSize;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// converts an array to a specific type\r\nfunction convertArray( array, type, forceClone ) {\r\n\r\n\tif ( ! array || // let 'undefined' and 'null' pass\r\n\t\t! forceClone && array.constructor === type ) return array;\r\n\r\n\tif ( typeof type.BYTES_PER_ELEMENT === 'number' ) {\r\n\r\n\t\treturn new type( array ); // create typed array\r\n\r\n\t}\r\n\r\n\treturn Array.prototype.slice.call( array ); // create Array\r\n\r\n}\r\n\r\nfunction isTypedArray( object ) {\r\n\r\n\treturn ArrayBuffer.isView( object ) &&\r\n\t\t! ( object instanceof DataView );\r\n\r\n}\r\n\r\n// returns an array by which times and values can be sorted\r\nfunction getKeyframeOrder( times ) {\r\n\r\n\tfunction compareTime( i, j ) {\r\n\r\n\t\treturn times[ i ] - times[ j ];\r\n\r\n\t}\r\n\r\n\tconst n = times.length;\r\n\tconst result = new Array( n );\r\n\tfor ( let i = 0; i !== n; ++ i ) result[ i ] = i;\r\n\r\n\tresult.sort( compareTime );\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\n// uses the array previously returned by 'getKeyframeOrder' to sort data\r\nfunction sortedArray( values, stride, order ) {\r\n\r\n\tconst nValues = values.length;\r\n\tconst result = new values.constructor( nValues );\r\n\r\n\tfor ( let i = 0, dstOffset = 0; dstOffset !== nValues; ++ i ) {\r\n\r\n\t\tconst srcOffset = order[ i ] * stride;\r\n\r\n\t\tfor ( let j = 0; j !== stride; ++ j ) {\r\n\r\n\t\t\tresult[ dstOffset ++ ] = values[ srcOffset + j ];\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn result;\r\n\r\n}\r\n\r\n// function for parsing AOS keyframe formats\r\nfunction flattenJSON( jsonKeys, times, values, valuePropertyName ) {\r\n\r\n\tlet i = 1, key = jsonKeys[ 0 ];\r\n\r\n\twhile ( key !== undefined && key[ valuePropertyName ] === undefined ) {\r\n\r\n\t\tkey = jsonKeys[ i ++ ];\r\n\r\n\t}\r\n\r\n\tif ( key === undefined ) return; // no data\r\n\r\n\tlet value = key[ valuePropertyName ];\r\n\tif ( value === undefined ) return; // no data\r\n\r\n\tif ( Array.isArray( value ) ) {\r\n\r\n\t\tdo {\r\n\r\n\t\t\tvalue = key[ valuePropertyName ];\r\n\r\n\t\t\tif ( value !== undefined ) {\r\n\r\n\t\t\t\ttimes.push( key.time );\r\n\t\t\t\tvalues.push.apply( values, value ); // push all elements\r\n\r\n\t\t\t}\r\n\r\n\t\t\tkey = jsonKeys[ i ++ ];\r\n\r\n\t\t} while ( key !== undefined );\r\n\r\n\t} else if ( value.toArray !== undefined ) {\r\n\r\n\t\t// ...assume THREE.Math-ish\r\n\r\n\t\tdo {\r\n\r\n\t\t\tvalue = key[ valuePropertyName ];\r\n\r\n\t\t\tif ( value !== undefined ) {\r\n\r\n\t\t\t\ttimes.push( key.time );\r\n\t\t\t\tvalue.toArray( values, values.length );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tkey = jsonKeys[ i ++ ];\r\n\r\n\t\t} while ( key !== undefined );\r\n\r\n\t} else {\r\n\r\n\t\t// otherwise push as-is\r\n\r\n\t\tdo {\r\n\r\n\t\t\tvalue = key[ valuePropertyName ];\r\n\r\n\t\t\tif ( value !== undefined ) {\r\n\r\n\t\t\t\ttimes.push( key.time );\r\n\t\t\t\tvalues.push( value );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tkey = jsonKeys[ i ++ ];\r\n\r\n\t\t} while ( key !== undefined );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction subclip( sourceClip, name, startFrame, endFrame, fps = 30 ) {\r\n\r\n\tconst clip = sourceClip.clone();\r\n\r\n\tclip.name = name;\r\n\r\n\tconst tracks = [];\r\n\r\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\r\n\r\n\t\tconst track = clip.tracks[ i ];\r\n\t\tconst valueSize = track.getValueSize();\r\n\r\n\t\tconst times = [];\r\n\t\tconst values = [];\r\n\r\n\t\tfor ( let j = 0; j < track.times.length; ++ j ) {\r\n\r\n\t\t\tconst frame = track.times[ j ] * fps;\r\n\r\n\t\t\tif ( frame < startFrame || frame >= endFrame ) continue;\r\n\r\n\t\t\ttimes.push( track.times[ j ] );\r\n\r\n\t\t\tfor ( let k = 0; k < valueSize; ++ k ) {\r\n\r\n\t\t\t\tvalues.push( track.values[ j * valueSize + k ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( times.length === 0 ) continue;\r\n\r\n\t\ttrack.times = convertArray( times, track.times.constructor );\r\n\t\ttrack.values = convertArray( values, track.values.constructor );\r\n\r\n\t\ttracks.push( track );\r\n\r\n\t}\r\n\r\n\tclip.tracks = tracks;\r\n\r\n\t// find minimum .times value across all tracks in the trimmed clip\r\n\r\n\tlet minStartTime = Infinity;\r\n\r\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\r\n\r\n\t\tif ( minStartTime > clip.tracks[ i ].times[ 0 ] ) {\r\n\r\n\t\t\tminStartTime = clip.tracks[ i ].times[ 0 ];\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// shift all tracks such that clip begins at t=0\r\n\r\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\r\n\r\n\t\tclip.tracks[ i ].shift( - 1 * minStartTime );\r\n\r\n\t}\r\n\r\n\tclip.resetDuration();\r\n\r\n\treturn clip;\r\n\r\n}\r\n\r\nfunction makeClipAdditive( targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30 ) {\r\n\r\n\tif ( fps <= 0 ) fps = 30;\r\n\r\n\tconst numTracks = referenceClip.tracks.length;\r\n\tconst referenceTime = referenceFrame / fps;\r\n\r\n\t// Make each track's values relative to the values at the reference frame\r\n\tfor ( let i = 0; i < numTracks; ++ i ) {\r\n\r\n\t\tconst referenceTrack = referenceClip.tracks[ i ];\r\n\t\tconst referenceTrackType = referenceTrack.ValueTypeName;\r\n\r\n\t\t// Skip this track if it's non-numeric\r\n\t\tif ( referenceTrackType === 'bool' || referenceTrackType === 'string' ) continue;\r\n\r\n\t\t// Find the track in the target clip whose name and type matches the reference track\r\n\t\tconst targetTrack = targetClip.tracks.find( function ( track ) {\r\n\r\n\t\t\treturn track.name === referenceTrack.name\r\n\t\t\t\t&& track.ValueTypeName === referenceTrackType;\r\n\r\n\t\t} );\r\n\r\n\t\tif ( targetTrack === undefined ) continue;\r\n\r\n\t\tlet referenceOffset = 0;\r\n\t\tconst referenceValueSize = referenceTrack.getValueSize();\r\n\r\n\t\tif ( referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\r\n\r\n\t\t\treferenceOffset = referenceValueSize / 3;\r\n\r\n\t\t}\r\n\r\n\t\tlet targetOffset = 0;\r\n\t\tconst targetValueSize = targetTrack.getValueSize();\r\n\r\n\t\tif ( targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\r\n\r\n\t\t\ttargetOffset = targetValueSize / 3;\r\n\r\n\t\t}\r\n\r\n\t\tconst lastIndex = referenceTrack.times.length - 1;\r\n\t\tlet referenceValue;\r\n\r\n\t\t// Find the value to subtract out of the track\r\n\t\tif ( referenceTime <= referenceTrack.times[ 0 ] ) {\r\n\r\n\t\t\t// Reference frame is earlier than the first keyframe, so just use the first keyframe\r\n\t\t\tconst startIndex = referenceOffset;\r\n\t\t\tconst endIndex = referenceValueSize - referenceOffset;\r\n\t\t\treferenceValue = referenceTrack.values.slice( startIndex, endIndex );\r\n\r\n\t\t} else if ( referenceTime >= referenceTrack.times[ lastIndex ] ) {\r\n\r\n\t\t\t// Reference frame is after the last keyframe, so just use the last keyframe\r\n\t\t\tconst startIndex = lastIndex * referenceValueSize + referenceOffset;\r\n\t\t\tconst endIndex = startIndex + referenceValueSize - referenceOffset;\r\n\t\t\treferenceValue = referenceTrack.values.slice( startIndex, endIndex );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// Interpolate to the reference value\r\n\t\t\tconst interpolant = referenceTrack.createInterpolant();\r\n\t\t\tconst startIndex = referenceOffset;\r\n\t\t\tconst endIndex = referenceValueSize - referenceOffset;\r\n\t\t\tinterpolant.evaluate( referenceTime );\r\n\t\t\treferenceValue = interpolant.resultBuffer.slice( startIndex, endIndex );\r\n\r\n\t\t}\r\n\r\n\t\t// Conjugate the quaternion\r\n\t\tif ( referenceTrackType === 'quaternion' ) {\r\n\r\n\t\t\tconst referenceQuat = new Quaternion().fromArray( referenceValue ).normalize().conjugate();\r\n\t\t\treferenceQuat.toArray( referenceValue );\r\n\r\n\t\t}\r\n\r\n\t\t// Subtract the reference value from all of the track values\r\n\r\n\t\tconst numTimes = targetTrack.times.length;\r\n\t\tfor ( let j = 0; j < numTimes; ++ j ) {\r\n\r\n\t\t\tconst valueStart = j * targetValueSize + targetOffset;\r\n\r\n\t\t\tif ( referenceTrackType === 'quaternion' ) {\r\n\r\n\t\t\t\t// Multiply the conjugate for quaternion track types\r\n\t\t\t\tQuaternion.multiplyQuaternionsFlat(\r\n\t\t\t\t\ttargetTrack.values,\r\n\t\t\t\t\tvalueStart,\r\n\t\t\t\t\treferenceValue,\r\n\t\t\t\t\t0,\r\n\t\t\t\t\ttargetTrack.values,\r\n\t\t\t\t\tvalueStart\r\n\t\t\t\t);\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst valueEnd = targetValueSize - targetOffset * 2;\r\n\r\n\t\t\t\t// Subtract each value for all other numeric track types\r\n\t\t\t\tfor ( let k = 0; k < valueEnd; ++ k ) {\r\n\r\n\t\t\t\t\ttargetTrack.values[ valueStart + k ] -= referenceValue[ k ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ttargetClip.blendMode = AdditiveAnimationBlendMode;\r\n\r\n\treturn targetClip;\r\n\r\n}\r\n\r\nconst AnimationUtils = {\r\n\tconvertArray: convertArray,\r\n\tisTypedArray: isTypedArray,\r\n\tgetKeyframeOrder: getKeyframeOrder,\r\n\tsortedArray: sortedArray,\r\n\tflattenJSON: flattenJSON,\r\n\tsubclip: subclip,\r\n\tmakeClipAdditive: makeClipAdditive\r\n};\r\n\r\n/**\r\n * Abstract base class of interpolants over parametric samples.\r\n *\r\n * The parameter domain is one dimensional, typically the time or a path\r\n * along a curve defined by the data.\r\n *\r\n * The sample values can have any dimensionality and derived classes may\r\n * apply special interpretations to the data.\r\n *\r\n * This class provides the interval seek in a Template Method, deferring\r\n * the actual interpolation to derived classes.\r\n *\r\n * Time complexity is O(1) for linear access crossing at most two points\r\n * and O(log N) for random access, where N is the number of positions.\r\n *\r\n * References:\r\n *\r\n * \t\thttp://www.oodesign.com/template-method-pattern.html\r\n *\r\n */\r\n\r\nclass Interpolant {\r\n\r\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\r\n\r\n\t\tthis.parameterPositions = parameterPositions;\r\n\t\tthis._cachedIndex = 0;\r\n\r\n\t\tthis.resultBuffer = resultBuffer !== undefined ?\r\n\t\t\tresultBuffer : new sampleValues.constructor( sampleSize );\r\n\t\tthis.sampleValues = sampleValues;\r\n\t\tthis.valueSize = sampleSize;\r\n\r\n\t\tthis.settings = null;\r\n\t\tthis.DefaultSettings_ = {};\r\n\r\n\t}\r\n\r\n\tevaluate( t ) {\r\n\r\n\t\tconst pp = this.parameterPositions;\r\n\t\tlet i1 = this._cachedIndex,\r\n\t\t\tt1 = pp[ i1 ],\r\n\t\t\tt0 = pp[ i1 - 1 ];\r\n\r\n\t\tvalidate_interval: {\r\n\r\n\t\t\tseek: {\r\n\r\n\t\t\t\tlet right;\r\n\r\n\t\t\t\tlinear_scan: {\r\n\r\n\t\t\t\t\t//- See http://jsperf.com/comparison-to-undefined/3\r\n\t\t\t\t\t//- slower code:\r\n\t\t\t\t\t//-\r\n\t\t\t\t\t//- \t\t\t\tif ( t >= t1 || t1 === undefined ) {\r\n\t\t\t\t\tforward_scan: if ( ! ( t < t1 ) ) {\r\n\r\n\t\t\t\t\t\tfor ( let giveUpAt = i1 + 2; ; ) {\r\n\r\n\t\t\t\t\t\t\tif ( t1 === undefined ) {\r\n\r\n\t\t\t\t\t\t\t\tif ( t < t0 ) break forward_scan;\r\n\r\n\t\t\t\t\t\t\t\t// after end\r\n\r\n\t\t\t\t\t\t\t\ti1 = pp.length;\r\n\t\t\t\t\t\t\t\tthis._cachedIndex = i1;\r\n\t\t\t\t\t\t\t\treturn this.copySampleValue_( i1 - 1 );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\r\n\r\n\t\t\t\t\t\t\tt0 = t1;\r\n\t\t\t\t\t\t\tt1 = pp[ ++ i1 ];\r\n\r\n\t\t\t\t\t\t\tif ( t < t1 ) {\r\n\r\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\r\n\t\t\t\t\t\t\t\tbreak seek;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// prepare binary search on the right side of the index\r\n\t\t\t\t\t\tright = pp.length;\r\n\t\t\t\t\t\tbreak linear_scan;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t//- slower code:\r\n\t\t\t\t\t//-\t\t\t\t\tif ( t < t0 || t0 === undefined ) {\r\n\t\t\t\t\tif ( ! ( t >= t0 ) ) {\r\n\r\n\t\t\t\t\t\t// looping?\r\n\r\n\t\t\t\t\t\tconst t1global = pp[ 1 ];\r\n\r\n\t\t\t\t\t\tif ( t < t1global ) {\r\n\r\n\t\t\t\t\t\t\ti1 = 2; // + 1, using the scan for the details\r\n\t\t\t\t\t\t\tt0 = t1global;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// linear reverse scan\r\n\r\n\t\t\t\t\t\tfor ( let giveUpAt = i1 - 2; ; ) {\r\n\r\n\t\t\t\t\t\t\tif ( t0 === undefined ) {\r\n\r\n\t\t\t\t\t\t\t\t// before start\r\n\r\n\t\t\t\t\t\t\t\tthis._cachedIndex = 0;\r\n\t\t\t\t\t\t\t\treturn this.copySampleValue_( 0 );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\r\n\r\n\t\t\t\t\t\t\tt1 = t0;\r\n\t\t\t\t\t\t\tt0 = pp[ -- i1 - 1 ];\r\n\r\n\t\t\t\t\t\t\tif ( t >= t0 ) {\r\n\r\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\r\n\t\t\t\t\t\t\t\tbreak seek;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// prepare binary search on the left side of the index\r\n\t\t\t\t\t\tright = i1;\r\n\t\t\t\t\t\ti1 = 0;\r\n\t\t\t\t\t\tbreak linear_scan;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// the interval is valid\r\n\r\n\t\t\t\t\tbreak validate_interval;\r\n\r\n\t\t\t\t} // linear scan\r\n\r\n\t\t\t\t// binary search\r\n\r\n\t\t\t\twhile ( i1 < right ) {\r\n\r\n\t\t\t\t\tconst mid = ( i1 + right ) >>> 1;\r\n\r\n\t\t\t\t\tif ( t < pp[ mid ] ) {\r\n\r\n\t\t\t\t\t\tright = mid;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\ti1 = mid + 1;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tt1 = pp[ i1 ];\r\n\t\t\t\tt0 = pp[ i1 - 1 ];\r\n\r\n\t\t\t\t// check boundary cases, again\r\n\r\n\t\t\t\tif ( t0 === undefined ) {\r\n\r\n\t\t\t\t\tthis._cachedIndex = 0;\r\n\t\t\t\t\treturn this.copySampleValue_( 0 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( t1 === undefined ) {\r\n\r\n\t\t\t\t\ti1 = pp.length;\r\n\t\t\t\t\tthis._cachedIndex = i1;\r\n\t\t\t\t\treturn this.copySampleValue_( i1 - 1 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} // seek\r\n\r\n\t\t\tthis._cachedIndex = i1;\r\n\r\n\t\t\tthis.intervalChanged_( i1, t0, t1 );\r\n\r\n\t\t} // validate_interval\r\n\r\n\t\treturn this.interpolate_( i1, t0, t, t1 );\r\n\r\n\t}\r\n\r\n\tgetSettings_() {\r\n\r\n\t\treturn this.settings || this.DefaultSettings_;\r\n\r\n\t}\r\n\r\n\tcopySampleValue_( index ) {\r\n\r\n\t\t// copies a sample value to the result buffer\r\n\r\n\t\tconst result = this.resultBuffer,\r\n\t\t\tvalues = this.sampleValues,\r\n\t\t\tstride = this.valueSize,\r\n\t\t\toffset = index * stride;\r\n\r\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\r\n\r\n\t\t\tresult[ i ] = values[ offset + i ];\r\n\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\t// Template methods for derived classes:\r\n\r\n\tinterpolate_( /* i1, t0, t, t1 */ ) {\r\n\r\n\t\tthrow new Error( 'call to abstract method' );\r\n\t\t// implementations shall return this.resultBuffer\r\n\r\n\t}\r\n\r\n\tintervalChanged_( /* i1, t0, t1 */ ) {\r\n\r\n\t\t// empty\r\n\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Fast and simple cubic spline interpolant.\r\n *\r\n * It was derived from a Hermitian construction setting the first derivative\r\n * at each sample position to the linear slope between neighboring positions\r\n * over their parameter interval.\r\n */\r\n\r\nclass CubicInterpolant extends Interpolant {\r\n\r\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\r\n\r\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\r\n\r\n\t\tthis._weightPrev = - 0;\r\n\t\tthis._offsetPrev = - 0;\r\n\t\tthis._weightNext = - 0;\r\n\t\tthis._offsetNext = - 0;\r\n\r\n\t\tthis.DefaultSettings_ = {\r\n\r\n\t\t\tendingStart: ZeroCurvatureEnding,\r\n\t\t\tendingEnd: ZeroCurvatureEnding\r\n\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tintervalChanged_( i1, t0, t1 ) {\r\n\r\n\t\tconst pp = this.parameterPositions;\r\n\t\tlet iPrev = i1 - 2,\r\n\t\t\tiNext = i1 + 1,\r\n\r\n\t\t\ttPrev = pp[ iPrev ],\r\n\t\t\ttNext = pp[ iNext ];\r\n\r\n\t\tif ( tPrev === undefined ) {\r\n\r\n\t\t\tswitch ( this.getSettings_().endingStart ) {\r\n\r\n\t\t\t\tcase ZeroSlopeEnding:\r\n\r\n\t\t\t\t\t// f'(t0) = 0\r\n\t\t\t\t\tiPrev = i1;\r\n\t\t\t\t\ttPrev = 2 * t0 - t1;\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase WrapAroundEnding:\r\n\r\n\t\t\t\t\t// use the other end of the curve\r\n\t\t\t\t\tiPrev = pp.length - 2;\r\n\t\t\t\t\ttPrev = t0 + pp[ iPrev ] - pp[ iPrev + 1 ];\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tdefault: // ZeroCurvatureEnding\r\n\r\n\t\t\t\t\t// f''(t0) = 0 a.k.a. Natural Spline\r\n\t\t\t\t\tiPrev = i1;\r\n\t\t\t\t\ttPrev = t1;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( tNext === undefined ) {\r\n\r\n\t\t\tswitch ( this.getSettings_().endingEnd ) {\r\n\r\n\t\t\t\tcase ZeroSlopeEnding:\r\n\r\n\t\t\t\t\t// f'(tN) = 0\r\n\t\t\t\t\tiNext = i1;\r\n\t\t\t\t\ttNext = 2 * t1 - t0;\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase WrapAroundEnding:\r\n\r\n\t\t\t\t\t// use the other end of the curve\r\n\t\t\t\t\tiNext = 1;\r\n\t\t\t\t\ttNext = t1 + pp[ 1 ] - pp[ 0 ];\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tdefault: // ZeroCurvatureEnding\r\n\r\n\t\t\t\t\t// f''(tN) = 0, a.k.a. Natural Spline\r\n\t\t\t\t\tiNext = i1 - 1;\r\n\t\t\t\t\ttNext = t0;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconst halfDt = ( t1 - t0 ) * 0.5,\r\n\t\t\tstride = this.valueSize;\r\n\r\n\t\tthis._weightPrev = halfDt / ( t0 - tPrev );\r\n\t\tthis._weightNext = halfDt / ( tNext - t1 );\r\n\t\tthis._offsetPrev = iPrev * stride;\r\n\t\tthis._offsetNext = iNext * stride;\r\n\r\n\t}\r\n\r\n\tinterpolate_( i1, t0, t, t1 ) {\r\n\r\n\t\tconst result = this.resultBuffer,\r\n\t\t\tvalues = this.sampleValues,\r\n\t\t\tstride = this.valueSize,\r\n\r\n\t\t\to1 = i1 * stride,\t\to0 = o1 - stride,\r\n\t\t\toP = this._offsetPrev, \toN = this._offsetNext,\r\n\t\t\twP = this._weightPrev,\twN = this._weightNext,\r\n\r\n\t\t\tp = ( t - t0 ) / ( t1 - t0 ),\r\n\t\t\tpp = p * p,\r\n\t\t\tppp = pp * p;\r\n\r\n\t\t// evaluate polynomials\r\n\r\n\t\tconst sP = - wP * ppp + 2 * wP * pp - wP * p;\r\n\t\tconst s0 = ( 1 + wP ) * ppp + ( - 1.5 - 2 * wP ) * pp + ( - 0.5 + wP ) * p + 1;\r\n\t\tconst s1 = ( - 1 - wN ) * ppp + ( 1.5 + wN ) * pp + 0.5 * p;\r\n\t\tconst sN = wN * ppp - wN * pp;\r\n\r\n\t\t// combine data linearly\r\n\r\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\r\n\r\n\t\t\tresult[ i ] =\r\n\t\t\t\t\tsP * values[ oP + i ] +\r\n\t\t\t\t\ts0 * values[ o0 + i ] +\r\n\t\t\t\t\ts1 * values[ o1 + i ] +\r\n\t\t\t\t\tsN * values[ oN + i ];\r\n\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass LinearInterpolant extends Interpolant {\r\n\r\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\r\n\r\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\r\n\r\n\t}\r\n\r\n\tinterpolate_( i1, t0, t, t1 ) {\r\n\r\n\t\tconst result = this.resultBuffer,\r\n\t\t\tvalues = this.sampleValues,\r\n\t\t\tstride = this.valueSize,\r\n\r\n\t\t\toffset1 = i1 * stride,\r\n\t\t\toffset0 = offset1 - stride,\r\n\r\n\t\t\tweight1 = ( t - t0 ) / ( t1 - t0 ),\r\n\t\t\tweight0 = 1 - weight1;\r\n\r\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\r\n\r\n\t\t\tresult[ i ] =\r\n\t\t\t\t\tvalues[ offset0 + i ] * weight0 +\r\n\t\t\t\t\tvalues[ offset1 + i ] * weight1;\r\n\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n *\r\n * Interpolant that evaluates to the sample value at the position preceding\r\n * the parameter.\r\n */\r\n\r\nclass DiscreteInterpolant extends Interpolant {\r\n\r\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\r\n\r\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\r\n\r\n\t}\r\n\r\n\tinterpolate_( i1 /*, t0, t, t1 */ ) {\r\n\r\n\t\treturn this.copySampleValue_( i1 - 1 );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass KeyframeTrack {\r\n\r\n\tconstructor( name, times, values, interpolation ) {\r\n\r\n\t\tif ( name === undefined ) throw new Error( 'THREE.KeyframeTrack: track name is undefined' );\r\n\t\tif ( times === undefined || times.length === 0 ) throw new Error( 'THREE.KeyframeTrack: no keyframes in track named ' + name );\r\n\r\n\t\tthis.name = name;\r\n\r\n\t\tthis.times = convertArray( times, this.TimeBufferType );\r\n\t\tthis.values = convertArray( values, this.ValueBufferType );\r\n\r\n\t\tthis.setInterpolation( interpolation || this.DefaultInterpolation );\r\n\r\n\t}\r\n\r\n\t// Serialization (in static context, because of constructor invocation\r\n\t// and automatic invocation of .toJSON):\r\n\r\n\tstatic toJSON( track ) {\r\n\r\n\t\tconst trackType = track.constructor;\r\n\r\n\t\tlet json;\r\n\r\n\t\t// derived classes can define a static toJSON method\r\n\t\tif ( trackType.toJSON !== this.toJSON ) {\r\n\r\n\t\t\tjson = trackType.toJSON( track );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// by default, we assume the data can be serialized as-is\r\n\t\t\tjson = {\r\n\r\n\t\t\t\t'name': track.name,\r\n\t\t\t\t'times': convertArray( track.times, Array ),\r\n\t\t\t\t'values': convertArray( track.values, Array )\r\n\r\n\t\t\t};\r\n\r\n\t\t\tconst interpolation = track.getInterpolation();\r\n\r\n\t\t\tif ( interpolation !== track.DefaultInterpolation ) {\r\n\r\n\t\t\t\tjson.interpolation = interpolation;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tjson.type = track.ValueTypeName; // mandatory\r\n\r\n\t\treturn json;\r\n\r\n\t}\r\n\r\n\tInterpolantFactoryMethodDiscrete( result ) {\r\n\r\n\t\treturn new DiscreteInterpolant( this.times, this.values, this.getValueSize(), result );\r\n\r\n\t}\r\n\r\n\tInterpolantFactoryMethodLinear( result ) {\r\n\r\n\t\treturn new LinearInterpolant( this.times, this.values, this.getValueSize(), result );\r\n\r\n\t}\r\n\r\n\tInterpolantFactoryMethodSmooth( result ) {\r\n\r\n\t\treturn new CubicInterpolant( this.times, this.values, this.getValueSize(), result );\r\n\r\n\t}\r\n\r\n\tsetInterpolation( interpolation ) {\r\n\r\n\t\tlet factoryMethod;\r\n\r\n\t\tswitch ( interpolation ) {\r\n\r\n\t\t\tcase InterpolateDiscrete:\r\n\r\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodDiscrete;\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase InterpolateLinear:\r\n\r\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodLinear;\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase InterpolateSmooth:\r\n\r\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodSmooth;\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t}\r\n\r\n\t\tif ( factoryMethod === undefined ) {\r\n\r\n\t\t\tconst message = 'unsupported interpolation for ' +\r\n\t\t\t\tthis.ValueTypeName + ' keyframe track named ' + this.name;\r\n\r\n\t\t\tif ( this.createInterpolant === undefined ) {\r\n\r\n\t\t\t\t// fall back to default, unless the default itself is messed up\r\n\t\t\t\tif ( interpolation !== this.DefaultInterpolation ) {\r\n\r\n\t\t\t\t\tthis.setInterpolation( this.DefaultInterpolation );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tthrow new Error( message ); // fatal, in this case\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconsole.warn( 'THREE.KeyframeTrack:', message );\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tthis.createInterpolant = factoryMethod;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetInterpolation() {\r\n\r\n\t\tswitch ( this.createInterpolant ) {\r\n\r\n\t\t\tcase this.InterpolantFactoryMethodDiscrete:\r\n\r\n\t\t\t\treturn InterpolateDiscrete;\r\n\r\n\t\t\tcase this.InterpolantFactoryMethodLinear:\r\n\r\n\t\t\t\treturn InterpolateLinear;\r\n\r\n\t\t\tcase this.InterpolantFactoryMethodSmooth:\r\n\r\n\t\t\t\treturn InterpolateSmooth;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tgetValueSize() {\r\n\r\n\t\treturn this.values.length / this.times.length;\r\n\r\n\t}\r\n\r\n\t// move all keyframes either forwards or backwards in time\r\n\tshift( timeOffset ) {\r\n\r\n\t\tif ( timeOffset !== 0.0 ) {\r\n\r\n\t\t\tconst times = this.times;\r\n\r\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\r\n\r\n\t\t\t\ttimes[ i ] += timeOffset;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t// scale all keyframe times by a factor (useful for frame <-> seconds conversions)\r\n\tscale( timeScale ) {\r\n\r\n\t\tif ( timeScale !== 1.0 ) {\r\n\r\n\t\t\tconst times = this.times;\r\n\r\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\r\n\r\n\t\t\t\ttimes[ i ] *= timeScale;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t// removes keyframes before and after animation without changing any values within the range [startTime, endTime].\r\n\t// IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values\r\n\ttrim( startTime, endTime ) {\r\n\r\n\t\tconst times = this.times,\r\n\t\t\tnKeys = times.length;\r\n\r\n\t\tlet from = 0,\r\n\t\t\tto = nKeys - 1;\r\n\r\n\t\twhile ( from !== nKeys && times[ from ] < startTime ) {\r\n\r\n\t\t\t++ from;\r\n\r\n\t\t}\r\n\r\n\t\twhile ( to !== - 1 && times[ to ] > endTime ) {\r\n\r\n\t\t\t-- to;\r\n\r\n\t\t}\r\n\r\n\t\t++ to; // inclusive -> exclusive bound\r\n\r\n\t\tif ( from !== 0 || to !== nKeys ) {\r\n\r\n\t\t\t// empty tracks are forbidden, so keep at least one keyframe\r\n\t\t\tif ( from >= to ) {\r\n\r\n\t\t\t\tto = Math.max( to, 1 );\r\n\t\t\t\tfrom = to - 1;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst stride = this.getValueSize();\r\n\t\t\tthis.times = times.slice( from, to );\r\n\t\t\tthis.values = this.values.slice( from * stride, to * stride );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t// ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable\r\n\tvalidate() {\r\n\r\n\t\tlet valid = true;\r\n\r\n\t\tconst valueSize = this.getValueSize();\r\n\t\tif ( valueSize - Math.floor( valueSize ) !== 0 ) {\r\n\r\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Invalid value size in track.', this );\r\n\t\t\tvalid = false;\r\n\r\n\t\t}\r\n\r\n\t\tconst times = this.times,\r\n\t\t\tvalues = this.values,\r\n\r\n\t\t\tnKeys = times.length;\r\n\r\n\t\tif ( nKeys === 0 ) {\r\n\r\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Track is empty.', this );\r\n\t\t\tvalid = false;\r\n\r\n\t\t}\r\n\r\n\t\tlet prevTime = null;\r\n\r\n\t\tfor ( let i = 0; i !== nKeys; i ++ ) {\r\n\r\n\t\t\tconst currTime = times[ i ];\r\n\r\n\t\t\tif ( typeof currTime === 'number' && isNaN( currTime ) ) {\r\n\r\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime );\r\n\t\t\t\tvalid = false;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( prevTime !== null && prevTime > currTime ) {\r\n\r\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Out of order keys.', this, i, currTime, prevTime );\r\n\t\t\t\tvalid = false;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tprevTime = currTime;\r\n\r\n\t\t}\r\n\r\n\t\tif ( values !== undefined ) {\r\n\r\n\t\t\tif ( isTypedArray( values ) ) {\r\n\r\n\t\t\t\tfor ( let i = 0, n = values.length; i !== n; ++ i ) {\r\n\r\n\t\t\t\t\tconst value = values[ i ];\r\n\r\n\t\t\t\t\tif ( isNaN( value ) ) {\r\n\r\n\t\t\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Value is not a valid number.', this, i, value );\r\n\t\t\t\t\t\tvalid = false;\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn valid;\r\n\r\n\t}\r\n\r\n\t// removes equivalent sequential keys as common in morph target sequences\r\n\t// (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)\r\n\toptimize() {\r\n\r\n\t\t// times or values may be shared with other tracks, so overwriting is unsafe\r\n\t\tconst times = this.times.slice(),\r\n\t\t\tvalues = this.values.slice(),\r\n\t\t\tstride = this.getValueSize(),\r\n\r\n\t\t\tsmoothInterpolation = this.getInterpolation() === InterpolateSmooth,\r\n\r\n\t\t\tlastIndex = times.length - 1;\r\n\r\n\t\tlet writeIndex = 1;\r\n\r\n\t\tfor ( let i = 1; i < lastIndex; ++ i ) {\r\n\r\n\t\t\tlet keep = false;\r\n\r\n\t\t\tconst time = times[ i ];\r\n\t\t\tconst timeNext = times[ i + 1 ];\r\n\r\n\t\t\t// remove adjacent keyframes scheduled at the same time\r\n\r\n\t\t\tif ( time !== timeNext && ( i !== 1 || time !== times[ 0 ] ) ) {\r\n\r\n\t\t\t\tif ( ! smoothInterpolation ) {\r\n\r\n\t\t\t\t\t// remove unnecessary keyframes same as their neighbors\r\n\r\n\t\t\t\t\tconst offset = i * stride,\r\n\t\t\t\t\t\toffsetP = offset - stride,\r\n\t\t\t\t\t\toffsetN = offset + stride;\r\n\r\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\r\n\r\n\t\t\t\t\t\tconst value = values[ offset + j ];\r\n\r\n\t\t\t\t\t\tif ( value !== values[ offsetP + j ] ||\r\n\t\t\t\t\t\t\tvalue !== values[ offsetN + j ] ) {\r\n\r\n\t\t\t\t\t\t\tkeep = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tkeep = true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// in-place compaction\r\n\r\n\t\t\tif ( keep ) {\r\n\r\n\t\t\t\tif ( i !== writeIndex ) {\r\n\r\n\t\t\t\t\ttimes[ writeIndex ] = times[ i ];\r\n\r\n\t\t\t\t\tconst readOffset = i * stride,\r\n\t\t\t\t\t\twriteOffset = writeIndex * stride;\r\n\r\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\r\n\r\n\t\t\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t++ writeIndex;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// flush last keyframe (compaction looks ahead)\r\n\r\n\t\tif ( lastIndex > 0 ) {\r\n\r\n\t\t\ttimes[ writeIndex ] = times[ lastIndex ];\r\n\r\n\t\t\tfor ( let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++ j ) {\r\n\r\n\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\t++ writeIndex;\r\n\r\n\t\t}\r\n\r\n\t\tif ( writeIndex !== times.length ) {\r\n\r\n\t\t\tthis.times = times.slice( 0, writeIndex );\r\n\t\t\tthis.values = values.slice( 0, writeIndex * stride );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.times = times;\r\n\t\t\tthis.values = values;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\tconst times = this.times.slice();\r\n\t\tconst values = this.values.slice();\r\n\r\n\t\tconst TypedKeyframeTrack = this.constructor;\r\n\t\tconst track = new TypedKeyframeTrack( this.name, times, values );\r\n\r\n\t\t// Interpolant argument to constructor is not saved, so copy the factory method directly.\r\n\t\ttrack.createInterpolant = this.createInterpolant;\r\n\r\n\t\treturn track;\r\n\r\n\t}\r\n\r\n}\r\n\r\nKeyframeTrack.prototype.TimeBufferType = Float32Array;\r\nKeyframeTrack.prototype.ValueBufferType = Float32Array;\r\nKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;\r\n\r\n/**\r\n * A Track of Boolean keyframe values.\r\n */\r\nclass BooleanKeyframeTrack extends KeyframeTrack {\r\n\r\n\t// No interpolation parameter because only InterpolateDiscrete is valid.\r\n\tconstructor( name, times, values ) {\r\n\r\n\t\tsuper( name, times, values );\r\n\r\n\t}\r\n\r\n}\r\n\r\nBooleanKeyframeTrack.prototype.ValueTypeName = 'bool';\r\nBooleanKeyframeTrack.prototype.ValueBufferType = Array;\r\nBooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\r\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\r\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\r\n\r\n/**\r\n * A Track of keyframe values that represent color.\r\n */\r\nclass ColorKeyframeTrack extends KeyframeTrack {}\r\n\r\nColorKeyframeTrack.prototype.ValueTypeName = 'color';\r\n\r\n/**\r\n * A Track of numeric keyframe values.\r\n */\r\nclass NumberKeyframeTrack extends KeyframeTrack {}\r\n\r\nNumberKeyframeTrack.prototype.ValueTypeName = 'number';\r\n\r\n/**\r\n * Spherical linear unit quaternion interpolant.\r\n */\r\n\r\nclass QuaternionLinearInterpolant extends Interpolant {\r\n\r\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\r\n\r\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\r\n\r\n\t}\r\n\r\n\tinterpolate_( i1, t0, t, t1 ) {\r\n\r\n\t\tconst result = this.resultBuffer,\r\n\t\t\tvalues = this.sampleValues,\r\n\t\t\tstride = this.valueSize,\r\n\r\n\t\t\talpha = ( t - t0 ) / ( t1 - t0 );\r\n\r\n\t\tlet offset = i1 * stride;\r\n\r\n\t\tfor ( let end = offset + stride; offset !== end; offset += 4 ) {\r\n\r\n\t\t\tQuaternion.slerpFlat( result, 0, values, offset - stride, values, offset, alpha );\r\n\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * A Track of quaternion keyframe values.\r\n */\r\nclass QuaternionKeyframeTrack extends KeyframeTrack {\r\n\r\n\tInterpolantFactoryMethodLinear( result ) {\r\n\r\n\t\treturn new QuaternionLinearInterpolant( this.times, this.values, this.getValueSize(), result );\r\n\r\n\t}\r\n\r\n}\r\n\r\nQuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion';\r\n// ValueBufferType is inherited\r\n// DefaultInterpolation is inherited;\r\nQuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\r\n\r\n/**\r\n * A Track that interpolates Strings\r\n */\r\nclass StringKeyframeTrack extends KeyframeTrack {\r\n\r\n\t// No interpolation parameter because only InterpolateDiscrete is valid.\r\n\tconstructor( name, times, values ) {\r\n\r\n\t\tsuper( name, times, values );\r\n\r\n\t}\r\n\r\n}\r\n\r\nStringKeyframeTrack.prototype.ValueTypeName = 'string';\r\nStringKeyframeTrack.prototype.ValueBufferType = Array;\r\nStringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\r\nStringKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\r\nStringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\r\n\r\n/**\r\n * A Track of vectored keyframe values.\r\n */\r\nclass VectorKeyframeTrack extends KeyframeTrack {}\r\n\r\nVectorKeyframeTrack.prototype.ValueTypeName = 'vector';\r\n\r\nclass AnimationClip {\r\n\r\n\tconstructor( name = '', duration = - 1, tracks = [], blendMode = NormalAnimationBlendMode ) {\r\n\r\n\t\tthis.name = name;\r\n\t\tthis.tracks = tracks;\r\n\t\tthis.duration = duration;\r\n\t\tthis.blendMode = blendMode;\r\n\r\n\t\tthis.uuid = generateUUID();\r\n\r\n\t\t// this means it should figure out its duration by scanning the tracks\r\n\t\tif ( this.duration < 0 ) {\r\n\r\n\t\t\tthis.resetDuration();\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\r\n\tstatic parse( json ) {\r\n\r\n\t\tconst tracks = [],\r\n\t\t\tjsonTracks = json.tracks,\r\n\t\t\tframeTime = 1.0 / ( json.fps || 1.0 );\r\n\r\n\t\tfor ( let i = 0, n = jsonTracks.length; i !== n; ++ i ) {\r\n\r\n\t\t\ttracks.push( parseKeyframeTrack( jsonTracks[ i ] ).scale( frameTime ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst clip = new this( json.name, json.duration, tracks, json.blendMode );\r\n\t\tclip.uuid = json.uuid;\r\n\r\n\t\treturn clip;\r\n\r\n\t}\r\n\r\n\tstatic toJSON( clip ) {\r\n\r\n\t\tconst tracks = [],\r\n\t\t\tclipTracks = clip.tracks;\r\n\r\n\t\tconst json = {\r\n\r\n\t\t\t'name': clip.name,\r\n\t\t\t'duration': clip.duration,\r\n\t\t\t'tracks': tracks,\r\n\t\t\t'uuid': clip.uuid,\r\n\t\t\t'blendMode': clip.blendMode\r\n\r\n\t\t};\r\n\r\n\t\tfor ( let i = 0, n = clipTracks.length; i !== n; ++ i ) {\r\n\r\n\t\t\ttracks.push( KeyframeTrack.toJSON( clipTracks[ i ] ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn json;\r\n\r\n\t}\r\n\r\n\tstatic CreateFromMorphTargetSequence( name, morphTargetSequence, fps, noLoop ) {\r\n\r\n\t\tconst numMorphTargets = morphTargetSequence.length;\r\n\t\tconst tracks = [];\r\n\r\n\t\tfor ( let i = 0; i < numMorphTargets; i ++ ) {\r\n\r\n\t\t\tlet times = [];\r\n\t\t\tlet values = [];\r\n\r\n\t\t\ttimes.push(\r\n\t\t\t\t( i + numMorphTargets - 1 ) % numMorphTargets,\r\n\t\t\t\ti,\r\n\t\t\t\t( i + 1 ) % numMorphTargets );\r\n\r\n\t\t\tvalues.push( 0, 1, 0 );\r\n\r\n\t\t\tconst order = getKeyframeOrder( times );\r\n\t\t\ttimes = sortedArray( times, 1, order );\r\n\t\t\tvalues = sortedArray( values, 1, order );\r\n\r\n\t\t\t// if there is a key at the first frame, duplicate it as the\r\n\t\t\t// last frame as well for perfect loop.\r\n\t\t\tif ( ! noLoop && times[ 0 ] === 0 ) {\r\n\r\n\t\t\t\ttimes.push( numMorphTargets );\r\n\t\t\t\tvalues.push( values[ 0 ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\ttracks.push(\r\n\t\t\t\tnew NumberKeyframeTrack(\r\n\t\t\t\t\t'.morphTargetInfluences[' + morphTargetSequence[ i ].name + ']',\r\n\t\t\t\t\ttimes, values\r\n\t\t\t\t).scale( 1.0 / fps ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn new this( name, - 1, tracks );\r\n\r\n\t}\r\n\r\n\tstatic findByName( objectOrClipArray, name ) {\r\n\r\n\t\tlet clipArray = objectOrClipArray;\r\n\r\n\t\tif ( ! Array.isArray( objectOrClipArray ) ) {\r\n\r\n\t\t\tconst o = objectOrClipArray;\r\n\t\t\tclipArray = o.geometry && o.geometry.animations || o.animations;\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < clipArray.length; i ++ ) {\r\n\r\n\t\t\tif ( clipArray[ i ].name === name ) {\r\n\r\n\t\t\t\treturn clipArray[ i ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\r\n\t}\r\n\r\n\tstatic CreateClipsFromMorphTargetSequences( morphTargets, fps, noLoop ) {\r\n\r\n\t\tconst animationToMorphTargets = {};\r\n\r\n\t\t// tested with https://regex101.com/ on trick sequences\r\n\t\t// such flamingo_flyA_003, flamingo_run1_003, crdeath0059\r\n\t\tconst pattern = /^([\\w-]*?)([\\d]+)$/;\r\n\r\n\t\t// sort morph target names into animation groups based\r\n\t\t// patterns like Walk_001, Walk_002, Run_001, Run_002\r\n\t\tfor ( let i = 0, il = morphTargets.length; i < il; i ++ ) {\r\n\r\n\t\t\tconst morphTarget = morphTargets[ i ];\r\n\t\t\tconst parts = morphTarget.name.match( pattern );\r\n\r\n\t\t\tif ( parts && parts.length > 1 ) {\r\n\r\n\t\t\t\tconst name = parts[ 1 ];\r\n\r\n\t\t\t\tlet animationMorphTargets = animationToMorphTargets[ name ];\r\n\r\n\t\t\t\tif ( ! animationMorphTargets ) {\r\n\r\n\t\t\t\t\tanimationToMorphTargets[ name ] = animationMorphTargets = [];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tanimationMorphTargets.push( morphTarget );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconst clips = [];\r\n\r\n\t\tfor ( const name in animationToMorphTargets ) {\r\n\r\n\t\t\tclips.push( this.CreateFromMorphTargetSequence( name, animationToMorphTargets[ name ], fps, noLoop ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn clips;\r\n\r\n\t}\r\n\r\n\t// parse the animation.hierarchy format\r\n\tstatic parseAnimation( animation, bones ) {\r\n\r\n\t\tif ( ! animation ) {\r\n\r\n\t\t\tconsole.error( 'THREE.AnimationClip: No animation in JSONLoader data.' );\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\tconst addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) {\r\n\r\n\t\t\t// only return track if there are actually keys.\r\n\t\t\tif ( animationKeys.length !== 0 ) {\r\n\r\n\t\t\t\tconst times = [];\r\n\t\t\t\tconst values = [];\r\n\r\n\t\t\t\tflattenJSON( animationKeys, times, values, propertyName );\r\n\r\n\t\t\t\t// empty keys are filtered out, so check again\r\n\t\t\t\tif ( times.length !== 0 ) {\r\n\r\n\t\t\t\t\tdestTracks.push( new trackType( trackName, times, values ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tconst tracks = [];\r\n\r\n\t\tconst clipName = animation.name || 'default';\r\n\t\tconst fps = animation.fps || 30;\r\n\t\tconst blendMode = animation.blendMode;\r\n\r\n\t\t// automatic length determination in AnimationClip.\r\n\t\tlet duration = animation.length || - 1;\r\n\r\n\t\tconst hierarchyTracks = animation.hierarchy || [];\r\n\r\n\t\tfor ( let h = 0; h < hierarchyTracks.length; h ++ ) {\r\n\r\n\t\t\tconst animationKeys = hierarchyTracks[ h ].keys;\r\n\r\n\t\t\t// skip empty tracks\r\n\t\t\tif ( ! animationKeys || animationKeys.length === 0 ) continue;\r\n\r\n\t\t\t// process morph targets\r\n\t\t\tif ( animationKeys[ 0 ].morphTargets ) {\r\n\r\n\t\t\t\t// figure out all morph targets used in this track\r\n\t\t\t\tconst morphTargetNames = {};\r\n\r\n\t\t\t\tlet k;\r\n\r\n\t\t\t\tfor ( k = 0; k < animationKeys.length; k ++ ) {\r\n\r\n\t\t\t\t\tif ( animationKeys[ k ].morphTargets ) {\r\n\r\n\t\t\t\t\t\tfor ( let m = 0; m < animationKeys[ k ].morphTargets.length; m ++ ) {\r\n\r\n\t\t\t\t\t\t\tmorphTargetNames[ animationKeys[ k ].morphTargets[ m ] ] = - 1;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// create a track for each morph target with all zero\r\n\t\t\t\t// morphTargetInfluences except for the keys in which\r\n\t\t\t\t// the morphTarget is named.\r\n\t\t\t\tfor ( const morphTargetName in morphTargetNames ) {\r\n\r\n\t\t\t\t\tconst times = [];\r\n\t\t\t\t\tconst values = [];\r\n\r\n\t\t\t\t\tfor ( let m = 0; m !== animationKeys[ k ].morphTargets.length; ++ m ) {\r\n\r\n\t\t\t\t\t\tconst animationKey = animationKeys[ k ];\r\n\r\n\t\t\t\t\t\ttimes.push( animationKey.time );\r\n\t\t\t\t\t\tvalues.push( ( animationKey.morphTarget === morphTargetName ) ? 1 : 0 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttracks.push( new NumberKeyframeTrack( '.morphTargetInfluence[' + morphTargetName + ']', times, values ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tduration = morphTargetNames.length * fps;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// ...assume skeletal animation\r\n\r\n\t\t\t\tconst boneName = '.bones[' + bones[ h ].name + ']';\r\n\r\n\t\t\t\taddNonemptyTrack(\r\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.position',\r\n\t\t\t\t\tanimationKeys, 'pos', tracks );\r\n\r\n\t\t\t\taddNonemptyTrack(\r\n\t\t\t\t\tQuaternionKeyframeTrack, boneName + '.quaternion',\r\n\t\t\t\t\tanimationKeys, 'rot', tracks );\r\n\r\n\t\t\t\taddNonemptyTrack(\r\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.scale',\r\n\t\t\t\t\tanimationKeys, 'scl', tracks );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( tracks.length === 0 ) {\r\n\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\tconst clip = new this( clipName, duration, tracks, blendMode );\r\n\r\n\t\treturn clip;\r\n\r\n\t}\r\n\r\n\tresetDuration() {\r\n\r\n\t\tconst tracks = this.tracks;\r\n\t\tlet duration = 0;\r\n\r\n\t\tfor ( let i = 0, n = tracks.length; i !== n; ++ i ) {\r\n\r\n\t\t\tconst track = this.tracks[ i ];\r\n\r\n\t\t\tduration = Math.max( duration, track.times[ track.times.length - 1 ] );\r\n\r\n\t\t}\r\n\r\n\t\tthis.duration = duration;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttrim() {\r\n\r\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\r\n\r\n\t\t\tthis.tracks[ i ].trim( 0, this.duration );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tvalidate() {\r\n\r\n\t\tlet valid = true;\r\n\r\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\r\n\r\n\t\t\tvalid = valid && this.tracks[ i ].validate();\r\n\r\n\t\t}\r\n\r\n\t\treturn valid;\r\n\r\n\t}\r\n\r\n\toptimize() {\r\n\r\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\r\n\r\n\t\t\tthis.tracks[ i ].optimize();\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\tconst tracks = [];\r\n\r\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\r\n\r\n\t\t\ttracks.push( this.tracks[ i ].clone() );\r\n\r\n\t\t}\r\n\r\n\t\treturn new this.constructor( this.name, this.duration, tracks, this.blendMode );\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\treturn this.constructor.toJSON( this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction getTrackTypeForValueTypeName( typeName ) {\r\n\r\n\tswitch ( typeName.toLowerCase() ) {\r\n\r\n\t\tcase 'scalar':\r\n\t\tcase 'double':\r\n\t\tcase 'float':\r\n\t\tcase 'number':\r\n\t\tcase 'integer':\r\n\r\n\t\t\treturn NumberKeyframeTrack;\r\n\r\n\t\tcase 'vector':\r\n\t\tcase 'vector2':\r\n\t\tcase 'vector3':\r\n\t\tcase 'vector4':\r\n\r\n\t\t\treturn VectorKeyframeTrack;\r\n\r\n\t\tcase 'color':\r\n\r\n\t\t\treturn ColorKeyframeTrack;\r\n\r\n\t\tcase 'quaternion':\r\n\r\n\t\t\treturn QuaternionKeyframeTrack;\r\n\r\n\t\tcase 'bool':\r\n\t\tcase 'boolean':\r\n\r\n\t\t\treturn BooleanKeyframeTrack;\r\n\r\n\t\tcase 'string':\r\n\r\n\t\t\treturn StringKeyframeTrack;\r\n\r\n\t}\r\n\r\n\tthrow new Error( 'THREE.KeyframeTrack: Unsupported typeName: ' + typeName );\r\n\r\n}\r\n\r\nfunction parseKeyframeTrack( json ) {\r\n\r\n\tif ( json.type === undefined ) {\r\n\r\n\t\tthrow new Error( 'THREE.KeyframeTrack: track type undefined, can not parse' );\r\n\r\n\t}\r\n\r\n\tconst trackType = getTrackTypeForValueTypeName( json.type );\r\n\r\n\tif ( json.times === undefined ) {\r\n\r\n\t\tconst times = [], values = [];\r\n\r\n\t\tflattenJSON( json.keys, times, values, 'value' );\r\n\r\n\t\tjson.times = times;\r\n\t\tjson.values = values;\r\n\r\n\t}\r\n\r\n\t// derived classes can define a static parse method\r\n\tif ( trackType.parse !== undefined ) {\r\n\r\n\t\treturn trackType.parse( json );\r\n\r\n\t} else {\r\n\r\n\t\t// by default, we assume a constructor compatible with the base\r\n\t\treturn new trackType( json.name, json.times, json.values, json.interpolation );\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst Cache = {\r\n\r\n\tenabled: false,\r\n\r\n\tfiles: {},\r\n\r\n\tadd: function ( key, file ) {\r\n\r\n\t\tif ( this.enabled === false ) return;\r\n\r\n\t\t// console.log( 'THREE.Cache', 'Adding key:', key );\r\n\r\n\t\tthis.files[ key ] = file;\r\n\r\n\t},\r\n\r\n\tget: function ( key ) {\r\n\r\n\t\tif ( this.enabled === false ) return;\r\n\r\n\t\t// console.log( 'THREE.Cache', 'Checking key:', key );\r\n\r\n\t\treturn this.files[ key ];\r\n\r\n\t},\r\n\r\n\tremove: function ( key ) {\r\n\r\n\t\tdelete this.files[ key ];\r\n\r\n\t},\r\n\r\n\tclear: function () {\r\n\r\n\t\tthis.files = {};\r\n\r\n\t}\r\n\r\n};\r\n\r\nclass LoadingManager {\r\n\r\n\tconstructor( onLoad, onProgress, onError ) {\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\tlet isLoading = false;\r\n\t\tlet itemsLoaded = 0;\r\n\t\tlet itemsTotal = 0;\r\n\t\tlet urlModifier = undefined;\r\n\t\tconst handlers = [];\r\n\r\n\t\t// Refer to #5689 for the reason why we don't set .onStart\r\n\t\t// in the constructor\r\n\r\n\t\tthis.onStart = undefined;\r\n\t\tthis.onLoad = onLoad;\r\n\t\tthis.onProgress = onProgress;\r\n\t\tthis.onError = onError;\r\n\r\n\t\tthis.itemStart = function ( url ) {\r\n\r\n\t\t\titemsTotal ++;\r\n\r\n\t\t\tif ( isLoading === false ) {\r\n\r\n\t\t\t\tif ( scope.onStart !== undefined ) {\r\n\r\n\t\t\t\t\tscope.onStart( url, itemsLoaded, itemsTotal );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tisLoading = true;\r\n\r\n\t\t};\r\n\r\n\t\tthis.itemEnd = function ( url ) {\r\n\r\n\t\t\titemsLoaded ++;\r\n\r\n\t\t\tif ( scope.onProgress !== undefined ) {\r\n\r\n\t\t\t\tscope.onProgress( url, itemsLoaded, itemsTotal );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( itemsLoaded === itemsTotal ) {\r\n\r\n\t\t\t\tisLoading = false;\r\n\r\n\t\t\t\tif ( scope.onLoad !== undefined ) {\r\n\r\n\t\t\t\t\tscope.onLoad();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tthis.itemError = function ( url ) {\r\n\r\n\t\t\tif ( scope.onError !== undefined ) {\r\n\r\n\t\t\t\tscope.onError( url );\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tthis.resolveURL = function ( url ) {\r\n\r\n\t\t\tif ( urlModifier ) {\r\n\r\n\t\t\t\treturn urlModifier( url );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn url;\r\n\r\n\t\t};\r\n\r\n\t\tthis.setURLModifier = function ( transform ) {\r\n\r\n\t\t\turlModifier = transform;\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t\tthis.addHandler = function ( regex, loader ) {\r\n\r\n\t\t\thandlers.push( regex, loader );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t\tthis.removeHandler = function ( regex ) {\r\n\r\n\t\t\tconst index = handlers.indexOf( regex );\r\n\r\n\t\t\tif ( index !== - 1 ) {\r\n\r\n\t\t\t\thandlers.splice( index, 2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t\tthis.getHandler = function ( file ) {\r\n\r\n\t\t\tfor ( let i = 0, l = handlers.length; i < l; i += 2 ) {\r\n\r\n\t\t\t\tconst regex = handlers[ i ];\r\n\t\t\t\tconst loader = handlers[ i + 1 ];\r\n\r\n\t\t\t\tif ( regex.global ) regex.lastIndex = 0; // see #17920\r\n\r\n\t\t\t\tif ( regex.test( file ) ) {\r\n\r\n\t\t\t\t\treturn loader;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn null;\r\n\r\n\t\t};\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst DefaultLoadingManager = /*@__PURE__*/ new LoadingManager();\r\n\r\nclass Loader {\r\n\r\n\tconstructor( manager ) {\r\n\r\n\t\tthis.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;\r\n\r\n\t\tthis.crossOrigin = 'anonymous';\r\n\t\tthis.withCredentials = false;\r\n\t\tthis.path = '';\r\n\t\tthis.resourcePath = '';\r\n\t\tthis.requestHeader = {};\r\n\r\n\t}\r\n\r\n\tload( /* url, onLoad, onProgress, onError */ ) {}\r\n\r\n\tloadAsync( url, onProgress ) {\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\treturn new Promise( function ( resolve, reject ) {\r\n\r\n\t\t\tscope.load( url, resolve, onProgress, reject );\r\n\r\n\t\t} );\r\n\r\n\t}\r\n\r\n\tparse( /* data */ ) {}\r\n\r\n\tsetCrossOrigin( crossOrigin ) {\r\n\r\n\t\tthis.crossOrigin = crossOrigin;\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetWithCredentials( value ) {\r\n\r\n\t\tthis.withCredentials = value;\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetPath( path ) {\r\n\r\n\t\tthis.path = path;\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetResourcePath( resourcePath ) {\r\n\r\n\t\tthis.resourcePath = resourcePath;\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetRequestHeader( requestHeader ) {\r\n\r\n\t\tthis.requestHeader = requestHeader;\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nLoader.DEFAULT_MATERIAL_NAME = '__DEFAULT';\r\n\r\nconst loading = {};\r\n\r\nclass HttpError extends Error {\r\n\r\n\tconstructor( message, response ) {\r\n\r\n\t\tsuper( message );\r\n\t\tthis.response = response;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass FileLoader extends Loader {\r\n\r\n\tconstructor( manager ) {\r\n\r\n\t\tsuper( manager );\r\n\r\n\t}\r\n\r\n\tload( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tif ( url === undefined ) url = '';\r\n\r\n\t\tif ( this.path !== undefined ) url = this.path + url;\r\n\r\n\t\turl = this.manager.resolveURL( url );\r\n\r\n\t\tconst cached = Cache.get( url );\r\n\r\n\t\tif ( cached !== undefined ) {\r\n\r\n\t\t\tthis.manager.itemStart( url );\r\n\r\n\t\t\tsetTimeout( () => {\r\n\r\n\t\t\t\tif ( onLoad ) onLoad( cached );\r\n\r\n\t\t\t\tthis.manager.itemEnd( url );\r\n\r\n\t\t\t}, 0 );\r\n\r\n\t\t\treturn cached;\r\n\r\n\t\t}\r\n\r\n\t\t// Check if request is duplicate\r\n\r\n\t\tif ( loading[ url ] !== undefined ) {\r\n\r\n\t\t\tloading[ url ].push( {\r\n\r\n\t\t\t\tonLoad: onLoad,\r\n\t\t\t\tonProgress: onProgress,\r\n\t\t\t\tonError: onError\r\n\r\n\t\t\t} );\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\t// Initialise array for duplicate requests\r\n\t\tloading[ url ] = [];\r\n\r\n\t\tloading[ url ].push( {\r\n\t\t\tonLoad: onLoad,\r\n\t\t\tonProgress: onProgress,\r\n\t\t\tonError: onError,\r\n\t\t} );\r\n\r\n\t\t// create request\r\n\t\tconst req = new Request( url, {\r\n\t\t\theaders: new Headers( this.requestHeader ),\r\n\t\t\tcredentials: this.withCredentials ? 'include' : 'same-origin',\r\n\t\t\t// An abort controller could be added within a future PR\r\n\t\t} );\r\n\r\n\t\t// record states ( avoid data race )\r\n\t\tconst mimeType = this.mimeType;\r\n\t\tconst responseType = this.responseType;\r\n\r\n\t\t// start the fetch\r\n\t\tfetch( req )\r\n\t\t\t.then( response => {\r\n\r\n\t\t\t\tif ( response.status === 200 || response.status === 0 ) {\r\n\r\n\t\t\t\t\t// Some browsers return HTTP Status 0 when using non-http protocol\r\n\t\t\t\t\t// e.g. 'file://' or 'data://'. Handle as success.\r\n\r\n\t\t\t\t\tif ( response.status === 0 ) {\r\n\r\n\t\t\t\t\t\tconsole.warn( 'THREE.FileLoader: HTTP Status 0 received.' );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Workaround: Checking if response.body === undefined for Alipay browser #23548\r\n\r\n\t\t\t\t\tif ( typeof ReadableStream === 'undefined' || response.body === undefined || response.body.getReader === undefined ) {\r\n\r\n\t\t\t\t\t\treturn response;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst callbacks = loading[ url ];\r\n\t\t\t\t\tconst reader = response.body.getReader();\r\n\r\n\t\t\t\t\t// Nginx needs X-File-Size check\r\n\t\t\t\t\t// https://serverfault.com/questions/482875/why-does-nginx-remove-content-length-header-for-chunked-content\r\n\t\t\t\t\tconst contentLength = response.headers.get( 'X-File-Size' ) || response.headers.get( 'Content-Length' );\r\n\t\t\t\t\tconst total = contentLength ? parseInt( contentLength ) : 0;\r\n\t\t\t\t\tconst lengthComputable = total !== 0;\r\n\t\t\t\t\tlet loaded = 0;\r\n\r\n\t\t\t\t\t// periodically read data into the new stream tracking while download progress\r\n\t\t\t\t\tconst stream = new ReadableStream( {\r\n\t\t\t\t\t\tstart( controller ) {\r\n\r\n\t\t\t\t\t\t\treadData();\r\n\r\n\t\t\t\t\t\t\tfunction readData() {\r\n\r\n\t\t\t\t\t\t\t\treader.read().then( ( { done, value } ) => {\r\n\r\n\t\t\t\t\t\t\t\t\tif ( done ) {\r\n\r\n\t\t\t\t\t\t\t\t\t\tcontroller.close();\r\n\r\n\t\t\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\t\t\tloaded += value.byteLength;\r\n\r\n\t\t\t\t\t\t\t\t\t\tconst event = new ProgressEvent( 'progress', { lengthComputable, loaded, total } );\r\n\t\t\t\t\t\t\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tconst callback = callbacks[ i ];\r\n\t\t\t\t\t\t\t\t\t\t\tif ( callback.onProgress ) callback.onProgress( event );\r\n\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\tcontroller.enqueue( value );\r\n\t\t\t\t\t\t\t\t\t\treadData();\r\n\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t}, ( e ) => {\r\n\r\n\t\t\t\t\t\t\t\t\tcontroller.error( e );\r\n\r\n\t\t\t\t\t\t\t\t} );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} );\r\n\r\n\t\t\t\t\treturn new Response( stream );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tthrow new HttpError( `fetch for \"${response.url}\" responded with ${response.status}: ${response.statusText}`, response );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} )\r\n\t\t\t.then( response => {\r\n\r\n\t\t\t\tswitch ( responseType ) {\r\n\r\n\t\t\t\t\tcase 'arraybuffer':\r\n\r\n\t\t\t\t\t\treturn response.arrayBuffer();\r\n\r\n\t\t\t\t\tcase 'blob':\r\n\r\n\t\t\t\t\t\treturn response.blob();\r\n\r\n\t\t\t\t\tcase 'document':\r\n\r\n\t\t\t\t\t\treturn response.text()\r\n\t\t\t\t\t\t\t.then( text => {\r\n\r\n\t\t\t\t\t\t\t\tconst parser = new DOMParser();\r\n\t\t\t\t\t\t\t\treturn parser.parseFromString( text, mimeType );\r\n\r\n\t\t\t\t\t\t\t} );\r\n\r\n\t\t\t\t\tcase 'json':\r\n\r\n\t\t\t\t\t\treturn response.json();\r\n\r\n\t\t\t\t\tdefault:\r\n\r\n\t\t\t\t\t\tif ( mimeType === undefined ) {\r\n\r\n\t\t\t\t\t\t\treturn response.text();\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t// sniff encoding\r\n\t\t\t\t\t\t\tconst re = /charset=\"?([^;\"\\s]*)\"?/i;\r\n\t\t\t\t\t\t\tconst exec = re.exec( mimeType );\r\n\t\t\t\t\t\t\tconst label = exec && exec[ 1 ] ? exec[ 1 ].toLowerCase() : undefined;\r\n\t\t\t\t\t\t\tconst decoder = new TextDecoder( label );\r\n\t\t\t\t\t\t\treturn response.arrayBuffer().then( ab => decoder.decode( ab ) );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} )\r\n\t\t\t.then( data => {\r\n\r\n\t\t\t\t// Add to cache only on HTTP success, so that we do not cache\r\n\t\t\t\t// error response bodies as proper responses to requests.\r\n\t\t\t\tCache.add( url, data );\r\n\r\n\t\t\t\tconst callbacks = loading[ url ];\r\n\t\t\t\tdelete loading[ url ];\r\n\r\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tconst callback = callbacks[ i ];\r\n\t\t\t\t\tif ( callback.onLoad ) callback.onLoad( data );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} )\r\n\t\t\t.catch( err => {\r\n\r\n\t\t\t\t// Abort errors and other errors are handled the same\r\n\r\n\t\t\t\tconst callbacks = loading[ url ];\r\n\r\n\t\t\t\tif ( callbacks === undefined ) {\r\n\r\n\t\t\t\t\t// When onLoad was called and url was deleted in `loading`\r\n\t\t\t\t\tthis.manager.itemError( url );\r\n\t\t\t\t\tthrow err;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdelete loading[ url ];\r\n\r\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tconst callback = callbacks[ i ];\r\n\t\t\t\t\tif ( callback.onError ) callback.onError( err );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.manager.itemError( url );\r\n\r\n\t\t\t} )\r\n\t\t\t.finally( () => {\r\n\r\n\t\t\t\tthis.manager.itemEnd( url );\r\n\r\n\t\t\t} );\r\n\r\n\t\tthis.manager.itemStart( url );\r\n\r\n\t}\r\n\r\n\tsetResponseType( value ) {\r\n\r\n\t\tthis.responseType = value;\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetMimeType( value ) {\r\n\r\n\t\tthis.mimeType = value;\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass AnimationLoader extends Loader {\r\n\r\n\tconstructor( manager ) {\r\n\r\n\t\tsuper( manager );\r\n\r\n\t}\r\n\r\n\tload( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\tconst loader = new FileLoader( this.manager );\r\n\t\tloader.setPath( this.path );\r\n\t\tloader.setRequestHeader( this.requestHeader );\r\n\t\tloader.setWithCredentials( this.withCredentials );\r\n\t\tloader.load( url, function ( text ) {\r\n\r\n\t\t\ttry {\r\n\r\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\r\n\r\n\t\t\t} catch ( e ) {\r\n\r\n\t\t\t\tif ( onError ) {\r\n\r\n\t\t\t\t\tonError( e );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tconsole.error( e );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tscope.manager.itemError( url );\r\n\r\n\t\t\t}\r\n\r\n\t\t}, onProgress, onError );\r\n\r\n\t}\r\n\r\n\tparse( json ) {\r\n\r\n\t\tconst animations = [];\r\n\r\n\t\tfor ( let i = 0; i < json.length; i ++ ) {\r\n\r\n\t\t\tconst clip = AnimationClip.parse( json[ i ] );\r\n\r\n\t\t\tanimations.push( clip );\r\n\r\n\t\t}\r\n\r\n\t\treturn animations;\r\n\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Abstract Base class to block based textures loader (dds, pvr, ...)\r\n *\r\n * Sub classes have to implement the parse() method which will be used in load().\r\n */\r\n\r\nclass CompressedTextureLoader extends Loader {\r\n\r\n\tconstructor( manager ) {\r\n\r\n\t\tsuper( manager );\r\n\r\n\t}\r\n\r\n\tload( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\tconst images = [];\r\n\r\n\t\tconst texture = new CompressedTexture();\r\n\r\n\t\tconst loader = new FileLoader( this.manager );\r\n\t\tloader.setPath( this.path );\r\n\t\tloader.setResponseType( 'arraybuffer' );\r\n\t\tloader.setRequestHeader( this.requestHeader );\r\n\t\tloader.setWithCredentials( scope.withCredentials );\r\n\r\n\t\tlet loaded = 0;\r\n\r\n\t\tfunction loadTexture( i ) {\r\n\r\n\t\t\tloader.load( url[ i ], function ( buffer ) {\r\n\r\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\r\n\r\n\t\t\t\timages[ i ] = {\r\n\t\t\t\t\twidth: texDatas.width,\r\n\t\t\t\t\theight: texDatas.height,\r\n\t\t\t\t\tformat: texDatas.format,\r\n\t\t\t\t\tmipmaps: texDatas.mipmaps\r\n\t\t\t\t};\r\n\r\n\t\t\t\tloaded += 1;\r\n\r\n\t\t\t\tif ( loaded === 6 ) {\r\n\r\n\t\t\t\t\tif ( texDatas.mipmapCount === 1 ) texture.minFilter = LinearFilter;\r\n\r\n\t\t\t\t\ttexture.image = images;\r\n\t\t\t\t\ttexture.format = texDatas.format;\r\n\t\t\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}, onProgress, onError );\r\n\r\n\t\t}\r\n\r\n\t\tif ( Array.isArray( url ) ) {\r\n\r\n\t\t\tfor ( let i = 0, il = url.length; i < il; ++ i ) {\r\n\r\n\t\t\t\tloadTexture( i );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// compressed cubemap texture stored in a single DDS file\r\n\r\n\t\t\tloader.load( url, function ( buffer ) {\r\n\r\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\r\n\r\n\t\t\t\tif ( texDatas.isCubemap ) {\r\n\r\n\t\t\t\t\tconst faces = texDatas.mipmaps.length / texDatas.mipmapCount;\r\n\r\n\t\t\t\t\tfor ( let f = 0; f < faces; f ++ ) {\r\n\r\n\t\t\t\t\t\timages[ f ] = { mipmaps: [] };\r\n\r\n\t\t\t\t\t\tfor ( let i = 0; i < texDatas.mipmapCount; i ++ ) {\r\n\r\n\t\t\t\t\t\t\timages[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] );\r\n\t\t\t\t\t\t\timages[ f ].format = texDatas.format;\r\n\t\t\t\t\t\t\timages[ f ].width = texDatas.width;\r\n\t\t\t\t\t\t\timages[ f ].height = texDatas.height;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttexture.image = images;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\ttexture.image.width = texDatas.width;\r\n\t\t\t\t\ttexture.image.height = texDatas.height;\r\n\t\t\t\t\ttexture.mipmaps = texDatas.mipmaps;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( texDatas.mipmapCount === 1 ) {\r\n\r\n\t\t\t\t\ttexture.minFilter = LinearFilter;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttexture.format = texDatas.format;\r\n\t\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\t\tif ( onLoad ) onLoad( texture );\r\n\r\n\t\t\t}, onProgress, onError );\r\n\r\n\t\t}\r\n\r\n\t\treturn texture;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass ImageLoader extends Loader {\r\n\r\n\tconstructor( manager ) {\r\n\r\n\t\tsuper( manager );\r\n\r\n\t}\r\n\r\n\tload( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tif ( this.path !== undefined ) url = this.path + url;\r\n\r\n\t\turl = this.manager.resolveURL( url );\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\tconst cached = Cache.get( url );\r\n\r\n\t\tif ( cached !== undefined ) {\r\n\r\n\t\t\tscope.manager.itemStart( url );\r\n\r\n\t\t\tsetTimeout( function () {\r\n\r\n\t\t\t\tif ( onLoad ) onLoad( cached );\r\n\r\n\t\t\t\tscope.manager.itemEnd( url );\r\n\r\n\t\t\t}, 0 );\r\n\r\n\t\t\treturn cached;\r\n\r\n\t\t}\r\n\r\n\t\tconst image = createElementNS( 'img' );\r\n\r\n\t\tfunction onImageLoad() {\r\n\r\n\t\t\tremoveEventListeners();\r\n\r\n\t\t\tCache.add( url, this );\r\n\r\n\t\t\tif ( onLoad ) onLoad( this );\r\n\r\n\t\t\tscope.manager.itemEnd( url );\r\n\r\n\t\t}\r\n\r\n\t\tfunction onImageError( event ) {\r\n\r\n\t\t\tremoveEventListeners();\r\n\r\n\t\t\tif ( onError ) onError( event );\r\n\r\n\t\t\tscope.manager.itemError( url );\r\n\t\t\tscope.manager.itemEnd( url );\r\n\r\n\t\t}\r\n\r\n\t\tfunction removeEventListeners() {\r\n\r\n\t\t\timage.removeEventListener( 'load', onImageLoad, false );\r\n\t\t\timage.removeEventListener( 'error', onImageError, false );\r\n\r\n\t\t}\r\n\r\n\t\timage.addEventListener( 'load', onImageLoad, false );\r\n\t\timage.addEventListener( 'error', onImageError, false );\r\n\r\n\t\tif ( url.slice( 0, 5 ) !== 'data:' ) {\r\n\r\n\t\t\tif ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;\r\n\r\n\t\t}\r\n\r\n\t\tscope.manager.itemStart( url );\r\n\r\n\t\timage.src = url;\r\n\r\n\t\treturn image;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass CubeTextureLoader extends Loader {\r\n\r\n\tconstructor( manager ) {\r\n\r\n\t\tsuper( manager );\r\n\r\n\t}\r\n\r\n\tload( urls, onLoad, onProgress, onError ) {\r\n\r\n\t\tconst texture = new CubeTexture();\r\n\t\ttexture.colorSpace = SRGBColorSpace;\r\n\r\n\t\tconst loader = new ImageLoader( this.manager );\r\n\t\tloader.setCrossOrigin( this.crossOrigin );\r\n\t\tloader.setPath( this.path );\r\n\r\n\t\tlet loaded = 0;\r\n\r\n\t\tfunction loadTexture( i ) {\r\n\r\n\t\t\tloader.load( urls[ i ], function ( image ) {\r\n\r\n\t\t\t\ttexture.images[ i ] = image;\r\n\r\n\t\t\t\tloaded ++;\r\n\r\n\t\t\t\tif ( loaded === 6 ) {\r\n\r\n\t\t\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}, undefined, onError );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i < urls.length; ++ i ) {\r\n\r\n\t\t\tloadTexture( i );\r\n\r\n\t\t}\r\n\r\n\t\treturn texture;\r\n\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)\r\n *\r\n * Sub classes have to implement the parse() method which will be used in load().\r\n */\r\n\r\nclass DataTextureLoader extends Loader {\r\n\r\n\tconstructor( manager ) {\r\n\r\n\t\tsuper( manager );\r\n\r\n\t}\r\n\r\n\tload( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\tconst texture = new DataTexture();\r\n\r\n\t\tconst loader = new FileLoader( this.manager );\r\n\t\tloader.setResponseType( 'arraybuffer' );\r\n\t\tloader.setRequestHeader( this.requestHeader );\r\n\t\tloader.setPath( this.path );\r\n\t\tloader.setWithCredentials( scope.withCredentials );\r\n\t\tloader.load( url, function ( buffer ) {\r\n\r\n\t\t\tlet texData;\r\n\r\n\t\t\ttry {\r\n\r\n\t\t\t\ttexData = scope.parse( buffer );\r\n\r\n\t\t\t} catch ( error ) {\r\n\r\n\t\t\t\tif ( onError !== undefined ) {\r\n\r\n\t\t\t\t\tonError( error );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tconsole.error( error );\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( texData.image !== undefined ) {\r\n\r\n\t\t\t\ttexture.image = texData.image;\r\n\r\n\t\t\t} else if ( texData.data !== undefined ) {\r\n\r\n\t\t\t\ttexture.image.width = texData.width;\r\n\t\t\t\ttexture.image.height = texData.height;\r\n\t\t\t\ttexture.image.data = texData.data;\r\n\r\n\t\t\t}\r\n\r\n\t\t\ttexture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;\r\n\t\t\ttexture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;\r\n\r\n\t\t\ttexture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;\r\n\t\t\ttexture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;\r\n\r\n\t\t\ttexture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;\r\n\r\n\t\t\tif ( texData.colorSpace !== undefined ) {\r\n\r\n\t\t\t\ttexture.colorSpace = texData.colorSpace;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( texData.flipY !== undefined ) {\r\n\r\n\t\t\t\ttexture.flipY = texData.flipY;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( texData.format !== undefined ) {\r\n\r\n\t\t\t\ttexture.format = texData.format;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( texData.type !== undefined ) {\r\n\r\n\t\t\t\ttexture.type = texData.type;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( texData.mipmaps !== undefined ) {\r\n\r\n\t\t\t\ttexture.mipmaps = texData.mipmaps;\r\n\t\t\t\ttexture.minFilter = LinearMipmapLinearFilter; // presumably...\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( texData.mipmapCount === 1 ) {\r\n\r\n\t\t\t\ttexture.minFilter = LinearFilter;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( texData.generateMipmaps !== undefined ) {\r\n\r\n\t\t\t\ttexture.generateMipmaps = texData.generateMipmaps;\r\n\r\n\t\t\t}\r\n\r\n\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\tif ( onLoad ) onLoad( texture, texData );\r\n\r\n\t\t}, onProgress, onError );\r\n\r\n\r\n\t\treturn texture;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass TextureLoader extends Loader {\r\n\r\n\tconstructor( manager ) {\r\n\r\n\t\tsuper( manager );\r\n\r\n\t}\r\n\r\n\tload( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tconst texture = new Texture();\r\n\r\n\t\tconst loader = new ImageLoader( this.manager );\r\n\t\tloader.setCrossOrigin( this.crossOrigin );\r\n\t\tloader.setPath( this.path );\r\n\r\n\t\tloader.load( url, function ( image ) {\r\n\r\n\t\t\ttexture.image = image;\r\n\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\tif ( onLoad !== undefined ) {\r\n\r\n\t\t\t\tonLoad( texture );\r\n\r\n\t\t\t}\r\n\r\n\t\t}, onProgress, onError );\r\n\r\n\t\treturn texture;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Light extends Object3D {\r\n\r\n\tconstructor( color, intensity = 1 ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isLight = true;\r\n\r\n\t\tthis.type = 'Light';\r\n\r\n\t\tthis.color = new Color( color );\r\n\t\tthis.intensity = intensity;\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\t// Empty here in base class; some subclasses override.\r\n\r\n\t}\r\n\r\n\tcopy( source, recursive ) {\r\n\r\n\t\tsuper.copy( source, recursive );\r\n\r\n\t\tthis.color.copy( source.color );\r\n\t\tthis.intensity = source.intensity;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON( meta ) {\r\n\r\n\t\tconst data = super.toJSON( meta );\r\n\r\n\t\tdata.object.color = this.color.getHex();\r\n\t\tdata.object.intensity = this.intensity;\r\n\r\n\t\tif ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex();\r\n\r\n\t\tif ( this.distance !== undefined ) data.object.distance = this.distance;\r\n\t\tif ( this.angle !== undefined ) data.object.angle = this.angle;\r\n\t\tif ( this.decay !== undefined ) data.object.decay = this.decay;\r\n\t\tif ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra;\r\n\r\n\t\tif ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON();\r\n\t\tif ( this.target !== undefined ) data.object.target = this.target.uuid;\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass HemisphereLight extends Light {\r\n\r\n\tconstructor( skyColor, groundColor, intensity ) {\r\n\r\n\t\tsuper( skyColor, intensity );\r\n\r\n\t\tthis.isHemisphereLight = true;\r\n\r\n\t\tthis.type = 'HemisphereLight';\r\n\r\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\r\n\t\tthis.updateMatrix();\r\n\r\n\t\tthis.groundColor = new Color( groundColor );\r\n\r\n\t}\r\n\r\n\tcopy( source, recursive ) {\r\n\r\n\t\tsuper.copy( source, recursive );\r\n\r\n\t\tthis.groundColor.copy( source.groundColor );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _projScreenMatrix$1 = /*@__PURE__*/ new Matrix4();\r\nconst _lightPositionWorld$1 = /*@__PURE__*/ new Vector3();\r\nconst _lookTarget$1 = /*@__PURE__*/ new Vector3();\r\n\r\nclass LightShadow {\r\n\r\n\tconstructor( camera ) {\r\n\r\n\t\tthis.camera = camera;\r\n\r\n\t\tthis.intensity = 1;\r\n\r\n\t\tthis.bias = 0;\r\n\t\tthis.normalBias = 0;\r\n\t\tthis.radius = 1;\r\n\t\tthis.blurSamples = 8;\r\n\r\n\t\tthis.mapSize = new Vector2( 512, 512 );\r\n\r\n\t\tthis.map = null;\r\n\t\tthis.mapPass = null;\r\n\t\tthis.matrix = new Matrix4();\r\n\r\n\t\tthis.autoUpdate = true;\r\n\t\tthis.needsUpdate = false;\r\n\r\n\t\tthis._frustum = new Frustum();\r\n\t\tthis._frameExtents = new Vector2( 1, 1 );\r\n\r\n\t\tthis._viewportCount = 1;\r\n\r\n\t\tthis._viewports = [\r\n\r\n\t\t\tnew Vector4( 0, 0, 1, 1 )\r\n\r\n\t\t];\r\n\r\n\t}\r\n\r\n\tgetViewportCount() {\r\n\r\n\t\treturn this._viewportCount;\r\n\r\n\t}\r\n\r\n\tgetFrustum() {\r\n\r\n\t\treturn this._frustum;\r\n\r\n\t}\r\n\r\n\tupdateMatrices( light ) {\r\n\r\n\t\tconst shadowCamera = this.camera;\r\n\t\tconst shadowMatrix = this.matrix;\r\n\r\n\t\t_lightPositionWorld$1.setFromMatrixPosition( light.matrixWorld );\r\n\t\tshadowCamera.position.copy( _lightPositionWorld$1 );\r\n\r\n\t\t_lookTarget$1.setFromMatrixPosition( light.target.matrixWorld );\r\n\t\tshadowCamera.lookAt( _lookTarget$1 );\r\n\t\tshadowCamera.updateMatrixWorld();\r\n\r\n\t\t_projScreenMatrix$1.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );\r\n\t\tthis._frustum.setFromProjectionMatrix( _projScreenMatrix$1 );\r\n\r\n\t\tshadowMatrix.set(\r\n\t\t\t0.5, 0.0, 0.0, 0.5,\r\n\t\t\t0.0, 0.5, 0.0, 0.5,\r\n\t\t\t0.0, 0.0, 0.5, 0.5,\r\n\t\t\t0.0, 0.0, 0.0, 1.0\r\n\t\t);\r\n\r\n\t\tshadowMatrix.multiply( _projScreenMatrix$1 );\r\n\r\n\t}\r\n\r\n\tgetViewport( viewportIndex ) {\r\n\r\n\t\treturn this._viewports[ viewportIndex ];\r\n\r\n\t}\r\n\r\n\tgetFrameExtents() {\r\n\r\n\t\treturn this._frameExtents;\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tif ( this.map ) {\r\n\r\n\t\t\tthis.map.dispose();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.mapPass ) {\r\n\r\n\t\t\tthis.mapPass.dispose();\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.camera = source.camera.clone();\r\n\r\n\t\tthis.intensity = source.intensity;\r\n\r\n\t\tthis.bias = source.bias;\r\n\t\tthis.radius = source.radius;\r\n\r\n\t\tthis.mapSize.copy( source.mapSize );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst object = {};\r\n\r\n\t\tif ( this.intensity !== 1 ) object.intensity = this.intensity;\r\n\t\tif ( this.bias !== 0 ) object.bias = this.bias;\r\n\t\tif ( this.normalBias !== 0 ) object.normalBias = this.normalBias;\r\n\t\tif ( this.radius !== 1 ) object.radius = this.radius;\r\n\t\tif ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray();\r\n\r\n\t\tobject.camera = this.camera.toJSON( false ).object;\r\n\t\tdelete object.camera.matrix;\r\n\r\n\t\treturn object;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass SpotLightShadow extends LightShadow {\r\n\r\n\tconstructor() {\r\n\r\n\t\tsuper( new PerspectiveCamera( 50, 1, 0.5, 500 ) );\r\n\r\n\t\tthis.isSpotLightShadow = true;\r\n\r\n\t\tthis.focus = 1;\r\n\r\n\t}\r\n\r\n\tupdateMatrices( light ) {\r\n\r\n\t\tconst camera = this.camera;\r\n\r\n\t\tconst fov = RAD2DEG * 2 * light.angle * this.focus;\r\n\t\tconst aspect = this.mapSize.width / this.mapSize.height;\r\n\t\tconst far = light.distance || camera.far;\r\n\r\n\t\tif ( fov !== camera.fov || aspect !== camera.aspect || far !== camera.far ) {\r\n\r\n\t\t\tcamera.fov = fov;\r\n\t\t\tcamera.aspect = aspect;\r\n\t\t\tcamera.far = far;\r\n\t\t\tcamera.updateProjectionMatrix();\r\n\r\n\t\t}\r\n\r\n\t\tsuper.updateMatrices( light );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.focus = source.focus;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass SpotLight extends Light {\r\n\r\n\tconstructor( color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 2 ) {\r\n\r\n\t\tsuper( color, intensity );\r\n\r\n\t\tthis.isSpotLight = true;\r\n\r\n\t\tthis.type = 'SpotLight';\r\n\r\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\r\n\t\tthis.updateMatrix();\r\n\r\n\t\tthis.target = new Object3D();\r\n\r\n\t\tthis.distance = distance;\r\n\t\tthis.angle = angle;\r\n\t\tthis.penumbra = penumbra;\r\n\t\tthis.decay = decay;\r\n\r\n\t\tthis.map = null;\r\n\r\n\t\tthis.shadow = new SpotLightShadow();\r\n\r\n\t}\r\n\r\n\tget power() {\r\n\r\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\r\n\t\t// by convention for a spotlight, luminous power (lm) = π * luminous intensity (cd)\r\n\t\treturn this.intensity * Math.PI;\r\n\r\n\t}\r\n\r\n\tset power( power ) {\r\n\r\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\r\n\t\tthis.intensity = power / Math.PI;\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.shadow.dispose();\r\n\r\n\t}\r\n\r\n\tcopy( source, recursive ) {\r\n\r\n\t\tsuper.copy( source, recursive );\r\n\r\n\t\tthis.distance = source.distance;\r\n\t\tthis.angle = source.angle;\r\n\t\tthis.penumbra = source.penumbra;\r\n\t\tthis.decay = source.decay;\r\n\r\n\t\tthis.target = source.target.clone();\r\n\r\n\t\tthis.shadow = source.shadow.clone();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _projScreenMatrix = /*@__PURE__*/ new Matrix4();\r\nconst _lightPositionWorld = /*@__PURE__*/ new Vector3();\r\nconst _lookTarget = /*@__PURE__*/ new Vector3();\r\n\r\nclass PointLightShadow extends LightShadow {\r\n\r\n\tconstructor() {\r\n\r\n\t\tsuper( new PerspectiveCamera( 90, 1, 0.5, 500 ) );\r\n\r\n\t\tthis.isPointLightShadow = true;\r\n\r\n\t\tthis._frameExtents = new Vector2( 4, 2 );\r\n\r\n\t\tthis._viewportCount = 6;\r\n\r\n\t\tthis._viewports = [\r\n\t\t\t// These viewports map a cube-map onto a 2D texture with the\r\n\t\t\t// following orientation:\r\n\t\t\t//\r\n\t\t\t// xzXZ\r\n\t\t\t// y Y\r\n\t\t\t//\r\n\t\t\t// X - Positive x direction\r\n\t\t\t// x - Negative x direction\r\n\t\t\t// Y - Positive y direction\r\n\t\t\t// y - Negative y direction\r\n\t\t\t// Z - Positive z direction\r\n\t\t\t// z - Negative z direction\r\n\r\n\t\t\t// positive X\r\n\t\t\tnew Vector4( 2, 1, 1, 1 ),\r\n\t\t\t// negative X\r\n\t\t\tnew Vector4( 0, 1, 1, 1 ),\r\n\t\t\t// positive Z\r\n\t\t\tnew Vector4( 3, 1, 1, 1 ),\r\n\t\t\t// negative Z\r\n\t\t\tnew Vector4( 1, 1, 1, 1 ),\r\n\t\t\t// positive Y\r\n\t\t\tnew Vector4( 3, 0, 1, 1 ),\r\n\t\t\t// negative Y\r\n\t\t\tnew Vector4( 1, 0, 1, 1 )\r\n\t\t];\r\n\r\n\t\tthis._cubeDirections = [\r\n\t\t\tnew Vector3( 1, 0, 0 ), new Vector3( - 1, 0, 0 ), new Vector3( 0, 0, 1 ),\r\n\t\t\tnew Vector3( 0, 0, - 1 ), new Vector3( 0, 1, 0 ), new Vector3( 0, - 1, 0 )\r\n\t\t];\r\n\r\n\t\tthis._cubeUps = [\r\n\t\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ),\r\n\t\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 0, 1 ),\tnew Vector3( 0, 0, - 1 )\r\n\t\t];\r\n\r\n\t}\r\n\r\n\tupdateMatrices( light, viewportIndex = 0 ) {\r\n\r\n\t\tconst camera = this.camera;\r\n\t\tconst shadowMatrix = this.matrix;\r\n\r\n\t\tconst far = light.distance || camera.far;\r\n\r\n\t\tif ( far !== camera.far ) {\r\n\r\n\t\t\tcamera.far = far;\r\n\t\t\tcamera.updateProjectionMatrix();\r\n\r\n\t\t}\r\n\r\n\t\t_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );\r\n\t\tcamera.position.copy( _lightPositionWorld );\r\n\r\n\t\t_lookTarget.copy( camera.position );\r\n\t\t_lookTarget.add( this._cubeDirections[ viewportIndex ] );\r\n\t\tcamera.up.copy( this._cubeUps[ viewportIndex ] );\r\n\t\tcamera.lookAt( _lookTarget );\r\n\t\tcamera.updateMatrixWorld();\r\n\r\n\t\tshadowMatrix.makeTranslation( - _lightPositionWorld.x, - _lightPositionWorld.y, - _lightPositionWorld.z );\r\n\r\n\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\r\n\t\tthis._frustum.setFromProjectionMatrix( _projScreenMatrix );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass PointLight extends Light {\r\n\r\n\tconstructor( color, intensity, distance = 0, decay = 2 ) {\r\n\r\n\t\tsuper( color, intensity );\r\n\r\n\t\tthis.isPointLight = true;\r\n\r\n\t\tthis.type = 'PointLight';\r\n\r\n\t\tthis.distance = distance;\r\n\t\tthis.decay = decay;\r\n\r\n\t\tthis.shadow = new PointLightShadow();\r\n\r\n\t}\r\n\r\n\tget power() {\r\n\r\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\r\n\t\t// for an isotropic light source, luminous power (lm) = 4 π luminous intensity (cd)\r\n\t\treturn this.intensity * 4 * Math.PI;\r\n\r\n\t}\r\n\r\n\tset power( power ) {\r\n\r\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\r\n\t\tthis.intensity = power / ( 4 * Math.PI );\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.shadow.dispose();\r\n\r\n\t}\r\n\r\n\tcopy( source, recursive ) {\r\n\r\n\t\tsuper.copy( source, recursive );\r\n\r\n\t\tthis.distance = source.distance;\r\n\t\tthis.decay = source.decay;\r\n\r\n\t\tthis.shadow = source.shadow.clone();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass DirectionalLightShadow extends LightShadow {\r\n\r\n\tconstructor() {\r\n\r\n\t\tsuper( new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) );\r\n\r\n\t\tthis.isDirectionalLightShadow = true;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass DirectionalLight extends Light {\r\n\r\n\tconstructor( color, intensity ) {\r\n\r\n\t\tsuper( color, intensity );\r\n\r\n\t\tthis.isDirectionalLight = true;\r\n\r\n\t\tthis.type = 'DirectionalLight';\r\n\r\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\r\n\t\tthis.updateMatrix();\r\n\r\n\t\tthis.target = new Object3D();\r\n\r\n\t\tthis.shadow = new DirectionalLightShadow();\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.shadow.dispose();\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.target = source.target.clone();\r\n\t\tthis.shadow = source.shadow.clone();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass AmbientLight extends Light {\r\n\r\n\tconstructor( color, intensity ) {\r\n\r\n\t\tsuper( color, intensity );\r\n\r\n\t\tthis.isAmbientLight = true;\r\n\r\n\t\tthis.type = 'AmbientLight';\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass RectAreaLight extends Light {\r\n\r\n\tconstructor( color, intensity, width = 10, height = 10 ) {\r\n\r\n\t\tsuper( color, intensity );\r\n\r\n\t\tthis.isRectAreaLight = true;\r\n\r\n\t\tthis.type = 'RectAreaLight';\r\n\r\n\t\tthis.width = width;\r\n\t\tthis.height = height;\r\n\r\n\t}\r\n\r\n\tget power() {\r\n\r\n\t\t// compute the light's luminous power (in lumens) from its intensity (in nits)\r\n\t\treturn this.intensity * this.width * this.height * Math.PI;\r\n\r\n\t}\r\n\r\n\tset power( power ) {\r\n\r\n\t\t// set the light's intensity (in nits) from the desired luminous power (in lumens)\r\n\t\tthis.intensity = power / ( this.width * this.height * Math.PI );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.width = source.width;\r\n\t\tthis.height = source.height;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON( meta ) {\r\n\r\n\t\tconst data = super.toJSON( meta );\r\n\r\n\t\tdata.object.width = this.width;\r\n\t\tdata.object.height = this.height;\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Primary reference:\r\n * https://graphics.stanford.edu/papers/envmap/envmap.pdf\r\n *\r\n * Secondary reference:\r\n * https://www.ppsloan.org/publications/StupidSH36.pdf\r\n */\r\n\r\n// 3-band SH defined by 9 coefficients\r\n\r\nclass SphericalHarmonics3 {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.isSphericalHarmonics3 = true;\r\n\r\n\t\tthis.coefficients = [];\r\n\r\n\t\tfor ( let i = 0; i < 9; i ++ ) {\r\n\r\n\t\t\tthis.coefficients.push( new Vector3() );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tset( coefficients ) {\r\n\r\n\t\tfor ( let i = 0; i < 9; i ++ ) {\r\n\r\n\t\t\tthis.coefficients[ i ].copy( coefficients[ i ] );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tzero() {\r\n\r\n\t\tfor ( let i = 0; i < 9; i ++ ) {\r\n\r\n\t\t\tthis.coefficients[ i ].set( 0, 0, 0 );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t// get the radiance in the direction of the normal\r\n\t// target is a Vector3\r\n\tgetAt( normal, target ) {\r\n\r\n\t\t// normal is assumed to be unit length\r\n\r\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\r\n\r\n\t\tconst coeff = this.coefficients;\r\n\r\n\t\t// band 0\r\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.282095 );\r\n\r\n\t\t// band 1\r\n\t\ttarget.addScaledVector( coeff[ 1 ], 0.488603 * y );\r\n\t\ttarget.addScaledVector( coeff[ 2 ], 0.488603 * z );\r\n\t\ttarget.addScaledVector( coeff[ 3 ], 0.488603 * x );\r\n\r\n\t\t// band 2\r\n\t\ttarget.addScaledVector( coeff[ 4 ], 1.092548 * ( x * y ) );\r\n\t\ttarget.addScaledVector( coeff[ 5 ], 1.092548 * ( y * z ) );\r\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.315392 * ( 3.0 * z * z - 1.0 ) );\r\n\t\ttarget.addScaledVector( coeff[ 7 ], 1.092548 * ( x * z ) );\r\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.546274 * ( x * x - y * y ) );\r\n\r\n\t\treturn target;\r\n\r\n\t}\r\n\r\n\t// get the irradiance (radiance convolved with cosine lobe) in the direction of the normal\r\n\t// target is a Vector3\r\n\t// https://graphics.stanford.edu/papers/envmap/envmap.pdf\r\n\tgetIrradianceAt( normal, target ) {\r\n\r\n\t\t// normal is assumed to be unit length\r\n\r\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\r\n\r\n\t\tconst coeff = this.coefficients;\r\n\r\n\t\t// band 0\r\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.886227 ); // π * 0.282095\r\n\r\n\t\t// band 1\r\n\t\ttarget.addScaledVector( coeff[ 1 ], 2.0 * 0.511664 * y ); // ( 2 * π / 3 ) * 0.488603\r\n\t\ttarget.addScaledVector( coeff[ 2 ], 2.0 * 0.511664 * z );\r\n\t\ttarget.addScaledVector( coeff[ 3 ], 2.0 * 0.511664 * x );\r\n\r\n\t\t// band 2\r\n\t\ttarget.addScaledVector( coeff[ 4 ], 2.0 * 0.429043 * x * y ); // ( π / 4 ) * 1.092548\r\n\t\ttarget.addScaledVector( coeff[ 5 ], 2.0 * 0.429043 * y * z );\r\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.743125 * z * z - 0.247708 ); // ( π / 4 ) * 0.315392 * 3\r\n\t\ttarget.addScaledVector( coeff[ 7 ], 2.0 * 0.429043 * x * z );\r\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.429043 * ( x * x - y * y ) ); // ( π / 4 ) * 0.546274\r\n\r\n\t\treturn target;\r\n\r\n\t}\r\n\r\n\tadd( sh ) {\r\n\r\n\t\tfor ( let i = 0; i < 9; i ++ ) {\r\n\r\n\t\t\tthis.coefficients[ i ].add( sh.coefficients[ i ] );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\taddScaledSH( sh, s ) {\r\n\r\n\t\tfor ( let i = 0; i < 9; i ++ ) {\r\n\r\n\t\t\tthis.coefficients[ i ].addScaledVector( sh.coefficients[ i ], s );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tscale( s ) {\r\n\r\n\t\tfor ( let i = 0; i < 9; i ++ ) {\r\n\r\n\t\t\tthis.coefficients[ i ].multiplyScalar( s );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tlerp( sh, alpha ) {\r\n\r\n\t\tfor ( let i = 0; i < 9; i ++ ) {\r\n\r\n\t\t\tthis.coefficients[ i ].lerp( sh.coefficients[ i ], alpha );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tequals( sh ) {\r\n\r\n\t\tfor ( let i = 0; i < 9; i ++ ) {\r\n\r\n\t\t\tif ( ! this.coefficients[ i ].equals( sh.coefficients[ i ] ) ) {\r\n\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t}\r\n\r\n\tcopy( sh ) {\r\n\r\n\t\treturn this.set( sh.coefficients );\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n\tfromArray( array, offset = 0 ) {\r\n\r\n\t\tconst coefficients = this.coefficients;\r\n\r\n\t\tfor ( let i = 0; i < 9; i ++ ) {\r\n\r\n\t\t\tcoefficients[ i ].fromArray( array, offset + ( i * 3 ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoArray( array = [], offset = 0 ) {\r\n\r\n\t\tconst coefficients = this.coefficients;\r\n\r\n\t\tfor ( let i = 0; i < 9; i ++ ) {\r\n\r\n\t\t\tcoefficients[ i ].toArray( array, offset + ( i * 3 ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn array;\r\n\r\n\t}\r\n\r\n\t// evaluate the basis functions\r\n\t// shBasis is an Array[ 9 ]\r\n\tstatic getBasisAt( normal, shBasis ) {\r\n\r\n\t\t// normal is assumed to be unit length\r\n\r\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\r\n\r\n\t\t// band 0\r\n\t\tshBasis[ 0 ] = 0.282095;\r\n\r\n\t\t// band 1\r\n\t\tshBasis[ 1 ] = 0.488603 * y;\r\n\t\tshBasis[ 2 ] = 0.488603 * z;\r\n\t\tshBasis[ 3 ] = 0.488603 * x;\r\n\r\n\t\t// band 2\r\n\t\tshBasis[ 4 ] = 1.092548 * x * y;\r\n\t\tshBasis[ 5 ] = 1.092548 * y * z;\r\n\t\tshBasis[ 6 ] = 0.315392 * ( 3 * z * z - 1 );\r\n\t\tshBasis[ 7 ] = 1.092548 * x * z;\r\n\t\tshBasis[ 8 ] = 0.546274 * ( x * x - y * y );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass LightProbe extends Light {\r\n\r\n\tconstructor( sh = new SphericalHarmonics3(), intensity = 1 ) {\r\n\r\n\t\tsuper( undefined, intensity );\r\n\r\n\t\tthis.isLightProbe = true;\r\n\r\n\t\tthis.sh = sh;\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.sh.copy( source.sh );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tfromJSON( json ) {\r\n\r\n\t\tthis.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();\r\n\t\tthis.sh.fromArray( json.sh );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON( meta ) {\r\n\r\n\t\tconst data = super.toJSON( meta );\r\n\r\n\t\tdata.object.sh = this.sh.toArray();\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass MaterialLoader extends Loader {\r\n\r\n\tconstructor( manager ) {\r\n\r\n\t\tsuper( manager );\r\n\t\tthis.textures = {};\r\n\r\n\t}\r\n\r\n\tload( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\tconst loader = new FileLoader( scope.manager );\r\n\t\tloader.setPath( scope.path );\r\n\t\tloader.setRequestHeader( scope.requestHeader );\r\n\t\tloader.setWithCredentials( scope.withCredentials );\r\n\t\tloader.load( url, function ( text ) {\r\n\r\n\t\t\ttry {\r\n\r\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\r\n\r\n\t\t\t} catch ( e ) {\r\n\r\n\t\t\t\tif ( onError ) {\r\n\r\n\t\t\t\t\tonError( e );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tconsole.error( e );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tscope.manager.itemError( url );\r\n\r\n\t\t\t}\r\n\r\n\t\t}, onProgress, onError );\r\n\r\n\t}\r\n\r\n\tparse( json ) {\r\n\r\n\t\tconst textures = this.textures;\r\n\r\n\t\tfunction getTexture( name ) {\r\n\r\n\t\t\tif ( textures[ name ] === undefined ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.MaterialLoader: Undefined texture', name );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn textures[ name ];\r\n\r\n\t\t}\r\n\r\n\t\tconst material = MaterialLoader.createMaterialFromType( json.type );\r\n\r\n\t\tif ( json.uuid !== undefined ) material.uuid = json.uuid;\r\n\t\tif ( json.name !== undefined ) material.name = json.name;\r\n\t\tif ( json.color !== undefined && material.color !== undefined ) material.color.setHex( json.color );\r\n\t\tif ( json.roughness !== undefined ) material.roughness = json.roughness;\r\n\t\tif ( json.metalness !== undefined ) material.metalness = json.metalness;\r\n\t\tif ( json.sheen !== undefined ) material.sheen = json.sheen;\r\n\t\tif ( json.sheenColor !== undefined ) material.sheenColor = new Color().setHex( json.sheenColor );\r\n\t\tif ( json.sheenRoughness !== undefined ) material.sheenRoughness = json.sheenRoughness;\r\n\t\tif ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive );\r\n\t\tif ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular );\r\n\t\tif ( json.specularIntensity !== undefined ) material.specularIntensity = json.specularIntensity;\r\n\t\tif ( json.specularColor !== undefined && material.specularColor !== undefined ) material.specularColor.setHex( json.specularColor );\r\n\t\tif ( json.shininess !== undefined ) material.shininess = json.shininess;\r\n\t\tif ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;\r\n\t\tif ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;\r\n\t\tif ( json.dispersion !== undefined ) material.dispersion = json.dispersion;\r\n\t\tif ( json.iridescence !== undefined ) material.iridescence = json.iridescence;\r\n\t\tif ( json.iridescenceIOR !== undefined ) material.iridescenceIOR = json.iridescenceIOR;\r\n\t\tif ( json.iridescenceThicknessRange !== undefined ) material.iridescenceThicknessRange = json.iridescenceThicknessRange;\r\n\t\tif ( json.transmission !== undefined ) material.transmission = json.transmission;\r\n\t\tif ( json.thickness !== undefined ) material.thickness = json.thickness;\r\n\t\tif ( json.attenuationDistance !== undefined ) material.attenuationDistance = json.attenuationDistance;\r\n\t\tif ( json.attenuationColor !== undefined && material.attenuationColor !== undefined ) material.attenuationColor.setHex( json.attenuationColor );\r\n\t\tif ( json.anisotropy !== undefined ) material.anisotropy = json.anisotropy;\r\n\t\tif ( json.anisotropyRotation !== undefined ) material.anisotropyRotation = json.anisotropyRotation;\r\n\t\tif ( json.fog !== undefined ) material.fog = json.fog;\r\n\t\tif ( json.flatShading !== undefined ) material.flatShading = json.flatShading;\r\n\t\tif ( json.blending !== undefined ) material.blending = json.blending;\r\n\t\tif ( json.combine !== undefined ) material.combine = json.combine;\r\n\t\tif ( json.side !== undefined ) material.side = json.side;\r\n\t\tif ( json.shadowSide !== undefined ) material.shadowSide = json.shadowSide;\r\n\t\tif ( json.opacity !== undefined ) material.opacity = json.opacity;\r\n\t\tif ( json.transparent !== undefined ) material.transparent = json.transparent;\r\n\t\tif ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;\r\n\t\tif ( json.alphaHash !== undefined ) material.alphaHash = json.alphaHash;\r\n\t\tif ( json.depthFunc !== undefined ) material.depthFunc = json.depthFunc;\r\n\t\tif ( json.depthTest !== undefined ) material.depthTest = json.depthTest;\r\n\t\tif ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;\r\n\t\tif ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;\r\n\t\tif ( json.blendSrc !== undefined ) material.blendSrc = json.blendSrc;\r\n\t\tif ( json.blendDst !== undefined ) material.blendDst = json.blendDst;\r\n\t\tif ( json.blendEquation !== undefined ) material.blendEquation = json.blendEquation;\r\n\t\tif ( json.blendSrcAlpha !== undefined ) material.blendSrcAlpha = json.blendSrcAlpha;\r\n\t\tif ( json.blendDstAlpha !== undefined ) material.blendDstAlpha = json.blendDstAlpha;\r\n\t\tif ( json.blendEquationAlpha !== undefined ) material.blendEquationAlpha = json.blendEquationAlpha;\r\n\t\tif ( json.blendColor !== undefined && material.blendColor !== undefined ) material.blendColor.setHex( json.blendColor );\r\n\t\tif ( json.blendAlpha !== undefined ) material.blendAlpha = json.blendAlpha;\r\n\t\tif ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;\r\n\t\tif ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;\r\n\t\tif ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;\r\n\t\tif ( json.stencilFuncMask !== undefined ) material.stencilFuncMask = json.stencilFuncMask;\r\n\t\tif ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;\r\n\t\tif ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;\r\n\t\tif ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;\r\n\t\tif ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;\r\n\r\n\t\tif ( json.wireframe !== undefined ) material.wireframe = json.wireframe;\r\n\t\tif ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;\r\n\t\tif ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap;\r\n\t\tif ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin;\r\n\r\n\t\tif ( json.rotation !== undefined ) material.rotation = json.rotation;\r\n\r\n\t\tif ( json.linewidth !== undefined ) material.linewidth = json.linewidth;\r\n\t\tif ( json.dashSize !== undefined ) material.dashSize = json.dashSize;\r\n\t\tif ( json.gapSize !== undefined ) material.gapSize = json.gapSize;\r\n\t\tif ( json.scale !== undefined ) material.scale = json.scale;\r\n\r\n\t\tif ( json.polygonOffset !== undefined ) material.polygonOffset = json.polygonOffset;\r\n\t\tif ( json.polygonOffsetFactor !== undefined ) material.polygonOffsetFactor = json.polygonOffsetFactor;\r\n\t\tif ( json.polygonOffsetUnits !== undefined ) material.polygonOffsetUnits = json.polygonOffsetUnits;\r\n\r\n\t\tif ( json.dithering !== undefined ) material.dithering = json.dithering;\r\n\r\n\t\tif ( json.alphaToCoverage !== undefined ) material.alphaToCoverage = json.alphaToCoverage;\r\n\t\tif ( json.premultipliedAlpha !== undefined ) material.premultipliedAlpha = json.premultipliedAlpha;\r\n\t\tif ( json.forceSinglePass !== undefined ) material.forceSinglePass = json.forceSinglePass;\r\n\r\n\t\tif ( json.visible !== undefined ) material.visible = json.visible;\r\n\r\n\t\tif ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped;\r\n\r\n\t\tif ( json.userData !== undefined ) material.userData = json.userData;\r\n\r\n\t\tif ( json.vertexColors !== undefined ) {\r\n\r\n\t\t\tif ( typeof json.vertexColors === 'number' ) {\r\n\r\n\t\t\t\tmaterial.vertexColors = ( json.vertexColors > 0 ) ? true : false;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tmaterial.vertexColors = json.vertexColors;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// Shader Material\r\n\r\n\t\tif ( json.uniforms !== undefined ) {\r\n\r\n\t\t\tfor ( const name in json.uniforms ) {\r\n\r\n\t\t\t\tconst uniform = json.uniforms[ name ];\r\n\r\n\t\t\t\tmaterial.uniforms[ name ] = {};\r\n\r\n\t\t\t\tswitch ( uniform.type ) {\r\n\r\n\t\t\t\t\tcase 't':\r\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = getTexture( uniform.value );\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'c':\r\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Color().setHex( uniform.value );\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'v2':\r\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector2().fromArray( uniform.value );\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'v3':\r\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector3().fromArray( uniform.value );\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'v4':\r\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector4().fromArray( uniform.value );\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'm3':\r\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'm4':\r\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = uniform.value;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( json.defines !== undefined ) material.defines = json.defines;\r\n\t\tif ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;\r\n\t\tif ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;\r\n\t\tif ( json.glslVersion !== undefined ) material.glslVersion = json.glslVersion;\r\n\r\n\t\tif ( json.extensions !== undefined ) {\r\n\r\n\t\t\tfor ( const key in json.extensions ) {\r\n\r\n\t\t\t\tmaterial.extensions[ key ] = json.extensions[ key ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( json.lights !== undefined ) material.lights = json.lights;\r\n\t\tif ( json.clipping !== undefined ) material.clipping = json.clipping;\r\n\r\n\t\t// for PointsMaterial\r\n\r\n\t\tif ( json.size !== undefined ) material.size = json.size;\r\n\t\tif ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;\r\n\r\n\t\t// maps\r\n\r\n\t\tif ( json.map !== undefined ) material.map = getTexture( json.map );\r\n\t\tif ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap );\r\n\r\n\t\tif ( json.alphaMap !== undefined ) material.alphaMap = getTexture( json.alphaMap );\r\n\r\n\t\tif ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap );\r\n\t\tif ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale;\r\n\r\n\t\tif ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap );\r\n\t\tif ( json.normalMapType !== undefined ) material.normalMapType = json.normalMapType;\r\n\t\tif ( json.normalScale !== undefined ) {\r\n\r\n\t\t\tlet normalScale = json.normalScale;\r\n\r\n\t\t\tif ( Array.isArray( normalScale ) === false ) {\r\n\r\n\t\t\t\t// Blender exporter used to export a scalar. See #7459\r\n\r\n\t\t\t\tnormalScale = [ normalScale, normalScale ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tmaterial.normalScale = new Vector2().fromArray( normalScale );\r\n\r\n\t\t}\r\n\r\n\t\tif ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap );\r\n\t\tif ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;\r\n\t\tif ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;\r\n\r\n\t\tif ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap );\r\n\t\tif ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap );\r\n\r\n\t\tif ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap );\r\n\t\tif ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity;\r\n\r\n\t\tif ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );\r\n\t\tif ( json.specularIntensityMap !== undefined ) material.specularIntensityMap = getTexture( json.specularIntensityMap );\r\n\t\tif ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );\r\n\r\n\t\tif ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );\r\n\t\tif ( json.envMapRotation !== undefined ) material.envMapRotation.fromArray( json.envMapRotation );\r\n\t\tif ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;\r\n\r\n\t\tif ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;\r\n\t\tif ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio;\r\n\r\n\t\tif ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap );\r\n\t\tif ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;\r\n\r\n\t\tif ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap );\r\n\t\tif ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;\r\n\r\n\t\tif ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap );\r\n\r\n\t\tif ( json.clearcoatMap !== undefined ) material.clearcoatMap = getTexture( json.clearcoatMap );\r\n\t\tif ( json.clearcoatRoughnessMap !== undefined ) material.clearcoatRoughnessMap = getTexture( json.clearcoatRoughnessMap );\r\n\t\tif ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap );\r\n\t\tif ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );\r\n\r\n\t\tif ( json.iridescenceMap !== undefined ) material.iridescenceMap = getTexture( json.iridescenceMap );\r\n\t\tif ( json.iridescenceThicknessMap !== undefined ) material.iridescenceThicknessMap = getTexture( json.iridescenceThicknessMap );\r\n\r\n\t\tif ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap );\r\n\t\tif ( json.thicknessMap !== undefined ) material.thicknessMap = getTexture( json.thicknessMap );\r\n\r\n\t\tif ( json.anisotropyMap !== undefined ) material.anisotropyMap = getTexture( json.anisotropyMap );\r\n\r\n\t\tif ( json.sheenColorMap !== undefined ) material.sheenColorMap = getTexture( json.sheenColorMap );\r\n\t\tif ( json.sheenRoughnessMap !== undefined ) material.sheenRoughnessMap = getTexture( json.sheenRoughnessMap );\r\n\r\n\t\treturn material;\r\n\r\n\t}\r\n\r\n\tsetTextures( value ) {\r\n\r\n\t\tthis.textures = value;\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tstatic createMaterialFromType( type ) {\r\n\r\n\t\tconst materialLib = {\r\n\t\t\tShadowMaterial,\r\n\t\t\tSpriteMaterial,\r\n\t\t\tRawShaderMaterial,\r\n\t\t\tShaderMaterial,\r\n\t\t\tPointsMaterial,\r\n\t\t\tMeshPhysicalMaterial,\r\n\t\t\tMeshStandardMaterial,\r\n\t\t\tMeshPhongMaterial,\r\n\t\t\tMeshToonMaterial,\r\n\t\t\tMeshNormalMaterial,\r\n\t\t\tMeshLambertMaterial,\r\n\t\t\tMeshDepthMaterial,\r\n\t\t\tMeshDistanceMaterial,\r\n\t\t\tMeshBasicMaterial,\r\n\t\t\tMeshMatcapMaterial,\r\n\t\t\tLineDashedMaterial,\r\n\t\t\tLineBasicMaterial,\r\n\t\t\tMaterial\r\n\t\t};\r\n\r\n\t\treturn new materialLib[ type ]();\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass LoaderUtils {\r\n\r\n\tstatic decodeText( array ) { // @deprecated, r165\r\n\r\n\t\tconsole.warn( 'THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead.' );\r\n\r\n\t\tif ( typeof TextDecoder !== 'undefined' ) {\r\n\r\n\t\t\treturn new TextDecoder().decode( array );\r\n\r\n\t\t}\r\n\r\n\t\t// Avoid the String.fromCharCode.apply(null, array) shortcut, which\r\n\t\t// throws a \"maximum call stack size exceeded\" error for large arrays.\r\n\r\n\t\tlet s = '';\r\n\r\n\t\tfor ( let i = 0, il = array.length; i < il; i ++ ) {\r\n\r\n\t\t\t// Implicitly assumes little-endian.\r\n\t\t\ts += String.fromCharCode( array[ i ] );\r\n\r\n\t\t}\r\n\r\n\t\ttry {\r\n\r\n\t\t\t// merges multi-byte utf-8 characters.\r\n\r\n\t\t\treturn decodeURIComponent( escape( s ) );\r\n\r\n\t\t} catch ( e ) { // see #16358\r\n\r\n\t\t\treturn s;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tstatic extractUrlBase( url ) {\r\n\r\n\t\tconst index = url.lastIndexOf( '/' );\r\n\r\n\t\tif ( index === - 1 ) return './';\r\n\r\n\t\treturn url.slice( 0, index + 1 );\r\n\r\n\t}\r\n\r\n\tstatic resolveURL( url, path ) {\r\n\r\n\t\t// Invalid URL\r\n\t\tif ( typeof url !== 'string' || url === '' ) return '';\r\n\r\n\t\t// Host Relative URL\r\n\t\tif ( /^https?:\\/\\//i.test( path ) && /^\\//.test( url ) ) {\r\n\r\n\t\t\tpath = path.replace( /(^https?:\\/\\/[^\\/]+).*/i, '$1' );\r\n\r\n\t\t}\r\n\r\n\t\t// Absolute URL http://,https://,//\r\n\t\tif ( /^(https?:)?\\/\\//i.test( url ) ) return url;\r\n\r\n\t\t// Data URI\r\n\t\tif ( /^data:.*,.*$/i.test( url ) ) return url;\r\n\r\n\t\t// Blob URL\r\n\t\tif ( /^blob:.*$/i.test( url ) ) return url;\r\n\r\n\t\t// Relative URL\r\n\t\treturn path + url;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass InstancedBufferGeometry extends BufferGeometry {\r\n\r\n\tconstructor() {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isInstancedBufferGeometry = true;\r\n\r\n\t\tthis.type = 'InstancedBufferGeometry';\r\n\t\tthis.instanceCount = Infinity;\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.instanceCount = source.instanceCount;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoJSON() {\r\n\r\n\t\tconst data = super.toJSON();\r\n\r\n\t\tdata.instanceCount = this.instanceCount;\r\n\r\n\t\tdata.isInstancedBufferGeometry = true;\r\n\r\n\t\treturn data;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass BufferGeometryLoader extends Loader {\r\n\r\n\tconstructor( manager ) {\r\n\r\n\t\tsuper( manager );\r\n\r\n\t}\r\n\r\n\tload( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\tconst loader = new FileLoader( scope.manager );\r\n\t\tloader.setPath( scope.path );\r\n\t\tloader.setRequestHeader( scope.requestHeader );\r\n\t\tloader.setWithCredentials( scope.withCredentials );\r\n\t\tloader.load( url, function ( text ) {\r\n\r\n\t\t\ttry {\r\n\r\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\r\n\r\n\t\t\t} catch ( e ) {\r\n\r\n\t\t\t\tif ( onError ) {\r\n\r\n\t\t\t\t\tonError( e );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tconsole.error( e );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tscope.manager.itemError( url );\r\n\r\n\t\t\t}\r\n\r\n\t\t}, onProgress, onError );\r\n\r\n\t}\r\n\r\n\tparse( json ) {\r\n\r\n\t\tconst interleavedBufferMap = {};\r\n\t\tconst arrayBufferMap = {};\r\n\r\n\t\tfunction getInterleavedBuffer( json, uuid ) {\r\n\r\n\t\t\tif ( interleavedBufferMap[ uuid ] !== undefined ) return interleavedBufferMap[ uuid ];\r\n\r\n\t\t\tconst interleavedBuffers = json.interleavedBuffers;\r\n\t\t\tconst interleavedBuffer = interleavedBuffers[ uuid ];\r\n\r\n\t\t\tconst buffer = getArrayBuffer( json, interleavedBuffer.buffer );\r\n\r\n\t\t\tconst array = getTypedArray( interleavedBuffer.type, buffer );\r\n\t\t\tconst ib = new InterleavedBuffer( array, interleavedBuffer.stride );\r\n\t\t\tib.uuid = interleavedBuffer.uuid;\r\n\r\n\t\t\tinterleavedBufferMap[ uuid ] = ib;\r\n\r\n\t\t\treturn ib;\r\n\r\n\t\t}\r\n\r\n\t\tfunction getArrayBuffer( json, uuid ) {\r\n\r\n\t\t\tif ( arrayBufferMap[ uuid ] !== undefined ) return arrayBufferMap[ uuid ];\r\n\r\n\t\t\tconst arrayBuffers = json.arrayBuffers;\r\n\t\t\tconst arrayBuffer = arrayBuffers[ uuid ];\r\n\r\n\t\t\tconst ab = new Uint32Array( arrayBuffer ).buffer;\r\n\r\n\t\t\tarrayBufferMap[ uuid ] = ab;\r\n\r\n\t\t\treturn ab;\r\n\r\n\t\t}\r\n\r\n\t\tconst geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry();\r\n\r\n\t\tconst index = json.data.index;\r\n\r\n\t\tif ( index !== undefined ) {\r\n\r\n\t\t\tconst typedArray = getTypedArray( index.type, index.array );\r\n\t\t\tgeometry.setIndex( new BufferAttribute( typedArray, 1 ) );\r\n\r\n\t\t}\r\n\r\n\t\tconst attributes = json.data.attributes;\r\n\r\n\t\tfor ( const key in attributes ) {\r\n\r\n\t\t\tconst attribute = attributes[ key ];\r\n\t\t\tlet bufferAttribute;\r\n\r\n\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\r\n\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\r\n\t\t\t\tconst bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute;\r\n\t\t\t\tbufferAttribute = new bufferAttributeConstr( typedArray, attribute.itemSize, attribute.normalized );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\r\n\t\t\tif ( attribute.usage !== undefined ) bufferAttribute.setUsage( attribute.usage );\r\n\r\n\t\t\tgeometry.setAttribute( key, bufferAttribute );\r\n\r\n\t\t}\r\n\r\n\t\tconst morphAttributes = json.data.morphAttributes;\r\n\r\n\t\tif ( morphAttributes ) {\r\n\r\n\t\t\tfor ( const key in morphAttributes ) {\r\n\r\n\t\t\t\tconst attributeArray = morphAttributes[ key ];\r\n\r\n\t\t\t\tconst array = [];\r\n\r\n\t\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tconst attribute = attributeArray[ i ];\r\n\t\t\t\t\tlet bufferAttribute;\r\n\r\n\t\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\r\n\r\n\t\t\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\r\n\t\t\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\r\n\t\t\t\t\t\tbufferAttribute = new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\r\n\t\t\t\t\tarray.push( bufferAttribute );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tgeometry.morphAttributes[ key ] = array;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconst morphTargetsRelative = json.data.morphTargetsRelative;\r\n\r\n\t\tif ( morphTargetsRelative ) {\r\n\r\n\t\t\tgeometry.morphTargetsRelative = true;\r\n\r\n\t\t}\r\n\r\n\t\tconst groups = json.data.groups || json.data.drawcalls || json.data.offsets;\r\n\r\n\t\tif ( groups !== undefined ) {\r\n\r\n\t\t\tfor ( let i = 0, n = groups.length; i !== n; ++ i ) {\r\n\r\n\t\t\t\tconst group = groups[ i ];\r\n\r\n\t\t\t\tgeometry.addGroup( group.start, group.count, group.materialIndex );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconst boundingSphere = json.data.boundingSphere;\r\n\r\n\t\tif ( boundingSphere !== undefined ) {\r\n\r\n\t\t\tconst center = new Vector3();\r\n\r\n\t\t\tif ( boundingSphere.center !== undefined ) {\r\n\r\n\t\t\t\tcenter.fromArray( boundingSphere.center );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgeometry.boundingSphere = new Sphere( center, boundingSphere.radius );\r\n\r\n\t\t}\r\n\r\n\t\tif ( json.name ) geometry.name = json.name;\r\n\t\tif ( json.userData ) geometry.userData = json.userData;\r\n\r\n\t\treturn geometry;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass ObjectLoader extends Loader {\r\n\r\n\tconstructor( manager ) {\r\n\r\n\t\tsuper( manager );\r\n\r\n\t}\r\n\r\n\tload( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\r\n\t\tthis.resourcePath = this.resourcePath || path;\r\n\r\n\t\tconst loader = new FileLoader( this.manager );\r\n\t\tloader.setPath( this.path );\r\n\t\tloader.setRequestHeader( this.requestHeader );\r\n\t\tloader.setWithCredentials( this.withCredentials );\r\n\t\tloader.load( url, function ( text ) {\r\n\r\n\t\t\tlet json = null;\r\n\r\n\t\t\ttry {\r\n\r\n\t\t\t\tjson = JSON.parse( text );\r\n\r\n\t\t\t} catch ( error ) {\r\n\r\n\t\t\t\tif ( onError !== undefined ) onError( error );\r\n\r\n\t\t\t\tconsole.error( 'THREE:ObjectLoader: Can\\'t parse ' + url + '.', error.message );\r\n\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst metadata = json.metadata;\r\n\r\n\t\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\r\n\r\n\t\t\t\tif ( onError !== undefined ) onError( new Error( 'THREE.ObjectLoader: Can\\'t load ' + url ) );\r\n\r\n\t\t\t\tconsole.error( 'THREE.ObjectLoader: Can\\'t load ' + url );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tscope.parse( json, onLoad );\r\n\r\n\t\t}, onProgress, onError );\r\n\r\n\t}\r\n\r\n\tasync loadAsync( url, onProgress ) {\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\r\n\t\tthis.resourcePath = this.resourcePath || path;\r\n\r\n\t\tconst loader = new FileLoader( this.manager );\r\n\t\tloader.setPath( this.path );\r\n\t\tloader.setRequestHeader( this.requestHeader );\r\n\t\tloader.setWithCredentials( this.withCredentials );\r\n\r\n\t\tconst text = await loader.loadAsync( url, onProgress );\r\n\r\n\t\tconst json = JSON.parse( text );\r\n\r\n\t\tconst metadata = json.metadata;\r\n\r\n\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\r\n\r\n\t\t\tthrow new Error( 'THREE.ObjectLoader: Can\\'t load ' + url );\r\n\r\n\t\t}\r\n\r\n\t\treturn await scope.parseAsync( json );\r\n\r\n\t}\r\n\r\n\tparse( json, onLoad ) {\r\n\r\n\t\tconst animations = this.parseAnimations( json.animations );\r\n\t\tconst shapes = this.parseShapes( json.shapes );\r\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\r\n\r\n\t\tconst images = this.parseImages( json.images, function () {\r\n\r\n\t\t\tif ( onLoad !== undefined ) onLoad( object );\r\n\r\n\t\t} );\r\n\r\n\t\tconst textures = this.parseTextures( json.textures, images );\r\n\t\tconst materials = this.parseMaterials( json.materials, textures );\r\n\r\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\r\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\r\n\r\n\t\tthis.bindSkeletons( object, skeletons );\r\n\t\tthis.bindLightTargets( object );\r\n\r\n\t\t//\r\n\r\n\t\tif ( onLoad !== undefined ) {\r\n\r\n\t\t\tlet hasImages = false;\r\n\r\n\t\t\tfor ( const uuid in images ) {\r\n\r\n\t\t\t\tif ( images[ uuid ].data instanceof HTMLImageElement ) {\r\n\r\n\t\t\t\t\thasImages = true;\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( hasImages === false ) onLoad( object );\r\n\r\n\t\t}\r\n\r\n\t\treturn object;\r\n\r\n\t}\r\n\r\n\tasync parseAsync( json ) {\r\n\r\n\t\tconst animations = this.parseAnimations( json.animations );\r\n\t\tconst shapes = this.parseShapes( json.shapes );\r\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\r\n\r\n\t\tconst images = await this.parseImagesAsync( json.images );\r\n\r\n\t\tconst textures = this.parseTextures( json.textures, images );\r\n\t\tconst materials = this.parseMaterials( json.materials, textures );\r\n\r\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\r\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\r\n\r\n\t\tthis.bindSkeletons( object, skeletons );\r\n\t\tthis.bindLightTargets( object );\r\n\r\n\t\treturn object;\r\n\r\n\t}\r\n\r\n\tparseShapes( json ) {\r\n\r\n\t\tconst shapes = {};\r\n\r\n\t\tif ( json !== undefined ) {\r\n\r\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tconst shape = new Shape().fromJSON( json[ i ] );\r\n\r\n\t\t\t\tshapes[ shape.uuid ] = shape;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn shapes;\r\n\r\n\t}\r\n\r\n\tparseSkeletons( json, object ) {\r\n\r\n\t\tconst skeletons = {};\r\n\t\tconst bones = {};\r\n\r\n\t\t// generate bone lookup table\r\n\r\n\t\tobject.traverse( function ( child ) {\r\n\r\n\t\t\tif ( child.isBone ) bones[ child.uuid ] = child;\r\n\r\n\t\t} );\r\n\r\n\t\t// create skeletons\r\n\r\n\t\tif ( json !== undefined ) {\r\n\r\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tconst skeleton = new Skeleton().fromJSON( json[ i ], bones );\r\n\r\n\t\t\t\tskeletons[ skeleton.uuid ] = skeleton;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn skeletons;\r\n\r\n\t}\r\n\r\n\tparseGeometries( json, shapes ) {\r\n\r\n\t\tconst geometries = {};\r\n\r\n\t\tif ( json !== undefined ) {\r\n\r\n\t\t\tconst bufferGeometryLoader = new BufferGeometryLoader();\r\n\r\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tlet geometry;\r\n\t\t\t\tconst data = json[ i ];\r\n\r\n\t\t\t\tswitch ( data.type ) {\r\n\r\n\t\t\t\t\tcase 'BufferGeometry':\r\n\t\t\t\t\tcase 'InstancedBufferGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = bufferGeometryLoader.parse( data );\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tdefault:\r\n\r\n\t\t\t\t\t\tif ( data.type in Geometries ) {\r\n\r\n\t\t\t\t\t\t\tgeometry = Geometries[ data.type ].fromJSON( data, shapes );\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tconsole.warn( `THREE.ObjectLoader: Unsupported geometry type \"${ data.type }\"` );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tgeometry.uuid = data.uuid;\r\n\r\n\t\t\t\tif ( data.name !== undefined ) geometry.name = data.name;\r\n\t\t\t\tif ( data.userData !== undefined ) geometry.userData = data.userData;\r\n\r\n\t\t\t\tgeometries[ data.uuid ] = geometry;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn geometries;\r\n\r\n\t}\r\n\r\n\tparseMaterials( json, textures ) {\r\n\r\n\t\tconst cache = {}; // MultiMaterial\r\n\t\tconst materials = {};\r\n\r\n\t\tif ( json !== undefined ) {\r\n\r\n\t\t\tconst loader = new MaterialLoader();\r\n\t\t\tloader.setTextures( textures );\r\n\r\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tconst data = json[ i ];\r\n\r\n\t\t\t\tif ( cache[ data.uuid ] === undefined ) {\r\n\r\n\t\t\t\t\tcache[ data.uuid ] = loader.parse( data );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tmaterials[ data.uuid ] = cache[ data.uuid ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn materials;\r\n\r\n\t}\r\n\r\n\tparseAnimations( json ) {\r\n\r\n\t\tconst animations = {};\r\n\r\n\t\tif ( json !== undefined ) {\r\n\r\n\t\t\tfor ( let i = 0; i < json.length; i ++ ) {\r\n\r\n\t\t\t\tconst data = json[ i ];\r\n\r\n\t\t\t\tconst clip = AnimationClip.parse( data );\r\n\r\n\t\t\t\tanimations[ clip.uuid ] = clip;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn animations;\r\n\r\n\t}\r\n\r\n\tparseImages( json, onLoad ) {\r\n\r\n\t\tconst scope = this;\r\n\t\tconst images = {};\r\n\r\n\t\tlet loader;\r\n\r\n\t\tfunction loadImage( url ) {\r\n\r\n\t\t\tscope.manager.itemStart( url );\r\n\r\n\t\t\treturn loader.load( url, function () {\r\n\r\n\t\t\t\tscope.manager.itemEnd( url );\r\n\r\n\t\t\t}, undefined, function () {\r\n\r\n\t\t\t\tscope.manager.itemError( url );\r\n\t\t\t\tscope.manager.itemEnd( url );\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\tfunction deserializeImage( image ) {\r\n\r\n\t\t\tif ( typeof image === 'string' ) {\r\n\r\n\t\t\t\tconst url = image;\r\n\r\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\r\n\r\n\t\t\t\treturn loadImage( path );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif ( image.data ) {\r\n\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\r\n\t\t\t\t\t\twidth: image.width,\r\n\t\t\t\t\t\theight: image.height\r\n\t\t\t\t\t};\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn null;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( json !== undefined && json.length > 0 ) {\r\n\r\n\t\t\tconst manager = new LoadingManager( onLoad );\r\n\r\n\t\t\tloader = new ImageLoader( manager );\r\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\r\n\r\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tconst image = json[ i ];\r\n\t\t\t\tconst url = image.url;\r\n\r\n\t\t\t\tif ( Array.isArray( url ) ) {\r\n\r\n\t\t\t\t\t// load array of images e.g CubeTexture\r\n\r\n\t\t\t\t\tconst imageArray = [];\r\n\r\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\t\t\tconst currentUrl = url[ j ];\r\n\r\n\t\t\t\t\t\tconst deserializedImage = deserializeImage( currentUrl );\r\n\r\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\r\n\r\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\r\n\r\n\t\t\t\t\t\t\t\timageArray.push( deserializedImage );\r\n\r\n\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\r\n\r\n\t\t\t\t\t\t\t\timageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\timages[ image.uuid ] = new Source( imageArray );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// load single image\r\n\r\n\t\t\t\t\tconst deserializedImage = deserializeImage( image.url );\r\n\t\t\t\t\timages[ image.uuid ] = new Source( deserializedImage );\r\n\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn images;\r\n\r\n\t}\r\n\r\n\tasync parseImagesAsync( json ) {\r\n\r\n\t\tconst scope = this;\r\n\t\tconst images = {};\r\n\r\n\t\tlet loader;\r\n\r\n\t\tasync function deserializeImage( image ) {\r\n\r\n\t\t\tif ( typeof image === 'string' ) {\r\n\r\n\t\t\t\tconst url = image;\r\n\r\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\r\n\r\n\t\t\t\treturn await loader.loadAsync( path );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif ( image.data ) {\r\n\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\r\n\t\t\t\t\t\twidth: image.width,\r\n\t\t\t\t\t\theight: image.height\r\n\t\t\t\t\t};\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn null;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( json !== undefined && json.length > 0 ) {\r\n\r\n\t\t\tloader = new ImageLoader( this.manager );\r\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\r\n\r\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tconst image = json[ i ];\r\n\t\t\t\tconst url = image.url;\r\n\r\n\t\t\t\tif ( Array.isArray( url ) ) {\r\n\r\n\t\t\t\t\t// load array of images e.g CubeTexture\r\n\r\n\t\t\t\t\tconst imageArray = [];\r\n\r\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\t\t\tconst currentUrl = url[ j ];\r\n\r\n\t\t\t\t\t\tconst deserializedImage = await deserializeImage( currentUrl );\r\n\r\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\r\n\r\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\r\n\r\n\t\t\t\t\t\t\t\timageArray.push( deserializedImage );\r\n\r\n\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\r\n\r\n\t\t\t\t\t\t\t\timageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\timages[ image.uuid ] = new Source( imageArray );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// load single image\r\n\r\n\t\t\t\t\tconst deserializedImage = await deserializeImage( image.url );\r\n\t\t\t\t\timages[ image.uuid ] = new Source( deserializedImage );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn images;\r\n\r\n\t}\r\n\r\n\tparseTextures( json, images ) {\r\n\r\n\t\tfunction parseConstant( value, type ) {\r\n\r\n\t\t\tif ( typeof value === 'number' ) return value;\r\n\r\n\t\t\tconsole.warn( 'THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value );\r\n\r\n\t\t\treturn type[ value ];\r\n\r\n\t\t}\r\n\r\n\t\tconst textures = {};\r\n\r\n\t\tif ( json !== undefined ) {\r\n\r\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tconst data = json[ i ];\r\n\r\n\t\t\t\tif ( data.image === undefined ) {\r\n\r\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No \"image\" specified for', data.uuid );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( images[ data.image ] === undefined ) {\r\n\r\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined image', data.image );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst source = images[ data.image ];\r\n\t\t\t\tconst image = source.data;\r\n\r\n\t\t\t\tlet texture;\r\n\r\n\t\t\t\tif ( Array.isArray( image ) ) {\r\n\r\n\t\t\t\t\ttexture = new CubeTexture();\r\n\r\n\t\t\t\t\tif ( image.length === 6 ) texture.needsUpdate = true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif ( image && image.data ) {\r\n\r\n\t\t\t\t\t\ttexture = new DataTexture();\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\ttexture = new Texture();\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( image ) texture.needsUpdate = true; // textures can have undefined image data\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttexture.source = source;\r\n\r\n\t\t\t\ttexture.uuid = data.uuid;\r\n\r\n\t\t\t\tif ( data.name !== undefined ) texture.name = data.name;\r\n\r\n\t\t\t\tif ( data.mapping !== undefined ) texture.mapping = parseConstant( data.mapping, TEXTURE_MAPPING );\r\n\t\t\t\tif ( data.channel !== undefined ) texture.channel = data.channel;\r\n\r\n\t\t\t\tif ( data.offset !== undefined ) texture.offset.fromArray( data.offset );\r\n\t\t\t\tif ( data.repeat !== undefined ) texture.repeat.fromArray( data.repeat );\r\n\t\t\t\tif ( data.center !== undefined ) texture.center.fromArray( data.center );\r\n\t\t\t\tif ( data.rotation !== undefined ) texture.rotation = data.rotation;\r\n\r\n\t\t\t\tif ( data.wrap !== undefined ) {\r\n\r\n\t\t\t\t\ttexture.wrapS = parseConstant( data.wrap[ 0 ], TEXTURE_WRAPPING );\r\n\t\t\t\t\ttexture.wrapT = parseConstant( data.wrap[ 1 ], TEXTURE_WRAPPING );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( data.format !== undefined ) texture.format = data.format;\r\n\t\t\t\tif ( data.internalFormat !== undefined ) texture.internalFormat = data.internalFormat;\r\n\t\t\t\tif ( data.type !== undefined ) texture.type = data.type;\r\n\t\t\t\tif ( data.colorSpace !== undefined ) texture.colorSpace = data.colorSpace;\r\n\r\n\t\t\t\tif ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER );\r\n\t\t\t\tif ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER );\r\n\t\t\t\tif ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy;\r\n\r\n\t\t\t\tif ( data.flipY !== undefined ) texture.flipY = data.flipY;\r\n\r\n\t\t\t\tif ( data.generateMipmaps !== undefined ) texture.generateMipmaps = data.generateMipmaps;\r\n\t\t\t\tif ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;\r\n\t\t\t\tif ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;\r\n\t\t\t\tif ( data.compareFunction !== undefined ) texture.compareFunction = data.compareFunction;\r\n\r\n\t\t\t\tif ( data.userData !== undefined ) texture.userData = data.userData;\r\n\r\n\t\t\t\ttextures[ data.uuid ] = texture;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn textures;\r\n\r\n\t}\r\n\r\n\tparseObject( data, geometries, materials, textures, animations ) {\r\n\r\n\t\tlet object;\r\n\r\n\t\tfunction getGeometry( name ) {\r\n\r\n\t\t\tif ( geometries[ name ] === undefined ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined geometry', name );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn geometries[ name ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getMaterial( name ) {\r\n\r\n\t\t\tif ( name === undefined ) return undefined;\r\n\r\n\t\t\tif ( Array.isArray( name ) ) {\r\n\r\n\t\t\t\tconst array = [];\r\n\r\n\t\t\t\tfor ( let i = 0, l = name.length; i < l; i ++ ) {\r\n\r\n\t\t\t\t\tconst uuid = name[ i ];\r\n\r\n\t\t\t\t\tif ( materials[ uuid ] === undefined ) {\r\n\r\n\t\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', uuid );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tarray.push( materials[ uuid ] );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn array;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( materials[ name ] === undefined ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', name );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn materials[ name ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getTexture( uuid ) {\r\n\r\n\t\t\tif ( textures[ uuid ] === undefined ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined texture', uuid );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn textures[ uuid ];\r\n\r\n\t\t}\r\n\r\n\t\tlet geometry, material;\r\n\r\n\t\tswitch ( data.type ) {\r\n\r\n\t\t\tcase 'Scene':\r\n\r\n\t\t\t\tobject = new Scene();\r\n\r\n\t\t\t\tif ( data.background !== undefined ) {\r\n\r\n\t\t\t\t\tif ( Number.isInteger( data.background ) ) {\r\n\r\n\t\t\t\t\t\tobject.background = new Color( data.background );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tobject.background = getTexture( data.background );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( data.environment !== undefined ) {\r\n\r\n\t\t\t\t\tobject.environment = getTexture( data.environment );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( data.fog !== undefined ) {\r\n\r\n\t\t\t\t\tif ( data.fog.type === 'Fog' ) {\r\n\r\n\t\t\t\t\t\tobject.fog = new Fog( data.fog.color, data.fog.near, data.fog.far );\r\n\r\n\t\t\t\t\t} else if ( data.fog.type === 'FogExp2' ) {\r\n\r\n\t\t\t\t\t\tobject.fog = new FogExp2( data.fog.color, data.fog.density );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( data.fog.name !== '' ) {\r\n\r\n\t\t\t\t\t\tobject.fog.name = data.fog.name;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;\r\n\t\t\t\tif ( data.backgroundIntensity !== undefined ) object.backgroundIntensity = data.backgroundIntensity;\r\n\t\t\t\tif ( data.backgroundRotation !== undefined ) object.backgroundRotation.fromArray( data.backgroundRotation );\r\n\r\n\t\t\t\tif ( data.environmentIntensity !== undefined ) object.environmentIntensity = data.environmentIntensity;\r\n\t\t\t\tif ( data.environmentRotation !== undefined ) object.environmentRotation.fromArray( data.environmentRotation );\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'PerspectiveCamera':\r\n\r\n\t\t\t\tobject = new PerspectiveCamera( data.fov, data.aspect, data.near, data.far );\r\n\r\n\t\t\t\tif ( data.focus !== undefined ) object.focus = data.focus;\r\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\r\n\t\t\t\tif ( data.filmGauge !== undefined ) object.filmGauge = data.filmGauge;\r\n\t\t\t\tif ( data.filmOffset !== undefined ) object.filmOffset = data.filmOffset;\r\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'OrthographicCamera':\r\n\r\n\t\t\t\tobject = new OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far );\r\n\r\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\r\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'AmbientLight':\r\n\r\n\t\t\t\tobject = new AmbientLight( data.color, data.intensity );\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'DirectionalLight':\r\n\r\n\t\t\t\tobject = new DirectionalLight( data.color, data.intensity );\r\n\t\t\t\tobject.target = data.target || '';\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'PointLight':\r\n\r\n\t\t\t\tobject = new PointLight( data.color, data.intensity, data.distance, data.decay );\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'RectAreaLight':\r\n\r\n\t\t\t\tobject = new RectAreaLight( data.color, data.intensity, data.width, data.height );\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'SpotLight':\r\n\r\n\t\t\t\tobject = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay );\r\n\t\t\t\tobject.target = data.target || '';\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'HemisphereLight':\r\n\r\n\t\t\t\tobject = new HemisphereLight( data.color, data.groundColor, data.intensity );\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'LightProbe':\r\n\r\n\t\t\t\tobject = new LightProbe().fromJSON( data );\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'SkinnedMesh':\r\n\r\n\t\t\t\tgeometry = getGeometry( data.geometry );\r\n\t\t\t \tmaterial = getMaterial( data.material );\r\n\r\n\t\t\t\tobject = new SkinnedMesh( geometry, material );\r\n\r\n\t\t\t\tif ( data.bindMode !== undefined ) object.bindMode = data.bindMode;\r\n\t\t\t\tif ( data.bindMatrix !== undefined ) object.bindMatrix.fromArray( data.bindMatrix );\r\n\t\t\t\tif ( data.skeleton !== undefined ) object.skeleton = data.skeleton;\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'Mesh':\r\n\r\n\t\t\t\tgeometry = getGeometry( data.geometry );\r\n\t\t\t\tmaterial = getMaterial( data.material );\r\n\r\n\t\t\t\tobject = new Mesh( geometry, material );\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'InstancedMesh':\r\n\r\n\t\t\t\tgeometry = getGeometry( data.geometry );\r\n\t\t\t\tmaterial = getMaterial( data.material );\r\n\t\t\t\tconst count = data.count;\r\n\t\t\t\tconst instanceMatrix = data.instanceMatrix;\r\n\t\t\t\tconst instanceColor = data.instanceColor;\r\n\r\n\t\t\t\tobject = new InstancedMesh( geometry, material, count );\r\n\t\t\t\tobject.instanceMatrix = new InstancedBufferAttribute( new Float32Array( instanceMatrix.array ), 16 );\r\n\t\t\t\tif ( instanceColor !== undefined ) object.instanceColor = new InstancedBufferAttribute( new Float32Array( instanceColor.array ), instanceColor.itemSize );\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'BatchedMesh':\r\n\r\n\t\t\t\tgeometry = getGeometry( data.geometry );\r\n\t\t\t\tmaterial = getMaterial( data.material );\r\n\r\n\t\t\t\tobject = new BatchedMesh( data.maxInstanceCount, data.maxVertexCount, data.maxIndexCount, material );\r\n\t\t\t\tobject.geometry = geometry;\r\n\t\t\t\tobject.perObjectFrustumCulled = data.perObjectFrustumCulled;\r\n\t\t\t\tobject.sortObjects = data.sortObjects;\r\n\r\n\t\t\t\tobject._drawRanges = data.drawRanges;\r\n\t\t\t\tobject._reservedRanges = data.reservedRanges;\r\n\r\n\t\t\t\tobject._visibility = data.visibility;\r\n\t\t\t\tobject._active = data.active;\r\n\t\t\t\tobject._bounds = data.bounds.map( bound => {\r\n\r\n\t\t\t\t\tconst box = new Box3();\r\n\t\t\t\t\tbox.min.fromArray( bound.boxMin );\r\n\t\t\t\t\tbox.max.fromArray( bound.boxMax );\r\n\r\n\t\t\t\t\tconst sphere = new Sphere();\r\n\t\t\t\t\tsphere.radius = bound.sphereRadius;\r\n\t\t\t\t\tsphere.center.fromArray( bound.sphereCenter );\r\n\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tboxInitialized: bound.boxInitialized,\r\n\t\t\t\t\t\tbox: box,\r\n\r\n\t\t\t\t\t\tsphereInitialized: bound.sphereInitialized,\r\n\t\t\t\t\t\tsphere: sphere\r\n\t\t\t\t\t};\r\n\r\n\t\t\t\t} );\r\n\r\n\t\t\t\tobject._maxInstanceCount = data.maxInstanceCount;\r\n\t\t\t\tobject._maxVertexCount = data.maxVertexCount;\r\n\t\t\t\tobject._maxIndexCount = data.maxIndexCount;\r\n\r\n\t\t\t\tobject._geometryInitialized = data.geometryInitialized;\r\n\t\t\t\tobject._geometryCount = data.geometryCount;\r\n\r\n\t\t\t\tobject._matricesTexture = getTexture( data.matricesTexture.uuid );\r\n\t\t\t\tif ( data.colorsTexture !== undefined ) object._colorsTexture = getTexture( data.colorsTexture.uuid );\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'LOD':\r\n\r\n\t\t\t\tobject = new LOD();\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'Line':\r\n\r\n\t\t\t\tobject = new Line( getGeometry( data.geometry ), getMaterial( data.material ) );\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'LineLoop':\r\n\r\n\t\t\t\tobject = new LineLoop( getGeometry( data.geometry ), getMaterial( data.material ) );\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'LineSegments':\r\n\r\n\t\t\t\tobject = new LineSegments( getGeometry( data.geometry ), getMaterial( data.material ) );\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'PointCloud':\r\n\t\t\tcase 'Points':\r\n\r\n\t\t\t\tobject = new Points( getGeometry( data.geometry ), getMaterial( data.material ) );\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'Sprite':\r\n\r\n\t\t\t\tobject = new Sprite( getMaterial( data.material ) );\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'Group':\r\n\r\n\t\t\t\tobject = new Group();\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'Bone':\r\n\r\n\t\t\t\tobject = new Bone();\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tdefault:\r\n\r\n\t\t\t\tobject = new Object3D();\r\n\r\n\t\t}\r\n\r\n\t\tobject.uuid = data.uuid;\r\n\r\n\t\tif ( data.name !== undefined ) object.name = data.name;\r\n\r\n\t\tif ( data.matrix !== undefined ) {\r\n\r\n\t\t\tobject.matrix.fromArray( data.matrix );\r\n\r\n\t\t\tif ( data.matrixAutoUpdate !== undefined ) object.matrixAutoUpdate = data.matrixAutoUpdate;\r\n\t\t\tif ( object.matrixAutoUpdate ) object.matrix.decompose( object.position, object.quaternion, object.scale );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tif ( data.position !== undefined ) object.position.fromArray( data.position );\r\n\t\t\tif ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation );\r\n\t\t\tif ( data.quaternion !== undefined ) object.quaternion.fromArray( data.quaternion );\r\n\t\t\tif ( data.scale !== undefined ) object.scale.fromArray( data.scale );\r\n\r\n\t\t}\r\n\r\n\t\tif ( data.up !== undefined ) object.up.fromArray( data.up );\r\n\r\n\t\tif ( data.castShadow !== undefined ) object.castShadow = data.castShadow;\r\n\t\tif ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow;\r\n\r\n\t\tif ( data.shadow ) {\r\n\r\n\t\t\tif ( data.shadow.intensity !== undefined ) object.shadow.intensity = data.shadow.intensity;\r\n\t\t\tif ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;\r\n\t\t\tif ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;\r\n\t\t\tif ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;\r\n\t\t\tif ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize );\r\n\t\t\tif ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera );\r\n\r\n\t\t}\r\n\r\n\t\tif ( data.visible !== undefined ) object.visible = data.visible;\r\n\t\tif ( data.frustumCulled !== undefined ) object.frustumCulled = data.frustumCulled;\r\n\t\tif ( data.renderOrder !== undefined ) object.renderOrder = data.renderOrder;\r\n\t\tif ( data.userData !== undefined ) object.userData = data.userData;\r\n\t\tif ( data.layers !== undefined ) object.layers.mask = data.layers;\r\n\r\n\t\tif ( data.children !== undefined ) {\r\n\r\n\t\t\tconst children = data.children;\r\n\r\n\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\r\n\r\n\t\t\t\tobject.add( this.parseObject( children[ i ], geometries, materials, textures, animations ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( data.animations !== undefined ) {\r\n\r\n\t\t\tconst objectAnimations = data.animations;\r\n\r\n\t\t\tfor ( let i = 0; i < objectAnimations.length; i ++ ) {\r\n\r\n\t\t\t\tconst uuid = objectAnimations[ i ];\r\n\r\n\t\t\t\tobject.animations.push( animations[ uuid ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( data.type === 'LOD' ) {\r\n\r\n\t\t\tif ( data.autoUpdate !== undefined ) object.autoUpdate = data.autoUpdate;\r\n\r\n\t\t\tconst levels = data.levels;\r\n\r\n\t\t\tfor ( let l = 0; l < levels.length; l ++ ) {\r\n\r\n\t\t\t\tconst level = levels[ l ];\r\n\t\t\t\tconst child = object.getObjectByProperty( 'uuid', level.object );\r\n\r\n\t\t\t\tif ( child !== undefined ) {\r\n\r\n\t\t\t\t\tobject.addLevel( child, level.distance, level.hysteresis );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn object;\r\n\r\n\t}\r\n\r\n\tbindSkeletons( object, skeletons ) {\r\n\r\n\t\tif ( Object.keys( skeletons ).length === 0 ) return;\r\n\r\n\t\tobject.traverse( function ( child ) {\r\n\r\n\t\t\tif ( child.isSkinnedMesh === true && child.skeleton !== undefined ) {\r\n\r\n\t\t\t\tconst skeleton = skeletons[ child.skeleton ];\r\n\r\n\t\t\t\tif ( skeleton === undefined ) {\r\n\r\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No skeleton found with UUID:', child.skeleton );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tchild.bind( skeleton, child.bindMatrix );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t}\r\n\r\n\tbindLightTargets( object ) {\r\n\r\n\t\tobject.traverse( function ( child ) {\r\n\r\n\t\t\tif ( child.isDirectionalLight || child.isSpotLight ) {\r\n\r\n\t\t\t\tconst uuid = child.target;\r\n\r\n\t\t\t\tconst target = object.getObjectByProperty( 'uuid', uuid );\r\n\r\n\t\t\t\tif ( target !== undefined ) {\r\n\r\n\t\t\t\t\tchild.target = target;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tchild.target = new Object3D();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst TEXTURE_MAPPING = {\r\n\tUVMapping: UVMapping,\r\n\tCubeReflectionMapping: CubeReflectionMapping,\r\n\tCubeRefractionMapping: CubeRefractionMapping,\r\n\tEquirectangularReflectionMapping: EquirectangularReflectionMapping,\r\n\tEquirectangularRefractionMapping: EquirectangularRefractionMapping,\r\n\tCubeUVReflectionMapping: CubeUVReflectionMapping\r\n};\r\n\r\nconst TEXTURE_WRAPPING = {\r\n\tRepeatWrapping: RepeatWrapping,\r\n\tClampToEdgeWrapping: ClampToEdgeWrapping,\r\n\tMirroredRepeatWrapping: MirroredRepeatWrapping\r\n};\r\n\r\nconst TEXTURE_FILTER = {\r\n\tNearestFilter: NearestFilter,\r\n\tNearestMipmapNearestFilter: NearestMipmapNearestFilter,\r\n\tNearestMipmapLinearFilter: NearestMipmapLinearFilter,\r\n\tLinearFilter: LinearFilter,\r\n\tLinearMipmapNearestFilter: LinearMipmapNearestFilter,\r\n\tLinearMipmapLinearFilter: LinearMipmapLinearFilter\r\n};\r\n\r\nclass ImageBitmapLoader extends Loader {\r\n\r\n\tconstructor( manager ) {\r\n\r\n\t\tsuper( manager );\r\n\r\n\t\tthis.isImageBitmapLoader = true;\r\n\r\n\t\tif ( typeof createImageBitmap === 'undefined' ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.ImageBitmapLoader: createImageBitmap() not supported.' );\r\n\r\n\t\t}\r\n\r\n\t\tif ( typeof fetch === 'undefined' ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.ImageBitmapLoader: fetch() not supported.' );\r\n\r\n\t\t}\r\n\r\n\t\tthis.options = { premultiplyAlpha: 'none' };\r\n\r\n\t}\r\n\r\n\tsetOptions( options ) {\r\n\r\n\t\tthis.options = options;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tload( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tif ( url === undefined ) url = '';\r\n\r\n\t\tif ( this.path !== undefined ) url = this.path + url;\r\n\r\n\t\turl = this.manager.resolveURL( url );\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\tconst cached = Cache.get( url );\r\n\r\n\t\tif ( cached !== undefined ) {\r\n\r\n\t\t\tscope.manager.itemStart( url );\r\n\r\n\t\t\t// If cached is a promise, wait for it to resolve\r\n\t\t\tif ( cached.then ) {\r\n\r\n\t\t\t\tcached.then( imageBitmap => {\r\n\r\n\t\t\t\t\tif ( onLoad ) onLoad( imageBitmap );\r\n\r\n\t\t\t\t\tscope.manager.itemEnd( url );\r\n\r\n\t\t\t\t} ).catch( e => {\r\n\r\n\t\t\t\t\tif ( onError ) onError( e );\r\n\r\n\t\t\t\t} );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// If cached is not a promise (i.e., it's already an imageBitmap)\r\n\t\t\tsetTimeout( function () {\r\n\r\n\t\t\t\tif ( onLoad ) onLoad( cached );\r\n\r\n\t\t\t\tscope.manager.itemEnd( url );\r\n\r\n\t\t\t}, 0 );\r\n\r\n\t\t\treturn cached;\r\n\r\n\t\t}\r\n\r\n\t\tconst fetchOptions = {};\r\n\t\tfetchOptions.credentials = ( this.crossOrigin === 'anonymous' ) ? 'same-origin' : 'include';\r\n\t\tfetchOptions.headers = this.requestHeader;\r\n\r\n\t\tconst promise = fetch( url, fetchOptions ).then( function ( res ) {\r\n\r\n\t\t\treturn res.blob();\r\n\r\n\t\t} ).then( function ( blob ) {\r\n\r\n\t\t\treturn createImageBitmap( blob, Object.assign( scope.options, { colorSpaceConversion: 'none' } ) );\r\n\r\n\t\t} ).then( function ( imageBitmap ) {\r\n\r\n\t\t\tCache.add( url, imageBitmap );\r\n\r\n\t\t\tif ( onLoad ) onLoad( imageBitmap );\r\n\r\n\t\t\tscope.manager.itemEnd( url );\r\n\r\n\t\t\treturn imageBitmap;\r\n\r\n\t\t} ).catch( function ( e ) {\r\n\r\n\t\t\tif ( onError ) onError( e );\r\n\r\n\t\t\tCache.remove( url );\r\n\r\n\t\t\tscope.manager.itemError( url );\r\n\t\t\tscope.manager.itemEnd( url );\r\n\r\n\t\t} );\r\n\r\n\t\tCache.add( url, promise );\r\n\t\tscope.manager.itemStart( url );\r\n\r\n\t}\r\n\r\n}\r\n\r\nlet _context;\r\n\r\nclass AudioContext {\r\n\r\n\tstatic getContext() {\r\n\r\n\t\tif ( _context === undefined ) {\r\n\r\n\t\t\t_context = new ( window.AudioContext || window.webkitAudioContext )();\r\n\r\n\t\t}\r\n\r\n\t\treturn _context;\r\n\r\n\t}\r\n\r\n\tstatic setContext( value ) {\r\n\r\n\t\t_context = value;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass AudioLoader extends Loader {\r\n\r\n\tconstructor( manager ) {\r\n\r\n\t\tsuper( manager );\r\n\r\n\t}\r\n\r\n\tload( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\tconst loader = new FileLoader( this.manager );\r\n\t\tloader.setResponseType( 'arraybuffer' );\r\n\t\tloader.setPath( this.path );\r\n\t\tloader.setRequestHeader( this.requestHeader );\r\n\t\tloader.setWithCredentials( this.withCredentials );\r\n\t\tloader.load( url, function ( buffer ) {\r\n\r\n\t\t\ttry {\r\n\r\n\t\t\t\t// Create a copy of the buffer. The `decodeAudioData` method\r\n\t\t\t\t// detaches the buffer when complete, preventing reuse.\r\n\t\t\t\tconst bufferCopy = buffer.slice( 0 );\r\n\r\n\t\t\t\tconst context = AudioContext.getContext();\r\n\t\t\t\tcontext.decodeAudioData( bufferCopy, function ( audioBuffer ) {\r\n\r\n\t\t\t\t\tonLoad( audioBuffer );\r\n\r\n\t\t\t\t} ).catch( handleError );\r\n\r\n\t\t\t} catch ( e ) {\r\n\r\n\t\t\t\thandleError( e );\r\n\r\n\t\t\t}\r\n\r\n\t\t}, onProgress, onError );\r\n\r\n\t\tfunction handleError( e ) {\r\n\r\n\t\t\tif ( onError ) {\r\n\r\n\t\t\t\tonError( e );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconsole.error( e );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tscope.manager.itemError( url );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _eyeRight = /*@__PURE__*/ new Matrix4();\r\nconst _eyeLeft = /*@__PURE__*/ new Matrix4();\r\nconst _projectionMatrix = /*@__PURE__*/ new Matrix4();\r\n\r\nclass StereoCamera {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.type = 'StereoCamera';\r\n\r\n\t\tthis.aspect = 1;\r\n\r\n\t\tthis.eyeSep = 0.064;\r\n\r\n\t\tthis.cameraL = new PerspectiveCamera();\r\n\t\tthis.cameraL.layers.enable( 1 );\r\n\t\tthis.cameraL.matrixAutoUpdate = false;\r\n\r\n\t\tthis.cameraR = new PerspectiveCamera();\r\n\t\tthis.cameraR.layers.enable( 2 );\r\n\t\tthis.cameraR.matrixAutoUpdate = false;\r\n\r\n\t\tthis._cache = {\r\n\t\t\tfocus: null,\r\n\t\t\tfov: null,\r\n\t\t\taspect: null,\r\n\t\t\tnear: null,\r\n\t\t\tfar: null,\r\n\t\t\tzoom: null,\r\n\t\t\teyeSep: null\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tupdate( camera ) {\r\n\r\n\t\tconst cache = this._cache;\r\n\r\n\t\tconst needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov ||\r\n\t\t\tcache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near ||\r\n\t\t\tcache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep;\r\n\r\n\t\tif ( needsUpdate ) {\r\n\r\n\t\t\tcache.focus = camera.focus;\r\n\t\t\tcache.fov = camera.fov;\r\n\t\t\tcache.aspect = camera.aspect * this.aspect;\r\n\t\t\tcache.near = camera.near;\r\n\t\t\tcache.far = camera.far;\r\n\t\t\tcache.zoom = camera.zoom;\r\n\t\t\tcache.eyeSep = this.eyeSep;\r\n\r\n\t\t\t// Off-axis stereoscopic effect based on\r\n\t\t\t// http://paulbourke.net/stereographics/stereorender/\r\n\r\n\t\t\t_projectionMatrix.copy( camera.projectionMatrix );\r\n\t\t\tconst eyeSepHalf = cache.eyeSep / 2;\r\n\t\t\tconst eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;\r\n\t\t\tconst ymax = ( cache.near * Math.tan( DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;\r\n\t\t\tlet xmin, xmax;\r\n\r\n\t\t\t// translate xOffset\r\n\r\n\t\t\t_eyeLeft.elements[ 12 ] = - eyeSepHalf;\r\n\t\t\t_eyeRight.elements[ 12 ] = eyeSepHalf;\r\n\r\n\t\t\t// for left eye\r\n\r\n\t\t\txmin = - ymax * cache.aspect + eyeSepOnProjection;\r\n\t\t\txmax = ymax * cache.aspect + eyeSepOnProjection;\r\n\r\n\t\t\t_projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\r\n\t\t\t_projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\r\n\r\n\t\t\tthis.cameraL.projectionMatrix.copy( _projectionMatrix );\r\n\r\n\t\t\t// for right eye\r\n\r\n\t\t\txmin = - ymax * cache.aspect - eyeSepOnProjection;\r\n\t\t\txmax = ymax * cache.aspect - eyeSepOnProjection;\r\n\r\n\t\t\t_projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\r\n\t\t\t_projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\r\n\r\n\t\t\tthis.cameraR.projectionMatrix.copy( _projectionMatrix );\r\n\r\n\t\t}\r\n\r\n\t\tthis.cameraL.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeLeft );\r\n\t\tthis.cameraR.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeRight );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Clock {\r\n\r\n\tconstructor( autoStart = true ) {\r\n\r\n\t\tthis.autoStart = autoStart;\r\n\r\n\t\tthis.startTime = 0;\r\n\t\tthis.oldTime = 0;\r\n\t\tthis.elapsedTime = 0;\r\n\r\n\t\tthis.running = false;\r\n\r\n\t}\r\n\r\n\tstart() {\r\n\r\n\t\tthis.startTime = now();\r\n\r\n\t\tthis.oldTime = this.startTime;\r\n\t\tthis.elapsedTime = 0;\r\n\t\tthis.running = true;\r\n\r\n\t}\r\n\r\n\tstop() {\r\n\r\n\t\tthis.getElapsedTime();\r\n\t\tthis.running = false;\r\n\t\tthis.autoStart = false;\r\n\r\n\t}\r\n\r\n\tgetElapsedTime() {\r\n\r\n\t\tthis.getDelta();\r\n\t\treturn this.elapsedTime;\r\n\r\n\t}\r\n\r\n\tgetDelta() {\r\n\r\n\t\tlet diff = 0;\r\n\r\n\t\tif ( this.autoStart && ! this.running ) {\r\n\r\n\t\t\tthis.start();\r\n\t\t\treturn 0;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.running ) {\r\n\r\n\t\t\tconst newTime = now();\r\n\r\n\t\t\tdiff = ( newTime - this.oldTime ) / 1000;\r\n\t\t\tthis.oldTime = newTime;\r\n\r\n\t\t\tthis.elapsedTime += diff;\r\n\r\n\t\t}\r\n\r\n\t\treturn diff;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction now() {\r\n\r\n\treturn ( typeof performance === 'undefined' ? Date : performance ).now(); // see #10732\r\n\r\n}\r\n\r\nconst _position$1 = /*@__PURE__*/ new Vector3();\r\nconst _quaternion$1 = /*@__PURE__*/ new Quaternion();\r\nconst _scale$1 = /*@__PURE__*/ new Vector3();\r\nconst _orientation$1 = /*@__PURE__*/ new Vector3();\r\n\r\nclass AudioListener extends Object3D {\r\n\r\n\tconstructor() {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'AudioListener';\r\n\r\n\t\tthis.context = AudioContext.getContext();\r\n\r\n\t\tthis.gain = this.context.createGain();\r\n\t\tthis.gain.connect( this.context.destination );\r\n\r\n\t\tthis.filter = null;\r\n\r\n\t\tthis.timeDelta = 0;\r\n\r\n\t\t// private\r\n\r\n\t\tthis._clock = new Clock();\r\n\r\n\t}\r\n\r\n\tgetInput() {\r\n\r\n\t\treturn this.gain;\r\n\r\n\t}\r\n\r\n\tremoveFilter() {\r\n\r\n\t\tif ( this.filter !== null ) {\r\n\r\n\t\t\tthis.gain.disconnect( this.filter );\r\n\t\t\tthis.filter.disconnect( this.context.destination );\r\n\t\t\tthis.gain.connect( this.context.destination );\r\n\t\t\tthis.filter = null;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetFilter() {\r\n\r\n\t\treturn this.filter;\r\n\r\n\t}\r\n\r\n\tsetFilter( value ) {\r\n\r\n\t\tif ( this.filter !== null ) {\r\n\r\n\t\t\tthis.gain.disconnect( this.filter );\r\n\t\t\tthis.filter.disconnect( this.context.destination );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.gain.disconnect( this.context.destination );\r\n\r\n\t\t}\r\n\r\n\t\tthis.filter = value;\r\n\t\tthis.gain.connect( this.filter );\r\n\t\tthis.filter.connect( this.context.destination );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetMasterVolume() {\r\n\r\n\t\treturn this.gain.gain.value;\r\n\r\n\t}\r\n\r\n\tsetMasterVolume( value ) {\r\n\r\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( force ) {\r\n\r\n\t\tsuper.updateMatrixWorld( force );\r\n\r\n\t\tconst listener = this.context.listener;\r\n\t\tconst up = this.up;\r\n\r\n\t\tthis.timeDelta = this._clock.getDelta();\r\n\r\n\t\tthis.matrixWorld.decompose( _position$1, _quaternion$1, _scale$1 );\r\n\r\n\t\t_orientation$1.set( 0, 0, - 1 ).applyQuaternion( _quaternion$1 );\r\n\r\n\t\tif ( listener.positionX ) {\r\n\r\n\t\t\t// code path for Chrome (see #14393)\r\n\r\n\t\t\tconst endTime = this.context.currentTime + this.timeDelta;\r\n\r\n\t\t\tlistener.positionX.linearRampToValueAtTime( _position$1.x, endTime );\r\n\t\t\tlistener.positionY.linearRampToValueAtTime( _position$1.y, endTime );\r\n\t\t\tlistener.positionZ.linearRampToValueAtTime( _position$1.z, endTime );\r\n\t\t\tlistener.forwardX.linearRampToValueAtTime( _orientation$1.x, endTime );\r\n\t\t\tlistener.forwardY.linearRampToValueAtTime( _orientation$1.y, endTime );\r\n\t\t\tlistener.forwardZ.linearRampToValueAtTime( _orientation$1.z, endTime );\r\n\t\t\tlistener.upX.linearRampToValueAtTime( up.x, endTime );\r\n\t\t\tlistener.upY.linearRampToValueAtTime( up.y, endTime );\r\n\t\t\tlistener.upZ.linearRampToValueAtTime( up.z, endTime );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tlistener.setPosition( _position$1.x, _position$1.y, _position$1.z );\r\n\t\t\tlistener.setOrientation( _orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Audio extends Object3D {\r\n\r\n\tconstructor( listener ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'Audio';\r\n\r\n\t\tthis.listener = listener;\r\n\t\tthis.context = listener.context;\r\n\r\n\t\tthis.gain = this.context.createGain();\r\n\t\tthis.gain.connect( listener.getInput() );\r\n\r\n\t\tthis.autoplay = false;\r\n\r\n\t\tthis.buffer = null;\r\n\t\tthis.detune = 0;\r\n\t\tthis.loop = false;\r\n\t\tthis.loopStart = 0;\r\n\t\tthis.loopEnd = 0;\r\n\t\tthis.offset = 0;\r\n\t\tthis.duration = undefined;\r\n\t\tthis.playbackRate = 1;\r\n\t\tthis.isPlaying = false;\r\n\t\tthis.hasPlaybackControl = true;\r\n\t\tthis.source = null;\r\n\t\tthis.sourceType = 'empty';\r\n\r\n\t\tthis._startedAt = 0;\r\n\t\tthis._progress = 0;\r\n\t\tthis._connected = false;\r\n\r\n\t\tthis.filters = [];\r\n\r\n\t}\r\n\r\n\tgetOutput() {\r\n\r\n\t\treturn this.gain;\r\n\r\n\t}\r\n\r\n\tsetNodeSource( audioNode ) {\r\n\r\n\t\tthis.hasPlaybackControl = false;\r\n\t\tthis.sourceType = 'audioNode';\r\n\t\tthis.source = audioNode;\r\n\t\tthis.connect();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetMediaElementSource( mediaElement ) {\r\n\r\n\t\tthis.hasPlaybackControl = false;\r\n\t\tthis.sourceType = 'mediaNode';\r\n\t\tthis.source = this.context.createMediaElementSource( mediaElement );\r\n\t\tthis.connect();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetMediaStreamSource( mediaStream ) {\r\n\r\n\t\tthis.hasPlaybackControl = false;\r\n\t\tthis.sourceType = 'mediaStreamNode';\r\n\t\tthis.source = this.context.createMediaStreamSource( mediaStream );\r\n\t\tthis.connect();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetBuffer( audioBuffer ) {\r\n\r\n\t\tthis.buffer = audioBuffer;\r\n\t\tthis.sourceType = 'buffer';\r\n\r\n\t\tif ( this.autoplay ) this.play();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tplay( delay = 0 ) {\r\n\r\n\t\tif ( this.isPlaying === true ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Audio: Audio is already playing.' );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.hasPlaybackControl === false ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tthis._startedAt = this.context.currentTime + delay;\r\n\r\n\t\tconst source = this.context.createBufferSource();\r\n\t\tsource.buffer = this.buffer;\r\n\t\tsource.loop = this.loop;\r\n\t\tsource.loopStart = this.loopStart;\r\n\t\tsource.loopEnd = this.loopEnd;\r\n\t\tsource.onended = this.onEnded.bind( this );\r\n\t\tsource.start( this._startedAt, this._progress + this.offset, this.duration );\r\n\r\n\t\tthis.isPlaying = true;\r\n\r\n\t\tthis.source = source;\r\n\r\n\t\tthis.setDetune( this.detune );\r\n\t\tthis.setPlaybackRate( this.playbackRate );\r\n\r\n\t\treturn this.connect();\r\n\r\n\t}\r\n\r\n\tpause() {\r\n\r\n\t\tif ( this.hasPlaybackControl === false ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.isPlaying === true ) {\r\n\r\n\t\t\t// update current progress\r\n\r\n\t\t\tthis._progress += Math.max( this.context.currentTime - this._startedAt, 0 ) * this.playbackRate;\r\n\r\n\t\t\tif ( this.loop === true ) {\r\n\r\n\t\t\t\t// ensure _progress does not exceed duration with looped audios\r\n\r\n\t\t\t\tthis._progress = this._progress % ( this.duration || this.buffer.duration );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.source.stop();\r\n\t\t\tthis.source.onended = null;\r\n\r\n\t\t\tthis.isPlaying = false;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tstop() {\r\n\r\n\t\tif ( this.hasPlaybackControl === false ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tthis._progress = 0;\r\n\r\n\t\tif ( this.source !== null ) {\r\n\r\n\t\t\tthis.source.stop();\r\n\t\t\tthis.source.onended = null;\r\n\r\n\t\t}\r\n\r\n\t\tthis.isPlaying = false;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tconnect() {\r\n\r\n\t\tif ( this.filters.length > 0 ) {\r\n\r\n\t\t\tthis.source.connect( this.filters[ 0 ] );\r\n\r\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tthis.filters[ i - 1 ].connect( this.filters[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.filters[ this.filters.length - 1 ].connect( this.getOutput() );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.source.connect( this.getOutput() );\r\n\r\n\t\t}\r\n\r\n\t\tthis._connected = true;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdisconnect() {\r\n\r\n\t\tif ( this._connected === false ) {\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.filters.length > 0 ) {\r\n\r\n\t\t\tthis.source.disconnect( this.filters[ 0 ] );\r\n\r\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tthis.filters[ i - 1 ].disconnect( this.filters[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.filters[ this.filters.length - 1 ].disconnect( this.getOutput() );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.source.disconnect( this.getOutput() );\r\n\r\n\t\t}\r\n\r\n\t\tthis._connected = false;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetFilters() {\r\n\r\n\t\treturn this.filters;\r\n\r\n\t}\r\n\r\n\tsetFilters( value ) {\r\n\r\n\t\tif ( ! value ) value = [];\r\n\r\n\t\tif ( this._connected === true ) {\r\n\r\n\t\t\tthis.disconnect();\r\n\t\t\tthis.filters = value.slice();\r\n\t\t\tthis.connect();\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.filters = value.slice();\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetDetune( value ) {\r\n\r\n\t\tthis.detune = value;\r\n\r\n\t\tif ( this.isPlaying === true && this.source.detune !== undefined ) {\r\n\r\n\t\t\tthis.source.detune.setTargetAtTime( this.detune, this.context.currentTime, 0.01 );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetDetune() {\r\n\r\n\t\treturn this.detune;\r\n\r\n\t}\r\n\r\n\tgetFilter() {\r\n\r\n\t\treturn this.getFilters()[ 0 ];\r\n\r\n\t}\r\n\r\n\tsetFilter( filter ) {\r\n\r\n\t\treturn this.setFilters( filter ? [ filter ] : [] );\r\n\r\n\t}\r\n\r\n\tsetPlaybackRate( value ) {\r\n\r\n\t\tif ( this.hasPlaybackControl === false ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tthis.playbackRate = value;\r\n\r\n\t\tif ( this.isPlaying === true ) {\r\n\r\n\t\t\tthis.source.playbackRate.setTargetAtTime( this.playbackRate, this.context.currentTime, 0.01 );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetPlaybackRate() {\r\n\r\n\t\treturn this.playbackRate;\r\n\r\n\t}\r\n\r\n\tonEnded() {\r\n\r\n\t\tthis.isPlaying = false;\r\n\r\n\t}\r\n\r\n\tgetLoop() {\r\n\r\n\t\tif ( this.hasPlaybackControl === false ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t\treturn this.loop;\r\n\r\n\t}\r\n\r\n\tsetLoop( value ) {\r\n\r\n\t\tif ( this.hasPlaybackControl === false ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tthis.loop = value;\r\n\r\n\t\tif ( this.isPlaying === true ) {\r\n\r\n\t\t\tthis.source.loop = this.loop;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetLoopStart( value ) {\r\n\r\n\t\tthis.loopStart = value;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetLoopEnd( value ) {\r\n\r\n\t\tthis.loopEnd = value;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetVolume() {\r\n\r\n\t\treturn this.gain.gain.value;\r\n\r\n\t}\r\n\r\n\tsetVolume( value ) {\r\n\r\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _position = /*@__PURE__*/ new Vector3();\r\nconst _quaternion = /*@__PURE__*/ new Quaternion();\r\nconst _scale = /*@__PURE__*/ new Vector3();\r\nconst _orientation = /*@__PURE__*/ new Vector3();\r\n\r\nclass PositionalAudio extends Audio {\r\n\r\n\tconstructor( listener ) {\r\n\r\n\t\tsuper( listener );\r\n\r\n\t\tthis.panner = this.context.createPanner();\r\n\t\tthis.panner.panningModel = 'HRTF';\r\n\t\tthis.panner.connect( this.gain );\r\n\r\n\t}\r\n\r\n\tconnect() {\r\n\r\n\t\tsuper.connect();\r\n\r\n\t\tthis.panner.connect( this.gain );\r\n\r\n\t}\r\n\r\n\tdisconnect() {\r\n\r\n\t\tsuper.disconnect();\r\n\r\n\t\tthis.panner.disconnect( this.gain );\r\n\r\n\t}\r\n\r\n\tgetOutput() {\r\n\r\n\t\treturn this.panner;\r\n\r\n\t}\r\n\r\n\tgetRefDistance() {\r\n\r\n\t\treturn this.panner.refDistance;\r\n\r\n\t}\r\n\r\n\tsetRefDistance( value ) {\r\n\r\n\t\tthis.panner.refDistance = value;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetRolloffFactor() {\r\n\r\n\t\treturn this.panner.rolloffFactor;\r\n\r\n\t}\r\n\r\n\tsetRolloffFactor( value ) {\r\n\r\n\t\tthis.panner.rolloffFactor = value;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetDistanceModel() {\r\n\r\n\t\treturn this.panner.distanceModel;\r\n\r\n\t}\r\n\r\n\tsetDistanceModel( value ) {\r\n\r\n\t\tthis.panner.distanceModel = value;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetMaxDistance() {\r\n\r\n\t\treturn this.panner.maxDistance;\r\n\r\n\t}\r\n\r\n\tsetMaxDistance( value ) {\r\n\r\n\t\tthis.panner.maxDistance = value;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetDirectionalCone( coneInnerAngle, coneOuterAngle, coneOuterGain ) {\r\n\r\n\t\tthis.panner.coneInnerAngle = coneInnerAngle;\r\n\t\tthis.panner.coneOuterAngle = coneOuterAngle;\r\n\t\tthis.panner.coneOuterGain = coneOuterGain;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( force ) {\r\n\r\n\t\tsuper.updateMatrixWorld( force );\r\n\r\n\t\tif ( this.hasPlaybackControl === true && this.isPlaying === false ) return;\r\n\r\n\t\tthis.matrixWorld.decompose( _position, _quaternion, _scale );\r\n\r\n\t\t_orientation.set( 0, 0, 1 ).applyQuaternion( _quaternion );\r\n\r\n\t\tconst panner = this.panner;\r\n\r\n\t\tif ( panner.positionX ) {\r\n\r\n\t\t\t// code path for Chrome and Firefox (see #14393)\r\n\r\n\t\t\tconst endTime = this.context.currentTime + this.listener.timeDelta;\r\n\r\n\t\t\tpanner.positionX.linearRampToValueAtTime( _position.x, endTime );\r\n\t\t\tpanner.positionY.linearRampToValueAtTime( _position.y, endTime );\r\n\t\t\tpanner.positionZ.linearRampToValueAtTime( _position.z, endTime );\r\n\t\t\tpanner.orientationX.linearRampToValueAtTime( _orientation.x, endTime );\r\n\t\t\tpanner.orientationY.linearRampToValueAtTime( _orientation.y, endTime );\r\n\t\t\tpanner.orientationZ.linearRampToValueAtTime( _orientation.z, endTime );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tpanner.setPosition( _position.x, _position.y, _position.z );\r\n\t\t\tpanner.setOrientation( _orientation.x, _orientation.y, _orientation.z );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass AudioAnalyser {\r\n\r\n\tconstructor( audio, fftSize = 2048 ) {\r\n\r\n\t\tthis.analyser = audio.context.createAnalyser();\r\n\t\tthis.analyser.fftSize = fftSize;\r\n\r\n\t\tthis.data = new Uint8Array( this.analyser.frequencyBinCount );\r\n\r\n\t\taudio.getOutput().connect( this.analyser );\r\n\r\n\t}\r\n\r\n\r\n\tgetFrequencyData() {\r\n\r\n\t\tthis.analyser.getByteFrequencyData( this.data );\r\n\r\n\t\treturn this.data;\r\n\r\n\t}\r\n\r\n\tgetAverageFrequency() {\r\n\r\n\t\tlet value = 0;\r\n\t\tconst data = this.getFrequencyData();\r\n\r\n\t\tfor ( let i = 0; i < data.length; i ++ ) {\r\n\r\n\t\t\tvalue += data[ i ];\r\n\r\n\t\t}\r\n\r\n\t\treturn value / data.length;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass PropertyMixer {\r\n\r\n\tconstructor( binding, typeName, valueSize ) {\r\n\r\n\t\tthis.binding = binding;\r\n\t\tthis.valueSize = valueSize;\r\n\r\n\t\tlet mixFunction,\r\n\t\t\tmixFunctionAdditive,\r\n\t\t\tsetIdentity;\r\n\r\n\t\t// buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ]\r\n\t\t//\r\n\t\t// interpolators can use .buffer as their .result\r\n\t\t// the data then goes to 'incoming'\r\n\t\t//\r\n\t\t// 'accu0' and 'accu1' are used frame-interleaved for\r\n\t\t// the cumulative result and are compared to detect\r\n\t\t// changes\r\n\t\t//\r\n\t\t// 'orig' stores the original state of the property\r\n\t\t//\r\n\t\t// 'add' is used for additive cumulative results\r\n\t\t//\r\n\t\t// 'work' is optional and is only present for quaternion types. It is used\r\n\t\t// to store intermediate quaternion multiplication results\r\n\r\n\t\tswitch ( typeName ) {\r\n\r\n\t\t\tcase 'quaternion':\r\n\t\t\t\tmixFunction = this._slerp;\r\n\t\t\t\tmixFunctionAdditive = this._slerpAdditive;\r\n\t\t\t\tsetIdentity = this._setAdditiveIdentityQuaternion;\r\n\r\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 6 );\r\n\t\t\t\tthis._workIndex = 5;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'string':\r\n\t\t\tcase 'bool':\r\n\t\t\t\tmixFunction = this._select;\r\n\r\n\t\t\t\t// Use the regular mix function and for additive on these types,\r\n\t\t\t\t// additive is not relevant for non-numeric types\r\n\t\t\t\tmixFunctionAdditive = this._select;\r\n\r\n\t\t\t\tsetIdentity = this._setAdditiveIdentityOther;\r\n\r\n\t\t\t\tthis.buffer = new Array( valueSize * 5 );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tdefault:\r\n\t\t\t\tmixFunction = this._lerp;\r\n\t\t\t\tmixFunctionAdditive = this._lerpAdditive;\r\n\t\t\t\tsetIdentity = this._setAdditiveIdentityNumeric;\r\n\r\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 5 );\r\n\r\n\t\t}\r\n\r\n\t\tthis._mixBufferRegion = mixFunction;\r\n\t\tthis._mixBufferRegionAdditive = mixFunctionAdditive;\r\n\t\tthis._setIdentity = setIdentity;\r\n\t\tthis._origIndex = 3;\r\n\t\tthis._addIndex = 4;\r\n\r\n\t\tthis.cumulativeWeight = 0;\r\n\t\tthis.cumulativeWeightAdditive = 0;\r\n\r\n\t\tthis.useCount = 0;\r\n\t\tthis.referenceCount = 0;\r\n\r\n\t}\r\n\r\n\t// accumulate data in the 'incoming' region into 'accu'\r\n\taccumulate( accuIndex, weight ) {\r\n\r\n\t\t// note: happily accumulating nothing when weight = 0, the caller knows\r\n\t\t// the weight and shouldn't have made the call in the first place\r\n\r\n\t\tconst buffer = this.buffer,\r\n\t\t\tstride = this.valueSize,\r\n\t\t\toffset = accuIndex * stride + stride;\r\n\r\n\t\tlet currentWeight = this.cumulativeWeight;\r\n\r\n\t\tif ( currentWeight === 0 ) {\r\n\r\n\t\t\t// accuN := incoming * weight\r\n\r\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\r\n\r\n\t\t\t\tbuffer[ offset + i ] = buffer[ i ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcurrentWeight = weight;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// accuN := accuN + incoming * weight\r\n\r\n\t\t\tcurrentWeight += weight;\r\n\t\t\tconst mix = weight / currentWeight;\r\n\t\t\tthis._mixBufferRegion( buffer, offset, 0, mix, stride );\r\n\r\n\t\t}\r\n\r\n\t\tthis.cumulativeWeight = currentWeight;\r\n\r\n\t}\r\n\r\n\t// accumulate data in the 'incoming' region into 'add'\r\n\taccumulateAdditive( weight ) {\r\n\r\n\t\tconst buffer = this.buffer,\r\n\t\t\tstride = this.valueSize,\r\n\t\t\toffset = stride * this._addIndex;\r\n\r\n\t\tif ( this.cumulativeWeightAdditive === 0 ) {\r\n\r\n\t\t\t// add = identity\r\n\r\n\t\t\tthis._setIdentity();\r\n\r\n\t\t}\r\n\r\n\t\t// add := add + incoming * weight\r\n\r\n\t\tthis._mixBufferRegionAdditive( buffer, offset, 0, weight, stride );\r\n\t\tthis.cumulativeWeightAdditive += weight;\r\n\r\n\t}\r\n\r\n\t// apply the state of 'accu' to the binding when accus differ\r\n\tapply( accuIndex ) {\r\n\r\n\t\tconst stride = this.valueSize,\r\n\t\t\tbuffer = this.buffer,\r\n\t\t\toffset = accuIndex * stride + stride,\r\n\r\n\t\t\tweight = this.cumulativeWeight,\r\n\t\t\tweightAdditive = this.cumulativeWeightAdditive,\r\n\r\n\t\t\tbinding = this.binding;\r\n\r\n\t\tthis.cumulativeWeight = 0;\r\n\t\tthis.cumulativeWeightAdditive = 0;\r\n\r\n\t\tif ( weight < 1 ) {\r\n\r\n\t\t\t// accuN := accuN + original * ( 1 - cumulativeWeight )\r\n\r\n\t\t\tconst originalValueOffset = stride * this._origIndex;\r\n\r\n\t\t\tthis._mixBufferRegion(\r\n\t\t\t\tbuffer, offset, originalValueOffset, 1 - weight, stride );\r\n\r\n\t\t}\r\n\r\n\t\tif ( weightAdditive > 0 ) {\r\n\r\n\t\t\t// accuN := accuN + additive accuN\r\n\r\n\t\t\tthis._mixBufferRegionAdditive( buffer, offset, this._addIndex * stride, 1, stride );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = stride, e = stride + stride; i !== e; ++ i ) {\r\n\r\n\t\t\tif ( buffer[ i ] !== buffer[ i + stride ] ) {\r\n\r\n\t\t\t\t// value has changed -> update scene graph\r\n\r\n\t\t\t\tbinding.setValue( buffer, offset );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// remember the state of the bound property and copy it to both accus\r\n\tsaveOriginalState() {\r\n\r\n\t\tconst binding = this.binding;\r\n\r\n\t\tconst buffer = this.buffer,\r\n\t\t\tstride = this.valueSize,\r\n\r\n\t\t\toriginalValueOffset = stride * this._origIndex;\r\n\r\n\t\tbinding.getValue( buffer, originalValueOffset );\r\n\r\n\t\t// accu[0..1] := orig -- initially detect changes against the original\r\n\t\tfor ( let i = stride, e = originalValueOffset; i !== e; ++ i ) {\r\n\r\n\t\t\tbuffer[ i ] = buffer[ originalValueOffset + ( i % stride ) ];\r\n\r\n\t\t}\r\n\r\n\t\t// Add to identity for additive\r\n\t\tthis._setIdentity();\r\n\r\n\t\tthis.cumulativeWeight = 0;\r\n\t\tthis.cumulativeWeightAdditive = 0;\r\n\r\n\t}\r\n\r\n\t// apply the state previously taken via 'saveOriginalState' to the binding\r\n\trestoreOriginalState() {\r\n\r\n\t\tconst originalValueOffset = this.valueSize * 3;\r\n\t\tthis.binding.setValue( this.buffer, originalValueOffset );\r\n\r\n\t}\r\n\r\n\t_setAdditiveIdentityNumeric() {\r\n\r\n\t\tconst startIndex = this._addIndex * this.valueSize;\r\n\t\tconst endIndex = startIndex + this.valueSize;\r\n\r\n\t\tfor ( let i = startIndex; i < endIndex; i ++ ) {\r\n\r\n\t\t\tthis.buffer[ i ] = 0;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t_setAdditiveIdentityQuaternion() {\r\n\r\n\t\tthis._setAdditiveIdentityNumeric();\r\n\t\tthis.buffer[ this._addIndex * this.valueSize + 3 ] = 1;\r\n\r\n\t}\r\n\r\n\t_setAdditiveIdentityOther() {\r\n\r\n\t\tconst startIndex = this._origIndex * this.valueSize;\r\n\t\tconst targetIndex = this._addIndex * this.valueSize;\r\n\r\n\t\tfor ( let i = 0; i < this.valueSize; i ++ ) {\r\n\r\n\t\t\tthis.buffer[ targetIndex + i ] = this.buffer[ startIndex + i ];\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\r\n\t// mix functions\r\n\r\n\t_select( buffer, dstOffset, srcOffset, t, stride ) {\r\n\r\n\t\tif ( t >= 0.5 ) {\r\n\r\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\r\n\r\n\t\t\t\tbuffer[ dstOffset + i ] = buffer[ srcOffset + i ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t_slerp( buffer, dstOffset, srcOffset, t ) {\r\n\r\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t );\r\n\r\n\t}\r\n\r\n\t_slerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\r\n\r\n\t\tconst workOffset = this._workIndex * stride;\r\n\r\n\t\t// Store result in intermediate buffer offset\r\n\t\tQuaternion.multiplyQuaternionsFlat( buffer, workOffset, buffer, dstOffset, buffer, srcOffset );\r\n\r\n\t\t// Slerp to the intermediate result\r\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t );\r\n\r\n\t}\r\n\r\n\t_lerp( buffer, dstOffset, srcOffset, t, stride ) {\r\n\r\n\t\tconst s = 1 - t;\r\n\r\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\r\n\r\n\t\t\tconst j = dstOffset + i;\r\n\r\n\t\t\tbuffer[ j ] = buffer[ j ] * s + buffer[ srcOffset + i ] * t;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t_lerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\r\n\r\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\r\n\r\n\t\t\tconst j = dstOffset + i;\r\n\r\n\t\t\tbuffer[ j ] = buffer[ j ] + buffer[ srcOffset + i ] * t;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Characters [].:/ are reserved for track binding syntax.\r\nconst _RESERVED_CHARS_RE = '\\\\[\\\\]\\\\.:\\\\/';\r\nconst _reservedRe = new RegExp( '[' + _RESERVED_CHARS_RE + ']', 'g' );\r\n\r\n// Attempts to allow node names from any language. ES5's `\\w` regexp matches\r\n// only latin characters, and the unicode \\p{L} is not yet supported. So\r\n// instead, we exclude reserved characters and match everything else.\r\nconst _wordChar = '[^' + _RESERVED_CHARS_RE + ']';\r\nconst _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace( '\\\\.', '' ) + ']';\r\n\r\n// Parent directories, delimited by '/' or ':'. Currently unused, but must\r\n// be matched to parse the rest of the track name.\r\nconst _directoryRe = /*@__PURE__*/ /((?:WC+[\\/:])*)/.source.replace( 'WC', _wordChar );\r\n\r\n// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.\r\nconst _nodeRe = /*@__PURE__*/ /(WCOD+)?/.source.replace( 'WCOD', _wordCharOrDot );\r\n\r\n// Object on target node, and accessor. May not contain reserved\r\n// characters. Accessor may contain any character except closing bracket.\r\nconst _objectRe = /*@__PURE__*/ /(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace( 'WC', _wordChar );\r\n\r\n// Property and accessor. May not contain reserved characters. Accessor may\r\n// contain any non-bracket characters.\r\nconst _propertyRe = /*@__PURE__*/ /\\.(WC+)(?:\\[(.+)\\])?/.source.replace( 'WC', _wordChar );\r\n\r\nconst _trackRe = new RegExp( ''\r\n\t+ '^'\r\n\t+ _directoryRe\r\n\t+ _nodeRe\r\n\t+ _objectRe\r\n\t+ _propertyRe\r\n\t+ '$'\r\n);\r\n\r\nconst _supportedObjectNames = [ 'material', 'materials', 'bones', 'map' ];\r\n\r\nclass Composite {\r\n\r\n\tconstructor( targetGroup, path, optionalParsedPath ) {\r\n\r\n\t\tconst parsedPath = optionalParsedPath || PropertyBinding.parseTrackName( path );\r\n\r\n\t\tthis._targetGroup = targetGroup;\r\n\t\tthis._bindings = targetGroup.subscribe_( path, parsedPath );\r\n\r\n\t}\r\n\r\n\tgetValue( array, offset ) {\r\n\r\n\t\tthis.bind(); // bind all binding\r\n\r\n\t\tconst firstValidIndex = this._targetGroup.nCachedObjects_,\r\n\t\t\tbinding = this._bindings[ firstValidIndex ];\r\n\r\n\t\t// and only call .getValue on the first\r\n\t\tif ( binding !== undefined ) binding.getValue( array, offset );\r\n\r\n\t}\r\n\r\n\tsetValue( array, offset ) {\r\n\r\n\t\tconst bindings = this._bindings;\r\n\r\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\r\n\r\n\t\t\tbindings[ i ].setValue( array, offset );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tbind() {\r\n\r\n\t\tconst bindings = this._bindings;\r\n\r\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\r\n\r\n\t\t\tbindings[ i ].bind();\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tunbind() {\r\n\r\n\t\tconst bindings = this._bindings;\r\n\r\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\r\n\r\n\t\t\tbindings[ i ].unbind();\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n// Note: This class uses a State pattern on a per-method basis:\r\n// 'bind' sets 'this.getValue' / 'setValue' and shadows the\r\n// prototype version of these methods with one that represents\r\n// the bound state. When the property is not found, the methods\r\n// become no-ops.\r\nclass PropertyBinding {\r\n\r\n\tconstructor( rootNode, path, parsedPath ) {\r\n\r\n\t\tthis.path = path;\r\n\t\tthis.parsedPath = parsedPath || PropertyBinding.parseTrackName( path );\r\n\r\n\t\tthis.node = PropertyBinding.findNode( rootNode, this.parsedPath.nodeName );\r\n\r\n\t\tthis.rootNode = rootNode;\r\n\r\n\t\t// initial state of these methods that calls 'bind'\r\n\t\tthis.getValue = this._getValue_unbound;\r\n\t\tthis.setValue = this._setValue_unbound;\r\n\r\n\t}\r\n\r\n\r\n\tstatic create( root, path, parsedPath ) {\r\n\r\n\t\tif ( ! ( root && root.isAnimationObjectGroup ) ) {\r\n\r\n\t\t\treturn new PropertyBinding( root, path, parsedPath );\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn new PropertyBinding.Composite( root, path, parsedPath );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Replaces spaces with underscores and removes unsupported characters from\r\n\t * node names, to ensure compatibility with parseTrackName().\r\n\t *\r\n\t * @param {string} name Node name to be sanitized.\r\n\t * @return {string}\r\n\t */\r\n\tstatic sanitizeNodeName( name ) {\r\n\r\n\t\treturn name.replace( /\\s/g, '_' ).replace( _reservedRe, '' );\r\n\r\n\t}\r\n\r\n\tstatic parseTrackName( trackName ) {\r\n\r\n\t\tconst matches = _trackRe.exec( trackName );\r\n\r\n\t\tif ( matches === null ) {\r\n\r\n\t\t\tthrow new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );\r\n\r\n\t\t}\r\n\r\n\t\tconst results = {\r\n\t\t\t// directoryName: matches[ 1 ], // (tschw) currently unused\r\n\t\t\tnodeName: matches[ 2 ],\r\n\t\t\tobjectName: matches[ 3 ],\r\n\t\t\tobjectIndex: matches[ 4 ],\r\n\t\t\tpropertyName: matches[ 5 ], // required\r\n\t\t\tpropertyIndex: matches[ 6 ]\r\n\t\t};\r\n\r\n\t\tconst lastDot = results.nodeName && results.nodeName.lastIndexOf( '.' );\r\n\r\n\t\tif ( lastDot !== undefined && lastDot !== - 1 ) {\r\n\r\n\t\t\tconst objectName = results.nodeName.substring( lastDot + 1 );\r\n\r\n\t\t\t// Object names must be checked against an allowlist. Otherwise, there\r\n\t\t\t// is no way to parse 'foo.bar.baz': 'baz' must be a property, but\r\n\t\t\t// 'bar' could be the objectName, or part of a nodeName (which can\r\n\t\t\t// include '.' characters).\r\n\t\t\tif ( _supportedObjectNames.indexOf( objectName ) !== - 1 ) {\r\n\r\n\t\t\t\tresults.nodeName = results.nodeName.substring( 0, lastDot );\r\n\t\t\t\tresults.objectName = objectName;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( results.propertyName === null || results.propertyName.length === 0 ) {\r\n\r\n\t\t\tthrow new Error( 'PropertyBinding: can not parse propertyName from trackName: ' + trackName );\r\n\r\n\t\t}\r\n\r\n\t\treturn results;\r\n\r\n\t}\r\n\r\n\tstatic findNode( root, nodeName ) {\r\n\r\n\t\tif ( nodeName === undefined || nodeName === '' || nodeName === '.' || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) {\r\n\r\n\t\t\treturn root;\r\n\r\n\t\t}\r\n\r\n\t\t// search into skeleton bones.\r\n\t\tif ( root.skeleton ) {\r\n\r\n\t\t\tconst bone = root.skeleton.getBoneByName( nodeName );\r\n\r\n\t\t\tif ( bone !== undefined ) {\r\n\r\n\t\t\t\treturn bone;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// search into node subtree.\r\n\t\tif ( root.children ) {\r\n\r\n\t\t\tconst searchNodeSubtree = function ( children ) {\r\n\r\n\t\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\r\n\r\n\t\t\t\t\tconst childNode = children[ i ];\r\n\r\n\t\t\t\t\tif ( childNode.name === nodeName || childNode.uuid === nodeName ) {\r\n\r\n\t\t\t\t\t\treturn childNode;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tconst result = searchNodeSubtree( childNode.children );\r\n\r\n\t\t\t\t\tif ( result ) return result;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn null;\r\n\r\n\t\t\t};\r\n\r\n\t\t\tconst subTreeNode = searchNodeSubtree( root.children );\r\n\r\n\t\t\tif ( subTreeNode ) {\r\n\r\n\t\t\t\treturn subTreeNode;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\r\n\t}\r\n\r\n\t// these are used to \"bind\" a nonexistent property\r\n\t_getValue_unavailable() {}\r\n\t_setValue_unavailable() {}\r\n\r\n\t// Getters\r\n\r\n\t_getValue_direct( buffer, offset ) {\r\n\r\n\t\tbuffer[ offset ] = this.targetObject[ this.propertyName ];\r\n\r\n\t}\r\n\r\n\t_getValue_array( buffer, offset ) {\r\n\r\n\t\tconst source = this.resolvedProperty;\r\n\r\n\t\tfor ( let i = 0, n = source.length; i !== n; ++ i ) {\r\n\r\n\t\t\tbuffer[ offset ++ ] = source[ i ];\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t_getValue_arrayElement( buffer, offset ) {\r\n\r\n\t\tbuffer[ offset ] = this.resolvedProperty[ this.propertyIndex ];\r\n\r\n\t}\r\n\r\n\t_getValue_toArray( buffer, offset ) {\r\n\r\n\t\tthis.resolvedProperty.toArray( buffer, offset );\r\n\r\n\t}\r\n\r\n\t// Direct\r\n\r\n\t_setValue_direct( buffer, offset ) {\r\n\r\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\r\n\r\n\t}\r\n\r\n\t_setValue_direct_setNeedsUpdate( buffer, offset ) {\r\n\r\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\r\n\t\tthis.targetObject.needsUpdate = true;\r\n\r\n\t}\r\n\r\n\t_setValue_direct_setMatrixWorldNeedsUpdate( buffer, offset ) {\r\n\r\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\r\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\r\n\r\n\t}\r\n\r\n\t// EntireArray\r\n\r\n\t_setValue_array( buffer, offset ) {\r\n\r\n\t\tconst dest = this.resolvedProperty;\r\n\r\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\r\n\r\n\t\t\tdest[ i ] = buffer[ offset ++ ];\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t_setValue_array_setNeedsUpdate( buffer, offset ) {\r\n\r\n\t\tconst dest = this.resolvedProperty;\r\n\r\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\r\n\r\n\t\t\tdest[ i ] = buffer[ offset ++ ];\r\n\r\n\t\t}\r\n\r\n\t\tthis.targetObject.needsUpdate = true;\r\n\r\n\t}\r\n\r\n\t_setValue_array_setMatrixWorldNeedsUpdate( buffer, offset ) {\r\n\r\n\t\tconst dest = this.resolvedProperty;\r\n\r\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\r\n\r\n\t\t\tdest[ i ] = buffer[ offset ++ ];\r\n\r\n\t\t}\r\n\r\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\r\n\r\n\t}\r\n\r\n\t// ArrayElement\r\n\r\n\t_setValue_arrayElement( buffer, offset ) {\r\n\r\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\r\n\r\n\t}\r\n\r\n\t_setValue_arrayElement_setNeedsUpdate( buffer, offset ) {\r\n\r\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\r\n\t\tthis.targetObject.needsUpdate = true;\r\n\r\n\t}\r\n\r\n\t_setValue_arrayElement_setMatrixWorldNeedsUpdate( buffer, offset ) {\r\n\r\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\r\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\r\n\r\n\t}\r\n\r\n\t// HasToFromArray\r\n\r\n\t_setValue_fromArray( buffer, offset ) {\r\n\r\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\r\n\r\n\t}\r\n\r\n\t_setValue_fromArray_setNeedsUpdate( buffer, offset ) {\r\n\r\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\r\n\t\tthis.targetObject.needsUpdate = true;\r\n\r\n\t}\r\n\r\n\t_setValue_fromArray_setMatrixWorldNeedsUpdate( buffer, offset ) {\r\n\r\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\r\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\r\n\r\n\t}\r\n\r\n\t_getValue_unbound( targetArray, offset ) {\r\n\r\n\t\tthis.bind();\r\n\t\tthis.getValue( targetArray, offset );\r\n\r\n\t}\r\n\r\n\t_setValue_unbound( sourceArray, offset ) {\r\n\r\n\t\tthis.bind();\r\n\t\tthis.setValue( sourceArray, offset );\r\n\r\n\t}\r\n\r\n\t// create getter / setter pair for a property in the scene graph\r\n\tbind() {\r\n\r\n\t\tlet targetObject = this.node;\r\n\t\tconst parsedPath = this.parsedPath;\r\n\r\n\t\tconst objectName = parsedPath.objectName;\r\n\t\tconst propertyName = parsedPath.propertyName;\r\n\t\tlet propertyIndex = parsedPath.propertyIndex;\r\n\r\n\t\tif ( ! targetObject ) {\r\n\r\n\t\t\ttargetObject = PropertyBinding.findNode( this.rootNode, parsedPath.nodeName );\r\n\r\n\t\t\tthis.node = targetObject;\r\n\r\n\t\t}\r\n\r\n\t\t// set fail state so we can just 'return' on error\r\n\t\tthis.getValue = this._getValue_unavailable;\r\n\t\tthis.setValue = this._setValue_unavailable;\r\n\r\n\t\t// ensure there is a value node\r\n\t\tif ( ! targetObject ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.PropertyBinding: No target node found for track: ' + this.path + '.' );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tif ( objectName ) {\r\n\r\n\t\t\tlet objectIndex = parsedPath.objectIndex;\r\n\r\n\t\t\t// special cases were we need to reach deeper into the hierarchy to get the face materials....\r\n\t\t\tswitch ( objectName ) {\r\n\r\n\t\t\t\tcase 'materials':\r\n\r\n\t\t\t\t\tif ( ! targetObject.material ) {\r\n\r\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );\r\n\t\t\t\t\t\treturn;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( ! targetObject.material.materials ) {\r\n\r\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this );\r\n\t\t\t\t\t\treturn;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttargetObject = targetObject.material.materials;\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'bones':\r\n\r\n\t\t\t\t\tif ( ! targetObject.skeleton ) {\r\n\r\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.', this );\r\n\t\t\t\t\t\treturn;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// potential future optimization: skip this if propertyIndex is already an integer\r\n\t\t\t\t\t// and convert the integer string to a true integer.\r\n\r\n\t\t\t\t\ttargetObject = targetObject.skeleton.bones;\r\n\r\n\t\t\t\t\t// support resolving morphTarget names into indices.\r\n\t\t\t\t\tfor ( let i = 0; i < targetObject.length; i ++ ) {\r\n\r\n\t\t\t\t\t\tif ( targetObject[ i ].name === objectIndex ) {\r\n\r\n\t\t\t\t\t\t\tobjectIndex = i;\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'map':\r\n\r\n\t\t\t\t\tif ( 'map' in targetObject ) {\r\n\r\n\t\t\t\t\t\ttargetObject = targetObject.map;\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( ! targetObject.material ) {\r\n\r\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );\r\n\t\t\t\t\t\treturn;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( ! targetObject.material.map ) {\r\n\r\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.', this );\r\n\t\t\t\t\t\treturn;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttargetObject = targetObject.material.map;\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tdefault:\r\n\r\n\t\t\t\t\tif ( targetObject[ objectName ] === undefined ) {\r\n\r\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to objectName of node undefined.', this );\r\n\t\t\t\t\t\treturn;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttargetObject = targetObject[ objectName ];\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tif ( objectIndex !== undefined ) {\r\n\r\n\t\t\t\tif ( targetObject[ objectIndex ] === undefined ) {\r\n\r\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject );\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttargetObject = targetObject[ objectIndex ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// resolve property\r\n\t\tconst nodeProperty = targetObject[ propertyName ];\r\n\r\n\t\tif ( nodeProperty === undefined ) {\r\n\r\n\t\t\tconst nodeName = parsedPath.nodeName;\r\n\r\n\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to update property for track: ' + nodeName +\r\n\t\t\t\t'.' + propertyName + ' but it wasn\\'t found.', targetObject );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\t// determine versioning scheme\r\n\t\tlet versioning = this.Versioning.None;\r\n\r\n\t\tthis.targetObject = targetObject;\r\n\r\n\t\tif ( targetObject.needsUpdate !== undefined ) { // material\r\n\r\n\t\t\tversioning = this.Versioning.NeedsUpdate;\r\n\r\n\t\t} else if ( targetObject.matrixWorldNeedsUpdate !== undefined ) { // node transform\r\n\r\n\t\t\tversioning = this.Versioning.MatrixWorldNeedsUpdate;\r\n\r\n\t\t}\r\n\r\n\t\t// determine how the property gets bound\r\n\t\tlet bindingType = this.BindingType.Direct;\r\n\r\n\t\tif ( propertyIndex !== undefined ) {\r\n\r\n\t\t\t// access a sub element of the property array (only primitives are supported right now)\r\n\r\n\t\t\tif ( propertyName === 'morphTargetInfluences' ) {\r\n\r\n\t\t\t\t// potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.\r\n\r\n\t\t\t\t// support resolving morphTarget names into indices.\r\n\t\t\t\tif ( ! targetObject.geometry ) {\r\n\r\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this );\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( ! targetObject.geometry.morphAttributes ) {\r\n\r\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this );\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( targetObject.morphTargetDictionary[ propertyIndex ] !== undefined ) {\r\n\r\n\t\t\t\t\tpropertyIndex = targetObject.morphTargetDictionary[ propertyIndex ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbindingType = this.BindingType.ArrayElement;\r\n\r\n\t\t\tthis.resolvedProperty = nodeProperty;\r\n\t\t\tthis.propertyIndex = propertyIndex;\r\n\r\n\t\t} else if ( nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined ) {\r\n\r\n\t\t\t// must use copy for Object3D.Euler/Quaternion\r\n\r\n\t\t\tbindingType = this.BindingType.HasFromToArray;\r\n\r\n\t\t\tthis.resolvedProperty = nodeProperty;\r\n\r\n\t\t} else if ( Array.isArray( nodeProperty ) ) {\r\n\r\n\t\t\tbindingType = this.BindingType.EntireArray;\r\n\r\n\t\t\tthis.resolvedProperty = nodeProperty;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.propertyName = propertyName;\r\n\r\n\t\t}\r\n\r\n\t\t// select getter / setter\r\n\t\tthis.getValue = this.GetterByBindingType[ bindingType ];\r\n\t\tthis.setValue = this.SetterByBindingTypeAndVersioning[ bindingType ][ versioning ];\r\n\r\n\t}\r\n\r\n\tunbind() {\r\n\r\n\t\tthis.node = null;\r\n\r\n\t\t// back to the prototype version of getValue / setValue\r\n\t\t// note: avoiding to mutate the shape of 'this' via 'delete'\r\n\t\tthis.getValue = this._getValue_unbound;\r\n\t\tthis.setValue = this._setValue_unbound;\r\n\r\n\t}\r\n\r\n}\r\n\r\nPropertyBinding.Composite = Composite;\r\n\r\nPropertyBinding.prototype.BindingType = {\r\n\tDirect: 0,\r\n\tEntireArray: 1,\r\n\tArrayElement: 2,\r\n\tHasFromToArray: 3\r\n};\r\n\r\nPropertyBinding.prototype.Versioning = {\r\n\tNone: 0,\r\n\tNeedsUpdate: 1,\r\n\tMatrixWorldNeedsUpdate: 2\r\n};\r\n\r\nPropertyBinding.prototype.GetterByBindingType = [\r\n\r\n\tPropertyBinding.prototype._getValue_direct,\r\n\tPropertyBinding.prototype._getValue_array,\r\n\tPropertyBinding.prototype._getValue_arrayElement,\r\n\tPropertyBinding.prototype._getValue_toArray,\r\n\r\n];\r\n\r\nPropertyBinding.prototype.SetterByBindingTypeAndVersioning = [\r\n\r\n\t[\r\n\t\t// Direct\r\n\t\tPropertyBinding.prototype._setValue_direct,\r\n\t\tPropertyBinding.prototype._setValue_direct_setNeedsUpdate,\r\n\t\tPropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate,\r\n\r\n\t], [\r\n\r\n\t\t// EntireArray\r\n\r\n\t\tPropertyBinding.prototype._setValue_array,\r\n\t\tPropertyBinding.prototype._setValue_array_setNeedsUpdate,\r\n\t\tPropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate,\r\n\r\n\t], [\r\n\r\n\t\t// ArrayElement\r\n\t\tPropertyBinding.prototype._setValue_arrayElement,\r\n\t\tPropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,\r\n\t\tPropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate,\r\n\r\n\t], [\r\n\r\n\t\t// HasToFromArray\r\n\t\tPropertyBinding.prototype._setValue_fromArray,\r\n\t\tPropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,\r\n\t\tPropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate,\r\n\r\n\t]\r\n\r\n];\r\n\r\n/**\r\n *\r\n * A group of objects that receives a shared animation state.\r\n *\r\n * Usage:\r\n *\r\n * - Add objects you would otherwise pass as 'root' to the\r\n * constructor or the .clipAction method of AnimationMixer.\r\n *\r\n * - Instead pass this object as 'root'.\r\n *\r\n * - You can also add and remove objects later when the mixer\r\n * is running.\r\n *\r\n * Note:\r\n *\r\n * Objects of this class appear as one object to the mixer,\r\n * so cache control of the individual objects must be done\r\n * on the group.\r\n *\r\n * Limitation:\r\n *\r\n * - The animated properties must be compatible among the\r\n * all objects in the group.\r\n *\r\n * - A single property can either be controlled through a\r\n * target group or directly, but not both.\r\n */\r\n\r\nclass AnimationObjectGroup {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.isAnimationObjectGroup = true;\r\n\r\n\t\tthis.uuid = generateUUID();\r\n\r\n\t\t// cached objects followed by the active ones\r\n\t\tthis._objects = Array.prototype.slice.call( arguments );\r\n\r\n\t\tthis.nCachedObjects_ = 0; // threshold\r\n\t\t// note: read by PropertyBinding.Composite\r\n\r\n\t\tconst indices = {};\r\n\t\tthis._indicesByUUID = indices; // for bookkeeping\r\n\r\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\r\n\r\n\t\t\tindices[ arguments[ i ].uuid ] = i;\r\n\r\n\t\t}\r\n\r\n\t\tthis._paths = []; // inside: string\r\n\t\tthis._parsedPaths = []; // inside: { we don't care, here }\r\n\t\tthis._bindings = []; // inside: Array< PropertyBinding >\r\n\t\tthis._bindingsIndicesByPath = {}; // inside: indices in these arrays\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\tthis.stats = {\r\n\r\n\t\t\tobjects: {\r\n\t\t\t\tget total() {\r\n\r\n\t\t\t\t\treturn scope._objects.length;\r\n\r\n\t\t\t\t},\r\n\t\t\t\tget inUse() {\r\n\r\n\t\t\t\t\treturn this.total - scope.nCachedObjects_;\r\n\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tget bindingsPerObject() {\r\n\r\n\t\t\t\treturn scope._bindings.length;\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tadd() {\r\n\r\n\t\tconst objects = this._objects,\r\n\t\t\tindicesByUUID = this._indicesByUUID,\r\n\t\t\tpaths = this._paths,\r\n\t\t\tparsedPaths = this._parsedPaths,\r\n\t\t\tbindings = this._bindings,\r\n\t\t\tnBindings = bindings.length;\r\n\r\n\t\tlet knownObject = undefined,\r\n\t\t\tnObjects = objects.length,\r\n\t\t\tnCachedObjects = this.nCachedObjects_;\r\n\r\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\r\n\r\n\t\t\tconst object = arguments[ i ],\r\n\t\t\t\tuuid = object.uuid;\r\n\t\t\tlet index = indicesByUUID[ uuid ];\r\n\r\n\t\t\tif ( index === undefined ) {\r\n\r\n\t\t\t\t// unknown object -> add it to the ACTIVE region\r\n\r\n\t\t\t\tindex = nObjects ++;\r\n\t\t\t\tindicesByUUID[ uuid ] = index;\r\n\t\t\t\tobjects.push( object );\r\n\r\n\t\t\t\t// accounting is done, now do the same for all bindings\r\n\r\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\r\n\r\n\t\t\t\t\tbindings[ j ].push( new PropertyBinding( object, paths[ j ], parsedPaths[ j ] ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( index < nCachedObjects ) {\r\n\r\n\t\t\t\tknownObject = objects[ index ];\r\n\r\n\t\t\t\t// move existing object to the ACTIVE region\r\n\r\n\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\r\n\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ];\r\n\r\n\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\r\n\t\t\t\tobjects[ index ] = lastCachedObject;\r\n\r\n\t\t\t\tindicesByUUID[ uuid ] = firstActiveIndex;\r\n\t\t\t\tobjects[ firstActiveIndex ] = object;\r\n\r\n\t\t\t\t// accounting is done, now do the same for all bindings\r\n\r\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\r\n\r\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\r\n\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ];\r\n\r\n\t\t\t\t\tlet binding = bindingsForPath[ index ];\r\n\r\n\t\t\t\t\tbindingsForPath[ index ] = lastCached;\r\n\r\n\t\t\t\t\tif ( binding === undefined ) {\r\n\r\n\t\t\t\t\t\t// since we do not bother to create new bindings\r\n\t\t\t\t\t\t// for objects that are cached, the binding may\r\n\t\t\t\t\t\t// or may not exist\r\n\r\n\t\t\t\t\t\tbinding = new PropertyBinding( object, paths[ j ], parsedPaths[ j ] );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = binding;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( objects[ index ] !== knownObject ) {\r\n\r\n\t\t\t\tconsole.error( 'THREE.AnimationObjectGroup: Different objects with the same UUID ' +\r\n\t\t\t\t\t'detected. Clean the caches or recreate your infrastructure when reloading scenes.' );\r\n\r\n\t\t\t} // else the object is already where we want it to be\r\n\r\n\t\t} // for arguments\r\n\r\n\t\tthis.nCachedObjects_ = nCachedObjects;\r\n\r\n\t}\r\n\r\n\tremove() {\r\n\r\n\t\tconst objects = this._objects,\r\n\t\t\tindicesByUUID = this._indicesByUUID,\r\n\t\t\tbindings = this._bindings,\r\n\t\t\tnBindings = bindings.length;\r\n\r\n\t\tlet nCachedObjects = this.nCachedObjects_;\r\n\r\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\r\n\r\n\t\t\tconst object = arguments[ i ],\r\n\t\t\t\tuuid = object.uuid,\r\n\t\t\t\tindex = indicesByUUID[ uuid ];\r\n\r\n\t\t\tif ( index !== undefined && index >= nCachedObjects ) {\r\n\r\n\t\t\t\t// move existing object into the CACHED region\r\n\r\n\t\t\t\tconst lastCachedIndex = nCachedObjects ++,\r\n\t\t\t\t\tfirstActiveObject = objects[ lastCachedIndex ];\r\n\r\n\t\t\t\tindicesByUUID[ firstActiveObject.uuid ] = index;\r\n\t\t\t\tobjects[ index ] = firstActiveObject;\r\n\r\n\t\t\t\tindicesByUUID[ uuid ] = lastCachedIndex;\r\n\t\t\t\tobjects[ lastCachedIndex ] = object;\r\n\r\n\t\t\t\t// accounting is done, now do the same for all bindings\r\n\r\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\r\n\r\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\r\n\t\t\t\t\t\tfirstActive = bindingsForPath[ lastCachedIndex ],\r\n\t\t\t\t\t\tbinding = bindingsForPath[ index ];\r\n\r\n\t\t\t\t\tbindingsForPath[ index ] = firstActive;\r\n\t\t\t\t\tbindingsForPath[ lastCachedIndex ] = binding;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} // for arguments\r\n\r\n\t\tthis.nCachedObjects_ = nCachedObjects;\r\n\r\n\t}\r\n\r\n\t// remove & forget\r\n\tuncache() {\r\n\r\n\t\tconst objects = this._objects,\r\n\t\t\tindicesByUUID = this._indicesByUUID,\r\n\t\t\tbindings = this._bindings,\r\n\t\t\tnBindings = bindings.length;\r\n\r\n\t\tlet nCachedObjects = this.nCachedObjects_,\r\n\t\t\tnObjects = objects.length;\r\n\r\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\r\n\r\n\t\t\tconst object = arguments[ i ],\r\n\t\t\t\tuuid = object.uuid,\r\n\t\t\t\tindex = indicesByUUID[ uuid ];\r\n\r\n\t\t\tif ( index !== undefined ) {\r\n\r\n\t\t\t\tdelete indicesByUUID[ uuid ];\r\n\r\n\t\t\t\tif ( index < nCachedObjects ) {\r\n\r\n\t\t\t\t\t// object is cached, shrink the CACHED region\r\n\r\n\t\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\r\n\t\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ],\r\n\t\t\t\t\t\tlastIndex = -- nObjects,\r\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\r\n\r\n\t\t\t\t\t// last cached object takes this object's place\r\n\t\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\r\n\t\t\t\t\tobjects[ index ] = lastCachedObject;\r\n\r\n\t\t\t\t\t// last object goes to the activated slot and pop\r\n\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = firstActiveIndex;\r\n\t\t\t\t\tobjects[ firstActiveIndex ] = lastObject;\r\n\t\t\t\t\tobjects.pop();\r\n\r\n\t\t\t\t\t// accounting is done, now do the same for all bindings\r\n\r\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\r\n\r\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ],\r\n\t\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ],\r\n\t\t\t\t\t\t\tlast = bindingsForPath[ lastIndex ];\r\n\r\n\t\t\t\t\t\tbindingsForPath[ index ] = lastCached;\r\n\t\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = last;\r\n\t\t\t\t\t\tbindingsForPath.pop();\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// object is active, just swap with the last and pop\r\n\r\n\t\t\t\t\tconst lastIndex = -- nObjects,\r\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\r\n\r\n\t\t\t\t\tif ( lastIndex > 0 ) {\r\n\r\n\t\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = index;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tobjects[ index ] = lastObject;\r\n\t\t\t\t\tobjects.pop();\r\n\r\n\t\t\t\t\t// accounting is done, now do the same for all bindings\r\n\r\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\r\n\r\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ];\r\n\r\n\t\t\t\t\t\tbindingsForPath[ index ] = bindingsForPath[ lastIndex ];\r\n\t\t\t\t\t\tbindingsForPath.pop();\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} // cached or active\r\n\r\n\t\t\t} // if object is known\r\n\r\n\t\t} // for arguments\r\n\r\n\t\tthis.nCachedObjects_ = nCachedObjects;\r\n\r\n\t}\r\n\r\n\t// Internal interface used by befriended PropertyBinding.Composite:\r\n\r\n\tsubscribe_( path, parsedPath ) {\r\n\r\n\t\t// returns an array of bindings for the given path that is changed\r\n\t\t// according to the contained objects in the group\r\n\r\n\t\tconst indicesByPath = this._bindingsIndicesByPath;\r\n\t\tlet index = indicesByPath[ path ];\r\n\t\tconst bindings = this._bindings;\r\n\r\n\t\tif ( index !== undefined ) return bindings[ index ];\r\n\r\n\t\tconst paths = this._paths,\r\n\t\t\tparsedPaths = this._parsedPaths,\r\n\t\t\tobjects = this._objects,\r\n\t\t\tnObjects = objects.length,\r\n\t\t\tnCachedObjects = this.nCachedObjects_,\r\n\t\t\tbindingsForPath = new Array( nObjects );\r\n\r\n\t\tindex = bindings.length;\r\n\r\n\t\tindicesByPath[ path ] = index;\r\n\r\n\t\tpaths.push( path );\r\n\t\tparsedPaths.push( parsedPath );\r\n\t\tbindings.push( bindingsForPath );\r\n\r\n\t\tfor ( let i = nCachedObjects, n = objects.length; i !== n; ++ i ) {\r\n\r\n\t\t\tconst object = objects[ i ];\r\n\t\t\tbindingsForPath[ i ] = new PropertyBinding( object, path, parsedPath );\r\n\r\n\t\t}\r\n\r\n\t\treturn bindingsForPath;\r\n\r\n\t}\r\n\r\n\tunsubscribe_( path ) {\r\n\r\n\t\t// tells the group to forget about a property path and no longer\r\n\t\t// update the array previously obtained with 'subscribe_'\r\n\r\n\t\tconst indicesByPath = this._bindingsIndicesByPath,\r\n\t\t\tindex = indicesByPath[ path ];\r\n\r\n\t\tif ( index !== undefined ) {\r\n\r\n\t\t\tconst paths = this._paths,\r\n\t\t\t\tparsedPaths = this._parsedPaths,\r\n\t\t\t\tbindings = this._bindings,\r\n\t\t\t\tlastBindingsIndex = bindings.length - 1,\r\n\t\t\t\tlastBindings = bindings[ lastBindingsIndex ],\r\n\t\t\t\tlastBindingsPath = path[ lastBindingsIndex ];\r\n\r\n\t\t\tindicesByPath[ lastBindingsPath ] = index;\r\n\r\n\t\t\tbindings[ index ] = lastBindings;\r\n\t\t\tbindings.pop();\r\n\r\n\t\t\tparsedPaths[ index ] = parsedPaths[ lastBindingsIndex ];\r\n\t\t\tparsedPaths.pop();\r\n\r\n\t\t\tpaths[ index ] = paths[ lastBindingsIndex ];\r\n\t\t\tpaths.pop();\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass AnimationAction {\r\n\r\n\tconstructor( mixer, clip, localRoot = null, blendMode = clip.blendMode ) {\r\n\r\n\t\tthis._mixer = mixer;\r\n\t\tthis._clip = clip;\r\n\t\tthis._localRoot = localRoot;\r\n\t\tthis.blendMode = blendMode;\r\n\r\n\t\tconst tracks = clip.tracks,\r\n\t\t\tnTracks = tracks.length,\r\n\t\t\tinterpolants = new Array( nTracks );\r\n\r\n\t\tconst interpolantSettings = {\r\n\t\t\tendingStart: ZeroCurvatureEnding,\r\n\t\t\tendingEnd: ZeroCurvatureEnding\r\n\t\t};\r\n\r\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\r\n\r\n\t\t\tconst interpolant = tracks[ i ].createInterpolant( null );\r\n\t\t\tinterpolants[ i ] = interpolant;\r\n\t\t\tinterpolant.settings = interpolantSettings;\r\n\r\n\t\t}\r\n\r\n\t\tthis._interpolantSettings = interpolantSettings;\r\n\r\n\t\tthis._interpolants = interpolants; // bound by the mixer\r\n\r\n\t\t// inside: PropertyMixer (managed by the mixer)\r\n\t\tthis._propertyBindings = new Array( nTracks );\r\n\r\n\t\tthis._cacheIndex = null; // for the memory manager\r\n\t\tthis._byClipCacheIndex = null; // for the memory manager\r\n\r\n\t\tthis._timeScaleInterpolant = null;\r\n\t\tthis._weightInterpolant = null;\r\n\r\n\t\tthis.loop = LoopRepeat;\r\n\t\tthis._loopCount = - 1;\r\n\r\n\t\t// global mixer time when the action is to be started\r\n\t\t// it's set back to 'null' upon start of the action\r\n\t\tthis._startTime = null;\r\n\r\n\t\t// scaled local time of the action\r\n\t\t// gets clamped or wrapped to 0..clip.duration according to loop\r\n\t\tthis.time = 0;\r\n\r\n\t\tthis.timeScale = 1;\r\n\t\tthis._effectiveTimeScale = 1;\r\n\r\n\t\tthis.weight = 1;\r\n\t\tthis._effectiveWeight = 1;\r\n\r\n\t\tthis.repetitions = Infinity; // no. of repetitions when looping\r\n\r\n\t\tthis.paused = false; // true -> zero effective time scale\r\n\t\tthis.enabled = true; // false -> zero effective weight\r\n\r\n\t\tthis.clampWhenFinished = false;// keep feeding the last frame?\r\n\r\n\t\tthis.zeroSlopeAtStart = true;// for smooth interpolation w/o separate\r\n\t\tthis.zeroSlopeAtEnd = true;// clips for start, loop and end\r\n\r\n\t}\r\n\r\n\t// State & Scheduling\r\n\r\n\tplay() {\r\n\r\n\t\tthis._mixer._activateAction( this );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tstop() {\r\n\r\n\t\tthis._mixer._deactivateAction( this );\r\n\r\n\t\treturn this.reset();\r\n\r\n\t}\r\n\r\n\treset() {\r\n\r\n\t\tthis.paused = false;\r\n\t\tthis.enabled = true;\r\n\r\n\t\tthis.time = 0; // restart clip\r\n\t\tthis._loopCount = - 1;// forget previous loops\r\n\t\tthis._startTime = null;// forget scheduling\r\n\r\n\t\treturn this.stopFading().stopWarping();\r\n\r\n\t}\r\n\r\n\tisRunning() {\r\n\r\n\t\treturn this.enabled && ! this.paused && this.timeScale !== 0 &&\r\n\t\t\tthis._startTime === null && this._mixer._isActiveAction( this );\r\n\r\n\t}\r\n\r\n\t// return true when play has been called\r\n\tisScheduled() {\r\n\r\n\t\treturn this._mixer._isActiveAction( this );\r\n\r\n\t}\r\n\r\n\tstartAt( time ) {\r\n\r\n\t\tthis._startTime = time;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetLoop( mode, repetitions ) {\r\n\r\n\t\tthis.loop = mode;\r\n\t\tthis.repetitions = repetitions;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t// Weight\r\n\r\n\t// set the weight stopping any scheduled fading\r\n\t// although .enabled = false yields an effective weight of zero, this\r\n\t// method does *not* change .enabled, because it would be confusing\r\n\tsetEffectiveWeight( weight ) {\r\n\r\n\t\tthis.weight = weight;\r\n\r\n\t\t// note: same logic as when updated at runtime\r\n\t\tthis._effectiveWeight = this.enabled ? weight : 0;\r\n\r\n\t\treturn this.stopFading();\r\n\r\n\t}\r\n\r\n\t// return the weight considering fading and .enabled\r\n\tgetEffectiveWeight() {\r\n\r\n\t\treturn this._effectiveWeight;\r\n\r\n\t}\r\n\r\n\tfadeIn( duration ) {\r\n\r\n\t\treturn this._scheduleFading( duration, 0, 1 );\r\n\r\n\t}\r\n\r\n\tfadeOut( duration ) {\r\n\r\n\t\treturn this._scheduleFading( duration, 1, 0 );\r\n\r\n\t}\r\n\r\n\tcrossFadeFrom( fadeOutAction, duration, warp ) {\r\n\r\n\t\tfadeOutAction.fadeOut( duration );\r\n\t\tthis.fadeIn( duration );\r\n\r\n\t\tif ( warp ) {\r\n\r\n\t\t\tconst fadeInDuration = this._clip.duration,\r\n\t\t\t\tfadeOutDuration = fadeOutAction._clip.duration,\r\n\r\n\t\t\t\tstartEndRatio = fadeOutDuration / fadeInDuration,\r\n\t\t\t\tendStartRatio = fadeInDuration / fadeOutDuration;\r\n\r\n\t\t\tfadeOutAction.warp( 1.0, startEndRatio, duration );\r\n\t\t\tthis.warp( endStartRatio, 1.0, duration );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcrossFadeTo( fadeInAction, duration, warp ) {\r\n\r\n\t\treturn fadeInAction.crossFadeFrom( this, duration, warp );\r\n\r\n\t}\r\n\r\n\tstopFading() {\r\n\r\n\t\tconst weightInterpolant = this._weightInterpolant;\r\n\r\n\t\tif ( weightInterpolant !== null ) {\r\n\r\n\t\t\tthis._weightInterpolant = null;\r\n\t\t\tthis._mixer._takeBackControlInterpolant( weightInterpolant );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t// Time Scale Control\r\n\r\n\t// set the time scale stopping any scheduled warping\r\n\t// although .paused = true yields an effective time scale of zero, this\r\n\t// method does *not* change .paused, because it would be confusing\r\n\tsetEffectiveTimeScale( timeScale ) {\r\n\r\n\t\tthis.timeScale = timeScale;\r\n\t\tthis._effectiveTimeScale = this.paused ? 0 : timeScale;\r\n\r\n\t\treturn this.stopWarping();\r\n\r\n\t}\r\n\r\n\t// return the time scale considering warping and .paused\r\n\tgetEffectiveTimeScale() {\r\n\r\n\t\treturn this._effectiveTimeScale;\r\n\r\n\t}\r\n\r\n\tsetDuration( duration ) {\r\n\r\n\t\tthis.timeScale = this._clip.duration / duration;\r\n\r\n\t\treturn this.stopWarping();\r\n\r\n\t}\r\n\r\n\tsyncWith( action ) {\r\n\r\n\t\tthis.time = action.time;\r\n\t\tthis.timeScale = action.timeScale;\r\n\r\n\t\treturn this.stopWarping();\r\n\r\n\t}\r\n\r\n\thalt( duration ) {\r\n\r\n\t\treturn this.warp( this._effectiveTimeScale, 0, duration );\r\n\r\n\t}\r\n\r\n\twarp( startTimeScale, endTimeScale, duration ) {\r\n\r\n\t\tconst mixer = this._mixer,\r\n\t\t\tnow = mixer.time,\r\n\t\t\ttimeScale = this.timeScale;\r\n\r\n\t\tlet interpolant = this._timeScaleInterpolant;\r\n\r\n\t\tif ( interpolant === null ) {\r\n\r\n\t\t\tinterpolant = mixer._lendControlInterpolant();\r\n\t\t\tthis._timeScaleInterpolant = interpolant;\r\n\r\n\t\t}\r\n\r\n\t\tconst times = interpolant.parameterPositions,\r\n\t\t\tvalues = interpolant.sampleValues;\r\n\r\n\t\ttimes[ 0 ] = now;\r\n\t\ttimes[ 1 ] = now + duration;\r\n\r\n\t\tvalues[ 0 ] = startTimeScale / timeScale;\r\n\t\tvalues[ 1 ] = endTimeScale / timeScale;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tstopWarping() {\r\n\r\n\t\tconst timeScaleInterpolant = this._timeScaleInterpolant;\r\n\r\n\t\tif ( timeScaleInterpolant !== null ) {\r\n\r\n\t\t\tthis._timeScaleInterpolant = null;\r\n\t\t\tthis._mixer._takeBackControlInterpolant( timeScaleInterpolant );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t// Object Accessors\r\n\r\n\tgetMixer() {\r\n\r\n\t\treturn this._mixer;\r\n\r\n\t}\r\n\r\n\tgetClip() {\r\n\r\n\t\treturn this._clip;\r\n\r\n\t}\r\n\r\n\tgetRoot() {\r\n\r\n\t\treturn this._localRoot || this._mixer._root;\r\n\r\n\t}\r\n\r\n\t// Interna\r\n\r\n\t_update( time, deltaTime, timeDirection, accuIndex ) {\r\n\r\n\t\t// called by the mixer\r\n\r\n\t\tif ( ! this.enabled ) {\r\n\r\n\t\t\t// call ._updateWeight() to update ._effectiveWeight\r\n\r\n\t\t\tthis._updateWeight( time );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tconst startTime = this._startTime;\r\n\r\n\t\tif ( startTime !== null ) {\r\n\r\n\t\t\t// check for scheduled start of action\r\n\r\n\t\t\tconst timeRunning = ( time - startTime ) * timeDirection;\r\n\t\t\tif ( timeRunning < 0 || timeDirection === 0 ) {\r\n\r\n\t\t\t\tdeltaTime = 0;\r\n\r\n\t\t\t} else {\r\n\r\n\r\n\t\t\t\tthis._startTime = null; // unschedule\r\n\t\t\t\tdeltaTime = timeDirection * timeRunning;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// apply time scale and advance time\r\n\r\n\t\tdeltaTime *= this._updateTimeScale( time );\r\n\t\tconst clipTime = this._updateTime( deltaTime );\r\n\r\n\t\t// note: _updateTime may disable the action resulting in\r\n\t\t// an effective weight of 0\r\n\r\n\t\tconst weight = this._updateWeight( time );\r\n\r\n\t\tif ( weight > 0 ) {\r\n\r\n\t\t\tconst interpolants = this._interpolants;\r\n\t\t\tconst propertyMixers = this._propertyBindings;\r\n\r\n\t\t\tswitch ( this.blendMode ) {\r\n\r\n\t\t\t\tcase AdditiveAnimationBlendMode:\r\n\r\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\r\n\r\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\r\n\t\t\t\t\t\tpropertyMixers[ j ].accumulateAdditive( weight );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase NormalAnimationBlendMode:\r\n\t\t\t\tdefault:\r\n\r\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\r\n\r\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\r\n\t\t\t\t\t\tpropertyMixers[ j ].accumulate( accuIndex, weight );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t_updateWeight( time ) {\r\n\r\n\t\tlet weight = 0;\r\n\r\n\t\tif ( this.enabled ) {\r\n\r\n\t\t\tweight = this.weight;\r\n\t\t\tconst interpolant = this._weightInterpolant;\r\n\r\n\t\t\tif ( interpolant !== null ) {\r\n\r\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\r\n\r\n\t\t\t\tweight *= interpolantValue;\r\n\r\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\r\n\r\n\t\t\t\t\tthis.stopFading();\r\n\r\n\t\t\t\t\tif ( interpolantValue === 0 ) {\r\n\r\n\t\t\t\t\t\t// faded out, disable\r\n\t\t\t\t\t\tthis.enabled = false;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis._effectiveWeight = weight;\r\n\t\treturn weight;\r\n\r\n\t}\r\n\r\n\t_updateTimeScale( time ) {\r\n\r\n\t\tlet timeScale = 0;\r\n\r\n\t\tif ( ! this.paused ) {\r\n\r\n\t\t\ttimeScale = this.timeScale;\r\n\r\n\t\t\tconst interpolant = this._timeScaleInterpolant;\r\n\r\n\t\t\tif ( interpolant !== null ) {\r\n\r\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\r\n\r\n\t\t\t\ttimeScale *= interpolantValue;\r\n\r\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\r\n\r\n\t\t\t\t\tthis.stopWarping();\r\n\r\n\t\t\t\t\tif ( timeScale === 0 ) {\r\n\r\n\t\t\t\t\t\t// motion has halted, pause\r\n\t\t\t\t\t\tthis.paused = true;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t// warp done - apply final time scale\r\n\t\t\t\t\t\tthis.timeScale = timeScale;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis._effectiveTimeScale = timeScale;\r\n\t\treturn timeScale;\r\n\r\n\t}\r\n\r\n\t_updateTime( deltaTime ) {\r\n\r\n\t\tconst duration = this._clip.duration;\r\n\t\tconst loop = this.loop;\r\n\r\n\t\tlet time = this.time + deltaTime;\r\n\t\tlet loopCount = this._loopCount;\r\n\r\n\t\tconst pingPong = ( loop === LoopPingPong );\r\n\r\n\t\tif ( deltaTime === 0 ) {\r\n\r\n\t\t\tif ( loopCount === - 1 ) return time;\r\n\r\n\t\t\treturn ( pingPong && ( loopCount & 1 ) === 1 ) ? duration - time : time;\r\n\r\n\t\t}\r\n\r\n\t\tif ( loop === LoopOnce ) {\r\n\r\n\t\t\tif ( loopCount === - 1 ) {\r\n\r\n\t\t\t\t// just started\r\n\r\n\t\t\t\tthis._loopCount = 0;\r\n\t\t\t\tthis._setEndings( true, true, false );\r\n\r\n\t\t\t}\r\n\r\n\t\t\thandle_stop: {\r\n\r\n\t\t\t\tif ( time >= duration ) {\r\n\r\n\t\t\t\t\ttime = duration;\r\n\r\n\t\t\t\t} else if ( time < 0 ) {\r\n\r\n\t\t\t\t\ttime = 0;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tthis.time = time;\r\n\r\n\t\t\t\t\tbreak handle_stop;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\r\n\t\t\t\telse this.enabled = false;\r\n\r\n\t\t\t\tthis.time = time;\r\n\r\n\t\t\t\tthis._mixer.dispatchEvent( {\r\n\t\t\t\t\ttype: 'finished', action: this,\r\n\t\t\t\t\tdirection: deltaTime < 0 ? - 1 : 1\r\n\t\t\t\t} );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else { // repetitive Repeat or PingPong\r\n\r\n\t\t\tif ( loopCount === - 1 ) {\r\n\r\n\t\t\t\t// just started\r\n\r\n\t\t\t\tif ( deltaTime >= 0 ) {\r\n\r\n\t\t\t\t\tloopCount = 0;\r\n\r\n\t\t\t\t\tthis._setEndings( true, this.repetitions === 0, pingPong );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// when looping in reverse direction, the initial\r\n\t\t\t\t\t// transition through zero counts as a repetition,\r\n\t\t\t\t\t// so leave loopCount at -1\r\n\r\n\t\t\t\t\tthis._setEndings( this.repetitions === 0, true, pingPong );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( time >= duration || time < 0 ) {\r\n\r\n\t\t\t\t// wrap around\r\n\r\n\t\t\t\tconst loopDelta = Math.floor( time / duration ); // signed\r\n\t\t\t\ttime -= duration * loopDelta;\r\n\r\n\t\t\t\tloopCount += Math.abs( loopDelta );\r\n\r\n\t\t\t\tconst pending = this.repetitions - loopCount;\r\n\r\n\t\t\t\tif ( pending <= 0 ) {\r\n\r\n\t\t\t\t\t// have to stop (switch state, clamp time, fire event)\r\n\r\n\t\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\r\n\t\t\t\t\telse this.enabled = false;\r\n\r\n\t\t\t\t\ttime = deltaTime > 0 ? duration : 0;\r\n\r\n\t\t\t\t\tthis.time = time;\r\n\r\n\t\t\t\t\tthis._mixer.dispatchEvent( {\r\n\t\t\t\t\t\ttype: 'finished', action: this,\r\n\t\t\t\t\t\tdirection: deltaTime > 0 ? 1 : - 1\r\n\t\t\t\t\t} );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// keep running\r\n\r\n\t\t\t\t\tif ( pending === 1 ) {\r\n\r\n\t\t\t\t\t\t// entering the last round\r\n\r\n\t\t\t\t\t\tconst atStart = deltaTime < 0;\r\n\t\t\t\t\t\tthis._setEndings( atStart, ! atStart, pingPong );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tthis._setEndings( false, false, pingPong );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis._loopCount = loopCount;\r\n\r\n\t\t\t\t\tthis.time = time;\r\n\r\n\t\t\t\t\tthis._mixer.dispatchEvent( {\r\n\t\t\t\t\t\ttype: 'loop', action: this, loopDelta: loopDelta\r\n\t\t\t\t\t} );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis.time = time;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( pingPong && ( loopCount & 1 ) === 1 ) {\r\n\r\n\t\t\t\t// invert time for the \"pong round\"\r\n\r\n\t\t\t\treturn duration - time;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn time;\r\n\r\n\t}\r\n\r\n\t_setEndings( atStart, atEnd, pingPong ) {\r\n\r\n\t\tconst settings = this._interpolantSettings;\r\n\r\n\t\tif ( pingPong ) {\r\n\r\n\t\t\tsettings.endingStart = ZeroSlopeEnding;\r\n\t\t\tsettings.endingEnd = ZeroSlopeEnding;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// assuming for LoopOnce atStart == atEnd == true\r\n\r\n\t\t\tif ( atStart ) {\r\n\r\n\t\t\t\tsettings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tsettings.endingStart = WrapAroundEnding;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( atEnd ) {\r\n\r\n\t\t\t\tsettings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tsettings.endingEnd \t = WrapAroundEnding;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t_scheduleFading( duration, weightNow, weightThen ) {\r\n\r\n\t\tconst mixer = this._mixer, now = mixer.time;\r\n\t\tlet interpolant = this._weightInterpolant;\r\n\r\n\t\tif ( interpolant === null ) {\r\n\r\n\t\t\tinterpolant = mixer._lendControlInterpolant();\r\n\t\t\tthis._weightInterpolant = interpolant;\r\n\r\n\t\t}\r\n\r\n\t\tconst times = interpolant.parameterPositions,\r\n\t\t\tvalues = interpolant.sampleValues;\r\n\r\n\t\ttimes[ 0 ] = now;\r\n\t\tvalues[ 0 ] = weightNow;\r\n\t\ttimes[ 1 ] = now + duration;\r\n\t\tvalues[ 1 ] = weightThen;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _controlInterpolantsResultBuffer = new Float32Array( 1 );\r\n\r\n\r\nclass AnimationMixer extends EventDispatcher {\r\n\r\n\tconstructor( root ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis._root = root;\r\n\t\tthis._initMemoryManager();\r\n\t\tthis._accuIndex = 0;\r\n\t\tthis.time = 0;\r\n\t\tthis.timeScale = 1.0;\r\n\r\n\t}\r\n\r\n\t_bindAction( action, prototypeAction ) {\r\n\r\n\t\tconst root = action._localRoot || this._root,\r\n\t\t\ttracks = action._clip.tracks,\r\n\t\t\tnTracks = tracks.length,\r\n\t\t\tbindings = action._propertyBindings,\r\n\t\t\tinterpolants = action._interpolants,\r\n\t\t\trootUuid = root.uuid,\r\n\t\t\tbindingsByRoot = this._bindingsByRootAndName;\r\n\r\n\t\tlet bindingsByName = bindingsByRoot[ rootUuid ];\r\n\r\n\t\tif ( bindingsByName === undefined ) {\r\n\r\n\t\t\tbindingsByName = {};\r\n\t\t\tbindingsByRoot[ rootUuid ] = bindingsByName;\r\n\r\n\t\t}\r\n\r\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\r\n\r\n\t\t\tconst track = tracks[ i ],\r\n\t\t\t\ttrackName = track.name;\r\n\r\n\t\t\tlet binding = bindingsByName[ trackName ];\r\n\r\n\t\t\tif ( binding !== undefined ) {\r\n\r\n\t\t\t\t++ binding.referenceCount;\r\n\t\t\t\tbindings[ i ] = binding;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbinding = bindings[ i ];\r\n\r\n\t\t\t\tif ( binding !== undefined ) {\r\n\r\n\t\t\t\t\t// existing binding, make sure the cache knows\r\n\r\n\t\t\t\t\tif ( binding._cacheIndex === null ) {\r\n\r\n\t\t\t\t\t\t++ binding.referenceCount;\r\n\t\t\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst path = prototypeAction && prototypeAction.\r\n\t\t\t\t\t_propertyBindings[ i ].binding.parsedPath;\r\n\r\n\t\t\t\tbinding = new PropertyMixer(\r\n\t\t\t\t\tPropertyBinding.create( root, trackName, path ),\r\n\t\t\t\t\ttrack.ValueTypeName, track.getValueSize() );\r\n\r\n\t\t\t\t++ binding.referenceCount;\r\n\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\r\n\r\n\t\t\t\tbindings[ i ] = binding;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tinterpolants[ i ].resultBuffer = binding.buffer;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t_activateAction( action ) {\r\n\r\n\t\tif ( ! this._isActiveAction( action ) ) {\r\n\r\n\t\t\tif ( action._cacheIndex === null ) {\r\n\r\n\t\t\t\t// this action has been forgotten by the cache, but the user\r\n\t\t\t\t// appears to be still using it -> rebind\r\n\r\n\t\t\t\tconst rootUuid = ( action._localRoot || this._root ).uuid,\r\n\t\t\t\t\tclipUuid = action._clip.uuid,\r\n\t\t\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\r\n\r\n\t\t\t\tthis._bindAction( action,\r\n\t\t\t\t\tactionsForClip && actionsForClip.knownActions[ 0 ] );\r\n\r\n\t\t\t\tthis._addInactiveAction( action, clipUuid, rootUuid );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst bindings = action._propertyBindings;\r\n\r\n\t\t\t// increment reference counts / sort out state\r\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\r\n\r\n\t\t\t\tconst binding = bindings[ i ];\r\n\r\n\t\t\t\tif ( binding.useCount ++ === 0 ) {\r\n\r\n\t\t\t\t\tthis._lendBinding( binding );\r\n\t\t\t\t\tbinding.saveOriginalState();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis._lendAction( action );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t_deactivateAction( action ) {\r\n\r\n\t\tif ( this._isActiveAction( action ) ) {\r\n\r\n\t\t\tconst bindings = action._propertyBindings;\r\n\r\n\t\t\t// decrement reference counts / sort out state\r\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\r\n\r\n\t\t\t\tconst binding = bindings[ i ];\r\n\r\n\t\t\t\tif ( -- binding.useCount === 0 ) {\r\n\r\n\t\t\t\t\tbinding.restoreOriginalState();\r\n\t\t\t\t\tthis._takeBackBinding( binding );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis._takeBackAction( action );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Memory manager\r\n\r\n\t_initMemoryManager() {\r\n\r\n\t\tthis._actions = []; // 'nActiveActions' followed by inactive ones\r\n\t\tthis._nActiveActions = 0;\r\n\r\n\t\tthis._actionsByClip = {};\r\n\t\t// inside:\r\n\t\t// {\r\n\t\t// \tknownActions: Array< AnimationAction > - used as prototypes\r\n\t\t// \tactionByRoot: AnimationAction - lookup\r\n\t\t// }\r\n\r\n\r\n\t\tthis._bindings = []; // 'nActiveBindings' followed by inactive ones\r\n\t\tthis._nActiveBindings = 0;\r\n\r\n\t\tthis._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer >\r\n\r\n\r\n\t\tthis._controlInterpolants = []; // same game as above\r\n\t\tthis._nActiveControlInterpolants = 0;\r\n\r\n\t\tconst scope = this;\r\n\r\n\t\tthis.stats = {\r\n\r\n\t\t\tactions: {\r\n\t\t\t\tget total() {\r\n\r\n\t\t\t\t\treturn scope._actions.length;\r\n\r\n\t\t\t\t},\r\n\t\t\t\tget inUse() {\r\n\r\n\t\t\t\t\treturn scope._nActiveActions;\r\n\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tbindings: {\r\n\t\t\t\tget total() {\r\n\r\n\t\t\t\t\treturn scope._bindings.length;\r\n\r\n\t\t\t\t},\r\n\t\t\t\tget inUse() {\r\n\r\n\t\t\t\t\treturn scope._nActiveBindings;\r\n\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tcontrolInterpolants: {\r\n\t\t\t\tget total() {\r\n\r\n\t\t\t\t\treturn scope._controlInterpolants.length;\r\n\r\n\t\t\t\t},\r\n\t\t\t\tget inUse() {\r\n\r\n\t\t\t\t\treturn scope._nActiveControlInterpolants;\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t}\r\n\r\n\t// Memory management for AnimationAction objects\r\n\r\n\t_isActiveAction( action ) {\r\n\r\n\t\tconst index = action._cacheIndex;\r\n\t\treturn index !== null && index < this._nActiveActions;\r\n\r\n\t}\r\n\r\n\t_addInactiveAction( action, clipUuid, rootUuid ) {\r\n\r\n\t\tconst actions = this._actions,\r\n\t\t\tactionsByClip = this._actionsByClip;\r\n\r\n\t\tlet actionsForClip = actionsByClip[ clipUuid ];\r\n\r\n\t\tif ( actionsForClip === undefined ) {\r\n\r\n\t\t\tactionsForClip = {\r\n\r\n\t\t\t\tknownActions: [ action ],\r\n\t\t\t\tactionByRoot: {}\r\n\r\n\t\t\t};\r\n\r\n\t\t\taction._byClipCacheIndex = 0;\r\n\r\n\t\t\tactionsByClip[ clipUuid ] = actionsForClip;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst knownActions = actionsForClip.knownActions;\r\n\r\n\t\t\taction._byClipCacheIndex = knownActions.length;\r\n\t\t\tknownActions.push( action );\r\n\r\n\t\t}\r\n\r\n\t\taction._cacheIndex = actions.length;\r\n\t\tactions.push( action );\r\n\r\n\t\tactionsForClip.actionByRoot[ rootUuid ] = action;\r\n\r\n\t}\r\n\r\n\t_removeInactiveAction( action ) {\r\n\r\n\t\tconst actions = this._actions,\r\n\t\t\tlastInactiveAction = actions[ actions.length - 1 ],\r\n\t\t\tcacheIndex = action._cacheIndex;\r\n\r\n\t\tlastInactiveAction._cacheIndex = cacheIndex;\r\n\t\tactions[ cacheIndex ] = lastInactiveAction;\r\n\t\tactions.pop();\r\n\r\n\t\taction._cacheIndex = null;\r\n\r\n\r\n\t\tconst clipUuid = action._clip.uuid,\r\n\t\t\tactionsByClip = this._actionsByClip,\r\n\t\t\tactionsForClip = actionsByClip[ clipUuid ],\r\n\t\t\tknownActionsForClip = actionsForClip.knownActions,\r\n\r\n\t\t\tlastKnownAction =\r\n\t\t\t\tknownActionsForClip[ knownActionsForClip.length - 1 ],\r\n\r\n\t\t\tbyClipCacheIndex = action._byClipCacheIndex;\r\n\r\n\t\tlastKnownAction._byClipCacheIndex = byClipCacheIndex;\r\n\t\tknownActionsForClip[ byClipCacheIndex ] = lastKnownAction;\r\n\t\tknownActionsForClip.pop();\r\n\r\n\t\taction._byClipCacheIndex = null;\r\n\r\n\r\n\t\tconst actionByRoot = actionsForClip.actionByRoot,\r\n\t\t\trootUuid = ( action._localRoot || this._root ).uuid;\r\n\r\n\t\tdelete actionByRoot[ rootUuid ];\r\n\r\n\t\tif ( knownActionsForClip.length === 0 ) {\r\n\r\n\t\t\tdelete actionsByClip[ clipUuid ];\r\n\r\n\t\t}\r\n\r\n\t\tthis._removeInactiveBindingsForAction( action );\r\n\r\n\t}\r\n\r\n\t_removeInactiveBindingsForAction( action ) {\r\n\r\n\t\tconst bindings = action._propertyBindings;\r\n\r\n\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\r\n\r\n\t\t\tconst binding = bindings[ i ];\r\n\r\n\t\t\tif ( -- binding.referenceCount === 0 ) {\r\n\r\n\t\t\t\tthis._removeInactiveBinding( binding );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t_lendAction( action ) {\r\n\r\n\t\t// [ active actions | inactive actions ]\r\n\t\t// [ active actions >| inactive actions ]\r\n\t\t// s a\r\n\t\t// <-swap->\r\n\t\t// a s\r\n\r\n\t\tconst actions = this._actions,\r\n\t\t\tprevIndex = action._cacheIndex,\r\n\r\n\t\t\tlastActiveIndex = this._nActiveActions ++,\r\n\r\n\t\t\tfirstInactiveAction = actions[ lastActiveIndex ];\r\n\r\n\t\taction._cacheIndex = lastActiveIndex;\r\n\t\tactions[ lastActiveIndex ] = action;\r\n\r\n\t\tfirstInactiveAction._cacheIndex = prevIndex;\r\n\t\tactions[ prevIndex ] = firstInactiveAction;\r\n\r\n\t}\r\n\r\n\t_takeBackAction( action ) {\r\n\r\n\t\t// [ active actions | inactive actions ]\r\n\t\t// [ active actions |< inactive actions ]\r\n\t\t// a s\r\n\t\t// <-swap->\r\n\t\t// s a\r\n\r\n\t\tconst actions = this._actions,\r\n\t\t\tprevIndex = action._cacheIndex,\r\n\r\n\t\t\tfirstInactiveIndex = -- this._nActiveActions,\r\n\r\n\t\t\tlastActiveAction = actions[ firstInactiveIndex ];\r\n\r\n\t\taction._cacheIndex = firstInactiveIndex;\r\n\t\tactions[ firstInactiveIndex ] = action;\r\n\r\n\t\tlastActiveAction._cacheIndex = prevIndex;\r\n\t\tactions[ prevIndex ] = lastActiveAction;\r\n\r\n\t}\r\n\r\n\t// Memory management for PropertyMixer objects\r\n\r\n\t_addInactiveBinding( binding, rootUuid, trackName ) {\r\n\r\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\r\n\t\t\tbindings = this._bindings;\r\n\r\n\t\tlet bindingByName = bindingsByRoot[ rootUuid ];\r\n\r\n\t\tif ( bindingByName === undefined ) {\r\n\r\n\t\t\tbindingByName = {};\r\n\t\t\tbindingsByRoot[ rootUuid ] = bindingByName;\r\n\r\n\t\t}\r\n\r\n\t\tbindingByName[ trackName ] = binding;\r\n\r\n\t\tbinding._cacheIndex = bindings.length;\r\n\t\tbindings.push( binding );\r\n\r\n\t}\r\n\r\n\t_removeInactiveBinding( binding ) {\r\n\r\n\t\tconst bindings = this._bindings,\r\n\t\t\tpropBinding = binding.binding,\r\n\t\t\trootUuid = propBinding.rootNode.uuid,\r\n\t\t\ttrackName = propBinding.path,\r\n\t\t\tbindingsByRoot = this._bindingsByRootAndName,\r\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ],\r\n\r\n\t\t\tlastInactiveBinding = bindings[ bindings.length - 1 ],\r\n\t\t\tcacheIndex = binding._cacheIndex;\r\n\r\n\t\tlastInactiveBinding._cacheIndex = cacheIndex;\r\n\t\tbindings[ cacheIndex ] = lastInactiveBinding;\r\n\t\tbindings.pop();\r\n\r\n\t\tdelete bindingByName[ trackName ];\r\n\r\n\t\tif ( Object.keys( bindingByName ).length === 0 ) {\r\n\r\n\t\t\tdelete bindingsByRoot[ rootUuid ];\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t_lendBinding( binding ) {\r\n\r\n\t\tconst bindings = this._bindings,\r\n\t\t\tprevIndex = binding._cacheIndex,\r\n\r\n\t\t\tlastActiveIndex = this._nActiveBindings ++,\r\n\r\n\t\t\tfirstInactiveBinding = bindings[ lastActiveIndex ];\r\n\r\n\t\tbinding._cacheIndex = lastActiveIndex;\r\n\t\tbindings[ lastActiveIndex ] = binding;\r\n\r\n\t\tfirstInactiveBinding._cacheIndex = prevIndex;\r\n\t\tbindings[ prevIndex ] = firstInactiveBinding;\r\n\r\n\t}\r\n\r\n\t_takeBackBinding( binding ) {\r\n\r\n\t\tconst bindings = this._bindings,\r\n\t\t\tprevIndex = binding._cacheIndex,\r\n\r\n\t\t\tfirstInactiveIndex = -- this._nActiveBindings,\r\n\r\n\t\t\tlastActiveBinding = bindings[ firstInactiveIndex ];\r\n\r\n\t\tbinding._cacheIndex = firstInactiveIndex;\r\n\t\tbindings[ firstInactiveIndex ] = binding;\r\n\r\n\t\tlastActiveBinding._cacheIndex = prevIndex;\r\n\t\tbindings[ prevIndex ] = lastActiveBinding;\r\n\r\n\t}\r\n\r\n\r\n\t// Memory management of Interpolants for weight and time scale\r\n\r\n\t_lendControlInterpolant() {\r\n\r\n\t\tconst interpolants = this._controlInterpolants,\r\n\t\t\tlastActiveIndex = this._nActiveControlInterpolants ++;\r\n\r\n\t\tlet interpolant = interpolants[ lastActiveIndex ];\r\n\r\n\t\tif ( interpolant === undefined ) {\r\n\r\n\t\t\tinterpolant = new LinearInterpolant(\r\n\t\t\t\tnew Float32Array( 2 ), new Float32Array( 2 ),\r\n\t\t\t\t1, _controlInterpolantsResultBuffer );\r\n\r\n\t\t\tinterpolant.__cacheIndex = lastActiveIndex;\r\n\t\t\tinterpolants[ lastActiveIndex ] = interpolant;\r\n\r\n\t\t}\r\n\r\n\t\treturn interpolant;\r\n\r\n\t}\r\n\r\n\t_takeBackControlInterpolant( interpolant ) {\r\n\r\n\t\tconst interpolants = this._controlInterpolants,\r\n\t\t\tprevIndex = interpolant.__cacheIndex,\r\n\r\n\t\t\tfirstInactiveIndex = -- this._nActiveControlInterpolants,\r\n\r\n\t\t\tlastActiveInterpolant = interpolants[ firstInactiveIndex ];\r\n\r\n\t\tinterpolant.__cacheIndex = firstInactiveIndex;\r\n\t\tinterpolants[ firstInactiveIndex ] = interpolant;\r\n\r\n\t\tlastActiveInterpolant.__cacheIndex = prevIndex;\r\n\t\tinterpolants[ prevIndex ] = lastActiveInterpolant;\r\n\r\n\t}\r\n\r\n\t// return an action for a clip optionally using a custom root target\r\n\t// object (this method allocates a lot of dynamic memory in case a\r\n\t// previously unknown clip/root combination is specified)\r\n\tclipAction( clip, optionalRoot, blendMode ) {\r\n\r\n\t\tconst root = optionalRoot || this._root,\r\n\t\t\trootUuid = root.uuid;\r\n\r\n\t\tlet clipObject = typeof clip === 'string' ? AnimationClip.findByName( root, clip ) : clip;\r\n\r\n\t\tconst clipUuid = clipObject !== null ? clipObject.uuid : clip;\r\n\r\n\t\tconst actionsForClip = this._actionsByClip[ clipUuid ];\r\n\t\tlet prototypeAction = null;\r\n\r\n\t\tif ( blendMode === undefined ) {\r\n\r\n\t\t\tif ( clipObject !== null ) {\r\n\r\n\t\t\t\tblendMode = clipObject.blendMode;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tblendMode = NormalAnimationBlendMode;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( actionsForClip !== undefined ) {\r\n\r\n\t\t\tconst existingAction = actionsForClip.actionByRoot[ rootUuid ];\r\n\r\n\t\t\tif ( existingAction !== undefined && existingAction.blendMode === blendMode ) {\r\n\r\n\t\t\t\treturn existingAction;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// we know the clip, so we don't have to parse all\r\n\t\t\t// the bindings again but can just copy\r\n\t\t\tprototypeAction = actionsForClip.knownActions[ 0 ];\r\n\r\n\t\t\t// also, take the clip from the prototype action\r\n\t\t\tif ( clipObject === null )\r\n\t\t\t\tclipObject = prototypeAction._clip;\r\n\r\n\t\t}\r\n\r\n\t\t// clip must be known when specified via string\r\n\t\tif ( clipObject === null ) return null;\r\n\r\n\t\t// allocate all resources required to run it\r\n\t\tconst newAction = new AnimationAction( this, clipObject, optionalRoot, blendMode );\r\n\r\n\t\tthis._bindAction( newAction, prototypeAction );\r\n\r\n\t\t// and make the action known to the memory manager\r\n\t\tthis._addInactiveAction( newAction, clipUuid, rootUuid );\r\n\r\n\t\treturn newAction;\r\n\r\n\t}\r\n\r\n\t// get an existing action\r\n\texistingAction( clip, optionalRoot ) {\r\n\r\n\t\tconst root = optionalRoot || this._root,\r\n\t\t\trootUuid = root.uuid,\r\n\r\n\t\t\tclipObject = typeof clip === 'string' ?\r\n\t\t\t\tAnimationClip.findByName( root, clip ) : clip,\r\n\r\n\t\t\tclipUuid = clipObject ? clipObject.uuid : clip,\r\n\r\n\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\r\n\r\n\t\tif ( actionsForClip !== undefined ) {\r\n\r\n\t\t\treturn actionsForClip.actionByRoot[ rootUuid ] || null;\r\n\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\r\n\t}\r\n\r\n\t// deactivates all previously scheduled actions\r\n\tstopAllAction() {\r\n\r\n\t\tconst actions = this._actions,\r\n\t\t\tnActions = this._nActiveActions;\r\n\r\n\t\tfor ( let i = nActions - 1; i >= 0; -- i ) {\r\n\r\n\t\t\tactions[ i ].stop();\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t// advance the time and update apply the animation\r\n\tupdate( deltaTime ) {\r\n\r\n\t\tdeltaTime *= this.timeScale;\r\n\r\n\t\tconst actions = this._actions,\r\n\t\t\tnActions = this._nActiveActions,\r\n\r\n\t\t\ttime = this.time += deltaTime,\r\n\t\t\ttimeDirection = Math.sign( deltaTime ),\r\n\r\n\t\t\taccuIndex = this._accuIndex ^= 1;\r\n\r\n\t\t// run active actions\r\n\r\n\t\tfor ( let i = 0; i !== nActions; ++ i ) {\r\n\r\n\t\t\tconst action = actions[ i ];\r\n\r\n\t\t\taction._update( time, deltaTime, timeDirection, accuIndex );\r\n\r\n\t\t}\r\n\r\n\t\t// update scene graph\r\n\r\n\t\tconst bindings = this._bindings,\r\n\t\t\tnBindings = this._nActiveBindings;\r\n\r\n\t\tfor ( let i = 0; i !== nBindings; ++ i ) {\r\n\r\n\t\t\tbindings[ i ].apply( accuIndex );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t// Allows you to seek to a specific time in an animation.\r\n\tsetTime( timeInSeconds ) {\r\n\r\n\t\tthis.time = 0; // Zero out time attribute for AnimationMixer object;\r\n\t\tfor ( let i = 0; i < this._actions.length; i ++ ) {\r\n\r\n\t\t\tthis._actions[ i ].time = 0; // Zero out time attribute for all associated AnimationAction objects.\r\n\r\n\t\t}\r\n\r\n\t\treturn this.update( timeInSeconds ); // Update used to set exact time. Returns \"this\" AnimationMixer object.\r\n\r\n\t}\r\n\r\n\t// return this mixer's root target object\r\n\tgetRoot() {\r\n\r\n\t\treturn this._root;\r\n\r\n\t}\r\n\r\n\t// free all resources specific to a particular clip\r\n\tuncacheClip( clip ) {\r\n\r\n\t\tconst actions = this._actions,\r\n\t\t\tclipUuid = clip.uuid,\r\n\t\t\tactionsByClip = this._actionsByClip,\r\n\t\t\tactionsForClip = actionsByClip[ clipUuid ];\r\n\r\n\t\tif ( actionsForClip !== undefined ) {\r\n\r\n\t\t\t// note: just calling _removeInactiveAction would mess up the\r\n\t\t\t// iteration state and also require updating the state we can\r\n\t\t\t// just throw away\r\n\r\n\t\t\tconst actionsToRemove = actionsForClip.knownActions;\r\n\r\n\t\t\tfor ( let i = 0, n = actionsToRemove.length; i !== n; ++ i ) {\r\n\r\n\t\t\t\tconst action = actionsToRemove[ i ];\r\n\r\n\t\t\t\tthis._deactivateAction( action );\r\n\r\n\t\t\t\tconst cacheIndex = action._cacheIndex,\r\n\t\t\t\t\tlastInactiveAction = actions[ actions.length - 1 ];\r\n\r\n\t\t\t\taction._cacheIndex = null;\r\n\t\t\t\taction._byClipCacheIndex = null;\r\n\r\n\t\t\t\tlastInactiveAction._cacheIndex = cacheIndex;\r\n\t\t\t\tactions[ cacheIndex ] = lastInactiveAction;\r\n\t\t\t\tactions.pop();\r\n\r\n\t\t\t\tthis._removeInactiveBindingsForAction( action );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdelete actionsByClip[ clipUuid ];\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// free all resources specific to a particular root target object\r\n\tuncacheRoot( root ) {\r\n\r\n\t\tconst rootUuid = root.uuid,\r\n\t\t\tactionsByClip = this._actionsByClip;\r\n\r\n\t\tfor ( const clipUuid in actionsByClip ) {\r\n\r\n\t\t\tconst actionByRoot = actionsByClip[ clipUuid ].actionByRoot,\r\n\t\t\t\taction = actionByRoot[ rootUuid ];\r\n\r\n\t\t\tif ( action !== undefined ) {\r\n\r\n\t\t\t\tthis._deactivateAction( action );\r\n\t\t\t\tthis._removeInactiveAction( action );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\r\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ];\r\n\r\n\t\tif ( bindingByName !== undefined ) {\r\n\r\n\t\t\tfor ( const trackName in bindingByName ) {\r\n\r\n\t\t\t\tconst binding = bindingByName[ trackName ];\r\n\t\t\t\tbinding.restoreOriginalState();\r\n\t\t\t\tthis._removeInactiveBinding( binding );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// remove a targeted clip from the cache\r\n\tuncacheAction( clip, optionalRoot ) {\r\n\r\n\t\tconst action = this.existingAction( clip, optionalRoot );\r\n\r\n\t\tif ( action !== null ) {\r\n\r\n\t\t\tthis._deactivateAction( action );\r\n\t\t\tthis._removeInactiveAction( action );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Uniform {\r\n\r\n\tconstructor( value ) {\r\n\r\n\t\tthis.value = value;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new Uniform( this.value.clone === undefined ? this.value : this.value.clone() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nlet _id = 0;\r\n\r\nclass UniformsGroup extends EventDispatcher {\r\n\r\n\tconstructor() {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.isUniformsGroup = true;\r\n\r\n\t\tObject.defineProperty( this, 'id', { value: _id ++ } );\r\n\r\n\t\tthis.name = '';\r\n\r\n\t\tthis.usage = StaticDrawUsage;\r\n\t\tthis.uniforms = [];\r\n\r\n\t}\r\n\r\n\tadd( uniform ) {\r\n\r\n\t\tthis.uniforms.push( uniform );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tremove( uniform ) {\r\n\r\n\t\tconst index = this.uniforms.indexOf( uniform );\r\n\r\n\t\tif ( index !== - 1 ) this.uniforms.splice( index, 1 );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetName( name ) {\r\n\r\n\t\tthis.name = name;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetUsage( value ) {\r\n\r\n\t\tthis.usage = value;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.dispatchEvent( { type: 'dispose' } );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tthis.name = source.name;\r\n\t\tthis.usage = source.usage;\r\n\r\n\t\tconst uniformsSource = source.uniforms;\r\n\r\n\t\tthis.uniforms.length = 0;\r\n\r\n\t\tfor ( let i = 0, l = uniformsSource.length; i < l; i ++ ) {\r\n\r\n\t\t\tconst uniforms = Array.isArray( uniformsSource[ i ] ) ? uniformsSource[ i ] : [ uniformsSource[ i ] ];\r\n\r\n\t\t\tfor ( let j = 0; j < uniforms.length; j ++ ) {\r\n\r\n\t\t\t\tthis.uniforms.push( uniforms[ j ].clone() );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass InstancedInterleavedBuffer extends InterleavedBuffer {\r\n\r\n\tconstructor( array, stride, meshPerAttribute = 1 ) {\r\n\r\n\t\tsuper( array, stride );\r\n\r\n\t\tthis.isInstancedInterleavedBuffer = true;\r\n\r\n\t\tthis.meshPerAttribute = meshPerAttribute;\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source );\r\n\r\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclone( data ) {\r\n\r\n\t\tconst ib = super.clone( data );\r\n\r\n\t\tib.meshPerAttribute = this.meshPerAttribute;\r\n\r\n\t\treturn ib;\r\n\r\n\t}\r\n\r\n\ttoJSON( data ) {\r\n\r\n\t\tconst json = super.toJSON( data );\r\n\r\n\t\tjson.isInstancedInterleavedBuffer = true;\r\n\t\tjson.meshPerAttribute = this.meshPerAttribute;\r\n\r\n\t\treturn json;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass GLBufferAttribute {\r\n\r\n\tconstructor( buffer, type, itemSize, elementSize, count ) {\r\n\r\n\t\tthis.isGLBufferAttribute = true;\r\n\r\n\t\tthis.name = '';\r\n\r\n\t\tthis.buffer = buffer;\r\n\t\tthis.type = type;\r\n\t\tthis.itemSize = itemSize;\r\n\t\tthis.elementSize = elementSize;\r\n\t\tthis.count = count;\r\n\r\n\t\tthis.version = 0;\r\n\r\n\t}\r\n\r\n\tset needsUpdate( value ) {\r\n\r\n\t\tif ( value === true ) this.version ++;\r\n\r\n\t}\r\n\r\n\tsetBuffer( buffer ) {\r\n\r\n\t\tthis.buffer = buffer;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetType( type, elementSize ) {\r\n\r\n\t\tthis.type = type;\r\n\t\tthis.elementSize = elementSize;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetItemSize( itemSize ) {\r\n\r\n\t\tthis.itemSize = itemSize;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetCount( count ) {\r\n\r\n\t\tthis.count = count;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _matrix = /*@__PURE__*/ new Matrix4();\r\n\r\nclass Raycaster {\r\n\r\n\tconstructor( origin, direction, near = 0, far = Infinity ) {\r\n\r\n\t\tthis.ray = new Ray( origin, direction );\r\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\r\n\r\n\t\tthis.near = near;\r\n\t\tthis.far = far;\r\n\t\tthis.camera = null;\r\n\t\tthis.layers = new Layers();\r\n\r\n\t\tthis.params = {\r\n\t\t\tMesh: {},\r\n\t\t\tLine: { threshold: 1 },\r\n\t\t\tLOD: {},\r\n\t\t\tPoints: { threshold: 1 },\r\n\t\t\tSprite: {}\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tset( origin, direction ) {\r\n\r\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\r\n\r\n\t\tthis.ray.set( origin, direction );\r\n\r\n\t}\r\n\r\n\tsetFromCamera( coords, camera ) {\r\n\r\n\t\tif ( camera.isPerspectiveCamera ) {\r\n\r\n\t\t\tthis.ray.origin.setFromMatrixPosition( camera.matrixWorld );\r\n\t\t\tthis.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize();\r\n\t\t\tthis.camera = camera;\r\n\r\n\t\t} else if ( camera.isOrthographicCamera ) {\r\n\r\n\t\t\tthis.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera\r\n\t\t\tthis.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );\r\n\t\t\tthis.camera = camera;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconsole.error( 'THREE.Raycaster: Unsupported camera type: ' + camera.type );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tsetFromXRController( controller ) {\r\n\r\n\t\t_matrix.identity().extractRotation( controller.matrixWorld );\r\n\r\n\t\tthis.ray.origin.setFromMatrixPosition( controller.matrixWorld );\r\n\t\tthis.ray.direction.set( 0, 0, - 1 ).applyMatrix4( _matrix );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tintersectObject( object, recursive = true, intersects = [] ) {\r\n\r\n\t\tintersect( object, this, intersects, recursive );\r\n\r\n\t\tintersects.sort( ascSort );\r\n\r\n\t\treturn intersects;\r\n\r\n\t}\r\n\r\n\tintersectObjects( objects, recursive = true, intersects = [] ) {\r\n\r\n\t\tfor ( let i = 0, l = objects.length; i < l; i ++ ) {\r\n\r\n\t\t\tintersect( objects[ i ], this, intersects, recursive );\r\n\r\n\t\t}\r\n\r\n\t\tintersects.sort( ascSort );\r\n\r\n\t\treturn intersects;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction ascSort( a, b ) {\r\n\r\n\treturn a.distance - b.distance;\r\n\r\n}\r\n\r\nfunction intersect( object, raycaster, intersects, recursive ) {\r\n\r\n\tlet propagate = true;\r\n\r\n\tif ( object.layers.test( raycaster.layers ) ) {\r\n\r\n\t\tconst result = object.raycast( raycaster, intersects );\r\n\r\n\t\tif ( result === false ) propagate = false;\r\n\r\n\t}\r\n\r\n\tif ( propagate === true && recursive === true ) {\r\n\r\n\t\tconst children = object.children;\r\n\r\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\r\n\r\n\t\t\tintersect( children[ i ], raycaster, intersects, true );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system\r\n *\r\n * phi (the polar angle) is measured from the positive y-axis. The positive y-axis is up.\r\n * theta (the azimuthal angle) is measured from the positive z-axis.\r\n */\r\nclass Spherical {\r\n\r\n\tconstructor( radius = 1, phi = 0, theta = 0 ) {\r\n\r\n\t\tthis.radius = radius;\r\n\t\tthis.phi = phi; // polar angle\r\n\t\tthis.theta = theta; // azimuthal angle\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tset( radius, phi, theta ) {\r\n\r\n\t\tthis.radius = radius;\r\n\t\tthis.phi = phi;\r\n\t\tthis.theta = theta;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcopy( other ) {\r\n\r\n\t\tthis.radius = other.radius;\r\n\t\tthis.phi = other.phi;\r\n\t\tthis.theta = other.theta;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\t// restrict phi to be between EPS and PI-EPS\r\n\tmakeSafe() {\r\n\r\n\t\tconst EPS = 0.000001;\r\n\t\tthis.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromVector3( v ) {\r\n\r\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\r\n\r\n\t}\r\n\r\n\tsetFromCartesianCoords( x, y, z ) {\r\n\r\n\t\tthis.radius = Math.sqrt( x * x + y * y + z * z );\r\n\r\n\t\tif ( this.radius === 0 ) {\r\n\r\n\t\t\tthis.theta = 0;\r\n\t\t\tthis.phi = 0;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.theta = Math.atan2( x, z );\r\n\t\t\tthis.phi = Math.acos( clamp( y / this.radius, - 1, 1 ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system\r\n */\r\n\r\nclass Cylindrical {\r\n\r\n\tconstructor( radius = 1, theta = 0, y = 0 ) {\r\n\r\n\t\tthis.radius = radius; // distance from the origin to a point in the x-z plane\r\n\t\tthis.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis\r\n\t\tthis.y = y; // height above the x-z plane\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tset( radius, theta, y ) {\r\n\r\n\t\tthis.radius = radius;\r\n\t\tthis.theta = theta;\r\n\t\tthis.y = y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcopy( other ) {\r\n\r\n\t\tthis.radius = other.radius;\r\n\t\tthis.theta = other.theta;\r\n\t\tthis.y = other.y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromVector3( v ) {\r\n\r\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\r\n\r\n\t}\r\n\r\n\tsetFromCartesianCoords( x, y, z ) {\r\n\r\n\t\tthis.radius = Math.sqrt( x * x + z * z );\r\n\t\tthis.theta = Math.atan2( x, z );\r\n\t\tthis.y = y;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Matrix2 {\r\n\r\n\tconstructor( n11, n12, n21, n22 ) {\r\n\r\n\t\tMatrix2.prototype.isMatrix2 = true;\r\n\r\n\t\tthis.elements = [\r\n\t\t\t1, 0,\r\n\t\t\t0, 1,\r\n\t\t];\r\n\r\n\t\tif ( n11 !== undefined ) {\r\n\r\n\t\t\tthis.set( n11, n12, n21, n22 );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tidentity() {\r\n\r\n\t\tthis.set(\r\n\t\t\t1, 0,\r\n\t\t\t0, 1,\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tfromArray( array, offset = 0 ) {\r\n\r\n\t\tfor ( let i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\tthis.elements[ i ] = array[ i + offset ];\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tset( n11, n12, n21, n22 ) {\r\n\r\n\t\tconst te = this.elements;\r\n\r\n\t\tte[ 0 ] = n11; te[ 2 ] = n12;\r\n\t\tte[ 1 ] = n21; te[ 3 ] = n22;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _vector$4 = /*@__PURE__*/ new Vector2();\r\n\r\nclass Box2 {\r\n\r\n\tconstructor( min = new Vector2( + Infinity, + Infinity ), max = new Vector2( - Infinity, - Infinity ) ) {\r\n\r\n\t\tthis.isBox2 = true;\r\n\r\n\t\tthis.min = min;\r\n\t\tthis.max = max;\r\n\r\n\t}\r\n\r\n\tset( min, max ) {\r\n\r\n\t\tthis.min.copy( min );\r\n\t\tthis.max.copy( max );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromPoints( points ) {\r\n\r\n\t\tthis.makeEmpty();\r\n\r\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\r\n\r\n\t\t\tthis.expandByPoint( points[ i ] );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsetFromCenterAndSize( center, size ) {\r\n\r\n\t\tconst halfSize = _vector$4.copy( size ).multiplyScalar( 0.5 );\r\n\t\tthis.min.copy( center ).sub( halfSize );\r\n\t\tthis.max.copy( center ).add( halfSize );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n\tcopy( box ) {\r\n\r\n\t\tthis.min.copy( box.min );\r\n\t\tthis.max.copy( box.max );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tmakeEmpty() {\r\n\r\n\t\tthis.min.x = this.min.y = + Infinity;\r\n\t\tthis.max.x = this.max.y = - Infinity;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tisEmpty() {\r\n\r\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\r\n\r\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y );\r\n\r\n\t}\r\n\r\n\tgetCenter( target ) {\r\n\r\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\r\n\r\n\t}\r\n\r\n\tgetSize( target ) {\r\n\r\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.subVectors( this.max, this.min );\r\n\r\n\t}\r\n\r\n\texpandByPoint( point ) {\r\n\r\n\t\tthis.min.min( point );\r\n\t\tthis.max.max( point );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\texpandByVector( vector ) {\r\n\r\n\t\tthis.min.sub( vector );\r\n\t\tthis.max.add( vector );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\texpandByScalar( scalar ) {\r\n\r\n\t\tthis.min.addScalar( - scalar );\r\n\t\tthis.max.addScalar( scalar );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcontainsPoint( point ) {\r\n\r\n\t\treturn point.x >= this.min.x && point.x <= this.max.x &&\r\n\t\t\tpoint.y >= this.min.y && point.y <= this.max.y;\r\n\r\n\t}\r\n\r\n\tcontainsBox( box ) {\r\n\r\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\r\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y;\r\n\r\n\t}\r\n\r\n\tgetParameter( point, target ) {\r\n\r\n\t\t// This can potentially have a divide by zero if the box\r\n\t\t// has a size dimension of 0.\r\n\r\n\t\treturn target.set(\r\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\r\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y )\r\n\t\t);\r\n\r\n\t}\r\n\r\n\tintersectsBox( box ) {\r\n\r\n\t\t// using 4 splitting planes to rule out intersections\r\n\r\n\t\treturn box.max.x >= this.min.x && box.min.x <= this.max.x &&\r\n\t\t\tbox.max.y >= this.min.y && box.min.y <= this.max.y;\r\n\r\n\t}\r\n\r\n\tclampPoint( point, target ) {\r\n\r\n\t\treturn target.copy( point ).clamp( this.min, this.max );\r\n\r\n\t}\r\n\r\n\tdistanceToPoint( point ) {\r\n\r\n\t\treturn this.clampPoint( point, _vector$4 ).distanceTo( point );\r\n\r\n\t}\r\n\r\n\tintersect( box ) {\r\n\r\n\t\tthis.min.max( box.min );\r\n\t\tthis.max.min( box.max );\r\n\r\n\t\tif ( this.isEmpty() ) this.makeEmpty();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tunion( box ) {\r\n\r\n\t\tthis.min.min( box.min );\r\n\t\tthis.max.max( box.max );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttranslate( offset ) {\r\n\r\n\t\tthis.min.add( offset );\r\n\t\tthis.max.add( offset );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tequals( box ) {\r\n\r\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _startP = /*@__PURE__*/ new Vector3();\r\nconst _startEnd = /*@__PURE__*/ new Vector3();\r\n\r\nclass Line3 {\r\n\r\n\tconstructor( start = new Vector3(), end = new Vector3() ) {\r\n\r\n\t\tthis.start = start;\r\n\t\tthis.end = end;\r\n\r\n\t}\r\n\r\n\tset( start, end ) {\r\n\r\n\t\tthis.start.copy( start );\r\n\t\tthis.end.copy( end );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcopy( line ) {\r\n\r\n\t\tthis.start.copy( line.start );\r\n\t\tthis.end.copy( line.end );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tgetCenter( target ) {\r\n\r\n\t\treturn target.addVectors( this.start, this.end ).multiplyScalar( 0.5 );\r\n\r\n\t}\r\n\r\n\tdelta( target ) {\r\n\r\n\t\treturn target.subVectors( this.end, this.start );\r\n\r\n\t}\r\n\r\n\tdistanceSq() {\r\n\r\n\t\treturn this.start.distanceToSquared( this.end );\r\n\r\n\t}\r\n\r\n\tdistance() {\r\n\r\n\t\treturn this.start.distanceTo( this.end );\r\n\r\n\t}\r\n\r\n\tat( t, target ) {\r\n\r\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\r\n\r\n\t}\r\n\r\n\tclosestPointToPointParameter( point, clampToLine ) {\r\n\r\n\t\t_startP.subVectors( point, this.start );\r\n\t\t_startEnd.subVectors( this.end, this.start );\r\n\r\n\t\tconst startEnd2 = _startEnd.dot( _startEnd );\r\n\t\tconst startEnd_startP = _startEnd.dot( _startP );\r\n\r\n\t\tlet t = startEnd_startP / startEnd2;\r\n\r\n\t\tif ( clampToLine ) {\r\n\r\n\t\t\tt = clamp( t, 0, 1 );\r\n\r\n\t\t}\r\n\r\n\t\treturn t;\r\n\r\n\t}\r\n\r\n\tclosestPointToPoint( point, clampToLine, target ) {\r\n\r\n\t\tconst t = this.closestPointToPointParameter( point, clampToLine );\r\n\r\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\r\n\r\n\t}\r\n\r\n\tapplyMatrix4( matrix ) {\r\n\r\n\t\tthis.start.applyMatrix4( matrix );\r\n\t\tthis.end.applyMatrix4( matrix );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tequals( line ) {\r\n\r\n\t\treturn line.start.equals( this.start ) && line.end.equals( this.end );\r\n\r\n\t}\r\n\r\n\tclone() {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _vector$3 = /*@__PURE__*/ new Vector3();\r\n\r\nclass SpotLightHelper extends Object3D {\r\n\r\n\tconstructor( light, color ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.light = light;\r\n\r\n\t\tthis.matrixAutoUpdate = false;\r\n\r\n\t\tthis.color = color;\r\n\r\n\t\tthis.type = 'SpotLightHelper';\r\n\r\n\t\tconst geometry = new BufferGeometry();\r\n\r\n\t\tconst positions = [\r\n\t\t\t0, 0, 0, \t0, 0, 1,\r\n\t\t\t0, 0, 0, \t1, 0, 1,\r\n\t\t\t0, 0, 0,\t- 1, 0, 1,\r\n\t\t\t0, 0, 0, \t0, 1, 1,\r\n\t\t\t0, 0, 0, \t0, - 1, 1\r\n\t\t];\r\n\r\n\t\tfor ( let i = 0, j = 1, l = 32; i < l; i ++, j ++ ) {\r\n\r\n\t\t\tconst p1 = ( i / l ) * Math.PI * 2;\r\n\t\t\tconst p2 = ( j / l ) * Math.PI * 2;\r\n\r\n\t\t\tpositions.push(\r\n\t\t\t\tMath.cos( p1 ), Math.sin( p1 ), 1,\r\n\t\t\t\tMath.cos( p2 ), Math.sin( p2 ), 1\r\n\t\t\t);\r\n\r\n\t\t}\r\n\r\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\r\n\r\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\r\n\r\n\t\tthis.cone = new LineSegments( geometry, material );\r\n\t\tthis.add( this.cone );\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.cone.geometry.dispose();\r\n\t\tthis.cone.material.dispose();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tthis.light.updateWorldMatrix( true, false );\r\n\t\tthis.light.target.updateWorldMatrix( true, false );\r\n\r\n\t\t// update the local matrix based on the parent and light target transforms\r\n\t\tif ( this.parent ) {\r\n\r\n\t\t\tthis.parent.updateWorldMatrix( true );\r\n\r\n\t\t\tthis.matrix\r\n\t\t\t\t.copy( this.parent.matrixWorld )\r\n\t\t\t\t.invert()\r\n\t\t\t\t.multiply( this.light.matrixWorld );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.matrix.copy( this.light.matrixWorld );\r\n\r\n\t\t}\r\n\r\n\t\tthis.matrixWorld.copy( this.light.matrixWorld );\r\n\r\n\t\tconst coneLength = this.light.distance ? this.light.distance : 1000;\r\n\t\tconst coneWidth = coneLength * Math.tan( this.light.angle );\r\n\r\n\t\tthis.cone.scale.set( coneWidth, coneWidth, coneLength );\r\n\r\n\t\t_vector$3.setFromMatrixPosition( this.light.target.matrixWorld );\r\n\r\n\t\tthis.cone.lookAt( _vector$3 );\r\n\r\n\t\tif ( this.color !== undefined ) {\r\n\r\n\t\t\tthis.cone.material.color.set( this.color );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.cone.material.color.copy( this.light.color );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _vector$2 = /*@__PURE__*/ new Vector3();\r\nconst _boneMatrix = /*@__PURE__*/ new Matrix4();\r\nconst _matrixWorldInv = /*@__PURE__*/ new Matrix4();\r\n\r\n\r\nclass SkeletonHelper extends LineSegments {\r\n\r\n\tconstructor( object ) {\r\n\r\n\t\tconst bones = getBoneList( object );\r\n\r\n\t\tconst geometry = new BufferGeometry();\r\n\r\n\t\tconst vertices = [];\r\n\t\tconst colors = [];\r\n\r\n\t\tconst color1 = new Color( 0, 0, 1 );\r\n\t\tconst color2 = new Color( 0, 1, 0 );\r\n\r\n\t\tfor ( let i = 0; i < bones.length; i ++ ) {\r\n\r\n\t\t\tconst bone = bones[ i ];\r\n\r\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\r\n\r\n\t\t\t\tvertices.push( 0, 0, 0 );\r\n\t\t\t\tvertices.push( 0, 0, 0 );\r\n\t\t\t\tcolors.push( color1.r, color1.g, color1.b );\r\n\t\t\t\tcolors.push( color2.r, color2.g, color2.b );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\r\n\r\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true } );\r\n\r\n\t\tsuper( geometry, material );\r\n\r\n\t\tthis.isSkeletonHelper = true;\r\n\r\n\t\tthis.type = 'SkeletonHelper';\r\n\r\n\t\tthis.root = object;\r\n\t\tthis.bones = bones;\r\n\r\n\t\tthis.matrix = object.matrixWorld;\r\n\t\tthis.matrixAutoUpdate = false;\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( force ) {\r\n\r\n\t\tconst bones = this.bones;\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\r\n\t\t_matrixWorldInv.copy( this.root.matrixWorld ).invert();\r\n\r\n\t\tfor ( let i = 0, j = 0; i < bones.length; i ++ ) {\r\n\r\n\t\t\tconst bone = bones[ i ];\r\n\r\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\r\n\r\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.matrixWorld );\r\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\r\n\t\t\t\tposition.setXYZ( j, _vector$2.x, _vector$2.y, _vector$2.z );\r\n\r\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.parent.matrixWorld );\r\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\r\n\t\t\t\tposition.setXYZ( j + 1, _vector$2.x, _vector$2.y, _vector$2.z );\r\n\r\n\t\t\t\tj += 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\r\n\r\n\t\tsuper.updateMatrixWorld( force );\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.geometry.dispose();\r\n\t\tthis.material.dispose();\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nfunction getBoneList( object ) {\r\n\r\n\tconst boneList = [];\r\n\r\n\tif ( object.isBone === true ) {\r\n\r\n\t\tboneList.push( object );\r\n\r\n\t}\r\n\r\n\tfor ( let i = 0; i < object.children.length; i ++ ) {\r\n\r\n\t\tboneList.push.apply( boneList, getBoneList( object.children[ i ] ) );\r\n\r\n\t}\r\n\r\n\treturn boneList;\r\n\r\n}\r\n\r\nclass PointLightHelper extends Mesh {\r\n\r\n\tconstructor( light, sphereSize, color ) {\r\n\r\n\t\tconst geometry = new SphereGeometry( sphereSize, 4, 2 );\r\n\t\tconst material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\r\n\r\n\t\tsuper( geometry, material );\r\n\r\n\t\tthis.light = light;\r\n\r\n\t\tthis.color = color;\r\n\r\n\t\tthis.type = 'PointLightHelper';\r\n\r\n\t\tthis.matrix = this.light.matrixWorld;\r\n\t\tthis.matrixAutoUpdate = false;\r\n\r\n\t\tthis.update();\r\n\r\n\r\n\t\t/*\r\n\t// TODO: delete this comment?\r\n\tconst distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );\r\n\tconst distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );\r\n\r\n\tthis.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );\r\n\tthis.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );\r\n\r\n\tconst d = light.distance;\r\n\r\n\tif ( d === 0.0 ) {\r\n\r\n\t\tthis.lightDistance.visible = false;\r\n\r\n\t} else {\r\n\r\n\t\tthis.lightDistance.scale.set( d, d, d );\r\n\r\n\t}\r\n\r\n\tthis.add( this.lightDistance );\r\n\t*/\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.geometry.dispose();\r\n\t\tthis.material.dispose();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tthis.light.updateWorldMatrix( true, false );\r\n\r\n\t\tif ( this.color !== undefined ) {\r\n\r\n\t\t\tthis.material.color.set( this.color );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.material.color.copy( this.light.color );\r\n\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\tconst d = this.light.distance;\r\n\r\n\t\tif ( d === 0.0 ) {\r\n\r\n\t\t\tthis.lightDistance.visible = false;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.lightDistance.visible = true;\r\n\t\t\tthis.lightDistance.scale.set( d, d, d );\r\n\r\n\t\t}\r\n\t\t*/\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _vector$1 = /*@__PURE__*/ new Vector3();\r\nconst _color1 = /*@__PURE__*/ new Color();\r\nconst _color2 = /*@__PURE__*/ new Color();\r\n\r\nclass HemisphereLightHelper extends Object3D {\r\n\r\n\tconstructor( light, size, color ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.light = light;\r\n\r\n\t\tthis.matrix = light.matrixWorld;\r\n\t\tthis.matrixAutoUpdate = false;\r\n\r\n\t\tthis.color = color;\r\n\r\n\t\tthis.type = 'HemisphereLightHelper';\r\n\r\n\t\tconst geometry = new OctahedronGeometry( size );\r\n\t\tgeometry.rotateY( Math.PI * 0.5 );\r\n\r\n\t\tthis.material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\r\n\t\tif ( this.color === undefined ) this.material.vertexColors = true;\r\n\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\t\tconst colors = new Float32Array( position.count * 3 );\r\n\r\n\t\tgeometry.setAttribute( 'color', new BufferAttribute( colors, 3 ) );\r\n\r\n\t\tthis.add( new Mesh( geometry, this.material ) );\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.children[ 0 ].geometry.dispose();\r\n\t\tthis.children[ 0 ].material.dispose();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst mesh = this.children[ 0 ];\r\n\r\n\t\tif ( this.color !== undefined ) {\r\n\r\n\t\t\tthis.material.color.set( this.color );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst colors = mesh.geometry.getAttribute( 'color' );\r\n\r\n\t\t\t_color1.copy( this.light.color );\r\n\t\t\t_color2.copy( this.light.groundColor );\r\n\r\n\t\t\tfor ( let i = 0, l = colors.count; i < l; i ++ ) {\r\n\r\n\t\t\t\tconst color = ( i < ( l / 2 ) ) ? _color1 : _color2;\r\n\r\n\t\t\t\tcolors.setXYZ( i, color.r, color.g, color.b );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcolors.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t\tthis.light.updateWorldMatrix( true, false );\r\n\r\n\t\tmesh.lookAt( _vector$1.setFromMatrixPosition( this.light.matrixWorld ).negate() );\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass GridHelper extends LineSegments {\r\n\r\n\tconstructor( size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888 ) {\r\n\r\n\t\tcolor1 = new Color( color1 );\r\n\t\tcolor2 = new Color( color2 );\r\n\r\n\t\tconst center = divisions / 2;\r\n\t\tconst step = size / divisions;\r\n\t\tconst halfSize = size / 2;\r\n\r\n\t\tconst vertices = [], colors = [];\r\n\r\n\t\tfor ( let i = 0, j = 0, k = - halfSize; i <= divisions; i ++, k += step ) {\r\n\r\n\t\t\tvertices.push( - halfSize, 0, k, halfSize, 0, k );\r\n\t\t\tvertices.push( k, 0, - halfSize, k, 0, halfSize );\r\n\r\n\t\t\tconst color = i === center ? color1 : color2;\r\n\r\n\t\t\tcolor.toArray( colors, j ); j += 3;\r\n\t\t\tcolor.toArray( colors, j ); j += 3;\r\n\t\t\tcolor.toArray( colors, j ); j += 3;\r\n\t\t\tcolor.toArray( colors, j ); j += 3;\r\n\r\n\t\t}\r\n\r\n\t\tconst geometry = new BufferGeometry();\r\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\r\n\r\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\r\n\r\n\t\tsuper( geometry, material );\r\n\r\n\t\tthis.type = 'GridHelper';\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.geometry.dispose();\r\n\t\tthis.material.dispose();\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass PolarGridHelper extends LineSegments {\r\n\r\n\tconstructor( radius = 10, sectors = 16, rings = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888 ) {\r\n\r\n\t\tcolor1 = new Color( color1 );\r\n\t\tcolor2 = new Color( color2 );\r\n\r\n\t\tconst vertices = [];\r\n\t\tconst colors = [];\r\n\r\n\t\t// create the sectors\r\n\r\n\t\tif ( sectors > 1 ) {\r\n\r\n\t\t\tfor ( let i = 0; i < sectors; i ++ ) {\r\n\r\n\t\t\t\tconst v = ( i / sectors ) * ( Math.PI * 2 );\r\n\r\n\t\t\t\tconst x = Math.sin( v ) * radius;\r\n\t\t\t\tconst z = Math.cos( v ) * radius;\r\n\r\n\t\t\t\tvertices.push( 0, 0, 0 );\r\n\t\t\t\tvertices.push( x, 0, z );\r\n\r\n\t\t\t\tconst color = ( i & 1 ) ? color1 : color2;\r\n\r\n\t\t\t\tcolors.push( color.r, color.g, color.b );\r\n\t\t\t\tcolors.push( color.r, color.g, color.b );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// create the rings\r\n\r\n\t\tfor ( let i = 0; i < rings; i ++ ) {\r\n\r\n\t\t\tconst color = ( i & 1 ) ? color1 : color2;\r\n\r\n\t\t\tconst r = radius - ( radius / rings * i );\r\n\r\n\t\t\tfor ( let j = 0; j < divisions; j ++ ) {\r\n\r\n\t\t\t\t// first vertex\r\n\r\n\t\t\t\tlet v = ( j / divisions ) * ( Math.PI * 2 );\r\n\r\n\t\t\t\tlet x = Math.sin( v ) * r;\r\n\t\t\t\tlet z = Math.cos( v ) * r;\r\n\r\n\t\t\t\tvertices.push( x, 0, z );\r\n\t\t\t\tcolors.push( color.r, color.g, color.b );\r\n\r\n\t\t\t\t// second vertex\r\n\r\n\t\t\t\tv = ( ( j + 1 ) / divisions ) * ( Math.PI * 2 );\r\n\r\n\t\t\t\tx = Math.sin( v ) * r;\r\n\t\t\t\tz = Math.cos( v ) * r;\r\n\r\n\t\t\t\tvertices.push( x, 0, z );\r\n\t\t\t\tcolors.push( color.r, color.g, color.b );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconst geometry = new BufferGeometry();\r\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\r\n\r\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\r\n\r\n\t\tsuper( geometry, material );\r\n\r\n\t\tthis.type = 'PolarGridHelper';\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.geometry.dispose();\r\n\t\tthis.material.dispose();\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _v1 = /*@__PURE__*/ new Vector3();\r\nconst _v2 = /*@__PURE__*/ new Vector3();\r\nconst _v3 = /*@__PURE__*/ new Vector3();\r\n\r\nclass DirectionalLightHelper extends Object3D {\r\n\r\n\tconstructor( light, size, color ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.light = light;\r\n\r\n\t\tthis.matrix = light.matrixWorld;\r\n\t\tthis.matrixAutoUpdate = false;\r\n\r\n\t\tthis.color = color;\r\n\r\n\t\tthis.type = 'DirectionalLightHelper';\r\n\r\n\t\tif ( size === undefined ) size = 1;\r\n\r\n\t\tlet geometry = new BufferGeometry();\r\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [\r\n\t\t\t- size, size, 0,\r\n\t\t\tsize, size, 0,\r\n\t\t\tsize, - size, 0,\r\n\t\t\t- size, - size, 0,\r\n\t\t\t- size, size, 0\r\n\t\t], 3 ) );\r\n\r\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\r\n\r\n\t\tthis.lightPlane = new Line( geometry, material );\r\n\t\tthis.add( this.lightPlane );\r\n\r\n\t\tgeometry = new BufferGeometry();\r\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 0, 1 ], 3 ) );\r\n\r\n\t\tthis.targetLine = new Line( geometry, material );\r\n\t\tthis.add( this.targetLine );\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.lightPlane.geometry.dispose();\r\n\t\tthis.lightPlane.material.dispose();\r\n\t\tthis.targetLine.geometry.dispose();\r\n\t\tthis.targetLine.material.dispose();\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tthis.light.updateWorldMatrix( true, false );\r\n\t\tthis.light.target.updateWorldMatrix( true, false );\r\n\r\n\t\t_v1.setFromMatrixPosition( this.light.matrixWorld );\r\n\t\t_v2.setFromMatrixPosition( this.light.target.matrixWorld );\r\n\t\t_v3.subVectors( _v2, _v1 );\r\n\r\n\t\tthis.lightPlane.lookAt( _v2 );\r\n\r\n\t\tif ( this.color !== undefined ) {\r\n\r\n\t\t\tthis.lightPlane.material.color.set( this.color );\r\n\t\t\tthis.targetLine.material.color.set( this.color );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.lightPlane.material.color.copy( this.light.color );\r\n\t\t\tthis.targetLine.material.color.copy( this.light.color );\r\n\r\n\t\t}\r\n\r\n\t\tthis.targetLine.lookAt( _v2 );\r\n\t\tthis.targetLine.scale.z = _v3.length();\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _vector = /*@__PURE__*/ new Vector3();\r\nconst _camera = /*@__PURE__*/ new Camera();\r\n\r\n/**\r\n *\t- shows frustum, line of sight and up of the camera\r\n *\t- suitable for fast updates\r\n * \t- based on frustum visualization in lightgl.js shadowmap example\r\n *\t\thttps://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html\r\n */\r\n\r\nclass CameraHelper extends LineSegments {\r\n\r\n\tconstructor( camera ) {\r\n\r\n\t\tconst geometry = new BufferGeometry();\r\n\t\tconst material = new LineBasicMaterial( { color: 0xffffff, vertexColors: true, toneMapped: false } );\r\n\r\n\t\tconst vertices = [];\r\n\t\tconst colors = [];\r\n\r\n\t\tconst pointMap = {};\r\n\r\n\t\t// near\r\n\r\n\t\taddLine( 'n1', 'n2' );\r\n\t\taddLine( 'n2', 'n4' );\r\n\t\taddLine( 'n4', 'n3' );\r\n\t\taddLine( 'n3', 'n1' );\r\n\r\n\t\t// far\r\n\r\n\t\taddLine( 'f1', 'f2' );\r\n\t\taddLine( 'f2', 'f4' );\r\n\t\taddLine( 'f4', 'f3' );\r\n\t\taddLine( 'f3', 'f1' );\r\n\r\n\t\t// sides\r\n\r\n\t\taddLine( 'n1', 'f1' );\r\n\t\taddLine( 'n2', 'f2' );\r\n\t\taddLine( 'n3', 'f3' );\r\n\t\taddLine( 'n4', 'f4' );\r\n\r\n\t\t// cone\r\n\r\n\t\taddLine( 'p', 'n1' );\r\n\t\taddLine( 'p', 'n2' );\r\n\t\taddLine( 'p', 'n3' );\r\n\t\taddLine( 'p', 'n4' );\r\n\r\n\t\t// up\r\n\r\n\t\taddLine( 'u1', 'u2' );\r\n\t\taddLine( 'u2', 'u3' );\r\n\t\taddLine( 'u3', 'u1' );\r\n\r\n\t\t// target\r\n\r\n\t\taddLine( 'c', 't' );\r\n\t\taddLine( 'p', 'c' );\r\n\r\n\t\t// cross\r\n\r\n\t\taddLine( 'cn1', 'cn2' );\r\n\t\taddLine( 'cn3', 'cn4' );\r\n\r\n\t\taddLine( 'cf1', 'cf2' );\r\n\t\taddLine( 'cf3', 'cf4' );\r\n\r\n\t\tfunction addLine( a, b ) {\r\n\r\n\t\t\taddPoint( a );\r\n\t\t\taddPoint( b );\r\n\r\n\t\t}\r\n\r\n\t\tfunction addPoint( id ) {\r\n\r\n\t\t\tvertices.push( 0, 0, 0 );\r\n\t\t\tcolors.push( 0, 0, 0 );\r\n\r\n\t\t\tif ( pointMap[ id ] === undefined ) {\r\n\r\n\t\t\t\tpointMap[ id ] = [];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tpointMap[ id ].push( ( vertices.length / 3 ) - 1 );\r\n\r\n\t\t}\r\n\r\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\r\n\r\n\t\tsuper( geometry, material );\r\n\r\n\t\tthis.type = 'CameraHelper';\r\n\r\n\t\tthis.camera = camera;\r\n\t\tif ( this.camera.updateProjectionMatrix ) this.camera.updateProjectionMatrix();\r\n\r\n\t\tthis.matrix = camera.matrixWorld;\r\n\t\tthis.matrixAutoUpdate = false;\r\n\r\n\t\tthis.pointMap = pointMap;\r\n\r\n\t\tthis.update();\r\n\r\n\t\t// colors\r\n\r\n\t\tconst colorFrustum = new Color( 0xffaa00 );\r\n\t\tconst colorCone = new Color( 0xff0000 );\r\n\t\tconst colorUp = new Color( 0x00aaff );\r\n\t\tconst colorTarget = new Color( 0xffffff );\r\n\t\tconst colorCross = new Color( 0x333333 );\r\n\r\n\t\tthis.setColors( colorFrustum, colorCone, colorUp, colorTarget, colorCross );\r\n\r\n\t}\r\n\r\n\tsetColors( frustum, cone, up, target, cross ) {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\r\n\t\tconst colorAttribute = geometry.getAttribute( 'color' );\r\n\r\n\t\t// near\r\n\r\n\t\tcolorAttribute.setXYZ( 0, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 1, frustum.r, frustum.g, frustum.b ); // n1, n2\r\n\t\tcolorAttribute.setXYZ( 2, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 3, frustum.r, frustum.g, frustum.b ); // n2, n4\r\n\t\tcolorAttribute.setXYZ( 4, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 5, frustum.r, frustum.g, frustum.b ); // n4, n3\r\n\t\tcolorAttribute.setXYZ( 6, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 7, frustum.r, frustum.g, frustum.b ); // n3, n1\r\n\r\n\t\t// far\r\n\r\n\t\tcolorAttribute.setXYZ( 8, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 9, frustum.r, frustum.g, frustum.b ); // f1, f2\r\n\t\tcolorAttribute.setXYZ( 10, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 11, frustum.r, frustum.g, frustum.b ); // f2, f4\r\n\t\tcolorAttribute.setXYZ( 12, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 13, frustum.r, frustum.g, frustum.b ); // f4, f3\r\n\t\tcolorAttribute.setXYZ( 14, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 15, frustum.r, frustum.g, frustum.b ); // f3, f1\r\n\r\n\t\t// sides\r\n\r\n\t\tcolorAttribute.setXYZ( 16, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 17, frustum.r, frustum.g, frustum.b ); // n1, f1\r\n\t\tcolorAttribute.setXYZ( 18, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 19, frustum.r, frustum.g, frustum.b ); // n2, f2\r\n\t\tcolorAttribute.setXYZ( 20, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 21, frustum.r, frustum.g, frustum.b ); // n3, f3\r\n\t\tcolorAttribute.setXYZ( 22, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 23, frustum.r, frustum.g, frustum.b ); // n4, f4\r\n\r\n\t\t// cone\r\n\r\n\t\tcolorAttribute.setXYZ( 24, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 25, cone.r, cone.g, cone.b ); // p, n1\r\n\t\tcolorAttribute.setXYZ( 26, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 27, cone.r, cone.g, cone.b ); // p, n2\r\n\t\tcolorAttribute.setXYZ( 28, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 29, cone.r, cone.g, cone.b ); // p, n3\r\n\t\tcolorAttribute.setXYZ( 30, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 31, cone.r, cone.g, cone.b ); // p, n4\r\n\r\n\t\t// up\r\n\r\n\t\tcolorAttribute.setXYZ( 32, up.r, up.g, up.b ); colorAttribute.setXYZ( 33, up.r, up.g, up.b ); // u1, u2\r\n\t\tcolorAttribute.setXYZ( 34, up.r, up.g, up.b ); colorAttribute.setXYZ( 35, up.r, up.g, up.b ); // u2, u3\r\n\t\tcolorAttribute.setXYZ( 36, up.r, up.g, up.b ); colorAttribute.setXYZ( 37, up.r, up.g, up.b ); // u3, u1\r\n\r\n\t\t// target\r\n\r\n\t\tcolorAttribute.setXYZ( 38, target.r, target.g, target.b ); colorAttribute.setXYZ( 39, target.r, target.g, target.b ); // c, t\r\n\t\tcolorAttribute.setXYZ( 40, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 41, cross.r, cross.g, cross.b ); // p, c\r\n\r\n\t\t// cross\r\n\r\n\t\tcolorAttribute.setXYZ( 42, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 43, cross.r, cross.g, cross.b ); // cn1, cn2\r\n\t\tcolorAttribute.setXYZ( 44, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 45, cross.r, cross.g, cross.b ); // cn3, cn4\r\n\r\n\t\tcolorAttribute.setXYZ( 46, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 47, cross.r, cross.g, cross.b ); // cf1, cf2\r\n\t\tcolorAttribute.setXYZ( 48, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 49, cross.r, cross.g, cross.b ); // cf3, cf4\r\n\r\n\t\tcolorAttribute.needsUpdate = true;\r\n\r\n\t}\r\n\r\n\tupdate() {\r\n\r\n\t\tconst geometry = this.geometry;\r\n\t\tconst pointMap = this.pointMap;\r\n\r\n\t\tconst w = 1, h = 1;\r\n\r\n\t\t// we need just camera projection matrix inverse\r\n\t\t// world matrix must be identity\r\n\r\n\t\t_camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );\r\n\r\n\t\t// center / target\r\n\r\n\t\tsetPoint( 'c', pointMap, geometry, _camera, 0, 0, - 1 );\r\n\t\tsetPoint( 't', pointMap, geometry, _camera, 0, 0, 1 );\r\n\r\n\t\t// near\r\n\r\n\t\tsetPoint( 'n1', pointMap, geometry, _camera, - w, - h, - 1 );\r\n\t\tsetPoint( 'n2', pointMap, geometry, _camera, w, - h, - 1 );\r\n\t\tsetPoint( 'n3', pointMap, geometry, _camera, - w, h, - 1 );\r\n\t\tsetPoint( 'n4', pointMap, geometry, _camera, w, h, - 1 );\r\n\r\n\t\t// far\r\n\r\n\t\tsetPoint( 'f1', pointMap, geometry, _camera, - w, - h, 1 );\r\n\t\tsetPoint( 'f2', pointMap, geometry, _camera, w, - h, 1 );\r\n\t\tsetPoint( 'f3', pointMap, geometry, _camera, - w, h, 1 );\r\n\t\tsetPoint( 'f4', pointMap, geometry, _camera, w, h, 1 );\r\n\r\n\t\t// up\r\n\r\n\t\tsetPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, - 1 );\r\n\t\tsetPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1, - 1 );\r\n\t\tsetPoint( 'u3', pointMap, geometry, _camera, 0, h * 2, - 1 );\r\n\r\n\t\t// cross\r\n\r\n\t\tsetPoint( 'cf1', pointMap, geometry, _camera, - w, 0, 1 );\r\n\t\tsetPoint( 'cf2', pointMap, geometry, _camera, w, 0, 1 );\r\n\t\tsetPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 );\r\n\t\tsetPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 );\r\n\r\n\t\tsetPoint( 'cn1', pointMap, geometry, _camera, - w, 0, - 1 );\r\n\t\tsetPoint( 'cn2', pointMap, geometry, _camera, w, 0, - 1 );\r\n\t\tsetPoint( 'cn3', pointMap, geometry, _camera, 0, - h, - 1 );\r\n\t\tsetPoint( 'cn4', pointMap, geometry, _camera, 0, h, - 1 );\r\n\r\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.geometry.dispose();\r\n\t\tthis.material.dispose();\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\nfunction setPoint( point, pointMap, geometry, camera, x, y, z ) {\r\n\r\n\t_vector.set( x, y, z ).unproject( camera );\r\n\r\n\tconst points = pointMap[ point ];\r\n\r\n\tif ( points !== undefined ) {\r\n\r\n\t\tconst position = geometry.getAttribute( 'position' );\r\n\r\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\r\n\r\n\t\t\tposition.setXYZ( points[ i ], _vector.x, _vector.y, _vector.z );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _box = /*@__PURE__*/ new Box3();\r\n\r\nclass BoxHelper extends LineSegments {\r\n\r\n\tconstructor( object, color = 0xffff00 ) {\r\n\r\n\t\tconst indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\r\n\t\tconst positions = new Float32Array( 8 * 3 );\r\n\r\n\t\tconst geometry = new BufferGeometry();\r\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\r\n\t\tgeometry.setAttribute( 'position', new BufferAttribute( positions, 3 ) );\r\n\r\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\r\n\r\n\t\tthis.object = object;\r\n\t\tthis.type = 'BoxHelper';\r\n\r\n\t\tthis.matrixAutoUpdate = false;\r\n\r\n\t\tthis.update();\r\n\r\n\t}\r\n\r\n\tupdate( object ) {\r\n\r\n\t\tif ( object !== undefined ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.BoxHelper: .update() has no longer arguments.' );\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.object !== undefined ) {\r\n\r\n\t\t\t_box.setFromObject( this.object );\r\n\r\n\t\t}\r\n\r\n\t\tif ( _box.isEmpty() ) return;\r\n\r\n\t\tconst min = _box.min;\r\n\t\tconst max = _box.max;\r\n\r\n\t\t/*\r\n\t\t\t5____4\r\n\t\t1/___0/|\r\n\t\t| 6__|_7\r\n\t\t2/___3/\r\n\r\n\t\t0: max.x, max.y, max.z\r\n\t\t1: min.x, max.y, max.z\r\n\t\t2: min.x, min.y, max.z\r\n\t\t3: max.x, min.y, max.z\r\n\t\t4: max.x, max.y, min.z\r\n\t\t5: min.x, max.y, min.z\r\n\t\t6: min.x, min.y, min.z\r\n\t\t7: max.x, min.y, min.z\r\n\t\t*/\r\n\r\n\t\tconst position = this.geometry.attributes.position;\r\n\t\tconst array = position.array;\r\n\r\n\t\tarray[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z;\r\n\t\tarray[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z;\r\n\t\tarray[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z;\r\n\t\tarray[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z;\r\n\t\tarray[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z;\r\n\t\tarray[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z;\r\n\t\tarray[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z;\r\n\t\tarray[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z;\r\n\r\n\t\tposition.needsUpdate = true;\r\n\r\n\t\tthis.geometry.computeBoundingSphere();\r\n\r\n\t}\r\n\r\n\tsetFromObject( object ) {\r\n\r\n\t\tthis.object = object;\r\n\t\tthis.update();\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tcopy( source, recursive ) {\r\n\r\n\t\tsuper.copy( source, recursive );\r\n\r\n\t\tthis.object = source.object;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.geometry.dispose();\r\n\t\tthis.material.dispose();\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Box3Helper extends LineSegments {\r\n\r\n\tconstructor( box, color = 0xffff00 ) {\r\n\r\n\t\tconst indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\r\n\r\n\t\tconst positions = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 1, - 1, 1, - 1, - 1 ];\r\n\r\n\t\tconst geometry = new BufferGeometry();\r\n\r\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\r\n\r\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\r\n\r\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\r\n\r\n\t\tthis.box = box;\r\n\r\n\t\tthis.type = 'Box3Helper';\r\n\r\n\t\tthis.geometry.computeBoundingSphere();\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( force ) {\r\n\r\n\t\tconst box = this.box;\r\n\r\n\t\tif ( box.isEmpty() ) return;\r\n\r\n\t\tbox.getCenter( this.position );\r\n\r\n\t\tbox.getSize( this.scale );\r\n\r\n\t\tthis.scale.multiplyScalar( 0.5 );\r\n\r\n\t\tsuper.updateMatrixWorld( force );\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.geometry.dispose();\r\n\t\tthis.material.dispose();\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass PlaneHelper extends Line {\r\n\r\n\tconstructor( plane, size = 1, hex = 0xffff00 ) {\r\n\r\n\t\tconst color = hex;\r\n\r\n\t\tconst positions = [ 1, - 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, - 1, 0, 1, 1, 0 ];\r\n\r\n\t\tconst geometry = new BufferGeometry();\r\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\r\n\t\tgeometry.computeBoundingSphere();\r\n\r\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\r\n\r\n\t\tthis.type = 'PlaneHelper';\r\n\r\n\t\tthis.plane = plane;\r\n\r\n\t\tthis.size = size;\r\n\r\n\t\tconst positions2 = [ 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, - 1, 0 ];\r\n\r\n\t\tconst geometry2 = new BufferGeometry();\r\n\t\tgeometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) );\r\n\t\tgeometry2.computeBoundingSphere();\r\n\r\n\t\tthis.add( new Mesh( geometry2, new MeshBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false, toneMapped: false } ) ) );\r\n\r\n\t}\r\n\r\n\tupdateMatrixWorld( force ) {\r\n\r\n\t\tthis.position.set( 0, 0, 0 );\r\n\r\n\t\tthis.scale.set( 0.5 * this.size, 0.5 * this.size, 1 );\r\n\r\n\t\tthis.lookAt( this.plane.normal );\r\n\r\n\t\tthis.translateZ( - this.plane.constant );\r\n\r\n\t\tsuper.updateMatrixWorld( force );\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.geometry.dispose();\r\n\t\tthis.material.dispose();\r\n\t\tthis.children[ 0 ].geometry.dispose();\r\n\t\tthis.children[ 0 ].material.dispose();\r\n\r\n\t}\r\n\r\n}\r\n\r\nconst _axis = /*@__PURE__*/ new Vector3();\r\nlet _lineGeometry, _coneGeometry;\r\n\r\nclass ArrowHelper extends Object3D {\r\n\r\n\t// dir is assumed to be normalized\r\n\r\n\tconstructor( dir = new Vector3( 0, 0, 1 ), origin = new Vector3( 0, 0, 0 ), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.type = 'ArrowHelper';\r\n\r\n\t\tif ( _lineGeometry === undefined ) {\r\n\r\n\t\t\t_lineGeometry = new BufferGeometry();\r\n\t\t\t_lineGeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );\r\n\r\n\t\t\t_coneGeometry = new CylinderGeometry( 0, 0.5, 1, 5, 1 );\r\n\t\t\t_coneGeometry.translate( 0, - 0.5, 0 );\r\n\r\n\t\t}\r\n\r\n\t\tthis.position.copy( origin );\r\n\r\n\t\tthis.line = new Line( _lineGeometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\r\n\t\tthis.line.matrixAutoUpdate = false;\r\n\t\tthis.add( this.line );\r\n\r\n\t\tthis.cone = new Mesh( _coneGeometry, new MeshBasicMaterial( { color: color, toneMapped: false } ) );\r\n\t\tthis.cone.matrixAutoUpdate = false;\r\n\t\tthis.add( this.cone );\r\n\r\n\t\tthis.setDirection( dir );\r\n\t\tthis.setLength( length, headLength, headWidth );\r\n\r\n\t}\r\n\r\n\tsetDirection( dir ) {\r\n\r\n\t\t// dir is assumed to be normalized\r\n\r\n\t\tif ( dir.y > 0.99999 ) {\r\n\r\n\t\t\tthis.quaternion.set( 0, 0, 0, 1 );\r\n\r\n\t\t} else if ( dir.y < - 0.99999 ) {\r\n\r\n\t\t\tthis.quaternion.set( 1, 0, 0, 0 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_axis.set( dir.z, 0, - dir.x ).normalize();\r\n\r\n\t\t\tconst radians = Math.acos( dir.y );\r\n\r\n\t\t\tthis.quaternion.setFromAxisAngle( _axis, radians );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tsetLength( length, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\r\n\r\n\t\tthis.line.scale.set( 1, Math.max( 0.0001, length - headLength ), 1 ); // see #17458\r\n\t\tthis.line.updateMatrix();\r\n\r\n\t\tthis.cone.scale.set( headWidth, headLength, headWidth );\r\n\t\tthis.cone.position.y = length;\r\n\t\tthis.cone.updateMatrix();\r\n\r\n\t}\r\n\r\n\tsetColor( color ) {\r\n\r\n\t\tthis.line.material.color.set( color );\r\n\t\tthis.cone.material.color.set( color );\r\n\r\n\t}\r\n\r\n\tcopy( source ) {\r\n\r\n\t\tsuper.copy( source, false );\r\n\r\n\t\tthis.line.copy( source.line );\r\n\t\tthis.cone.copy( source.cone );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.line.geometry.dispose();\r\n\t\tthis.line.material.dispose();\r\n\t\tthis.cone.geometry.dispose();\r\n\t\tthis.cone.material.dispose();\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass AxesHelper extends LineSegments {\r\n\r\n\tconstructor( size = 1 ) {\r\n\r\n\t\tconst vertices = [\r\n\t\t\t0, 0, 0,\tsize, 0, 0,\r\n\t\t\t0, 0, 0,\t0, size, 0,\r\n\t\t\t0, 0, 0,\t0, 0, size\r\n\t\t];\r\n\r\n\t\tconst colors = [\r\n\t\t\t1, 0, 0,\t1, 0.6, 0,\r\n\t\t\t0, 1, 0,\t0.6, 1, 0,\r\n\t\t\t0, 0, 1,\t0, 0.6, 1\r\n\t\t];\r\n\r\n\t\tconst geometry = new BufferGeometry();\r\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\r\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\r\n\r\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\r\n\r\n\t\tsuper( geometry, material );\r\n\r\n\t\tthis.type = 'AxesHelper';\r\n\r\n\t}\r\n\r\n\tsetColors( xAxisColor, yAxisColor, zAxisColor ) {\r\n\r\n\t\tconst color = new Color();\r\n\t\tconst array = this.geometry.attributes.color.array;\r\n\r\n\t\tcolor.set( xAxisColor );\r\n\t\tcolor.toArray( array, 0 );\r\n\t\tcolor.toArray( array, 3 );\r\n\r\n\t\tcolor.set( yAxisColor );\r\n\t\tcolor.toArray( array, 6 );\r\n\t\tcolor.toArray( array, 9 );\r\n\r\n\t\tcolor.set( zAxisColor );\r\n\t\tcolor.toArray( array, 12 );\r\n\t\tcolor.toArray( array, 15 );\r\n\r\n\t\tthis.geometry.attributes.color.needsUpdate = true;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.geometry.dispose();\r\n\t\tthis.material.dispose();\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass ShapePath {\r\n\r\n\tconstructor() {\r\n\r\n\t\tthis.type = 'ShapePath';\r\n\r\n\t\tthis.color = new Color();\r\n\r\n\t\tthis.subPaths = [];\r\n\t\tthis.currentPath = null;\r\n\r\n\t}\r\n\r\n\tmoveTo( x, y ) {\r\n\r\n\t\tthis.currentPath = new Path();\r\n\t\tthis.subPaths.push( this.currentPath );\r\n\t\tthis.currentPath.moveTo( x, y );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tlineTo( x, y ) {\r\n\r\n\t\tthis.currentPath.lineTo( x, y );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\r\n\r\n\t\tthis.currentPath.quadraticCurveTo( aCPx, aCPy, aX, aY );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\r\n\r\n\t\tthis.currentPath.bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\tsplineThru( pts ) {\r\n\r\n\t\tthis.currentPath.splineThru( pts );\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n\ttoShapes( isCCW ) {\r\n\r\n\t\tfunction toShapesNoHoles( inSubpaths ) {\r\n\r\n\t\t\tconst shapes = [];\r\n\r\n\t\t\tfor ( let i = 0, l = inSubpaths.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tconst tmpPath = inSubpaths[ i ];\r\n\r\n\t\t\t\tconst tmpShape = new Shape();\r\n\t\t\t\ttmpShape.curves = tmpPath.curves;\r\n\r\n\t\t\t\tshapes.push( tmpShape );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn shapes;\r\n\r\n\t\t}\r\n\r\n\t\tfunction isPointInsidePolygon( inPt, inPolygon ) {\r\n\r\n\t\t\tconst polyLen = inPolygon.length;\r\n\r\n\t\t\t// inPt on polygon contour => immediate success or\r\n\t\t\t// toggling of inside/outside at every single! intersection point of an edge\r\n\t\t\t// with the horizontal line through inPt, left of inPt\r\n\t\t\t// not counting lowerY endpoints of edges and whole edges on that line\r\n\t\t\tlet inside = false;\r\n\t\t\tfor ( let p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {\r\n\r\n\t\t\t\tlet edgeLowPt = inPolygon[ p ];\r\n\t\t\t\tlet edgeHighPt = inPolygon[ q ];\r\n\r\n\t\t\t\tlet edgeDx = edgeHighPt.x - edgeLowPt.x;\r\n\t\t\t\tlet edgeDy = edgeHighPt.y - edgeLowPt.y;\r\n\r\n\t\t\t\tif ( Math.abs( edgeDy ) > Number.EPSILON ) {\r\n\r\n\t\t\t\t\t// not parallel\r\n\t\t\t\t\tif ( edgeDy < 0 ) {\r\n\r\n\t\t\t\t\t\tedgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;\r\n\t\t\t\t\t\tedgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) \t\tcontinue;\r\n\r\n\t\t\t\t\tif ( inPt.y === edgeLowPt.y ) {\r\n\r\n\t\t\t\t\t\tif ( inPt.x === edgeLowPt.x )\t\treturn\ttrue;\t\t// inPt is on contour ?\r\n\t\t\t\t\t\t// continue;\t\t\t\t// no intersection or edgeLowPt => doesn't count !!!\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tconst perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y );\r\n\t\t\t\t\t\tif ( perpEdge === 0 )\t\t\t\treturn\ttrue;\t\t// inPt is on contour ?\r\n\t\t\t\t\t\tif ( perpEdge < 0 ) \t\t\t\tcontinue;\r\n\t\t\t\t\t\tinside = ! inside;\t\t// true intersection left of inPt\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// parallel or collinear\r\n\t\t\t\t\tif ( inPt.y !== edgeLowPt.y ) \t\tcontinue;\t\t\t// parallel\r\n\t\t\t\t\t// edge lies on the same horizontal line as inPt\r\n\t\t\t\t\tif ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||\r\n\t\t\t\t\t\t ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) )\t\treturn\ttrue;\t// inPt: Point on contour !\r\n\t\t\t\t\t// continue;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn\tinside;\r\n\r\n\t\t}\r\n\r\n\t\tconst isClockWise = ShapeUtils.isClockWise;\r\n\r\n\t\tconst subPaths = this.subPaths;\r\n\t\tif ( subPaths.length === 0 ) return [];\r\n\r\n\t\tlet solid, tmpPath, tmpShape;\r\n\t\tconst shapes = [];\r\n\r\n\t\tif ( subPaths.length === 1 ) {\r\n\r\n\t\t\ttmpPath = subPaths[ 0 ];\r\n\t\t\ttmpShape = new Shape();\r\n\t\t\ttmpShape.curves = tmpPath.curves;\r\n\t\t\tshapes.push( tmpShape );\r\n\t\t\treturn shapes;\r\n\r\n\t\t}\r\n\r\n\t\tlet holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() );\r\n\t\tholesFirst = isCCW ? ! holesFirst : holesFirst;\r\n\r\n\t\t// console.log(\"Holes first\", holesFirst);\r\n\r\n\t\tconst betterShapeHoles = [];\r\n\t\tconst newShapes = [];\r\n\t\tlet newShapeHoles = [];\r\n\t\tlet mainIdx = 0;\r\n\t\tlet tmpPoints;\r\n\r\n\t\tnewShapes[ mainIdx ] = undefined;\r\n\t\tnewShapeHoles[ mainIdx ] = [];\r\n\r\n\t\tfor ( let i = 0, l = subPaths.length; i < l; i ++ ) {\r\n\r\n\t\t\ttmpPath = subPaths[ i ];\r\n\t\t\ttmpPoints = tmpPath.getPoints();\r\n\t\t\tsolid = isClockWise( tmpPoints );\r\n\t\t\tsolid = isCCW ? ! solid : solid;\r\n\r\n\t\t\tif ( solid ) {\r\n\r\n\t\t\t\tif ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) )\tmainIdx ++;\r\n\r\n\t\t\t\tnewShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints };\r\n\t\t\t\tnewShapes[ mainIdx ].s.curves = tmpPath.curves;\r\n\r\n\t\t\t\tif ( holesFirst )\tmainIdx ++;\r\n\t\t\t\tnewShapeHoles[ mainIdx ] = [];\r\n\r\n\t\t\t\t//console.log('cw', i);\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tnewShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );\r\n\r\n\t\t\t\t//console.log('ccw', i);\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// only Holes? -> probably all Shapes with wrong orientation\r\n\t\tif ( ! newShapes[ 0 ] )\treturn\ttoShapesNoHoles( subPaths );\r\n\r\n\r\n\t\tif ( newShapes.length > 1 ) {\r\n\r\n\t\t\tlet ambiguous = false;\r\n\t\t\tlet toChange = 0;\r\n\r\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\r\n\r\n\t\t\t\tbetterShapeHoles[ sIdx ] = [];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\r\n\r\n\t\t\t\tconst sho = newShapeHoles[ sIdx ];\r\n\r\n\t\t\t\tfor ( let hIdx = 0; hIdx < sho.length; hIdx ++ ) {\r\n\r\n\t\t\t\t\tconst ho = sho[ hIdx ];\r\n\t\t\t\t\tlet hole_unassigned = true;\r\n\r\n\t\t\t\t\tfor ( let s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {\r\n\r\n\t\t\t\t\t\tif ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {\r\n\r\n\t\t\t\t\t\t\tif ( sIdx !== s2Idx )\ttoChange ++;\r\n\r\n\t\t\t\t\t\t\tif ( hole_unassigned ) {\r\n\r\n\t\t\t\t\t\t\t\thole_unassigned = false;\r\n\t\t\t\t\t\t\t\tbetterShapeHoles[ s2Idx ].push( ho );\r\n\r\n\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\tambiguous = true;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( hole_unassigned ) {\r\n\r\n\t\t\t\t\t\tbetterShapeHoles[ sIdx ].push( ho );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( toChange > 0 && ambiguous === false ) {\r\n\r\n\t\t\t\tnewShapeHoles = betterShapeHoles;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tlet tmpHoles;\r\n\r\n\t\tfor ( let i = 0, il = newShapes.length; i < il; i ++ ) {\r\n\r\n\t\t\ttmpShape = newShapes[ i ].s;\r\n\t\t\tshapes.push( tmpShape );\r\n\t\t\ttmpHoles = newShapeHoles[ i ];\r\n\r\n\t\t\tfor ( let j = 0, jl = tmpHoles.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\ttmpShape.holes.push( tmpHoles[ j ].h );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t//console.log(\"shape\", shapes);\r\n\r\n\t\treturn shapes;\r\n\r\n\t}\r\n\r\n}\r\n\r\nclass Controls extends EventDispatcher {\r\n\r\n\tconstructor( object, domElement ) {\r\n\r\n\t\tsuper();\r\n\r\n\t\tthis.object = object;\r\n\t\tthis.domElement = domElement;\r\n\r\n\t\tthis.enabled = true;\r\n\r\n\t\tthis.state = - 1;\r\n\r\n\t\tthis.keys = {};\r\n\t\tthis.mouseButtons = { LEFT: null, MIDDLE: null, RIGHT: null };\r\n\t\tthis.touches = { ONE: null, TWO: null };\r\n\r\n\t}\r\n\r\n\tconnect() {}\r\n\r\n\tdisconnect() {}\r\n\r\n\tdispose() {}\r\n\r\n\tupdate( /* delta */ ) {}\r\n\r\n}\r\n\r\nclass WebGLMultipleRenderTargets extends WebGLRenderTarget { // @deprecated, r162\r\n\r\n\tconstructor( width = 1, height = 1, count = 1, options = {} ) {\r\n\r\n\t\tconsole.warn( 'THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the \"count\" parameter to enable MRT.' );\r\n\r\n\t\tsuper( width, height, { ...options, count } );\r\n\r\n\t\tthis.isWebGLMultipleRenderTargets = true;\r\n\r\n\t}\r\n\r\n\tget texture() {\r\n\r\n\t\treturn this.textures;\r\n\r\n\t}\r\n\r\n}\r\n\r\nif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\r\n\r\n\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {\r\n\t\trevision: REVISION,\r\n\t} } ) );\r\n\r\n}\r\n\r\nif ( typeof window !== 'undefined' ) {\r\n\r\n\tif ( window.__THREE__ ) {\r\n\r\n\t\tconsole.warn( 'WARNING: Multiple instances of Three.js being imported.' );\r\n\r\n\t} else {\r\n\r\n\t\twindow.__THREE__ = REVISION;\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\n\n\n//# sourceURL=webpack://3d_game/./node_modules/three/build/three.module.js?"); - -/***/ }), - -/***/ "./node_modules/three/examples/jsm/controls/PointerLockControls.js": -/*!*************************************************************************!*\ - !*** ./node_modules/three/examples/jsm/controls/PointerLockControls.js ***! - \*************************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PointerLockControls: () => (/* binding */ PointerLockControls)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\r\n\r\nconst _euler = new three__WEBPACK_IMPORTED_MODULE_0__.Euler( 0, 0, 0, 'YXZ' );\r\nconst _vector = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\r\n\r\nconst _changeEvent = { type: 'change' };\r\nconst _lockEvent = { type: 'lock' };\r\nconst _unlockEvent = { type: 'unlock' };\r\n\r\nconst _PI_2 = Math.PI / 2;\r\n\r\nclass PointerLockControls extends three__WEBPACK_IMPORTED_MODULE_0__.Controls {\r\n\r\n\tconstructor( camera, domElement = null ) {\r\n\r\n\t\tsuper( camera, domElement );\r\n\r\n\t\tthis.isLocked = false;\r\n\r\n\t\t// Set to constrain the pitch of the camera\r\n\t\t// Range is 0 to Math.PI radians\r\n\t\tthis.minPolarAngle = 0; // radians\r\n\t\tthis.maxPolarAngle = Math.PI; // radians\r\n\r\n\t\tthis.pointerSpeed = 1.0;\r\n\r\n\t\t// event listeners\r\n\r\n\t\tthis._onMouseMove = onMouseMove.bind( this );\r\n\t\tthis._onPointerlockChange = onPointerlockChange.bind( this );\r\n\t\tthis._onPointerlockError = onPointerlockError.bind( this );\r\n\r\n\t\tif ( this.domElement !== null ) {\r\n\r\n\t\t\tthis.connect();\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tconnect() {\r\n\r\n\t\tthis.domElement.ownerDocument.addEventListener( 'mousemove', this._onMouseMove );\r\n\t\tthis.domElement.ownerDocument.addEventListener( 'pointerlockchange', this._onPointerlockChange );\r\n\t\tthis.domElement.ownerDocument.addEventListener( 'pointerlockerror', this._onPointerlockError );\r\n\r\n\t}\r\n\r\n\tdisconnect() {\r\n\r\n\t\tthis.domElement.ownerDocument.removeEventListener( 'mousemove', this._onMouseMove );\r\n\t\tthis.domElement.ownerDocument.removeEventListener( 'pointerlockchange', this._onPointerlockChange );\r\n\t\tthis.domElement.ownerDocument.removeEventListener( 'pointerlockerror', this._onPointerlockError );\r\n\r\n\t}\r\n\r\n\tdispose() {\r\n\r\n\t\tthis.disconnect();\r\n\r\n\t}\r\n\r\n\tgetObject() {\r\n\r\n\t\tconsole.warn( 'THREE.PointerLockControls: getObject() has been deprecated. Use controls.object instead.' ); // @deprecated r169\r\n\r\n\t\treturn this.object;\r\n\r\n\t}\r\n\r\n\tgetDirection( v ) {\r\n\r\n\t\treturn v.set( 0, 0, - 1 ).applyQuaternion( this.object.quaternion );\r\n\r\n\t}\r\n\r\n\tmoveForward( distance ) {\r\n\r\n\t\tif ( this.enabled === false ) return;\r\n\r\n\t\t// move forward parallel to the xz-plane\r\n\t\t// assumes camera.up is y-up\r\n\r\n\t\tconst camera = this.object;\r\n\r\n\t\t_vector.setFromMatrixColumn( camera.matrix, 0 );\r\n\r\n\t\t_vector.crossVectors( camera.up, _vector );\r\n\r\n\t\tcamera.position.addScaledVector( _vector, distance );\r\n\r\n\t}\r\n\r\n\tmoveRight( distance ) {\r\n\r\n\t\tif ( this.enabled === false ) return;\r\n\r\n\t\tconst camera = this.object;\r\n\r\n\t\t_vector.setFromMatrixColumn( camera.matrix, 0 );\r\n\r\n\t\tcamera.position.addScaledVector( _vector, distance );\r\n\r\n\t}\r\n\r\n\tlock() {\r\n\r\n\t\tthis.domElement.requestPointerLock();\r\n\r\n\t}\r\n\r\n\tunlock() {\r\n\r\n\t\tthis.domElement.ownerDocument.exitPointerLock();\r\n\r\n\t}\r\n\r\n}\r\n\r\n// event listeners\r\n\r\nfunction onMouseMove( event ) {\r\n\r\n\tif ( this.enabled === false || this.isLocked === false ) return;\r\n\r\n\tconst movementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0;\r\n\tconst movementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0;\r\n\r\n\tconst camera = this.object;\r\n\t_euler.setFromQuaternion( camera.quaternion );\r\n\r\n\t_euler.y -= movementX * 0.002 * this.pointerSpeed;\r\n\t_euler.x -= movementY * 0.002 * this.pointerSpeed;\r\n\r\n\t_euler.x = Math.max( _PI_2 - this.maxPolarAngle, Math.min( _PI_2 - this.minPolarAngle, _euler.x ) );\r\n\r\n\tcamera.quaternion.setFromEuler( _euler );\r\n\r\n\tthis.dispatchEvent( _changeEvent );\r\n\r\n}\r\n\r\nfunction onPointerlockChange() {\r\n\r\n\tif ( this.domElement.ownerDocument.pointerLockElement === this.domElement ) {\r\n\r\n\t\tthis.dispatchEvent( _lockEvent );\r\n\r\n\t\tthis.isLocked = true;\r\n\r\n\t} else {\r\n\r\n\t\tthis.dispatchEvent( _unlockEvent );\r\n\r\n\t\tthis.isLocked = false;\r\n\r\n\t}\r\n\r\n}\r\n\r\nfunction onPointerlockError() {\r\n\r\n\tconsole.error( 'THREE.PointerLockControls: Unable to use Pointer Lock API' );\r\n\r\n}\r\n\r\n\r\n\n\n//# sourceURL=webpack://3d_game/./node_modules/three/examples/jsm/controls/PointerLockControls.js?"); - -/***/ }), - -/***/ "./node_modules/three/examples/jsm/libs/stats.module.js": -/*!**************************************************************!*\ - !*** ./node_modules/three/examples/jsm/libs/stats.module.js ***! - \**************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nvar Stats = function () {\n\n\tvar mode = 0;\n\n\tvar container = document.createElement( 'div' );\n\tcontainer.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000';\n\tcontainer.addEventListener( 'click', function ( event ) {\n\n\t\tevent.preventDefault();\n\t\tshowPanel( ++ mode % container.children.length );\n\n\t}, false );\n\n\t//\n\n\tfunction addPanel( panel ) {\n\n\t\tcontainer.appendChild( panel.dom );\n\t\treturn panel;\n\n\t}\n\n\tfunction showPanel( id ) {\n\n\t\tfor ( var i = 0; i < container.children.length; i ++ ) {\n\n\t\t\tcontainer.children[ i ].style.display = i === id ? 'block' : 'none';\n\n\t\t}\n\n\t\tmode = id;\n\n\t}\n\n\t//\n\n\tvar beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0;\n\n\tvar fpsPanel = addPanel( new Stats.Panel( 'FPS', '#0ff', '#002' ) );\n\tvar msPanel = addPanel( new Stats.Panel( 'MS', '#0f0', '#020' ) );\n\n\tif ( self.performance && self.performance.memory ) {\n\n\t\tvar memPanel = addPanel( new Stats.Panel( 'MB', '#f08', '#201' ) );\n\n\t}\n\n\tshowPanel( 0 );\n\n\treturn {\n\n\t\tREVISION: 16,\n\n\t\tdom: container,\n\n\t\taddPanel: addPanel,\n\t\tshowPanel: showPanel,\n\n\t\tbegin: function () {\n\n\t\t\tbeginTime = ( performance || Date ).now();\n\n\t\t},\n\n\t\tend: function () {\n\n\t\t\tframes ++;\n\n\t\t\tvar time = ( performance || Date ).now();\n\n\t\t\tmsPanel.update( time - beginTime, 200 );\n\n\t\t\tif ( time >= prevTime + 1000 ) {\n\n\t\t\t\tfpsPanel.update( ( frames * 1000 ) / ( time - prevTime ), 100 );\n\n\t\t\t\tprevTime = time;\n\t\t\t\tframes = 0;\n\n\t\t\t\tif ( memPanel ) {\n\n\t\t\t\t\tvar memory = performance.memory;\n\t\t\t\t\tmemPanel.update( memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn time;\n\n\t\t},\n\n\t\tupdate: function () {\n\n\t\t\tbeginTime = this.end();\n\n\t\t},\n\n\t\t// Backwards Compatibility\n\n\t\tdomElement: container,\n\t\tsetMode: showPanel\n\n\t};\n\n};\n\nStats.Panel = function ( name, fg, bg ) {\n\n\tvar min = Infinity, max = 0, round = Math.round;\n\tvar PR = round( window.devicePixelRatio || 1 );\n\n\tvar WIDTH = 80 * PR, HEIGHT = 48 * PR,\n\t\tTEXT_X = 3 * PR, TEXT_Y = 2 * PR,\n\t\tGRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,\n\t\tGRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;\n\n\tvar canvas = document.createElement( 'canvas' );\n\tcanvas.width = WIDTH;\n\tcanvas.height = HEIGHT;\n\tcanvas.style.cssText = 'width:80px;height:48px';\n\n\tvar context = canvas.getContext( '2d' );\n\tcontext.font = 'bold ' + ( 9 * PR ) + 'px Helvetica,Arial,sans-serif';\n\tcontext.textBaseline = 'top';\n\n\tcontext.fillStyle = bg;\n\tcontext.fillRect( 0, 0, WIDTH, HEIGHT );\n\n\tcontext.fillStyle = fg;\n\tcontext.fillText( name, TEXT_X, TEXT_Y );\n\tcontext.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );\n\n\tcontext.fillStyle = bg;\n\tcontext.globalAlpha = 0.9;\n\tcontext.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );\n\n\treturn {\n\n\t\tdom: canvas,\n\n\t\tupdate: function ( value, maxValue ) {\n\n\t\t\tmin = Math.min( min, value );\n\t\t\tmax = Math.max( max, value );\n\n\t\t\tcontext.fillStyle = bg;\n\t\t\tcontext.globalAlpha = 1;\n\t\t\tcontext.fillRect( 0, 0, WIDTH, GRAPH_Y );\n\t\t\tcontext.fillStyle = fg;\n\t\t\tcontext.fillText( round( value ) + ' ' + name + ' (' + round( min ) + '-' + round( max ) + ')', TEXT_X, TEXT_Y );\n\n\t\t\tcontext.drawImage( canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT );\n\n\t\t\tcontext.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT );\n\n\t\t\tcontext.fillStyle = bg;\n\t\t\tcontext.globalAlpha = 0.9;\n\t\t\tcontext.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round( ( 1 - ( value / maxValue ) ) * GRAPH_HEIGHT ) );\n\n\t\t}\n\n\t};\n\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Stats);\n\n\n//# sourceURL=webpack://3d_game/./node_modules/three/examples/jsm/libs/stats.module.js?"); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ -/******/ -/******/ // startup -/******/ // Load entry module and return exports -/******/ // This entry module can't be inlined because the eval devtool is used. -/******/ var __webpack_exports__ = __webpack_require__("./src/index.js"); -/******/ -/******/ })() -; \ No newline at end of file +/*! For license information please see bundle.js.LICENSE.txt */ +(()=>{"use strict";const t="168",e=0,n=1,i=2,r=100,a=101,s=102,o=200,l=201,c=202,h=203,u=204,d=205,p=206,f=207,m=208,g=209,v=210,_=211,x=212,y=213,M=214,S=301,E=302,b=306,w=1e3,T=1001,A=1002,R=1003,C=1004,P=1005,L=1006,I=1007,N=1008,U=1009,D=1012,O=1013,F=1014,z=1015,B=1016,V=1017,H=1018,k=1020,G=1023,W=1026,j=1027,q=1029,X=1031,Y=1033,K=33776,Z=33777,J=33778,$=33779,Q=35840,tt=35841,et=35842,nt=35843,it=36196,rt=37492,at=37496,st=37808,ot=37809,lt=37810,ct=37811,ht=37812,ut=37813,dt=37814,pt=37815,ft=37816,mt=37817,gt=37818,vt=37819,_t=37820,xt=37821,yt=36492,Mt=36494,St=36495,Et=36284,bt=36285,wt=36286,Tt=2300,At=2301,Rt=2302,Ct="",Pt="srgb",Lt="srgb-linear",It="display-p3",Nt="display-p3-linear",Ut="linear",Dt="srgb",Ot="rec709",Ft="p3",zt=7680,Bt=512,Vt=513,Ht=514,kt=515,Gt=516,Wt=517,jt=518,qt=519,Xt="300 es",Yt=2e3,Kt=2001;class Zt{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,i=n.length;e>8&255]+Jt[t>>16&255]+Jt[t>>24&255]+"-"+Jt[255&e]+Jt[e>>8&255]+"-"+Jt[e>>16&15|64]+Jt[e>>24&255]+"-"+Jt[63&n|128]+Jt[n>>8&255]+"-"+Jt[n>>16&255]+Jt[n>>24&255]+Jt[255&i]+Jt[i>>8&255]+Jt[i>>16&255]+Jt[i>>24&255]).toLowerCase()}function ee(t,e,n){return Math.max(e,Math.min(n,t))}function ne(t,e,n){return(1-n)*t+n*e}function ie(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function re(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}class ae{constructor(t=0,e=0){ae.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(ee(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*n-a*i+t.x,this.y=r*i+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class se{constructor(t,e,n,i,r,a,s,o,l){se.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,a,s,o,l)}set(t,e,n,i,r,a,s,o,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=s,c[3]=e,c[4]=r,c[5]=o,c[6]=n,c[7]=a,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],_=i[4],x=i[7],y=i[2],M=i[5],S=i[8];return r[0]=a*f+s*v+o*y,r[3]=a*m+s*_+o*M,r[6]=a*g+s*x+o*S,r[1]=l*f+c*v+h*y,r[4]=l*m+c*_+h*M,r[7]=l*g+c*x+h*S,r[2]=u*f+d*v+p*y,r[5]=u*m+d*_+p*M,r[8]=u*g+d*x+p*S,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],c=t[8];return e*a*c-e*s*l-n*r*c+n*s*o+i*r*l-i*a*o}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],c=t[8],h=c*a-s*l,u=s*o-c*r,d=l*r-a*o,p=e*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=h*f,t[1]=(i*l-c*n)*f,t[2]=(s*n-i*a)*f,t[3]=u*f,t[4]=(c*e-i*o)*f,t[5]=(i*r-s*e)*f,t[6]=d*f,t[7]=(n*o-l*e)*f,t[8]=(a*e-n*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,a,s){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*a+l*s)+a+t,-i*l,i*o,-i*(-l*a+o*s)+s+e,0,0,1),this}scale(t,e){return this.premultiply(oe.makeScale(t,e)),this}rotate(t){return this.premultiply(oe.makeRotation(-t)),this}translate(t,e){return this.premultiply(oe.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<9;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const oe=new se;function le(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function ce(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function he(){const t=ce("canvas");return t.style.display="block",t}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;const ue={};function de(t){t in ue||(ue[t]=!0,console.warn(t))}const pe=(new se).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),fe=(new se).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),me={[Lt]:{transfer:Ut,primaries:Ot,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t,fromReference:t=>t},[Pt]:{transfer:Dt,primaries:Ot,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[Nt]:{transfer:Ut,primaries:Ft,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.applyMatrix3(fe),fromReference:t=>t.applyMatrix3(pe)},[It]:{transfer:Dt,primaries:Ft,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.convertSRGBToLinear().applyMatrix3(fe),fromReference:t=>t.applyMatrix3(pe).convertLinearToSRGB()}},ge=new Set([Lt,Nt]),ve={enabled:!0,_workingColorSpace:Lt,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!ge.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,n){if(!1===this.enabled||e===n||!e||!n)return t;const i=me[e].toReference;return(0,me[n].fromReference)(i(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return me[t].primaries},getTransfer:function(t){return t===Ct?Ut:me[t].transfer},getLuminanceCoefficients:function(t,e=this._workingColorSpace){return t.fromArray(me[e].luminanceCoefficients)}};function _e(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function xe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let ye;class Me{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===ye&&(ye=ce("canvas")),ye.width=t.width,ye.height=t.height;const n=ye.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=ye}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=ce("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case w:t.x=t.x-Math.floor(t.x);break;case T:t.x=t.x<0?0:1;break;case A:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case w:t.y=t.y-Math.floor(t.y);break;case T:t.y=t.y<0?0:1;break;case A:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}Te.DEFAULT_IMAGE=null,Te.DEFAULT_MAPPING=300,Te.DEFAULT_ANISOTROPY=1;class Ae{constructor(t=0,e=0,n=0,i=1){Ae.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*e+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*e+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*e+a[7]*n+a[11]*i+a[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const a=.01,s=.1,o=t.elements,l=o[0],c=o[4],h=o[8],u=o[1],d=o[5],p=o[9],f=o[2],m=o[6],g=o[10];if(Math.abs(c-u)o&&t>v?tv?o=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),a=Math.atan2(r,e*n);t=Math.sin(t*a)/r,s=Math.sin(s*a)/r}const r=s*n;if(o=o*t+u*r,l=l*t+d*r,c=c*t+p*r,h=h*t+f*r,t===1-s){const t=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=t,l*=t,c*=t,h*=t}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,a){const s=n[i],o=n[i+1],l=n[i+2],c=n[i+3],h=r[a],u=r[a+1],d=r[a+2],p=r[a+3];return t[e]=s*p+c*h+o*d-l*u,t[e+1]=o*p+c*u+l*h-s*d,t[e+2]=l*p+c*d+s*u-o*h,t[e+3]=c*p-s*h-o*u-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const n=t._x,i=t._y,r=t._z,a=t._order,s=Math.cos,o=Math.sin,l=s(n/2),c=s(i/2),h=s(r/2),u=o(n/2),d=o(i/2),p=o(r/2);switch(a){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],a=e[1],s=e[5],o=e[9],l=e[2],c=e[6],h=e[10],u=n+s+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-o)*t,this._y=(r-l)*t,this._z=(a-i)*t}else if(n>s&&n>h){const t=2*Math.sqrt(1+n-s-h);this._w=(c-o)/t,this._x=.25*t,this._y=(i+a)/t,this._z=(r+l)/t}else if(s>h){const t=2*Math.sqrt(1+s-n-h);this._w=(r-l)/t,this._x=(i+a)/t,this._y=.25*t,this._z=(o+c)/t}else{const t=2*Math.sqrt(1+h-n-s);this._w=(a-i)/t,this._x=(r+l)/t,this._y=(o+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return nMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(ee(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,a=t._w,s=e._x,o=e._y,l=e._z,c=e._w;return this._x=n*c+a*s+i*l-r*o,this._y=i*c+a*o+r*s-n*l,this._z=r*c+a*l+n*o-i*s,this._w=a*c-n*s-i*o-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,a=this._w;let s=a*t._w+n*t._x+i*t._y+r*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;const o=1-s*s;if(o<=Number.EPSILON){const t=1-e;return this._w=t*a+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this}const l=Math.sqrt(o),c=Math.atan2(l,s),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=a*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Ne{constructor(t=0,e=0,n=0){Ne.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(De.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(De.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,a=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,a=t.y,s=t.z,o=t.w,l=2*(a*i-s*n),c=2*(s*e-r*i),h=2*(r*n-a*e);return this.x=e+o*l+a*h-s*c,this.y=n+o*c+s*l-r*h,this.z=i+o*h+r*c-a*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,a=e.x,s=e.y,o=e.z;return this.x=i*o-r*s,this.y=r*a-n*o,this.z=n*s-i*a,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Ue.copy(this).projectOnVector(t),this.sub(Ue)}reflect(t){return this.sub(Ue.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(ee(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Ue=new Ne,De=new Ie;class Oe{constructor(t=new Ne(1/0,1/0,1/0),e=new Ne(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,ze),ze.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(qe),Xe.subVectors(this.max,qe),Ve.subVectors(t.a,qe),He.subVectors(t.b,qe),ke.subVectors(t.c,qe),Ge.subVectors(He,Ve),We.subVectors(ke,He),je.subVectors(Ve,ke);let e=[0,-Ge.z,Ge.y,0,-We.z,We.y,0,-je.z,je.y,Ge.z,0,-Ge.x,We.z,0,-We.x,je.z,0,-je.x,-Ge.y,Ge.x,0,-We.y,We.x,0,-je.y,je.x,0];return!!Ze(e,Ve,He,ke,Xe)&&(e=[1,0,0,0,1,0,0,0,1],!!Ze(e,Ve,He,ke,Xe)&&(Ye.crossVectors(Ge,We),e=[Ye.x,Ye.y,Ye.z],Ze(e,Ve,He,ke,Xe)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ze).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(ze).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Fe[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Fe[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Fe[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Fe[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Fe[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Fe[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Fe[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Fe[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Fe)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Fe=[new Ne,new Ne,new Ne,new Ne,new Ne,new Ne,new Ne,new Ne],ze=new Ne,Be=new Oe,Ve=new Ne,He=new Ne,ke=new Ne,Ge=new Ne,We=new Ne,je=new Ne,qe=new Ne,Xe=new Ne,Ye=new Ne,Ke=new Ne;function Ze(t,e,n,i,r){for(let a=0,s=t.length-3;a<=s;a+=3){Ke.fromArray(t,a);const s=r.x*Math.abs(Ke.x)+r.y*Math.abs(Ke.y)+r.z*Math.abs(Ke.z),o=e.dot(Ke),l=n.dot(Ke),c=i.dot(Ke);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>s)return!1}return!0}const Je=new Oe,$e=new Ne,Qe=new Ne;class tn{constructor(t=new Ne,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):Je.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;ethis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;$e.subVectors(t,this.center);const e=$e.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.addScaledVector($e,n/t),this.radius+=n}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(Qe.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint($e.copy(t.center).add(Qe)),this.expandByPoint($e.copy(t.center).sub(Qe))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const en=new Ne,nn=new Ne,rn=new Ne,an=new Ne,sn=new Ne,on=new Ne,ln=new Ne;class cn{constructor(t=new Ne,e=new Ne(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,en)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=en.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(en.copy(this.origin).addScaledVector(this.direction,e),en.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){nn.copy(t).add(e).multiplyScalar(.5),rn.copy(e).sub(t).normalize(),an.copy(this.origin).sub(nn);const r=.5*t.distanceTo(e),a=-this.direction.dot(rn),s=an.dot(this.direction),o=-an.dot(rn),l=an.lengthSq(),c=Math.abs(1-a*a);let h,u,d,p;if(c>0)if(h=a*o-s,u=a*s-o,p=r*c,h>=0)if(u>=-p)if(u<=p){const t=1/c;h*=t,u*=t,d=h*(h+a*u+2*s)+u*(a*h+u+2*o)+l}else u=r,h=Math.max(0,-(a*u+s)),d=-h*h+u*(u+2*o)+l;else u=-r,h=Math.max(0,-(a*u+s)),d=-h*h+u*(u+2*o)+l;else u<=-p?(h=Math.max(0,-(-a*r+s)),u=h>0?-r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+l):(h=Math.max(0,-(a*r+s)),u=h>0?r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l);else u=a>0?-r:r,h=Math.max(0,-(a*u+s)),d=-h*h+u*(u+2*o)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(nn).addScaledVector(rn,u),d}intersectSphere(t,e){en.subVectors(t.center,this.origin);const n=en.dot(this.direction),i=en.dot(en)-n*n,r=t.radius*t.radius;if(i>r)return null;const a=Math.sqrt(r-i),s=n-a,o=n+a;return o<0?null:s<0?this.at(o,e):this.at(s,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,a,s,o;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,i=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,i=(t.min.x-u.x)*l),c>=0?(r=(t.min.y-u.y)*c,a=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,a=(t.min.y-u.y)*c),n>a||r>i?null:((r>n||isNaN(n))&&(n=r),(a=0?(s=(t.min.z-u.z)*h,o=(t.max.z-u.z)*h):(s=(t.max.z-u.z)*h,o=(t.min.z-u.z)*h),n>o||s>i?null:((s>n||n!=n)&&(n=s),(o=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,en)}intersectTriangle(t,e,n,i,r){sn.subVectors(e,t),on.subVectors(n,t),ln.crossVectors(sn,on);let a,s=this.direction.dot(ln);if(s>0){if(i)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}an.subVectors(this.origin,t);const o=a*this.direction.dot(on.crossVectors(an,on));if(o<0)return null;const l=a*this.direction.dot(sn.cross(an));if(l<0)return null;if(o+l>s)return null;const c=-a*an.dot(ln);return c<0?null:this.at(c/s,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class hn{constructor(t,e,n,i,r,a,s,o,l,c,h,u,d,p,f,m){hn.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,a,s,o,l,c,h,u,d,p,f,m)}set(t,e,n,i,r,a,s,o,l,c,h,u,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new hn).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/un.setFromMatrixColumn(t,0).length(),r=1/un.setFromMatrixColumn(t,1).length(),a=1/un.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,r=t.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=a*c,n=a*h,i=s*c,r=s*h;e[0]=o*c,e[4]=-o*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-s*o,e[2]=r-t*l,e[6]=i+n*l,e[10]=a*o}else if("YXZ"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t+r*s,e[4]=i*s-n,e[8]=a*l,e[1]=a*h,e[5]=a*c,e[9]=-s,e[2]=n*s-i,e[6]=r+t*s,e[10]=a*o}else if("ZXY"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t-r*s,e[4]=-a*h,e[8]=i+n*s,e[1]=n+i*s,e[5]=a*c,e[9]=r-t*s,e[2]=-a*l,e[6]=s,e[10]=a*o}else if("ZYX"===t.order){const t=a*c,n=a*h,i=s*c,r=s*h;e[0]=o*c,e[4]=i*l-n,e[8]=t*l+r,e[1]=o*h,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=s*o,e[10]=a*o}else if("YZX"===t.order){const t=a*o,n=a*l,i=s*o,r=s*l;e[0]=o*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=a*c,e[9]=-s*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=a*o,n=a*l,i=s*o,r=s*l;e[0]=o*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=a*c,e[9]=n*h-i,e[2]=i*h-n,e[6]=s*c,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(pn,t,fn)}lookAt(t,e,n){const i=this.elements;return vn.subVectors(t,e),0===vn.lengthSq()&&(vn.z=1),vn.normalize(),mn.crossVectors(n,vn),0===mn.lengthSq()&&(1===Math.abs(n.z)?vn.x+=1e-4:vn.z+=1e-4,vn.normalize(),mn.crossVectors(n,vn)),mn.normalize(),gn.crossVectors(vn,mn),i[0]=mn.x,i[4]=gn.x,i[8]=vn.x,i[1]=mn.y,i[5]=gn.y,i[9]=vn.y,i[2]=mn.z,i[6]=gn.z,i[10]=vn.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],_=n[7],x=n[11],y=n[15],M=i[0],S=i[4],E=i[8],b=i[12],w=i[1],T=i[5],A=i[9],R=i[13],C=i[2],P=i[6],L=i[10],I=i[14],N=i[3],U=i[7],D=i[11],O=i[15];return r[0]=a*M+s*w+o*C+l*N,r[4]=a*S+s*T+o*P+l*U,r[8]=a*E+s*A+o*L+l*D,r[12]=a*b+s*R+o*I+l*O,r[1]=c*M+h*w+u*C+d*N,r[5]=c*S+h*T+u*P+d*U,r[9]=c*E+h*A+u*L+d*D,r[13]=c*b+h*R+u*I+d*O,r[2]=p*M+f*w+m*C+g*N,r[6]=p*S+f*T+m*P+g*U,r[10]=p*E+f*A+m*L+g*D,r[14]=p*b+f*R+m*I+g*O,r[3]=v*M+_*w+x*C+y*N,r[7]=v*S+_*T+x*P+y*U,r[11]=v*E+_*A+x*L+y*D,r[15]=v*b+_*R+x*I+y*O,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],a=t[1],s=t[5],o=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*o*h-i*l*h-r*s*u+n*l*u+i*s*d-n*o*d)+t[7]*(+e*o*d-e*l*u+r*a*u-i*a*d+i*l*c-r*o*c)+t[11]*(+e*l*h-e*s*d-r*a*h+n*a*d+r*s*c-n*l*c)+t[15]*(-i*s*c-e*o*h+e*s*u+i*a*h-n*a*u+n*o*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=h*m*l-f*u*l+f*o*d-s*m*d-h*o*g+s*u*g,_=p*u*l-c*m*l-p*o*d+a*m*d+c*o*g-a*u*g,x=c*f*l-p*h*l+p*s*d-a*f*d-c*s*g+a*h*g,y=p*h*o-c*f*o-p*s*u+a*f*u+c*s*m-a*h*m,M=e*v+n*_+i*x+r*y;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const S=1/M;return t[0]=v*S,t[1]=(f*u*r-h*m*r-f*i*d+n*m*d+h*i*g-n*u*g)*S,t[2]=(s*m*r-f*o*r+f*i*l-n*m*l-s*i*g+n*o*g)*S,t[3]=(h*o*r-s*u*r-h*i*l+n*u*l+s*i*d-n*o*d)*S,t[4]=_*S,t[5]=(c*m*r-p*u*r+p*i*d-e*m*d-c*i*g+e*u*g)*S,t[6]=(p*o*r-a*m*r-p*i*l+e*m*l+a*i*g-e*o*g)*S,t[7]=(a*u*r-c*o*r+c*i*l-e*u*l-a*i*d+e*o*d)*S,t[8]=x*S,t[9]=(p*h*r-c*f*r-p*n*d+e*f*d+c*n*g-e*h*g)*S,t[10]=(a*f*r-p*s*r+p*n*l-e*f*l-a*n*g+e*s*g)*S,t[11]=(c*s*r-a*h*r-c*n*l+e*h*l+a*n*d-e*s*d)*S,t[12]=y*S,t[13]=(c*f*i-p*h*i+p*n*u-e*f*u-c*n*m+e*h*m)*S,t[14]=(p*s*i-a*f*i-p*n*o+e*f*o+a*n*m-e*s*m)*S,t[15]=(a*h*i-c*s*i+c*n*o-e*h*o-a*n*u+e*s*u)*S,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,a=t.x,s=t.y,o=t.z,l=r*a,c=r*s;return this.set(l*a+n,l*s-i*o,l*o+i*s,0,l*s+i*o,c*s+n,c*o-i*a,0,l*o-i*s,c*o+i*a,r*o*o+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,a){return this.set(1,n,r,0,t,1,a,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,a=e._y,s=e._z,o=e._w,l=r+r,c=a+a,h=s+s,u=r*l,d=r*c,p=r*h,f=a*c,m=a*h,g=s*h,v=o*l,_=o*c,x=o*h,y=n.x,M=n.y,S=n.z;return i[0]=(1-(f+g))*y,i[1]=(d+x)*y,i[2]=(p-_)*y,i[3]=0,i[4]=(d-x)*M,i[5]=(1-(u+g))*M,i[6]=(m+v)*M,i[7]=0,i[8]=(p+_)*S,i[9]=(m-v)*S,i[10]=(1-(u+f))*S,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=un.set(i[0],i[1],i[2]).length();const a=un.set(i[4],i[5],i[6]).length(),s=un.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],dn.copy(this);const o=1/r,l=1/a,c=1/s;return dn.elements[0]*=o,dn.elements[1]*=o,dn.elements[2]*=o,dn.elements[4]*=l,dn.elements[5]*=l,dn.elements[6]*=l,dn.elements[8]*=c,dn.elements[9]*=c,dn.elements[10]*=c,e.setFromRotationMatrix(dn),n.x=r,n.y=a,n.z=s,this}makePerspective(t,e,n,i,r,a,s=2e3){const o=this.elements,l=2*r/(e-t),c=2*r/(n-i),h=(e+t)/(e-t),u=(n+i)/(n-i);let d,p;if(s===Yt)d=-(a+r)/(a-r),p=-2*a*r/(a-r);else{if(s!==Kt)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);d=-a/(a-r),p=-a*r/(a-r)}return o[0]=l,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,i,r,a,s=2e3){const o=this.elements,l=1/(e-t),c=1/(n-i),h=1/(a-r),u=(e+t)*l,d=(n+i)*c;let p,f;if(s===Yt)p=(a+r)*h,f=-2*h;else{if(s!==Kt)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);p=r*h,f=-1*h}return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=f,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const un=new Ne,dn=new hn,pn=new Ne(0,0,0),fn=new Ne(1,1,1),mn=new Ne,gn=new Ne,vn=new Ne,_n=new hn,xn=new Ie;class yn{constructor(t=0,e=0,n=0,i=yn.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,r=i[0],a=i[4],s=i[8],o=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(ee(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-ee(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(ee(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-ee(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(ee(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-ee(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return _n.makeRotationFromQuaternion(t),this.setFromRotationMatrix(_n,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return xn.setFromEuler(this),this.setFromQuaternion(xn,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}yn.DEFAULT_ORDER="XYZ";class Mn{constructor(){this.mask=1}set(t){this.mask=1<>>0}enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map((t=>({boxInitialized:t.boxInitialized,boxMin:t.box.min.toArray(),boxMax:t.box.max.toArray(),sphereInitialized:t.sphereInitialized,sphereRadius:t.sphere.radius,sphereCenter:t.sphere.center.toArray()}))),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(t),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e0){i.children=[];for(let e=0;e0){i.animations=[];for(let e=0;e0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function a(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){zn.subVectors(i,e),Bn.subVectors(n,e),Vn.subVectors(t,e);const a=zn.dot(zn),s=zn.dot(Bn),o=zn.dot(Vn),l=Bn.dot(Bn),c=Bn.dot(Vn),h=a*l-s*s;if(0===h)return r.set(0,0,0),null;const u=1/h,d=(l*o-s*c)*u,p=(a*c-s*o)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return null!==this.getBarycoord(t,e,n,i,Hn)&&Hn.x>=0&&Hn.y>=0&&Hn.x+Hn.y<=1}static getInterpolation(t,e,n,i,r,a,s,o){return null===this.getBarycoord(t,e,n,i,Hn)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,Hn.x),o.addScaledVector(a,Hn.y),o.addScaledVector(s,Hn.z),o)}static isFrontFacing(t,e,n,i){return zn.subVectors(n,e),Bn.subVectors(t,e),zn.cross(Bn).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return zn.subVectors(this.c,this.b),Bn.subVectors(this.a,this.b),.5*zn.cross(Bn).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Yn.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Yn.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,r){return Yn.getInterpolation(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return Yn.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Yn.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let a,s;kn.subVectors(i,n),Gn.subVectors(r,n),jn.subVectors(t,n);const o=kn.dot(jn),l=Gn.dot(jn);if(o<=0&&l<=0)return e.copy(n);qn.subVectors(t,i);const c=kn.dot(qn),h=Gn.dot(qn);if(c>=0&&h<=c)return e.copy(i);const u=o*h-c*l;if(u<=0&&o>=0&&c<=0)return a=o/(o-c),e.copy(n).addScaledVector(kn,a);Xn.subVectors(t,r);const d=kn.dot(Xn),p=Gn.dot(Xn);if(p>=0&&d<=p)return e.copy(r);const f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),e.copy(n).addScaledVector(Gn,s);const m=c*p-d*h;if(m<=0&&h-c>=0&&d-p>=0)return Wn.subVectors(r,i),s=(h-c)/(h-c+(d-p)),e.copy(i).addScaledVector(Wn,s);const g=1/(m+f+u);return a=f*g,s=u*g,e.copy(n).addScaledVector(kn,a).addScaledVector(Gn,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const Kn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Zn={h:0,s:0,l:0},Jn={h:0,s:0,l:0};function $n(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}class Qn{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(void 0===e&&void 0===n){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Pt){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,ve.toWorkingColorSpace(this,e),this}setRGB(t,e,n,i=ve.workingColorSpace){return this.r=t,this.g=e,this.b=n,ve.toWorkingColorSpace(this,i),this}setHSL(t,e,n,i=ve.workingColorSpace){if(t=(t%(r=1)+r)%r,e=ee(e,0,1),n=ee(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=$n(r,i,t+1/3),this.g=$n(r,i,t),this.b=$n(r,i,t-1/3)}var r;return ve.toWorkingColorSpace(this,i),this}setStyle(t,e=Pt){function n(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const a=i[1],s=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(n,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Pt){const n=Kn[t.toLowerCase()];return void 0!==n?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=_e(t.r),this.g=_e(t.g),this.b=_e(t.b),this}copyLinearToSRGB(t){return this.r=xe(t.r),this.g=xe(t.g),this.b=xe(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Pt){return ve.fromWorkingColorSpace(ti.copy(this),t),65536*Math.round(ee(255*ti.r,0,255))+256*Math.round(ee(255*ti.g,0,255))+Math.round(ee(255*ti.b,0,255))}getHexString(t=Pt){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=ve.workingColorSpace){ve.fromWorkingColorSpace(ti.copy(this),e);const n=ti.r,i=ti.g,r=ti.b,a=Math.max(n,i,r),s=Math.min(n,i,r);let o,l;const c=(s+a)/2;if(s===a)o=0,l=0;else{const t=a-s;switch(l=c<=.5?t/(a+s):t/(2-a-s),a){case n:o=(i-r)/t+(i0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),204!==this.blendSrc&&(n.blendSrc=this.blendSrc),205!==this.blendDst&&(n.blendDst=this.blendDst),this.blendEquation!==r&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==zt&&(n.stencilFail=this.stencilFail),this.stencilZFail!==zt&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==zt&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class ii extends ni{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Qn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new yn,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const ri=new Ne,ai=new ae;class si{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=n,this.usage=35044,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=z,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}get updateRange(){return de("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const e in n){const i=n[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],a=[];for(let e=0,i=n.length;e0&&(i[e]=a,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const s=this.boundingSphere;return null!==s&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const t in i){const n=i[t];this.setAttribute(t,n.clone(e))}const r=t.morphAttributes;for(const t in r){const n=[],i=r[t];for(let t=0,r=i.length;t0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t(t.far-t.near)**2)return}_i.copy(r).invert(),xi.copy(t.ray).applyMatrix4(_i),null!==n.boundingBox&&!1===xi.intersectsBox(n.boundingBox)||this._computeIntersections(t,e,xi)}}_computeIntersections(t,e,n){let i;const r=this.geometry,a=this.material,s=r.index,o=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==s)if(Array.isArray(a))for(let r=0,o=u.length;rn.far?null:{distance:c,point:Ui.clone(),object:t}}(t,e,n,i,Si,Ei,bi,Ni);if(h){r&&(Ai.fromBufferAttribute(r,o),Ri.fromBufferAttribute(r,l),Ci.fromBufferAttribute(r,c),h.uv=Yn.getInterpolation(Ni,Si,Ei,bi,Ai,Ri,Ci,new ae)),a&&(Ai.fromBufferAttribute(a,o),Ri.fromBufferAttribute(a,l),Ci.fromBufferAttribute(a,c),h.uv1=Yn.getInterpolation(Ni,Si,Ei,bi,Ai,Ri,Ci,new ae)),s&&(Pi.fromBufferAttribute(s,o),Li.fromBufferAttribute(s,l),Ii.fromBufferAttribute(s,c),h.normal=Yn.getInterpolation(Ni,Si,Ei,bi,Pi,Li,Ii,new Ne),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const t={a:o,b:l,c,normal:new Ne,materialIndex:0};Yn.getNormal(Si,Ei,bi,t.normal),h.face=t}return h}class Fi extends vi{constructor(t=1,e=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const s=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const o=[],l=[],c=[],h=[];let u=0,d=0;function p(t,e,n,i,r,a,p,f,m,g,v){const _=a/m,x=p/g,y=a/2,M=p/2,S=f/2,E=m+1,b=g+1;let w=0,T=0;const A=new Ne;for(let a=0;a0?1:-1,c.push(A.x,A.y,A.z),h.push(o/m),h.push(1-a/g),w+=1}}for(let t=0;t0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class Gi extends Fn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new hn,this.projectionMatrix=new hn,this.projectionMatrixInverse=new hn,this.coordinateSystem=Yt}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const Wi=new Ne,ji=new ae,qi=new ae;class Xi extends Gi{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Qt*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*$t*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*Qt*Math.atan(Math.tan(.5*$t*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){Wi.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(Wi.x,Wi.y).multiplyScalar(-t/Wi.z),Wi.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Wi.x,Wi.y).multiplyScalar(-t/Wi.z)}getViewSize(t,e){return this.getViewBounds(t,ji,qi),e.subVectors(qi,ji)}setViewOffset(t,e,n,i,r,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*$t*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const a=this.view;if(null!==this.view&&this.view.enabled){const t=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/t,e-=a.offsetY*n/s,i*=a.width/t,n*=a.height/s}const s=this.filmOffset;0!==s&&(r+=t*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const Yi=-90;class Ki extends Fn{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Xi(Yi,1,t,e);i.layers=this.layers,this.add(i);const r=new Xi(Yi,1,t,e);r.layers=this.layers,this.add(r);const a=new Xi(Yi,1,t,e);a.layers=this.layers,this.add(a);const s=new Xi(Yi,1,t,e);s.layers=this.layers,this.add(s);const o=new Xi(Yi,1,t,e);o.layers=this.layers,this.add(o);const l=new Xi(Yi,1,t,e);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,i,r,a,s,o]=e;for(const t of e)this.remove(t);if(t===Yt)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(t!==Kt)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,a,s,o,l,c]=this.children,h=t.getRenderTarget(),u=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,i),t.render(e,r),t.setRenderTarget(n,1,i),t.render(e,a),t.setRenderTarget(n,2,i),t.render(e,s),t.setRenderTarget(n,3,i),t.render(e,o),t.setRenderTarget(n,4,i),t.render(e,l),n.texture.generateMipmaps=f,t.setRenderTarget(n,5,i),t.render(e,c),t.setRenderTarget(h,u,d),t.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class Zi extends Te{constructor(t,e,n,i,r,a,s,o,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:S,n,i,r,a,s,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class Ji extends Ce{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new Zi(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:L}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={tEquirect:{value:null}},i="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new Fi(5,5,5),s=new ki({name:"CubemapFromEquirect",uniforms:zi(n),vertexShader:i,fragmentShader:r,side:1,blending:0});s.uniforms.tEquirect.value=e;const o=new Di(a,s),l=e.minFilter;return e.minFilter===N&&(e.minFilter=L),new Ki(1,10,this).update(t,o),e.minFilter=l,o.geometry.dispose(),o.material.dispose(),this}clear(t,e,n,i){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,n,i);t.setRenderTarget(r)}}const $i=new Ne,Qi=new Ne,tr=new se;class er{constructor(t=new Ne(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=$i.subVectors(n,e).cross(Qi.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta($i),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(t.start).addScaledVector(n,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||tr.getNormalMatrix(t),i=this.coplanarPoint($i).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const nr=new tn,ir=new Ne;class rr{constructor(t=new er,e=new er,n=new er,i=new er,r=new er,a=new er){this.planes=[t,e,n,i,r,a]}set(t,e,n,i,r,a){const s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(a),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=2e3){const n=this.planes,i=t.elements,r=i[0],a=i[1],s=i[2],o=i[3],l=i[4],c=i[5],h=i[6],u=i[7],d=i[8],p=i[9],f=i[10],m=i[11],g=i[12],v=i[13],_=i[14],x=i[15];if(n[0].setComponents(o-r,u-l,m-d,x-g).normalize(),n[1].setComponents(o+r,u+l,m+d,x+g).normalize(),n[2].setComponents(o+a,u+c,m+p,x+v).normalize(),n[3].setComponents(o-a,u-c,m-p,x-v).normalize(),n[4].setComponents(o-s,u-h,m-f,x-_).normalize(),e===Yt)n[5].setComponents(o+s,u+h,m+f,x+_).normalize();else{if(e!==Kt)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);n[5].setComponents(s,h,f,_).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),nr.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),nr.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(nr)}intersectsSprite(t){return nr.center.set(0,0,0),nr.radius=.7071067811865476,nr.applyMatrix4(t.matrixWorld),this.intersectsSphere(nr)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(n)0?t.max.x:t.min.x,ir.y=i.normal.y>0?t.max.y:t.min.y,ir.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(ir)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function ar(){let t=null,e=!1,n=null,i=null;function r(e,a){n(e,a),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function sr(t){const e=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=e.get(n);i&&(t.deleteBuffer(i.buffer),e.delete(n))},update:function(n,i){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){const t=e.get(n);return void((!t||t.version 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},cr={common:{diffuse:{value:new Qn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new se},alphaMap:{value:null},alphaMapTransform:{value:new se},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new se}},envmap:{envMap:{value:null},envMapRotation:{value:new se},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new se}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new se}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new se},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new se},normalScale:{value:new ae(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new se},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new se}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new se}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new se}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Qn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Qn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new se},alphaTest:{value:0},uvTransform:{value:new se}},sprite:{diffuse:{value:new Qn(16777215)},opacity:{value:1},center:{value:new ae(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new se},alphaMap:{value:null},alphaMapTransform:{value:new se},alphaTest:{value:0}}},hr={basic:{uniforms:Bi([cr.common,cr.specularmap,cr.envmap,cr.aomap,cr.lightmap,cr.fog]),vertexShader:lr.meshbasic_vert,fragmentShader:lr.meshbasic_frag},lambert:{uniforms:Bi([cr.common,cr.specularmap,cr.envmap,cr.aomap,cr.lightmap,cr.emissivemap,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.fog,cr.lights,{emissive:{value:new Qn(0)}}]),vertexShader:lr.meshlambert_vert,fragmentShader:lr.meshlambert_frag},phong:{uniforms:Bi([cr.common,cr.specularmap,cr.envmap,cr.aomap,cr.lightmap,cr.emissivemap,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.fog,cr.lights,{emissive:{value:new Qn(0)},specular:{value:new Qn(1118481)},shininess:{value:30}}]),vertexShader:lr.meshphong_vert,fragmentShader:lr.meshphong_frag},standard:{uniforms:Bi([cr.common,cr.envmap,cr.aomap,cr.lightmap,cr.emissivemap,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.roughnessmap,cr.metalnessmap,cr.fog,cr.lights,{emissive:{value:new Qn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:lr.meshphysical_vert,fragmentShader:lr.meshphysical_frag},toon:{uniforms:Bi([cr.common,cr.aomap,cr.lightmap,cr.emissivemap,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.gradientmap,cr.fog,cr.lights,{emissive:{value:new Qn(0)}}]),vertexShader:lr.meshtoon_vert,fragmentShader:lr.meshtoon_frag},matcap:{uniforms:Bi([cr.common,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.fog,{matcap:{value:null}}]),vertexShader:lr.meshmatcap_vert,fragmentShader:lr.meshmatcap_frag},points:{uniforms:Bi([cr.points,cr.fog]),vertexShader:lr.points_vert,fragmentShader:lr.points_frag},dashed:{uniforms:Bi([cr.common,cr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:lr.linedashed_vert,fragmentShader:lr.linedashed_frag},depth:{uniforms:Bi([cr.common,cr.displacementmap]),vertexShader:lr.depth_vert,fragmentShader:lr.depth_frag},normal:{uniforms:Bi([cr.common,cr.bumpmap,cr.normalmap,cr.displacementmap,{opacity:{value:1}}]),vertexShader:lr.meshnormal_vert,fragmentShader:lr.meshnormal_frag},sprite:{uniforms:Bi([cr.sprite,cr.fog]),vertexShader:lr.sprite_vert,fragmentShader:lr.sprite_frag},background:{uniforms:{uvTransform:{value:new se},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:lr.background_vert,fragmentShader:lr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new se}},vertexShader:lr.backgroundCube_vert,fragmentShader:lr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:lr.cube_vert,fragmentShader:lr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:lr.equirect_vert,fragmentShader:lr.equirect_frag},distanceRGBA:{uniforms:Bi([cr.common,cr.displacementmap,{referencePosition:{value:new Ne},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:lr.distanceRGBA_vert,fragmentShader:lr.distanceRGBA_frag},shadow:{uniforms:Bi([cr.lights,cr.fog,{color:{value:new Qn(0)},opacity:{value:1}}]),vertexShader:lr.shadow_vert,fragmentShader:lr.shadow_frag}};hr.physical={uniforms:Bi([hr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new se},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new se},clearcoatNormalScale:{value:new ae(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new se},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new se},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new se},sheen:{value:0},sheenColor:{value:new Qn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new se},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new se},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new se},transmissionSamplerSize:{value:new ae},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new se},attenuationDistance:{value:0},attenuationColor:{value:new Qn(0)},specularColor:{value:new Qn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new se},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new se},anisotropyVector:{value:new ae},anisotropyMap:{value:null},anisotropyMapTransform:{value:new se}}]),vertexShader:lr.meshphysical_vert,fragmentShader:lr.meshphysical_frag};const ur={r:0,b:0,g:0},dr=new yn,pr=new hn;function fr(t,e,n,i,r,a,s){const o=new Qn(0);let l,c,h=!0===a?0:1,u=null,d=0,p=null;function f(t){let i=!0===t.isScene?t.background:null;return i&&i.isTexture&&(i=(t.backgroundBlurriness>0?n:e).get(i)),i}function m(e,n){e.getRGB(ur,Vi(t)),i.buffers.color.setClear(ur.r,ur.g,ur.b,n,s)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),h=e,m(o,h)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,m(o,h)},render:function(e){let n=!1;const r=f(e);null===r?m(o,h):r&&r.isColor&&(m(r,1),n=!0);const a=t.xr.getEnvironmentBlendMode();"additive"===a?i.buffers.color.setClear(0,0,0,1,s):"alpha-blend"===a&&i.buffers.color.setClear(0,0,0,0,s),(t.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))},addToRenderList:function(e,n){const i=f(n);i&&(i.isCubeTexture||i.mapping===b)?(void 0===c&&(c=new Di(new Fi(1,1,1),new ki({name:"BackgroundCubeMaterial",uniforms:zi(hr.backgroundCube.uniforms),vertexShader:hr.backgroundCube.vertexShader,fragmentShader:hr.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),dr.copy(n.backgroundRotation),dr.x*=-1,dr.y*=-1,dr.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(dr.y*=-1,dr.z*=-1),c.material.uniforms.envMap.value=i,c.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(pr.makeRotationFromEuler(dr)),c.material.toneMapped=ve.getTransfer(i.colorSpace)!==Dt,u===i&&d===i.version&&p===t.toneMapping||(c.material.needsUpdate=!0,u=i,d=i.version,p=t.toneMapping),c.layers.enableAll(),e.unshift(c,c.geometry,c.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new Di(new or(2,2),new ki({name:"BackgroundMaterial",uniforms:zi(hr.background.uniforms),vertexShader:hr.background.vertexShader,fragmentShader:hr.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=ve.getTransfer(i.colorSpace)!==Dt,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),u===i&&d===i.version&&p===t.toneMapping||(l.material.needsUpdate=!0,u=i,d=i.version,p=t.toneMapping),l.layers.enableAll(),e.unshift(l,l.geometry,l.material,0,0,null))}}}function mr(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},r=c(null);let a=r,s=!1;function o(e){return t.bindVertexArray(e)}function l(e){return t.deleteVertexArray(e)}function c(t){const e=[],i=[],r=[];for(let t=0;t=0){const n=r[e];let i=s[e];if(void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;o++}return a.attributesNum!==o||a.index!==i}(n,m,l,g),v&&function(t,e,n,i){const r={},s=e.attributes;let o=0;const l=n.getAttributes();for(const e in l)if(l[e].location>=0){let n=s[e];void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[e]=i,o++}a.attributes=r,a.attributesNum=o,a.index=i}(n,m,l,g),null!==g&&e.update(g,t.ELEMENT_ARRAY_BUFFER),(v||s)&&(s=!1,function(n,i,r,a){h();const s=a.attributes,o=r.getAttributes(),l=i.defaultAttributeValues;for(const i in o){const r=o[i];if(r.location>=0){let o=s[i];if(void 0===o&&("instanceMatrix"===i&&n.instanceMatrix&&(o=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(o=n.instanceColor)),void 0!==o){const i=o.normalized,s=o.itemSize,l=e.get(o);if(void 0===l)continue;const c=l.buffer,h=l.type,p=l.bytesPerElement,m=h===t.INT||h===t.UNSIGNED_INT||o.gpuType===O;if(o.isInterleavedBufferAttribute){const e=o.data,l=e.stride,g=o.offset;if(e.isInstancedInterleavedBuffer){for(let t=0;t0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=void 0!==n.precision?n.precision:"highp";const o=a(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);const l=!0===n.logarithmicDepthBuffer,c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,textureFormatReadable:function(e){return e===G||i.convert(e)===t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===B&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(n!==U&&i.convert(n)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==z&&!r)},precision:s,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxCubemapSize:t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:t.getParameter(t.MAX_VERTEX_ATTRIBS),maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:t.getParameter(t.MAX_VARYING_VECTORS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:t.getParameter(t.MAX_SAMPLES)}}function _r(t){const e=this;let n=null,i=0,r=!1,a=!1;const s=new er,o=new se,l={value:null,needsUpdate:!1};function c(t,n,i,r){const a=null!==t?t.length:0;let c=null;if(0!==a){if(c=l.value,!0!==r||null===c){const e=i+4*a,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length0),e.numPlanes=i,e.numIntersection=0);else{const t=a?0:i,e=4*t;let r=f.clippingState||null;l.value=r,r=c(u,o,e,h);for(let t=0;t!==e;++t)r[t]=n[t];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function xr(t){let e=new WeakMap;function n(t,e){return 303===e?t.mapping=S:304===e&&(t.mapping=E),t}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping;if(303===a||304===a){if(e.has(r))return n(e.get(r).texture,r.mapping);{const a=r.image;if(a&&a.height>0){const s=new Ji(a.height);return s.fromEquirectangularTexture(t,r),e.set(r,s),r.addEventListener("dispose",i),n(s.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}class yr extends Gi{constructor(t=-1,e=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,a=n+t,s=i+e,o=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,a=r+t*this.view.width,s-=e*this.view.offsetY,o=s-e*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}const Mr=[.125,.215,.35,.446,.526,.582],Sr=new yr,Er=new Qn;let br=null,wr=0,Tr=0,Ar=!1;const Rr=(1+Math.sqrt(5))/2,Cr=1/Rr,Pr=[new Ne(-Rr,Cr,0),new Ne(Rr,Cr,0),new Ne(-Cr,0,Rr),new Ne(Cr,0,Rr),new Ne(0,Rr,-Cr),new Ne(0,Rr,Cr),new Ne(-1,1,-1),new Ne(1,1,-1),new Ne(-1,1,1),new Ne(1,1,1)];class Lr{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){br=this._renderer.getRenderTarget(),wr=this._renderer.getActiveCubeFace(),Tr=this._renderer.getActiveMipmapLevel(),Ar=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Dr(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Ur(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;tt-4?o=Mr[s-t+4-1]:0===s&&(o=0),i.push(o);const l=1/(a-2),c=-l,h=1+l,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=6,p=6,f=3,m=2,g=1,v=new Float32Array(f*p*d),_=new Float32Array(m*p*d),x=new Float32Array(g*p*d);for(let t=0;t2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];v.set(i,f*p*t),_.set(u,m*p*t);const r=[t,t,t,t,t,t];x.set(r,g*p*t)}const y=new vi;y.setAttribute("position",new si(v,f)),y.setAttribute("uv",new si(_,m)),y.setAttribute("faceIndex",new si(x,g)),e.push(y),r>4&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(t,e,n){const i=new Float32Array(20),r=new Ne(0,1,0);return new ki({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(i,t,e)}return i}_compileMaterial(t){const e=new Di(this._lodPlanes[0],t);this._renderer.compile(e,Sr)}_sceneToCubeUV(t,e,n,i){const r=new Xi(90,1,e,n),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,c=o.toneMapping;o.getClearColor(Er),o.toneMapping=0,o.autoClear=!1;const h=new ii({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),u=new Di(new Fi,h);let d=!1;const p=t.background;p?p.isColor&&(h.color.copy(p),t.background=null,d=!0):(h.color.copy(Er),d=!0);for(let e=0;e<6;e++){const n=e%3;0===n?(r.up.set(0,a[e],0),r.lookAt(s[e],0,0)):1===n?(r.up.set(0,0,a[e]),r.lookAt(0,s[e],0)):(r.up.set(0,a[e],0),r.lookAt(0,0,s[e]));const l=this._cubeSize;Nr(i,n*l,e>2?l:0,l,l),o.setRenderTarget(i),d&&o.render(u,r),o.render(t,r)}u.geometry.dispose(),u.material.dispose(),o.toneMapping=c,o.autoClear=l,t.background=p}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===S||t.mapping===E;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Dr()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Ur());const r=i?this._cubemapMaterial:this._equirectMaterial,a=new Di(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const s=this._cubeSize;Nr(e,0,0,3*s,2*s),n.setRenderTarget(e),n.render(a,Sr)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;const i=this._lodPlanes.length;for(let e=1;e20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let t=0;t<20;++t){const e=t/p,n=Math.exp(-e*e/2);m.push(n),0===t?g+=n:tv-4?i-v+4:0),4*(this._cubeSize-_),3*_,2*_),o.setRenderTarget(e),o.render(c,Sr)}}function Ir(t,e,n){const i=new Ce(t,e,n);return i.texture.mapping=b,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Nr(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Ur(){return new ki({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Dr(){return new ki({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Or(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping,s=303===a||304===a,o=a===S||a===E;if(s||o){let a=e.get(r);const l=void 0!==a?a.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new Lr(t)),a=s?n.fromEquirectangular(r,a):n.fromCubemap(r,a),a.texture.pmremVersion=r.pmremVersion,e.set(r,a),a.texture;if(void 0!==a)return a.texture;{const l=r.image;return s&&l&&l.height>0||o&&l&&function(t){let e=0;for(let n=0;n<6;n++)void 0!==t[n]&&e++;return 6===e}(l)?(null===n&&(n=new Lr(t)),a=s?n.fromEquirectangular(r):n.fromCubemap(r),a.texture.pmremVersion=r.pmremVersion,e.set(r,a),r.addEventListener("dispose",i),a.texture):null}}}return r},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function Fr(t){const e={};function n(n){if(void 0!==e[n])return e[n];let i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}return{has:function(t){return null!==n(t)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(t){const e=n(t);return null===e&&de("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function zr(t,e,n,i){const r={},a=new WeakMap;function s(t){const o=t.target;null!==o.index&&e.remove(o.index);for(const t in o.attributes)e.remove(o.attributes[t]);for(const t in o.morphAttributes){const n=o.morphAttributes[t];for(let t=0,i=n.length;te.maxTextureSize&&(y=Math.ceil(x/e.maxTextureSize),x=e.maxTextureSize);const M=new Float32Array(x*y*4*h),S=new Pe(M,x,y,h);S.type=z,S.needsUpdate=!0;const E=4*_;for(let w=0;w0)return t;const r=e*n;let a=Kr[r];if(void 0===a&&(a=new Float32Array(r),Kr[r]=a),0!==e){i.toArray(a,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(a,r)}return a}function ea(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n":" "} ${r}: ${n[t]}`)}return i.join("\n")}(t.getShaderSource(e),i)}return r}function $a(t,e){const n=function(t){const e=ve.getPrimaries(ve.workingColorSpace),n=ve.getPrimaries(t);let i;switch(e===n?i="":e===Ft&&n===Ot?i="LinearDisplayP3ToLinearSRGB":e===Ot&&n===Ft&&(i="LinearSRGBToLinearDisplayP3"),t){case Lt:case Nt:return[i,"LinearTransferOETF"];case Pt:case It:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[i,"LinearTransferOETF"]}}(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function Qa(t,e){let n;switch(e){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="Cineon";break;case 4:n="ACESFilmic";break;case 6:n="AgX";break;case 7:n="Neutral";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const ts=new Ne;function es(t){return""!==t}function ns(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function is(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const rs=/^[ \t]*#include +<([\w\d./]+)>/gm;function as(t){return t.replace(rs,os)}const ss=new Map;function os(t,e){let n=lr[e];if(void 0===n){const t=ss.get(e);if(void 0===t)throw new Error("Can not resolve #include <"+e+">");n=lr[t],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,t)}return as(n)}const ls=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function cs(t){return t.replace(ls,hs)}function hs(t,e,n,i){let r="";for(let t=parseInt(e);t0&&(g+="\n"),v=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f].filter(es).join("\n"),v.length>0&&(v+="\n")):(g=[us(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(es).join("\n"),v=[us(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?lr.tonemapping_pars_fragment:"",0!==n.toneMapping?Qa("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",lr.colorspace_pars_fragment,$a("linearToOutputTexel",n.outputColorSpace),(ve.getLuminanceCoefficients(ts),["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${ts.x.toFixed(4)}, ${ts.y.toFixed(4)}, ${ts.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(es).join("\n")),s=as(s),s=ns(s,n),s=is(s,n),o=as(o),o=ns(o,n),o=is(o,n),s=cs(s),o=cs(o),!0!==n.isRawShaderMaterial&&(_="#version 300 es\n",g=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in",n.glslVersion===Xt?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Xt?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+v);const x=_+g+s,y=_+v+o,M=Ka(r,r.VERTEX_SHADER,x),w=Ka(r,r.FRAGMENT_SHADER,y);function T(e){if(t.debug.checkShaderErrors){const n=r.getProgramInfoLog(m).trim(),i=r.getShaderInfoLog(M).trim(),a=r.getShaderInfoLog(w).trim();let s=!0,o=!0;if(!1===r.getProgramParameter(m,r.LINK_STATUS))if(s=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(r,m,M,w);else{const t=Ja(r,M,"vertex"),i=Ja(r,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(m,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+e.name+"\nMaterial Type: "+e.type+"\n\nProgram Info Log: "+n+"\n"+t+"\n"+i)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==a||(o=!1);o&&(e.diagnostics={runnable:s,programLog:n,vertexShader:{log:i,prefix:g},fragmentShader:{log:a,prefix:v}})}r.deleteShader(M),r.deleteShader(w),A=new Ya(r,m),R=function(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r0,X=a.clearcoat>0,Y=a.dispersion>0,K=a.iridescence>0,Z=a.sheen>0,J=a.transmission>0,$=q&&!!a.anisotropyMap,Q=X&&!!a.clearcoatMap,tt=X&&!!a.clearcoatNormalMap,et=X&&!!a.clearcoatRoughnessMap,nt=K&&!!a.iridescenceMap,it=K&&!!a.iridescenceThicknessMap,rt=Z&&!!a.sheenColorMap,at=Z&&!!a.sheenRoughnessMap,st=!!a.specularMap,ot=!!a.specularColorMap,lt=!!a.specularIntensityMap,ct=J&&!!a.transmissionMap,ht=J&&!!a.thicknessMap,ut=!!a.gradientMap,dt=!!a.alphaMap,pt=a.alphaTest>0,ft=!!a.alphaHash,mt=!!a.extensions;let gt=0;a.toneMapped&&(null!==I&&!0!==I.isXRRenderTarget||(gt=t.toneMapping));const vt={shaderID:E,shaderType:a.type,shaderName:a.name,vertexShader:A,fragmentShader:R,defines:a.defines,customVertexShaderID:C,customFragmentShaderID:P,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,batching:U,batchingColor:U&&null!==v._colorsTexture,instancing:N,instancingColor:N&&null!==v.instanceColor,instancingMorph:N&&null!==v.morphTexture,supportsVertexTextures:d,outputColorSpace:null===I?t.outputColorSpace:!0===I.isXRRenderTarget?I.texture.colorSpace:Lt,alphaToCoverage:!!a.alphaToCoverage,map:D,matcap:O,envMap:F,envMapMode:F&&M.mapping,envMapCubeUVHeight:S,aoMap:z,lightMap:B,bumpMap:V,normalMap:H,displacementMap:d&&k,emissiveMap:G,normalMapObjectSpace:H&&1===a.normalMapType,normalMapTangentSpace:H&&0===a.normalMapType,metalnessMap:W,roughnessMap:j,anisotropy:q,anisotropyMap:$,clearcoat:X,clearcoatMap:Q,clearcoatNormalMap:tt,clearcoatRoughnessMap:et,dispersion:Y,iridescence:K,iridescenceMap:nt,iridescenceThicknessMap:it,sheen:Z,sheenColorMap:rt,sheenRoughnessMap:at,specularMap:st,specularColorMap:ot,specularIntensityMap:lt,transmission:J,transmissionMap:ct,thicknessMap:ht,gradientMap:ut,opaque:!1===a.transparent&&1===a.blending&&!1===a.alphaToCoverage,alphaMap:dt,alphaTest:pt,alphaHash:ft,combine:a.combine,mapUv:D&&m(a.map.channel),aoMapUv:z&&m(a.aoMap.channel),lightMapUv:B&&m(a.lightMap.channel),bumpMapUv:V&&m(a.bumpMap.channel),normalMapUv:H&&m(a.normalMap.channel),displacementMapUv:k&&m(a.displacementMap.channel),emissiveMapUv:G&&m(a.emissiveMap.channel),metalnessMapUv:W&&m(a.metalnessMap.channel),roughnessMapUv:j&&m(a.roughnessMap.channel),anisotropyMapUv:$&&m(a.anisotropyMap.channel),clearcoatMapUv:Q&&m(a.clearcoatMap.channel),clearcoatNormalMapUv:tt&&m(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:et&&m(a.clearcoatRoughnessMap.channel),iridescenceMapUv:nt&&m(a.iridescenceMap.channel),iridescenceThicknessMapUv:it&&m(a.iridescenceThicknessMap.channel),sheenColorMapUv:rt&&m(a.sheenColorMap.channel),sheenRoughnessMapUv:at&&m(a.sheenRoughnessMap.channel),specularMapUv:st&&m(a.specularMap.channel),specularColorMapUv:ot&&m(a.specularColorMap.channel),specularIntensityMapUv:lt&&m(a.specularIntensityMap.channel),transmissionMapUv:ct&&m(a.transmissionMap.channel),thicknessMapUv:ht&&m(a.thicknessMap.channel),alphaMapUv:dt&&m(a.alphaMap.channel),vertexTangents:!!x.attributes.tangent&&(H||q),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!x.attributes.color&&4===x.attributes.color.itemSize,pointsUvs:!0===v.isPoints&&!!x.attributes.uv&&(D||dt),fog:!!_,useFog:!0===a.fog,fogExp2:!!_&&_.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:u,skinning:!0===v.isSkinnedMesh,morphTargets:void 0!==x.morphAttributes.position,morphNormals:void 0!==x.morphAttributes.normal,morphColors:void 0!==x.morphAttributes.color,morphTargetsCount:T,morphTextureStride:L,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.length>0,shadowMapType:t.shadowMap.type,toneMapping:gt,decodeVideoTexture:D&&!0===a.map.isVideoTexture&&ve.getTransfer(a.map.colorSpace)===Dt,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:mt&&!0===a.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(mt&&!0===a.extensions.multiDraw||U)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return vt.vertexUv1s=c.has(1),vt.vertexUv2s=c.has(2),vt.vertexUv3s=c.has(3),c.clear(),vt},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(function(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.numLightProbes),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(n,e),function(t,e){o.disableAll(),e.supportsVertexTextures&&o.enable(0),e.instancing&&o.enable(1),e.instancingColor&&o.enable(2),e.instancingMorph&&o.enable(3),e.matcap&&o.enable(4),e.envMap&&o.enable(5),e.normalMapObjectSpace&&o.enable(6),e.normalMapTangentSpace&&o.enable(7),e.clearcoat&&o.enable(8),e.iridescence&&o.enable(9),e.alphaTest&&o.enable(10),e.vertexColors&&o.enable(11),e.vertexAlphas&&o.enable(12),e.vertexUv1s&&o.enable(13),e.vertexUv2s&&o.enable(14),e.vertexUv3s&&o.enable(15),e.vertexTangents&&o.enable(16),e.anisotropy&&o.enable(17),e.alphaHash&&o.enable(18),e.batching&&o.enable(19),e.dispersion&&o.enable(20),e.batchingColor&&o.enable(21),t.push(o.mask),o.disableAll(),e.fog&&o.enable(0),e.useFog&&o.enable(1),e.flatShading&&o.enable(2),e.logarithmicDepthBuffer&&o.enable(3),e.skinning&&o.enable(4),e.morphTargets&&o.enable(5),e.morphNormals&&o.enable(6),e.morphColors&&o.enable(7),e.premultipliedAlpha&&o.enable(8),e.shadowMapEnabled&&o.enable(9),e.doubleSided&&o.enable(10),e.flipSided&&o.enable(11),e.useDepthPacking&&o.enable(12),e.dithering&&o.enable(13),e.transmission&&o.enable(14),e.sheen&&o.enable(15),e.opaque&&o.enable(16),e.pointsUvs&&o.enable(17),e.decodeVideoTexture&&o.enable(18),e.alphaToCoverage&&o.enable(19),t.push(o.mask)}(n,e),n.push(t.outputColorSpace)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=f[t.type];let n;if(e){const t=hr[e];n=Hi.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=h.length;t0?i.push(h):!0===s.transparent?r.push(h):n.push(h)},unshift:function(t,e,s,o,l,c){const h=a(t,e,s,o,l,c);s.transmission>0?i.unshift(h):!0===s.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=e,i=t.length;n1&&n.sort(t||_s),i.length>1&&i.sort(e||xs),r.length>1&&r.sort(e||xs)}}}function Ms(){let t=new WeakMap;return{get:function(e,n){const i=t.get(e);let r;return void 0===i?(r=new ys,t.set(e,[r])):n>=i.length?(r=new ys,i.push(r)):r=i[n],r},dispose:function(){t=new WeakMap}}}function Ss(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Ne,color:new Qn};break;case"SpotLight":n={position:new Ne,direction:new Ne,color:new Qn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ne,color:new Qn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ne,skyColor:new Qn,groundColor:new Qn};break;case"RectAreaLight":n={color:new Qn,position:new Ne,halfWidth:new Ne,halfHeight:new Ne}}return t[e.id]=n,n}}}let Es=0;function bs(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function ws(t){const e=new Ss,n=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ae};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ae,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let t=0;t<9;t++)i.probe.push(new Ne);const r=new Ne,a=new hn,s=new hn;return{setup:function(r){let a=0,s=0,o=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let l=0,c=0,h=0,u=0,d=0,p=0,f=0,m=0,g=0,v=0,_=0;r.sort(bs);for(let t=0,x=r.length;t0&&(!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=cr.LTC_FLOAT_1,i.rectAreaLTC2=cr.LTC_FLOAT_2):(i.rectAreaLTC1=cr.LTC_HALF_1,i.rectAreaLTC2=cr.LTC_HALF_2)),i.ambient[0]=a,i.ambient[1]=s,i.ambient[2]=o;const x=i.hash;x.directionalLength===l&&x.pointLength===c&&x.spotLength===h&&x.rectAreaLength===u&&x.hemiLength===d&&x.numDirectionalShadows===p&&x.numPointShadows===f&&x.numSpotShadows===m&&x.numSpotMaps===g&&x.numLightProbes===_||(i.directional.length=l,i.spot.length=h,i.rectArea.length=u,i.point.length=c,i.hemi.length=d,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=f,i.pointShadowMap.length=f,i.spotShadow.length=m,i.spotShadowMap.length=m,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=f,i.spotLightMatrix.length=m+g-v,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=v,i.numLightProbes=_,x.directionalLength=l,x.pointLength=c,x.spotLength=h,x.rectAreaLength=u,x.hemiLength=d,x.numDirectionalShadows=p,x.numPointShadows=f,x.numSpotShadows=m,x.numSpotMaps=g,x.numLightProbes=_,i.version=Es++)},setupView:function(t,e){let n=0,o=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e=r.length?(a=new Ts(t),r.push(a)):a=r[i],a},dispose:function(){e=new WeakMap}}}class Rs extends ni{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class Cs extends ni{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function Ps(t,r,a){let s=new rr;const o=new ae,l=new ae,c=new Ae,h=new Rs({depthPacking:3201}),u=new Cs,d={},p=a.maxTextureSize,f={[e]:1,[n]:0,[i]:2},m=new ki({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ae},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),g=m.clone();g.defines.HORIZONTAL_PASS=1;const v=new vi;v.setAttribute("position",new si(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Di(v,m),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let y=this.type;function M(e,n){const i=r.update(_);m.defines.VSM_SAMPLES!==e.blurSamples&&(m.defines.VSM_SAMPLES=e.blurSamples,g.defines.VSM_SAMPLES=e.blurSamples,m.needsUpdate=!0,g.needsUpdate=!0),null===e.mapPass&&(e.mapPass=new Ce(o.x,o.y)),m.uniforms.shadow_pass.value=e.map.texture,m.uniforms.resolution.value=e.mapSize,m.uniforms.radius.value=e.radius,t.setRenderTarget(e.mapPass),t.clear(),t.renderBufferDirect(n,null,i,m,_,null),g.uniforms.shadow_pass.value=e.mapPass.texture,g.uniforms.resolution.value=e.mapSize,g.uniforms.radius.value=e.radius,t.setRenderTarget(e.map),t.clear(),t.renderBufferDirect(n,null,i,g,_,null)}function S(e,n,i,r){let a=null;const s=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===i.isPointLight?u:h,t.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const t=a.uuid,e=n.uuid;let i=d[t];void 0===i&&(i={},d[t]=i);let r=i[e];void 0===r&&(r=a.clone(),i[e]=r,n.addEventListener("dispose",b)),a=r}return a.visible=n.visible,a.wireframe=n.wireframe,a.side=3===r?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:f[n.side],a.alphaMap=n.alphaMap,a.alphaTest=n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial&&(t.properties.get(a).light=i),a}function E(e,n,i,a,o){if(!1===e.visible)return;if(e.layers.test(n.layers)&&(e.isMesh||e.isLine||e.isPoints)&&(e.castShadow||e.receiveShadow&&3===o)&&(!e.frustumCulled||s.intersectsObject(e))){e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld);const s=r.update(e),l=e.material;if(Array.isArray(l)){const r=s.groups;for(let c=0,h=r.length;cp||o.y>p)&&(o.x>p&&(l.x=Math.floor(p/m.x),o.x=l.x*m.x,h.mapSize.x=l.x),o.y>p&&(l.y=Math.floor(p/m.y),o.y=l.y*m.y,h.mapSize.y=l.y)),null===h.map||!0===d||!0===f){const t=3!==this.type?{minFilter:R,magFilter:R}:{};null!==h.map&&h.map.dispose(),h.map=new Ce(o.x,o.y,t),h.map.texture.name=a.name+".shadowMap",h.camera.updateProjectionMatrix()}t.setRenderTarget(h.map),t.clear();const g=h.getViewportCount();for(let t=0;t=1):-1!==Y.indexOf("OpenGL ES")&&(X=parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]),q=X>=2);let K=null,Z={};const J=t.getParameter(t.SCISSOR_BOX),$=t.getParameter(t.VIEWPORT),Q=(new Ae).fromArray(J),tt=(new Ae).fromArray($);function et(e,n,i,r){const a=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let s=0;sn||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&t instanceof VideoFrame){const n=Math.floor(i*r.width),a=Math.floor(i*r.height);void 0===u&&(u=f(n,a));const s=e?f(n,a):u;return s.width=n,s.height=a,s.getContext("2d").drawImage(t,0,0,n,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+a+")."),s}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),t}return t}function g(t){return t.generateMipmaps&&t.minFilter!==R&&t.minFilter!==L}function v(e){t.generateMipmap(e)}function _(n,i,r,a,s=!1){if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=i;if(i===t.RED&&(r===t.FLOAT&&(o=t.R32F),r===t.HALF_FLOAT&&(o=t.R16F),r===t.UNSIGNED_BYTE&&(o=t.R8)),i===t.RED_INTEGER&&(r===t.UNSIGNED_BYTE&&(o=t.R8UI),r===t.UNSIGNED_SHORT&&(o=t.R16UI),r===t.UNSIGNED_INT&&(o=t.R32UI),r===t.BYTE&&(o=t.R8I),r===t.SHORT&&(o=t.R16I),r===t.INT&&(o=t.R32I)),i===t.RG&&(r===t.FLOAT&&(o=t.RG32F),r===t.HALF_FLOAT&&(o=t.RG16F),r===t.UNSIGNED_BYTE&&(o=t.RG8)),i===t.RG_INTEGER&&(r===t.UNSIGNED_BYTE&&(o=t.RG8UI),r===t.UNSIGNED_SHORT&&(o=t.RG16UI),r===t.UNSIGNED_INT&&(o=t.RG32UI),r===t.BYTE&&(o=t.RG8I),r===t.SHORT&&(o=t.RG16I),r===t.INT&&(o=t.RG32I)),i===t.RGB&&r===t.UNSIGNED_INT_5_9_9_9_REV&&(o=t.RGB9_E5),i===t.RGBA){const e=s?Ut:ve.getTransfer(a);r===t.FLOAT&&(o=t.RGBA32F),r===t.HALF_FLOAT&&(o=t.RGBA16F),r===t.UNSIGNED_BYTE&&(o=e===Dt?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(o=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(o=t.RGB5_A1)}return o!==t.R16F&&o!==t.R32F&&o!==t.RG16F&&o!==t.RG32F&&o!==t.RGBA16F&&o!==t.RGBA32F||e.get("EXT_color_buffer_float"),o}function x(e,n){let i;return e?null===n||n===F||n===k?i=t.DEPTH24_STENCIL8:n===z?i=t.DEPTH32F_STENCIL8:n===D&&(i=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===F||n===k?i=t.DEPTH_COMPONENT24:n===z?i=t.DEPTH_COMPONENT32F:n===D&&(i=t.DEPTH_COMPONENT16),i}function y(t,e){return!0===g(t)||t.isFramebufferTexture&&t.minFilter!==R&&t.minFilter!==L?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function M(t){const e=t.target;e.removeEventListener("dispose",M),function(t){const e=i.get(t);if(void 0===e.__webglInit)return;const n=t.source,r=d.get(n);if(r){const i=r[e.__cacheKey];i.usedTimes--,0===i.usedTimes&&E(t),0===Object.keys(r).length&&d.delete(n)}i.remove(t)}(e),e.isVideoTexture&&h.delete(e)}function S(e){const n=e.target;n.removeEventListener("dispose",S),function(e){const n=i.get(e);if(e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++){if(Array.isArray(n.__webglFramebuffer[e]))for(let i=0;i0&&a.__version!==e.version){const t=e.image;if(null===t)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==t.complete)return void Y(a,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(t.TEXTURE_2D,a.__webglTexture,t.TEXTURE0+r)}const B={[w]:t.REPEAT,[T]:t.CLAMP_TO_EDGE,[A]:t.MIRRORED_REPEAT},V={[R]:t.NEAREST,[C]:t.NEAREST_MIPMAP_NEAREST,[P]:t.NEAREST_MIPMAP_LINEAR,[L]:t.LINEAR,[I]:t.LINEAR_MIPMAP_NEAREST,[N]:t.LINEAR_MIPMAP_LINEAR},H={[Bt]:t.NEVER,[qt]:t.ALWAYS,[Vt]:t.LESS,[kt]:t.LEQUAL,[Ht]:t.EQUAL,[jt]:t.GEQUAL,[Gt]:t.GREATER,[Wt]:t.NOTEQUAL};function q(n,a){if(a.type!==z||!1!==e.has("OES_texture_float_linear")||a.magFilter!==L&&a.magFilter!==I&&a.magFilter!==P&&a.magFilter!==N&&a.minFilter!==L&&a.minFilter!==I&&a.minFilter!==P&&a.minFilter!==N||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(n,t.TEXTURE_WRAP_S,B[a.wrapS]),t.texParameteri(n,t.TEXTURE_WRAP_T,B[a.wrapT]),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,B[a.wrapR]),t.texParameteri(n,t.TEXTURE_MAG_FILTER,V[a.magFilter]),t.texParameteri(n,t.TEXTURE_MIN_FILTER,V[a.minFilter]),a.compareFunction&&(t.texParameteri(n,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(n,t.TEXTURE_COMPARE_FUNC,H[a.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){if(a.magFilter===R)return;if(a.minFilter!==P&&a.minFilter!==N)return;if(a.type===z&&!1===e.has("OES_texture_float_linear"))return;if(a.anisotropy>1||i.get(a).__currentAnisotropy){const s=e.get("EXT_texture_filter_anisotropic");t.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy}}}function X(e,n){let i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",M));const r=n.source;let a=d.get(r);void 0===a&&(a={},d.set(r,a));const o=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}(n);if(o!==e.__cacheKey){void 0===a[o]&&(a[o]={texture:t.createTexture(),usedTimes:0},s.memory.textures++,i=!0),a[o].usedTimes++;const r=a[e.__cacheKey];void 0!==r&&(a[e.__cacheKey].usedTimes--,0===r.usedTimes&&E(n)),e.__cacheKey=o,e.__webglTexture=a[o].texture}return i}function Y(e,s,o){let l=t.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=t.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=t.TEXTURE_3D);const c=X(e,s),h=s.source;n.bindTexture(l,e.__webglTexture,t.TEXTURE0+o);const u=i.get(h);if(h.version!==u.__version||!0===c){n.activeTexture(t.TEXTURE0+o);const e=ve.getPrimaries(ve.workingColorSpace),i=s.colorSpace===Ct?null:ve.getPrimaries(s.colorSpace),d=s.colorSpace===Ct||e===i?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,s.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,s.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=m(s.image,!1,r.maxTextureSize);p=nt(s,p);const f=a.convert(s.format,s.colorSpace),M=a.convert(s.type);let S,E=_(s.internalFormat,f,M,s.colorSpace,s.isVideoTexture);q(l,s);const b=s.mipmaps,w=!0!==s.isVideoTexture,T=void 0===u.__version||!0===c,A=h.dataReady,R=y(s,p);if(s.isDepthTexture)E=x(s.format===j,s.type),T&&(w?n.texStorage2D(t.TEXTURE_2D,1,E,p.width,p.height):n.texImage2D(t.TEXTURE_2D,0,E,p.width,p.height,0,f,M,null));else if(s.isDataTexture)if(b.length>0){w&&T&&n.texStorage2D(t.TEXTURE_2D,R,E,b[0].width,b[0].height);for(let e=0,i=b.length;e0){const i=Is(S.width,S.height,s.format,s.type);for(const r of s.layerUpdates){const a=S.data.subarray(r*i/S.data.BYTES_PER_ELEMENT,(r+1)*i/S.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,r,S.width,S.height,1,f,a,0,0)}s.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,S.width,S.height,p.depth,f,S.data,0,0)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,e,E,S.width,S.height,p.depth,0,S.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else w?A&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,S.width,S.height,p.depth,f,M,S.data):n.texImage3D(t.TEXTURE_2D_ARRAY,e,E,S.width,S.height,p.depth,0,f,M,S.data)}else{w&&T&&n.texStorage2D(t.TEXTURE_2D,R,E,b[0].width,b[0].height);for(let e=0,i=b.length;e0){const e=Is(p.width,p.height,s.format,s.type);for(const i of s.layerUpdates){const r=p.data.subarray(i*e/p.data.BYTES_PER_ELEMENT,(i+1)*e/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,i,p.width,p.height,1,f,M,r)}s.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,f,M,p.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,E,p.width,p.height,p.depth,0,f,M,p.data);else if(s.isData3DTexture)w?(T&&n.texStorage3D(t.TEXTURE_3D,R,E,p.width,p.height,p.depth),A&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,f,M,p.data)):n.texImage3D(t.TEXTURE_3D,0,E,p.width,p.height,p.depth,0,f,M,p.data);else if(s.isFramebufferTexture){if(T)if(w)n.texStorage2D(t.TEXTURE_2D,R,E,p.width,p.height);else{let e=p.width,i=p.height;for(let r=0;r>=1,i>>=1}}else if(b.length>0){if(w&&T){const e=it(b[0]);n.texStorage2D(t.TEXTURE_2D,R,E,e.width,e.height)}for(let e=0,i=b.length;e>h),i=Math.max(1,r.height>>h);c===t.TEXTURE_3D||c===t.TEXTURE_2D_ARRAY?n.texImage3D(c,h,p,e,i,r.depth,0,u,d,null):n.texImage2D(c,h,p,e,i,0,u,d,null)}n.bindFramebuffer(t.FRAMEBUFFER,e),et(r)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,l,c,i.get(s).__webglTexture,0,tt(r)):(c===t.TEXTURE_2D||c>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,l,c,i.get(s).__webglTexture,h),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Z(e,n,i){if(t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer){const r=n.depthTexture,a=r&&r.isDepthTexture?r.type:null,s=x(n.stencilBuffer,a),l=n.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,c=tt(n);et(n)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,c,s,n.width,n.height):i?t.renderbufferStorageMultisample(t.RENDERBUFFER,c,s,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,s,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,l,t.RENDERBUFFER,e)}else{const e=n.textures;for(let r=0;r{delete r.__boundDepthTexture,delete r.__depthDisposeCallback,t.removeEventListener("dispose",e)};t.addEventListener("dispose",e),r.__depthDisposeCallback=e}r.__boundDepthTexture=t}if(e.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),O(r.depthTexture,0);const a=i.get(r.depthTexture).__webglTexture,s=tt(r);if(r.depthTexture.format===W)et(r)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0,s):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0);else{if(r.depthTexture.format!==j)throw new Error("Unknown depthTexture format");et(r)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0,s):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0)}}(r.__webglFramebuffer,e)}else if(a){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)if(n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[i]),void 0===r.__webglDepthbuffer[i])r.__webglDepthbuffer[i]=t.createRenderbuffer(),Z(r.__webglDepthbuffer[i],e,!1);else{const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,a=r.__webglDepthbuffer[i];t.bindRenderbuffer(t.RENDERBUFFER,a),t.framebufferRenderbuffer(t.FRAMEBUFFER,n,t.RENDERBUFFER,a)}}else if(n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=t.createRenderbuffer(),Z(r.__webglDepthbuffer,e,!1);else{const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,i=r.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,i),t.framebufferRenderbuffer(t.FRAMEBUFFER,n,t.RENDERBUFFER,i)}n.bindFramebuffer(t.FRAMEBUFFER,null)}const $=[],Q=[];function tt(t){return Math.min(r.maxSamples,t.samples)}function et(t){const n=i.get(t);return t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function nt(t,e){const n=t.colorSpace,i=t.format,r=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||n!==Lt&&n!==Ct&&(ve.getTransfer(n)===Dt?i===G&&r===U||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),e}function it(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?(c.width=t.naturalWidth||t.width,c.height=t.naturalHeight||t.height):"undefined"!=typeof VideoFrame&&t instanceof VideoFrame?(c.width=t.displayWidth,c.height=t.displayHeight):(c.width=t.width,c.height=t.height),c}this.allocateTextureUnit=function(){const t=b;return t>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+r.maxTextures),b+=1,t},this.resetTextureUnits=function(){b=0},this.setTexture2D=O,this.setTexture2DArray=function(e,r){const a=i.get(e);e.version>0&&a.__version!==e.version?Y(a,e,r):n.bindTexture(t.TEXTURE_2D_ARRAY,a.__webglTexture,t.TEXTURE0+r)},this.setTexture3D=function(e,r){const a=i.get(e);e.version>0&&a.__version!==e.version?Y(a,e,r):n.bindTexture(t.TEXTURE_3D,a.__webglTexture,t.TEXTURE0+r)},this.setTextureCube=function(e,s){const o=i.get(e);e.version>0&&o.__version!==e.version?function(e,s,o){if(6!==s.image.length)return;const l=X(e,s),c=s.source;n.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+o);const h=i.get(c);if(c.version!==h.__version||!0===l){n.activeTexture(t.TEXTURE0+o);const e=ve.getPrimaries(ve.workingColorSpace),i=s.colorSpace===Ct?null:ve.getPrimaries(s.colorSpace),u=s.colorSpace===Ct||e===i?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,s.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,s.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);const d=s.isCompressedTexture||s.image[0].isCompressedTexture,p=s.image[0]&&s.image[0].isDataTexture,f=[];for(let t=0;t<6;t++)f[t]=d||p?p?s.image[t].image:s.image[t]:m(s.image[t],!0,r.maxCubemapSize),f[t]=nt(s,f[t]);const x=f[0],M=a.convert(s.format,s.colorSpace),S=a.convert(s.type),E=_(s.internalFormat,M,S,s.colorSpace),b=!0!==s.isVideoTexture,w=void 0===h.__version||!0===l,T=c.dataReady;let A,R=y(s,x);if(q(t.TEXTURE_CUBE_MAP,s),d){b&&w&&n.texStorage2D(t.TEXTURE_CUBE_MAP,R,E,x.width,x.height);for(let e=0;e<6;e++){A=f[e].mipmaps;for(let i=0;i0&&R++;const e=it(f[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,R,E,e.width,e.height)}for(let e=0;e<6;e++)if(p){b?T&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,f[e].width,f[e].height,M,S,f[e].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,E,f[e].width,f[e].height,0,M,S,f[e].data);for(let i=0;i1;if(u||(void 0===l.__webglTexture&&(l.__webglTexture=t.createTexture()),l.__version=r.version,s.memory.textures++),h){o.__webglFramebuffer=[];for(let e=0;e<6;e++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[e]=[];for(let n=0;n0){o.__webglFramebuffer=[];for(let e=0;e0&&!1===et(e)){o.__webglMultisampledFramebuffer=t.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n0)for(let i=0;i0)for(let n=0;n0)if(!1===et(e)){const r=e.textures,a=e.width,s=e.height;let o=t.COLOR_BUFFER_BIT;const c=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,h=i.get(e),u=r.length>1;if(u)for(let e=0;eo+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&s<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==s&&(i=e.getPose(t.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(Fs)))}return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const n=new Os;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}class Bs{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(null===this.texture){const i=new Te;t.properties.get(i).__webglTexture=e.texture,e.depthNear==n.depthNear&&e.depthFar==n.depthFar||(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(t){if(null!==this.texture&&null===this.mesh){const e=t.cameras[0].viewport,n=new ki({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Di(new or(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Vs extends Zt{constructor(t,e){super();const n=this;let i=null,r=1,a=null,s="local-floor",o=1,l=null,c=null,h=null,u=null,d=null,p=null;const f=new Bs,m=e.getContextAttributes();let g=null,v=null;const _=[],x=[],y=new ae;let M=null;const S=new Xi;S.layers.enable(1),S.viewport=new Ae;const E=new Xi;E.layers.enable(2),E.viewport=new Ae;const b=[S,E],w=new Ds;w.layers.enable(1),w.layers.enable(2);let T=null,A=null;function R(t){const e=x.indexOf(t.inputSource);if(-1===e)return;const n=_[e];void 0!==n&&(n.update(t.inputSource,t.frame,l||a),n.dispatchEvent({type:t.type,data:t.inputSource}))}function C(){i.removeEventListener("select",R),i.removeEventListener("selectstart",R),i.removeEventListener("selectend",R),i.removeEventListener("squeeze",R),i.removeEventListener("squeezestart",R),i.removeEventListener("squeezeend",R),i.removeEventListener("end",C),i.removeEventListener("inputsourceschange",P);for(let t=0;t<_.length;t++){const e=x[t];null!==e&&(x[t]=null,_[t].disconnect(e))}T=null,A=null,f.reset(),t.setRenderTarget(g),d=null,u=null,h=null,i=null,v=null,O.stop(),n.isPresenting=!1,t.setPixelRatio(M),t.setSize(y.width,y.height,!1),n.dispatchEvent({type:"sessionend"})}function P(t){for(let e=0;e=0&&(x[i]=null,_[i].disconnect(n))}for(let e=0;e=x.length){x.push(n),i=t;break}if(null===x[t]){x[t]=n,i=t;break}}if(-1===i)break}const r=_[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=_[t];return void 0===e&&(e=new zs,_[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=_[t];return void 0===e&&(e=new zs,_[t]=e),e.getGripSpace()},this.getHand=function(t){let e=_[t];return void 0===e&&(e=new zs,_[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){s=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(t){l=t},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(c){if(i=c,null!==i){if(g=t.getRenderTarget(),i.addEventListener("select",R),i.addEventListener("selectstart",R),i.addEventListener("selectend",R),i.addEventListener("squeeze",R),i.addEventListener("squeezestart",R),i.addEventListener("squeezeend",R),i.addEventListener("end",C),i.addEventListener("inputsourceschange",P),!0!==m.xrCompatible&&await e.makeXRCompatible(),M=t.getPixelRatio(),t.getSize(y),void 0===i.renderState.layers){const n={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(i,e,n),i.updateRenderState({baseLayer:d}),t.setPixelRatio(1),t.setSize(d.framebufferWidth,d.framebufferHeight,!1),v=new Ce(d.framebufferWidth,d.framebufferHeight,{format:G,type:U,colorSpace:t.outputColorSpace,stencilBuffer:m.stencil})}else{let n=null,a=null,s=null;m.depth&&(s=m.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,n=m.stencil?j:W,a=m.stencil?k:F);const o={colorFormat:e.RGBA8,depthFormat:s,scaleFactor:r};h=new XRWebGLBinding(i,e),u=h.createProjectionLayer(o),i.updateRenderState({layers:[u]}),t.setPixelRatio(1),t.setSize(u.textureWidth,u.textureHeight,!1),v=new Ce(u.textureWidth,u.textureHeight,{format:G,type:U,depthTexture:new Gr(u.textureWidth,u.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:m.stencil,colorSpace:t.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:!1===u.ignoreDepthValues})}v.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await i.requestReferenceSpace(s),O.setContext(i),O.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode},this.getDepthTexture=function(){return f.getDepthTexture()};const L=new Ne,I=new Ne;function N(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===i)return;let e=t.near,n=t.far;null!==f.texture&&(f.depthNear>0&&(e=f.depthNear),f.depthFar>0&&(n=f.depthFar)),w.near=E.near=S.near=e,w.far=E.far=S.far=n,T===w.near&&A===w.far||(i.updateRenderState({depthNear:w.near,depthFar:w.far}),T=w.near,A=w.far);const r=t.parent,a=w.cameras;N(w,r);for(let t=0;t0&&(t.alphaTest.value=i.alphaTest);const r=e.get(i),a=r.envMap,s=r.envMapRotation;a&&(t.envMap.value=a,Hs.copy(s),Hs.x*=-1,Hs.y*=-1,Hs.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(Hs.y*=-1,Hs.z*=-1),t.envMapRotation.value.setFromMatrix4(ks.makeRotationFromEuler(Hs)),t.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,t.reflectivity.value=i.reflectivity,t.ior.value=i.ior,t.refractionRatio.value=i.refractionRatio),i.lightMap&&(t.lightMap.value=i.lightMap,t.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,t.lightMapTransform)),i.aoMap&&(t.aoMap.value=i.aoMap,t.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,t.aoMapTransform))}return{refreshFogUniforms:function(e,n){n.color.getRGB(e.fogColor.value,Vi(t)),n.isFog?(e.fogNear.value=n.near,e.fogFar.value=n.far):n.isFogExp2&&(e.fogDensity.value=n.density)},refreshMaterialUniforms:function(t,r,a,s,o){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(t,r):r.isMeshToonMaterial?(i(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(i(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(i(t,r),function(t,e){t.metalness.value=e.metalness,e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap,n(e.metalnessMap,t.metalnessMapTransform)),t.roughness.value=e.roughness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap,n(e.roughnessMap,t.roughnessMapTransform)),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}(t,r),r.isMeshPhysicalMaterial&&function(t,e,i){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,n(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,n(e.sheenRoughnessMap,t.sheenRoughnessMapTransform))),e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,n(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,n(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,n(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),1===e.side&&t.clearcoatNormalScale.value.negate())),e.dispersion>0&&(t.dispersion.value=e.dispersion),e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,n(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,n(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform))),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,n(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,n(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)),e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,n(e.anisotropyMap,t.anisotropyMapTransform))),t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,n(e.specularColorMap,t.specularColorMapTransform)),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,n(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,r,o)):r.isMeshMatcapMaterial?(i(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?i(t,r):r.isMeshDistanceMaterial?(i(t,r),function(t,n){const i=e.get(n).light;t.referencePosition.value.setFromMatrixPosition(i.matrixWorld),t.nearDistance.value=i.shadow.camera.near,t.farDistance.value=i.shadow.camera.far}(t,r)):r.isMeshNormalMaterial?i(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform))}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,i,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*r,e.map&&(t.map.value=e.map,n(e.map,t.uvTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r,a,s):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Ws(t,e,n,i){let r={},a={},s=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(t,e,n,i){const r=t.value,a=e+"_"+n;if(void 0===i[a])return i[a]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const t=i[a];if("number"==typeof r||"boolean"==typeof r){if(t!==r)return i[a]=r,!0}else if(!1===t.equals(r))return t.copy(r),!0}return!1}function c(t){const e={boundary:0,storage:0};return"number"==typeof t||"boolean"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",t),e}function h(e){const n=e.target;n.removeEventListener("dispose",h);const i=s.indexOf(n.__bindingPointIndex);s.splice(i,1),t.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(t,e){const n=e.program;i.uniformBlockBinding(t,n)},update:function(n,u){let d=r[n.id];void 0===d&&(function(t){const e=t.uniforms;let n=0;for(let t=0,i=e.length;t0&&(n+=16-i),t.__size=n,t.__cache={}}(n),d=function(e){const n=function(){for(let t=0;t0)&&d.push(e,r,l),(t!==n-1||o=r)break t;{const s=e[1];t=r)break e}a=n,n=0}}for(;n>>1;te;)--a;if(++a,0!==r||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const t=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*t,a*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let e=0;e!==r;e++){const i=n[e];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==a&&a>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,a),t=!1;break}a=i}if(void 0!==i&&(s=i,ArrayBuffer.isView(s)&&!(s instanceof DataView)))for(let e=0,n=i.length;e!==n;++e){const n=i[e];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,n),t=!1;break}}var s;return t}optimize(){const t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Rt,r=t.length-1;let a=1;for(let s=1;s0){t[a]=t[r];for(let t=r*n,i=a*n,s=0;s!==n;++s)e[i+s]=e[t+s];++a}return a!==t.length?(this.times=t.slice(0,a),this.values=e.slice(0,a*n)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}$s.prototype.TimeBufferType=Float32Array,$s.prototype.ValueBufferType=Float32Array,$s.prototype.DefaultInterpolation=At;class Qs extends $s{constructor(t,e,n){super(t,e,n)}}Qs.prototype.ValueTypeName="bool",Qs.prototype.ValueBufferType=Array,Qs.prototype.DefaultInterpolation=Tt,Qs.prototype.InterpolantFactoryMethodLinear=void 0,Qs.prototype.InterpolantFactoryMethodSmooth=void 0;(class extends $s{}).prototype.ValueTypeName="color";(class extends $s{}).prototype.ValueTypeName="number";class to extends Ys{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(n-e)/(i-e);let l=t*s;for(let t=l+s;l!==t;l+=4)Ie.slerpFlat(r,0,a,l-s,a,l,o);return r}}class eo extends $s{InterpolantFactoryMethodLinear(t){return new to(this.times,this.values,this.getValueSize(),t)}}eo.prototype.ValueTypeName="quaternion",eo.prototype.InterpolantFactoryMethodSmooth=void 0;class no extends $s{constructor(t,e,n){super(t,e,n)}}no.prototype.ValueTypeName="string",no.prototype.ValueBufferType=Array,no.prototype.DefaultInterpolation=Tt,no.prototype.InterpolantFactoryMethodLinear=void 0,no.prototype.InterpolantFactoryMethodSmooth=void 0;(class extends $s{}).prototype.ValueTypeName="vector";const io={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class ro{constructor(t,e,n){const i=this;let r,a=!1,s=0,o=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){o++,!1===a&&void 0!==i.onStart&&i.onStart(t,s,o),a=!0},this.itemEnd=function(t){s++,void 0!==i.onProgress&&i.onProgress(t,s,o),s===o&&(a=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=l.length;e0){const t=1/i;this.x*=t,this.y*=t,this.z*=t}else this.x=0,this.y=0,this.z=0;return i}unit(t){void 0===t&&(t=new Bo);const e=this.x,n=this.y,i=this.z;let r=Math.sqrt(e*e+n*n+i*i);return r>0?(r=1/r,t.x=e*r,t.y=n*r,t.z=i*r):(t.x=1,t.y=0,t.z=0),t}length(){const t=this.x,e=this.y,n=this.z;return Math.sqrt(t*t+e*e+n*n)}lengthSquared(){return this.dot(this)}distanceTo(t){const e=this.x,n=this.y,i=this.z,r=t.x,a=t.y,s=t.z;return Math.sqrt((r-e)*(r-e)+(a-n)*(a-n)+(s-i)*(s-i))}distanceSquared(t){const e=this.x,n=this.y,i=this.z,r=t.x,a=t.y,s=t.z;return(r-e)*(r-e)+(a-n)*(a-n)+(s-i)*(s-i)}scale(t,e){void 0===e&&(e=new Bo);const n=this.x,i=this.y,r=this.z;return e.x=t*n,e.y=t*i,e.z=t*r,e}vmul(t,e){return void 0===e&&(e=new Bo),e.x=t.x*this.x,e.y=t.y*this.y,e.z=t.z*this.z,e}addScaledVector(t,e,n){return void 0===n&&(n=new Bo),n.x=this.x+t*e.x,n.y=this.y+t*e.y,n.z=this.z+t*e.z,n}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}isZero(){return 0===this.x&&0===this.y&&0===this.z}negate(t){return void 0===t&&(t=new Bo),t.x=-this.x,t.y=-this.y,t.z=-this.z,t}tangents(t,e){const n=this.length();if(n>0){const i=Vo,r=1/n;i.set(this.x*r,this.y*r,this.z*r);const a=Ho;Math.abs(i.x)<.9?(a.set(1,0,0),i.cross(a,t)):(a.set(0,1,0),i.cross(a,t)),i.cross(t,e)}else t.set(1,0,0),e.set(0,1,0)}toString(){return`${this.x},${this.y},${this.z}`}toArray(){return[this.x,this.y,this.z]}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}lerp(t,e,n){const i=this.x,r=this.y,a=this.z;n.x=i+(t.x-i)*e,n.y=r+(t.y-r)*e,n.z=a+(t.z-a)*e}almostEquals(t,e){return void 0===e&&(e=1e-6),!(Math.abs(this.x-t.x)>e||Math.abs(this.y-t.y)>e||Math.abs(this.z-t.z)>e)}almostZero(t){return void 0===t&&(t=1e-6),!(Math.abs(this.x)>t||Math.abs(this.y)>t||Math.abs(this.z)>t)}isAntiparallelTo(t,e){return this.negate(ko),ko.almostEquals(t,e)}clone(){return new Bo(this.x,this.y,this.z)}}Bo.ZERO=new Bo(0,0,0),Bo.UNIT_X=new Bo(1,0,0),Bo.UNIT_Y=new Bo(0,1,0),Bo.UNIT_Z=new Bo(0,0,1);const Vo=new Bo,Ho=new Bo,ko=new Bo;class Go{constructor(t){void 0===t&&(t={}),this.lowerBound=new Bo,this.upperBound=new Bo,t.lowerBound&&this.lowerBound.copy(t.lowerBound),t.upperBound&&this.upperBound.copy(t.upperBound)}setFromPoints(t,e,n,i){const r=this.lowerBound,a=this.upperBound,s=n;r.copy(t[0]),s&&s.vmult(r,r),a.copy(r);for(let e=1;ea.x&&(a.x=n.x),n.xa.y&&(a.y=n.y),n.ya.z&&(a.z=n.z),n.z=r.x&&e.y<=i.y&&n.y>=r.y&&e.z<=i.z&&n.z>=r.z}getCorners(t,e,n,i,r,a,s,o){const l=this.lowerBound,c=this.upperBound;t.copy(l),e.set(c.x,l.y,l.z),n.set(c.x,c.y,l.z),i.set(l.x,c.y,c.z),r.set(c.x,l.y,c.z),a.set(l.x,c.y,l.z),s.set(l.x,l.y,c.z),o.copy(c)}toLocalFrame(t,e){const n=jo,i=n[0],r=n[1],a=n[2],s=n[3],o=n[4],l=n[5],c=n[6],h=n[7];this.getCorners(i,r,a,s,o,l,c,h);for(let e=0;8!==e;e++){const i=n[e];t.pointToLocal(i,i)}return e.setFromPoints(n)}toWorldFrame(t,e){const n=jo,i=n[0],r=n[1],a=n[2],s=n[3],o=n[4],l=n[5],c=n[6],h=n[7];this.getCorners(i,r,a,s,o,l,c,h);for(let e=0;8!==e;e++){const i=n[e];t.pointToWorld(i,i)}return e.setFromPoints(n)}overlapsRay(t){const{direction:e,from:n}=t,i=1/e.x,r=1/e.y,a=1/e.z,s=(this.lowerBound.x-n.x)*i,o=(this.upperBound.x-n.x)*i,l=(this.lowerBound.y-n.y)*r,c=(this.upperBound.y-n.y)*r,h=(this.lowerBound.z-n.z)*a,u=(this.upperBound.z-n.z)*a,d=Math.max(Math.max(Math.min(s,o),Math.min(l,c)),Math.min(h,u)),p=Math.min(Math.min(Math.max(s,o),Math.max(l,c)),Math.max(h,u));return!(p<0||d>p)}}const Wo=new Bo,jo=[new Bo,new Bo,new Bo,new Bo,new Bo,new Bo,new Bo,new Bo];class qo{constructor(){this.matrix=[]}get(t,e){let{index:n}=t,{index:i}=e;if(i>n){const t=i;i=n,n=t}return this.matrix[(n*(n+1)>>1)+i-1]}set(t,e,n){let{index:i}=t,{index:r}=e;if(r>i){const t=r;r=i,i=t}this.matrix[(i*(i+1)>>1)+r-1]=n?1:0}reset(){for(let t=0,e=this.matrix.length;t!==e;t++)this.matrix[t]=0}setNumObjects(t){this.matrix.length=t*(t-1)>>1}}class Xo{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;return void 0===n[t]&&(n[t]=[]),n[t].includes(e)||n[t].push(e),this}hasEventListener(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return!(void 0===n[t]||!n[t].includes(e))}hasAnyEventListener(t){return void 0!==this._listeners&&void 0!==this._listeners[t]}removeEventListener(t,e){if(void 0===this._listeners)return this;const n=this._listeners;if(void 0===n[t])return this;const i=n[t].indexOf(e);return-1!==i&&n[t].splice(i,1),this}dispatchEvent(t){if(void 0===this._listeners)return this;const e=this._listeners[t.type];if(void 0!==e){t.target=this;for(let n=0,i=e.length;n.499&&(n=2*Math.atan2(a,l),i=Math.PI/2,r=0),t<-.499&&(n=-2*Math.atan2(a,l),i=-Math.PI/2,r=0),void 0===n){const e=a*a,c=s*s,h=o*o;n=Math.atan2(2*s*l-2*a*o,1-2*c-2*h),i=Math.asin(2*t),r=Math.atan2(2*a*l-2*s*o,1-2*e-2*h)}}t.y=n,t.z=i,t.x=r}setFromEuler(t,e,n,i){void 0===i&&(i="XYZ");const r=Math.cos(t/2),a=Math.cos(e/2),s=Math.cos(n/2),o=Math.sin(t/2),l=Math.sin(e/2),c=Math.sin(n/2);return"XYZ"===i?(this.x=o*a*s+r*l*c,this.y=r*l*s-o*a*c,this.z=r*a*c+o*l*s,this.w=r*a*s-o*l*c):"YXZ"===i?(this.x=o*a*s+r*l*c,this.y=r*l*s-o*a*c,this.z=r*a*c-o*l*s,this.w=r*a*s+o*l*c):"ZXY"===i?(this.x=o*a*s-r*l*c,this.y=r*l*s+o*a*c,this.z=r*a*c+o*l*s,this.w=r*a*s-o*l*c):"ZYX"===i?(this.x=o*a*s-r*l*c,this.y=r*l*s+o*a*c,this.z=r*a*c-o*l*s,this.w=r*a*s+o*l*c):"YZX"===i?(this.x=o*a*s+r*l*c,this.y=r*l*s+o*a*c,this.z=r*a*c-o*l*s,this.w=r*a*s-o*l*c):"XZY"===i&&(this.x=o*a*s-r*l*c,this.y=r*l*s-o*a*c,this.z=r*a*c+o*l*s,this.w=r*a*s+o*l*c),this}clone(){return new Yo(this.x,this.y,this.z,this.w)}slerp(t,e,n){void 0===n&&(n=new Yo);const i=this.x,r=this.y,a=this.z,s=this.w;let o,l,c,h,u,d=t.x,p=t.y,f=t.z,m=t.w;return l=i*d+r*p+a*f+s*m,l<0&&(l=-l,d=-d,p=-p,f=-f,m=-m),1-l>1e-6?(o=Math.acos(l),c=Math.sin(o),h=Math.sin((1-e)*o)/c,u=Math.sin(e*o)/c):(h=1-e,u=e),n.x=h*i+u*d,n.y=h*r+u*p,n.z=h*a+u*f,n.w=h*s+u*m,n}integrate(t,e,n,i){void 0===i&&(i=new Yo);const r=t.x*n.x,a=t.y*n.y,s=t.z*n.z,o=this.x,l=this.y,c=this.z,h=this.w,u=.5*e;return i.x+=u*(r*h+a*c-s*l),i.y+=u*(a*h+s*o-r*c),i.z+=u*(s*h+r*l-a*o),i.w+=u*(-r*o-a*l-s*c),i}}const Ko=new Bo,Zo=new Bo;class Jo{constructor(t){void 0===t&&(t={}),this.id=Jo.idCounter++,this.type=t.type||0,this.boundingSphereRadius=0,this.collisionResponse=!t.collisionResponse||t.collisionResponse,this.collisionFilterGroup=void 0!==t.collisionFilterGroup?t.collisionFilterGroup:1,this.collisionFilterMask=void 0!==t.collisionFilterMask?t.collisionFilterMask:-1,this.material=t.material?t.material:null,this.body=null}updateBoundingSphereRadius(){throw`computeBoundingSphereRadius() not implemented for shape type ${this.type}`}volume(){throw`volume() not implemented for shape type ${this.type}`}calculateLocalInertia(t,e){throw`calculateLocalInertia() not implemented for shape type ${this.type}`}calculateWorldAABB(t,e,n,i){throw`calculateWorldAABB() not implemented for shape type ${this.type}`}}Jo.idCounter=0,Jo.types={SPHERE:1,PLANE:2,BOX:4,COMPOUND:8,CONVEXPOLYHEDRON:16,HEIGHTFIELD:32,PARTICLE:64,CYLINDER:128,TRIMESH:256};class $o{constructor(t){void 0===t&&(t={}),this.position=new Bo,this.quaternion=new Yo,t.position&&this.position.copy(t.position),t.quaternion&&this.quaternion.copy(t.quaternion)}pointToLocal(t,e){return $o.pointToLocalFrame(this.position,this.quaternion,t,e)}pointToWorld(t,e){return $o.pointToWorldFrame(this.position,this.quaternion,t,e)}vectorToWorldFrame(t,e){return void 0===e&&(e=new Bo),this.quaternion.vmult(t,e),e}static pointToLocalFrame(t,e,n,i){return void 0===i&&(i=new Bo),n.vsub(t,i),e.conjugate(Qo),Qo.vmult(i,i),i}static pointToWorldFrame(t,e,n,i){return void 0===i&&(i=new Bo),e.vmult(n,i),i.vadd(t,i),i}static vectorToWorldFrame(t,e,n){return void 0===n&&(n=new Bo),t.vmult(e,n),n}static vectorToLocalFrame(t,e,n,i){return void 0===i&&(i=new Bo),e.w*=-1,e.vmult(n,i),e.w*=-1,i}}const Qo=new Yo;class tl extends Jo{constructor(t){void 0===t&&(t={});const{vertices:e=[],faces:n=[],normals:i=[],axes:r,boundingSphereRadius:a}=t;super({type:Jo.types.CONVEXPOLYHEDRON}),this.vertices=e,this.faces=n,this.faceNormals=i,0===this.faceNormals.length&&this.computeNormals(),a?this.boundingSphereRadius=a:this.updateBoundingSphereRadius(),this.worldVertices=[],this.worldVerticesNeedsUpdate=!0,this.worldFaceNormals=[],this.worldFaceNormalsNeedsUpdate=!0,this.uniqueAxes=r?r.slice():null,this.uniqueEdges=[],this.computeEdges()}computeEdges(){const t=this.faces,e=this.vertices,n=this.uniqueEdges;n.length=0;const i=new Bo;for(let r=0;r!==t.length;r++){const a=t[r],s=a.length;for(let t=0;t!==s;t++){const r=(t+1)%s;e[a[t]].vsub(e[a[r]],i),i.normalize();let o=!1;for(let t=0;t!==n.length;t++)if(n[t].almostEquals(i)||n[t].almostEquals(i)){o=!0;break}o||n.push(i.clone())}}}computeNormals(){this.faceNormals.length=this.faces.length;for(let t=0;tu&&(u=e,h=t)}const d=[];for(let t=0;t=0&&this.clipFaceAgainstHull(a,t,e,d,s,o,l)}findSeparatingAxis(t,e,n,i,r,a,s,o){const l=new Bo,c=new Bo,h=new Bo,u=new Bo,d=new Bo,p=new Bo;let f=Number.MAX_VALUE;const m=this;if(m.uniqueAxes)for(let s=0;s!==m.uniqueAxes.length;s++){n.vmult(m.uniqueAxes[s],l);const o=m.testSepAxis(l,t,e,n,i,r);if(!1===o)return!1;o0&&a.negate(a),!0}testSepAxis(t,e,n,i,r,a){tl.project(this,t,n,i,el),tl.project(e,t,r,a,nl);const s=el[0],o=el[1],l=nl[0],c=nl[1];if(se.x&&(e.x=r.x),r.ye.y&&(e.y=r.y),r.ze.z&&(e.z=r.z)}}computeWorldFaceNormals(t){const e=this.faceNormals.length;for(;this.worldFaceNormals.lengtht&&(t=i)}this.boundingSphereRadius=Math.sqrt(t)}calculateWorldAABB(t,e,n,i){const r=this.vertices;let a,s,o,l,c,h,u=new Bo;for(let n=0;nl)&&(l=i.x),(void 0===s||i.yc)&&(c=i.y),(void 0===o||i.zh)&&(h=i.z)}n.set(a,s,o),i.set(l,c,h)}volume(){return 4*Math.PI*this.boundingSphereRadius/3}getAveragePointLocal(t){void 0===t&&(t=new Bo);const e=this.vertices;for(let n=0;n0||c>0&&u<0)return!1}return-1}static project(t,e,n,i,r){const a=t.vertices.length,s=il;let o=0,l=0;const c=rl,h=t.vertices;c.setZero(),$o.vectorToLocalFrame(n,i,e,s),$o.pointToLocalFrame(n,i,c,c);const u=c.dot(s);l=o=h[0].dot(s);for(let t=1;to&&(o=e),eo){const t=l;l=o,o=t}r[0]=o,r[1]=l}}const el=[],nl=[],il=(new Bo,new Bo),rl=new Bo;class al extends Jo{constructor(t){super({type:Jo.types.BOX}),this.halfExtents=t,this.convexPolyhedronRepresentation=null,this.updateConvexPolyhedronRepresentation(),this.updateBoundingSphereRadius()}updateConvexPolyhedronRepresentation(){const t=this.halfExtents.x,e=this.halfExtents.y,n=this.halfExtents.z,i=Bo,r=[new i(-t,-e,-n),new i(t,-e,-n),new i(t,e,-n),new i(-t,e,-n),new i(-t,-e,n),new i(t,-e,n),new i(t,e,n),new i(-t,e,n)],a=[new i(0,0,1),new i(0,1,0),new i(1,0,0)],s=new tl({vertices:r,faces:[[3,2,1,0],[4,5,6,7],[5,4,0,1],[2,3,7,6],[0,4,7,3],[1,2,6,5]],axes:a});this.convexPolyhedronRepresentation=s,s.material=this.material}calculateLocalInertia(t,e){return void 0===e&&(e=new Bo),al.calculateInertia(this.halfExtents,t,e),e}static calculateInertia(t,e,n){const i=t;n.x=1/12*e*(2*i.y*2*i.y+2*i.z*2*i.z),n.y=1/12*e*(2*i.x*2*i.x+2*i.z*2*i.z),n.z=1/12*e*(2*i.y*2*i.y+2*i.x*2*i.x)}getSideNormals(t,e){const n=t,i=this.halfExtents;if(n[0].set(i.x,0,0),n[1].set(0,i.y,0),n[2].set(0,0,i.z),n[3].set(-i.x,0,0),n[4].set(0,-i.y,0),n[5].set(0,0,-i.z),void 0!==e)for(let t=0;t!==n.length;t++)e.vmult(n[t],n[t]);return n}volume(){return 8*this.halfExtents.x*this.halfExtents.y*this.halfExtents.z}updateBoundingSphereRadius(){this.boundingSphereRadius=this.halfExtents.length()}forEachWorldCorner(t,e,n){const i=this.halfExtents,r=[[i.x,i.y,i.z],[-i.x,i.y,i.z],[-i.x,-i.y,i.z],[-i.x,-i.y,-i.z],[i.x,-i.y,-i.z],[i.x,i.y,-i.z],[-i.x,i.y,-i.z],[i.x,-i.y,i.z]];for(let i=0;ii.x&&(i.x=s),o>i.y&&(i.y=o),l>i.z&&(i.z=l),s0?1/e:0,this.material=t.material||null,this.linearDamping="number"==typeof t.linearDamping?t.linearDamping:.01,this.type=e<=0?ll.STATIC:ll.DYNAMIC,typeof t.type==typeof ll.STATIC&&(this.type=t.type),this.allowSleep=void 0===t.allowSleep||t.allowSleep,this.sleepState=ll.AWAKE,this.sleepSpeedLimit=void 0!==t.sleepSpeedLimit?t.sleepSpeedLimit:.1,this.sleepTimeLimit=void 0!==t.sleepTimeLimit?t.sleepTimeLimit:1,this.timeLastSleepy=0,this.wakeUpAfterNarrowphase=!1,this.torque=new Bo,this.quaternion=new Yo,this.initQuaternion=new Yo,this.previousQuaternion=new Yo,this.interpolatedQuaternion=new Yo,t.quaternion&&(this.quaternion.copy(t.quaternion),this.initQuaternion.copy(t.quaternion),this.previousQuaternion.copy(t.quaternion),this.interpolatedQuaternion.copy(t.quaternion)),this.angularVelocity=new Bo,t.angularVelocity&&this.angularVelocity.copy(t.angularVelocity),this.initAngularVelocity=new Bo,this.shapes=[],this.shapeOffsets=[],this.shapeOrientations=[],this.inertia=new Bo,this.invInertia=new Bo,this.invInertiaWorld=new Fo,this.invMassSolve=0,this.invInertiaSolve=new Bo,this.invInertiaWorldSolve=new Fo,this.fixedRotation=void 0!==t.fixedRotation&&t.fixedRotation,this.angularDamping=void 0!==t.angularDamping?t.angularDamping:.01,this.linearFactor=new Bo(1,1,1),t.linearFactor&&this.linearFactor.copy(t.linearFactor),this.angularFactor=new Bo(1,1,1),t.angularFactor&&this.angularFactor.copy(t.angularFactor),this.aabb=new Go,this.aabbNeedsUpdate=!0,this.boundingRadius=0,this.wlambda=new Bo,this.isTrigger=Boolean(t.isTrigger),t.shape&&this.addShape(t.shape),this.updateMassProperties()}wakeUp(){const t=this.sleepState;this.sleepState=ll.AWAKE,this.wakeUpAfterNarrowphase=!1,t===ll.SLEEPING&&this.dispatchEvent(ll.wakeupEvent)}sleep(){this.sleepState=ll.SLEEPING,this.velocity.set(0,0,0),this.angularVelocity.set(0,0,0),this.wakeUpAfterNarrowphase=!1}sleepTick(t){if(this.allowSleep){const e=this.sleepState,n=this.velocity.lengthSquared()+this.angularVelocity.lengthSquared(),i=this.sleepSpeedLimit**2;e===ll.AWAKE&&ni?this.wakeUp():e===ll.SLEEPY&&t-this.timeLastSleepy>this.sleepTimeLimit&&(this.sleep(),this.dispatchEvent(ll.sleepEvent))}}updateSolveMassProperties(){this.sleepState===ll.SLEEPING||this.type===ll.KINEMATIC?(this.invMassSolve=0,this.invInertiaSolve.setZero(),this.invInertiaWorldSolve.setZero()):(this.invMassSolve=this.invMass,this.invInertiaSolve.copy(this.invInertia),this.invInertiaWorldSolve.copy(this.invInertiaWorld))}pointToLocalFrame(t,e){return void 0===e&&(e=new Bo),t.vsub(this.position,e),this.quaternion.conjugate().vmult(e,e),e}vectorToLocalFrame(t,e){return void 0===e&&(e=new Bo),this.quaternion.conjugate().vmult(t,e),e}pointToWorldFrame(t,e){return void 0===e&&(e=new Bo),this.quaternion.vmult(t,e),e.vadd(this.position,e),e}vectorToWorldFrame(t,e){return void 0===e&&(e=new Bo),this.quaternion.vmult(t,e),e}addShape(t,e,n){const i=new Bo,r=new Yo;return e&&i.copy(e),n&&r.copy(n),this.shapes.push(t),this.shapeOffsets.push(i),this.shapeOrientations.push(r),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,t.body=this,this}removeShape(t){const e=this.shapes.indexOf(t);return-1===e?(console.warn("Shape does not belong to the body"),this):(this.shapes.splice(e,1),this.shapeOffsets.splice(e,1),this.shapeOrientations.splice(e,1),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,t.body=null,this)}updateBoundingRadius(){const t=this.shapes,e=this.shapeOffsets,n=t.length;let i=0;for(let r=0;r!==n;r++){const n=t[r];n.updateBoundingSphereRadius();const a=e[r].length(),s=n.boundingSphereRadius;a+s>i&&(i=a+s)}this.boundingRadius=i}updateAABB(){const t=this.shapes,e=this.shapeOffsets,n=this.shapeOrientations,i=t.length,r=cl,a=hl,s=this.quaternion,o=this.aabb,l=ul;for(let c=0;c!==i;c++){const i=t[c];s.vmult(e[c],r),r.vadd(this.position,r),s.mult(n[c],a),i.calculateWorldAABB(r,a,l.lowerBound,l.upperBound),0===c?o.copy(l):o.extend(l)}this.aabbNeedsUpdate=!1}updateInertiaWorld(t){const e=this.invInertia;if(e.x!==e.y||e.y!==e.z||t){const t=dl,n=pl;t.setRotationFromQuaternion(this.quaternion),t.transpose(n),t.scale(e,t),t.mmult(n,this.invInertiaWorld)}}applyForce(t,e){if(void 0===e&&(e=new Bo),this.type!==ll.DYNAMIC)return;this.sleepState===ll.SLEEPING&&this.wakeUp();const n=fl;e.cross(t,n),this.force.vadd(t,this.force),this.torque.vadd(n,this.torque)}applyLocalForce(t,e){if(void 0===e&&(e=new Bo),this.type!==ll.DYNAMIC)return;const n=ml,i=gl;this.vectorToWorldFrame(t,n),this.vectorToWorldFrame(e,i),this.applyForce(n,i)}applyTorque(t){this.type===ll.DYNAMIC&&(this.sleepState===ll.SLEEPING&&this.wakeUp(),this.torque.vadd(t,this.torque))}applyImpulse(t,e){if(void 0===e&&(e=new Bo),this.type!==ll.DYNAMIC)return;this.sleepState===ll.SLEEPING&&this.wakeUp();const n=e,i=vl;i.copy(t),i.scale(this.invMass,i),this.velocity.vadd(i,this.velocity);const r=_l;n.cross(t,r),this.invInertiaWorld.vmult(r,r),this.angularVelocity.vadd(r,this.angularVelocity)}applyLocalImpulse(t,e){if(void 0===e&&(e=new Bo),this.type!==ll.DYNAMIC)return;const n=xl,i=yl;this.vectorToWorldFrame(t,n),this.vectorToWorldFrame(e,i),this.applyImpulse(n,i)}updateMassProperties(){const t=Ml;this.invMass=this.mass>0?1/this.mass:0;const e=this.inertia,n=this.fixedRotation;this.updateAABB(),t.set((this.aabb.upperBound.x-this.aabb.lowerBound.x)/2,(this.aabb.upperBound.y-this.aabb.lowerBound.y)/2,(this.aabb.upperBound.z-this.aabb.lowerBound.z)/2),al.calculateInertia(t,this.mass,e),this.invInertia.set(e.x>0&&!n?1/e.x:0,e.y>0&&!n?1/e.y:0,e.z>0&&!n?1/e.z:0),this.updateInertiaWorld(!0)}getVelocityAtWorldPoint(t,e){const n=new Bo;return t.vsub(this.position,n),this.angularVelocity.cross(n,e),this.velocity.vadd(e,e),e}integrate(t,e,n){if(this.previousPosition.copy(this.position),this.previousQuaternion.copy(this.quaternion),this.type!==ll.DYNAMIC&&this.type!==ll.KINEMATIC||this.sleepState===ll.SLEEPING)return;const i=this.velocity,r=this.angularVelocity,a=this.position,s=this.force,o=this.torque,l=this.quaternion,c=this.invMass,h=this.invInertiaWorld,u=this.linearFactor,d=c*t;i.x+=s.x*d*u.x,i.y+=s.y*d*u.y,i.z+=s.z*d*u.z;const p=h.elements,f=this.angularFactor,m=o.x*f.x,g=o.y*f.y,v=o.z*f.z;r.x+=t*(p[0]*m+p[1]*g+p[2]*v),r.y+=t*(p[3]*m+p[4]*g+p[5]*v),r.z+=t*(p[6]*m+p[7]*g+p[8]*v),a.x+=i.x*t,a.y+=i.y*t,a.z+=i.z*t,l.integrate(this.angularVelocity,t,this.angularFactor,l),e&&(n?l.normalizeFast():l.normalize()),this.aabbNeedsUpdate=!0,this.updateInertiaWorld()}}ll.idCounter=0,ll.COLLIDE_EVENT_NAME="collide",ll.DYNAMIC=1,ll.STATIC=2,ll.KINEMATIC=4,ll.AWAKE=0,ll.SLEEPY=1,ll.SLEEPING=2,ll.wakeupEvent={type:"wakeup"},ll.sleepyEvent={type:"sleepy"},ll.sleepEvent={type:"sleep"};const cl=new Bo,hl=new Yo,ul=new Go,dl=new Fo,pl=new Fo,fl=(new Fo,new Bo),ml=new Bo,gl=new Bo,vl=new Bo,_l=new Bo,xl=new Bo,yl=new Bo,Ml=new Bo;class Sl{constructor(){this.world=null,this.useBoundingBoxes=!1,this.dirty=!0}collisionPairs(t,e,n){throw new Error("collisionPairs not implemented for this BroadPhase class!")}needBroadphaseCollision(t,e){return!(!(t.collisionFilterGroup&e.collisionFilterMask&&e.collisionFilterGroup&t.collisionFilterMask)||(t.type&ll.STATIC||t.sleepState===ll.SLEEPING)&&(e.type&ll.STATIC||e.sleepState===ll.SLEEPING))}intersectionTest(t,e,n,i){this.useBoundingBoxes?this.doBoundingBoxBroadphase(t,e,n,i):this.doBoundingSphereBroadphase(t,e,n,i)}doBoundingSphereBroadphase(t,e,n,i){const r=El;e.position.vsub(t.position,r);const a=(t.boundingRadius+e.boundingRadius)**2;r.lengthSquared()n.lengthSquared()}aabbQuery(t,e,n){return console.warn(".aabbQuery is not implemented in this Broadphase subclass."),[]}}const El=new Bo;new Bo,new Yo,new Bo;const bl={keys:[]},wl=[],Tl=[];new Bo,new Bo,new Bo;class Al extends Sl{constructor(){super()}collisionPairs(t,e,n){const i=t.bodies,r=i.length;let a,s;for(let t=0;t!==r;t++)for(let r=0;r!==t;r++)a=i[t],s=i[r],this.needBroadphaseCollision(a,s)&&this.intersectionTest(a,s,e,n)}aabbQuery(t,e,n){void 0===n&&(n=[]);for(let i=0;i{}}intersectWorld(t,e){return this.mode=e.mode||Ol.ANY,this.result=e.result||new Rl,this.skipBackfaces=!!e.skipBackfaces,this.collisionFilterMask=void 0!==e.collisionFilterMask?e.collisionFilterMask:-1,this.collisionFilterGroup=void 0!==e.collisionFilterGroup?e.collisionFilterGroup:-1,this.checkCollisionResponse=void 0===e.checkCollisionResponse||e.checkCollisionResponse,e.from&&this.from.copy(e.from),e.to&&this.to.copy(e.to),this.callback=e.callback||(()=>{}),this.hasHit=!1,this.result.reset(),this.updateDirection(),this.getAABB(Fl),zl.length=0,t.broadphase.aabbQuery(t,Fl,zl),this.intersectBodies(zl),this.hasHit}intersectBody(t,e){e&&(this.result=e,this.updateDirection());const n=this.checkCollisionResponse;if(n&&!t.collisionResponse)return;if(!(this.collisionFilterGroup&t.collisionFilterMask&&t.collisionFilterGroup&this.collisionFilterMask))return;const i=Hl,r=kl;for(let e=0,a=t.shapes.length;et.boundingSphereRadius)return;const a=this[t.type];a&&a.call(this,t,e,n,i,t)}_intersectBox(t,e,n,i,r){return this._intersectConvex(t.convexPolyhedronRepresentation,e,n,i,r)}_intersectPlane(t,e,n,i,r){const a=this.from,s=this.to,o=this.direction,l=new Bo(0,0,1);e.vmult(l,l);const c=new Bo;a.vsub(n,c);const h=c.dot(l);if(s.vsub(n,c),h*c.dot(l)>0)return;if(a.distanceTo(s)=0&&t<=1&&(a.lerp(s,t,u),u.vsub(n,d),d.normalize(),this.reportIntersection(d,u,r,i,-1)),this.result.shouldStop)return;e>=0&&e<=1&&(a.lerp(s,e,u),u.vsub(n,d),d.normalize(),this.reportIntersection(d,u,r,i,-1))}}_intersectConvex(t,e,n,i,r,a){const s=Ql,o=tc,l=a&&a.faceList||null,c=t.faces,h=t.vertices,u=t.faceNormals,d=this.direction,p=this.from,f=this.to,m=p.distanceTo(f),g=l?l.length:c.length,v=this.result;for(let t=0;!v.shouldStop&&tm||this.reportIntersection(s,Gl,r,i,a)}}}}_intersectTrimesh(t,e,n,i,r,a){const s=ec,o=oc,l=lc,c=tc,h=nc,u=ic,d=rc,p=sc,f=ac,m=t.indices;t.vertices;const g=this.from,v=this.to,_=this.direction;l.position.copy(n),l.quaternion.copy(e),$o.vectorToLocalFrame(n,e,_,h),$o.pointToLocalFrame(n,e,g,u),$o.pointToLocalFrame(n,e,v,d),d.x*=t.scale.x,d.y*=t.scale.y,d.z*=t.scale.z,u.x*=t.scale.x,u.y*=t.scale.y,u.z*=t.scale.z,d.vsub(u,h),h.normalize();const x=u.distanceSquared(d);t.tree.rayQuery(this,l,o);for(let a=0,l=o.length;!this.result.shouldStop&&a!==l;a++){const l=o[a];t.getNormal(l,s),t.getVertex(m[3*l],Wl),Wl.vsub(u,c);const d=h.dot(s),g=s.dot(c)/d;if(g<0)continue;h.scale(g,Gl),Gl.vadd(u,Gl),t.getVertex(m[3*l+1],jl),t.getVertex(m[3*l+2],ql);const v=Gl.distanceSquared(u);!Ol.pointInTriangle(Gl,jl,Wl,ql)&&!Ol.pointInTriangle(Gl,Wl,jl,ql)||v>x||($o.vectorToWorldFrame(e,s,f),$o.pointToWorldFrame(n,e,Gl,p),this.reportIntersection(f,p,r,i,l))}o.length=0}reportIntersection(t,e,n,i,r){const a=this.from,s=this.to,o=a.distanceTo(e),l=this.result;if(!(this.skipBackfaces&&t.dot(this.direction)>0))switch(l.hitFaceIndex=void 0!==r?r:-1,this.mode){case Ol.ALL:this.hasHit=!0,l.set(a,s,t,e,n,i,o),l.hasHit=!0,this.callback(l);break;case Ol.CLOSEST:(o=0&&(h=r*l-a*s)>=0&&c+he.maxForce&&(d=e.maxForce-m),_[t]+=d,p+=d>0?d:-d,e.addToWlambda(d)}if(p*pt;)e.pop();for(;e.length=0&&c.restitution>=0&&(s.restitution=l.restitution*c.restitution),s.si=r||n,s.sj=a||i,s}createFrictionEquationsFromContact(t,e){const n=t.bi,i=t.bj,r=t.si,a=t.sj,s=this.world,o=this.currentContactMaterial;let l=o.friction;const c=r.material||n.material,h=a.material||i.material;if(c&&h&&c.friction>=0&&h.friction>=0&&(l=c.friction*h.friction),l>0){const r=l*(s.frictionGravity||s.gravity).length();let a=n.invMass+i.invMass;a>0&&(a=1/a);const c=this.frictionEquationPool,h=c.length?c.pop():new Pc(n,i,r*a),u=c.length?c.pop():new Pc(n,i,r*a);return h.bi=u.bi=n,h.bj=u.bj=i,h.minForce=u.minForce=-r*a,h.maxForce=u.maxForce=r*a,h.ri.copy(t.ri),h.rj.copy(t.rj),u.ri.copy(t.ri),u.rj.copy(t.rj),t.ni.tangents(h.t,u.t),h.setSpookParams(o.frictionEquationStiffness,o.frictionEquationRelaxation,s.dt),u.setSpookParams(o.frictionEquationStiffness,o.frictionEquationRelaxation,s.dt),h.enabled=u.enabled=t.enabled,e.push(h,u),!0}return!1}createFrictionFromAverage(t){let e=this.result[this.result.length-1];if(!this.createFrictionEquationsFromContact(e,this.frictionResult)||1===t)return;const n=this.frictionResult[this.frictionResult.length-2],i=this.frictionResult[this.frictionResult.length-1];gh.setZero(),vh.setZero(),_h.setZero();const r=e.bi;e.bj;for(let n=0;n!==t;n++)e=this.result[this.result.length-1-n],e.bi!==r?(gh.vadd(e.ni,gh),vh.vadd(e.ri,vh),_h.vadd(e.rj,_h)):(gh.vsub(e.ni,gh),vh.vadd(e.rj,vh),_h.vadd(e.ri,_h));const a=1/t;vh.scale(a,n.ri),_h.scale(a,n.rj),i.ri.copy(n.ri),i.rj.copy(n.rj),gh.normalize(),gh.tangents(n.t,i.t)}getContacts(t,e,n,i,r,a,s){this.contactPointPool=r,this.frictionEquationPool=s,this.result=i,this.frictionResult=a;const o=Mh,l=Sh,c=xh,h=yh;for(let i=0,r=t.length;i!==r;i++){const r=t[i],a=e[i];let s=null;r.material&&a.material&&(s=n.getContactMaterial(r.material,a.material)||null);const u=r.type&ll.KINEMATIC&&a.type&ll.STATIC||r.type&ll.STATIC&&a.type&ll.KINEMATIC||r.type&ll.KINEMATIC&&a.type&ll.KINEMATIC;for(let t=0;te.boundingSphereRadius+i.boundingSphereRadius)continue;let d=null;e.material&&i.material&&(d=n.getContactMaterial(e.material,i.material)||null),this.currentContactMaterial=d||s||n.defaultContactMaterial;const p=this[e.type|i.type];if(p){let t=!1;t=e.type0){const r=Kh,a=Zh;r.copy(d[(t+1)%3]),a.copy(d[(t+2)%3]);const s=r.length(),o=a.length();r.normalize(),a.normalize();const l=Xh.dot(r),c=Xh.dot(a);if(l-s&&c-o){const t=Math.abs(i-n-p);if((null===S||tt.boundingSphereRadius+e.boundingSphereRadius)&&t.findSeparatingAxis(e,n,r,i,a,p,u,d)){const u=[],d=vu;t.clipAgainstHull(n,r,e,i,a,p,-100,100,u);let f=0;for(let r=0;r!==u.length;r++){if(h)return!0;const a=this.createContactEquation(s,o,t,e,l,c),m=a.ri,g=a.rj;p.negate(a.ni),u[r].normal.negate(d),d.scale(u[r].depth,d),u[r].point.vadd(d,m),g.copy(u[r].point),m.vsub(n,m),g.vsub(i,g),m.vadd(n,m),m.vsub(s.position,m),g.vadd(i,g),g.vsub(o.position,g),this.result.push(a),f++,this.enableFrictionReduction||this.createFrictionEquationsFromContact(a,this.frictionResult)}this.enableFrictionReduction&&f&&this.createFrictionFromAverage(f)}}sphereConvex(t,e,n,i,r,a,s,o,l,c,h){const u=this.v3pool;n.vsub(i,nu);const d=e.faceNormals,p=e.faces,f=e.vertices,m=t.radius;let g=!1;for(let r=0;r!==f.length;r++){const u=f[r],d=su;a.vmult(u,d),i.vadd(d,d);const p=au;if(d.vsub(n,p),p.lengthSquared()0){const r=[];for(let t=0,e=_.length;t!==e;t++){const e=u.get();a.vmult(f[_[t]],e),i.vadd(e,e),r.push(e)}if(qh(r,x,n)){if(h)return!0;g=!0;const a=this.createContactEquation(s,o,t,e,l,c);x.scale(-m,a.ri),x.negate(a.ni);const d=u.get();x.scale(-E,d);const p=u.get();x.scale(-m,p),n.vsub(i,a.rj),a.rj.vadd(p,a.rj),a.rj.vadd(d,a.rj),a.rj.vadd(i,a.rj),a.rj.vsub(o.position,a.rj),a.ri.vadd(n,a.ri),a.ri.vsub(s.position,a.ri),u.release(d),u.release(p),this.result.push(a),this.createFrictionEquationsFromContact(a,this.frictionResult);for(let t=0,e=r.length;t!==e;t++)u.release(r[t]);return}for(let d=0;d!==_.length;d++){const p=u.get(),g=u.get();a.vmult(f[_[(d+1)%_.length]],p),a.vmult(f[_[(d+2)%_.length]],g),i.vadd(p,p),i.vadd(g,g);const v=iu;g.vsub(p,v);const x=ru;v.unit(x);const y=u.get(),M=u.get();n.vsub(p,M);const S=M.dot(x);x.scale(S,y),y.vadd(p,y);const E=u.get();if(y.vsub(n,E),S>0&&S*Su.length||_>u[0].length)return;g<0&&(g=0),v<0&&(v=0),_<0&&(_=0),x<0&&(x=0),g>=u.length&&(g=u.length-1),v>=u.length&&(v=u.length-1),x>=u[0].length&&(x=u[0].length-1),_>=u[0].length&&(_=u[0].length-1);const y=[];e.getRectMinMax(g,_,v,x,y);const M=y[0],S=y[1];if(m.z-d>S||m.z+d2)return}}boxHeightfield(t,e,n,i,r,a,s,o,l,c,h){return t.convexPolyhedronRepresentation.material=t.material,t.convexPolyhedronRepresentation.collisionResponse=t.collisionResponse,this.convexHeightfield(t.convexPolyhedronRepresentation,e,n,i,r,a,s,o,t,e,h)}convexHeightfield(t,e,n,i,r,a,s,o,l,c,h){const u=e.data,d=e.elementSize,p=t.boundingSphereRadius,f=Ru,m=Cu,g=Au;$o.pointToLocalFrame(i,a,n,g);let v=Math.floor((g.x-p)/d)-1,_=Math.ceil((g.x+p)/d)+1,x=Math.floor((g.y-p)/d)-1,y=Math.ceil((g.y+p)/d)+1;if(_<0||y<0||v>u.length||x>u[0].length)return;v<0&&(v=0),_<0&&(_=0),x<0&&(x=0),y<0&&(y=0),v>=u.length&&(v=u.length-1),_>=u.length&&(_=u.length-1),y>=u[0].length&&(y=u[0].length-1),x>=u[0].length&&(x=u[0].length-1);const M=[];e.getRectMinMax(v,x,_,y,M);const S=M[0],E=M[1];if(!(g.z-p>E||g.z+p0&&_<0&&(m.vsub(u,g),f.copy(p),f.normalize(),x=g.dot(f),f.scale(x,g),g.vadd(u,g),g.distanceTo(m)0&&!0===i||h<=0&&!1===i))return!1;null===i&&(i=h>0)}return!0}const Xh=new Bo,Yh=new Bo,Kh=new Bo,Zh=new Bo,Jh=[new Bo,new Bo,new Bo,new Bo,new Bo,new Bo],$h=new Bo,Qh=new Bo,tu=new Bo,eu=new Bo,nu=new Bo,iu=new Bo,ru=new Bo,au=new Bo,su=new Bo,ou=new Bo,lu=new Bo,cu=new Bo,hu=new Bo,uu=new Bo;new Bo,new Bo;const du=new Bo,pu=new Bo,fu=new Bo,mu=new Bo,gu=new Bo,vu=new Bo,_u=new Bo,xu=new Bo,yu=new Bo,Mu=new Bo,Su=new Yo,Eu=new Bo;new Bo;const bu=new Bo,wu=new Bo,Tu=new Bo,Au=new Bo,Ru=new Bo,Cu=[0],Pu=new Bo,Lu=new Bo;class Iu{constructor(){this.current=[],this.previous=[]}getKey(t,e){if(ei[r];)r++;if(n!==i[r]){for(let t=i.length-1;t>=r;t--)i[t+1]=i[t];i[r]=n}}tick(){const t=this.current;this.current=this.previous,this.previous=t,this.current.length=0}getDiff(t,e){const n=this.current,i=this.previous,r=n.length,a=i.length;let s=0;for(let e=0;ei[s];)s++;r=a===i[s],r||Nu(t,a)}s=0;for(let t=0;tn[s];)s++;r=n[s]===a,r||Nu(e,a)}}}function Nu(t,e){t.push((4294901760&e)>>16,65535&e)}const Uu=(t,e)=>t0;)delete t[e.pop()]}}new Go;const Ou=new Ol,Fu=globalThis.performance||{};if(!Fu.now){let t=Date.now();Fu.timing&&Fu.timing.navigationStart&&(t=Fu.timing.navigationStart),Fu.now=()=>Date.now()-t}new Bo;const zu={type:"postStep"},Bu={type:"preStep"},Vu={type:ll.COLLIDE_EVENT_NAME,body:null,contact:null},Hu=[],ku=[],Gu=[],Wu=[],ju=[],qu=[],Xu={type:"beginContact",bodyA:null,bodyB:null},Yu={type:"endContact",bodyA:null,bodyB:null},Ku={type:"beginShapeContact",bodyA:null,bodyB:null,shapeA:null,shapeB:null},Zu={type:"endShapeContact",bodyA:null,bodyB:null,shapeA:null,shapeB:null};var Ju=function(){var t=0,e=document.createElement("div");function n(t){return e.appendChild(t.dom),t}function i(n){for(var i=0;i=a+1e3&&(o.update(1e3*s/(t-a),100),a=t,s=0,c)){var e=performance.memory;c.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576)}return t},update:function(){r=this.end()},domElement:e,setMode:i}};Ju.Panel=function(t,e,n){var i=1/0,r=0,a=Math.round,s=a(window.devicePixelRatio||1),o=80*s,l=48*s,c=3*s,h=2*s,u=3*s,d=15*s,p=74*s,f=30*s,m=document.createElement("canvas");m.width=o,m.height=l,m.style.cssText="width:80px;height:48px";var g=m.getContext("2d");return g.font="bold "+9*s+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=n,g.fillRect(0,0,o,l),g.fillStyle=e,g.fillText(t,c,h),g.fillRect(u,d,p,f),g.fillStyle=n,g.globalAlpha=.9,g.fillRect(u,d,p,f),{dom:m,update:function(l,v){i=Math.min(i,l),r=Math.max(r,l),g.fillStyle=n,g.globalAlpha=1,g.fillRect(0,0,o,d),g.fillStyle=e,g.fillText(a(l)+" "+t+" ("+a(i)+"-"+a(r)+")",c,h),g.drawImage(m,u+s,d,p-s,f,u,d,p-s,f),g.fillRect(u+p-s,d,s,f),g.fillStyle=n,g.globalAlpha=.9,g.fillRect(u+p-s,d,s,a((1-l/v)*f))}}};const $u=Ju;var Qu=!1,td=!1;document.addEventListener("DOMContentLoaded",(function(){var t=document.getElementById("mainButton");t?t.onclick=function(){Qu?(ad.lock(),td=!1,document.getElementById("menu").style.display="none",Hd()):(ad.lock(),Qu=!0,td=!1,document.getElementById("mainButton").innerText="Resume Game",document.getElementById("menu").style.display="none",Hd())}:console.error("Main button not found!")}));var ed=new class extends Fn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new yn,this.environmentIntensity=1,this.environmentRotation=new yn,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}},nd=new class{constructor(e={}){const{canvas:n=he(),context:i=null,depth:r=!0,stencil:a=!1,alpha:s=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1}=e;let d;if(this.isWebGLRenderer=!0,null!==i){if("undefined"!=typeof WebGLRenderingContext&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=i.getContextAttributes().alpha}else d=s;const p=new Uint32Array(4),f=new Int32Array(4);let m=null,g=null;const v=[],_=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Pt,this.toneMapping=0,this.toneMappingExposure=1;const x=this;let y=!1,M=0,S=0,E=null,b=-1,w=null;const T=new Ae,A=new Ae;let R=null;const C=new Qn(0);let P=0,L=n.width,I=n.height,O=1,z=null,G=null;const W=new Ae(0,0,L,I),j=new Ae(0,0,L,I);let K=!1;const Z=new rr;let J=!1,$=!1;const Q=new hn,tt=new Ne,et=new Ae,nt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let it=!1;function rt(){return null===E?O:1}let at,st,ot,lt,ct,ht,ut,dt,pt,ft,mt,gt,vt,_t,xt,yt,Mt,St,Et,bt,wt,Tt,At,Rt,Ct=i;function It(t,e){return n.getContext(t,e)}try{const e={alpha:!0,depth:r,stencil:a,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${t}`),n.addEventListener("webglcontextlost",Dt,!1),n.addEventListener("webglcontextrestored",Ot,!1),n.addEventListener("webglcontextcreationerror",Ft,!1),null===Ct){const t="webgl2";if(Ct=It(t,e),null===Ct)throw It(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function Nt(){at=new Fr(Ct),at.init(),Tt=new Us(Ct,at),st=new vr(Ct,at,e,Tt),ot=new Ls(Ct),lt=new Vr(Ct),ct=new vs,ht=new Ns(Ct,at,ot,ct,st,Tt,lt),ut=new xr(x),dt=new Or(x),pt=new sr(Ct),At=new mr(Ct,pt),ft=new zr(Ct,pt,lt,At),mt=new kr(Ct,ft,pt,lt),Et=new Hr(Ct,st,ht),yt=new _r(ct),gt=new gs(x,ut,dt,at,st,At,yt),vt=new Gs(x,ct),_t=new Ms,xt=new As(at),St=new fr(x,ut,dt,ot,mt,d,l),Mt=new Ps(x,mt,st),Rt=new Ws(Ct,lt,st,ot),bt=new gr(Ct,at,lt),wt=new Br(Ct,at,lt),lt.programs=gt.programs,x.capabilities=st,x.extensions=at,x.properties=ct,x.renderLists=_t,x.shadowMap=Mt,x.state=ot,x.info=lt}Nt();const Ut=new Vs(x,Ct);function Dt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),y=!0}function Ot(){console.log("THREE.WebGLRenderer: Context Restored."),y=!1;const t=lt.autoReset,e=Mt.enabled,n=Mt.autoUpdate,i=Mt.needsUpdate,r=Mt.type;Nt(),lt.autoReset=t,Mt.enabled=e,Mt.autoUpdate=n,Mt.needsUpdate=i,Mt.type=r}function Ft(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function zt(t){const e=t.target;e.removeEventListener("dispose",zt),function(t){(function(t){const e=ct.get(t).programs;void 0!==e&&(e.forEach((function(t){gt.releaseProgram(t)})),t.isShaderMaterial&>.releaseShaderCache(t))})(t),ct.remove(t)}(e)}function Bt(t,e,n){!0===t.transparent&&2===t.side&&!1===t.forceSinglePass?(t.side=1,t.needsUpdate=!0,Kt(t,e,n),t.side=0,t.needsUpdate=!0,Kt(t,e,n),t.side=2):Kt(t,e,n)}this.xr=Ut,this.getContext=function(){return Ct},this.getContextAttributes=function(){return Ct.getContextAttributes()},this.forceContextLoss=function(){const t=at.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=at.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return O},this.setPixelRatio=function(t){void 0!==t&&(O=t,this.setSize(L,I,!1))},this.getSize=function(t){return t.set(L,I)},this.setSize=function(t,e,i=!0){Ut.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(L=t,I=e,n.width=Math.floor(t*O),n.height=Math.floor(e*O),!0===i&&(n.style.width=t+"px",n.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(t){return t.set(L*O,I*O).floor()},this.setDrawingBufferSize=function(t,e,i){L=t,I=e,O=i,n.width=Math.floor(t*i),n.height=Math.floor(e*i),this.setViewport(0,0,t,e)},this.getCurrentViewport=function(t){return t.copy(T)},this.getViewport=function(t){return t.copy(W)},this.setViewport=function(t,e,n,i){t.isVector4?W.set(t.x,t.y,t.z,t.w):W.set(t,e,n,i),ot.viewport(T.copy(W).multiplyScalar(O).round())},this.getScissor=function(t){return t.copy(j)},this.setScissor=function(t,e,n,i){t.isVector4?j.set(t.x,t.y,t.z,t.w):j.set(t,e,n,i),ot.scissor(A.copy(j).multiplyScalar(O).round())},this.getScissorTest=function(){return K},this.setScissorTest=function(t){ot.setScissorTest(K=t)},this.setOpaqueSort=function(t){z=t},this.setTransparentSort=function(t){G=t},this.getClearColor=function(t){return t.copy(St.getClearColor())},this.setClearColor=function(){St.setClearColor.apply(St,arguments)},this.getClearAlpha=function(){return St.getClearAlpha()},this.setClearAlpha=function(){St.setClearAlpha.apply(St,arguments)},this.clear=function(t=!0,e=!0,n=!0){let i=0;if(t){let t=!1;if(null!==E){const e=E.texture.format;t=e===Y||e===X||e===q}if(t){const t=E.texture.type,e=t===U||t===F||t===D||t===k||t===V||t===H,n=St.getClearColor(),i=St.getClearAlpha(),r=n.r,a=n.g,s=n.b;e?(p[0]=r,p[1]=a,p[2]=s,p[3]=i,Ct.clearBufferuiv(Ct.COLOR,0,p)):(f[0]=r,f[1]=a,f[2]=s,f[3]=i,Ct.clearBufferiv(Ct.COLOR,0,f))}else i|=Ct.COLOR_BUFFER_BIT}e&&(i|=Ct.DEPTH_BUFFER_BIT),n&&(i|=Ct.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Ct.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",Dt,!1),n.removeEventListener("webglcontextrestored",Ot,!1),n.removeEventListener("webglcontextcreationerror",Ft,!1),_t.dispose(),xt.dispose(),ct.dispose(),ut.dispose(),dt.dispose(),mt.dispose(),At.dispose(),Rt.dispose(),gt.dispose(),Ut.dispose(),Ut.removeEventListener("sessionstart",Ht),Ut.removeEventListener("sessionend",kt),Gt.stop()},this.renderBufferDirect=function(t,e,n,i,r,a){null===e&&(e=nt);const s=r.isMesh&&r.matrixWorld.determinant()<0,o=function(t,e,n,i,r){!0!==e.isScene&&(e=nt),ht.resetTextureUnits();const a=e.fog,s=i.isMeshStandardMaterial?e.environment:null,o=null===E?x.outputColorSpace:!0===E.isXRRenderTarget?E.texture.colorSpace:Lt,l=(i.isMeshStandardMaterial?dt:ut).get(i.envMap||s),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),u=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let f=0;i.toneMapped&&(null!==E&&!0!==E.isXRRenderTarget||(f=x.toneMapping));const m=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==m?m.length:0,_=ct.get(i),y=g.state.lights;if(!0===J&&(!0===$||t!==w)){const e=t===w&&i.id===b;yt.setState(i,t,e)}let M=!1;i.version===_.__version?_.needsLights&&_.lightsStateVersion!==y.state.version||_.outputColorSpace!==o||r.isBatchedMesh&&!1===_.batching?M=!0:r.isBatchedMesh||!0!==_.batching?r.isBatchedMesh&&!0===_.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===_.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===_.instancing?M=!0:r.isInstancedMesh||!0!==_.instancing?r.isSkinnedMesh&&!1===_.skinning?M=!0:r.isSkinnedMesh||!0!==_.skinning?r.isInstancedMesh&&!0===_.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===_.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===_.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===_.instancingMorph&&null!==r.morphTexture||_.envMap!==l||!0===i.fog&&_.fog!==a?M=!0:void 0===_.numClippingPlanes||_.numClippingPlanes===yt.numPlanes&&_.numIntersection===yt.numIntersection?(_.vertexAlphas!==c||_.vertexTangents!==h||_.morphTargets!==u||_.morphNormals!==d||_.morphColors!==p||_.toneMapping!==f||_.morphTargetsCount!==v)&&(M=!0):M=!0:M=!0:M=!0:M=!0:(M=!0,_.__version=i.version);let S=_.currentProgram;!0===M&&(S=Kt(i,e,r));let T=!1,A=!1,R=!1;const C=S.getUniforms(),P=_.uniforms;if(ot.useProgram(S.program)&&(T=!0,A=!0,R=!0),i.id!==b&&(b=i.id,A=!0),T||w!==t){C.setValue(Ct,"projectionMatrix",t.projectionMatrix),C.setValue(Ct,"viewMatrix",t.matrixWorldInverse);const e=C.map.cameraPosition;void 0!==e&&e.setValue(Ct,tt.setFromMatrixPosition(t.matrixWorld)),st.logarithmicDepthBuffer&&C.setValue(Ct,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&C.setValue(Ct,"isOrthographic",!0===t.isOrthographicCamera),w!==t&&(w=t,A=!0,R=!0)}if(r.isSkinnedMesh){C.setOptional(Ct,r,"bindMatrix"),C.setOptional(Ct,r,"bindMatrixInverse");const t=r.skeleton;t&&(null===t.boneTexture&&t.computeBoneTexture(),C.setValue(Ct,"boneTexture",t.boneTexture,ht))}r.isBatchedMesh&&(C.setOptional(Ct,r,"batchingTexture"),C.setValue(Ct,"batchingTexture",r._matricesTexture,ht),C.setOptional(Ct,r,"batchingIdTexture"),C.setValue(Ct,"batchingIdTexture",r._indirectTexture,ht),C.setOptional(Ct,r,"batchingColorTexture"),null!==r._colorsTexture&&C.setValue(Ct,"batchingColorTexture",r._colorsTexture,ht));const L=n.morphAttributes;var N,U;if(void 0===L.position&&void 0===L.normal&&void 0===L.color||Et.update(r,n,S),(A||_.receiveShadow!==r.receiveShadow)&&(_.receiveShadow=r.receiveShadow,C.setValue(Ct,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(P.envMap.value=l,P.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==e.environment&&(P.envMapIntensity.value=e.environmentIntensity),A&&(C.setValue(Ct,"toneMappingExposure",x.toneMappingExposure),_.needsLights&&(U=R,(N=P).ambientLightColor.needsUpdate=U,N.lightProbe.needsUpdate=U,N.directionalLights.needsUpdate=U,N.directionalLightShadows.needsUpdate=U,N.pointLights.needsUpdate=U,N.pointLightShadows.needsUpdate=U,N.spotLights.needsUpdate=U,N.spotLightShadows.needsUpdate=U,N.rectAreaLights.needsUpdate=U,N.hemisphereLights.needsUpdate=U),a&&!0===i.fog&&vt.refreshFogUniforms(P,a),vt.refreshMaterialUniforms(P,i,O,I,g.state.transmissionRenderTarget[t.id]),Ya.upload(Ct,Zt(_),P,ht)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Ya.upload(Ct,Zt(_),P,ht),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&C.setValue(Ct,"center",r.center),C.setValue(Ct,"modelViewMatrix",r.modelViewMatrix),C.setValue(Ct,"normalMatrix",r.normalMatrix),C.setValue(Ct,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const t=i.uniformsGroups;for(let e=0,n=t.length;e{function n(){i.forEach((function(t){ct.get(t).currentProgram.isReady()&&i.delete(t)})),0!==i.size?setTimeout(n,10):e(t)}null!==at.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)}))};let Vt=null;function Ht(){Gt.stop()}function kt(){Gt.start()}const Gt=new ar;function Wt(t,e,n,i){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)g.pushLight(t),t.castShadow&&g.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||Z.intersectsSprite(t)){i&&et.setFromMatrixPosition(t.matrixWorld).applyMatrix4(Q);const e=mt.update(t),r=t.material;r.visible&&m.push(t,e,r,n,et.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||Z.intersectsObject(t))){const e=mt.update(t),r=t.material;if(i&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),et.copy(t.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),et.copy(e.boundingSphere.center)),et.applyMatrix4(t.matrixWorld).applyMatrix4(Q)),Array.isArray(r)){const i=e.groups;for(let a=0,s=i.length;a0&&Xt(r,e,n),a.length>0&&Xt(a,e,n),s.length>0&&Xt(s,e,n),ot.buffers.depth.setTest(!0),ot.buffers.depth.setMask(!0),ot.buffers.color.setMask(!0),ot.setPolygonOffset(!1)}function qt(t,e,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===g.state.transmissionRenderTarget[i.id]&&(g.state.transmissionRenderTarget[i.id]=new Ce(1,1,{generateMipmaps:!0,type:at.has("EXT_color_buffer_half_float")||at.has("EXT_color_buffer_float")?B:U,minFilter:N,samples:4,stencilBuffer:a,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ve.workingColorSpace}));const r=g.state.transmissionRenderTarget[i.id],s=i.viewport||T;r.setSize(s.z,s.w);const o=x.getRenderTarget();x.setRenderTarget(r),x.getClearColor(C),P=x.getClearAlpha(),P<1&&x.setClearColor(16777215,.5),x.clear(),it&&St.render(n);const l=x.toneMapping;x.toneMapping=0;const c=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),g.setupLightsView(i),!0===J&&yt.setGlobalState(x.clippingPlanes,i),Xt(t,n,i),ht.updateMultisampleRenderTarget(r),ht.updateRenderTargetMipmap(r),!1===at.has("WEBGL_multisampled_render_to_texture")){let t=!1;for(let r=0,a=e.length;r0)for(let e=0,a=n.length;e0&&qt(i,r,t,e),it&&St.render(t),jt(m,t,e);null!==E&&(ht.updateMultisampleRenderTarget(E),ht.updateRenderTargetMipmap(E)),!0===t.isScene&&t.onAfterRender(x,t,e),At.resetDefaultState(),b=-1,w=null,_.pop(),_.length>0?(g=_[_.length-1],!0===J&&yt.setGlobalState(x.clippingPlanes,g.state.camera)):g=null,v.pop(),m=v.length>0?v[v.length-1]:null},this.getActiveCubeFace=function(){return M},this.getActiveMipmapLevel=function(){return S},this.getRenderTarget=function(){return E},this.setRenderTargetTextures=function(t,e,n){ct.get(t.texture).__webglTexture=e,ct.get(t.depthTexture).__webglTexture=n;const i=ct.get(t);i.__hasExternalTextures=!0,i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===at.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(t,e){const n=ct.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,n=0){E=t,M=e,S=n;let i=!0,r=null,a=!1,s=!1;if(t){const o=ct.get(t);if(void 0!==o.__useDefaultFramebuffer)ot.bindFramebuffer(Ct.FRAMEBUFFER,null),i=!1;else if(void 0===o.__webglFramebuffer)ht.setupRenderTarget(t);else if(o.__hasExternalTextures)ht.rebindTextures(t,ct.get(t.texture).__webglTexture,ct.get(t.depthTexture).__webglTexture);else if(t.depthBuffer){const e=t.depthTexture;if(o.__boundDepthTexture!==e){if(null!==e&&ct.has(e)&&(t.width!==e.image.width||t.height!==e.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ht.setupDepthRenderbuffer(t)}}const l=t.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(s=!0);const c=ct.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=Array.isArray(c[e])?c[e][n]:c[e],a=!0):r=t.samples>0&&!1===ht.useMultisampledRTT(t)?ct.get(t).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,T.copy(t.viewport),A.copy(t.scissor),R=t.scissorTest}else T.copy(W).multiplyScalar(O).floor(),A.copy(j).multiplyScalar(O).floor(),R=K;if(ot.bindFramebuffer(Ct.FRAMEBUFFER,r)&&i&&ot.drawBuffers(t,r),ot.viewport(T),ot.scissor(A),ot.setScissorTest(R),a){const i=ct.get(t.texture);Ct.framebufferTexture2D(Ct.FRAMEBUFFER,Ct.COLOR_ATTACHMENT0,Ct.TEXTURE_CUBE_MAP_POSITIVE_X+e,i.__webglTexture,n)}else if(s){const i=ct.get(t.texture),r=e||0;Ct.framebufferTextureLayer(Ct.FRAMEBUFFER,Ct.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}b=-1},this.readRenderTargetPixels=function(t,e,n,i,r,a,s){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=ct.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){ot.bindFramebuffer(Ct.FRAMEBUFFER,o);try{const s=t.texture,o=s.format,l=s.type;if(!st.textureFormatReadable(o))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!st.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&Ct.readPixels(e,n,i,r,Tt.convert(o),Tt.convert(l),a)}finally{const t=null!==E?ct.get(E).__webglFramebuffer:null;ot.bindFramebuffer(Ct.FRAMEBUFFER,t)}}},this.readRenderTargetPixelsAsync=async function(t,e,n,i,r,a,s){if(!t||!t.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=ct.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){ot.bindFramebuffer(Ct.FRAMEBUFFER,o);try{const s=t.texture,o=s.format,l=s.type;if(!st.textureFormatReadable(o))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!st.textureTypeReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r){const t=Ct.createBuffer();Ct.bindBuffer(Ct.PIXEL_PACK_BUFFER,t),Ct.bufferData(Ct.PIXEL_PACK_BUFFER,a.byteLength,Ct.STREAM_READ),Ct.readPixels(e,n,i,r,Tt.convert(o),Tt.convert(l),0),Ct.flush();const s=Ct.fenceSync(Ct.SYNC_GPU_COMMANDS_COMPLETE,0);await function(t,e){return new Promise((function(n,i){setTimeout((function r(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:i();break;case t.TIMEOUT_EXPIRED:setTimeout(r,4);break;default:n()}}),4)}))}(Ct,s);try{Ct.bindBuffer(Ct.PIXEL_PACK_BUFFER,t),Ct.getBufferSubData(Ct.PIXEL_PACK_BUFFER,0,a)}finally{Ct.deleteBuffer(t),Ct.deleteSync(s)}return a}}finally{const t=null!==E?ct.get(E).__webglFramebuffer:null;ot.bindFramebuffer(Ct.FRAMEBUFFER,t)}}},this.copyFramebufferToTexture=function(t,e=null,n=0){!0!==t.isTexture&&(de("WebGLRenderer: copyFramebufferToTexture function signature has changed."),e=arguments[0]||null,t=arguments[1]);const i=Math.pow(2,-n),r=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i),s=null!==e?e.x:0,o=null!==e?e.y:0;ht.setTexture2D(t,0),Ct.copyTexSubImage2D(Ct.TEXTURE_2D,n,0,0,s,o,r,a),ot.unbindTexture()},this.copyTextureToTexture=function(t,e,n=null,i=null,r=0){let a,s,o,l,c,h;!0!==t.isTexture&&(de("WebGLRenderer: copyTextureToTexture function signature has changed."),i=arguments[0]||null,t=arguments[1],e=arguments[2],r=arguments[3]||0,n=null),null!==n?(a=n.max.x-n.min.x,s=n.max.y-n.min.y,o=n.min.x,l=n.min.y):(a=t.image.width,s=t.image.height,o=0,l=0),null!==i?(c=i.x,h=i.y):(c=0,h=0);const u=Tt.convert(e.format),d=Tt.convert(e.type);ht.setTexture2D(e,0),Ct.pixelStorei(Ct.UNPACK_FLIP_Y_WEBGL,e.flipY),Ct.pixelStorei(Ct.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),Ct.pixelStorei(Ct.UNPACK_ALIGNMENT,e.unpackAlignment);const p=Ct.getParameter(Ct.UNPACK_ROW_LENGTH),f=Ct.getParameter(Ct.UNPACK_IMAGE_HEIGHT),m=Ct.getParameter(Ct.UNPACK_SKIP_PIXELS),g=Ct.getParameter(Ct.UNPACK_SKIP_ROWS),v=Ct.getParameter(Ct.UNPACK_SKIP_IMAGES),_=t.isCompressedTexture?t.mipmaps[r]:t.image;Ct.pixelStorei(Ct.UNPACK_ROW_LENGTH,_.width),Ct.pixelStorei(Ct.UNPACK_IMAGE_HEIGHT,_.height),Ct.pixelStorei(Ct.UNPACK_SKIP_PIXELS,o),Ct.pixelStorei(Ct.UNPACK_SKIP_ROWS,l),t.isDataTexture?Ct.texSubImage2D(Ct.TEXTURE_2D,r,c,h,a,s,u,d,_.data):t.isCompressedTexture?Ct.compressedTexSubImage2D(Ct.TEXTURE_2D,r,c,h,_.width,_.height,u,_.data):Ct.texSubImage2D(Ct.TEXTURE_2D,r,c,h,a,s,u,d,_),Ct.pixelStorei(Ct.UNPACK_ROW_LENGTH,p),Ct.pixelStorei(Ct.UNPACK_IMAGE_HEIGHT,f),Ct.pixelStorei(Ct.UNPACK_SKIP_PIXELS,m),Ct.pixelStorei(Ct.UNPACK_SKIP_ROWS,g),Ct.pixelStorei(Ct.UNPACK_SKIP_IMAGES,v),0===r&&e.generateMipmaps&&Ct.generateMipmap(Ct.TEXTURE_2D),ot.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n=null,i=null,r=0){let a,s,o,l,c,h,u,d,p;!0!==t.isTexture&&(de("WebGLRenderer: copyTextureToTexture3D function signature has changed."),n=arguments[0]||null,i=arguments[1]||null,t=arguments[2],e=arguments[3],r=arguments[4]||0);const f=t.isCompressedTexture?t.mipmaps[r]:t.image;null!==n?(a=n.max.x-n.min.x,s=n.max.y-n.min.y,o=n.max.z-n.min.z,l=n.min.x,c=n.min.y,h=n.min.z):(a=f.width,s=f.height,o=f.depth,l=0,c=0,h=0),null!==i?(u=i.x,d=i.y,p=i.z):(u=0,d=0,p=0);const m=Tt.convert(e.format),g=Tt.convert(e.type);let v;if(e.isData3DTexture)ht.setTexture3D(e,0),v=Ct.TEXTURE_3D;else{if(!e.isDataArrayTexture&&!e.isCompressedArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");ht.setTexture2DArray(e,0),v=Ct.TEXTURE_2D_ARRAY}Ct.pixelStorei(Ct.UNPACK_FLIP_Y_WEBGL,e.flipY),Ct.pixelStorei(Ct.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),Ct.pixelStorei(Ct.UNPACK_ALIGNMENT,e.unpackAlignment);const _=Ct.getParameter(Ct.UNPACK_ROW_LENGTH),x=Ct.getParameter(Ct.UNPACK_IMAGE_HEIGHT),y=Ct.getParameter(Ct.UNPACK_SKIP_PIXELS),M=Ct.getParameter(Ct.UNPACK_SKIP_ROWS),S=Ct.getParameter(Ct.UNPACK_SKIP_IMAGES);Ct.pixelStorei(Ct.UNPACK_ROW_LENGTH,f.width),Ct.pixelStorei(Ct.UNPACK_IMAGE_HEIGHT,f.height),Ct.pixelStorei(Ct.UNPACK_SKIP_PIXELS,l),Ct.pixelStorei(Ct.UNPACK_SKIP_ROWS,c),Ct.pixelStorei(Ct.UNPACK_SKIP_IMAGES,h),t.isDataTexture||t.isData3DTexture?Ct.texSubImage3D(v,r,u,d,p,a,s,o,m,g,f.data):e.isCompressedArrayTexture?Ct.compressedTexSubImage3D(v,r,u,d,p,a,s,o,m,f.data):Ct.texSubImage3D(v,r,u,d,p,a,s,o,m,g,f),Ct.pixelStorei(Ct.UNPACK_ROW_LENGTH,_),Ct.pixelStorei(Ct.UNPACK_IMAGE_HEIGHT,x),Ct.pixelStorei(Ct.UNPACK_SKIP_PIXELS,y),Ct.pixelStorei(Ct.UNPACK_SKIP_ROWS,M),Ct.pixelStorei(Ct.UNPACK_SKIP_IMAGES,S),0===r&&e.generateMipmaps&&Ct.generateMipmap(v),ot.unbindTexture()},this.initRenderTarget=function(t){void 0===ct.get(t).__webglFramebuffer&&ht.setupRenderTarget(t)},this.initTexture=function(t){t.isCubeTexture?ht.setTextureCube(t,0):t.isData3DTexture?ht.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?ht.setTexture2DArray(t,0):ht.setTexture2D(t,0),ot.unbindTexture()},this.resetState=function(){M=0,S=0,E=null,ot.reset(),At.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Yt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=t===It?"display-p3":"srgb",e.unpackColorSpace=ve.workingColorSpace===Nt?"display-p3":"srgb"}}({antialias:!0});nd.setSize(window.innerWidth,window.innerHeight),nd.shadowMap.enabled=!0,nd.shadowMap.type=2,document.body.appendChild(nd.domElement);var id=new $u;document.body.appendChild(id.dom);var rd=new Xi(75,window.innerWidth/window.innerHeight,.1,1e3);rd.position.set(0,1.8,5);var ad=new class extends Ao{constructor(t,e=null){super(t,e),this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,this._onMouseMove=Uo.bind(this),this._onPointerlockChange=Do.bind(this),this._onPointerlockError=Oo.bind(this),null!==this.domElement&&this.connect()}connect(){this.domElement.ownerDocument.addEventListener("mousemove",this._onMouseMove),this.domElement.ownerDocument.addEventListener("pointerlockchange",this._onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this._onPointerlockError)}disconnect(){this.domElement.ownerDocument.removeEventListener("mousemove",this._onMouseMove),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this._onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this._onPointerlockError)}dispose(){this.disconnect()}getObject(){return console.warn("THREE.PointerLockControls: getObject() has been deprecated. Use controls.object instead."),this.object}getDirection(t){return t.set(0,0,-1).applyQuaternion(this.object.quaternion)}moveForward(t){if(!1===this.enabled)return;const e=this.object;Co.setFromMatrixColumn(e.matrix,0),Co.crossVectors(e.up,Co),e.position.addScaledVector(Co,t)}moveRight(t){if(!1===this.enabled)return;const e=this.object;Co.setFromMatrixColumn(e.matrix,0),e.position.addScaledVector(Co,t)}lock(){this.domElement.requestPointerLock()}unlock(){this.domElement.ownerDocument.exitPointerLock()}}(rd,document.body);document.body.addEventListener("click",(function(){Qu&&ad.lock()})),ad.addEventListener("lock",(function(){td||(document.getElementById("menu").style.display="none")})),ad.addEventListener("unlock",(function(){Qu&&(td=!0,document.getElementById("menu").style.display="block")})),window.addEventListener("resize",(function(){nd.setSize(window.innerWidth,window.innerHeight),rd.aspect=window.innerWidth/window.innerHeight,rd.updateProjectionMatrix()}));var sd=(new class extends so{constructor(t){super(t)}load(t,e,n,i){const r=new Zi;r.colorSpace=Pt;const a=new oo(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let s=0;function o(n){a.load(t[n],(function(t){r.images[n]=t,s++,6===s&&(r.needsUpdate=!0,e&&e(r))}),void 0,i)}for(let e=0;e=t&&r1e3*t)););this.accumulator=this.accumulator%t;const a=this.accumulator/t;for(let t=0;t!==this.bodies.length;t++){const e=this.bodies[t];e.previousPosition.lerp(e.position,a,e.interpolatedPosition),e.previousQuaternion.slerp(e.quaternion,a,e.interpolatedQuaternion),e.previousQuaternion.normalize()}this.time+=e}}internalStep(t){this.dt=t;const e=this.contacts,n=Gu,i=Wu,r=this.bodies.length,a=this.bodies,s=this.solver,o=this.gravity,l=this.doProfiling,c=this.profile,h=ll.DYNAMIC;let u=-1/0;const d=this.constraints,p=ku;o.length();const f=o.x,m=o.y,g=o.z;let v=0;for(l&&(u=Fu.now()),v=0;v!==r;v++){const t=a[v];if(t.type===h){const e=t.force,n=t.mass;e.x+=n*f,e.y+=n*m,e.z+=n*g}}for(let t=0,e=this.subsystems.length;t!==e;t++)this.subsystems[t].update();l&&(u=Fu.now()),n.length=0,i.length=0,this.broadphase.collisionPairs(this,n,i),l&&(c.broadphase=Fu.now()-u);let _=d.length;for(v=0;v!==_;v++){const t=d[v];if(!t.collideConnected)for(let e=n.length-1;e>=0;e-=1)(t.bodyA===n[e]&&t.bodyB===i[e]||t.bodyB===n[e]&&t.bodyA===i[e])&&(n.splice(e,1),i.splice(e,1))}this.collisionMatrixTick(),l&&(u=Fu.now());const x=Hu,y=e.length;for(v=0;v!==y;v++)x.push(e[v]);e.length=0;const M=this.frictionEquations.length;for(v=0;v!==M;v++)p.push(this.frictionEquations[v]);for(this.frictionEquations.length=0,this.narrowphase.getContacts(n,i,this,e,x,this.frictionEquations,p),l&&(c.narrowphase=Fu.now()-u),l&&(u=Fu.now()),v=0;v=0&&r.material.friction>=0&&(i.material.friction,r.material.friction),i.material.restitution>=0&&r.material.restitution>=0&&(n.restitution=i.material.restitution*r.material.restitution)),s.addEquation(n),i.allowSleep&&i.type===ll.DYNAMIC&&i.sleepState===ll.SLEEPING&&r.sleepState===ll.AWAKE&&r.type!==ll.STATIC&&r.velocity.lengthSquared()+r.angularVelocity.lengthSquared()>=2*r.sleepSpeedLimit**2&&(i.wakeUpAfterNarrowphase=!0),r.allowSleep&&r.type===ll.DYNAMIC&&r.sleepState===ll.SLEEPING&&i.sleepState===ll.AWAKE&&i.type!==ll.STATIC&&i.velocity.lengthSquared()+i.angularVelocity.lengthSquared()>=2*i.sleepSpeedLimit**2&&(r.wakeUpAfterNarrowphase=!0),this.collisionMatrix.set(i,r,!0),this.collisionMatrixPrevious.get(i,r)||(Vu.body=r,Vu.contact=n,i.dispatchEvent(Vu),Vu.body=i,r.dispatchEvent(Vu)),this.bodyOverlapKeeper.set(i.id,r.id),this.shapeOverlapKeeper.set(a.id,o.id)}for(this.emitContactEvents(),l&&(c.makeContactConstraints=Fu.now()-u,u=Fu.now()),v=0;v!==r;v++){const t=a[v];t.wakeUpAfterNarrowphase&&(t.wakeUp(),t.wakeUpAfterNarrowphase=!1)}for(_=d.length,v=0;v!==_;v++){const t=d[v];t.update();for(let e=0,n=t.equations.length;e!==n;e++){const n=t.equations[e];s.addEquation(n)}}s.solve(t,this),l&&(c.solve=Fu.now()-u),s.removeAllEquations();const E=Math.pow;for(v=0;v!==r;v++){const e=a[v];if(e.type&h){const n=E(1-e.linearDamping,t),i=e.velocity;i.scale(n,i);const r=e.angularVelocity;if(r){const n=E(1-e.angularDamping,t);r.scale(n,r)}}}this.dispatchEvent(Bu),l&&(u=Fu.now());const b=this.stepnumber%(this.quatNormalizeSkip+1)==0,w=this.quatNormalizeFast;for(v=0;v!==r;v++)a[v].integrate(t,b,w);this.clearForces(),this.broadphase.dirty=!0,l&&(c.integrate=Fu.now()-u),this.stepnumber+=1,this.dispatchEvent(zu);let T=!0;if(this.allowSleep)for(T=!1,v=0;v!==r;v++){const t=a[v];t.sleepTick(this.time),t.sleepState!==ll.SLEEPING&&(T=!0)}this.hasActiveBodies=T}emitContactEvents(){const t=this.hasAnyEventListener("beginContact"),e=this.hasAnyEventListener("endContact");if((t||e)&&this.bodyOverlapKeeper.getDiff(ju,qu),t){for(let t=0,e=ju.length;t0){var n,i=e[0].object;i===Ed?n=bd:i===wd&&(n=Td),Ad.position.distanceTo(i.position)<=2.5&&((Fd=n).angularVelocity.set(0,0,0),Fd.angularDamping=1,Fd.type=ll.KINEMATIC,Fd.allowSleep=!1,Fd.gravityScale=0,Fd.collisionResponse=!1)}}();break;case"KeyF":Fd&&function(){if(Fd){var t=new Bo,e=new Ne;rd.getWorldDirection(e),t.set(20*e.x,20*e.y,20*e.z),Fd.velocity.copy(t),Bd()}}()}})),document.addEventListener("keyup",(function(t){switch(t.code){case"KeyW":Rd=!1;break;case"KeyS":Cd=!1;break;case"KeyA":Pd=!1;break;case"KeyD":Ld=!1;break;case"ControlLeft":Nd=!1}}));var Vd=new class{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=mo(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=mo();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}};function Hd(){if(!td){var t=Vd.getDelta();od.step(ld,t,cd),function(t){Od.set(0,0,0);var e=Nd?Ud*Dd:Ud,n=new Ne;rd.getWorldDirection(n);var i=new Ne;if(i.crossVectors(n,rd.up).normalize(),Rd&&Od.add(n.multiplyScalar(e*t)),Cd&&Od.add(n.multiplyScalar(-e*t)),Pd&&Od.add(i.multiplyScalar(-e*t)),Ld&&Od.add(i.multiplyScalar(e*t)),Ad.velocity.x=Od.x,Ad.velocity.z=Od.z,rd.position.copy(Ad.position),ad.object.position.copy(Ad.position),Fd){var r=new Ne;rd.getWorldDirection(r),r.normalize(),zd.copy(rd.position).add(r.multiplyScalar(2)),Fd.position.set(zd.x,zd.y,zd.z)}}(t),gd.position.copy(vd.position),gd.quaternion.copy(vd.quaternion),_d.position.copy(xd.position),_d.quaternion.copy(xd.quaternion),Ed.position.copy(bd.position),Ed.quaternion.copy(bd.quaternion),wd.position.copy(Td.position),wd.quaternion.copy(Td.quaternion),id.update(),nd.render(ed,rd),requestAnimationFrame(Hd)}}Hd()})(); \ No newline at end of file diff --git a/dist/bundle.js.LICENSE.txt b/dist/bundle.js.LICENSE.txt new file mode 100644 index 0000000..f4c5bed --- /dev/null +++ b/dist/bundle.js.LICENSE.txt @@ -0,0 +1,5 @@ +/** + * @license + * Copyright 2010-2024 Three.js Authors + * SPDX-License-Identifier: MIT + */ diff --git a/dist/index.html b/dist/index.html index 3954908..0742d0d 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1,74 +1 @@ - - - - - - 3D Game Scene - - - - - - - - \ No newline at end of file +3D Game Scene \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 72d897c..e61cb1e 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -1785,7 +1785,6 @@ "version": "0.5.7", "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", - "dev": true, "license": "MIT", "engines": { "node": ">=10.0.0" @@ -1795,7 +1794,6 @@ "version": "0.3.5", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", - "dev": true, "license": "MIT", "dependencies": { "@jridgewell/set-array": "^1.2.1", @@ -1810,7 +1808,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, "license": "MIT", "engines": { "node": ">=6.0.0" @@ -1820,7 +1817,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", - "dev": true, "license": "MIT", "engines": { "node": ">=6.0.0" @@ -1830,7 +1826,6 @@ "version": "0.3.6", "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", - "dev": true, "license": "MIT", "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", @@ -1841,20 +1836,75 @@ "version": "1.5.0", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true, "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.25", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", - "dev": true, "license": "MIT", "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@jsonjoy.com/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jsonjoy.com/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-q6XAnWQDIMA3+FTiOYajoYqySkO+JSat0ytXGSuRdq9uXE7o92gzuQwQM14xaCRlBLGq3v5miDGC4vkVTn54xA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" + } + }, + "node_modules/@jsonjoy.com/json-pack": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@jsonjoy.com/json-pack/-/json-pack-1.1.0.tgz", + "integrity": "sha512-zlQONA+msXPPwHWZMKFVS78ewFczIll5lXiVPwFPCZUsrOKdxc2AvxU1HoNBmMRhqDZUR9HkC3UOm+6pME6Xsg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@jsonjoy.com/base64": "^1.1.1", + "@jsonjoy.com/util": "^1.1.2", + "hyperdyperid": "^1.2.0", + "thingies": "^1.20.0" + }, + "engines": { + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" + } + }, + "node_modules/@jsonjoy.com/util": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@jsonjoy.com/util/-/util-1.3.0.tgz", + "integrity": "sha512-Cebt4Vk7k1xHy87kHY7KSPLT77A7Ev7IfOblyLZhtYEhrdQ6fX4EoLq3xOQ3O/DRMEh2ok5nyC180E+ABS8Wmw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" + } + }, "node_modules/@leichtgewicht/ip-codec": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz", @@ -1905,10 +1955,9 @@ } }, "node_modules/@types/estree": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", - "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", - "dev": true, + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", "license": "MIT" }, "node_modules/@types/express": { @@ -1965,7 +2014,6 @@ "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true, "license": "MIT" }, "node_modules/@types/mime": { @@ -1976,10 +2024,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.5.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz", - "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==", - "dev": true, + "version": "22.5.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.5.tgz", + "integrity": "sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==", "license": "MIT", "dependencies": { "undici-types": "~6.19.2" @@ -1996,9 +2043,9 @@ } }, "node_modules/@types/qs": { - "version": "6.9.15", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.15.tgz", - "integrity": "sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==", + "version": "6.9.16", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.16.tgz", + "integrity": "sha512-7i+zxXdPD0T4cKDuxCUXJ4wHcsJLwENa6Z3dCu8cfCK743OGy5Nu1RmAGqDPsoTDINVEcdXKRvR/zre+P2Ku1A==", "dev": true, "license": "MIT" }, @@ -2010,9 +2057,9 @@ "license": "MIT" }, "node_modules/@types/retry": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", - "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz", + "integrity": "sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==", "dev": true, "license": "MIT" }, @@ -2073,7 +2120,6 @@ "version": "1.12.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.12.1.tgz", "integrity": "sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg==", - "dev": true, "license": "MIT", "dependencies": { "@webassemblyjs/helper-numbers": "1.11.6", @@ -2084,28 +2130,24 @@ "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.6.tgz", "integrity": "sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw==", - "dev": true, "license": "MIT" }, "node_modules/@webassemblyjs/helper-api-error": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz", "integrity": "sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q==", - "dev": true, "license": "MIT" }, "node_modules/@webassemblyjs/helper-buffer": { "version": "1.12.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.12.1.tgz", "integrity": "sha512-nzJwQw99DNDKr9BVCOZcLuJJUlqkJh+kVzVl6Fmq/tI5ZtEyWT1KZMyOXltXLZJmDtvLCDgwsyrkohEtopTXCw==", - "dev": true, "license": "MIT" }, "node_modules/@webassemblyjs/helper-numbers": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.6.tgz", "integrity": "sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g==", - "dev": true, "license": "MIT", "dependencies": { "@webassemblyjs/floating-point-hex-parser": "1.11.6", @@ -2117,14 +2159,12 @@ "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz", "integrity": "sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA==", - "dev": true, "license": "MIT" }, "node_modules/@webassemblyjs/helper-wasm-section": { "version": "1.12.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.12.1.tgz", "integrity": "sha512-Jif4vfB6FJlUlSbgEMHUyk1j234GTNG9dBJ4XJdOySoj518Xj0oGsNi59cUQF4RRMS9ouBUxDDdyBVfPTypa5g==", - "dev": true, "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.12.1", @@ -2137,7 +2177,6 @@ "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.6.tgz", "integrity": "sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg==", - "dev": true, "license": "MIT", "dependencies": { "@xtuc/ieee754": "^1.2.0" @@ -2147,7 +2186,6 @@ "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.6.tgz", "integrity": "sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ==", - "dev": true, "license": "Apache-2.0", "dependencies": { "@xtuc/long": "4.2.2" @@ -2157,14 +2195,12 @@ "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.6.tgz", "integrity": "sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA==", - "dev": true, "license": "MIT" }, "node_modules/@webassemblyjs/wasm-edit": { "version": "1.12.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.12.1.tgz", "integrity": "sha512-1DuwbVvADvS5mGnXbE+c9NfA8QRcZ6iKquqjjmR10k6o+zzsRVesil54DKexiowcFCPdr/Q0qaMgB01+SQ1u6g==", - "dev": true, "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.12.1", @@ -2181,7 +2217,6 @@ "version": "1.12.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.12.1.tgz", "integrity": "sha512-TDq4Ojh9fcohAw6OIMXqiIcTq5KUXTGRkVxbSo1hQnSy6lAM5GSdfwWeSxpAo0YzgsgF182E/U0mDNhuA0tW7w==", - "dev": true, "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.12.1", @@ -2195,7 +2230,6 @@ "version": "1.12.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.12.1.tgz", "integrity": "sha512-Jg99j/2gG2iaz3hijw857AVYekZe2SAskcqlWIZXjji5WStnOpVoat3gQfT/Q5tb2djnCjBtMocY/Su1GfxPBg==", - "dev": true, "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.12.1", @@ -2208,7 +2242,6 @@ "version": "1.12.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.12.1.tgz", "integrity": "sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ==", - "dev": true, "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.12.1", @@ -2223,51 +2256,49 @@ "version": "1.12.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.12.1.tgz", "integrity": "sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA==", - "dev": true, "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.12.1", "@xtuc/long": "4.2.2" } }, - "node_modules/@webgpu/glslang": { - "version": "0.0.15", - "resolved": "https://registry.npmjs.org/@webgpu/glslang/-/glslang-0.0.15.tgz", - "integrity": "sha512-niT+Prh3Aff8Uf1MVBVUsaNjFj9rJAKDXuoHIKiQbB+6IUP/3J3JIhBNyZ7lDhytvXxw6ppgnwKZdDJ08UMj4Q==", - "license": "glslang/LICENSE.txt" - }, "node_modules/@webpack-cli/configtest": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz", - "integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==", - "dev": true, + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.1.1.tgz", + "integrity": "sha512-wy0mglZpDSiSS0XHrVR+BAdId2+yxPSoJW8fsna3ZpYSlufjvxnP4YbKTCBZnNIcGN4r6ZPXV55X4mYExOfLmw==", "license": "MIT", + "engines": { + "node": ">=14.15.0" + }, "peerDependencies": { - "webpack": "4.x.x || 5.x.x", - "webpack-cli": "4.x.x" + "webpack": "5.x.x", + "webpack-cli": "5.x.x" } }, "node_modules/@webpack-cli/info": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz", - "integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==", - "dev": true, + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-2.0.2.tgz", + "integrity": "sha512-zLHQdI/Qs1UyT5UBdWNqsARasIA+AaF8t+4u2aS2nEpBQh2mWIVb8qAklq0eUENnC5mOItrIB4LiS9xMtph18A==", "license": "MIT", - "dependencies": { - "envinfo": "^7.7.3" + "engines": { + "node": ">=14.15.0" }, "peerDependencies": { - "webpack-cli": "4.x.x" + "webpack": "5.x.x", + "webpack-cli": "5.x.x" } }, "node_modules/@webpack-cli/serve": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz", - "integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==", - "dev": true, + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-2.0.5.tgz", + "integrity": "sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ==", "license": "MIT", + "engines": { + "node": ">=14.15.0" + }, "peerDependencies": { - "webpack-cli": "4.x.x" + "webpack": "5.x.x", + "webpack-cli": "5.x.x" }, "peerDependenciesMeta": { "webpack-dev-server": { @@ -2279,14 +2310,12 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", - "dev": true, "license": "BSD-3-Clause" }, "node_modules/@xtuc/long": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", - "dev": true, "license": "Apache-2.0" }, "node_modules/accepts": { @@ -2307,7 +2336,6 @@ "version": "8.12.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", - "dev": true, "license": "MIT", "bin": { "acorn": "bin/acorn" @@ -2320,23 +2348,21 @@ "version": "1.9.5", "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", - "dev": true, "license": "MIT", "peerDependencies": { "acorn": "^8" } }, "node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "dev": true, + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" }, "funding": { "type": "github", @@ -2361,17 +2387,37 @@ } } }, - "node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "node_modules/ajv-formats/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.3" + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, + "node_modules/ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "license": "MIT", "peerDependencies": { - "ajv": "^8.8.2" + "ajv": "^6.9.1" } }, "node_modules/ansi-html-community": { @@ -2431,75 +2477,79 @@ "dev": true, "license": "MIT" }, - "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==", + "node_modules/babel-loader": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.2.1.tgz", + "integrity": "sha512-fqe8naHt46e0yIdkjUZYqddSXfej3AHajX+CSO5X7oy0EmPc6o5Xh+RClNoHjnieWz9AW4kZxW9yyFMhVB1QLA==", "dev": true, "license": "MIT", "dependencies": { - "array-uniq": "^1.0.1" + "find-cache-dir": "^4.0.0", + "schema-utils": "^4.0.0" }, "engines": { - "node": ">=0.10.0" + "node": ">= 14.15.0" + }, + "peerDependencies": { + "@babel/core": "^7.12.0", + "webpack": ">=5" } }, - "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==", + "node_modules/babel-loader/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, "license": "MIT", - "engines": { - "node": ">=0.10.0" + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/assemblyscript": { - "version": "0.27.29", - "resolved": "https://registry.npmjs.org/assemblyscript/-/assemblyscript-0.27.29.tgz", - "integrity": "sha512-pH6udb7aE2F0t6cTh+0uCepmucykhMnAmm7k0kkAU3SY7LvpIngEBZWM6p5VCguu4EpmKGwEuZpZbEXzJ/frHQ==", + "node_modules/babel-loader/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", "dev": true, - "license": "Apache-2.0", + "license": "MIT", "dependencies": { - "binaryen": "116.0.0-nightly.20240114", - "long": "^5.2.1" - }, - "bin": { - "asc": "bin/asc.js", - "asinit": "bin/asinit.js" - }, - "engines": { - "node": ">=16", - "npm": ">=7" + "fast-deep-equal": "^3.1.3" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/assemblyscript" + "peerDependencies": { + "ajv": "^8.8.2" } }, - "node_modules/async": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", - "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "node_modules/babel-loader/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "dev": true, "license": "MIT" }, - "node_modules/babel-loader": { - "version": "9.1.3", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.1.3.tgz", - "integrity": "sha512-xG3ST4DglodGf8qSwv0MdeWLhrDsw/32QMdTO5T1ZIp9gQur0HkCyFs7Awskr10JKXFXwpAhiCuYX5oGXnRGbw==", + "node_modules/babel-loader/node_modules/schema-utils": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", + "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", "dev": true, "license": "MIT", "dependencies": { - "find-cache-dir": "^4.0.0", - "schema-utils": "^4.0.0" + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" }, "engines": { - "node": ">= 14.15.0" + "node": ">= 12.13.0" }, - "peerDependencies": { - "@babel/core": "^7.12.0", - "webpack": ">=5" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" } }, "node_modules/babel-plugin-polyfill-corejs2": { @@ -2544,13 +2594,6 @@ "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, - "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==", - "dev": true, - "license": "MIT" - }, "node_modules/batch": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", @@ -2571,17 +2614,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/binaryen": { - "version": "116.0.0-nightly.20240114", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-116.0.0-nightly.20240114.tgz", - "integrity": "sha512-0GZrojJnuhoe+hiwji7QFaL3tBlJoA+KFUN7ouYSDGZLSo9CKM8swQX8n/UcbR0d1VuZKU+nhogNzv423JEu5A==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "wasm-opt": "bin/wasm-opt", - "wasm2js": "bin/wasm2js" - } - }, "node_modules/body-parser": { "version": "1.20.3", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", @@ -2634,22 +2666,6 @@ "dev": true, "license": "MIT" }, - "node_modules/body-parser/node_modules/qs": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", - "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "side-channel": "^1.0.6" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/bonjour-service": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.2.1.tgz", @@ -2668,17 +2684,6 @@ "dev": true, "license": "ISC" }, - "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==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "node_modules/braces": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", @@ -2696,7 +2701,6 @@ "version": "4.23.3", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.3.tgz", "integrity": "sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==", - "dev": true, "funding": [ { "type": "opencollective", @@ -2729,9 +2733,24 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true, "license": "MIT" }, + "node_modules/bundle-name": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz", + "integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "run-applescript": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/bytes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", @@ -2774,10 +2793,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001660", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001660.tgz", - "integrity": "sha512-GacvNTTuATm26qC74pt+ad1fW15mlQ/zuTzzY1ZoIzECTP8HURDfF43kNxPgf7H1jmelCBQTTbBNxdSXOA7Bqg==", - "dev": true, + "version": "1.0.30001662", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001662.tgz", + "integrity": "sha512-sgMUVwLmGseH8ZIrm1d51UbrhqMCH3jvS7gF/M6byuHOnKyLOBL7W8yz5V02OHwgLGA36o/AFhWzzh4uc5aqTA==", "funding": [ { "type": "opencollective", @@ -2795,9 +2813,9 @@ "license": "CC-BY-4.0" }, "node_modules/cannon-es": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/cannon-es/-/cannon-es-0.18.0.tgz", - "integrity": "sha512-GiQ1bd0etZsMVSnUhNc+p+FEh0R/cULpp8uRSAhEK4Kax+y/31Au03m6h1h1xdDivAMnFg8YDwevHgzLynOHlw==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/cannon-es/-/cannon-es-0.20.0.tgz", + "integrity": "sha512-eZhWTZIkFOnMAJOgfXJa9+b3kVlvG+FX4mdkpePev/w/rP5V8NRquGyEozcjPfEoXUlb+p7d9SUcmDSn14prOA==", "license": "MIT" }, "node_modules/chalk": { @@ -2815,6 +2833,29 @@ "node": ">=4" } }, + "node_modules/chalk/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/chokidar": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", @@ -2844,7 +2885,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz", "integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==", - "dev": true, "license": "MIT", "engines": { "node": ">=6.0" @@ -2867,7 +2907,6 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", - "dev": true, "license": "MIT", "dependencies": { "is-plain-object": "^2.0.4", @@ -2899,18 +2938,13 @@ "version": "2.0.20", "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", - "dev": true, "license": "MIT" }, "node_modules/commander": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", - "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=16" - } + "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/common-path-prefix": { "version": "3.0.0", @@ -2919,13 +2953,6 @@ "dev": true, "license": "ISC" }, - "node_modules/commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", - "dev": true, - "license": "MIT" - }, "node_modules/compressible": { "version": "2.0.18", "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", @@ -2982,13 +3009,6 @@ "dev": true, "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==", - "dev": true, - "license": "MIT" - }, "node_modules/connect-history-api-fallback": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz", @@ -3071,7 +3091,6 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, "license": "MIT", "dependencies": { "path-key": "^3.1.0", @@ -3082,55 +3101,6 @@ "node": ">= 8" } }, - "node_modules/css-loader": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-7.1.2.tgz", - "integrity": "sha512-6WvYYn7l/XEGN8Xu2vWFt9nVzrCn39vKyTEFf/ExEyoksJjjSZV/0/35XPlMbpnr6VGhZIUg5yJrL8tGfes/FA==", - "dev": true, - "license": "MIT", - "dependencies": { - "icss-utils": "^5.1.0", - "postcss": "^8.4.33", - "postcss-modules-extract-imports": "^3.1.0", - "postcss-modules-local-by-default": "^4.0.5", - "postcss-modules-scope": "^3.2.0", - "postcss-modules-values": "^4.0.0", - "postcss-value-parser": "^4.2.0", - "semver": "^7.5.4" - }, - "engines": { - "node": ">= 18.12.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "@rspack/core": "0.x || 1.x", - "webpack": "^5.27.0" - }, - "peerDependenciesMeta": { - "@rspack/core": { - "optional": true - }, - "webpack": { - "optional": true - } - } - }, - "node_modules/css-loader/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/css-select": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz", @@ -3161,19 +3131,6 @@ "url": "https://github.com/sponsors/fb55" } }, - "node_modules/cssesc": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", - "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", - "dev": true, - "license": "MIT", - "bin": { - "cssesc": "bin/cssesc" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/debug": { "version": "4.3.7", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", @@ -3192,17 +3149,34 @@ } } }, - "node_modules/default-gateway": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-6.0.3.tgz", - "integrity": "sha512-fwSOJsbbNzZ/CUFpqFBqYfYNLj1NbMPm8MMCIzHjC83iSJRBEGmDUxU+WP661BaBQImeC2yHwXtz+P/O9o+XEg==", + "node_modules/default-browser": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.2.1.tgz", + "integrity": "sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "execa": "^5.0.0" + "bundle-name": "^4.1.0", + "default-browser-id": "^5.0.0" }, "engines": { - "node": ">= 10" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser-id": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.0.tgz", + "integrity": "sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/define-data-property": { @@ -3224,13 +3198,16 @@ } }, "node_modules/define-lazy-prop": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", - "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", "dev": true, "license": "MIT", "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/depd": { @@ -3362,19 +3339,11 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.19", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.19.tgz", - "integrity": "sha512-kpLJJi3zxTR1U828P+LIUDZ5ohixyo68/IcYOHLqnbTPr/wdgn4i1ECvmALN9E16JPA6cvCG5UG79gVwVdEK5w==", - "dev": true, + "version": "1.5.26", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.26.tgz", + "integrity": "sha512-Z+OMe9M/V6Ep9n/52+b7lkvYEps26z4Yz3vjWL1V61W0q+VLF1pOHhMY17sa4roz4AWmULSI8E6SAojZA5L0YQ==", "license": "ISC" }, - "node_modules/email-addresses": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/email-addresses/-/email-addresses-5.0.0.tgz", - "integrity": "sha512-4OIPYlA6JXqtVn8zpHpGiI7vE6EQOAg16aGnDMIAlZVinnoZ8208tW1hAbjWydgN/4PLTT9q+O1K6AH/vALJGw==", - "dev": true, - "license": "MIT" - }, "node_modules/encodeurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", @@ -3389,7 +3358,6 @@ "version": "5.17.1", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", - "dev": true, "license": "MIT", "dependencies": { "graceful-fs": "^4.2.4", @@ -3410,10 +3378,9 @@ } }, "node_modules/envinfo": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.13.0.tgz", - "integrity": "sha512-cvcaMr7KqXVh4nyzGTVqTum+gAiL265x5jUWQIDLq//zOGbW+gSW/C+OWLleY/rs9Qole6AZLMXPbtIFQbqu+Q==", - "dev": true, + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.14.0.tgz", + "integrity": "sha512-CO40UI41xDQzhLB1hWyqUKgFhs250pNcGbyGKe1l/e4FSaI/+YE4IMG76GDt0In67WLPACIITC+sOi08x4wIvg==", "license": "MIT", "bin": { "envinfo": "dist/cli.js" @@ -3449,14 +3416,12 @@ "version": "1.5.4", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", "integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", - "dev": true, "license": "MIT" }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -3483,7 +3448,6 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", @@ -3497,7 +3461,6 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, "license": "BSD-2-Clause", "dependencies": { "estraverse": "^5.2.0" @@ -3510,7 +3473,6 @@ "version": "5.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=4.0" @@ -3520,7 +3482,6 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=4.0" @@ -3557,40 +3518,15 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", - "dev": true, "license": "MIT", "engines": { "node": ">=0.8.x" } }, - "node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, - "license": "MIT", - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, "node_modules/express": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/express/-/express-4.20.0.tgz", - "integrity": "sha512-pLdae7I6QqShF5PnNTCVn4hI91Dx0Grkn2+IAsMTgMIKuQVte2dN9PeGSSAME2FR8anOhVA62QDIUaWVfEXVLw==", + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.0.tgz", + "integrity": "sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng==", "dev": true, "license": "MIT", "dependencies": { @@ -3606,7 +3542,7 @@ "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", - "finalhandler": "1.2.0", + "finalhandler": "1.3.1", "fresh": "0.5.2", "http-errors": "2.0.0", "merge-descriptors": "1.0.3", @@ -3615,11 +3551,11 @@ "parseurl": "~1.3.3", "path-to-regexp": "0.1.10", "proxy-addr": "~2.0.7", - "qs": "6.11.0", + "qs": "6.13.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", "send": "0.19.0", - "serve-static": "1.16.0", + "serve-static": "1.16.2", "setprototypeof": "1.2.0", "statuses": "2.0.1", "type-is": "~1.6.18", @@ -3651,14 +3587,12 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true, "license": "MIT" }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true, "license": "MIT" }, "node_modules/fast-uri": { @@ -3672,7 +3606,6 @@ "version": "1.0.16", "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", - "dev": true, "license": "MIT", "engines": { "node": ">= 4.9.1" @@ -3691,34 +3624,6 @@ "node": ">=0.8.0" } }, - "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==", - "dev": true, - "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==", - "dev": true, - "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/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -3733,14 +3638,14 @@ } }, "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", "dev": true, "license": "MIT", "dependencies": { "debug": "2.6.9", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "on-finished": "2.4.1", "parseurl": "~1.3.3", @@ -3761,16 +3666,6 @@ "ms": "2.0.0" } }, - "node_modules/finalhandler/node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, "node_modules/finalhandler/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -3795,7 +3690,7 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/find-up": { + "node_modules/find-cache-dir/node_modules/find-up": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", @@ -3812,11 +3707,97 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/find-cache-dir/node_modules/locate-path": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", + "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^6.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-cache-dir/node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-cache-dir/node_modules/p-locate": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-cache-dir/node_modules/path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/find-cache-dir/node_modules/pkg-dir": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-7.0.0.tgz", + "integrity": "sha512-Ie9z/WINcxxLp27BKOCHGde4ITq9UklYKDzVo1nhk5sqGEXU3FpkwP5GM2voTGJkGd9B3Otl+Q4uwSOeSUtOBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^6.3.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "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/flat": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true, "license": "BSD-3-Clause", "bin": { "flat": "cli.js" @@ -3863,40 +3844,10 @@ "node": ">= 0.6" } }, - "node_modules/fs-extra": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", - "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=14.14" - } - }, - "node_modules/fs-monkey": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/fs-monkey/-/fs-monkey-1.0.6.tgz", - "integrity": "sha512-b1FMfwetIKymC0eioW7mTywihSQE4oLzQn1dB6rZB5fx/3NpNEdAWeCSMB+60/AeT0TCXsxzAlcYVEFCTAksWg==", - "dev": true, - "license": "Unlicense" - }, - "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==", - "dev": true, - "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==", - "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3932,169 +3883,14 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/gh-pages": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/gh-pages/-/gh-pages-6.1.1.tgz", - "integrity": "sha512-upnohfjBwN5hBP9w2dPE7HO5JJTHzSGMV1JrLrHvNuqmjoYHg6TBrCcnEoorjG/e0ejbuvnwyKMdTyM40PEByw==", - "dev": true, - "license": "MIT", - "dependencies": { - "async": "^3.2.4", - "commander": "^11.0.0", - "email-addresses": "^5.0.0", - "filenamify": "^4.3.0", - "find-cache-dir": "^3.3.1", - "fs-extra": "^11.1.1", - "globby": "^6.1.0" - }, - "bin": { - "gh-pages": "bin/gh-pages.js", - "gh-pages-clean": "bin/gh-pages-clean.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/gh-pages/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/avajs/find-cache-dir?sponsor=1" - } - }, - "node_modules/gh-pages/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/gh-pages/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/gh-pages/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/gh-pages/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/gh-pages/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==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/gh-pages/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "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", - "dev": true, - "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/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" }, "engines": { "node": ">= 6" @@ -4104,7 +3900,6 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", - "dev": true, "license": "BSD-2-Clause" }, "node_modules/globals": { @@ -4117,23 +3912,6 @@ "node": ">=4" } }, - "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==", - "dev": true, - "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", @@ -4151,7 +3929,6 @@ "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==", - "dev": true, "license": "ISC" }, "node_modules/handle-thing": { @@ -4162,13 +3939,12 @@ "license": "MIT" }, "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "license": "MIT", "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/has-property-descriptors": { @@ -4214,7 +3990,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dev": true, "license": "MIT", "dependencies": { "function-bind": "^1.1.2" @@ -4518,14 +4293,14 @@ } } }, - "node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "node_modules/hyperdyperid": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/hyperdyperid/-/hyperdyperid-1.2.0.tgz", + "integrity": "sha512-Y93lCzHYgGWdrJ66yIktxiaGULYc6oGiABxhcO5AufBeOyoIdZF7bIfLaOrbM0iGIOXQQgxxRrFEnb+Y6w1n4A==", "dev": true, - "license": "Apache-2.0", + "license": "MIT", "engines": { - "node": ">=10.17.0" + "node": ">=10.18" } }, "node_modules/iconv-lite": { @@ -4541,24 +4316,10 @@ "node": ">=0.10.0" } }, - "node_modules/icss-utils": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", - "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", - "dev": true, - "license": "ISC", - "engines": { - "node": "^10 || ^12 || >= 14" - }, - "peerDependencies": { - "postcss": "^8.1.0" - } - }, "node_modules/import-local": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", - "dev": true, "license": "MIT", "dependencies": { "pkg-dir": "^4.2.0", @@ -4574,97 +4335,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/import-local/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/import-local/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/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==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local/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==", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "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.", - "dev": true, - "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", @@ -4673,13 +4343,12 @@ "license": "ISC" }, "node_modules/interpret": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", - "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", - "dev": true, + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", + "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", "license": "MIT", "engines": { - "node": ">= 0.10" + "node": ">=10.13.0" } }, "node_modules/ipaddr.js": { @@ -4709,7 +4378,6 @@ "version": "2.15.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==", - "dev": true, "license": "MIT", "dependencies": { "hasown": "^2.0.2" @@ -4722,16 +4390,16 @@ } }, "node_modules/is-docker": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", - "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", "dev": true, "license": "MIT", "bin": { "is-docker": "cli.js" }, "engines": { - "node": ">=8" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -4760,66 +4428,87 @@ "node": ">=0.10.0" } }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", "dev": true, "license": "MIT", + "dependencies": { + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, "engines": { - "node": ">=0.12.0" + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-plain-obj": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz", - "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==", + "node_modules/is-network-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-network-error/-/is-network-error-1.1.0.tgz", + "integrity": "sha512-tUdRRAnhT+OtCZR/LxZelH/C7QtjtFrTu5tXCA8pl55eTUElUHT+GPYV8MBMBvea/j+NxQqVt3LbWMRir7Gx9g==", "dev": true, "license": "MIT", "engines": { - "node": ">=10" + "node": ">=16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, "license": "MIT", - "dependencies": { - "isobject": "^3.0.1" - }, "engines": { - "node": ">=0.10.0" + "node": ">=0.12.0" } }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "node_modules/is-plain-obj": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz", + "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==", "dev": true, "license": "MIT", "engines": { - "node": ">=8" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "license": "MIT", + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-wsl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", - "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", + "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", "dev": true, "license": "MIT", "dependencies": { - "is-docker": "^2.0.0" + "is-inside-container": "^1.0.0" }, "engines": { - "node": ">=8" + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/isarray": { @@ -4833,14 +4522,12 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, "license": "ISC" }, "node_modules/isobject": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -4850,7 +4537,6 @@ "version": "27.5.1", "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", - "dev": true, "license": "MIT", "dependencies": { "@types/node": "*", @@ -4861,32 +4547,6 @@ "node": ">= 10.13.0" } }, - "node_modules/jest-worker/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -4911,14 +4571,12 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true, "license": "MIT" }, "node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "license": "MIT" }, "node_modules/json5": { @@ -4934,24 +4592,10 @@ "node": ">=6" } }, - "node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, "node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -4972,26 +4616,21 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", - "dev": true, "license": "MIT", "engines": { "node": ">=6.11.5" } }, "node_modules/locate-path": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", - "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", - "dev": true, + "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": "^6.0.0" + "p-locate": "^4.1.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, "node_modules/lodash": { @@ -5008,13 +4647,6 @@ "dev": true, "license": "MIT" }, - "node_modules/long": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", - "dev": true, - "license": "Apache-2.0" - }, "node_modules/lower-case": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", @@ -5035,22 +4667,6 @@ "yallist": "^3.0.2" } }, - "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==", - "dev": true, - "license": "MIT", - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -5062,16 +4678,23 @@ } }, "node_modules/memfs": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/memfs/-/memfs-3.5.3.tgz", - "integrity": "sha512-UERzLsxzllchadvbPs5aolHh65ISpKpM+ccLbOJ8/vvpBKmAWf+la7dXFy7Mr0ySHbdHrFv5kGFCUHHe6GFEmw==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/memfs/-/memfs-4.12.0.tgz", + "integrity": "sha512-74wDsex5tQDSClVkeK1vtxqYCAgCoXxx+K4NSHzgU/muYVYByFqa+0RnrPO9NM6naWm1+G9JmZ0p6QHhXmeYfA==", "dev": true, - "license": "Unlicense", + "license": "Apache-2.0", "dependencies": { - "fs-monkey": "^1.0.4" + "@jsonjoy.com/json-pack": "^1.0.3", + "@jsonjoy.com/util": "^1.3.0", + "tree-dump": "^1.0.1", + "tslib": "^2.0.0" }, "engines": { "node": ">= 4.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" } }, "node_modules/merge-descriptors": { @@ -5088,7 +4711,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true, "license": "MIT" }, "node_modules/methods": { @@ -5132,7 +4754,6 @@ "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.6" @@ -5142,7 +4763,6 @@ "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, "license": "MIT", "dependencies": { "mime-db": "1.52.0" @@ -5151,16 +4771,6 @@ "node": ">= 0.6" } }, - "node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -5168,19 +4778,6 @@ "dev": true, "license": "ISC" }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -5202,25 +4799,6 @@ "multicast-dns": "cli.js" } }, - "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -5235,7 +4813,6 @@ "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true, "license": "MIT" }, "node_modules/no-case": { @@ -5263,7 +4840,6 @@ "version": "2.0.18", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", - "dev": true, "license": "MIT" }, "node_modules/normalize-path": { @@ -5276,19 +4852,6 @@ "node": ">=0.10.0" } }, - "node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/nth-check": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", @@ -5302,16 +4865,6 @@ "url": "https://github.com/fb55/nth-check?sponsor=1" } }, - "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==", - "dev": true, - "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", @@ -5355,101 +4908,74 @@ "node": ">= 0.8" } }, - "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==", - "dev": true, - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/open": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz", - "integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/open/-/open-10.1.0.tgz", + "integrity": "sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw==", "dev": true, "license": "MIT", "dependencies": { - "define-lazy-prop": "^2.0.0", - "is-docker": "^2.1.1", - "is-wsl": "^2.2.0" + "default-browser": "^5.2.1", + "define-lazy-prop": "^3.0.0", + "is-inside-container": "^1.0.0", + "is-wsl": "^3.1.0" }, "engines": { - "node": ">=12" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", - "dev": true, + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "license": "MIT", "dependencies": { - "yocto-queue": "^1.0.0" + "p-try": "^2.0.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=6" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-locate": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", - "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", - "dev": true, + "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": "^4.0.0" + "p-limit": "^2.2.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, "node_modules/p-retry": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.6.2.tgz", - "integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-6.2.0.tgz", + "integrity": "sha512-JA6nkq6hKyWLLasXQXUrO4z8BUZGUt/LjlJxx8Gb2+2ntodU/SS63YZ8b0LUTbQ8ZB9iwOfhEPhg4ykKnn2KsA==", "dev": true, "license": "MIT", "dependencies": { - "@types/retry": "0.12.0", + "@types/retry": "0.12.2", + "is-network-error": "^1.0.0", "retry": "^0.13.1" }, "engines": { - "node": ">=8" + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "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==", - "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -5514,30 +5040,18 @@ } }, "node_modules/path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, - "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==", - "dev": true, + "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": ">=0.10.0" + "node": ">=8" } }, "node_modules/path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -5547,7 +5061,6 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true, "license": "MIT" }, "node_modules/path-to-regexp": { @@ -5561,7 +5074,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==", - "dev": true, "license": "ISC" }, "node_modules/picomatch": { @@ -5577,180 +5089,30 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", - "dev": true, + "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": ">=0.10.0" + "node": ">=8" } }, - "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==", + "node_modules/pretty-error": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-4.0.0.tgz", + "integrity": "sha512-AoJ5YMAcXKYxKhuJGdcvse+Voc6v1RgnsR3nWcYU7q4t6z0Q6T86sv5Zq8VIRbOWWFpvdGE83LtdSMNd+6Y0xw==", "dev": true, "license": "MIT", - "engines": { - "node": ">=0.10.0" + "dependencies": { + "lodash": "^4.17.20", + "renderkid": "^3.0.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==", - "dev": true, - "license": "MIT", - "dependencies": { - "pinkie": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pkg-dir": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-7.0.0.tgz", - "integrity": "sha512-Ie9z/WINcxxLp27BKOCHGde4ITq9UklYKDzVo1nhk5sqGEXU3FpkwP5GM2voTGJkGd9B3Otl+Q4uwSOeSUtOBA==", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^6.3.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/postcss": { - "version": "8.4.45", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.45.tgz", - "integrity": "sha512-7KTLTdzdZZYscUc65XmjFiB73vBhBfbPztCYdUNvlaso9PrzjzcmjqBPR0lNGkcVlcO4BjiO5rK/qNz+XAen1Q==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "nanoid": "^3.3.7", - "picocolors": "^1.0.1", - "source-map-js": "^1.2.0" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/postcss-modules-extract-imports": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.1.0.tgz", - "integrity": "sha512-k3kNe0aNFQDAZGbin48pL2VNidTF0w4/eASDsxlyspobzU3wZQLOGj7L9gfRe0Jo9/4uud09DsjFNH7winGv8Q==", - "dev": true, - "license": "ISC", - "engines": { - "node": "^10 || ^12 || >= 14" - }, - "peerDependencies": { - "postcss": "^8.1.0" - } - }, - "node_modules/postcss-modules-local-by-default": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.5.tgz", - "integrity": "sha512-6MieY7sIfTK0hYfafw1OMEG+2bg8Q1ocHCpoWLqOKj3JXlKu4G7btkmM/B7lFubYkYWmRSPLZi5chid63ZaZYw==", - "dev": true, - "license": "MIT", - "dependencies": { - "icss-utils": "^5.0.0", - "postcss-selector-parser": "^6.0.2", - "postcss-value-parser": "^4.1.0" - }, - "engines": { - "node": "^10 || ^12 || >= 14" - }, - "peerDependencies": { - "postcss": "^8.1.0" - } - }, - "node_modules/postcss-modules-scope": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.2.0.tgz", - "integrity": "sha512-oq+g1ssrsZOsx9M96c5w8laRmvEu9C3adDSjI8oTcbfkrTE8hx/zfyobUoWIxaKPO8bt6S62kxpw5GqypEw1QQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "postcss-selector-parser": "^6.0.4" - }, - "engines": { - "node": "^10 || ^12 || >= 14" - }, - "peerDependencies": { - "postcss": "^8.1.0" - } - }, - "node_modules/postcss-modules-values": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-4.0.0.tgz", - "integrity": "sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "icss-utils": "^5.0.0" - }, - "engines": { - "node": "^10 || ^12 || >= 14" - }, - "peerDependencies": { - "postcss": "^8.1.0" - } - }, - "node_modules/postcss-selector-parser": { - "version": "6.1.2", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz", - "integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==", - "dev": true, - "license": "MIT", - "dependencies": { - "cssesc": "^3.0.0", - "util-deprecate": "^1.0.2" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/postcss-value-parser": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", - "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/pretty-error": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-4.0.0.tgz", - "integrity": "sha512-AoJ5YMAcXKYxKhuJGdcvse+Voc6v1RgnsR3nWcYU7q4t6z0Q6T86sv5Zq8VIRbOWWFpvdGE83LtdSMNd+6Y0xw==", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash": "^4.17.20", - "renderkid": "^3.0.0" - } - }, - "node_modules/process-nextick-args": { + "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", @@ -5785,20 +5147,19 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "dev": true, "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", "dev": true, "license": "BSD-3-Clause", "dependencies": { - "side-channel": "^1.0.4" + "side-channel": "^1.0.6" }, "engines": { "node": ">=0.6" @@ -5811,7 +5172,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, "license": "MIT", "dependencies": { "safe-buffer": "^5.1.0" @@ -5882,16 +5242,15 @@ } }, "node_modules/rechoir": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", - "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", - "dev": true, + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", "license": "MIT", "dependencies": { - "resolve": "^1.9.0" + "resolve": "^1.20.0" }, "engines": { - "node": ">= 0.10" + "node": ">= 10.13.0" } }, "node_modules/regenerate": { @@ -5902,9 +5261,9 @@ "license": "MIT" }, "node_modules/regenerate-unicode-properties": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.1.tgz", - "integrity": "sha512-X007RyZLsCJVVrjgEFVpLUTZwyOZk3oiL75ZcuYjlIWd6rNJtOjkBwQc5AsRrpbKVkxN6sklw/k/9m2jJYOf8Q==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.2.0.tgz", + "integrity": "sha512-DqHn3DwbmmPVzeKj9woBadqmXxLvQoQIwu7nopMc72ztvxVmVk2SBhSnx67zuye5TP+lJsb/TBQsjLKhnDf3MA==", "dev": true, "license": "MIT", "dependencies": { @@ -6016,7 +5375,6 @@ "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", - "dev": true, "license": "MIT", "dependencies": { "is-core-module": "^2.13.0", @@ -6034,7 +5392,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", - "dev": true, "license": "MIT", "dependencies": { "resolve-from": "^5.0.0" @@ -6047,7 +5404,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -6063,28 +5419,23 @@ "node": ">= 4" } }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "deprecated": "Rimraf versions prior to v4 are no longer supported", + "node_modules/run-applescript": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz", + "integrity": "sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==", "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" + "license": "MIT", + "engines": { + "node": ">=18" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, "funding": [ { "type": "github", @@ -6109,19 +5460,17 @@ "license": "MIT" }, "node_modules/schema-utils": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", - "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", - "dev": true, + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", "license": "MIT", "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.1.0" + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" }, "engines": { - "node": ">= 12.13.0" + "node": ">= 10.13.0" }, "funding": { "type": "opencollective", @@ -6215,7 +5564,6 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", - "dev": true, "license": "BSD-3-Clause", "dependencies": { "randombytes": "^2.1.0" @@ -6308,68 +5656,16 @@ } }, "node_modules/serve-static": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.0.tgz", - "integrity": "sha512-pDLK8zwl2eKaYrs8mrPZBJua4hMplRWJ1tIFksVC3FtBEBnl8dxgeHtsaMS8DhS9i4fLObaon6ABoc4/hQGdPA==", + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", "dev": true, "license": "MIT", "dependencies": { - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.18.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/serve-static/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/serve-static/node_modules/debug/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true, - "license": "MIT" - }, - "node_modules/serve-static/node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/serve-static/node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" + "send": "0.19.0" }, "engines": { "node": ">= 0.8.0" @@ -6404,7 +5700,6 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", - "dev": true, "license": "MIT", "dependencies": { "kind-of": "^6.0.2" @@ -6417,7 +5712,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, "license": "MIT", "dependencies": { "shebang-regex": "^3.0.0" @@ -6430,7 +5724,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -6465,13 +5758,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true, - "license": "ISC" - }, "node_modules/sockjs": { "version": "0.3.24", "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.24.tgz", @@ -6488,17 +5774,6 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "dev": true, "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" @@ -6508,7 +5783,6 @@ "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", - "dev": true, "license": "MIT", "dependencies": { "buffer-from": "^1.0.0", @@ -6580,64 +5854,25 @@ "node": ">=8" } }, - "node_modules/strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "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==", - "dev": true, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "license": "MIT", "dependencies": { - "escape-string-regexp": "^1.0.2" + "has-flag": "^4.0.0" }, "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/style-loader": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-4.0.0.tgz", - "integrity": "sha512-1V4WqhhZZgjVAVJyt7TdDPZoPBPNHbekX4fWnCJL1yQukhCeZhJySUL+gL9y6sNdN95uEOS83Y55SqHcP7MzLA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 18.12.0" + "node": ">=10" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^5.27.0" - } - }, - "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" + "url": "https://github.com/chalk/supports-color?sponsor=1" } }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -6650,17 +5885,15 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", - "dev": true, "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/terser": { - "version": "5.32.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.32.0.tgz", - "integrity": "sha512-v3Gtw3IzpBJ0ugkxEX8U0W6+TnPKRRCWGh1jC/iM/e3Ki5+qvO1L1EAZ56bZasc64aXHwRHNIQEzm6//i5cemQ==", - "dev": true, + "version": "5.33.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.33.0.tgz", + "integrity": "sha512-JuPVaB7s1gdFKPKTelwUyRq5Sid2A3Gko2S0PncwdBq7kN9Ti9HPWDQ06MPsEDGsZeVESjKEnyGy68quBk1w6g==", "license": "BSD-2-Clause", "dependencies": { "@jridgewell/source-map": "^0.3.3", @@ -6679,7 +5912,6 @@ "version": "5.3.10", "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz", "integrity": "sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==", - "dev": true, "license": "MIT", "dependencies": { "@jridgewell/trace-mapping": "^0.3.20", @@ -6710,66 +5942,19 @@ } } }, - "node_modules/terser-webpack-plugin/node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "node_modules/thingies": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/thingies/-/thingies-1.21.0.tgz", + "integrity": "sha512-hsqsJsFMsV+aD4s3CWKk85ep/3I9XzYV/IXaSouJMYIoDlgyi11cBhsqYe9/geRfB0YIikBQg6raRaM+nIMP9g==", "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/terser-webpack-plugin/node_modules/ajv-keywords": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", - "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "ajv": "^6.9.1" - } - }, - "node_modules/terser-webpack-plugin/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true, - "license": "MIT" - }, - "node_modules/terser-webpack-plugin/node_modules/schema-utils": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", - "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - }, + "license": "Unlicense", "engines": { - "node": ">= 10.13.0" + "node": ">=10.18" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" + "peerDependencies": { + "tslib": "^2" } }, - "node_modules/terser/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==", - "dev": true, - "license": "MIT" - }, "node_modules/three": { "version": "0.168.0", "resolved": "https://registry.npmjs.org/three/-/three-0.168.0.tgz", @@ -6816,17 +6001,21 @@ "node": ">=0.6" } }, - "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==", + "node_modules/tree-dump": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/tree-dump/-/tree-dump-1.0.2.tgz", + "integrity": "sha512-dpev9ABuLWdEubk+cIaI9cHwRNNDjkBBLXTwI4UCUFdQ5xXKqNXoK4FEciw/vxf+NQ7Cb7sGUyeUtORvHIdRXQ==", "dev": true, - "license": "MIT", - "dependencies": { - "escape-string-regexp": "^1.0.2" - }, + "license": "Apache-2.0", "engines": { - "node": ">=0.10.0" + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" } }, "node_modules/tslib": { @@ -6854,13 +6043,12 @@ "version": "6.19.8", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", - "dev": true, "license": "MIT" }, "node_modules/unicode-canonical-property-names-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", - "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz", + "integrity": "sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==", "dev": true, "license": "MIT", "engines": { @@ -6882,9 +6070,9 @@ } }, "node_modules/unicode-match-property-value-ecmascript": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.1.0.tgz", - "integrity": "sha512-qxkjQt6qjg/mYscYMC0XKRn3Rh0wFPlfxB0xkt9CfyTvpX1Ra0+rAmdX2QyAobptSEvuy4RtpPRui6XkV+8wjA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.2.0.tgz", + "integrity": "sha512-4IehN3V/+kkr5YeSSDDQG8QLqO26XpL2XP3GQtqwlT/QYSECAwFztxVHjlbh0+gjJ3XmNLS0zDsbgs9jWKExLg==", "dev": true, "license": "MIT", "engines": { @@ -6901,16 +6089,6 @@ "node": ">=4" } }, - "node_modules/universalify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 10.0.0" - } - }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -6925,7 +6103,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", "integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==", - "dev": true, "funding": [ { "type": "opencollective", @@ -6956,7 +6133,6 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, "license": "BSD-2-Clause", "dependencies": { "punycode": "^2.1.0" @@ -7010,7 +6186,6 @@ "version": "2.4.2", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz", "integrity": "sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==", - "dev": true, "license": "MIT", "dependencies": { "glob-to-regexp": "^0.4.1", @@ -7034,7 +6209,6 @@ "version": "5.94.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.94.0.tgz", "integrity": "sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg==", - "dev": true, "license": "MIT", "dependencies": { "@types/estree": "^1.0.5", @@ -7078,45 +6252,42 @@ } }, "node_modules/webpack-cli": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz", - "integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==", - "dev": true, + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.1.4.tgz", + "integrity": "sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==", "license": "MIT", "dependencies": { "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^1.2.0", - "@webpack-cli/info": "^1.5.0", - "@webpack-cli/serve": "^1.7.0", + "@webpack-cli/configtest": "^2.1.1", + "@webpack-cli/info": "^2.0.2", + "@webpack-cli/serve": "^2.0.5", "colorette": "^2.0.14", - "commander": "^7.0.0", + "commander": "^10.0.1", "cross-spawn": "^7.0.3", + "envinfo": "^7.7.3", "fastest-levenshtein": "^1.0.12", "import-local": "^3.0.2", - "interpret": "^2.2.0", - "rechoir": "^0.7.0", + "interpret": "^3.1.1", + "rechoir": "^0.8.0", "webpack-merge": "^5.7.3" }, "bin": { "webpack-cli": "bin/cli.js" }, "engines": { - "node": ">=10.13.0" + "node": ">=14.15.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" }, "peerDependencies": { - "webpack": "4.x.x || 5.x.x" + "webpack": "5.x.x" }, "peerDependenciesMeta": { "@webpack-cli/generators": { "optional": true }, - "@webpack-cli/migrate": { - "optional": true - }, "webpack-bundle-analyzer": { "optional": true }, @@ -7126,89 +6297,149 @@ } }, "node_modules/webpack-cli/node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", - "dev": true, + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", "license": "MIT", "engines": { - "node": ">= 10" + "node": ">=14" } }, "node_modules/webpack-dev-middleware": { - "version": "5.3.4", - "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.4.tgz", - "integrity": "sha512-BVdTqhhs+0IfoeAf7EoH5WE+exCmqGerHfDM0IL096Px60Tq2Mn9MAbnaGUe6HiMa41KMCYF19gyzZmBcq/o4Q==", + "version": "7.4.2", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-7.4.2.tgz", + "integrity": "sha512-xOO8n6eggxnwYpy1NlzUKpvrjfJTvae5/D6WOK0S2LSo7vjmo5gCM1DbLUmFqrMTJP+W/0YZNctm7jasWvLuBA==", "dev": true, "license": "MIT", "dependencies": { "colorette": "^2.0.10", - "memfs": "^3.4.3", + "memfs": "^4.6.0", "mime-types": "^2.1.31", + "on-finished": "^2.4.1", "range-parser": "^1.2.1", "schema-utils": "^4.0.0" }, "engines": { - "node": ">= 12.13.0" + "node": ">= 18.12.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" }, "peerDependencies": { - "webpack": "^4.0.0 || ^5.0.0" + "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "webpack": { + "optional": true + } + } + }, + "node_modules/webpack-dev-middleware/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/webpack-dev-middleware/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/webpack-dev-middleware/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, + "node_modules/webpack-dev-middleware/node_modules/schema-utils": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", + "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" } }, "node_modules/webpack-dev-server": { - "version": "4.15.2", - "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-4.15.2.tgz", - "integrity": "sha512-0XavAZbNJ5sDrCbkpWL8mia0o5WPOd2YGtxrEiZkBK9FjLppIUK2TgxK6qGD2P3hUXTJNNPVibrerKcx5WkR1g==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-5.1.0.tgz", + "integrity": "sha512-aQpaN81X6tXie1FoOB7xlMfCsN19pSvRAeYUHOdFWOlhpQ/LlbfTqYwwmEDFV0h8GGuqmCmKmT+pxcUV/Nt2gQ==", "dev": true, "license": "MIT", "dependencies": { - "@types/bonjour": "^3.5.9", - "@types/connect-history-api-fallback": "^1.3.5", - "@types/express": "^4.17.13", - "@types/serve-index": "^1.9.1", - "@types/serve-static": "^1.13.10", - "@types/sockjs": "^0.3.33", - "@types/ws": "^8.5.5", + "@types/bonjour": "^3.5.13", + "@types/connect-history-api-fallback": "^1.5.4", + "@types/express": "^4.17.21", + "@types/serve-index": "^1.9.4", + "@types/serve-static": "^1.15.5", + "@types/sockjs": "^0.3.36", + "@types/ws": "^8.5.10", "ansi-html-community": "^0.0.8", - "bonjour-service": "^1.0.11", - "chokidar": "^3.5.3", + "bonjour-service": "^1.2.1", + "chokidar": "^3.6.0", "colorette": "^2.0.10", "compression": "^1.7.4", "connect-history-api-fallback": "^2.0.0", - "default-gateway": "^6.0.3", - "express": "^4.17.3", + "express": "^4.19.2", "graceful-fs": "^4.2.6", - "html-entities": "^2.3.2", + "html-entities": "^2.4.0", "http-proxy-middleware": "^2.0.3", - "ipaddr.js": "^2.0.1", - "launch-editor": "^2.6.0", - "open": "^8.0.9", - "p-retry": "^4.5.0", - "rimraf": "^3.0.2", - "schema-utils": "^4.0.0", - "selfsigned": "^2.1.1", + "ipaddr.js": "^2.1.0", + "launch-editor": "^2.6.1", + "open": "^10.0.3", + "p-retry": "^6.2.0", + "schema-utils": "^4.2.0", + "selfsigned": "^2.4.1", "serve-index": "^1.9.1", "sockjs": "^0.3.24", "spdy": "^4.0.2", - "webpack-dev-middleware": "^5.3.4", - "ws": "^8.13.0" + "webpack-dev-middleware": "^7.4.2", + "ws": "^8.18.0" }, "bin": { "webpack-dev-server": "bin/webpack-dev-server.js" }, "engines": { - "node": ">= 12.13.0" + "node": ">= 18.12.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" }, "peerDependencies": { - "webpack": "^4.37.0 || ^5.0.0" + "webpack": "^5.0.0" }, "peerDependenciesMeta": { "webpack": { @@ -7219,84 +6450,86 @@ } } }, - "node_modules/webpack-merge": { - "version": "5.10.0", - "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.10.0.tgz", - "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", - "dev": true, - "license": "MIT", - "dependencies": { - "clone-deep": "^4.0.1", - "flat": "^5.0.2", - "wildcard": "^2.0.0" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/webpack-sources": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", - "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/webpack/node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "node_modules/webpack-dev-server/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" }, "funding": { "type": "github", "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/webpack/node_modules/ajv-keywords": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", - "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "node_modules/webpack-dev-server/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", "dev": true, "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, "peerDependencies": { - "ajv": "^6.9.1" + "ajv": "^8.8.2" } }, - "node_modules/webpack/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "node_modules/webpack-dev-server/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "dev": true, "license": "MIT" }, - "node_modules/webpack/node_modules/schema-utils": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", - "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", + "node_modules/webpack-dev-server/node_modules/schema-utils": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", + "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", "dev": true, "license": "MIT", "dependencies": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" }, "engines": { - "node": ">= 10.13.0" + "node": ">= 12.13.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" } }, + "node_modules/webpack-merge": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.10.0.tgz", + "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", + "license": "MIT", + "dependencies": { + "clone-deep": "^4.0.1", + "flat": "^5.0.2", + "wildcard": "^2.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "license": "MIT", + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/websocket-driver": { "version": "0.7.4", "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz", @@ -7326,7 +6559,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, "license": "ISC", "dependencies": { "isexe": "^2.0.0" @@ -7342,16 +6574,8 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", - "dev": true, "license": "MIT" }, - "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==", - "dev": true, - "license": "ISC" - }, "node_modules/ws": { "version": "8.18.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", diff --git a/node_modules/@types/estree/README.md b/node_modules/@types/estree/README.md index c9bc4d5..6e40c08 100644 --- a/node_modules/@types/estree/README.md +++ b/node_modules/@types/estree/README.md @@ -8,7 +8,7 @@ This package contains type definitions for estree (https://github.com/estree/est Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree. ### Additional Details - * Last updated: Mon, 06 Nov 2023 22:41:05 GMT + * Last updated: Wed, 18 Sep 2024 09:37:00 GMT * Dependencies: none # Credits diff --git a/node_modules/@types/estree/index.d.ts b/node_modules/@types/estree/index.d.ts index e933e20..81a351f 100644 --- a/node_modules/@types/estree/index.d.ts +++ b/node_modules/@types/estree/index.d.ts @@ -353,7 +353,7 @@ export interface UnaryExpression extends BaseExpression { export interface BinaryExpression extends BaseExpression { type: "BinaryExpression"; operator: BinaryOperator; - left: Expression; + left: Expression | PrivateIdentifier; right: Expression; } @@ -638,7 +638,7 @@ export interface ImportDeclaration extends BaseModuleDeclaration { export interface ImportSpecifier extends BaseModuleSpecifier { type: "ImportSpecifier"; - imported: Identifier; + imported: Identifier | Literal; } export interface ImportExpression extends BaseExpression { @@ -661,9 +661,10 @@ export interface ExportNamedDeclaration extends BaseModuleDeclaration { source?: Literal | null | undefined; } -export interface ExportSpecifier extends BaseModuleSpecifier { +export interface ExportSpecifier extends Omit { type: "ExportSpecifier"; - exported: Identifier; + local: Identifier | Literal; + exported: Identifier | Literal; } export interface ExportDefaultDeclaration extends BaseModuleDeclaration { @@ -673,7 +674,7 @@ export interface ExportDefaultDeclaration extends BaseModuleDeclaration { export interface ExportAllDeclaration extends BaseModuleDeclaration { type: "ExportAllDeclaration"; - exported: Identifier | null; + exported: Identifier | Literal | null; source: Literal; } diff --git a/node_modules/@types/estree/package.json b/node_modules/@types/estree/package.json index 2d5a998..f410761 100644 --- a/node_modules/@types/estree/package.json +++ b/node_modules/@types/estree/package.json @@ -1,6 +1,6 @@ { "name": "@types/estree", - "version": "1.0.5", + "version": "1.0.6", "description": "TypeScript definitions for estree", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree", "license": "MIT", @@ -20,7 +20,7 @@ }, "scripts": {}, "dependencies": {}, - "typesPublisherContentHash": "6f0eeaffe488ce594e73f8df619c677d752a279b51edbc744e4aebb20db4b3a7", - "typeScriptVersion": "4.5", + "typesPublisherContentHash": "0310b41994a6f8d7530af6c53d47d8b227f32925e43718507fdb1178e05006b1", + "typeScriptVersion": "4.8", "nonNpm": true } \ No newline at end of file diff --git a/node_modules/@types/node/README.md b/node_modules/@types/node/README.md index 955dbaf..f09618c 100644 --- a/node_modules/@types/node/README.md +++ b/node_modules/@types/node/README.md @@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/). Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node. ### Additional Details - * Last updated: Wed, 04 Sep 2024 21:35:57 GMT + * Last updated: Sat, 14 Sep 2024 00:53:13 GMT * Dependencies: [undici-types](https://npmjs.com/package/undici-types) # Credits diff --git a/node_modules/@types/node/package.json b/node_modules/@types/node/package.json index d0b303a..f485a93 100644 --- a/node_modules/@types/node/package.json +++ b/node_modules/@types/node/package.json @@ -1,6 +1,6 @@ { "name": "@types/node", - "version": "22.5.4", + "version": "22.5.5", "description": "TypeScript definitions for node", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", "license": "MIT", @@ -212,6 +212,6 @@ "dependencies": { "undici-types": "~6.19.2" }, - "typesPublisherContentHash": "6ee9a11eba834031423800320320aa873d6bf2b6f33603c13a2aa9d90b3803ee", + "typesPublisherContentHash": "49c6854801c6eca5f0c4debaa90673195b7385ea09dc082e76a86be2fa20430f", "typeScriptVersion": "4.8" } \ No newline at end of file diff --git a/node_modules/@types/node/util.d.ts b/node_modules/@types/node/util.d.ts index ab1f609..275cd6e 100644 --- a/node_modules/@types/node/util.d.ts +++ b/node_modules/@types/node/util.d.ts @@ -1520,11 +1520,14 @@ declare module "util" { type ParsedValues = & IfDefaultsTrue & (T["options"] extends ParseArgsOptionsConfig ? { - -readonly [LongOption in keyof T["options"]]: IfDefaultsFalse< - T["options"][LongOption]["multiple"], - undefined | Array>, - undefined | ExtractOptionValue - >; + -readonly [LongOption in keyof T["options"]]: + // when "default" is not undefined, the value will be present + | (T["options"][LongOption]["default"] extends {} ? never : undefined) + | IfDefaultsFalse< + T["options"][LongOption]["multiple"], + Array>, + ExtractOptionValue + >; } : {}); diff --git a/node_modules/@webpack-cli/configtest/README.md b/node_modules/@webpack-cli/configtest/README.md index 07f991f..49afdb6 100644 --- a/node_modules/@webpack-cli/configtest/README.md +++ b/node_modules/@webpack-cli/configtest/README.md @@ -2,6 +2,10 @@ [![NPM Downloads][downloads]][downloads-url] +> **Note** +> +> This package is used by webpack-cli under-the-hood and is not intended for installation + ## Description This package validates a webpack configuration. diff --git a/node_modules/@webpack-cli/configtest/lib/index.d.ts b/node_modules/@webpack-cli/configtest/lib/index.d.ts index 169bfb7..4820946 100644 --- a/node_modules/@webpack-cli/configtest/lib/index.d.ts +++ b/node_modules/@webpack-cli/configtest/lib/index.d.ts @@ -1,4 +1,4 @@ -import { IWebpackCLI } from "webpack-cli"; +import { type IWebpackCLI } from "webpack-cli"; declare class ConfigTestCommand { apply(cli: IWebpackCLI): Promise; } diff --git a/node_modules/@webpack-cli/configtest/lib/index.js b/node_modules/@webpack-cli/configtest/lib/index.js index 98690a4..f9b5b79 100644 --- a/node_modules/@webpack-cli/configtest/lib/index.js +++ b/node_modules/@webpack-cli/configtest/lib/index.js @@ -15,14 +15,18 @@ class ConfigTestCommand { const configPaths = new Set(); if (Array.isArray(config.options)) { config.options.forEach((options) => { - if (config.path.get(options)) { - configPaths.add(config.path.get(options)); + const loadedConfigPaths = config.path.get(options); + if (loadedConfigPaths) { + loadedConfigPaths.forEach((path) => configPaths.add(path)); } }); } else { if (config.path.get(config.options)) { - configPaths.add(config.path.get(config.options)); + const loadedConfigPaths = config.path.get(config.options); + if (loadedConfigPaths) { + loadedConfigPaths.forEach((path) => configPaths.add(path)); + } } } if (configPaths.size === 0) { @@ -31,13 +35,7 @@ class ConfigTestCommand { } cli.logger.info(`Validate '${Array.from(configPaths).join(" ,")}'.`); try { - // @ts-expect-error cli.webpack.validate returns void - const error = cli.webpack.validate(config.options); - // TODO remove this after drop webpack@4 - if (error && error.length > 0) { - // @ts-expect-error schema argument is missing - throw new cli.webpack.WebpackOptionsValidationError(error); - } + cli.webpack.validate(config.options); } catch (error) { if (cli.isValidationError(error)) { diff --git a/node_modules/@webpack-cli/configtest/package.json b/node_modules/@webpack-cli/configtest/package.json index 077b4bb..7ef2260 100644 --- a/node_modules/@webpack-cli/configtest/package.json +++ b/node_modules/@webpack-cli/configtest/package.json @@ -1,10 +1,13 @@ { "name": "@webpack-cli/configtest", - "version": "1.2.0", + "version": "2.1.1", "description": "Validate a webpack configuration.", "main": "lib/index.js", "types": "lib/index.d.ts", "license": "MIT", + "engines": { + "node": ">=14.15.0" + }, "publishConfig": { "access": "public" }, @@ -17,8 +20,8 @@ "lib" ], "peerDependencies": { - "webpack": "4.x.x || 5.x.x", - "webpack-cli": "4.x.x" + "webpack": "5.x.x", + "webpack-cli": "5.x.x" }, - "gitHead": "20882d463450d010bb76e0824fe555e9785e9561" + "gitHead": "e879ce4ef91a9a89ca5ef74f533391cef5ba009d" } diff --git a/node_modules/@webpack-cli/info/README.md b/node_modules/@webpack-cli/info/README.md index aa99d37..4486925 100644 --- a/node_modules/@webpack-cli/info/README.md +++ b/node_modules/@webpack-cli/info/README.md @@ -2,6 +2,10 @@ [![NPM Downloads][downloads]][downloads-url] +> **Note** +> +> This package is used by webpack-cli under-the-hood and is not intended for installation + ## Description This package returns a set of information related to the local environment. diff --git a/node_modules/@webpack-cli/info/lib/index.d.ts b/node_modules/@webpack-cli/info/lib/index.d.ts index 52b3022..0dc6cd9 100644 --- a/node_modules/@webpack-cli/info/lib/index.d.ts +++ b/node_modules/@webpack-cli/info/lib/index.d.ts @@ -1,4 +1,4 @@ -import { IWebpackCLI } from "webpack-cli"; +import { type IWebpackCLI } from "webpack-cli"; declare class InfoCommand { apply(cli: IWebpackCLI): Promise; } diff --git a/node_modules/@webpack-cli/info/lib/index.js b/node_modules/@webpack-cli/info/lib/index.js index bd92646..1702ed0 100644 --- a/node_modules/@webpack-cli/info/lib/index.js +++ b/node_modules/@webpack-cli/info/lib/index.js @@ -1,9 +1,5 @@ "use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); -const envinfo_1 = __importDefault(require("envinfo")); class InfoCommand { async apply(cli) { await cli.makeCommand({ @@ -12,71 +8,8 @@ class InfoCommand { description: "Outputs information about your system.", usage: "[options]", pkg: "@webpack-cli/info", - }, [ - { - name: "output", - alias: "o", - configs: [ - { - type: "string", - }, - ], - description: "To get the output in a specified format ( accept json or markdown )", - }, - { - name: "additional-package", - alias: "a", - configs: [{ type: "string" }], - multiple: true, - description: "Adds additional packages to the output", - }, - ], async (options) => { - let { output } = options; - const envinfoConfig = {}; - if (output) { - // Remove quotes if exist - output = output.replace(/['"]+/g, ""); - switch (output) { - case "markdown": - envinfoConfig["markdown"] = true; - break; - case "json": - envinfoConfig["json"] = true; - break; - default: - cli.logger.error(`'${output}' is not a valid value for output`); - process.exit(2); - } - } - const defaultInformation = { - Binaries: ["Node", "Yarn", "npm"], - Browsers: [ - "Brave Browser", - "Chrome", - "Chrome Canary", - "Edge", - "Firefox", - "Firefox Developer Edition", - "Firefox Nightly", - "Internet Explorer", - "Safari", - "Safari Technology Preview", - ], - Monorepos: ["Yarn Workspaces", "Lerna"], - System: ["OS", "CPU", "Memory"], - npmGlobalPackages: ["webpack", "webpack-cli", "webpack-dev-server"], - npmPackages: "{*webpack*,*loader*}", - }; - let defaultPackages = ["webpack", "loader"]; - if (typeof options.additionalPackage !== "undefined") { - defaultPackages = [...defaultPackages, ...options.additionalPackage]; - } - defaultInformation.npmPackages = `{${defaultPackages - .map((item) => `*${item}*`) - .join(",")}}`; - let info = await envinfo_1.default.run(defaultInformation, envinfoConfig); - info = info.replace(/npmPackages/g, "Packages"); - info = info.replace(/npmGlobalPackages/g, "Global Packages"); + }, cli.getInfoOptions(), async (options) => { + const info = await cli.getInfoOutput(options); cli.logger.raw(info); }); } diff --git a/node_modules/@webpack-cli/info/package.json b/node_modules/@webpack-cli/info/package.json index 11e005f..b4792dc 100644 --- a/node_modules/@webpack-cli/info/package.json +++ b/node_modules/@webpack-cli/info/package.json @@ -1,10 +1,13 @@ { "name": "@webpack-cli/info", - "version": "1.5.0", + "version": "2.0.2", "description": "Outputs info about system and webpack config", "main": "lib/index.js", "types": "lib/index.d.ts", "license": "MIT", + "engines": { + "node": ">=14.15.0" + }, "publishConfig": { "access": "public" }, @@ -16,14 +19,9 @@ "files": [ "lib" ], - "dependencies": { - "envinfo": "^7.7.3" - }, - "gitHead": "20882d463450d010bb76e0824fe555e9785e9561", + "gitHead": "e879ce4ef91a9a89ca5ef74f533391cef5ba009d", "peerDependencies": { - "webpack-cli": "4.x.x" - }, - "devDependencies": { - "@types/envinfo": "^7.8.1" + "webpack": "5.x.x", + "webpack-cli": "5.x.x" } } diff --git a/node_modules/@webpack-cli/serve/README.md b/node_modules/@webpack-cli/serve/README.md index 4475746..03279ae 100644 --- a/node_modules/@webpack-cli/serve/README.md +++ b/node_modules/@webpack-cli/serve/README.md @@ -2,7 +2,9 @@ [![NPM Downloads][downloads]][downloads-url] -**This package is used by webpack-cli under-the-hood and is not intended for installation as of v0.2.0** +> **Note** +> +> This package is used by webpack-cli under-the-hood and is not intended for installation ## Description diff --git a/node_modules/@webpack-cli/serve/lib/index.d.ts b/node_modules/@webpack-cli/serve/lib/index.d.ts index f0e772d..c17e8ae 100644 --- a/node_modules/@webpack-cli/serve/lib/index.d.ts +++ b/node_modules/@webpack-cli/serve/lib/index.d.ts @@ -1,4 +1,4 @@ -import { IWebpackCLI } from "webpack-cli"; +import { type IWebpackCLI } from "webpack-cli"; declare class ServeCommand { apply(cli: IWebpackCLI): Promise; } diff --git a/node_modules/@webpack-cli/serve/lib/index.js b/node_modules/@webpack-cli/serve/lib/index.js index 0b71cd7..788fb1e 100644 --- a/node_modules/@webpack-cli/serve/lib/index.js +++ b/node_modules/@webpack-cli/serve/lib/index.js @@ -5,32 +5,10 @@ const WEBPACK_DEV_SERVER_PACKAGE = process.env.WEBPACK_DEV_SERVER_PACKAGE || "we class ServeCommand { async apply(cli) { const loadDevServerOptions = () => { - // TODO simplify this after drop webpack v4 and webpack-dev-server v3 // eslint-disable-next-line @typescript-eslint/no-var-requires const devServer = require(WEBPACK_DEV_SERVER_PACKAGE); - const isNewDevServerCLIAPI = typeof devServer.schema !== "undefined"; // eslint-disable-next-line @typescript-eslint/no-explicit-any - let options = {}; - if (isNewDevServerCLIAPI) { - if (cli.webpack.cli && typeof cli.webpack.cli.getArguments === "function") { - options = cli.webpack.cli.getArguments(devServer.schema); - } - else { - options = devServer.cli.getArguments(); - } - } - else { - options = require(`${WEBPACK_DEV_SERVER_PACKAGE}/bin/cli-flags`); - } - // Old options format - // { devServer: [{...}, {}...] } - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (options.devServer) { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - return options.devServer; - } + const options = cli.webpack.cli.getArguments(devServer.schema); // New options format // { flag1: {}, flag2: {} } return Object.keys(options).map((key) => { @@ -41,7 +19,7 @@ class ServeCommand { await cli.makeCommand({ name: "serve [entries...]", alias: ["server", "s"], - description: "Run the webpack dev server.", + description: "Run the webpack dev server and watch for source file changes while serving.", usage: "[entries...] [options]", pkg: "@webpack-cli/serve", dependencies: [WEBPACK_PACKAGE, WEBPACK_DEV_SERVER_PACKAGE], @@ -55,9 +33,7 @@ class ServeCommand { cli.logger.error(`You need to install 'webpack-dev-server' for running 'webpack serve'.\n${error}`); process.exit(2); } - const builtInOptions = cli.getBuiltInOptions().filter( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (option) => option.name !== "watch"); + const builtInOptions = cli.getBuiltInOptions(); return [...builtInOptions, ...devServerFlags]; }, // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -78,10 +54,9 @@ class ServeCommand { const processors = []; for (const optionName in options) { const kebabedOption = cli.toKebabCase(optionName); - // `webpack-dev-server` has own logic for the `--hot` option - const isBuiltInOption = kebabedOption !== "hot" && - // eslint-disable-next-line @typescript-eslint/no-explicit-any - builtInOptions.find((builtInOption) => builtInOption.name === kebabedOption); + const isBuiltInOption = builtInOptions.find( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (builtInOption) => builtInOption.name === kebabedOption); if (isBuiltInOption) { webpackCLIOptions[optionName] = options[optionName]; } @@ -102,29 +77,16 @@ class ServeCommand { webpackCLIOptions.entry = [...entries, ...(webpackCLIOptions.entry || [])]; } webpackCLIOptions.argv = Object.assign(Object.assign({}, options), { env: Object.assign({ WEBPACK_SERVE: true }, options.env) }); + webpackCLIOptions.isWatchingLikeCommand = true; const compiler = await cli.createCompiler(webpackCLIOptions); if (!compiler) { return; } const servers = []; - if (cli.needWatchStdin(compiler) || devServerCLIOptions.stdin) { - // TODO remove in the next major release - // Compatibility with old `stdin` option for `webpack-dev-server` - // Should be removed for the next major release on both sides - if (devServerCLIOptions.stdin) { - delete devServerCLIOptions.stdin; - } + if (cli.needWatchStdin(compiler)) { process.stdin.on("end", () => { Promise.all(servers.map((server) => { - if (typeof server.stop === "function") { - return server.stop(); - } - // TODO remove in the next major release - return new Promise((resolve) => { - server.close(() => { - resolve(); - }); - }); + return server.stop(); })).then(() => { process.exit(0); }); @@ -133,11 +95,9 @@ class ServeCommand { } // eslint-disable-next-line @typescript-eslint/no-var-requires const DevServer = require(WEBPACK_DEV_SERVER_PACKAGE); - const isNewDevServerCLIAPI = typeof DevServer.schema !== "undefined"; - let devServerVersion; try { // eslint-disable-next-line @typescript-eslint/no-var-requires - devServerVersion = require(`${WEBPACK_DEV_SERVER_PACKAGE}/package.json`).version; + require(`${WEBPACK_DEV_SERVER_PACKAGE}/package.json`).version; } catch (err) { cli.logger.error(`You need to install 'webpack-dev-server' for running 'webpack serve'.\n${err}`); @@ -146,97 +106,46 @@ class ServeCommand { const compilers = cli.isMultipleCompiler(compiler) ? compiler.compilers : [compiler]; const possibleCompilers = compilers.filter((compiler) => compiler.options.devServer); const compilersForDevServer = possibleCompilers.length > 0 ? possibleCompilers : [compilers[0]]; - const isDevServer4 = devServerVersion.startsWith("4"); const usedPorts = []; for (const compilerForDevServer of compilersForDevServer) { - let devServerOptions; - if (isNewDevServerCLIAPI) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const args = devServerFlags.reduce((accumulator, flag) => { - accumulator[flag.name] = flag; - return accumulator; - }, {}); - const values = Object.keys(devServerCLIOptions).reduce( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (accumulator, name) => { - const kebabName = cli.toKebabCase(name); - if (args[kebabName]) { - accumulator[kebabName] = options[name]; - } - return accumulator; - }, {}); - const result = Object.assign({}, (compilerForDevServer.options.devServer || {})); - const problems = (cli.webpack.cli && typeof cli.webpack.cli.processArguments === "function" - ? cli.webpack.cli - : DevServer.cli).processArguments(args, result, values); - if (problems) { - const groupBy = (xs, key) => { - return xs.reduce((rv, x) => { - (rv[x[key]] = rv[x[key]] || []).push(x); - return rv; - }, {}); - }; - const problemsByPath = groupBy(problems, "path"); - for (const path in problemsByPath) { - const problems = problemsByPath[path]; - problems.forEach((problem) => { - cli.logger.error(`${cli.capitalizeFirstLetter(problem.type.replace(/-/g, " "))}${problem.value ? ` '${problem.value}'` : ""} for the '--${problem.argument}' option${problem.index ? ` by index '${problem.index}'` : ""}`); - if (problem.expected) { - cli.logger.error(`Expected: '${problem.expected}'`); - } - }); - } - process.exit(2); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const args = devServerFlags.reduce((accumulator, flag) => { + accumulator[flag.name] = flag; + return accumulator; + }, {}); + const values = Object.keys(devServerCLIOptions).reduce( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (accumulator, name) => { + const kebabName = cli.toKebabCase(name); + if (args[kebabName]) { + accumulator[kebabName] = options[name]; } - devServerOptions = result; - } - else { - // TODO remove in the next major release - const mergeOptions = (devServerOptions, devServerCliOptions) => { - // CLI options should take precedence over devServer options, - // and CLI options should have no default values included - const options = Object.assign(Object.assign({}, devServerOptions), devServerCliOptions); - if (devServerOptions.client && - devServerCliOptions.client && - typeof devServerOptions.client === "object" && - typeof devServerCliOptions.client === "object") { - // the user could set some client options in their devServer config, - // then also specify client options on the CLI - options.client = Object.assign(Object.assign({}, devServerOptions.client), devServerCliOptions.client); - } - return options; - }; - devServerOptions = mergeOptions(compilerForDevServer.options.devServer || {}, devServerCLIOptions); - } - // TODO remove in the next major release - if (!isDevServer4) { - const getPublicPathOption = () => { - const normalizePublicPath = (publicPath) => typeof publicPath === "undefined" || publicPath === "auto" ? "/" : publicPath; - if (options.outputPublicPath) { - return normalizePublicPath(compilerForDevServer.options.output.publicPath); - } - if (devServerOptions.publicPath) { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - return normalizePublicPath(devServerOptions.publicPath); - } - return normalizePublicPath(compilerForDevServer.options.output.publicPath); + return accumulator; + }, {}); + const result = Object.assign({}, (compilerForDevServer.options.devServer || {})); + const problems = (cli.webpack.cli && typeof cli.webpack.cli.processArguments === "function" + ? cli.webpack.cli + : DevServer.cli).processArguments(args, result, values); + if (problems) { + const groupBy = (xs, key) => { + return xs.reduce((rv, x) => { + (rv[x[key]] = rv[x[key]] || []).push(x); + return rv; + }, {}); }; - const getStatsOption = () => { - if (options.stats) { - return options.stats; - } - if (devServerOptions.stats) { - return devServerOptions.stats; + const problemsByPath = groupBy(problems, "path"); + for (const path in problemsByPath) { + const problems = problemsByPath[path]; + for (const problem of problems) { + cli.logger.error(`${cli.capitalizeFirstLetter(problem.type.replace(/-/g, " "))}${problem.value ? ` '${problem.value}'` : ""} for the '--${problem.argument}' option${problem.index ? ` by index '${problem.index}'` : ""}`); + if (problem.expected) { + cli.logger.error(`Expected: '${problem.expected}'`); + } } - return compilerForDevServer.options.stats; - }; - devServerOptions.host = devServerOptions.host || "localhost"; - devServerOptions.port = - typeof devServerOptions.port !== "undefined" ? devServerOptions.port : 8080; - devServerOptions.stats = getStatsOption(); - devServerOptions.publicPath = getPublicPathOption(); + } + process.exit(2); } + const devServerOptions = result; if (devServerOptions.port) { const portNumber = Number(devServerOptions.port); if (usedPorts.find((port) => portNumber === port)) { @@ -245,25 +154,8 @@ class ServeCommand { usedPorts.push(portNumber); } try { - let server; - // TODO: remove after dropping webpack-dev-server@v3 - if (isDevServer4) { - server = new DevServer(devServerOptions, compiler); - } - else { - server = new DevServer(compiler, devServerOptions); - } - if (typeof server.start === "function") { - await server.start(); - } - else { - // TODO remove in the next major release - server.listen(devServerOptions.port, devServerOptions.host, (error) => { - if (error) { - throw error; - } - }); - } + const server = new DevServer(devServerOptions, compiler); + await server.start(); servers.push(server); } catch (error) { diff --git a/node_modules/@webpack-cli/serve/package.json b/node_modules/@webpack-cli/serve/package.json index cad9fdc..e41951d 100644 --- a/node_modules/@webpack-cli/serve/package.json +++ b/node_modules/@webpack-cli/serve/package.json @@ -1,6 +1,6 @@ { "name": "@webpack-cli/serve", - "version": "1.7.0", + "version": "2.0.5", "description": "", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -14,16 +14,20 @@ }, "homepage": "https://github.com/webpack/webpack-cli/tree/master/packages/serve", "license": "MIT", + "engines": { + "node": ">=14.15.0" + }, "files": [ "lib" ], "peerDependencies": { - "webpack-cli": "4.x.x" + "webpack": "5.x.x", + "webpack-cli": "5.x.x" }, "peerDependenciesMeta": { "webpack-dev-server": { "optional": true } }, - "gitHead": "20882d463450d010bb76e0824fe555e9785e9561" + "gitHead": "e879ce4ef91a9a89ca5ef74f533391cef5ba009d" } diff --git a/node_modules/ajv-keywords/README.md b/node_modules/ajv-keywords/README.md index 63e784f..1964a22 100644 --- a/node_modules/ajv-keywords/README.md +++ b/node_modules/ajv-keywords/README.md @@ -2,15 +2,13 @@ Custom JSON-Schema keywords for [Ajv](https://github.com/epoberezkin/ajv) validator -[![build](https://github.com/ajv-validator/ajv-keywords/workflows/build/badge.svg)](https://github.com/ajv-validator/ajv-keywords/actions?query=workflow%3Abuild) +[![Build Status](https://travis-ci.org/ajv-validator/ajv-keywords.svg?branch=master)](https://travis-ci.org/ajv-validator/ajv-keywords) [![npm](https://img.shields.io/npm/v/ajv-keywords.svg)](https://www.npmjs.com/package/ajv-keywords) [![npm downloads](https://img.shields.io/npm/dm/ajv-keywords.svg)](https://www.npmjs.com/package/ajv-keywords) -[![coverage](https://coveralls.io/repos/github/ajv-validator/ajv-keywords/badge.svg?branch=master)](https://coveralls.io/github/ajv-validator/ajv-keywords?branch=master) -[![gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv) +[![Coverage Status](https://coveralls.io/repos/github/ajv-validator/ajv-keywords/badge.svg?branch=master)](https://coveralls.io/github/ajv-validator/ajv-keywords?branch=master) +[![Dependabot](https://api.dependabot.com/badges/status?host=github&repo=ajv-validator/ajv-keywords)](https://app.dependabot.com/accounts/ajv-validator/repos/60477053) +[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv) -**Please note**: This readme file is for [ajv-keywords v5.0.0](https://github.com/ajv-validator/ajv-keywords/releases/tag/v5.0.0) that should be used with [ajv v8](https://github.com/ajv-validator/ajv). - -[ajv-keywords v3](https://github.com/ajv-validator/ajv-keywords/tree/v3) should be used with [ajv v6](https://github.com/ajv-validator/ajv/tree/v6). ## Contents @@ -19,14 +17,15 @@ Custom JSON-Schema keywords for [Ajv](https://github.com/epoberezkin/ajv) valida - [Keywords](#keywords) - [Types](#types) - [typeof](#typeof) - - [instanceof](#instanceof)\+ + - [instanceof](#instanceof) - [Keywords for numbers](#keywords-for-numbers) - [range and exclusiveRange](#range-and-exclusiverange) - [Keywords for strings](#keywords-for-strings) - [regexp](#regexp) + - [formatMaximum / formatMinimum and formatExclusiveMaximum / formatExclusiveMinimum](#formatmaximum--formatminimum-and-formatexclusivemaximum--formatexclusiveminimum) - [transform](#transform)\* - [Keywords for arrays](#keywords-for-arrays) - - [uniqueItemProperties](#uniqueitemproperties)\+ + - [uniqueItemProperties](#uniqueitemproperties) - [Keywords for objects](#keywords-for-objects) - [allRequired](#allrequired) - [anyRequired](#anyrequired) @@ -35,75 +34,56 @@ Custom JSON-Schema keywords for [Ajv](https://github.com/epoberezkin/ajv) valida - [prohibited](#prohibited) - [deepProperties](#deepproperties) - [deepRequired](#deeprequired) - - [dynamicDefaults](#dynamicdefaults)\*\+ + - [Compound keywords](#compound-keywords) + - [switch](#switch) (deprecated) + - [select/selectCases/selectDefault](#selectselectcasesselectdefault) (BETA) - [Keywords for all types](#keywords-for-all-types) - - [select/selectCases/selectDefault](#selectselectcasesselectdefault) + - [dynamicDefaults](#dynamicdefaults)\* - [Security contact](#security-contact) - [Open-source software support](#open-source-software-support) - [License](#license) \* - keywords that modify data -\+ - keywords that are not supported in [standalone validation code](https://github.com/ajv-validator/ajv/blob/master/docs/standalone.md) -## Install -To install version 4 to use with [Ajv v7](https://github.com/ajv-validator/ajv): +## Install ``` npm install ajv-keywords ``` + ## Usage To add all available keywords: ```javascript -const Ajv = require("ajv") -const ajv = new Ajv() -require("ajv-keywords")(ajv) +var Ajv = require('ajv'); +var ajv = new Ajv; +require('ajv-keywords')(ajv); -ajv.validate({instanceof: "RegExp"}, /.*/) // true -ajv.validate({instanceof: "RegExp"}, ".*") // false +ajv.validate({ instanceof: 'RegExp' }, /.*/); // true +ajv.validate({ instanceof: 'RegExp' }, '.*'); // false ``` To add a single keyword: ```javascript -require("ajv-keywords")(ajv, "instanceof") +require('ajv-keywords')(ajv, 'instanceof'); ``` To add multiple keywords: ```javascript -require("ajv-keywords")(ajv, ["typeof", "instanceof"]) +require('ajv-keywords')(ajv, ['typeof', 'instanceof']); ``` -To add a single keyword directly (to avoid adding unused code): +To add a single keyword in browser (to avoid adding unused code): ```javascript -require("ajv-keywords/dist/keywords/select")(ajv, opts) +require('ajv-keywords/keywords/instanceof')(ajv); ``` -To add all keywords via Ajv options: - -```javascript -const ajv = new Ajv({keywords: require("ajv-keywords/dist/definitions")(opts)}) -``` - -To add one or several keywords via options: - -```javascript -const ajv = new Ajv({ - keywords: [ - require("ajv-keywords/dist/definitions/typeof")(), - require("ajv-keywords/dist/definitions/instanceof")(), - // select exports an array of 3 definitions - see "select" in docs - ...require("ajv-keywords/dist/definitions/select")(opts), - ], -}) -``` - -`opts` is an optional object with a property `defaultMeta` - URI of meta-schema to use for keywords that use subschemas (`select` and `deepProperties`). The default is `"http://json-schema.org/schema"`. ## Keywords @@ -113,155 +93,188 @@ const ajv = new Ajv({ Based on JavaScript `typeof` operation. -The value of the keyword should be a string (`"undefined"`, `"string"`, `"number"`, `"object"`, `"function"`, `"boolean"` or `"symbol"`) or an array of strings. +The value of the keyword should be a string (`"undefined"`, `"string"`, `"number"`, `"object"`, `"function"`, `"boolean"` or `"symbol"`) or array of strings. To pass validation the result of `typeof` operation on the value should be equal to the string (or one of the strings in the array). -```javascript -ajv.validate({typeof: "undefined"}, undefined) // true -ajv.validate({typeof: "undefined"}, null) // false -ajv.validate({typeof: ["undefined", "object"]}, null) // true ``` +ajv.validate({ typeof: 'undefined' }, undefined); // true +ajv.validate({ typeof: 'undefined' }, null); // false +ajv.validate({ typeof: ['undefined', 'object'] }, null); // true +``` + #### `instanceof` Based on JavaScript `instanceof` operation. -The value of the keyword should be a string (`"Object"`, `"Array"`, `"Function"`, `"Number"`, `"String"`, `"Date"`, `"RegExp"` or `"Promise"`) or an array of strings. +The value of the keyword should be a string (`"Object"`, `"Array"`, `"Function"`, `"Number"`, `"String"`, `"Date"`, `"RegExp"`, `"Promise"` or `"Buffer"`) or array of strings. To pass validation the result of `data instanceof ...` operation on the value should be true: -```javascript -ajv.validate({instanceof: "Array"}, []) // true -ajv.validate({instanceof: "Array"}, {}) // false -ajv.validate({instanceof: ["Array", "Function"]}, function () {}) // true +``` +ajv.validate({ instanceof: 'Array' }, []); // true +ajv.validate({ instanceof: 'Array' }, {}); // false +ajv.validate({ instanceof: ['Array', 'Function'] }, function(){}); // true ``` You can add your own constructor function to be recognised by this keyword: ```javascript -class MyClass {} -const instanceofDef = require("ajv-keywords/dist/definitions/instanceof") -instanceofDef.CONSTRUCTORS.MyClass = MyClass -ajv.validate({instanceof: "MyClass"}, new MyClass()) // true +function MyClass() {} +var instanceofDefinition = require('ajv-keywords').get('instanceof').definition; +// or require('ajv-keywords/keywords/instanceof').definition; +instanceofDefinition.CONSTRUCTORS.MyClass = MyClass; + +ajv.validate({ instanceof: 'MyClass' }, new MyClass); // true ``` -**Please note**: currently `instanceof` is not supported in [standalone validation code](https://github.com/ajv-validator/ajv/blob/master/docs/standalone.md) - it has to be implemented as [`code` keyword](https://github.com/ajv-validator/ajv/blob/master/docs/keywords.md#define-keyword-with-code-generation-function) to support it (PR is welcome). ### Keywords for numbers #### `range` and `exclusiveRange` -Syntax sugar for the combination of minimum and maximum keywords (or exclusiveMinimum and exclusiveMaximum), also fails schema compilation if there are no numbers in the range. +Syntax sugar for the combination of minimum and maximum keywords, also fails schema compilation if there are no numbers in the range. -The value of these keywords must be an array consisting of two numbers, the second must be greater or equal than the first one. +The value of this keyword must be the array consisting of two numbers, the second must be greater or equal than the first one. -If the validated value is not a number the validation passes, otherwise to pass validation the value should be greater (or equal) than the first number and smaller (or equal) than the second number in the array. +If the validated value is not a number the validation passes, otherwise to pass validation the value should be greater (or equal) than the first number and smaller (or equal) than the second number in the array. If `exclusiveRange` keyword is present in the same schema and its value is true, the validated value must not be equal to the range boundaries. ```javascript -const schema = {type: "number", range: [1, 3]} -ajv.validate(schema, 1) // true -ajv.validate(schema, 2) // true -ajv.validate(schema, 3) // true -ajv.validate(schema, 0.99) // false -ajv.validate(schema, 3.01) // false - -const schema = {type: "number", exclusiveRange: [1, 3]} -ajv.validate(schema, 1.01) // true -ajv.validate(schema, 2) // true -ajv.validate(schema, 2.99) // true -ajv.validate(schema, 1) // false -ajv.validate(schema, 3) // false +var schema = { range: [1, 3] }; +ajv.validate(schema, 1); // true +ajv.validate(schema, 2); // true +ajv.validate(schema, 3); // true +ajv.validate(schema, 0.99); // false +ajv.validate(schema, 3.01); // false + +var schema = { range: [1, 3], exclusiveRange: true }; +ajv.validate(schema, 1.01); // true +ajv.validate(schema, 2); // true +ajv.validate(schema, 2.99); // true +ajv.validate(schema, 1); // false +ajv.validate(schema, 3); // false ``` + ### Keywords for strings #### `regexp` -This keyword allows to use regular expressions with flags in schemas, and also without `"u"` flag when needed (the standard `pattern` keyword does not support flags and implies the presence of `"u"` flag). +This keyword allows to use regular expressions with flags in schemas (the standard `pattern` keyword does not support flags). This keyword applies only to strings. If the data is not a string, the validation succeeds. The value of this keyword can be either a string (the result of `regexp.toString()`) or an object with the properties `pattern` and `flags` (the same strings that should be passed to RegExp constructor). ```javascript -const schema = { - type: "object", +var schema = { + type: 'object', properties: { - foo: {type: "string", regexp: "/foo/i"}, - bar: {type: "string", regexp: {pattern: "bar", flags: "i"}}, - }, -} + foo: { regexp: '/foo/i' }, + bar: { regexp: { pattern: 'bar', flags: 'i' } } + } +}; + +var validData = { + foo: 'Food', + bar: 'Barmen' +}; + +var invalidData = { + foo: 'fog', + bar: 'bad' +}; +``` -const validData = { - foo: "Food", - bar: "Barmen", -} -const invalidData = { - foo: "fog", - bar: "bad", +#### `formatMaximum` / `formatMinimum` and `formatExclusiveMaximum` / `formatExclusiveMinimum` + +These keywords allow to define minimum/maximum constraints when the format keyword defines ordering. + +These keywords apply only to strings. If the data is not a string, the validation succeeds. + +The value of keyword `formatMaximum` (`formatMinimum`) should be a string. This value is the maximum (minimum) allowed value for the data to be valid as determined by `format` keyword. If `format` is not present schema compilation will throw exception. + +When this keyword is added, it defines comparison rules for formats `"date"`, `"time"` and `"date-time"`. Custom formats also can have comparison rules. See [addFormat](https://github.com/epoberezkin/ajv#api-addformat) method. + +The value of keyword `formatExclusiveMaximum` (`formatExclusiveMinimum`) should be a boolean value. These keyword cannot be used without `formatMaximum` (`formatMinimum`). If this keyword value is equal to `true`, the data to be valid should not be equal to the value in `formatMaximum` (`formatMinimum`) keyword. + +```javascript +require('ajv-keywords')(ajv, ['formatMinimum', 'formatMaximum']); + +var schema = { + format: 'date', + formatMinimum: '2016-02-06', + formatMaximum: '2016-12-27', + formatExclusiveMaximum: true } + +var validDataList = ['2016-02-06', '2016-12-26', 1]; + +var invalidDataList = ['2016-02-05', '2016-12-27', 'abc']; ``` -#### `transform` -This keyword allows a string to be modified during validation. +#### `transform` -This keyword applies only to strings. If the data is not a string, the `transform` keyword is ignored. +This keyword allows a string to be modified before validation. -A standalone string cannot be modified, i.e. `data = 'a'; ajv.validate(schema, data);`, because strings are passed by value +These keywords apply only to strings. If the data is not a string, the transform is skipped. -**Supported transformations:** +There are limitation due to how ajv is written: +- a stand alone string cannot be transformed. ie `data = 'a'; ajv.validate(schema, data);` +- currently cannot work with `ajv-pack` +**Supported options:** - `trim`: remove whitespace from start and end -- `trimStart`/`trimLeft`: remove whitespace from start -- `trimEnd`/`trimRight`: remove whitespace from end -- `toLowerCase`: convert to lower case -- `toUpperCase`: convert to upper case -- `toEnumCase`: change string case to be equal to one of `enum` values in the schema +- `trimLeft`: remove whitespace from start +- `trimRight`: remove whitespace from end +- `toLowerCase`: case string to all lower case +- `toUpperCase`: case string to all upper case +- `toEnumCase`: case string to match case in schema -Transformations are applied in the order they are listed. +Options are applied in the order they are listed. Note: `toEnumCase` requires that all allowed values are unique when case insensitive. -**Example: multiple transformations** - +**Example: multiple options** ```javascript -require("ajv-keywords")(ajv, "transform") +require('ajv-keywords')(ajv, ['transform']); -const schema = { - type: "array", +var schema = { + type: 'array', items: { - type: "string", - transform: ["trim", "toLowerCase"], - }, -} + type:'string', + transform:['trim','toLowerCase'] + } +}; + +var data = [' MixCase ']; +ajv.validate(schema, data); +console.log(data); // ['mixcase'] -const data = [" MixCase "] -ajv.validate(schema, data) -console.log(data) // ['mixcase'] ``` **Example: `enumcase`** - ```javascript -require("ajv-keywords")(ajv, ["transform"]) +require('ajv-keywords')(ajv, ['transform']); -const schema = { - type: "array", +var schema = { + type: 'array', items: { - type: "string", - transform: ["trim", "toEnumCase"], - enum: ["pH"], - }, -} - -const data = ["ph", " Ph", "PH", "pH "] -ajv.validate(schema, data) -console.log(data) // ['pH','pH','pH','pH'] + type:'string', + transform:['trim','toEnumCase'], + enum:['pH'] + } +}; + +var data = ['ph',' Ph','PH','pH ']; +ajv.validate(schema, data); +console.log(data); // ['pH','pH','pH','pH'] ``` + ### Keywords for arrays #### `uniqueItemProperties` @@ -273,29 +286,29 @@ This keyword applies only to arrays. If the data is not an array, the validation The value of this keyword must be an array of strings - property names that should have unique values across all items. ```javascript -const schema = { - type: "array", - uniqueItemProperties: ["id", "name"], -} - -const validData = [{id: 1}, {id: 2}, {id: 3}] - -const invalidData1 = [ - {id: 1}, - {id: 1}, // duplicate "id" - {id: 3}, -] - -const invalidData2 = [ - {id: 1, name: "taco"}, - {id: 2, name: "taco"}, // duplicate "name" - {id: 3, name: "salsa"}, -] +var schema = { uniqueItemProperties: [ "id", "name" ] }; + +var validData = [ + { id: 1 }, + { id: 2 }, + { id: 3 } +]; + +var invalidData1 = [ + { id: 1 }, + { id: 1 }, // duplicate "id" + { id: 3 } +]; + +var invalidData2 = [ + { id: 1, name: "taco" }, + { id: 2, name: "taco" }, // duplicate "name" + { id: 3, name: "salsa" } +]; ``` This keyword is contributed by [@blainesch](https://github.com/blainesch). -**Please note**: currently `uniqueItemProperties` is not supported in [standalone validation code](https://github.com/ajv-validator/ajv/blob/master/docs/standalone.md) - it has to be implemented as [`code` keyword](https://github.com/ajv-validator/ajv/blob/master/docs/keywords.md#define-keyword-with-code-generation-function) to support it (PR is welcome). ### Keywords for objects @@ -314,21 +327,21 @@ If the value of the keyword is `true`, the validation succeeds if the data conta If the `properties` keyword is not present in the same schema object, schema compilation will throw exception. ```javascript -const schema = { - type: "object", +var schema = { properties: { - foo: {type: "number"}, - bar: {type: "number"}, - }, - allRequired: true, -} + foo: {type: 'number'}, + bar: {type: 'number'} + } + allRequired: true +}; -const validData = {foo: 1, bar: 2} -const alsoValidData = {foo: 1, bar: 2, baz: 3} +var validData = { foo: 1, bar: 2 }; +var alsoValidData = { foo: 1, bar: 2, baz: 3 }; -const invalidDataList = [{}, {foo: 1}, {bar: 2}] +var invalidDataList = [ {}, { foo: 1 }, { bar: 2 } ]; ``` + #### `anyRequired` This keyword allows to require the presence of any (at least one) property from the list. @@ -338,17 +351,17 @@ This keyword applies only to objects. If the data is not an object, the validati The value of this keyword must be an array of strings, each string being a property name. For data object to be valid at least one of the properties in this array should be present in the object. ```javascript -const schema = { - type: "object", - anyRequired: ["foo", "bar"], -} +var schema = { + anyRequired: ['foo', 'bar'] +}; -const validData = {foo: 1} -const alsoValidData = {foo: 1, bar: 2} +var validData = { foo: 1 }; +var alsoValidData = { foo: 1, bar: 2 }; -const invalidDataList = [{}, {baz: 3}] +var invalidDataList = [ {}, { baz: 3 } ]; ``` + #### `oneRequired` This keyword allows to require the presence of only one property from the list. @@ -358,17 +371,17 @@ This keyword applies only to objects. If the data is not an object, the validati The value of this keyword must be an array of strings, each string being a property name. For data object to be valid exactly one of the properties in this array should be present in the object. ```javascript -const schema = { - type: "object", - oneRequired: ["foo", "bar"], -} +var schema = { + oneRequired: ['foo', 'bar'] +}; -const validData = {foo: 1} -const alsoValidData = {bar: 2, baz: 3} +var validData = { foo: 1 }; +var alsoValidData = { bar: 2, baz: 3 }; -const invalidDataList = [{}, {baz: 3}, {foo: 1, bar: 2}] +var invalidDataList = [ {}, { baz: 3 }, { foo: 1, bar: 2 } ]; ``` + #### `patternRequired` This keyword allows to require the presence of properties that match some pattern(s). @@ -380,17 +393,15 @@ The value of this keyword should be an array of strings, each string being a reg If the array contains multiple regular expressions, more than one expression can match the same property name. ```javascript -const schema = { - type: "object", - patternRequired: ["f.*o", "b.*r"], -} +var schema = { patternRequired: [ 'f.*o', 'b.*r' ] }; -const validData = {foo: 1, bar: 2} -const alsoValidData = {foobar: 3} +var validData = { foo: 1, bar: 2 }; +var alsoValidData = { foobar: 3 }; -const invalidDataList = [{}, {foo: 1}, {bar: 2}] +var invalidDataList = [ {}, { foo: 1 }, { bar: 2 } ]; ``` + #### `prohibited` This keyword allows to prohibit that any of the properties in the list is present in the object. @@ -399,19 +410,21 @@ This keyword applies only to objects. If the data is not an object, the validati The value of this keyword should be an array of strings, each string being a property name. For data object to be valid none of the properties in this array should be present in the object. -```javascript -const schema = { - type: "object", - prohibited: ["foo", "bar"], -} +``` +var schema = { prohibited: ['foo', 'bar']}; -const validData = {baz: 1} -const alsoValidData = {} +var validData = { baz: 1 }; +var alsoValidData = {}; -const invalidDataList = [{foo: 1}, {bar: 2}, {foo: 1, bar: 2}] +var invalidDataList = [ + { foo: 1 }, + { bar: 2 }, + { foo: 1, bar: 2} +]; ``` -**Please note**: `{prohibited: ['foo', 'bar']}` is equivalent to `{not: {anyRequired: ['foo', 'bar']}}` (i.e. it has the same validation result for any data). +__Please note__: `{prohibited: ['foo', 'bar']}` is equivalent to `{not: {anyRequired: ['foo', 'bar']}}` (i.e. it has the same validation result for any data). + #### `deepProperties` @@ -422,52 +435,53 @@ This keyword applies only to objects. If the data is not an object, the validati The value should be an object, where keys are JSON pointers to the data, starting from the current position in data, and the values are JSON schemas. For data object to be valid the value of each JSON pointer should be valid according to the corresponding schema. ```javascript -const schema = { - type: "object", +var schema = { + type: 'object', deepProperties: { - "/users/1/role": {enum: ["admin"]}, - }, -} + "/users/1/role": { "enum": ["admin"] } + } +}; -const validData = { +var validData = { users: [ {}, { id: 123, - role: "admin", - }, - ], -} + role: 'admin' + } + ] +}; -const alsoValidData = { +var alsoValidData = { users: { - 1: { + "1": { id: 123, - role: "admin", - }, - }, -} + role: 'admin' + } + } +}; -const invalidData = { +var invalidData = { users: [ {}, { id: 123, - role: "user", - }, - ], -} + role: 'user' + } + ] +}; -const alsoInvalidData = { +var alsoInvalidData = { users: { - 1: { + "1": { id: 123, - role: "user", - }, - }, -} + role: 'user' + } + } +}; ``` + #### `deepRequired` This keyword allows to check that some deep properties (identified by JSON pointers) are available. @@ -477,111 +491,184 @@ This keyword applies only to objects. If the data is not an object, the validati The value should be an array of JSON pointers to the data, starting from the current position in data. For data object to be valid each JSON pointer should be some existing part of the data. ```javascript -const schema = { - type: "object", - deepRequired: ["/users/1/role"], -} +var schema = { + type: 'object', + deepRequired: ["/users/1/role"] +}; -const validData = { +var validData = { users: [ {}, { id: 123, - role: "admin", - }, - ], -} + role: 'admin' + } + ] +}; -const invalidData = { +var invalidData = { users: [ {}, { - id: 123, - }, - ], -} + id: 123 + } + ] +}; ``` See [json-schema-org/json-schema-spec#203](https://github.com/json-schema-org/json-schema-spec/issues/203#issue-197211916) for an example of the equivalent schema without `deepRequired` keyword. -### Keywords for all types -#### `select`/`selectCases`/`selectDefault` +### Compound keywords + +#### `switch` (deprecated) + +__Please note__: this keyword is provided to preserve backward compatibility with previous versions of Ajv. It is strongly recommended to use `if`/`then`/`else` keywords instead, as they have been added to the draft-07 of JSON Schema specification. + +This keyword allows to perform advanced conditional validation. + +The value of the keyword is the array of if/then clauses. Each clause is the object with the following properties: + +- `if` (optional) - the value is JSON-schema +- `then` (required) - the value is JSON-schema or boolean +- `continue` (optional) - the value is boolean + +The validation process is dynamic; all clauses are executed sequentially in the following way: + +1. `if`: + 1. `if` property is JSON-schema according to which the data is: + 1. valid => go to step 2. + 2. invalid => go to the NEXT clause, if this was the last clause the validation of `switch` SUCCEEDS. + 2. `if` property is absent => go to step 2. +2. `then`: + 1. `then` property is `true` or it is JSON-schema according to which the data is valid => go to step 3. + 2. `then` property is `false` or it is JSON-schema according to which the data is invalid => the validation of `switch` FAILS. +3. `continue`: + 1. `continue` property is `true` => go to the NEXT clause, if this was the last clause the validation of `switch` SUCCEEDS. + 2. `continue` property is `false` or absent => validation of `switch` SUCCEEDS. + +```javascript +require('ajv-keywords')(ajv, 'switch'); + +var schema = { + type: 'array', + items: { + type: 'integer', + 'switch': [ + { if: { not: { minimum: 1 } }, then: false }, + { if: { maximum: 10 }, then: true }, + { if: { maximum: 100 }, then: { multipleOf: 10 } }, + { if: { maximum: 1000 }, then: { multipleOf: 100 } }, + { then: false } + ] + } +}; + +var validItems = [1, 5, 10, 20, 50, 100, 200, 500, 1000]; + +var invalidItems = [1, 0, 2000, 11, 57, 123, 'foo']; +``` + +The above schema is equivalent to (for example): + +```javascript +{ + type: 'array', + items: { + type: 'integer', + if: { minimum: 1, maximum: 10 }, + then: true, + else: { + if: { maximum: 100 }, + then: { multipleOf: 10 }, + else: { + if: { maximum: 1000 }, + then: { multipleOf: 100 }, + else: false + } + } + } +} +``` -**Please note**: these keywords are deprecated. It is recommended to use OpenAPI [discriminator](https://ajv.js.org/json-schema.html#discriminator) keyword supported by Ajv v8 instead of `select`. + +#### `select`/`selectCases`/`selectDefault` These keywords allow to choose the schema to validate the data based on the value of some property in the validated data. These keywords must be present in the same schema object (`selectDefault` is optional). -The value of `select` keyword should be a [\$data reference](https://github.com/ajv-validator/ajv/blob/master/docs/validation.md#data-reference) that points to any primitive JSON type (string, number, boolean or null) in the data that is validated. You can also use a constant of primitive type as the value of this keyword (e.g., for debugging purposes). +The value of `select` keyword should be a [$data reference](https://github.com/epoberezkin/ajv/tree/5.0.2-beta.0#data-reference) that points to any primitive JSON type (string, number, boolean or null) in the data that is validated. You can also use a constant of primitive type as the value of this keyword (e.g., for debugging purposes). The value of `selectCases` keyword must be an object where each property name is a possible string representation of the value of `select` keyword and each property value is a corresponding schema (from draft-06 it can be boolean) that must be used to validate the data. -The value of `selectDefault` keyword is a schema (also can be boolean) that must be used to validate the data in case `selectCases` has no key equal to the stringified value of `select` keyword. +The value of `selectDefault` keyword is a schema (from draft-06 it can be boolean) that must be used to validate the data in case `selectCases` has no key equal to the stringified value of `select` keyword. The validation succeeds in one of the following cases: - - the validation of data using selected schema succeeds, - none of the schemas is selected for validation, - the value of select is undefined (no property in the data that the data reference points to). If `select` value (in data) is not a primitive type the validation fails. -This keyword correctly tracks evaluated properties and items to work with `unevaluatedProperties` and `unevaluatedItems` keywords - only properties and items from the subschema that was used (one of `selectCases` subschemas or `selectDefault` subschema) are marked as evaluated. +__Please note__: these keywords require Ajv `$data` option to support [$data reference](https://github.com/epoberezkin/ajv/tree/5.0.2-beta.0#data-reference). -**Please note**: these keywords require Ajv `$data` option to support [\$data reference](https://github.com/ajv-validator/ajv/blob/master/docs/validation.md#data-reference). ```javascript -require("ajv-keywords")(ajv, "select") +require('ajv-keywords')(ajv, 'select'); -const schema = { - type: "object", - required: ["kind"], +var schema = { + type: object, + required: ['kind'], properties: { - kind: {type: "string"}, + kind: { type: 'string' } }, - select: {$data: "0/kind"}, + select: { $data: '0/kind' }, selectCases: { foo: { - required: ["foo"], + required: ['foo'], properties: { kind: {}, - foo: {type: "string"}, + foo: { type: 'string' } }, - additionalProperties: false, + additionalProperties: false }, bar: { - required: ["bar"], + required: ['bar'], properties: { kind: {}, - bar: {type: "number"}, + bar: { type: 'number' } }, - additionalProperties: false, - }, + additionalProperties: false + } }, selectDefault: { propertyNames: { - not: {enum: ["foo", "bar"]}, - }, - }, -} + not: { enum: ['foo', 'bar'] } + } + } +}; + +var validDataList = [ + { kind: 'foo', foo: 'any' }, + { kind: 'bar', bar: 1 }, + { kind: 'anything_else', not_bar_or_foo: 'any value' } +]; + +var invalidDataList = [ + { kind: 'foo' }, // no propery foo + { kind: 'bar' }, // no propery bar + { kind: 'foo', foo: 'any', another: 'any value' }, // additional property + { kind: 'bar', bar: 1, another: 'any value' }, // additional property + { kind: 'anything_else', foo: 'any' } // property foo not allowed + { kind: 'anything_else', bar: 1 } // property bar not allowed +]; +``` -const validDataList = [ - {kind: "foo", foo: "any"}, - {kind: "bar", bar: 1}, - {kind: "anything_else", not_bar_or_foo: "any value"}, -] +__Please note__: the current implementation is BETA. It does not allow using relative URIs in $ref keywords in schemas in `selectCases` and `selectDefault` that point outside of these schemas. The workaround is to use absolute URIs (that can point to any (sub-)schema added to Ajv, including those inside the current root schema where `select` is used). See [tests](https://github.com/epoberezkin/ajv-keywords/blob/v2.0.0/spec/tests/select.json#L314). -const invalidDataList = [ - {kind: "foo"}, // no property foo - {kind: "bar"}, // no property bar - {kind: "foo", foo: "any", another: "any value"}, // additional property - {kind: "bar", bar: 1, another: "any value"}, // additional property - {kind: "anything_else", foo: "any"}, // property foo not allowed - {kind: "anything_else", bar: 1}, // property bar not allowed -] -``` + +### Keywords for all types #### `dynamicDefaults` @@ -591,10 +678,10 @@ This keyword only works if `useDefaults` options is used and not inside `anyOf` The keyword should be added on the object level. Its value should be an object with each property corresponding to a property name, in the same way as in standard `properties` keyword. The value of each property can be: -- an identifier of dynamic default function (a string) +- an identifier of default function (a string) - an object with properties `func` (an identifier) and `args` (an object with parameters that will be passed to this function during schema compilation - see examples). -The properties used in `dynamicDefaults` should not be added to `required` keyword in the same schema (or validation will fail), because unlike `default` this keyword is processed after validation. +The properties used in `dynamicDefaults` should not be added to `required` keyword (or validation will fail), because unlike `default` this keyword is processed after validation. There are several predefined dynamic default functions: @@ -607,126 +694,128 @@ There are several predefined dynamic default functions: - `"seq"` - sequential integer number starting from 0. If string is used as a property value, the default sequence will be used. If object `{ func: 'seq', args: { name: 'foo'} }` is used then the sequence with name `"foo"` will be used. Sequences are global, even if different ajv instances are used. ```javascript -const schema = { - type: "object", +var schema = { + type: 'object', dynamicDefaults: { - ts: "datetime", - r: {func: "randomint", args: {max: 100}}, - id: {func: "seq", args: {name: "id"}}, + ts: 'datetime', + r: { func: 'randomint', args: { max: 100 } }, + id: { func: 'seq', args: { name: 'id' } } }, properties: { ts: { - type: "string", - format: "date-time", + type: 'string', + format: 'date-time' }, r: { - type: "integer", + type: 'integer', minimum: 0, - exclusiveMaximum: 100, + exclusiveMaximum: 100 }, id: { - type: "integer", - minimum: 0, - }, - }, -} - -const data = {} -ajv.validate(data) // true -data // { ts: '2016-12-01T22:07:28.829Z', r: 25, id: 0 } - -const data1 = {} -ajv.validate(data1) // true -data1 // { ts: '2016-12-01T22:07:29.832Z', r: 68, id: 1 } - -ajv.validate(data1) // true -data1 // didn't change, as all properties were defined + type: 'integer', + minimum: 0 + } + } +}; + +var data = {}; +ajv.validate(data); // true +data; // { ts: '2016-12-01T22:07:28.829Z', r: 25, id: 0 } + +var data1 = {}; +ajv.validate(data1); // true +data1; // { ts: '2016-12-01T22:07:29.832Z', r: 68, id: 1 } + +ajv.validate(data1); // true +data1; // didn't change, as all properties were defined ``` -When using the `useDefaults` option value `"empty"`, properties and items equal to `null` or `""` (empty string) will be considered missing and assigned defaults. Use `allOf` [compound keyword](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#compound-keywords) to execute `dynamicDefaults` before validation. +When using the `useDefaults` option value `"empty"`, properties and items equal to `null` or `""` (empty string) will be considered missing and assigned defaults. Use the `allOf` [compound keyword](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#compound-keywords) to execute `dynamicDefaults` before validation. ```javascript -const schema = { - type: "object", +var schema = { allOf: [ { dynamicDefaults: { - ts: "datetime", - r: {func: "randomint", args: {min: 5, max: 100}}, - id: {func: "seq", args: {name: "id"}}, - }, + ts: 'datetime', + r: { func: 'randomint', args: { min: 5, max: 100 } }, + id: { func: 'seq', args: { name: 'id' } } + } }, { + type: 'object', properties: { ts: { - type: "string", + type: 'string' }, r: { - type: "number", + type: 'number', minimum: 5, - exclusiveMaximum: 100, + exclusiveMaximum: 100 }, id: { - type: "integer", - minimum: 0, - }, - }, - }, - ], -} - -const data = {ts: "", r: null} -ajv.validate(data) // true -data // { ts: '2016-12-01T22:07:28.829Z', r: 25, id: 0 } + type: 'integer', + minimum: 0 + } + } + } + ] +}; + +var data = { ts: '', r: null }; +ajv.validate(data); // true +data; // { ts: '2016-12-01T22:07:28.829Z', r: 25, id: 0 } ``` You can add your own dynamic default function to be recognised by this keyword: ```javascript -const uuid = require("uuid") +var uuid = require('uuid'); -const def = require("ajv-keywords/dist/definitions/dynamicDefaults") -def.DEFAULTS.uuid = () => uuid.v4 +function uuidV4() { return uuid.v4(); } -const schema = { - dynamicDefaults: {id: "uuid"}, - properties: {id: {type: "string", format: "uuid"}}, -} +var definition = require('ajv-keywords').get('dynamicDefaults').definition; +// or require('ajv-keywords/keywords/dynamicDefaults').definition; +definition.DEFAULTS.uuid = uuidV4; -const data = {} -ajv.validate(schema, data) // true -data // { id: 'a1183fbe-697b-4030-9bcc-cfeb282a9150' }; +var schema = { + dynamicDefaults: { id: 'uuid' }, + properties: { id: { type: 'string', format: 'uuid' } } +}; -const data1 = {} -ajv.validate(schema, data1) // true -data1 // { id: '5b008de7-1669-467a-a5c6-70fa244d7209' } +var data = {}; +ajv.validate(schema, data); // true +data; // { id: 'a1183fbe-697b-4030-9bcc-cfeb282a9150' }; + +var data1 = {}; +ajv.validate(schema, data1); // true +data1; // { id: '5b008de7-1669-467a-a5c6-70fa244d7209' } ``` -You also can define dynamic default that accept parameters, e.g. version of uuid: +You also can define dynamic default that accepts parameters, e.g. version of uuid: ```javascript -const uuid = require("uuid") +var uuid = require('uuid'); function getUuid(args) { - const version = "v" + ((arvs && args.v) || "4") - return uuid[version] + var version = 'v' + (arvs && args.v || 4); + return function() { + return uuid[version](); + }; } -const def = require("ajv-keywords/dist/definitions/dynamicDefaults") -def.DEFAULTS.uuid = getUuid +var definition = require('ajv-keywords').get('dynamicDefaults').definition; +definition.DEFAULTS.uuid = getUuid; -const schema = { +var schema = { dynamicDefaults: { - id1: "uuid", // v4 - id2: {func: "uuid", v: 4}, // v4 - id3: {func: "uuid", v: 1}, // v1 - }, -} + id1: 'uuid', // v4 + id2: { func: 'uuid', v: 4 }, // v4 + id3: { func: 'uuid', v: 1 } // v1 + } +}; ``` -**Please note**: dynamic default functions are differentiated by the number of parameters they have (`function.length`). Functions that do not expect default must have one non-optional argument so that `function.length` > 0. - -`dynamicDefaults` is not supported in [standalone validation code](https://github.com/ajv-validator/ajv/blob/master/docs/standalone.md). ## Security contact @@ -736,10 +825,12 @@ Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerabilities via GitHub issues. + ## Open-source software support Ajv-keywords is a part of [Tidelift subscription](https://tidelift.com/subscription/pkg/npm-ajv-keywords?utm_source=npm-ajv-keywords&utm_medium=referral&utm_campaign=readme) - it provides a centralised support to open-source software users, in addition to the support provided by software maintainers. + ## License [MIT](https://github.com/epoberezkin/ajv-keywords/blob/master/LICENSE) diff --git a/node_modules/ajv-keywords/dist/definitions/_range.d.ts b/node_modules/ajv-keywords/dist/definitions/_range.d.ts deleted file mode 100644 index f106678..0000000 --- a/node_modules/ajv-keywords/dist/definitions/_range.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { MacroKeywordDefinition } from "ajv"; -import type { GetDefinition } from "./_types"; -declare type RangeKwd = "range" | "exclusiveRange"; -export default function getRangeDef(keyword: RangeKwd): GetDefinition; -export {}; diff --git a/node_modules/ajv-keywords/dist/definitions/_range.js b/node_modules/ajv-keywords/dist/definitions/_range.js deleted file mode 100644 index 21d4aa4..0000000 --- a/node_modules/ajv-keywords/dist/definitions/_range.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function getRangeDef(keyword) { - return () => ({ - keyword, - type: "number", - schemaType: "array", - macro: function ([min, max]) { - validateRangeSchema(min, max); - return keyword === "range" - ? { minimum: min, maximum: max } - : { exclusiveMinimum: min, exclusiveMaximum: max }; - }, - metaSchema: { - type: "array", - minItems: 2, - maxItems: 2, - items: { type: "number" }, - }, - }); - function validateRangeSchema(min, max) { - if (min > max || (keyword === "exclusiveRange" && min === max)) { - throw new Error("There are no numbers in range"); - } - } -} -exports.default = getRangeDef; -//# sourceMappingURL=_range.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/_range.js.map b/node_modules/ajv-keywords/dist/definitions/_range.js.map deleted file mode 100644 index 132c83d..0000000 --- a/node_modules/ajv-keywords/dist/definitions/_range.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"_range.js","sourceRoot":"","sources":["../../src/definitions/_range.ts"],"names":[],"mappings":";;AAKA,SAAwB,WAAW,CAAC,OAAiB;IACnD,OAAO,GAAG,EAAE,CAAC,CAAC;QACZ,OAAO;QACP,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,OAAO;QACnB,KAAK,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,CAAmB;YAC3C,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;YAC7B,OAAO,OAAO,KAAK,OAAO;gBACxB,CAAC,CAAC,EAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAC;gBAC9B,CAAC,CAAC,EAAC,gBAAgB,EAAE,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAC,CAAA;QACpD,CAAC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,CAAC;YACX,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;SACxB;KACF,CAAC,CAAA;IAEF,SAAS,mBAAmB,CAAC,GAAW,EAAE,GAAW;QACnD,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,KAAK,gBAAgB,IAAI,GAAG,KAAK,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;SACjD;IACH,CAAC;AACH,CAAC;AAxBD,8BAwBC"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/_required.d.ts b/node_modules/ajv-keywords/dist/definitions/_required.d.ts deleted file mode 100644 index cac6e5e..0000000 --- a/node_modules/ajv-keywords/dist/definitions/_required.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { MacroKeywordDefinition } from "ajv"; -import type { GetDefinition } from "./_types"; -declare type RequiredKwd = "anyRequired" | "oneRequired"; -export default function getRequiredDef(keyword: RequiredKwd): GetDefinition; -export {}; diff --git a/node_modules/ajv-keywords/dist/definitions/_required.js b/node_modules/ajv-keywords/dist/definitions/_required.js deleted file mode 100644 index 27dd2ff..0000000 --- a/node_modules/ajv-keywords/dist/definitions/_required.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function getRequiredDef(keyword) { - return () => ({ - keyword, - type: "object", - schemaType: "array", - macro(schema) { - if (schema.length === 0) - return true; - if (schema.length === 1) - return { required: schema }; - const comb = keyword === "anyRequired" ? "anyOf" : "oneOf"; - return { [comb]: schema.map((p) => ({ required: [p] })) }; - }, - metaSchema: { - type: "array", - items: { type: "string" }, - }, - }); -} -exports.default = getRequiredDef; -//# sourceMappingURL=_required.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/_required.js.map b/node_modules/ajv-keywords/dist/definitions/_required.js.map deleted file mode 100644 index 94211e7..0000000 --- a/node_modules/ajv-keywords/dist/definitions/_required.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"_required.js","sourceRoot":"","sources":["../../src/definitions/_required.ts"],"names":[],"mappings":";;AAKA,SAAwB,cAAc,CACpC,OAAoB;IAEpB,OAAO,GAAG,EAAE,CAAC,CAAC;QACZ,OAAO;QACP,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,OAAO;QACnB,KAAK,CAAC,MAAgB;YACpB,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAA;YACpC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAA;YAClD,MAAM,IAAI,GAAG,OAAO,KAAK,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAA;YAC1D,OAAO,EAAC,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAC,CAAA;QACvD,CAAC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;SACxB;KACF,CAAC,CAAA;AACJ,CAAC;AAlBD,iCAkBC"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/_types.d.ts b/node_modules/ajv-keywords/dist/definitions/_types.d.ts deleted file mode 100644 index 7c36a04..0000000 --- a/node_modules/ajv-keywords/dist/definitions/_types.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { KeywordDefinition } from "ajv"; -export interface DefinitionOptions { - defaultMeta?: string | boolean; -} -export declare type GetDefinition = (opts?: DefinitionOptions) => T; diff --git a/node_modules/ajv-keywords/dist/definitions/_types.js b/node_modules/ajv-keywords/dist/definitions/_types.js deleted file mode 100644 index 6e5dd98..0000000 --- a/node_modules/ajv-keywords/dist/definitions/_types.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=_types.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/_types.js.map b/node_modules/ajv-keywords/dist/definitions/_types.js.map deleted file mode 100644 index 31f2fac..0000000 --- a/node_modules/ajv-keywords/dist/definitions/_types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"_types.js","sourceRoot":"","sources":["../../src/definitions/_types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/_util.d.ts b/node_modules/ajv-keywords/dist/definitions/_util.d.ts deleted file mode 100644 index b0d91dd..0000000 --- a/node_modules/ajv-keywords/dist/definitions/_util.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { DefinitionOptions } from "./_types"; -import type { SchemaObject, KeywordCxt, Name } from "ajv"; -export declare function metaSchemaRef({ defaultMeta }?: DefinitionOptions): SchemaObject; -export declare function usePattern({ gen, it: { opts } }: KeywordCxt, pattern: string, flags?: string): Name; diff --git a/node_modules/ajv-keywords/dist/definitions/_util.js b/node_modules/ajv-keywords/dist/definitions/_util.js deleted file mode 100644 index f8d1045..0000000 --- a/node_modules/ajv-keywords/dist/definitions/_util.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.usePattern = exports.metaSchemaRef = void 0; -const codegen_1 = require("ajv/dist/compile/codegen"); -const META_SCHEMA_ID = "http://json-schema.org/schema"; -function metaSchemaRef({ defaultMeta } = {}) { - return defaultMeta === false ? {} : { $ref: defaultMeta || META_SCHEMA_ID }; -} -exports.metaSchemaRef = metaSchemaRef; -function usePattern({ gen, it: { opts } }, pattern, flags = opts.unicodeRegExp ? "u" : "") { - const rx = new RegExp(pattern, flags); - return gen.scopeValue("pattern", { - key: rx.toString(), - ref: rx, - code: (0, codegen_1._) `new RegExp(${pattern}, ${flags})`, - }); -} -exports.usePattern = usePattern; -//# sourceMappingURL=_util.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/_util.js.map b/node_modules/ajv-keywords/dist/definitions/_util.js.map deleted file mode 100644 index c9e310b..0000000 --- a/node_modules/ajv-keywords/dist/definitions/_util.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"_util.js","sourceRoot":"","sources":["../../src/definitions/_util.ts"],"names":[],"mappings":";;;AAEA,sDAA0C;AAE1C,MAAM,cAAc,GAAG,+BAA+B,CAAA;AAEtD,SAAgB,aAAa,CAAC,EAAC,WAAW,KAAuB,EAAE;IACjE,OAAO,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,WAAW,IAAI,cAAc,EAAC,CAAA;AAC3E,CAAC;AAFD,sCAEC;AAED,SAAgB,UAAU,CACxB,EAAC,GAAG,EAAE,EAAE,EAAE,EAAC,IAAI,EAAC,EAAa,EAC7B,OAAe,EACf,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;IAErC,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IACrC,OAAO,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE;QAC/B,GAAG,EAAE,EAAE,CAAC,QAAQ,EAAE;QAClB,GAAG,EAAE,EAAE;QACP,IAAI,EAAE,IAAA,WAAC,EAAA,cAAc,OAAO,KAAK,KAAK,GAAG;KAC1C,CAAC,CAAA;AACJ,CAAC;AAXD,gCAWC"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/allRequired.d.ts b/node_modules/ajv-keywords/dist/definitions/allRequired.d.ts deleted file mode 100644 index ac709be..0000000 --- a/node_modules/ajv-keywords/dist/definitions/allRequired.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type { MacroKeywordDefinition } from "ajv"; -export default function getDef(): MacroKeywordDefinition; diff --git a/node_modules/ajv-keywords/dist/definitions/allRequired.js b/node_modules/ajv-keywords/dist/definitions/allRequired.js deleted file mode 100644 index c2a6803..0000000 --- a/node_modules/ajv-keywords/dist/definitions/allRequired.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function getDef() { - return { - keyword: "allRequired", - type: "object", - schemaType: "boolean", - macro(schema, parentSchema) { - if (!schema) - return true; - const required = Object.keys(parentSchema.properties); - if (required.length === 0) - return true; - return { required }; - }, - dependencies: ["properties"], - }; -} -exports.default = getDef; -module.exports = getDef; -//# sourceMappingURL=allRequired.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/allRequired.js.map b/node_modules/ajv-keywords/dist/definitions/allRequired.js.map deleted file mode 100644 index ff7006b..0000000 --- a/node_modules/ajv-keywords/dist/definitions/allRequired.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"allRequired.js","sourceRoot":"","sources":["../../src/definitions/allRequired.ts"],"names":[],"mappings":";;AAEA,SAAwB,MAAM;IAC5B,OAAO;QACL,OAAO,EAAE,aAAa;QACtB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,SAAS;QACrB,KAAK,CAAC,MAAe,EAAE,YAAY;YACjC,IAAI,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAA;YACxB,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAA;YACrD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAA;YACtC,OAAO,EAAC,QAAQ,EAAC,CAAA;QACnB,CAAC;QACD,YAAY,EAAE,CAAC,YAAY,CAAC;KAC7B,CAAA;AACH,CAAC;AAbD,yBAaC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/anyRequired.d.ts b/node_modules/ajv-keywords/dist/definitions/anyRequired.d.ts deleted file mode 100644 index a14c2cf..0000000 --- a/node_modules/ajv-keywords/dist/definitions/anyRequired.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { MacroKeywordDefinition } from "ajv"; -import type { GetDefinition } from "./_types"; -declare const getDef: GetDefinition; -export default getDef; diff --git a/node_modules/ajv-keywords/dist/definitions/anyRequired.js b/node_modules/ajv-keywords/dist/definitions/anyRequired.js deleted file mode 100644 index 0870ce3..0000000 --- a/node_modules/ajv-keywords/dist/definitions/anyRequired.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const _required_1 = __importDefault(require("./_required")); -const getDef = (0, _required_1.default)("anyRequired"); -exports.default = getDef; -module.exports = getDef; -//# sourceMappingURL=anyRequired.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/anyRequired.js.map b/node_modules/ajv-keywords/dist/definitions/anyRequired.js.map deleted file mode 100644 index af1a67b..0000000 --- a/node_modules/ajv-keywords/dist/definitions/anyRequired.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"anyRequired.js","sourceRoot":"","sources":["../../src/definitions/anyRequired.ts"],"names":[],"mappings":";;;;;AAEA,4DAAwC;AAExC,MAAM,MAAM,GAA0C,IAAA,mBAAc,EAAC,aAAa,CAAC,CAAA;AAEnF,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/deepProperties.d.ts b/node_modules/ajv-keywords/dist/definitions/deepProperties.d.ts deleted file mode 100644 index ed18565..0000000 --- a/node_modules/ajv-keywords/dist/definitions/deepProperties.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { MacroKeywordDefinition } from "ajv"; -import type { DefinitionOptions } from "./_types"; -export default function getDef(opts?: DefinitionOptions): MacroKeywordDefinition; diff --git a/node_modules/ajv-keywords/dist/definitions/deepProperties.js b/node_modules/ajv-keywords/dist/definitions/deepProperties.js deleted file mode 100644 index a567d7b..0000000 --- a/node_modules/ajv-keywords/dist/definitions/deepProperties.js +++ /dev/null @@ -1,54 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const _util_1 = require("./_util"); -function getDef(opts) { - return { - keyword: "deepProperties", - type: "object", - schemaType: "object", - macro: function (schema) { - const allOf = []; - for (const pointer in schema) - allOf.push(getSchema(pointer, schema[pointer])); - return { allOf }; - }, - metaSchema: { - type: "object", - propertyNames: { type: "string", format: "json-pointer" }, - additionalProperties: (0, _util_1.metaSchemaRef)(opts), - }, - }; -} -exports.default = getDef; -function getSchema(jsonPointer, schema) { - const segments = jsonPointer.split("/"); - const rootSchema = {}; - let pointerSchema = rootSchema; - for (let i = 1; i < segments.length; i++) { - let segment = segments[i]; - const isLast = i === segments.length - 1; - segment = unescapeJsonPointer(segment); - const properties = (pointerSchema.properties = {}); - let items; - if (/[0-9]+/.test(segment)) { - let count = +segment; - items = pointerSchema.items = []; - pointerSchema.type = ["object", "array"]; - while (count--) - items.push({}); - } - else { - pointerSchema.type = "object"; - } - pointerSchema = isLast ? schema : {}; - properties[segment] = pointerSchema; - if (items) - items.push(pointerSchema); - } - return rootSchema; -} -function unescapeJsonPointer(str) { - return str.replace(/~1/g, "/").replace(/~0/g, "~"); -} -module.exports = getDef; -//# sourceMappingURL=deepProperties.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/deepProperties.js.map b/node_modules/ajv-keywords/dist/definitions/deepProperties.js.map deleted file mode 100644 index 782bd04..0000000 --- a/node_modules/ajv-keywords/dist/definitions/deepProperties.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"deepProperties.js","sourceRoot":"","sources":["../../src/definitions/deepProperties.ts"],"names":[],"mappings":";;AAEA,mCAAqC;AAErC,SAAwB,MAAM,CAAC,IAAwB;IACrD,OAAO;QACL,OAAO,EAAE,gBAAgB;QACzB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,UAAU,MAAoC;YACnD,MAAM,KAAK,GAAG,EAAE,CAAA;YAChB,KAAK,MAAM,OAAO,IAAI,MAAM;gBAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;YAC7E,OAAO,EAAC,KAAK,EAAC,CAAA;QAChB,CAAC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAC;YACvD,oBAAoB,EAAE,IAAA,qBAAa,EAAC,IAAI,CAAC;SAC1C;KACF,CAAA;AACH,CAAC;AAhBD,yBAgBC;AAED,SAAS,SAAS,CAAC,WAAmB,EAAE,MAAoB;IAC1D,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACvC,MAAM,UAAU,GAAiB,EAAE,CAAA;IACnC,IAAI,aAAa,GAAiB,UAAU,CAAA;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,IAAI,OAAO,GAAW,QAAQ,CAAC,CAAC,CAAC,CAAA;QACjC,MAAM,MAAM,GAAG,CAAC,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAA;QACxC,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAA;QACtC,MAAM,UAAU,GAA2B,CAAC,aAAa,CAAC,UAAU,GAAG,EAAE,CAAC,CAAA;QAC1E,IAAI,KAAiC,CAAA;QACrC,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YAC1B,IAAI,KAAK,GAAG,CAAC,OAAO,CAAA;YACpB,KAAK,GAAG,aAAa,CAAC,KAAK,GAAG,EAAE,CAAA;YAChC,aAAa,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;YACxC,OAAO,KAAK,EAAE;gBAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;SAC/B;aAAM;YACL,aAAa,CAAC,IAAI,GAAG,QAAQ,CAAA;SAC9B;QACD,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;QACpC,UAAU,CAAC,OAAO,CAAC,GAAG,aAAa,CAAA;QACnC,IAAI,KAAK;YAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;KACrC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AAED,SAAS,mBAAmB,CAAC,GAAW;IACtC,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AACpD,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/deepRequired.d.ts b/node_modules/ajv-keywords/dist/definitions/deepRequired.d.ts deleted file mode 100644 index 79993ed..0000000 --- a/node_modules/ajv-keywords/dist/definitions/deepRequired.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type { CodeKeywordDefinition } from "ajv"; -export default function getDef(): CodeKeywordDefinition; diff --git a/node_modules/ajv-keywords/dist/definitions/deepRequired.js b/node_modules/ajv-keywords/dist/definitions/deepRequired.js deleted file mode 100644 index 2aa8bbf..0000000 --- a/node_modules/ajv-keywords/dist/definitions/deepRequired.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("ajv/dist/compile/codegen"); -function getDef() { - return { - keyword: "deepRequired", - type: "object", - schemaType: "array", - code(ctx) { - const { schema, data } = ctx; - const props = schema.map((jp) => (0, codegen_1._) `(${getData(jp)}) === undefined`); - ctx.fail((0, codegen_1.or)(...props)); - function getData(jsonPointer) { - if (jsonPointer === "") - throw new Error("empty JSON pointer not allowed"); - const segments = jsonPointer.split("/"); - let x = data; - const xs = segments.map((s, i) => i ? (x = (0, codegen_1._) `${x}${(0, codegen_1.getProperty)(unescapeJPSegment(s))}`) : x); - return (0, codegen_1.and)(...xs); - } - }, - metaSchema: { - type: "array", - items: { type: "string", format: "json-pointer" }, - }, - }; -} -exports.default = getDef; -function unescapeJPSegment(s) { - return s.replace(/~1/g, "/").replace(/~0/g, "~"); -} -module.exports = getDef; -//# sourceMappingURL=deepRequired.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/deepRequired.js.map b/node_modules/ajv-keywords/dist/definitions/deepRequired.js.map deleted file mode 100644 index a632916..0000000 --- a/node_modules/ajv-keywords/dist/definitions/deepRequired.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"deepRequired.js","sourceRoot":"","sources":["../../src/definitions/deepRequired.ts"],"names":[],"mappings":";;AACA,sDAAsE;AAEtE,SAAwB,MAAM;IAC5B,OAAO;QACL,OAAO,EAAE,cAAc;QACvB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,OAAO;QACnB,IAAI,CAAC,GAAe;YAClB,MAAM,EAAC,MAAM,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;YAC1B,MAAM,KAAK,GAAI,MAAmB,CAAC,GAAG,CAAC,CAAC,EAAU,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,IAAI,OAAO,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAA;YACzF,GAAG,CAAC,IAAI,CAAC,IAAA,YAAE,EAAC,GAAG,KAAK,CAAC,CAAC,CAAA;YAEtB,SAAS,OAAO,CAAC,WAAmB;gBAClC,IAAI,WAAW,KAAK,EAAE;oBAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;gBACzE,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;gBACvC,IAAI,CAAC,GAAS,IAAI,CAAA;gBAClB,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC/B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAA,WAAC,EAAA,GAAG,CAAC,GAAG,IAAA,qBAAW,EAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAC1D,CAAA;gBACD,OAAO,IAAA,aAAG,EAAC,GAAG,EAAE,CAAC,CAAA;YACnB,CAAC;QACH,CAAC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAC;SAChD;KACF,CAAA;AACH,CAAC;AAzBD,yBAyBC;AAED,SAAS,iBAAiB,CAAC,CAAS;IAClC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AAClD,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.d.ts b/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.d.ts deleted file mode 100644 index 702fb0a..0000000 --- a/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { FuncKeywordDefinition } from "ajv"; -export declare type DynamicDefaultFunc = (args?: Record) => () => any; -declare const DEFAULTS: Record; -declare const getDef: (() => FuncKeywordDefinition) & { - DEFAULTS: typeof DEFAULTS; -}; -export default getDef; diff --git a/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.js b/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.js deleted file mode 100644 index eada65e..0000000 --- a/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.js +++ /dev/null @@ -1,84 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const sequences = {}; -const DEFAULTS = { - timestamp: () => () => Date.now(), - datetime: () => () => new Date().toISOString(), - date: () => () => new Date().toISOString().slice(0, 10), - time: () => () => new Date().toISOString().slice(11), - random: () => () => Math.random(), - randomint: (args) => { - var _a; - const max = (_a = args === null || args === void 0 ? void 0 : args.max) !== null && _a !== void 0 ? _a : 2; - return () => Math.floor(Math.random() * max); - }, - seq: (args) => { - var _a; - const name = (_a = args === null || args === void 0 ? void 0 : args.name) !== null && _a !== void 0 ? _a : ""; - sequences[name] || (sequences[name] = 0); - return () => sequences[name]++; - }, -}; -const getDef = Object.assign(_getDef, { DEFAULTS }); -function _getDef() { - return { - keyword: "dynamicDefaults", - type: "object", - schemaType: ["string", "object"], - modifying: true, - valid: true, - compile(schema, _parentSchema, it) { - if (!it.opts.useDefaults || it.compositeRule) - return () => true; - const fs = {}; - for (const key in schema) - fs[key] = getDefault(schema[key]); - const empty = it.opts.useDefaults === "empty"; - return (data) => { - for (const prop in schema) { - if (data[prop] === undefined || (empty && (data[prop] === null || data[prop] === ""))) { - data[prop] = fs[prop](); - } - } - return true; - }; - }, - metaSchema: { - type: "object", - additionalProperties: { - anyOf: [ - { type: "string" }, - { - type: "object", - additionalProperties: false, - required: ["func", "args"], - properties: { - func: { type: "string" }, - args: { type: "object" }, - }, - }, - ], - }, - }, - }; -} -function getDefault(d) { - return typeof d == "object" ? getObjDefault(d) : getStrDefault(d); -} -function getObjDefault({ func, args }) { - const def = DEFAULTS[func]; - assertDefined(func, def); - return def(args); -} -function getStrDefault(d = "") { - const def = DEFAULTS[d]; - assertDefined(d, def); - return def(); -} -function assertDefined(name, def) { - if (!def) - throw new Error(`invalid "dynamicDefaults" keyword property value: ${name}`); -} -exports.default = getDef; -module.exports = getDef; -//# sourceMappingURL=dynamicDefaults.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.js.map b/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.js.map deleted file mode 100644 index 95e8170..0000000 --- a/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dynamicDefaults.js","sourceRoot":"","sources":["../../src/definitions/dynamicDefaults.ts"],"names":[],"mappings":";;AAEA,MAAM,SAAS,GAAuC,EAAE,CAAA;AAIxD,MAAM,QAAQ,GAAmD;IAC/D,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;IACjC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;IAC9C,IAAI,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;IACvD,IAAI,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;IACpD,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE;IACjC,SAAS,EAAE,CAAC,IAAqB,EAAE,EAAE;;QACnC,MAAM,GAAG,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG,mCAAI,CAAC,CAAA;QAC1B,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAA;IAC9C,CAAC;IACD,GAAG,EAAE,CAAC,IAAsB,EAAE,EAAE;;QAC9B,MAAM,IAAI,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,mCAAI,EAAE,CAAA;QAC7B,SAAS,CAAC,IAAI,MAAd,SAAS,CAAC,IAAI,IAAM,CAAC,EAAA;QACrB,OAAO,GAAG,EAAE,CAAE,SAAS,CAAC,IAAI,CAAY,EAAE,CAAA;IAC5C,CAAC;CACF,CAAA;AASD,MAAM,MAAM,GAER,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAC,QAAQ,EAAC,CAAC,CAAA;AAEtC,SAAS,OAAO;IACd,OAAO;QACL,OAAO,EAAE,iBAAiB;QAC1B,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAChC,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,IAAI;QACX,OAAO,CAAC,MAAqB,EAAE,aAAa,EAAE,EAAa;YACzD,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,aAAa;gBAAE,OAAO,GAAG,EAAE,CAAC,IAAI,CAAA;YAC/D,MAAM,EAAE,GAA8B,EAAE,CAAA;YACxC,KAAK,MAAM,GAAG,IAAI,MAAM;gBAAE,EAAE,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;YAC3D,MAAM,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,KAAK,OAAO,CAAA;YAE7C,OAAO,CAAC,IAAyB,EAAE,EAAE;gBACnC,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE;oBACzB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE;wBACrF,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAA;qBACxB;iBACF;gBACD,OAAO,IAAI,CAAA;YACb,CAAC,CAAA;QACH,CAAC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,oBAAoB,EAAE;gBACpB,KAAK,EAAE;oBACL,EAAC,IAAI,EAAE,QAAQ,EAAC;oBAChB;wBACE,IAAI,EAAE,QAAQ;wBACd,oBAAoB,EAAE,KAAK;wBAC3B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;wBAC1B,UAAU,EAAE;4BACV,IAAI,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;4BACtB,IAAI,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;yBACvB;qBACF;iBACF;aACF;SACF;KACF,CAAA;AACH,CAAC;AAED,SAAS,UAAU,CAAC,CAA6C;IAC/D,OAAO,OAAO,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAA;AACnE,CAAC;AAED,SAAS,aAAa,CAAC,EAAC,IAAI,EAAE,IAAI,EAAwB;IACxD,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC1B,aAAa,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IACxB,OAAO,GAAG,CAAC,IAAI,CAAC,CAAA;AAClB,CAAC;AAED,SAAS,aAAa,CAAC,CAAC,GAAG,EAAE;IAC3B,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IACvB,aAAa,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;IACrB,OAAO,GAAG,EAAE,CAAA;AACd,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,GAAwB;IAC3D,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,qDAAqD,IAAI,EAAE,CAAC,CAAA;AACxF,CAAC;AAED,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/exclusiveRange.d.ts b/node_modules/ajv-keywords/dist/definitions/exclusiveRange.d.ts deleted file mode 100644 index a14c2cf..0000000 --- a/node_modules/ajv-keywords/dist/definitions/exclusiveRange.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { MacroKeywordDefinition } from "ajv"; -import type { GetDefinition } from "./_types"; -declare const getDef: GetDefinition; -export default getDef; diff --git a/node_modules/ajv-keywords/dist/definitions/exclusiveRange.js b/node_modules/ajv-keywords/dist/definitions/exclusiveRange.js deleted file mode 100644 index cee3feb..0000000 --- a/node_modules/ajv-keywords/dist/definitions/exclusiveRange.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const _range_1 = __importDefault(require("./_range")); -const getDef = (0, _range_1.default)("exclusiveRange"); -exports.default = getDef; -module.exports = getDef; -//# sourceMappingURL=exclusiveRange.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/exclusiveRange.js.map b/node_modules/ajv-keywords/dist/definitions/exclusiveRange.js.map deleted file mode 100644 index aa43025..0000000 --- a/node_modules/ajv-keywords/dist/definitions/exclusiveRange.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"exclusiveRange.js","sourceRoot":"","sources":["../../src/definitions/exclusiveRange.ts"],"names":[],"mappings":";;;;;AAEA,sDAAkC;AAElC,MAAM,MAAM,GAA0C,IAAA,gBAAW,EAAC,gBAAgB,CAAC,CAAA;AAEnF,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/index.d.ts b/node_modules/ajv-keywords/dist/definitions/index.d.ts deleted file mode 100644 index 326d684..0000000 --- a/node_modules/ajv-keywords/dist/definitions/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { Vocabulary, ErrorNoParams } from "ajv"; -import type { DefinitionOptions } from "./_types"; -import { PatternRequiredError } from "./patternRequired"; -import { SelectError } from "./select"; -export default function ajvKeywords(opts?: DefinitionOptions): Vocabulary; -export declare type AjvKeywordsError = PatternRequiredError | SelectError | ErrorNoParams<"range" | "exclusiveRange" | "anyRequired" | "oneRequired" | "allRequired" | "deepProperties" | "deepRequired" | "dynamicDefaults" | "instanceof" | "prohibited" | "regexp" | "transform" | "uniqueItemProperties">; diff --git a/node_modules/ajv-keywords/dist/definitions/index.js b/node_modules/ajv-keywords/dist/definitions/index.js deleted file mode 100644 index 94ae44e..0000000 --- a/node_modules/ajv-keywords/dist/definitions/index.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const typeof_1 = __importDefault(require("./typeof")); -const instanceof_1 = __importDefault(require("./instanceof")); -const range_1 = __importDefault(require("./range")); -const exclusiveRange_1 = __importDefault(require("./exclusiveRange")); -const regexp_1 = __importDefault(require("./regexp")); -const transform_1 = __importDefault(require("./transform")); -const uniqueItemProperties_1 = __importDefault(require("./uniqueItemProperties")); -const allRequired_1 = __importDefault(require("./allRequired")); -const anyRequired_1 = __importDefault(require("./anyRequired")); -const oneRequired_1 = __importDefault(require("./oneRequired")); -const patternRequired_1 = __importDefault(require("./patternRequired")); -const prohibited_1 = __importDefault(require("./prohibited")); -const deepProperties_1 = __importDefault(require("./deepProperties")); -const deepRequired_1 = __importDefault(require("./deepRequired")); -const dynamicDefaults_1 = __importDefault(require("./dynamicDefaults")); -const select_1 = __importDefault(require("./select")); -const definitions = [ - typeof_1.default, - instanceof_1.default, - range_1.default, - exclusiveRange_1.default, - regexp_1.default, - transform_1.default, - uniqueItemProperties_1.default, - allRequired_1.default, - anyRequired_1.default, - oneRequired_1.default, - patternRequired_1.default, - prohibited_1.default, - deepProperties_1.default, - deepRequired_1.default, - dynamicDefaults_1.default, -]; -function ajvKeywords(opts) { - return definitions.map((d) => d(opts)).concat((0, select_1.default)(opts)); -} -exports.default = ajvKeywords; -module.exports = ajvKeywords; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/index.js.map b/node_modules/ajv-keywords/dist/definitions/index.js.map deleted file mode 100644 index 07d3530..0000000 --- a/node_modules/ajv-keywords/dist/definitions/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definitions/index.ts"],"names":[],"mappings":";;;;;AAEA,sDAAgC;AAChC,8DAAwC;AACxC,oDAA2B;AAC3B,sEAA6C;AAC7C,sDAA6B;AAC7B,4DAAmC;AACnC,kFAAyD;AACzD,gEAAuC;AACvC,gEAAuC;AACvC,gEAAuC;AACvC,wEAAuE;AACvE,8DAAqC;AACrC,sEAA6C;AAC7C,kEAAyC;AACzC,wEAA+C;AAC/C,sDAA+C;AAE/C,MAAM,WAAW,GAAuC;IACtD,gBAAS;IACT,oBAAa;IACb,eAAK;IACL,wBAAc;IACd,gBAAM;IACN,mBAAS;IACT,8BAAoB;IACpB,qBAAW;IACX,qBAAW;IACX,qBAAW;IACX,yBAAe;IACf,oBAAU;IACV,wBAAc;IACd,sBAAY;IACZ,yBAAe;CAChB,CAAA;AAED,SAAwB,WAAW,CAAC,IAAwB;IAC1D,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAA,gBAAS,EAAC,IAAI,CAAC,CAAC,CAAA;AAChE,CAAC;AAFD,8BAEC;AAqBD,MAAM,CAAC,OAAO,GAAG,WAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/instanceof.d.ts b/node_modules/ajv-keywords/dist/definitions/instanceof.d.ts deleted file mode 100644 index 05726f1..0000000 --- a/node_modules/ajv-keywords/dist/definitions/instanceof.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { FuncKeywordDefinition } from "ajv"; -declare type Constructor = new (...args: any[]) => any; -declare const CONSTRUCTORS: Record; -declare const getDef: (() => FuncKeywordDefinition) & { - CONSTRUCTORS: typeof CONSTRUCTORS; -}; -export default getDef; diff --git a/node_modules/ajv-keywords/dist/definitions/instanceof.js b/node_modules/ajv-keywords/dist/definitions/instanceof.js deleted file mode 100644 index 034fb64..0000000 --- a/node_modules/ajv-keywords/dist/definitions/instanceof.js +++ /dev/null @@ -1,54 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const CONSTRUCTORS = { - Object, - Array, - Function, - Number, - String, - Date, - RegExp, -}; -/* istanbul ignore else */ -if (typeof Buffer != "undefined") - CONSTRUCTORS.Buffer = Buffer; -/* istanbul ignore else */ -if (typeof Promise != "undefined") - CONSTRUCTORS.Promise = Promise; -const getDef = Object.assign(_getDef, { CONSTRUCTORS }); -function _getDef() { - return { - keyword: "instanceof", - schemaType: ["string", "array"], - compile(schema) { - if (typeof schema == "string") { - const C = getConstructor(schema); - return (data) => data instanceof C; - } - if (Array.isArray(schema)) { - const constructors = schema.map(getConstructor); - return (data) => { - for (const C of constructors) { - if (data instanceof C) - return true; - } - return false; - }; - } - /* istanbul ignore next */ - throw new Error("ajv implementation error"); - }, - metaSchema: { - anyOf: [{ type: "string" }, { type: "array", items: { type: "string" } }], - }, - }; -} -function getConstructor(c) { - const C = CONSTRUCTORS[c]; - if (C) - return C; - throw new Error(`invalid "instanceof" keyword value ${c}`); -} -exports.default = getDef; -module.exports = getDef; -//# sourceMappingURL=instanceof.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/instanceof.js.map b/node_modules/ajv-keywords/dist/definitions/instanceof.js.map deleted file mode 100644 index d401cd7..0000000 --- a/node_modules/ajv-keywords/dist/definitions/instanceof.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"instanceof.js","sourceRoot":"","sources":["../../src/definitions/instanceof.ts"],"names":[],"mappings":";;AAIA,MAAM,YAAY,GAA4C;IAC5D,MAAM;IACN,KAAK;IACL,QAAQ;IACR,MAAM;IACN,MAAM;IACN,IAAI;IACJ,MAAM;CACP,CAAA;AAED,0BAA0B;AAC1B,IAAI,OAAO,MAAM,IAAI,WAAW;IAAE,YAAY,CAAC,MAAM,GAAG,MAAM,CAAA;AAE9D,0BAA0B;AAC1B,IAAI,OAAO,OAAO,IAAI,WAAW;IAAE,YAAY,CAAC,OAAO,GAAG,OAAO,CAAA;AAEjE,MAAM,MAAM,GAER,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAC,YAAY,EAAC,CAAC,CAAA;AAE1C,SAAS,OAAO;IACd,OAAO;QACL,OAAO,EAAE,YAAY;QACrB,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;QAC/B,OAAO,CAAC,MAAyB;YAC/B,IAAI,OAAO,MAAM,IAAI,QAAQ,EAAE;gBAC7B,MAAM,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAA;gBAChC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,CAAA;aACnC;YAED,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBACzB,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;gBAC/C,OAAO,CAAC,IAAI,EAAE,EAAE;oBACd,KAAK,MAAM,CAAC,IAAI,YAAY,EAAE;wBAC5B,IAAI,IAAI,YAAY,CAAC;4BAAE,OAAO,IAAI,CAAA;qBACnC;oBACD,OAAO,KAAK,CAAA;gBACd,CAAC,CAAA;aACF;YAED,0BAA0B;YAC1B,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC7C,CAAC;QACD,UAAU,EAAE;YACV,KAAK,EAAE,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAE,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAC,CAAC;SACpE;KACF,CAAA;AACH,CAAC;AAED,SAAS,cAAc,CAAC,CAAS;IAC/B,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;IACzB,IAAI,CAAC;QAAE,OAAO,CAAC,CAAA;IACf,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,EAAE,CAAC,CAAA;AAC5D,CAAC;AAED,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/oneRequired.d.ts b/node_modules/ajv-keywords/dist/definitions/oneRequired.d.ts deleted file mode 100644 index a14c2cf..0000000 --- a/node_modules/ajv-keywords/dist/definitions/oneRequired.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { MacroKeywordDefinition } from "ajv"; -import type { GetDefinition } from "./_types"; -declare const getDef: GetDefinition; -export default getDef; diff --git a/node_modules/ajv-keywords/dist/definitions/oneRequired.js b/node_modules/ajv-keywords/dist/definitions/oneRequired.js deleted file mode 100644 index ae46c30..0000000 --- a/node_modules/ajv-keywords/dist/definitions/oneRequired.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const _required_1 = __importDefault(require("./_required")); -const getDef = (0, _required_1.default)("oneRequired"); -exports.default = getDef; -module.exports = getDef; -//# sourceMappingURL=oneRequired.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/oneRequired.js.map b/node_modules/ajv-keywords/dist/definitions/oneRequired.js.map deleted file mode 100644 index 134a1d9..0000000 --- a/node_modules/ajv-keywords/dist/definitions/oneRequired.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oneRequired.js","sourceRoot":"","sources":["../../src/definitions/oneRequired.ts"],"names":[],"mappings":";;;;;AAEA,4DAAwC;AAExC,MAAM,MAAM,GAA0C,IAAA,mBAAc,EAAC,aAAa,CAAC,CAAA;AAEnF,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/patternRequired.d.ts b/node_modules/ajv-keywords/dist/definitions/patternRequired.d.ts deleted file mode 100644 index 95b8eb5..0000000 --- a/node_modules/ajv-keywords/dist/definitions/patternRequired.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject } from "ajv"; -export declare type PatternRequiredError = ErrorObject<"patternRequired", { - missingPattern: string; -}>; -export default function getDef(): CodeKeywordDefinition; diff --git a/node_modules/ajv-keywords/dist/definitions/patternRequired.js b/node_modules/ajv-keywords/dist/definitions/patternRequired.js deleted file mode 100644 index ca24e64..0000000 --- a/node_modules/ajv-keywords/dist/definitions/patternRequired.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("ajv/dist/compile/codegen"); -const _util_1 = require("./_util"); -const error = { - message: ({ params: { missingPattern } }) => (0, codegen_1.str) `should have property matching pattern '${missingPattern}'`, - params: ({ params: { missingPattern } }) => (0, codegen_1._) `{missingPattern: ${missingPattern}}`, -}; -function getDef() { - return { - keyword: "patternRequired", - type: "object", - schemaType: "array", - error, - code(cxt) { - const { gen, schema, data } = cxt; - if (schema.length === 0) - return; - const valid = gen.let("valid", true); - for (const pat of schema) - validateProperties(pat); - function validateProperties(pattern) { - const matched = gen.let("matched", false); - gen.forIn("key", data, (key) => { - gen.assign(matched, (0, codegen_1._) `${(0, _util_1.usePattern)(cxt, pattern)}.test(${key})`); - gen.if(matched, () => gen.break()); - }); - cxt.setParams({ missingPattern: pattern }); - gen.assign(valid, (0, codegen_1.and)(valid, matched)); - cxt.pass(valid); - } - }, - metaSchema: { - type: "array", - items: { type: "string", format: "regex" }, - uniqueItems: true, - }, - }; -} -exports.default = getDef; -module.exports = getDef; -//# sourceMappingURL=patternRequired.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/patternRequired.js.map b/node_modules/ajv-keywords/dist/definitions/patternRequired.js.map deleted file mode 100644 index 17b095f..0000000 --- a/node_modules/ajv-keywords/dist/definitions/patternRequired.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"patternRequired.js","sourceRoot":"","sources":["../../src/definitions/patternRequired.ts"],"names":[],"mappings":";;AACA,sDAAoD;AACpD,mCAAkC;AAIlC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,cAAc,EAAC,EAAC,EAAE,EAAE,CACtC,IAAA,aAAG,EAAA,0CAA0C,cAAc,GAAG;IAChE,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,cAAc,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,oBAAoB,cAAc,GAAG;CAC/E,CAAA;AAED,SAAwB,MAAM;IAC5B,OAAO;QACL,OAAO,EAAE,iBAAiB;QAC1B,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,OAAO;QACnB,KAAK;QACL,IAAI,CAAC,GAAe;YAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;YAC/B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAM;YAC/B,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;YACpC,KAAK,MAAM,GAAG,IAAI,MAAM;gBAAE,kBAAkB,CAAC,GAAG,CAAC,CAAA;YAEjD,SAAS,kBAAkB,CAAC,OAAe;gBACzC,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;gBAEzC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;oBAC7B,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,IAAA,kBAAU,EAAC,GAAG,EAAE,OAAO,CAAC,SAAS,GAAG,GAAG,CAAC,CAAA;oBAChE,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;gBACpC,CAAC,CAAC,CAAA;gBAEF,GAAG,CAAC,SAAS,CAAC,EAAC,cAAc,EAAE,OAAO,EAAC,CAAC,CAAA;gBACxC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAA,aAAG,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;gBACtC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACjB,CAAC;QACH,CAAC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAC;YACxC,WAAW,EAAE,IAAI;SAClB;KACF,CAAA;AACH,CAAC;AA/BD,yBA+BC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/prohibited.d.ts b/node_modules/ajv-keywords/dist/definitions/prohibited.d.ts deleted file mode 100644 index ac709be..0000000 --- a/node_modules/ajv-keywords/dist/definitions/prohibited.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type { MacroKeywordDefinition } from "ajv"; -export default function getDef(): MacroKeywordDefinition; diff --git a/node_modules/ajv-keywords/dist/definitions/prohibited.js b/node_modules/ajv-keywords/dist/definitions/prohibited.js deleted file mode 100644 index 9a49746..0000000 --- a/node_modules/ajv-keywords/dist/definitions/prohibited.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function getDef() { - return { - keyword: "prohibited", - type: "object", - schemaType: "array", - macro: function (schema) { - if (schema.length === 0) - return true; - if (schema.length === 1) - return { not: { required: schema } }; - return { not: { anyOf: schema.map((p) => ({ required: [p] })) } }; - }, - metaSchema: { - type: "array", - items: { type: "string" }, - }, - }; -} -exports.default = getDef; -module.exports = getDef; -//# sourceMappingURL=prohibited.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/prohibited.js.map b/node_modules/ajv-keywords/dist/definitions/prohibited.js.map deleted file mode 100644 index 1a2deec..0000000 --- a/node_modules/ajv-keywords/dist/definitions/prohibited.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"prohibited.js","sourceRoot":"","sources":["../../src/definitions/prohibited.ts"],"names":[],"mappings":";;AAEA,SAAwB,MAAM;IAC5B,OAAO;QACL,OAAO,EAAE,YAAY;QACrB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,OAAO;QACnB,KAAK,EAAE,UAAU,MAAgB;YAC/B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAA;YACpC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,EAAC,GAAG,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,EAAC,CAAA;YACzD,OAAO,EAAC,GAAG,EAAE,EAAC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAC,EAAC,CAAA;QAC7D,CAAC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;SACxB;KACF,CAAA;AACH,CAAC;AAfD,yBAeC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/range.d.ts b/node_modules/ajv-keywords/dist/definitions/range.d.ts deleted file mode 100644 index a14c2cf..0000000 --- a/node_modules/ajv-keywords/dist/definitions/range.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { MacroKeywordDefinition } from "ajv"; -import type { GetDefinition } from "./_types"; -declare const getDef: GetDefinition; -export default getDef; diff --git a/node_modules/ajv-keywords/dist/definitions/range.js b/node_modules/ajv-keywords/dist/definitions/range.js deleted file mode 100644 index aa75c51..0000000 --- a/node_modules/ajv-keywords/dist/definitions/range.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const _range_1 = __importDefault(require("./_range")); -const getDef = (0, _range_1.default)("range"); -exports.default = getDef; -module.exports = getDef; -//# sourceMappingURL=range.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/range.js.map b/node_modules/ajv-keywords/dist/definitions/range.js.map deleted file mode 100644 index 7d9dd58..0000000 --- a/node_modules/ajv-keywords/dist/definitions/range.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"range.js","sourceRoot":"","sources":["../../src/definitions/range.ts"],"names":[],"mappings":";;;;;AAEA,sDAAkC;AAElC,MAAM,MAAM,GAA0C,IAAA,gBAAW,EAAC,OAAO,CAAC,CAAA;AAE1E,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/regexp.d.ts b/node_modules/ajv-keywords/dist/definitions/regexp.d.ts deleted file mode 100644 index 79993ed..0000000 --- a/node_modules/ajv-keywords/dist/definitions/regexp.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type { CodeKeywordDefinition } from "ajv"; -export default function getDef(): CodeKeywordDefinition; diff --git a/node_modules/ajv-keywords/dist/definitions/regexp.js b/node_modules/ajv-keywords/dist/definitions/regexp.js deleted file mode 100644 index b3c5a7c..0000000 --- a/node_modules/ajv-keywords/dist/definitions/regexp.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("ajv/dist/compile/codegen"); -const _util_1 = require("./_util"); -const regexpMetaSchema = { - type: "object", - properties: { - pattern: { type: "string" }, - flags: { type: "string", nullable: true }, - }, - required: ["pattern"], - additionalProperties: false, -}; -const metaRegexp = /^\/(.*)\/([gimuy]*)$/; -function getDef() { - return { - keyword: "regexp", - type: "string", - schemaType: ["string", "object"], - code(cxt) { - const { data, schema } = cxt; - const regx = getRegExp(schema); - cxt.pass((0, codegen_1._) `${regx}.test(${data})`); - function getRegExp(sch) { - if (typeof sch == "object") - return (0, _util_1.usePattern)(cxt, sch.pattern, sch.flags); - const rx = metaRegexp.exec(sch); - if (rx) - return (0, _util_1.usePattern)(cxt, rx[1], rx[2]); - throw new Error("cannot parse string into RegExp"); - } - }, - metaSchema: { - anyOf: [{ type: "string" }, regexpMetaSchema], - }, - }; -} -exports.default = getDef; -module.exports = getDef; -//# sourceMappingURL=regexp.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/regexp.js.map b/node_modules/ajv-keywords/dist/definitions/regexp.js.map deleted file mode 100644 index d389e47..0000000 --- a/node_modules/ajv-keywords/dist/definitions/regexp.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"regexp.js","sourceRoot":"","sources":["../../src/definitions/regexp.ts"],"names":[],"mappings":";;AACA,sDAA0C;AAC1C,mCAAkC;AAOlC,MAAM,gBAAgB,GAAiC;IACrD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,OAAO,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QACzB,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAC;KACxC;IACD,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrB,oBAAoB,EAAE,KAAK;CAC5B,CAAA;AAED,MAAM,UAAU,GAAG,sBAAsB,CAAA;AAEzC,SAAwB,MAAM;IAC5B,OAAO;QACL,OAAO,EAAE,QAAQ;QACjB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAChC,IAAI,CAAC,GAAe;YAClB,MAAM,EAAC,IAAI,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;YAC1B,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAA;YAC9B,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,SAAS,IAAI,GAAG,CAAC,CAAA;YAElC,SAAS,SAAS,CAAC,GAA0B;gBAC3C,IAAI,OAAO,GAAG,IAAI,QAAQ;oBAAE,OAAO,IAAA,kBAAU,EAAC,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,CAAA;gBAC1E,MAAM,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;gBAC/B,IAAI,EAAE;oBAAE,OAAO,IAAA,kBAAU,EAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;gBAC5C,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;YACpD,CAAC;QACH,CAAC;QACD,UAAU,EAAE;YACV,KAAK,EAAE,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAE,gBAAgB,CAAC;SAC5C;KACF,CAAA;AACH,CAAC;AArBD,yBAqBC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/select.d.ts b/node_modules/ajv-keywords/dist/definitions/select.d.ts deleted file mode 100644 index d12fc65..0000000 --- a/node_modules/ajv-keywords/dist/definitions/select.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { KeywordDefinition, ErrorObject } from "ajv"; -import type { DefinitionOptions } from "./_types"; -export declare type SelectError = ErrorObject<"select", { - failingCase?: string; - failingDefault?: true; -}>; -export default function getDef(opts?: DefinitionOptions): KeywordDefinition[]; diff --git a/node_modules/ajv-keywords/dist/definitions/select.js b/node_modules/ajv-keywords/dist/definitions/select.js deleted file mode 100644 index bce677b..0000000 --- a/node_modules/ajv-keywords/dist/definitions/select.js +++ /dev/null @@ -1,63 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("ajv/dist/compile/codegen"); -const _util_1 = require("./_util"); -const error = { - message: ({ params: { schemaProp } }) => schemaProp - ? (0, codegen_1.str) `should match case "${schemaProp}" schema` - : (0, codegen_1.str) `should match default case schema`, - params: ({ params: { schemaProp } }) => schemaProp ? (0, codegen_1._) `{failingCase: ${schemaProp}}` : (0, codegen_1._) `{failingDefault: true}`, -}; -function getDef(opts) { - const metaSchema = (0, _util_1.metaSchemaRef)(opts); - return [ - { - keyword: "select", - schemaType: ["string", "number", "boolean", "null"], - $data: true, - error, - dependencies: ["selectCases"], - code(cxt) { - const { gen, schemaCode, parentSchema } = cxt; - cxt.block$data(codegen_1.nil, () => { - const valid = gen.let("valid", true); - const schValid = gen.name("_valid"); - const value = gen.const("value", (0, codegen_1._) `${schemaCode} === null ? "null" : ${schemaCode}`); - gen.if(false); // optimizer should remove it from generated code - for (const schemaProp in parentSchema.selectCases) { - cxt.setParams({ schemaProp }); - gen.elseIf((0, codegen_1._) `"" + ${value} == ${schemaProp}`); // intentional ==, to match numbers and booleans - const schCxt = cxt.subschema({ keyword: "selectCases", schemaProp }, schValid); - cxt.mergeEvaluated(schCxt, codegen_1.Name); - gen.assign(valid, schValid); - } - gen.else(); - if (parentSchema.selectDefault !== undefined) { - cxt.setParams({ schemaProp: undefined }); - const schCxt = cxt.subschema({ keyword: "selectDefault" }, schValid); - cxt.mergeEvaluated(schCxt, codegen_1.Name); - gen.assign(valid, schValid); - } - gen.endIf(); - cxt.pass(valid); - }); - }, - }, - { - keyword: "selectCases", - dependencies: ["select"], - metaSchema: { - type: "object", - additionalProperties: metaSchema, - }, - }, - { - keyword: "selectDefault", - dependencies: ["select", "selectCases"], - metaSchema, - }, - ]; -} -exports.default = getDef; -module.exports = getDef; -//# sourceMappingURL=select.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/select.js.map b/node_modules/ajv-keywords/dist/definitions/select.js.map deleted file mode 100644 index 1e5a035..0000000 --- a/node_modules/ajv-keywords/dist/definitions/select.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/definitions/select.ts"],"names":[],"mappings":";;AACA,sDAA0D;AAE1D,mCAAqC;AAIrC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,UAAU,EAAC,EAAC,EAAE,EAAE,CAClC,UAAU;QACR,CAAC,CAAC,IAAA,aAAG,EAAA,sBAAsB,UAAU,UAAU;QAC/C,CAAC,CAAC,IAAA,aAAG,EAAA,kCAAkC;IAC3C,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,UAAU,EAAC,EAAC,EAAE,EAAE,CACjC,UAAU,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,iBAAiB,UAAU,GAAG,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,wBAAwB;CAC3E,CAAA;AAED,SAAwB,MAAM,CAAC,IAAwB;IACrD,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,IAAI,CAAC,CAAA;IAEtC,OAAO;QACL;YACE,OAAO,EAAE,QAAQ;YACjB,UAAU,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC;YACnD,KAAK,EAAE,IAAI;YACX,KAAK;YACL,YAAY,EAAE,CAAC,aAAa,CAAC;YAC7B,IAAI,CAAC,GAAe;gBAClB,MAAM,EAAC,GAAG,EAAE,UAAU,EAAE,YAAY,EAAC,GAAG,GAAG,CAAA;gBAC3C,GAAG,CAAC,UAAU,CAAC,aAAG,EAAE,GAAG,EAAE;oBACvB,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;oBACpC,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;oBACnC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,UAAU,wBAAwB,UAAU,EAAE,CAAC,CAAA;oBACpF,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA,CAAC,iDAAiD;oBAC/D,KAAK,MAAM,UAAU,IAAI,YAAY,CAAC,WAAW,EAAE;wBACjD,GAAG,CAAC,SAAS,CAAC,EAAC,UAAU,EAAC,CAAC,CAAA;wBAC3B,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,QAAQ,KAAK,OAAO,UAAU,EAAE,CAAC,CAAA,CAAC,gDAAgD;wBAC9F,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAC,EAAE,QAAQ,CAAC,CAAA;wBAC5E,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,cAAI,CAAC,CAAA;wBAChC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;qBAC5B;oBACD,GAAG,CAAC,IAAI,EAAE,CAAA;oBACV,IAAI,YAAY,CAAC,aAAa,KAAK,SAAS,EAAE;wBAC5C,GAAG,CAAC,SAAS,CAAC,EAAC,UAAU,EAAE,SAAS,EAAC,CAAC,CAAA;wBACtC,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,eAAe,EAAC,EAAE,QAAQ,CAAC,CAAA;wBAClE,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,cAAI,CAAC,CAAA;wBAChC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;qBAC5B;oBACD,GAAG,CAAC,KAAK,EAAE,CAAA;oBACX,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;gBACjB,CAAC,CAAC,CAAA;YACJ,CAAC;SACF;QACD;YACE,OAAO,EAAE,aAAa;YACtB,YAAY,EAAE,CAAC,QAAQ,CAAC;YACxB,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,oBAAoB,EAAE,UAAU;aACjC;SACF;QACD;YACE,OAAO,EAAE,eAAe;YACxB,YAAY,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC;YACvC,UAAU;SACX;KACF,CAAA;AACH,CAAC;AAlDD,yBAkDC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/transform.d.ts b/node_modules/ajv-keywords/dist/definitions/transform.d.ts deleted file mode 100644 index 551c46e..0000000 --- a/node_modules/ajv-keywords/dist/definitions/transform.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { CodeKeywordDefinition } from "ajv"; -declare type TransformName = "trimStart" | "trimEnd" | "trimLeft" | "trimRight" | "trim" | "toLowerCase" | "toUpperCase" | "toEnumCase"; -interface TransformConfig { - hash: Record; -} -declare type Transform = (s: string, cfg?: TransformConfig) => string; -declare const transform: { - [key in TransformName]: Transform; -}; -declare const getDef: (() => CodeKeywordDefinition) & { - transform: typeof transform; -}; -export default getDef; diff --git a/node_modules/ajv-keywords/dist/definitions/transform.js b/node_modules/ajv-keywords/dist/definitions/transform.js deleted file mode 100644 index 17128de..0000000 --- a/node_modules/ajv-keywords/dist/definitions/transform.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("ajv/dist/compile/codegen"); -const transform = { - trimStart: (s) => s.trimStart(), - trimEnd: (s) => s.trimEnd(), - trimLeft: (s) => s.trimStart(), - trimRight: (s) => s.trimEnd(), - trim: (s) => s.trim(), - toLowerCase: (s) => s.toLowerCase(), - toUpperCase: (s) => s.toUpperCase(), - toEnumCase: (s, cfg) => (cfg === null || cfg === void 0 ? void 0 : cfg.hash[configKey(s)]) || s, -}; -const getDef = Object.assign(_getDef, { transform }); -function _getDef() { - return { - keyword: "transform", - schemaType: "array", - before: "enum", - code(cxt) { - const { gen, data, schema, parentSchema, it } = cxt; - const { parentData, parentDataProperty } = it; - const tNames = schema; - if (!tNames.length) - return; - let cfg; - if (tNames.includes("toEnumCase")) { - const config = getEnumCaseCfg(parentSchema); - cfg = gen.scopeValue("obj", { ref: config, code: (0, codegen_1.stringify)(config) }); - } - gen.if((0, codegen_1._) `typeof ${data} == "string" && ${parentData} !== undefined`, () => { - gen.assign(data, transformExpr(tNames.slice())); - gen.assign((0, codegen_1._) `${parentData}[${parentDataProperty}]`, data); - }); - function transformExpr(ts) { - if (!ts.length) - return data; - const t = ts.pop(); - if (!(t in transform)) - throw new Error(`transform: unknown transformation ${t}`); - const func = gen.scopeValue("func", { - ref: transform[t], - code: (0, codegen_1._) `require("ajv-keywords/dist/definitions/transform").transform${(0, codegen_1.getProperty)(t)}`, - }); - const arg = transformExpr(ts); - return cfg && t === "toEnumCase" ? (0, codegen_1._) `${func}(${arg}, ${cfg})` : (0, codegen_1._) `${func}(${arg})`; - } - }, - metaSchema: { - type: "array", - items: { type: "string", enum: Object.keys(transform) }, - }, - }; -} -function getEnumCaseCfg(parentSchema) { - // build hash table to enum values - const cfg = { hash: {} }; - // requires `enum` in the same schema as transform - if (!parentSchema.enum) - throw new Error('transform: "toEnumCase" requires "enum"'); - for (const v of parentSchema.enum) { - if (typeof v !== "string") - continue; - const k = configKey(v); - // requires all `enum` values have unique keys - if (cfg.hash[k]) { - throw new Error('transform: "toEnumCase" requires all lowercased "enum" values to be unique'); - } - cfg.hash[k] = v; - } - return cfg; -} -function configKey(s) { - return s.toLowerCase(); -} -exports.default = getDef; -module.exports = getDef; -//# sourceMappingURL=transform.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/transform.js.map b/node_modules/ajv-keywords/dist/definitions/transform.js.map deleted file mode 100644 index 82220dc..0000000 --- a/node_modules/ajv-keywords/dist/definitions/transform.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../src/definitions/transform.ts"],"names":[],"mappings":";;AACA,sDAAkE;AAkBlE,MAAM,SAAS,GAAwC;IACrD,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE;IAC/B,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE;IAC3B,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE;IAC9B,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE;IAC7B,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE;IACrB,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE;IACnC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE;IACnC,UAAU,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAI,CAAC;CACrD,CAAA;AAED,MAAM,MAAM,GAER,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAC,SAAS,EAAC,CAAC,CAAA;AAEvC,SAAS,OAAO;IACd,OAAO;QACL,OAAO,EAAE,WAAW;QACpB,UAAU,EAAE,OAAO;QACnB,MAAM,EAAE,MAAM;QACd,IAAI,CAAC,GAAe;YAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;YACjD,MAAM,EAAC,UAAU,EAAE,kBAAkB,EAAC,GAAG,EAAE,CAAA;YAC3C,MAAM,MAAM,GAAa,MAAM,CAAA;YAC/B,IAAI,CAAC,MAAM,CAAC,MAAM;gBAAE,OAAM;YAC1B,IAAI,GAAqB,CAAA;YACzB,IAAI,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;gBACjC,MAAM,MAAM,GAAG,cAAc,CAAC,YAAY,CAAC,CAAA;gBAC3C,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAA,mBAAS,EAAC,MAAM,CAAC,EAAC,CAAC,CAAA;aACpE;YACD,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,UAAU,IAAI,mBAAmB,UAAU,gBAAgB,EAAE,GAAG,EAAE;gBACxE,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;gBAC/C,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,UAAU,IAAI,kBAAkB,GAAG,EAAE,IAAI,CAAC,CAAA;YAC3D,CAAC,CAAC,CAAA;YAEF,SAAS,aAAa,CAAC,EAAY;gBACjC,IAAI,CAAC,EAAE,CAAC,MAAM;oBAAE,OAAO,IAAI,CAAA;gBAC3B,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,EAAY,CAAA;gBAC5B,IAAI,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC;oBAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,EAAE,CAAC,CAAA;gBAChF,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE;oBAClC,GAAG,EAAE,SAAS,CAAC,CAAkB,CAAC;oBAClC,IAAI,EAAE,IAAA,WAAC,EAAA,+DAA+D,IAAA,qBAAW,EAAC,CAAC,CAAC,EAAE;iBACvF,CAAC,CAAA;gBACF,MAAM,GAAG,GAAG,aAAa,CAAC,EAAE,CAAC,CAAA;gBAC7B,OAAO,GAAG,IAAI,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,IAAI,GAAG,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,IAAI,GAAG,GAAG,CAAA;YACpF,CAAC;QACH,CAAC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAC;SACtD;KACF,CAAA;AACH,CAAC;AAED,SAAS,cAAc,CAAC,YAA6B;IACnD,kCAAkC;IAClC,MAAM,GAAG,GAAoB,EAAC,IAAI,EAAE,EAAE,EAAC,CAAA;IAEvC,kDAAkD;IAClD,IAAI,CAAC,YAAY,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAA;IAClF,KAAK,MAAM,CAAC,IAAI,YAAY,CAAC,IAAI,EAAE;QACjC,IAAI,OAAO,CAAC,KAAK,QAAQ;YAAE,SAAQ;QACnC,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;QACtB,8CAA8C;QAC9C,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAA;SAC9F;QACD,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;KAChB;IAED,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,SAAS,SAAS,CAAC,CAAS;IAC1B,OAAO,CAAC,CAAC,WAAW,EAAE,CAAA;AACxB,CAAC;AAED,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/typeof.d.ts b/node_modules/ajv-keywords/dist/definitions/typeof.d.ts deleted file mode 100644 index 79993ed..0000000 --- a/node_modules/ajv-keywords/dist/definitions/typeof.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type { CodeKeywordDefinition } from "ajv"; -export default function getDef(): CodeKeywordDefinition; diff --git a/node_modules/ajv-keywords/dist/definitions/typeof.js b/node_modules/ajv-keywords/dist/definitions/typeof.js deleted file mode 100644 index 5bb2b02..0000000 --- a/node_modules/ajv-keywords/dist/definitions/typeof.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("ajv/dist/compile/codegen"); -const TYPES = ["undefined", "string", "number", "object", "function", "boolean", "symbol"]; -function getDef() { - return { - keyword: "typeof", - schemaType: ["string", "array"], - code(cxt) { - const { data, schema, schemaValue } = cxt; - cxt.fail(typeof schema == "string" - ? (0, codegen_1._) `typeof ${data} != ${schema}` - : (0, codegen_1._) `${schemaValue}.indexOf(typeof ${data}) < 0`); - }, - metaSchema: { - anyOf: [ - { type: "string", enum: TYPES }, - { type: "array", items: { type: "string", enum: TYPES } }, - ], - }, - }; -} -exports.default = getDef; -module.exports = getDef; -//# sourceMappingURL=typeof.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/typeof.js.map b/node_modules/ajv-keywords/dist/definitions/typeof.js.map deleted file mode 100644 index 918d3ff..0000000 --- a/node_modules/ajv-keywords/dist/definitions/typeof.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"typeof.js","sourceRoot":"","sources":["../../src/definitions/typeof.ts"],"names":[],"mappings":";;AACA,sDAA0C;AAE1C,MAAM,KAAK,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAA;AAE1F,SAAwB,MAAM;IAC5B,OAAO;QACL,OAAO,EAAE,QAAQ;QACjB,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;QAC/B,IAAI,CAAC,GAAe;YAClB,MAAM,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAC,GAAG,GAAG,CAAA;YACvC,GAAG,CAAC,IAAI,CACN,OAAO,MAAM,IAAI,QAAQ;gBACvB,CAAC,CAAC,IAAA,WAAC,EAAA,UAAU,IAAI,OAAO,MAAM,EAAE;gBAChC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,WAAW,mBAAmB,IAAI,OAAO,CAClD,CAAA;QACH,CAAC;QACD,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAC;gBAC7B,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAC,EAAC;aACtD;SACF;KACF,CAAA;AACH,CAAC;AAnBD,yBAmBC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.d.ts b/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.d.ts deleted file mode 100644 index d836559..0000000 --- a/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type { FuncKeywordDefinition } from "ajv"; -export default function getDef(): FuncKeywordDefinition; diff --git a/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.js b/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.js deleted file mode 100644 index 1758209..0000000 --- a/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const equal = require("fast-deep-equal"); -const SCALAR_TYPES = ["number", "integer", "string", "boolean", "null"]; -function getDef() { - return { - keyword: "uniqueItemProperties", - type: "array", - schemaType: "array", - compile(keys, parentSchema) { - const scalar = getScalarKeys(keys, parentSchema); - return (data) => { - if (data.length <= 1) - return true; - for (let k = 0; k < keys.length; k++) { - const key = keys[k]; - if (scalar[k]) { - const hash = {}; - for (const x of data) { - if (!x || typeof x != "object") - continue; - let p = x[key]; - if (p && typeof p == "object") - continue; - if (typeof p == "string") - p = '"' + p; - if (hash[p]) - return false; - hash[p] = true; - } - } - else { - for (let i = data.length; i--;) { - const x = data[i]; - if (!x || typeof x != "object") - continue; - for (let j = i; j--;) { - const y = data[j]; - if (y && typeof y == "object" && equal(x[key], y[key])) - return false; - } - } - } - } - return true; - }; - }, - metaSchema: { - type: "array", - items: { type: "string" }, - }, - }; -} -exports.default = getDef; -function getScalarKeys(keys, schema) { - return keys.map((key) => { - var _a, _b, _c; - const t = (_c = (_b = (_a = schema.items) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b[key]) === null || _c === void 0 ? void 0 : _c.type; - return Array.isArray(t) - ? !t.includes("object") && !t.includes("array") - : SCALAR_TYPES.includes(t); - }); -} -module.exports = getDef; -//# sourceMappingURL=uniqueItemProperties.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.js.map b/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.js.map deleted file mode 100644 index c0619c2..0000000 --- a/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"uniqueItemProperties.js","sourceRoot":"","sources":["../../src/definitions/uniqueItemProperties.ts"],"names":[],"mappings":";;AACA,yCAAyC;AAEzC,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAA;AAEvE,SAAwB,MAAM;IAC5B,OAAO;QACL,OAAO,EAAE,sBAAsB;QAC/B,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,OAAO;QACnB,OAAO,CAAC,IAAc,EAAE,YAA6B;YACnD,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;YAEhD,OAAO,CAAC,IAAI,EAAE,EAAE;gBACd,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC;oBAAE,OAAO,IAAI,CAAA;gBACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACpC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;oBACnB,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;wBACb,MAAM,IAAI,GAAwB,EAAE,CAAA;wBACpC,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE;4BACpB,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,QAAQ;gCAAE,SAAQ;4BACxC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;4BACd,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,QAAQ;gCAAE,SAAQ;4BACvC,IAAI,OAAO,CAAC,IAAI,QAAQ;gCAAE,CAAC,GAAG,GAAG,GAAG,CAAC,CAAA;4BACrC,IAAI,IAAI,CAAC,CAAC,CAAC;gCAAE,OAAO,KAAK,CAAA;4BACzB,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;yBACf;qBACF;yBAAM;wBACL,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,GAAI;4BAC/B,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;4BACjB,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,QAAQ;gCAAE,SAAQ;4BACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,GAAI;gCACrB,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;gCACjB,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;oCAAE,OAAO,KAAK,CAAA;6BACrE;yBACF;qBACF;iBACF;gBACD,OAAO,IAAI,CAAA;YACb,CAAC,CAAA;QACH,CAAC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;SACxB;KACF,CAAA;AACH,CAAC;AAzCD,yBAyCC;AAED,SAAS,aAAa,CAAC,IAAc,EAAE,MAAuB;IAC5D,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;;QACtB,MAAM,CAAC,GAAG,MAAA,MAAA,MAAA,MAAM,CAAC,KAAK,0CAAE,UAAU,0CAAG,GAAG,CAAC,0CAAE,IAAI,CAAA;QAC/C,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YACrB,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;YAC/C,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC9B,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/index.d.ts b/node_modules/ajv-keywords/dist/index.d.ts deleted file mode 100644 index fc5b7a9..0000000 --- a/node_modules/ajv-keywords/dist/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { Plugin } from "ajv"; -export { AjvKeywordsError } from "./definitions"; -declare const ajvKeywords: Plugin; -export default ajvKeywords; diff --git a/node_modules/ajv-keywords/dist/index.js b/node_modules/ajv-keywords/dist/index.js deleted file mode 100644 index d0d3d8b..0000000 --- a/node_modules/ajv-keywords/dist/index.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const keywords_1 = __importDefault(require("./keywords")); -const ajvKeywords = (ajv, keyword) => { - if (Array.isArray(keyword)) { - for (const k of keyword) - get(k)(ajv); - return ajv; - } - if (keyword) { - get(keyword)(ajv); - return ajv; - } - for (keyword in keywords_1.default) - get(keyword)(ajv); - return ajv; -}; -ajvKeywords.get = get; -function get(keyword) { - const defFunc = keywords_1.default[keyword]; - if (!defFunc) - throw new Error("Unknown keyword " + keyword); - return defFunc; -} -exports.default = ajvKeywords; -module.exports = ajvKeywords; -// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -module.exports.default = ajvKeywords; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/index.js.map b/node_modules/ajv-keywords/dist/index.js.map deleted file mode 100644 index 2f472f1..0000000 --- a/node_modules/ajv-keywords/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAEA,0DAAgC;AAIhC,MAAM,WAAW,GAA8B,CAAC,GAAQ,EAAE,OAA2B,EAAO,EAAE;IAC5F,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC1B,KAAK,MAAM,CAAC,IAAI,OAAO;YAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QACpC,OAAO,GAAG,CAAA;KACX;IACD,IAAI,OAAO,EAAE;QACX,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAA;QACjB,OAAO,GAAG,CAAA;KACX;IACD,KAAK,OAAO,IAAI,kBAAO;QAAE,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAA;IAC1C,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,WAAW,CAAC,GAAG,GAAG,GAAG,CAAA;AAErB,SAAS,GAAG,CAAC,OAAe;IAC1B,MAAM,OAAO,GAAG,kBAAO,CAAC,OAAO,CAAC,CAAA;IAChC,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,GAAG,OAAO,CAAC,CAAA;IAC3D,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,kBAAe,WAAW,CAAA;AAC1B,MAAM,CAAC,OAAO,GAAG,WAAW,CAAA;AAE5B,sEAAsE;AACtE,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,WAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/allRequired.d.ts b/node_modules/ajv-keywords/dist/keywords/allRequired.d.ts deleted file mode 100644 index 97dd121..0000000 --- a/node_modules/ajv-keywords/dist/keywords/allRequired.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Plugin } from "ajv"; -declare const allRequired: Plugin; -export default allRequired; diff --git a/node_modules/ajv-keywords/dist/keywords/allRequired.js b/node_modules/ajv-keywords/dist/keywords/allRequired.js deleted file mode 100644 index aaf6563..0000000 --- a/node_modules/ajv-keywords/dist/keywords/allRequired.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const allRequired_1 = __importDefault(require("../definitions/allRequired")); -const allRequired = (ajv) => ajv.addKeyword((0, allRequired_1.default)()); -exports.default = allRequired; -module.exports = allRequired; -//# sourceMappingURL=allRequired.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/allRequired.js.map b/node_modules/ajv-keywords/dist/keywords/allRequired.js.map deleted file mode 100644 index e19effd..0000000 --- a/node_modules/ajv-keywords/dist/keywords/allRequired.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"allRequired.js","sourceRoot":"","sources":["../../src/keywords/allRequired.ts"],"names":[],"mappings":";;;;;AACA,6EAA+C;AAE/C,MAAM,WAAW,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,qBAAM,GAAE,CAAC,CAAA;AAExE,kBAAe,WAAW,CAAA;AAC1B,MAAM,CAAC,OAAO,GAAG,WAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/anyRequired.d.ts b/node_modules/ajv-keywords/dist/keywords/anyRequired.d.ts deleted file mode 100644 index 55e0fb1..0000000 --- a/node_modules/ajv-keywords/dist/keywords/anyRequired.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Plugin } from "ajv"; -declare const anyRequired: Plugin; -export default anyRequired; diff --git a/node_modules/ajv-keywords/dist/keywords/anyRequired.js b/node_modules/ajv-keywords/dist/keywords/anyRequired.js deleted file mode 100644 index 700dc0d..0000000 --- a/node_modules/ajv-keywords/dist/keywords/anyRequired.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const anyRequired_1 = __importDefault(require("../definitions/anyRequired")); -const anyRequired = (ajv) => ajv.addKeyword((0, anyRequired_1.default)()); -exports.default = anyRequired; -module.exports = anyRequired; -//# sourceMappingURL=anyRequired.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/anyRequired.js.map b/node_modules/ajv-keywords/dist/keywords/anyRequired.js.map deleted file mode 100644 index e1986e0..0000000 --- a/node_modules/ajv-keywords/dist/keywords/anyRequired.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"anyRequired.js","sourceRoot":"","sources":["../../src/keywords/anyRequired.ts"],"names":[],"mappings":";;;;;AACA,6EAA+C;AAE/C,MAAM,WAAW,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,qBAAM,GAAE,CAAC,CAAA;AAExE,kBAAe,WAAW,CAAA;AAC1B,MAAM,CAAC,OAAO,GAAG,WAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/deepProperties.d.ts b/node_modules/ajv-keywords/dist/keywords/deepProperties.d.ts deleted file mode 100644 index b8209c8..0000000 --- a/node_modules/ajv-keywords/dist/keywords/deepProperties.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { Plugin } from "ajv"; -import type { DefinitionOptions } from "../definitions/_types"; -declare const deepProperties: Plugin; -export default deepProperties; diff --git a/node_modules/ajv-keywords/dist/keywords/deepProperties.js b/node_modules/ajv-keywords/dist/keywords/deepProperties.js deleted file mode 100644 index bd207d8..0000000 --- a/node_modules/ajv-keywords/dist/keywords/deepProperties.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const deepProperties_1 = __importDefault(require("../definitions/deepProperties")); -const deepProperties = (ajv, opts) => ajv.addKeyword((0, deepProperties_1.default)(opts)); -exports.default = deepProperties; -module.exports = deepProperties; -//# sourceMappingURL=deepProperties.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/deepProperties.js.map b/node_modules/ajv-keywords/dist/keywords/deepProperties.js.map deleted file mode 100644 index 23ee8f3..0000000 --- a/node_modules/ajv-keywords/dist/keywords/deepProperties.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"deepProperties.js","sourceRoot":"","sources":["../../src/keywords/deepProperties.ts"],"names":[],"mappings":";;;;;AACA,mFAAkD;AAGlD,MAAM,cAAc,GAA8B,CAAC,GAAG,EAAE,IAAwB,EAAE,EAAE,CAClF,GAAG,CAAC,UAAU,CAAC,IAAA,wBAAM,EAAC,IAAI,CAAC,CAAC,CAAA;AAE9B,kBAAe,cAAc,CAAA;AAC7B,MAAM,CAAC,OAAO,GAAG,cAAc,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/deepRequired.d.ts b/node_modules/ajv-keywords/dist/keywords/deepRequired.d.ts deleted file mode 100644 index 113062b..0000000 --- a/node_modules/ajv-keywords/dist/keywords/deepRequired.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Plugin } from "ajv"; -declare const deepRequired: Plugin; -export default deepRequired; diff --git a/node_modules/ajv-keywords/dist/keywords/deepRequired.js b/node_modules/ajv-keywords/dist/keywords/deepRequired.js deleted file mode 100644 index 2077831..0000000 --- a/node_modules/ajv-keywords/dist/keywords/deepRequired.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const deepRequired_1 = __importDefault(require("../definitions/deepRequired")); -const deepRequired = (ajv) => ajv.addKeyword((0, deepRequired_1.default)()); -exports.default = deepRequired; -module.exports = deepRequired; -//# sourceMappingURL=deepRequired.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/deepRequired.js.map b/node_modules/ajv-keywords/dist/keywords/deepRequired.js.map deleted file mode 100644 index 4b808c1..0000000 --- a/node_modules/ajv-keywords/dist/keywords/deepRequired.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"deepRequired.js","sourceRoot":"","sources":["../../src/keywords/deepRequired.ts"],"names":[],"mappings":";;;;;AACA,+EAAgD;AAEhD,MAAM,YAAY,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,sBAAM,GAAE,CAAC,CAAA;AAEzE,kBAAe,YAAY,CAAA;AAC3B,MAAM,CAAC,OAAO,GAAG,YAAY,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.d.ts b/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.d.ts deleted file mode 100644 index b5e8475..0000000 --- a/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Plugin } from "ajv"; -declare const dynamicDefaults: Plugin; -export default dynamicDefaults; diff --git a/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.js b/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.js deleted file mode 100644 index 3df2207..0000000 --- a/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const dynamicDefaults_1 = __importDefault(require("../definitions/dynamicDefaults")); -const dynamicDefaults = (ajv) => ajv.addKeyword((0, dynamicDefaults_1.default)()); -exports.default = dynamicDefaults; -module.exports = dynamicDefaults; -//# sourceMappingURL=dynamicDefaults.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.js.map b/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.js.map deleted file mode 100644 index f87302a..0000000 --- a/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dynamicDefaults.js","sourceRoot":"","sources":["../../src/keywords/dynamicDefaults.ts"],"names":[],"mappings":";;;;;AACA,qFAAmD;AAEnD,MAAM,eAAe,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,yBAAM,GAAE,CAAC,CAAA;AAE5E,kBAAe,eAAe,CAAA;AAC9B,MAAM,CAAC,OAAO,GAAG,eAAe,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/exclusiveRange.d.ts b/node_modules/ajv-keywords/dist/keywords/exclusiveRange.d.ts deleted file mode 100644 index 23ca1ac..0000000 --- a/node_modules/ajv-keywords/dist/keywords/exclusiveRange.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Plugin } from "ajv"; -declare const exclusiveRange: Plugin; -export default exclusiveRange; diff --git a/node_modules/ajv-keywords/dist/keywords/exclusiveRange.js b/node_modules/ajv-keywords/dist/keywords/exclusiveRange.js deleted file mode 100644 index 5788996..0000000 --- a/node_modules/ajv-keywords/dist/keywords/exclusiveRange.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const exclusiveRange_1 = __importDefault(require("../definitions/exclusiveRange")); -const exclusiveRange = (ajv) => ajv.addKeyword((0, exclusiveRange_1.default)()); -exports.default = exclusiveRange; -module.exports = exclusiveRange; -//# sourceMappingURL=exclusiveRange.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/exclusiveRange.js.map b/node_modules/ajv-keywords/dist/keywords/exclusiveRange.js.map deleted file mode 100644 index a12321b..0000000 --- a/node_modules/ajv-keywords/dist/keywords/exclusiveRange.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"exclusiveRange.js","sourceRoot":"","sources":["../../src/keywords/exclusiveRange.ts"],"names":[],"mappings":";;;;;AACA,mFAAkD;AAElD,MAAM,cAAc,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,wBAAM,GAAE,CAAC,CAAA;AAE3E,kBAAe,cAAc,CAAA;AAC7B,MAAM,CAAC,OAAO,GAAG,cAAc,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/index.d.ts b/node_modules/ajv-keywords/dist/keywords/index.d.ts deleted file mode 100644 index 98fd14e..0000000 --- a/node_modules/ajv-keywords/dist/keywords/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Plugin } from "ajv"; -declare const ajvKeywords: Record | undefined>; -export default ajvKeywords; diff --git a/node_modules/ajv-keywords/dist/keywords/index.js b/node_modules/ajv-keywords/dist/keywords/index.js deleted file mode 100644 index d2b7d86..0000000 --- a/node_modules/ajv-keywords/dist/keywords/index.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const typeof_1 = __importDefault(require("./typeof")); -const instanceof_1 = __importDefault(require("./instanceof")); -const range_1 = __importDefault(require("./range")); -const exclusiveRange_1 = __importDefault(require("./exclusiveRange")); -const regexp_1 = __importDefault(require("./regexp")); -const transform_1 = __importDefault(require("./transform")); -const uniqueItemProperties_1 = __importDefault(require("./uniqueItemProperties")); -const allRequired_1 = __importDefault(require("./allRequired")); -const anyRequired_1 = __importDefault(require("./anyRequired")); -const oneRequired_1 = __importDefault(require("./oneRequired")); -const patternRequired_1 = __importDefault(require("./patternRequired")); -const prohibited_1 = __importDefault(require("./prohibited")); -const deepProperties_1 = __importDefault(require("./deepProperties")); -const deepRequired_1 = __importDefault(require("./deepRequired")); -const dynamicDefaults_1 = __importDefault(require("./dynamicDefaults")); -const select_1 = __importDefault(require("./select")); -// TODO type -const ajvKeywords = { - typeof: typeof_1.default, - instanceof: instanceof_1.default, - range: range_1.default, - exclusiveRange: exclusiveRange_1.default, - regexp: regexp_1.default, - transform: transform_1.default, - uniqueItemProperties: uniqueItemProperties_1.default, - allRequired: allRequired_1.default, - anyRequired: anyRequired_1.default, - oneRequired: oneRequired_1.default, - patternRequired: patternRequired_1.default, - prohibited: prohibited_1.default, - deepProperties: deepProperties_1.default, - deepRequired: deepRequired_1.default, - dynamicDefaults: dynamicDefaults_1.default, - select: select_1.default, -}; -exports.default = ajvKeywords; -module.exports = ajvKeywords; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/index.js.map b/node_modules/ajv-keywords/dist/keywords/index.js.map deleted file mode 100644 index b91d99e..0000000 --- a/node_modules/ajv-keywords/dist/keywords/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keywords/index.ts"],"names":[],"mappings":";;;;;AACA,sDAAmC;AACnC,8DAA2C;AAC3C,oDAA2B;AAC3B,sEAA6C;AAC7C,sDAA6B;AAC7B,4DAAmC;AACnC,kFAAyD;AACzD,gEAAuC;AACvC,gEAAuC;AACvC,gEAAuC;AACvC,wEAA+C;AAC/C,8DAAqC;AACrC,sEAA6C;AAC7C,kEAAyC;AACzC,wEAA+C;AAC/C,sDAA6B;AAE7B,YAAY;AACZ,MAAM,WAAW,GAA4C;IAC3D,MAAM,EAAE,gBAAY;IACpB,UAAU,EAAE,oBAAgB;IAC5B,KAAK,EAAL,eAAK;IACL,cAAc,EAAd,wBAAc;IACd,MAAM,EAAN,gBAAM;IACN,SAAS,EAAT,mBAAS;IACT,oBAAoB,EAApB,8BAAoB;IACpB,WAAW,EAAX,qBAAW;IACX,WAAW,EAAX,qBAAW;IACX,WAAW,EAAX,qBAAW;IACX,eAAe,EAAf,yBAAe;IACf,UAAU,EAAV,oBAAU;IACV,cAAc,EAAd,wBAAc;IACd,YAAY,EAAZ,sBAAY;IACZ,eAAe,EAAf,yBAAe;IACf,MAAM,EAAN,gBAAM;CACP,CAAA;AAED,kBAAe,WAAW,CAAA;AAC1B,MAAM,CAAC,OAAO,GAAG,WAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/instanceof.d.ts b/node_modules/ajv-keywords/dist/keywords/instanceof.d.ts deleted file mode 100644 index 2fa300c..0000000 --- a/node_modules/ajv-keywords/dist/keywords/instanceof.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Plugin } from "ajv"; -declare const instanceofPlugin: Plugin; -export default instanceofPlugin; diff --git a/node_modules/ajv-keywords/dist/keywords/instanceof.js b/node_modules/ajv-keywords/dist/keywords/instanceof.js deleted file mode 100644 index e5e2784..0000000 --- a/node_modules/ajv-keywords/dist/keywords/instanceof.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const instanceof_1 = __importDefault(require("../definitions/instanceof")); -const instanceofPlugin = (ajv) => ajv.addKeyword((0, instanceof_1.default)()); -exports.default = instanceofPlugin; -module.exports = instanceofPlugin; -//# sourceMappingURL=instanceof.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/instanceof.js.map b/node_modules/ajv-keywords/dist/keywords/instanceof.js.map deleted file mode 100644 index b33b115..0000000 --- a/node_modules/ajv-keywords/dist/keywords/instanceof.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"instanceof.js","sourceRoot":"","sources":["../../src/keywords/instanceof.ts"],"names":[],"mappings":";;;;;AACA,2EAA8C;AAE9C,MAAM,gBAAgB,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,oBAAM,GAAE,CAAC,CAAA;AAE7E,kBAAe,gBAAgB,CAAA;AAC/B,MAAM,CAAC,OAAO,GAAG,gBAAgB,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/oneRequired.d.ts b/node_modules/ajv-keywords/dist/keywords/oneRequired.d.ts deleted file mode 100644 index 2aaa0f5..0000000 --- a/node_modules/ajv-keywords/dist/keywords/oneRequired.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Plugin } from "ajv"; -declare const oneRequired: Plugin; -export default oneRequired; diff --git a/node_modules/ajv-keywords/dist/keywords/oneRequired.js b/node_modules/ajv-keywords/dist/keywords/oneRequired.js deleted file mode 100644 index c62e1eb..0000000 --- a/node_modules/ajv-keywords/dist/keywords/oneRequired.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const oneRequired_1 = __importDefault(require("../definitions/oneRequired")); -const oneRequired = (ajv) => ajv.addKeyword((0, oneRequired_1.default)()); -exports.default = oneRequired; -module.exports = oneRequired; -//# sourceMappingURL=oneRequired.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/oneRequired.js.map b/node_modules/ajv-keywords/dist/keywords/oneRequired.js.map deleted file mode 100644 index 9dc8aa0..0000000 --- a/node_modules/ajv-keywords/dist/keywords/oneRequired.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oneRequired.js","sourceRoot":"","sources":["../../src/keywords/oneRequired.ts"],"names":[],"mappings":";;;;;AACA,6EAA+C;AAE/C,MAAM,WAAW,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,qBAAM,GAAE,CAAC,CAAA;AAExE,kBAAe,WAAW,CAAA;AAC1B,MAAM,CAAC,OAAO,GAAG,WAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/patternRequired.d.ts b/node_modules/ajv-keywords/dist/keywords/patternRequired.d.ts deleted file mode 100644 index 565f5c0..0000000 --- a/node_modules/ajv-keywords/dist/keywords/patternRequired.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Plugin } from "ajv"; -declare const patternRequired: Plugin; -export default patternRequired; diff --git a/node_modules/ajv-keywords/dist/keywords/patternRequired.js b/node_modules/ajv-keywords/dist/keywords/patternRequired.js deleted file mode 100644 index fc6a1ab..0000000 --- a/node_modules/ajv-keywords/dist/keywords/patternRequired.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const patternRequired_1 = __importDefault(require("../definitions/patternRequired")); -const patternRequired = (ajv) => ajv.addKeyword((0, patternRequired_1.default)()); -exports.default = patternRequired; -module.exports = patternRequired; -//# sourceMappingURL=patternRequired.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/patternRequired.js.map b/node_modules/ajv-keywords/dist/keywords/patternRequired.js.map deleted file mode 100644 index c446c4d..0000000 --- a/node_modules/ajv-keywords/dist/keywords/patternRequired.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"patternRequired.js","sourceRoot":"","sources":["../../src/keywords/patternRequired.ts"],"names":[],"mappings":";;;;;AACA,qFAAmD;AAEnD,MAAM,eAAe,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,yBAAM,GAAE,CAAC,CAAA;AAE5E,kBAAe,eAAe,CAAA;AAC9B,MAAM,CAAC,OAAO,GAAG,eAAe,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/prohibited.d.ts b/node_modules/ajv-keywords/dist/keywords/prohibited.d.ts deleted file mode 100644 index 19f2ccb..0000000 --- a/node_modules/ajv-keywords/dist/keywords/prohibited.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Plugin } from "ajv"; -declare const prohibited: Plugin; -export default prohibited; diff --git a/node_modules/ajv-keywords/dist/keywords/prohibited.js b/node_modules/ajv-keywords/dist/keywords/prohibited.js deleted file mode 100644 index 08414f9..0000000 --- a/node_modules/ajv-keywords/dist/keywords/prohibited.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const prohibited_1 = __importDefault(require("../definitions/prohibited")); -const prohibited = (ajv) => ajv.addKeyword((0, prohibited_1.default)()); -exports.default = prohibited; -module.exports = prohibited; -//# sourceMappingURL=prohibited.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/prohibited.js.map b/node_modules/ajv-keywords/dist/keywords/prohibited.js.map deleted file mode 100644 index 5c2b190..0000000 --- a/node_modules/ajv-keywords/dist/keywords/prohibited.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"prohibited.js","sourceRoot":"","sources":["../../src/keywords/prohibited.ts"],"names":[],"mappings":";;;;;AACA,2EAA8C;AAE9C,MAAM,UAAU,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,oBAAM,GAAE,CAAC,CAAA;AAEvE,kBAAe,UAAU,CAAA;AACzB,MAAM,CAAC,OAAO,GAAG,UAAU,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/range.d.ts b/node_modules/ajv-keywords/dist/keywords/range.d.ts deleted file mode 100644 index 5e9bd23..0000000 --- a/node_modules/ajv-keywords/dist/keywords/range.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Plugin } from "ajv"; -declare const range: Plugin; -export default range; diff --git a/node_modules/ajv-keywords/dist/keywords/range.js b/node_modules/ajv-keywords/dist/keywords/range.js deleted file mode 100644 index 915f28d..0000000 --- a/node_modules/ajv-keywords/dist/keywords/range.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const range_1 = __importDefault(require("../definitions/range")); -const range = (ajv) => ajv.addKeyword((0, range_1.default)()); -exports.default = range; -module.exports = range; -//# sourceMappingURL=range.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/range.js.map b/node_modules/ajv-keywords/dist/keywords/range.js.map deleted file mode 100644 index b07eb26..0000000 --- a/node_modules/ajv-keywords/dist/keywords/range.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"range.js","sourceRoot":"","sources":["../../src/keywords/range.ts"],"names":[],"mappings":";;;;;AACA,iEAAyC;AAEzC,MAAM,KAAK,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,eAAM,GAAE,CAAC,CAAA;AAElE,kBAAe,KAAK,CAAA;AACpB,MAAM,CAAC,OAAO,GAAG,KAAK,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/regexp.d.ts b/node_modules/ajv-keywords/dist/keywords/regexp.d.ts deleted file mode 100644 index 4c64f08..0000000 --- a/node_modules/ajv-keywords/dist/keywords/regexp.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Plugin } from "ajv"; -declare const regexp: Plugin; -export default regexp; diff --git a/node_modules/ajv-keywords/dist/keywords/regexp.js b/node_modules/ajv-keywords/dist/keywords/regexp.js deleted file mode 100644 index 7eb7583..0000000 --- a/node_modules/ajv-keywords/dist/keywords/regexp.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const regexp_1 = __importDefault(require("../definitions/regexp")); -const regexp = (ajv) => ajv.addKeyword((0, regexp_1.default)()); -exports.default = regexp; -module.exports = regexp; -//# sourceMappingURL=regexp.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/regexp.js.map b/node_modules/ajv-keywords/dist/keywords/regexp.js.map deleted file mode 100644 index a004f5e..0000000 --- a/node_modules/ajv-keywords/dist/keywords/regexp.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"regexp.js","sourceRoot":"","sources":["../../src/keywords/regexp.ts"],"names":[],"mappings":";;;;;AACA,mEAA0C;AAE1C,MAAM,MAAM,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,gBAAM,GAAE,CAAC,CAAA;AAEnE,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/select.d.ts b/node_modules/ajv-keywords/dist/keywords/select.d.ts deleted file mode 100644 index f7f9aba..0000000 --- a/node_modules/ajv-keywords/dist/keywords/select.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { Plugin } from "ajv"; -import type { DefinitionOptions } from "../definitions/_types"; -declare const select: Plugin; -export default select; diff --git a/node_modules/ajv-keywords/dist/keywords/select.js b/node_modules/ajv-keywords/dist/keywords/select.js deleted file mode 100644 index eff7205..0000000 --- a/node_modules/ajv-keywords/dist/keywords/select.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const select_1 = __importDefault(require("../definitions/select")); -const select = (ajv, opts) => { - (0, select_1.default)(opts).forEach((d) => ajv.addKeyword(d)); - return ajv; -}; -exports.default = select; -module.exports = select; -//# sourceMappingURL=select.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/select.js.map b/node_modules/ajv-keywords/dist/keywords/select.js.map deleted file mode 100644 index 55b294c..0000000 --- a/node_modules/ajv-keywords/dist/keywords/select.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/keywords/select.ts"],"names":[],"mappings":";;;;;AACA,mEAA2C;AAG3C,MAAM,MAAM,GAA8B,CAAC,GAAG,EAAE,IAAwB,EAAE,EAAE;IAC1E,IAAA,gBAAO,EAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;IAC/C,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/transform.d.ts b/node_modules/ajv-keywords/dist/keywords/transform.d.ts deleted file mode 100644 index 8734ed0..0000000 --- a/node_modules/ajv-keywords/dist/keywords/transform.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Plugin } from "ajv"; -declare const transform: Plugin; -export default transform; diff --git a/node_modules/ajv-keywords/dist/keywords/transform.js b/node_modules/ajv-keywords/dist/keywords/transform.js deleted file mode 100644 index bdf9ef1..0000000 --- a/node_modules/ajv-keywords/dist/keywords/transform.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const transform_1 = __importDefault(require("../definitions/transform")); -const transform = (ajv) => ajv.addKeyword((0, transform_1.default)()); -exports.default = transform; -module.exports = transform; -//# sourceMappingURL=transform.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/transform.js.map b/node_modules/ajv-keywords/dist/keywords/transform.js.map deleted file mode 100644 index ef0e675..0000000 --- a/node_modules/ajv-keywords/dist/keywords/transform.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../src/keywords/transform.ts"],"names":[],"mappings":";;;;;AACA,yEAA6C;AAE7C,MAAM,SAAS,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,mBAAM,GAAE,CAAC,CAAA;AAEtE,kBAAe,SAAS,CAAA;AACxB,MAAM,CAAC,OAAO,GAAG,SAAS,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/typeof.d.ts b/node_modules/ajv-keywords/dist/keywords/typeof.d.ts deleted file mode 100644 index 57aff4b..0000000 --- a/node_modules/ajv-keywords/dist/keywords/typeof.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Plugin } from "ajv"; -declare const typeofPlugin: Plugin; -export default typeofPlugin; diff --git a/node_modules/ajv-keywords/dist/keywords/typeof.js b/node_modules/ajv-keywords/dist/keywords/typeof.js deleted file mode 100644 index 6cabc3a..0000000 --- a/node_modules/ajv-keywords/dist/keywords/typeof.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const typeof_1 = __importDefault(require("../definitions/typeof")); -const typeofPlugin = (ajv) => ajv.addKeyword((0, typeof_1.default)()); -exports.default = typeofPlugin; -module.exports = typeofPlugin; -//# sourceMappingURL=typeof.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/typeof.js.map b/node_modules/ajv-keywords/dist/keywords/typeof.js.map deleted file mode 100644 index ec70622..0000000 --- a/node_modules/ajv-keywords/dist/keywords/typeof.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"typeof.js","sourceRoot":"","sources":["../../src/keywords/typeof.ts"],"names":[],"mappings":";;;;;AACA,mEAA0C;AAE1C,MAAM,YAAY,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,gBAAM,GAAE,CAAC,CAAA;AAEzE,kBAAe,YAAY,CAAA;AAC3B,MAAM,CAAC,OAAO,GAAG,YAAY,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.d.ts b/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.d.ts deleted file mode 100644 index ff06fea..0000000 --- a/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Plugin } from "ajv"; -declare const uniqueItemProperties: Plugin; -export default uniqueItemProperties; diff --git a/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.js b/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.js deleted file mode 100644 index a638fcc..0000000 --- a/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const uniqueItemProperties_1 = __importDefault(require("../definitions/uniqueItemProperties")); -const uniqueItemProperties = (ajv) => ajv.addKeyword((0, uniqueItemProperties_1.default)()); -exports.default = uniqueItemProperties; -module.exports = uniqueItemProperties; -//# sourceMappingURL=uniqueItemProperties.js.map \ No newline at end of file diff --git a/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.js.map b/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.js.map deleted file mode 100644 index b62fdd2..0000000 --- a/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"uniqueItemProperties.js","sourceRoot":"","sources":["../../src/keywords/uniqueItemProperties.ts"],"names":[],"mappings":";;;;;AACA,+FAAwD;AAExD,MAAM,oBAAoB,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,8BAAM,GAAE,CAAC,CAAA;AAEjF,kBAAe,oBAAoB,CAAA;AACnC,MAAM,CAAC,OAAO,GAAG,oBAAoB,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-keywords/package.json b/node_modules/ajv-keywords/package.json index 515f583..fbd29d0 100644 --- a/node_modules/ajv-keywords/package.json +++ b/node_modules/ajv-keywords/package.json @@ -1,18 +1,16 @@ { "name": "ajv-keywords", - "version": "5.1.0", - "description": "Additional JSON-Schema keywords for Ajv JSON validator", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "version": "3.5.2", + "description": "Custom JSON-Schema keywords for Ajv validator", + "main": "index.js", + "typings": "ajv-keywords.d.ts", "scripts": { - "build": "rm -rf dist && tsc", + "build": "node node_modules/ajv/scripts/compile-dots.js node_modules/ajv/lib keywords", "prepublish": "npm run build", - "prettier:write": "prettier --write \"./**/*.{md,json,yaml,js,ts}\"", - "prettier:check": "prettier --list-different \"./**/*.{md,json,yaml,js,ts}\"", - "test": "npm link && npm link ajv-keywords && npm run eslint && npm run test-cov", - "eslint": "eslint \"src/**/*.*s\" \"spec/**/*.*s\"", - "test-spec": "jest spec/*.ts", - "test-cov": "jest spec/*.ts --coverage" + "test": "npm run build && npm run eslint && npm run test-cov", + "eslint": "eslint index.js keywords/*.js spec", + "test-spec": "mocha spec/*.spec.js -R spec", + "test-cov": "istanbul cover -x 'spec/**' node_modules/mocha/bin/_mocha -- spec/*.spec.js -R spec" }, "repository": { "type": "git", @@ -24,9 +22,9 @@ "keywords" ], "files": [ - "src", - "dist", - "ajv-keywords.d.ts" + "index.js", + "ajv-keywords.d.ts", + "keywords" ], "author": "Evgeny Poberezkin", "license": "MIT", @@ -34,41 +32,22 @@ "url": "https://github.com/epoberezkin/ajv-keywords/issues" }, "homepage": "https://github.com/epoberezkin/ajv-keywords#readme", - "dependencies": { - "fast-deep-equal": "^3.1.3" - }, "peerDependencies": { - "ajv": "^8.8.2" + "ajv": "^6.9.1" }, "devDependencies": { - "@ajv-validator/config": "^0.2.3", - "@types/chai": "^4.2.14", - "@types/jest": "^26.0.14", - "@types/node": "^16.4.10", - "@types/uuid": "^8.3.0", - "@typescript-eslint/eslint-plugin": "^4.4.1", - "@typescript-eslint/parser": "^4.4.1", - "ajv": "^8.8.2", - "ajv-formats": "^2.0.0", + "ajv": "^6.9.1", + "ajv-pack": "^0.3.0", "chai": "^4.2.0", + "coveralls": "^3.0.2", + "dot": "^1.1.1", "eslint": "^7.2.0", - "eslint-config-prettier": "^7.0.0", - "husky": "^7.0.1", - "jest": "^26.5.3", + "glob": "^7.1.3", + "istanbul": "^0.4.3", + "js-beautify": "^1.8.9", "json-schema-test": "^2.0.0", - "lint-staged": "^11.1.1", - "prettier": "^2.1.2", - "ts-jest": "^26.4.1", - "typescript": "^4.2.0", + "mocha": "^8.0.1", + "pre-commit": "^1.1.3", "uuid": "^8.1.0" - }, - "prettier": "@ajv-validator/config/prettierrc.json", - "husky": { - "hooks": { - "pre-commit": "lint-staged && npm test" - } - }, - "lint-staged": { - "*.{md,json,yaml,js,ts}": "prettier --write" } } diff --git a/node_modules/ajv-keywords/src/definitions/_range.ts b/node_modules/ajv-keywords/src/definitions/_range.ts deleted file mode 100644 index 38cb9a0..0000000 --- a/node_modules/ajv-keywords/src/definitions/_range.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type {MacroKeywordDefinition} from "ajv" -import type {GetDefinition} from "./_types" - -type RangeKwd = "range" | "exclusiveRange" - -export default function getRangeDef(keyword: RangeKwd): GetDefinition { - return () => ({ - keyword, - type: "number", - schemaType: "array", - macro: function ([min, max]: [number, number]) { - validateRangeSchema(min, max) - return keyword === "range" - ? {minimum: min, maximum: max} - : {exclusiveMinimum: min, exclusiveMaximum: max} - }, - metaSchema: { - type: "array", - minItems: 2, - maxItems: 2, - items: {type: "number"}, - }, - }) - - function validateRangeSchema(min: number, max: number): void { - if (min > max || (keyword === "exclusiveRange" && min === max)) { - throw new Error("There are no numbers in range") - } - } -} diff --git a/node_modules/ajv-keywords/src/definitions/_required.ts b/node_modules/ajv-keywords/src/definitions/_required.ts deleted file mode 100644 index ddf9395..0000000 --- a/node_modules/ajv-keywords/src/definitions/_required.ts +++ /dev/null @@ -1,24 +0,0 @@ -import type {MacroKeywordDefinition} from "ajv" -import type {GetDefinition} from "./_types" - -type RequiredKwd = "anyRequired" | "oneRequired" - -export default function getRequiredDef( - keyword: RequiredKwd -): GetDefinition { - return () => ({ - keyword, - type: "object", - schemaType: "array", - macro(schema: string[]) { - if (schema.length === 0) return true - if (schema.length === 1) return {required: schema} - const comb = keyword === "anyRequired" ? "anyOf" : "oneOf" - return {[comb]: schema.map((p) => ({required: [p]}))} - }, - metaSchema: { - type: "array", - items: {type: "string"}, - }, - }) -} diff --git a/node_modules/ajv-keywords/src/definitions/_types.ts b/node_modules/ajv-keywords/src/definitions/_types.ts deleted file mode 100644 index c3f5424..0000000 --- a/node_modules/ajv-keywords/src/definitions/_types.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {KeywordDefinition} from "ajv" - -export interface DefinitionOptions { - defaultMeta?: string | boolean -} - -export type GetDefinition = (opts?: DefinitionOptions) => T diff --git a/node_modules/ajv-keywords/src/definitions/_util.ts b/node_modules/ajv-keywords/src/definitions/_util.ts deleted file mode 100644 index 68bcc01..0000000 --- a/node_modules/ajv-keywords/src/definitions/_util.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type {DefinitionOptions} from "./_types" -import type {SchemaObject, KeywordCxt, Name} from "ajv" -import {_} from "ajv/dist/compile/codegen" - -const META_SCHEMA_ID = "http://json-schema.org/schema" - -export function metaSchemaRef({defaultMeta}: DefinitionOptions = {}): SchemaObject { - return defaultMeta === false ? {} : {$ref: defaultMeta || META_SCHEMA_ID} -} - -export function usePattern( - {gen, it: {opts}}: KeywordCxt, - pattern: string, - flags = opts.unicodeRegExp ? "u" : "" -): Name { - const rx = new RegExp(pattern, flags) - return gen.scopeValue("pattern", { - key: rx.toString(), - ref: rx, - code: _`new RegExp(${pattern}, ${flags})`, - }) -} diff --git a/node_modules/ajv-keywords/src/definitions/allRequired.ts b/node_modules/ajv-keywords/src/definitions/allRequired.ts deleted file mode 100644 index 821558f..0000000 --- a/node_modules/ajv-keywords/src/definitions/allRequired.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type {MacroKeywordDefinition} from "ajv" - -export default function getDef(): MacroKeywordDefinition { - return { - keyword: "allRequired", - type: "object", - schemaType: "boolean", - macro(schema: boolean, parentSchema) { - if (!schema) return true - const required = Object.keys(parentSchema.properties) - if (required.length === 0) return true - return {required} - }, - dependencies: ["properties"], - } -} - -module.exports = getDef diff --git a/node_modules/ajv-keywords/src/definitions/anyRequired.ts b/node_modules/ajv-keywords/src/definitions/anyRequired.ts deleted file mode 100644 index 7f71536..0000000 --- a/node_modules/ajv-keywords/src/definitions/anyRequired.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type {MacroKeywordDefinition} from "ajv" -import type {GetDefinition} from "./_types" -import getRequiredDef from "./_required" - -const getDef: GetDefinition = getRequiredDef("anyRequired") - -export default getDef -module.exports = getDef diff --git a/node_modules/ajv-keywords/src/definitions/deepProperties.ts b/node_modules/ajv-keywords/src/definitions/deepProperties.ts deleted file mode 100644 index be29410..0000000 --- a/node_modules/ajv-keywords/src/definitions/deepProperties.ts +++ /dev/null @@ -1,52 +0,0 @@ -import type {MacroKeywordDefinition, SchemaObject, Schema} from "ajv" -import type {DefinitionOptions} from "./_types" -import {metaSchemaRef} from "./_util" - -export default function getDef(opts?: DefinitionOptions): MacroKeywordDefinition { - return { - keyword: "deepProperties", - type: "object", - schemaType: "object", - macro: function (schema: Record) { - const allOf = [] - for (const pointer in schema) allOf.push(getSchema(pointer, schema[pointer])) - return {allOf} - }, - metaSchema: { - type: "object", - propertyNames: {type: "string", format: "json-pointer"}, - additionalProperties: metaSchemaRef(opts), - }, - } -} - -function getSchema(jsonPointer: string, schema: SchemaObject): SchemaObject { - const segments = jsonPointer.split("/") - const rootSchema: SchemaObject = {} - let pointerSchema: SchemaObject = rootSchema - for (let i = 1; i < segments.length; i++) { - let segment: string = segments[i] - const isLast = i === segments.length - 1 - segment = unescapeJsonPointer(segment) - const properties: Record = (pointerSchema.properties = {}) - let items: SchemaObject[] | undefined - if (/[0-9]+/.test(segment)) { - let count = +segment - items = pointerSchema.items = [] - pointerSchema.type = ["object", "array"] - while (count--) items.push({}) - } else { - pointerSchema.type = "object" - } - pointerSchema = isLast ? schema : {} - properties[segment] = pointerSchema - if (items) items.push(pointerSchema) - } - return rootSchema -} - -function unescapeJsonPointer(str: string): string { - return str.replace(/~1/g, "/").replace(/~0/g, "~") -} - -module.exports = getDef diff --git a/node_modules/ajv-keywords/src/definitions/deepRequired.ts b/node_modules/ajv-keywords/src/definitions/deepRequired.ts deleted file mode 100644 index c01b702..0000000 --- a/node_modules/ajv-keywords/src/definitions/deepRequired.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type {CodeKeywordDefinition, KeywordCxt} from "ajv" -import {_, or, and, getProperty, Code} from "ajv/dist/compile/codegen" - -export default function getDef(): CodeKeywordDefinition { - return { - keyword: "deepRequired", - type: "object", - schemaType: "array", - code(ctx: KeywordCxt) { - const {schema, data} = ctx - const props = (schema as string[]).map((jp: string) => _`(${getData(jp)}) === undefined`) - ctx.fail(or(...props)) - - function getData(jsonPointer: string): Code { - if (jsonPointer === "") throw new Error("empty JSON pointer not allowed") - const segments = jsonPointer.split("/") - let x: Code = data - const xs = segments.map((s, i) => - i ? (x = _`${x}${getProperty(unescapeJPSegment(s))}`) : x - ) - return and(...xs) - } - }, - metaSchema: { - type: "array", - items: {type: "string", format: "json-pointer"}, - }, - } -} - -function unescapeJPSegment(s: string): string { - return s.replace(/~1/g, "/").replace(/~0/g, "~") -} - -module.exports = getDef diff --git a/node_modules/ajv-keywords/src/definitions/dynamicDefaults.ts b/node_modules/ajv-keywords/src/definitions/dynamicDefaults.ts deleted file mode 100644 index 84cd0c3..0000000 --- a/node_modules/ajv-keywords/src/definitions/dynamicDefaults.ts +++ /dev/null @@ -1,98 +0,0 @@ -import type {FuncKeywordDefinition, SchemaCxt} from "ajv" - -const sequences: Record = {} - -export type DynamicDefaultFunc = (args?: Record) => () => any - -const DEFAULTS: Record = { - timestamp: () => () => Date.now(), - datetime: () => () => new Date().toISOString(), - date: () => () => new Date().toISOString().slice(0, 10), - time: () => () => new Date().toISOString().slice(11), - random: () => () => Math.random(), - randomint: (args?: {max?: number}) => { - const max = args?.max ?? 2 - return () => Math.floor(Math.random() * max) - }, - seq: (args?: {name?: string}) => { - const name = args?.name ?? "" - sequences[name] ||= 0 - return () => (sequences[name] as number)++ - }, -} - -interface PropertyDefaultSchema { - func: string - args: Record -} - -type DefaultSchema = Record - -const getDef: (() => FuncKeywordDefinition) & { - DEFAULTS: typeof DEFAULTS -} = Object.assign(_getDef, {DEFAULTS}) - -function _getDef(): FuncKeywordDefinition { - return { - keyword: "dynamicDefaults", - type: "object", - schemaType: ["string", "object"], - modifying: true, - valid: true, - compile(schema: DefaultSchema, _parentSchema, it: SchemaCxt) { - if (!it.opts.useDefaults || it.compositeRule) return () => true - const fs: Record any> = {} - for (const key in schema) fs[key] = getDefault(schema[key]) - const empty = it.opts.useDefaults === "empty" - - return (data: Record) => { - for (const prop in schema) { - if (data[prop] === undefined || (empty && (data[prop] === null || data[prop] === ""))) { - data[prop] = fs[prop]() - } - } - return true - } - }, - metaSchema: { - type: "object", - additionalProperties: { - anyOf: [ - {type: "string"}, - { - type: "object", - additionalProperties: false, - required: ["func", "args"], - properties: { - func: {type: "string"}, - args: {type: "object"}, - }, - }, - ], - }, - }, - } -} - -function getDefault(d: string | PropertyDefaultSchema | undefined): () => any { - return typeof d == "object" ? getObjDefault(d) : getStrDefault(d) -} - -function getObjDefault({func, args}: PropertyDefaultSchema): () => any { - const def = DEFAULTS[func] - assertDefined(func, def) - return def(args) -} - -function getStrDefault(d = ""): () => any { - const def = DEFAULTS[d] - assertDefined(d, def) - return def() -} - -function assertDefined(name: string, def?: DynamicDefaultFunc): asserts def is DynamicDefaultFunc { - if (!def) throw new Error(`invalid "dynamicDefaults" keyword property value: ${name}`) -} - -export default getDef -module.exports = getDef diff --git a/node_modules/ajv-keywords/src/definitions/exclusiveRange.ts b/node_modules/ajv-keywords/src/definitions/exclusiveRange.ts deleted file mode 100644 index 7a4f736..0000000 --- a/node_modules/ajv-keywords/src/definitions/exclusiveRange.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type {MacroKeywordDefinition} from "ajv" -import type {GetDefinition} from "./_types" -import getRangeDef from "./_range" - -const getDef: GetDefinition = getRangeDef("exclusiveRange") - -export default getDef -module.exports = getDef diff --git a/node_modules/ajv-keywords/src/definitions/index.ts b/node_modules/ajv-keywords/src/definitions/index.ts deleted file mode 100644 index eb0a4af..0000000 --- a/node_modules/ajv-keywords/src/definitions/index.ts +++ /dev/null @@ -1,61 +0,0 @@ -import type {Vocabulary, KeywordDefinition, ErrorNoParams} from "ajv" -import type {DefinitionOptions, GetDefinition} from "./_types" -import typeofDef from "./typeof" -import instanceofDef from "./instanceof" -import range from "./range" -import exclusiveRange from "./exclusiveRange" -import regexp from "./regexp" -import transform from "./transform" -import uniqueItemProperties from "./uniqueItemProperties" -import allRequired from "./allRequired" -import anyRequired from "./anyRequired" -import oneRequired from "./oneRequired" -import patternRequired, {PatternRequiredError} from "./patternRequired" -import prohibited from "./prohibited" -import deepProperties from "./deepProperties" -import deepRequired from "./deepRequired" -import dynamicDefaults from "./dynamicDefaults" -import selectDef, {SelectError} from "./select" - -const definitions: GetDefinition[] = [ - typeofDef, - instanceofDef, - range, - exclusiveRange, - regexp, - transform, - uniqueItemProperties, - allRequired, - anyRequired, - oneRequired, - patternRequired, - prohibited, - deepProperties, - deepRequired, - dynamicDefaults, -] - -export default function ajvKeywords(opts?: DefinitionOptions): Vocabulary { - return definitions.map((d) => d(opts)).concat(selectDef(opts)) -} - -export type AjvKeywordsError = - | PatternRequiredError - | SelectError - | ErrorNoParams< - | "range" - | "exclusiveRange" - | "anyRequired" - | "oneRequired" - | "allRequired" - | "deepProperties" - | "deepRequired" - | "dynamicDefaults" - | "instanceof" - | "prohibited" - | "regexp" - | "transform" - | "uniqueItemProperties" - > - -module.exports = ajvKeywords diff --git a/node_modules/ajv-keywords/src/definitions/instanceof.ts b/node_modules/ajv-keywords/src/definitions/instanceof.ts deleted file mode 100644 index 2f1c54f..0000000 --- a/node_modules/ajv-keywords/src/definitions/instanceof.ts +++ /dev/null @@ -1,61 +0,0 @@ -import type {FuncKeywordDefinition} from "ajv" - -type Constructor = new (...args: any[]) => any - -const CONSTRUCTORS: Record = { - Object, - Array, - Function, - Number, - String, - Date, - RegExp, -} - -/* istanbul ignore else */ -if (typeof Buffer != "undefined") CONSTRUCTORS.Buffer = Buffer - -/* istanbul ignore else */ -if (typeof Promise != "undefined") CONSTRUCTORS.Promise = Promise - -const getDef: (() => FuncKeywordDefinition) & { - CONSTRUCTORS: typeof CONSTRUCTORS -} = Object.assign(_getDef, {CONSTRUCTORS}) - -function _getDef(): FuncKeywordDefinition { - return { - keyword: "instanceof", - schemaType: ["string", "array"], - compile(schema: string | string[]) { - if (typeof schema == "string") { - const C = getConstructor(schema) - return (data) => data instanceof C - } - - if (Array.isArray(schema)) { - const constructors = schema.map(getConstructor) - return (data) => { - for (const C of constructors) { - if (data instanceof C) return true - } - return false - } - } - - /* istanbul ignore next */ - throw new Error("ajv implementation error") - }, - metaSchema: { - anyOf: [{type: "string"}, {type: "array", items: {type: "string"}}], - }, - } -} - -function getConstructor(c: string): Constructor { - const C = CONSTRUCTORS[c] - if (C) return C - throw new Error(`invalid "instanceof" keyword value ${c}`) -} - -export default getDef -module.exports = getDef diff --git a/node_modules/ajv-keywords/src/definitions/oneRequired.ts b/node_modules/ajv-keywords/src/definitions/oneRequired.ts deleted file mode 100644 index 79c44c9..0000000 --- a/node_modules/ajv-keywords/src/definitions/oneRequired.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type {MacroKeywordDefinition} from "ajv" -import type {GetDefinition} from "./_types" -import getRequiredDef from "./_required" - -const getDef: GetDefinition = getRequiredDef("oneRequired") - -export default getDef -module.exports = getDef diff --git a/node_modules/ajv-keywords/src/definitions/patternRequired.ts b/node_modules/ajv-keywords/src/definitions/patternRequired.ts deleted file mode 100644 index 63235c5..0000000 --- a/node_modules/ajv-keywords/src/definitions/patternRequired.ts +++ /dev/null @@ -1,46 +0,0 @@ -import type {CodeKeywordDefinition, KeywordCxt, KeywordErrorDefinition, ErrorObject} from "ajv" -import {_, str, and} from "ajv/dist/compile/codegen" -import {usePattern} from "./_util" - -export type PatternRequiredError = ErrorObject<"patternRequired", {missingPattern: string}> - -const error: KeywordErrorDefinition = { - message: ({params: {missingPattern}}) => - str`should have property matching pattern '${missingPattern}'`, - params: ({params: {missingPattern}}) => _`{missingPattern: ${missingPattern}}`, -} - -export default function getDef(): CodeKeywordDefinition { - return { - keyword: "patternRequired", - type: "object", - schemaType: "array", - error, - code(cxt: KeywordCxt) { - const {gen, schema, data} = cxt - if (schema.length === 0) return - const valid = gen.let("valid", true) - for (const pat of schema) validateProperties(pat) - - function validateProperties(pattern: string): void { - const matched = gen.let("matched", false) - - gen.forIn("key", data, (key) => { - gen.assign(matched, _`${usePattern(cxt, pattern)}.test(${key})`) - gen.if(matched, () => gen.break()) - }) - - cxt.setParams({missingPattern: pattern}) - gen.assign(valid, and(valid, matched)) - cxt.pass(valid) - } - }, - metaSchema: { - type: "array", - items: {type: "string", format: "regex"}, - uniqueItems: true, - }, - } -} - -module.exports = getDef diff --git a/node_modules/ajv-keywords/src/definitions/prohibited.ts b/node_modules/ajv-keywords/src/definitions/prohibited.ts deleted file mode 100644 index 659fdda..0000000 --- a/node_modules/ajv-keywords/src/definitions/prohibited.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type {MacroKeywordDefinition} from "ajv" - -export default function getDef(): MacroKeywordDefinition { - return { - keyword: "prohibited", - type: "object", - schemaType: "array", - macro: function (schema: string[]) { - if (schema.length === 0) return true - if (schema.length === 1) return {not: {required: schema}} - return {not: {anyOf: schema.map((p) => ({required: [p]}))}} - }, - metaSchema: { - type: "array", - items: {type: "string"}, - }, - } -} - -module.exports = getDef diff --git a/node_modules/ajv-keywords/src/definitions/range.ts b/node_modules/ajv-keywords/src/definitions/range.ts deleted file mode 100644 index c867b7d..0000000 --- a/node_modules/ajv-keywords/src/definitions/range.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type {MacroKeywordDefinition} from "ajv" -import type {GetDefinition} from "./_types" -import getRangeDef from "./_range" - -const getDef: GetDefinition = getRangeDef("range") - -export default getDef -module.exports = getDef diff --git a/node_modules/ajv-keywords/src/definitions/regexp.ts b/node_modules/ajv-keywords/src/definitions/regexp.ts deleted file mode 100644 index 68ddef8..0000000 --- a/node_modules/ajv-keywords/src/definitions/regexp.ts +++ /dev/null @@ -1,45 +0,0 @@ -import type {CodeKeywordDefinition, KeywordCxt, JSONSchemaType, Name} from "ajv" -import {_} from "ajv/dist/compile/codegen" -import {usePattern} from "./_util" - -interface RegexpSchema { - pattern: string - flags?: string -} - -const regexpMetaSchema: JSONSchemaType = { - type: "object", - properties: { - pattern: {type: "string"}, - flags: {type: "string", nullable: true}, - }, - required: ["pattern"], - additionalProperties: false, -} - -const metaRegexp = /^\/(.*)\/([gimuy]*)$/ - -export default function getDef(): CodeKeywordDefinition { - return { - keyword: "regexp", - type: "string", - schemaType: ["string", "object"], - code(cxt: KeywordCxt) { - const {data, schema} = cxt - const regx = getRegExp(schema) - cxt.pass(_`${regx}.test(${data})`) - - function getRegExp(sch: string | RegexpSchema): Name { - if (typeof sch == "object") return usePattern(cxt, sch.pattern, sch.flags) - const rx = metaRegexp.exec(sch) - if (rx) return usePattern(cxt, rx[1], rx[2]) - throw new Error("cannot parse string into RegExp") - } - }, - metaSchema: { - anyOf: [{type: "string"}, regexpMetaSchema], - }, - } -} - -module.exports = getDef diff --git a/node_modules/ajv-keywords/src/definitions/select.ts b/node_modules/ajv-keywords/src/definitions/select.ts deleted file mode 100644 index f5cc19f..0000000 --- a/node_modules/ajv-keywords/src/definitions/select.ts +++ /dev/null @@ -1,69 +0,0 @@ -import type {KeywordDefinition, KeywordErrorDefinition, KeywordCxt, ErrorObject} from "ajv" -import {_, str, nil, Name} from "ajv/dist/compile/codegen" -import type {DefinitionOptions} from "./_types" -import {metaSchemaRef} from "./_util" - -export type SelectError = ErrorObject<"select", {failingCase?: string; failingDefault?: true}> - -const error: KeywordErrorDefinition = { - message: ({params: {schemaProp}}) => - schemaProp - ? str`should match case "${schemaProp}" schema` - : str`should match default case schema`, - params: ({params: {schemaProp}}) => - schemaProp ? _`{failingCase: ${schemaProp}}` : _`{failingDefault: true}`, -} - -export default function getDef(opts?: DefinitionOptions): KeywordDefinition[] { - const metaSchema = metaSchemaRef(opts) - - return [ - { - keyword: "select", - schemaType: ["string", "number", "boolean", "null"], - $data: true, - error, - dependencies: ["selectCases"], - code(cxt: KeywordCxt) { - const {gen, schemaCode, parentSchema} = cxt - cxt.block$data(nil, () => { - const valid = gen.let("valid", true) - const schValid = gen.name("_valid") - const value = gen.const("value", _`${schemaCode} === null ? "null" : ${schemaCode}`) - gen.if(false) // optimizer should remove it from generated code - for (const schemaProp in parentSchema.selectCases) { - cxt.setParams({schemaProp}) - gen.elseIf(_`"" + ${value} == ${schemaProp}`) // intentional ==, to match numbers and booleans - const schCxt = cxt.subschema({keyword: "selectCases", schemaProp}, schValid) - cxt.mergeEvaluated(schCxt, Name) - gen.assign(valid, schValid) - } - gen.else() - if (parentSchema.selectDefault !== undefined) { - cxt.setParams({schemaProp: undefined}) - const schCxt = cxt.subschema({keyword: "selectDefault"}, schValid) - cxt.mergeEvaluated(schCxt, Name) - gen.assign(valid, schValid) - } - gen.endIf() - cxt.pass(valid) - }) - }, - }, - { - keyword: "selectCases", - dependencies: ["select"], - metaSchema: { - type: "object", - additionalProperties: metaSchema, - }, - }, - { - keyword: "selectDefault", - dependencies: ["select", "selectCases"], - metaSchema, - }, - ] -} - -module.exports = getDef diff --git a/node_modules/ajv-keywords/src/definitions/transform.ts b/node_modules/ajv-keywords/src/definitions/transform.ts deleted file mode 100644 index af4ae29..0000000 --- a/node_modules/ajv-keywords/src/definitions/transform.ts +++ /dev/null @@ -1,98 +0,0 @@ -import type {CodeKeywordDefinition, AnySchemaObject, KeywordCxt, Code, Name} from "ajv" -import {_, stringify, getProperty} from "ajv/dist/compile/codegen" - -type TransformName = - | "trimStart" - | "trimEnd" - | "trimLeft" - | "trimRight" - | "trim" - | "toLowerCase" - | "toUpperCase" - | "toEnumCase" - -interface TransformConfig { - hash: Record -} - -type Transform = (s: string, cfg?: TransformConfig) => string - -const transform: {[key in TransformName]: Transform} = { - trimStart: (s) => s.trimStart(), - trimEnd: (s) => s.trimEnd(), - trimLeft: (s) => s.trimStart(), - trimRight: (s) => s.trimEnd(), - trim: (s) => s.trim(), - toLowerCase: (s) => s.toLowerCase(), - toUpperCase: (s) => s.toUpperCase(), - toEnumCase: (s, cfg) => cfg?.hash[configKey(s)] || s, -} - -const getDef: (() => CodeKeywordDefinition) & { - transform: typeof transform -} = Object.assign(_getDef, {transform}) - -function _getDef(): CodeKeywordDefinition { - return { - keyword: "transform", - schemaType: "array", - before: "enum", - code(cxt: KeywordCxt) { - const {gen, data, schema, parentSchema, it} = cxt - const {parentData, parentDataProperty} = it - const tNames: string[] = schema - if (!tNames.length) return - let cfg: Name | undefined - if (tNames.includes("toEnumCase")) { - const config = getEnumCaseCfg(parentSchema) - cfg = gen.scopeValue("obj", {ref: config, code: stringify(config)}) - } - gen.if(_`typeof ${data} == "string" && ${parentData} !== undefined`, () => { - gen.assign(data, transformExpr(tNames.slice())) - gen.assign(_`${parentData}[${parentDataProperty}]`, data) - }) - - function transformExpr(ts: string[]): Code { - if (!ts.length) return data - const t = ts.pop() as string - if (!(t in transform)) throw new Error(`transform: unknown transformation ${t}`) - const func = gen.scopeValue("func", { - ref: transform[t as TransformName], - code: _`require("ajv-keywords/dist/definitions/transform").transform${getProperty(t)}`, - }) - const arg = transformExpr(ts) - return cfg && t === "toEnumCase" ? _`${func}(${arg}, ${cfg})` : _`${func}(${arg})` - } - }, - metaSchema: { - type: "array", - items: {type: "string", enum: Object.keys(transform)}, - }, - } -} - -function getEnumCaseCfg(parentSchema: AnySchemaObject): TransformConfig { - // build hash table to enum values - const cfg: TransformConfig = {hash: {}} - - // requires `enum` in the same schema as transform - if (!parentSchema.enum) throw new Error('transform: "toEnumCase" requires "enum"') - for (const v of parentSchema.enum) { - if (typeof v !== "string") continue - const k = configKey(v) - // requires all `enum` values have unique keys - if (cfg.hash[k]) { - throw new Error('transform: "toEnumCase" requires all lowercased "enum" values to be unique') - } - cfg.hash[k] = v - } - - return cfg -} - -function configKey(s: string): string { - return s.toLowerCase() -} - -export default getDef -module.exports = getDef diff --git a/node_modules/ajv-keywords/src/definitions/typeof.ts b/node_modules/ajv-keywords/src/definitions/typeof.ts deleted file mode 100644 index a8b39fb..0000000 --- a/node_modules/ajv-keywords/src/definitions/typeof.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type {CodeKeywordDefinition, KeywordCxt} from "ajv" -import {_} from "ajv/dist/compile/codegen" - -const TYPES = ["undefined", "string", "number", "object", "function", "boolean", "symbol"] - -export default function getDef(): CodeKeywordDefinition { - return { - keyword: "typeof", - schemaType: ["string", "array"], - code(cxt: KeywordCxt) { - const {data, schema, schemaValue} = cxt - cxt.fail( - typeof schema == "string" - ? _`typeof ${data} != ${schema}` - : _`${schemaValue}.indexOf(typeof ${data}) < 0` - ) - }, - metaSchema: { - anyOf: [ - {type: "string", enum: TYPES}, - {type: "array", items: {type: "string", enum: TYPES}}, - ], - }, - } -} - -module.exports = getDef diff --git a/node_modules/ajv-keywords/src/definitions/uniqueItemProperties.ts b/node_modules/ajv-keywords/src/definitions/uniqueItemProperties.ts deleted file mode 100644 index 8b2c6f9..0000000 --- a/node_modules/ajv-keywords/src/definitions/uniqueItemProperties.ts +++ /dev/null @@ -1,58 +0,0 @@ -import type {FuncKeywordDefinition, AnySchemaObject} from "ajv" -import equal = require("fast-deep-equal") - -const SCALAR_TYPES = ["number", "integer", "string", "boolean", "null"] - -export default function getDef(): FuncKeywordDefinition { - return { - keyword: "uniqueItemProperties", - type: "array", - schemaType: "array", - compile(keys: string[], parentSchema: AnySchemaObject) { - const scalar = getScalarKeys(keys, parentSchema) - - return (data) => { - if (data.length <= 1) return true - for (let k = 0; k < keys.length; k++) { - const key = keys[k] - if (scalar[k]) { - const hash: Record = {} - for (const x of data) { - if (!x || typeof x != "object") continue - let p = x[key] - if (p && typeof p == "object") continue - if (typeof p == "string") p = '"' + p - if (hash[p]) return false - hash[p] = true - } - } else { - for (let i = data.length; i--; ) { - const x = data[i] - if (!x || typeof x != "object") continue - for (let j = i; j--; ) { - const y = data[j] - if (y && typeof y == "object" && equal(x[key], y[key])) return false - } - } - } - } - return true - } - }, - metaSchema: { - type: "array", - items: {type: "string"}, - }, - } -} - -function getScalarKeys(keys: string[], schema: AnySchemaObject): boolean[] { - return keys.map((key) => { - const t = schema.items?.properties?.[key]?.type - return Array.isArray(t) - ? !t.includes("object") && !t.includes("array") - : SCALAR_TYPES.includes(t) - }) -} - -module.exports = getDef diff --git a/node_modules/ajv-keywords/src/index.ts b/node_modules/ajv-keywords/src/index.ts deleted file mode 100644 index bb580fb..0000000 --- a/node_modules/ajv-keywords/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type Ajv from "ajv" -import type {Plugin} from "ajv" -import plugins from "./keywords" - -export {AjvKeywordsError} from "./definitions" - -const ajvKeywords: Plugin = (ajv: Ajv, keyword?: string | string[]): Ajv => { - if (Array.isArray(keyword)) { - for (const k of keyword) get(k)(ajv) - return ajv - } - if (keyword) { - get(keyword)(ajv) - return ajv - } - for (keyword in plugins) get(keyword)(ajv) - return ajv -} - -ajvKeywords.get = get - -function get(keyword: string): Plugin { - const defFunc = plugins[keyword] - if (!defFunc) throw new Error("Unknown keyword " + keyword) - return defFunc -} - -export default ajvKeywords -module.exports = ajvKeywords - -// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -module.exports.default = ajvKeywords diff --git a/node_modules/ajv-keywords/src/keywords/allRequired.ts b/node_modules/ajv-keywords/src/keywords/allRequired.ts deleted file mode 100644 index 30cce43..0000000 --- a/node_modules/ajv-keywords/src/keywords/allRequired.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {Plugin} from "ajv" -import getDef from "../definitions/allRequired" - -const allRequired: Plugin = (ajv) => ajv.addKeyword(getDef()) - -export default allRequired -module.exports = allRequired diff --git a/node_modules/ajv-keywords/src/keywords/anyRequired.ts b/node_modules/ajv-keywords/src/keywords/anyRequired.ts deleted file mode 100644 index b55b817..0000000 --- a/node_modules/ajv-keywords/src/keywords/anyRequired.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {Plugin} from "ajv" -import getDef from "../definitions/anyRequired" - -const anyRequired: Plugin = (ajv) => ajv.addKeyword(getDef()) - -export default anyRequired -module.exports = anyRequired diff --git a/node_modules/ajv-keywords/src/keywords/deepProperties.ts b/node_modules/ajv-keywords/src/keywords/deepProperties.ts deleted file mode 100644 index e035531..0000000 --- a/node_modules/ajv-keywords/src/keywords/deepProperties.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type {Plugin} from "ajv" -import getDef from "../definitions/deepProperties" -import type {DefinitionOptions} from "../definitions/_types" - -const deepProperties: Plugin = (ajv, opts?: DefinitionOptions) => - ajv.addKeyword(getDef(opts)) - -export default deepProperties -module.exports = deepProperties diff --git a/node_modules/ajv-keywords/src/keywords/deepRequired.ts b/node_modules/ajv-keywords/src/keywords/deepRequired.ts deleted file mode 100644 index 44b19ae..0000000 --- a/node_modules/ajv-keywords/src/keywords/deepRequired.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {Plugin} from "ajv" -import getDef from "../definitions/deepRequired" - -const deepRequired: Plugin = (ajv) => ajv.addKeyword(getDef()) - -export default deepRequired -module.exports = deepRequired diff --git a/node_modules/ajv-keywords/src/keywords/dynamicDefaults.ts b/node_modules/ajv-keywords/src/keywords/dynamicDefaults.ts deleted file mode 100644 index f8f8205..0000000 --- a/node_modules/ajv-keywords/src/keywords/dynamicDefaults.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {Plugin} from "ajv" -import getDef from "../definitions/dynamicDefaults" - -const dynamicDefaults: Plugin = (ajv) => ajv.addKeyword(getDef()) - -export default dynamicDefaults -module.exports = dynamicDefaults diff --git a/node_modules/ajv-keywords/src/keywords/exclusiveRange.ts b/node_modules/ajv-keywords/src/keywords/exclusiveRange.ts deleted file mode 100644 index 407a374..0000000 --- a/node_modules/ajv-keywords/src/keywords/exclusiveRange.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {Plugin} from "ajv" -import getDef from "../definitions/exclusiveRange" - -const exclusiveRange: Plugin = (ajv) => ajv.addKeyword(getDef()) - -export default exclusiveRange -module.exports = exclusiveRange diff --git a/node_modules/ajv-keywords/src/keywords/index.ts b/node_modules/ajv-keywords/src/keywords/index.ts deleted file mode 100644 index edf9996..0000000 --- a/node_modules/ajv-keywords/src/keywords/index.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type {Plugin} from "ajv" -import typeofPlugin from "./typeof" -import instanceofPlugin from "./instanceof" -import range from "./range" -import exclusiveRange from "./exclusiveRange" -import regexp from "./regexp" -import transform from "./transform" -import uniqueItemProperties from "./uniqueItemProperties" -import allRequired from "./allRequired" -import anyRequired from "./anyRequired" -import oneRequired from "./oneRequired" -import patternRequired from "./patternRequired" -import prohibited from "./prohibited" -import deepProperties from "./deepProperties" -import deepRequired from "./deepRequired" -import dynamicDefaults from "./dynamicDefaults" -import select from "./select" - -// TODO type -const ajvKeywords: Record | undefined> = { - typeof: typeofPlugin, - instanceof: instanceofPlugin, - range, - exclusiveRange, - regexp, - transform, - uniqueItemProperties, - allRequired, - anyRequired, - oneRequired, - patternRequired, - prohibited, - deepProperties, - deepRequired, - dynamicDefaults, - select, -} - -export default ajvKeywords -module.exports = ajvKeywords diff --git a/node_modules/ajv-keywords/src/keywords/instanceof.ts b/node_modules/ajv-keywords/src/keywords/instanceof.ts deleted file mode 100644 index 98a2463..0000000 --- a/node_modules/ajv-keywords/src/keywords/instanceof.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {Plugin} from "ajv" -import getDef from "../definitions/instanceof" - -const instanceofPlugin: Plugin = (ajv) => ajv.addKeyword(getDef()) - -export default instanceofPlugin -module.exports = instanceofPlugin diff --git a/node_modules/ajv-keywords/src/keywords/oneRequired.ts b/node_modules/ajv-keywords/src/keywords/oneRequired.ts deleted file mode 100644 index 452bb24..0000000 --- a/node_modules/ajv-keywords/src/keywords/oneRequired.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {Plugin} from "ajv" -import getDef from "../definitions/oneRequired" - -const oneRequired: Plugin = (ajv) => ajv.addKeyword(getDef()) - -export default oneRequired -module.exports = oneRequired diff --git a/node_modules/ajv-keywords/src/keywords/patternRequired.ts b/node_modules/ajv-keywords/src/keywords/patternRequired.ts deleted file mode 100644 index f9e4e50..0000000 --- a/node_modules/ajv-keywords/src/keywords/patternRequired.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {Plugin} from "ajv" -import getDef from "../definitions/patternRequired" - -const patternRequired: Plugin = (ajv) => ajv.addKeyword(getDef()) - -export default patternRequired -module.exports = patternRequired diff --git a/node_modules/ajv-keywords/src/keywords/prohibited.ts b/node_modules/ajv-keywords/src/keywords/prohibited.ts deleted file mode 100644 index c4f0576..0000000 --- a/node_modules/ajv-keywords/src/keywords/prohibited.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {Plugin} from "ajv" -import getDef from "../definitions/prohibited" - -const prohibited: Plugin = (ajv) => ajv.addKeyword(getDef()) - -export default prohibited -module.exports = prohibited diff --git a/node_modules/ajv-keywords/src/keywords/range.ts b/node_modules/ajv-keywords/src/keywords/range.ts deleted file mode 100644 index 1fd28ce..0000000 --- a/node_modules/ajv-keywords/src/keywords/range.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {Plugin} from "ajv" -import getDef from "../definitions/range" - -const range: Plugin = (ajv) => ajv.addKeyword(getDef()) - -export default range -module.exports = range diff --git a/node_modules/ajv-keywords/src/keywords/regexp.ts b/node_modules/ajv-keywords/src/keywords/regexp.ts deleted file mode 100644 index 48c461c..0000000 --- a/node_modules/ajv-keywords/src/keywords/regexp.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {Plugin} from "ajv" -import getDef from "../definitions/regexp" - -const regexp: Plugin = (ajv) => ajv.addKeyword(getDef()) - -export default regexp -module.exports = regexp diff --git a/node_modules/ajv-keywords/src/keywords/select.ts b/node_modules/ajv-keywords/src/keywords/select.ts deleted file mode 100644 index dc3bd81..0000000 --- a/node_modules/ajv-keywords/src/keywords/select.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type {Plugin} from "ajv" -import getDefs from "../definitions/select" -import type {DefinitionOptions} from "../definitions/_types" - -const select: Plugin = (ajv, opts?: DefinitionOptions) => { - getDefs(opts).forEach((d) => ajv.addKeyword(d)) - return ajv -} - -export default select -module.exports = select diff --git a/node_modules/ajv-keywords/src/keywords/transform.ts b/node_modules/ajv-keywords/src/keywords/transform.ts deleted file mode 100644 index d6335ec..0000000 --- a/node_modules/ajv-keywords/src/keywords/transform.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {Plugin} from "ajv" -import getDef from "../definitions/transform" - -const transform: Plugin = (ajv) => ajv.addKeyword(getDef()) - -export default transform -module.exports = transform diff --git a/node_modules/ajv-keywords/src/keywords/typeof.ts b/node_modules/ajv-keywords/src/keywords/typeof.ts deleted file mode 100644 index a171c50..0000000 --- a/node_modules/ajv-keywords/src/keywords/typeof.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {Plugin} from "ajv" -import getDef from "../definitions/typeof" - -const typeofPlugin: Plugin = (ajv) => ajv.addKeyword(getDef()) - -export default typeofPlugin -module.exports = typeofPlugin diff --git a/node_modules/ajv-keywords/src/keywords/uniqueItemProperties.ts b/node_modules/ajv-keywords/src/keywords/uniqueItemProperties.ts deleted file mode 100644 index 1dc5fe3..0000000 --- a/node_modules/ajv-keywords/src/keywords/uniqueItemProperties.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {Plugin} from "ajv" -import getDef from "../definitions/uniqueItemProperties" - -const uniqueItemProperties: Plugin = (ajv) => ajv.addKeyword(getDef()) - -export default uniqueItemProperties -module.exports = uniqueItemProperties diff --git a/node_modules/ajv/.runkit_example.js b/node_modules/ajv/.runkit_example.js deleted file mode 100644 index 0d578d5..0000000 --- a/node_modules/ajv/.runkit_example.js +++ /dev/null @@ -1,23 +0,0 @@ -const Ajv = require("ajv") -const ajv = new Ajv({allErrors: true}) - -const schema = { - type: "object", - properties: { - foo: {type: "string"}, - bar: {type: "number", maximum: 3}, - }, - required: ["foo", "bar"], - additionalProperties: false, -} - -const validate = ajv.compile(schema) - -test({foo: "abc", bar: 2}) -test({foo: 2, bar: 4}) - -function test(data) { - const valid = validate(data) - if (valid) console.log("Valid!") - else console.log("Invalid: " + ajv.errorsText(validate.errors)) -} diff --git a/node_modules/ajv/LICENSE b/node_modules/ajv/LICENSE index 139162a..96ee719 100644 --- a/node_modules/ajv/LICENSE +++ b/node_modules/ajv/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015-2021 Evgeny Poberezkin +Copyright (c) 2015-2017 Evgeny Poberezkin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/node_modules/ajv/README.md b/node_modules/ajv/README.md index d8ee276..5aa2078 100644 --- a/node_modules/ajv/README.md +++ b/node_modules/ajv/README.md @@ -1,63 +1,70 @@ -Ajv logo +Ajv logo -  +# Ajv: Another JSON Schema Validator -# Ajv JSON schema validator +The fastest JSON Schema validator for Node.js and browser. Supports draft-04/06/07. -The fastest JSON validator for Node.js and browser. - -Supports JSON Schema draft-04/06/07/2019-09/2020-12 ([draft-04 support](https://ajv.js.org/json-schema.html#draft-04) requires ajv-draft-04 package) and JSON Type Definition [RFC8927](https://datatracker.ietf.org/doc/rfc8927/). - -[![build](https://github.com/ajv-validator/ajv/actions/workflows/build.yml/badge.svg)](https://github.com/ajv-validator/ajv/actions?query=workflow%3Abuild) +[![Build Status](https://travis-ci.org/ajv-validator/ajv.svg?branch=master)](https://travis-ci.org/ajv-validator/ajv) [![npm](https://img.shields.io/npm/v/ajv.svg)](https://www.npmjs.com/package/ajv) +[![npm (beta)](https://img.shields.io/npm/v/ajv/beta)](https://www.npmjs.com/package/ajv/v/7.0.0-beta.0) [![npm downloads](https://img.shields.io/npm/dm/ajv.svg)](https://www.npmjs.com/package/ajv) [![Coverage Status](https://coveralls.io/repos/github/ajv-validator/ajv/badge.svg?branch=master)](https://coveralls.io/github/ajv-validator/ajv?branch=master) -[![SimpleX](https://img.shields.io/badge/chat-on%20SimpleX-70F0F9)](https://simplex.chat/contact#/?v=1-2&smp=smp%3A%2F%2Fu2dS9sG8nMNURyZwqASV4yROM28Er0luVTx5X1CsMrU%3D%40smp4.simplex.im%2F8KvvURM6J38Gdq9dCuPswMOkMny0xCOJ%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAr8rPVRuMOXv6kwF2yUAap-eoVg-9ssOFCi1fIrxTUw0%253D%26srv%3Do5vmywmrnaxalvz6wi3zicyftgio6psuvyniis6gco6bp6ekl4cqj4id.onion&data=%7B%22type%22%3A%22group%22%2C%22groupLinkId%22%3A%224pwLRgWHU9tlroMWHz0uOg%3D%3D%22%7D) [![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv) [![GitHub Sponsors](https://img.shields.io/badge/$-sponsors-brightgreen)](https://github.com/sponsors/epoberezkin) -## Ajv sponsors -[Mozilla](https://www.mozilla.org)[](https://opencollective.com/ajv) +## Ajv v7 beta is released -[Microsoft](https://opensource.microsoft.com)[](https://opencollective.com/ajv)[](https://opencollective.com/ajv) +[Ajv version 7.0.0-beta.0](https://github.com/ajv-validator/ajv/tree/v7-beta) is released with these changes: -[Retool](https://retool.com/?utm_source=sponsor&utm_campaign=ajv)[Tidelift](https://tidelift.com/subscription/pkg/npm-ajv?utm_source=npm-ajv&utm_medium=referral&utm_campaign=enterprise)[SimpleX](https://github.com/simplex-chat/simplex-chat)[](https://opencollective.com/ajv) +- to reduce the mistakes in JSON schemas and unexpected validation results, [strict mode](./docs/strict-mode.md) is added - it prohibits ignored or ambiguous JSON Schema elements. +- to make code injection from untrusted schemas impossible, [code generation](./docs/codegen.md) is fully re-written to be safe. +- to simplify Ajv extensions, the new keyword API that is used by pre-defined keywords is available to user-defined keywords - it is much easier to define any keywords now, especially with subschemas. +- schemas are compiled to ES6 code (ES5 code generation is supported with an option). +- to improve reliability and maintainability the code is migrated to TypeScript. -## Contributing +**Please note**: + +- the support for JSON-Schema draft-04 is removed - if you have schemas using "id" attributes you have to replace them with "\$id" (or continue using version 6 that will be supported until 02/28/2021). +- all formats are separated to ajv-formats package - they have to be explicitely added if you use them. + +See [release notes](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0-beta.0) for the details. + +To install the new version: + +```bash +npm install ajv@beta +``` -More than 100 people contributed to Ajv, and we would love to have you join the development. We welcome implementing new features that will benefit many users and ideas to improve our documentation. +See [Getting started with v7](https://github.com/ajv-validator/ajv/tree/v7-beta#usage) for code example. -Please review [Contributing guidelines](./CONTRIBUTING.md) and [Code components](https://ajv.js.org/components.html). -## Documentation +## Mozilla MOSS grant and OpenJS Foundation -All documentation is available on the [Ajv website](https://ajv.js.org). +[](https://www.mozilla.org/en-US/moss/)     [](https://openjsf.org/blog/2020/08/14/ajv-joins-openjs-foundation-as-an-incubation-project/) -Some useful site links: +Ajv has been awarded a grant from Mozilla’s [Open Source Support (MOSS) program](https://www.mozilla.org/en-US/moss/) in the “Foundational Technology” track! It will sponsor the development of Ajv support of [JSON Schema version 2019-09](https://tools.ietf.org/html/draft-handrews-json-schema-02) and of [JSON Type Definition](https://tools.ietf.org/html/draft-ucarion-json-type-definition-04). -- [Getting started](https://ajv.js.org/guide/getting-started.html) -- [JSON Schema vs JSON Type Definition](https://ajv.js.org/guide/schema-language.html) -- [API reference](https://ajv.js.org/api.html) -- [Strict mode](https://ajv.js.org/strict-mode.html) -- [Standalone validation code](https://ajv.js.org/standalone.html) -- [Security considerations](https://ajv.js.org/security.html) -- [Command line interface](https://ajv.js.org/packages/ajv-cli.html) -- [Frequently Asked Questions](https://ajv.js.org/faq.html) +Ajv also joined [OpenJS Foundation](https://openjsf.org/) – having this support will help ensure the longevity and stability of Ajv for all its users. -## Please [sponsor Ajv development](https://github.com/sponsors/epoberezkin) +This [blog post](https://www.poberezkin.com/posts/2020-08-14-ajv-json-validator-mozilla-open-source-grant-openjs-foundation.html) has more details. + +I am looking for the long term maintainers of Ajv – working with [ReadySet](https://www.thereadyset.co/), also sponsored by Mozilla, to establish clear guidelines for the role of a "maintainer" and the contribution standards, and to encourage a wider, more inclusive, contribution from the community. + + +## Please [sponsor Ajv development](https://github.com/sponsors/epoberezkin) Since I asked to support Ajv development 40 people and 6 organizations contributed via GitHub and OpenCollective - this support helped receiving the MOSS grant! Your continuing support is very important - the funds will be used to develop and maintain Ajv once the next major version is released. Please sponsor Ajv via: - - [GitHub sponsors page](https://github.com/sponsors/epoberezkin) (GitHub will match it) -- [Ajv Open Collective](https://opencollective.com/ajv) +- [Ajv Open Collective️](https://opencollective.com/ajv) Thank you. + #### Open Collective sponsors @@ -72,25 +79,73 @@ Thank you. - - - - - - - - - - - - - - - + + +## Using version 6 + +[JSON Schema draft-07](http://json-schema.org/latest/json-schema-validation.html) is published. + +[Ajv version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0) that supports draft-07 is released. It may require either migrating your schemas or updating your code (to continue using draft-04 and v5 schemas, draft-06 schemas will be supported without changes). + +__Please note__: To use Ajv with draft-06 schemas you need to explicitly add the meta-schema to the validator instance: + +```javascript +ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-06.json')); +``` + +To use Ajv with draft-04 schemas in addition to explicitly adding meta-schema you also need to use option schemaId: + +```javascript +var ajv = new Ajv({schemaId: 'id'}); +// If you want to use both draft-04 and draft-06/07 schemas: +// var ajv = new Ajv({schemaId: 'auto'}); +ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json')); +``` + + +## Contents + +- [Performance](#performance) +- [Features](#features) +- [Getting started](#getting-started) +- [Frequently Asked Questions](https://github.com/ajv-validator/ajv/blob/master/FAQ.md) +- [Using in browser](#using-in-browser) + - [Ajv and Content Security Policies (CSP)](#ajv-and-content-security-policies-csp) +- [Command line interface](#command-line-interface) +- Validation + - [Keywords](#validation-keywords) + - [Annotation keywords](#annotation-keywords) + - [Formats](#formats) + - [Combining schemas with $ref](#ref) + - [$data reference](#data-reference) + - NEW: [$merge and $patch keywords](#merge-and-patch-keywords) + - [Defining custom keywords](#defining-custom-keywords) + - [Asynchronous schema compilation](#asynchronous-schema-compilation) + - [Asynchronous validation](#asynchronous-validation) +- [Security considerations](#security-considerations) + - [Security contact](#security-contact) + - [Untrusted schemas](#untrusted-schemas) + - [Circular references in objects](#circular-references-in-javascript-objects) + - [Trusted schemas](#security-risks-of-trusted-schemas) + - [ReDoS attack](#redos-attack) +- Modifying data during validation + - [Filtering data](#filtering-data) + - [Assigning defaults](#assigning-defaults) + - [Coercing data types](#coercing-data-types) +- API + - [Methods](#api) + - [Options](#options) + - [Validation errors](#validation-errors) +- [Plugins](#plugins) +- [Related packages](#related-packages) +- [Some packages using Ajv](#some-packages-using-ajv) +- [Tests, Contributing, Changes history](#tests) +- [Support, Code of conduct, License](#open-source-software-support) + ## Performance -Ajv generates code to turn JSON Schemas into super-fast validation functions that are efficient for v8 optimization. +Ajv generates code using [doT templates](https://github.com/olado/doT) to turn JSON Schemas into super-fast validation functions that are efficient for v8 optimization. Currently Ajv is the fastest and the most standard compliant validator according to these benchmarks: @@ -99,109 +154,1344 @@ Currently Ajv is the fastest and the most standard compliant validator according - [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html) - [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html) + Performance of different validators by [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark): -[![performance](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=62,4,1&chs=600x416&chxl=-1:|ajv|@exodus/schemasafe|is-my-json-valid|djv|@cfworker/json-schema|jsonschema/=t:100,69.2,51.5,13.1,5.1,1.2)](https://github.com/ebdrup/json-schema-benchmark/blob/master/README.md#performance) +[![performance](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=32,4,1&chs=600x416&chxl=-1:|djv|ajv|json-schema-validator-generator|jsen|is-my-json-valid|themis|z-schema|jsck|skeemas|json-schema-library|tv4&chd=t:100,98,72.1,66.8,50.1,15.1,6.1,3.8,1.2,0.7,0.2)](https://github.com/ebdrup/json-schema-benchmark/blob/master/README.md#performance) + ## Features -- Ajv implements JSON Schema [draft-06/07/2019-09/2020-12](http://json-schema.org/) standards (draft-04 is supported in v6): - - all validation keywords (see [JSON Schema validation keywords](https://ajv.js.org/json-schema.html)) - - [OpenAPI](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md) extensions: - - NEW: keyword [discriminator](https://ajv.js.org/json-schema.html#discriminator). - - keyword [nullable](https://ajv.js.org/json-schema.html#nullable). - - full support of remote references (remote schemas have to be added with `addSchema` or compiled to be available) - - support of recursive references between schemas - - correct string lengths for strings with unicode pairs - - JSON Schema [formats](https://ajv.js.org/guide/formats.html) (with [ajv-formats](https://github.com/ajv-validator/ajv-formats) plugin). - - [validates schemas against meta-schema](https://ajv.js.org/api.html#api-validateschema) -- NEW: supports [JSON Type Definition](https://datatracker.ietf.org/doc/rfc8927/): - - all keywords (see [JSON Type Definition schema forms](https://ajv.js.org/json-type-definition.html)) - - meta-schema for JTD schemas - - "union" keyword and user-defined keywords (can be used inside "metadata" member of the schema) -- supports [browsers](https://ajv.js.org/guide/environments.html#browsers) and Node.js 10.x - current -- [asynchronous loading](https://ajv.js.org/guide/managing-schemas.html#asynchronous-schema-loading) of referenced schemas during compilation -- "All errors" validation mode with [option allErrors](https://ajv.js.org/options.html#allerrors) -- [error messages with parameters](https://ajv.js.org/api.html#validation-errors) describing error reasons to allow error message generation +- Ajv implements full JSON Schema [draft-06/07](http://json-schema.org/) and draft-04 standards: + - all validation keywords (see [JSON Schema validation keywords](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md)) + - full support of remote refs (remote schemas have to be added with `addSchema` or compiled to be available) + - support of circular references between schemas + - correct string lengths for strings with unicode pairs (can be turned off) + - [formats](#formats) defined by JSON Schema draft-07 standard and custom formats (can be turned off) + - [validates schemas against meta-schema](#api-validateschema) +- supports [browsers](#using-in-browser) and Node.js 0.10-14.x +- [asynchronous loading](#asynchronous-schema-compilation) of referenced schemas during compilation +- "All errors" validation mode with [option allErrors](#options) +- [error messages with parameters](#validation-errors) describing error reasons to allow creating custom error messages - i18n error messages support with [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) package -- [removing-additional-properties](https://ajv.js.org/guide/modifying-data.html#removing-additional-properties) -- [assigning defaults](https://ajv.js.org/guide/modifying-data.html#assigning-defaults) to missing properties and items -- [coercing data](https://ajv.js.org/guide/modifying-data.html#coercing-data-types) to the types specified in `type` keywords -- [user-defined keywords](https://ajv.js.org/guide/user-keywords.html) -- additional extension keywords with [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package -- [\$data reference](https://ajv.js.org/guide/combining-schemas.html#data-reference) to use values from the validated data as values for the schema keywords -- [asynchronous validation](https://ajv.js.org/guide/async-validation.html) of user-defined formats and keywords +- [filtering data](#filtering-data) from additional properties +- [assigning defaults](#assigning-defaults) to missing properties and items +- [coercing data](#coercing-data-types) to the types specified in `type` keywords +- [custom keywords](#defining-custom-keywords) +- draft-06/07 keywords `const`, `contains`, `propertyNames` and `if/then/else` +- draft-06 boolean schemas (`true`/`false` as a schema to always pass/fail). +- keywords `switch`, `patternRequired`, `formatMaximum` / `formatMinimum` and `formatExclusiveMaximum` / `formatExclusiveMinimum` from [JSON Schema extension proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals) with [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package +- [$data reference](#data-reference) to use values from the validated data as values for the schema keywords +- [asynchronous validation](#asynchronous-validation) of custom formats and keywords -## Install -To install version 8: +## Install ``` npm install ajv ``` + ## Getting started -Try it in the Node.js REPL: https://runkit.com/npm/ajv +Try it in the Node.js REPL: https://tonicdev.com/npm/ajv -In JavaScript: + +The fastest validation call: ```javascript -// or ESM/TypeScript import -import Ajv from "ajv" // Node.js require: -const Ajv = require("ajv") +var Ajv = require('ajv'); +// or ESM/TypeScript import +import Ajv from 'ajv'; + +var ajv = new Ajv(); // options can be passed, e.g. {allErrors: true} +var validate = ajv.compile(schema); +var valid = validate(data); +if (!valid) console.log(validate.errors); +``` + +or with less code + +```javascript +// ... +var valid = ajv.validate(schema, data); +if (!valid) console.log(ajv.errors); +// ... +``` + +or + +```javascript +// ... +var valid = ajv.addSchema(schema, 'mySchema') + .validate('mySchema', data); +if (!valid) console.log(ajv.errorsText()); +// ... +``` + +See [API](#api) and [Options](#options) for more details. + +Ajv compiles schemas to functions and caches them in all cases (using schema serialized with [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) or a custom function as a key), so that the next time the same schema is used (not necessarily the same object instance) it won't be compiled again. + +The best performance is achieved when using compiled functions returned by `compile` or `getSchema` methods (there is no additional function call). + +__Please note__: every time a validation function or `ajv.validate` are called `errors` property is overwritten. You need to copy `errors` array reference to another variable if you want to use it later (e.g., in the callback). See [Validation errors](#validation-errors) + +__Note for TypeScript users__: `ajv` provides its own TypeScript declarations +out of the box, so you don't need to install the deprecated `@types/ajv` +module. + + +## Using in browser + +You can require Ajv directly from the code you browserify - in this case Ajv will be a part of your bundle. + +If you need to use Ajv in several bundles you can create a separate UMD bundle using `npm run bundle` script (thanks to [siddo420](https://github.com/siddo420)). + +Then you need to load Ajv in the browser: +```html + +``` + +This bundle can be used with different module systems; it creates global `Ajv` if no module system is found. + +The browser bundle is available on [cdnjs](https://cdnjs.com/libraries/ajv). -const ajv = new Ajv() // options can be passed, e.g. {allErrors: true} +Ajv is tested with these browsers: -const schema = { - type: "object", - properties: { - foo: {type: "integer"}, - bar: {type: "string"}, +[![Sauce Test Status](https://saucelabs.com/browser-matrix/epoberezkin.svg)](https://saucelabs.com/u/epoberezkin) + +__Please note__: some frameworks, e.g. Dojo, may redefine global require in such way that is not compatible with CommonJS module format. In such case Ajv bundle has to be loaded before the framework and then you can use global Ajv (see issue [#234](https://github.com/ajv-validator/ajv/issues/234)). + + +### Ajv and Content Security Policies (CSP) + +If you're using Ajv to compile a schema (the typical use) in a browser document that is loaded with a Content Security Policy (CSP), that policy will require a `script-src` directive that includes the value `'unsafe-eval'`. +:warning: NOTE, however, that `unsafe-eval` is NOT recommended in a secure CSP[[1]](https://developer.chrome.com/extensions/contentSecurityPolicy#relaxing-eval), as it has the potential to open the document to cross-site scripting (XSS) attacks. + +In order to make use of Ajv without easing your CSP, you can [pre-compile a schema using the CLI](https://github.com/ajv-validator/ajv-cli#compile-schemas). This will transpile the schema JSON into a JavaScript file that exports a `validate` function that works simlarly to a schema compiled at runtime. + +Note that pre-compilation of schemas is performed using [ajv-pack](https://github.com/ajv-validator/ajv-pack) and there are [some limitations to the schema features it can compile](https://github.com/ajv-validator/ajv-pack#limitations). A successfully pre-compiled schema is equivalent to the same schema compiled at runtime. + + +## Command line interface + +CLI is available as a separate npm package [ajv-cli](https://github.com/ajv-validator/ajv-cli). It supports: + +- compiling JSON Schemas to test their validity +- BETA: generating standalone module exporting a validation function to be used without Ajv (using [ajv-pack](https://github.com/ajv-validator/ajv-pack)) +- migrate schemas to draft-07 (using [json-schema-migrate](https://github.com/epoberezkin/json-schema-migrate)) +- validating data file(s) against JSON Schema +- testing expected validity of data against JSON Schema +- referenced schemas +- custom meta-schemas +- files in JSON, JSON5, YAML, and JavaScript format +- all Ajv options +- reporting changes in data after validation in [JSON-patch](https://tools.ietf.org/html/rfc6902) format + + +## Validation keywords + +Ajv supports all validation keywords from draft-07 of JSON Schema standard: + +- [type](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#type) +- [for numbers](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-numbers) - maximum, minimum, exclusiveMaximum, exclusiveMinimum, multipleOf +- [for strings](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-strings) - maxLength, minLength, pattern, format +- [for arrays](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-arrays) - maxItems, minItems, uniqueItems, items, additionalItems, [contains](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#contains) +- [for objects](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-objects) - maxProperties, minProperties, required, properties, patternProperties, additionalProperties, dependencies, [propertyNames](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#propertynames) +- [for all types](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-all-types) - enum, [const](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#const) +- [compound keywords](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#compound-keywords) - not, oneOf, anyOf, allOf, [if/then/else](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#ifthenelse) + +With [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package Ajv also supports validation keywords from [JSON Schema extension proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals) for JSON Schema standard: + +- [patternRequired](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#patternrequired-proposed) - like `required` but with patterns that some property should match. +- [formatMaximum, formatMinimum, formatExclusiveMaximum, formatExclusiveMinimum](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#formatmaximum--formatminimum-and-exclusiveformatmaximum--exclusiveformatminimum-proposed) - setting limits for date, time, etc. + +See [JSON Schema validation keywords](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md) for more details. + + +## Annotation keywords + +JSON Schema specification defines several annotation keywords that describe schema itself but do not perform any validation. + +- `title` and `description`: information about the data represented by that schema +- `$comment` (NEW in draft-07): information for developers. With option `$comment` Ajv logs or passes the comment string to the user-supplied function. See [Options](#options). +- `default`: a default value of the data instance, see [Assigning defaults](#assigning-defaults). +- `examples` (NEW in draft-06): an array of data instances. Ajv does not check the validity of these instances against the schema. +- `readOnly` and `writeOnly` (NEW in draft-07): marks data-instance as read-only or write-only in relation to the source of the data (database, api, etc.). +- `contentEncoding`: [RFC 2045](https://tools.ietf.org/html/rfc2045#section-6.1 ), e.g., "base64". +- `contentMediaType`: [RFC 2046](https://tools.ietf.org/html/rfc2046), e.g., "image/png". + +__Please note__: Ajv does not implement validation of the keywords `examples`, `contentEncoding` and `contentMediaType` but it reserves them. If you want to create a plugin that implements some of them, it should remove these keywords from the instance. + + +## Formats + +Ajv implements formats defined by JSON Schema specification and several other formats. It is recommended NOT to use "format" keyword implementations with untrusted data, as they use potentially unsafe regular expressions - see [ReDoS attack](#redos-attack). + +__Please note__: if you need to use "format" keyword to validate untrusted data, you MUST assess their suitability and safety for your validation scenarios. + +The following formats are implemented for string validation with "format" keyword: + +- _date_: full-date according to [RFC3339](http://tools.ietf.org/html/rfc3339#section-5.6). +- _time_: time with optional time-zone. +- _date-time_: date-time from the same source (time-zone is mandatory). `date`, `time` and `date-time` validate ranges in `full` mode and only regexp in `fast` mode (see [options](#options)). +- _uri_: full URI. +- _uri-reference_: URI reference, including full and relative URIs. +- _uri-template_: URI template according to [RFC6570](https://tools.ietf.org/html/rfc6570) +- _url_ (deprecated): [URL record](https://url.spec.whatwg.org/#concept-url). +- _email_: email address. +- _hostname_: host name according to [RFC1034](http://tools.ietf.org/html/rfc1034#section-3.5). +- _ipv4_: IP address v4. +- _ipv6_: IP address v6. +- _regex_: tests whether a string is a valid regular expression by passing it to RegExp constructor. +- _uuid_: Universally Unique IDentifier according to [RFC4122](http://tools.ietf.org/html/rfc4122). +- _json-pointer_: JSON-pointer according to [RFC6901](https://tools.ietf.org/html/rfc6901). +- _relative-json-pointer_: relative JSON-pointer according to [this draft](http://tools.ietf.org/html/draft-luff-relative-json-pointer-00). + +__Please note__: JSON Schema draft-07 also defines formats `iri`, `iri-reference`, `idn-hostname` and `idn-email` for URLs, hostnames and emails with international characters. Ajv does not implement these formats. If you create Ajv plugin that implements them please make a PR to mention this plugin here. + +There are two modes of format validation: `fast` and `full`. This mode affects formats `date`, `time`, `date-time`, `uri`, `uri-reference`, and `email`. See [Options](#options) for details. + +You can add additional formats and replace any of the formats above using [addFormat](#api-addformat) method. + +The option `unknownFormats` allows changing the default behaviour when an unknown format is encountered. In this case Ajv can either fail schema compilation (default) or ignore it (default in versions before 5.0.0). You also can allow specific format(s) that will be ignored. See [Options](#options) for details. + +You can find regular expressions used for format validation and the sources that were used in [formats.js](https://github.com/ajv-validator/ajv/blob/master/lib/compile/formats.js). + + +## Combining schemas with $ref + +You can structure your validation logic across multiple schema files and have schemas reference each other using `$ref` keyword. + +Example: + +```javascript +var schema = { + "$id": "http://example.com/schemas/schema.json", + "type": "object", + "properties": { + "foo": { "$ref": "defs.json#/definitions/int" }, + "bar": { "$ref": "defs.json#/definitions/str" } + } +}; + +var defsSchema = { + "$id": "http://example.com/schemas/defs.json", + "definitions": { + "int": { "type": "integer" }, + "str": { "type": "string" } + } +}; +``` + +Now to compile your schema you can either pass all schemas to Ajv instance: + +```javascript +var ajv = new Ajv({schemas: [schema, defsSchema]}); +var validate = ajv.getSchema('http://example.com/schemas/schema.json'); +``` + +or use `addSchema` method: + +```javascript +var ajv = new Ajv; +var validate = ajv.addSchema(defsSchema) + .compile(schema); +``` + +See [Options](#options) and [addSchema](#api) method. + +__Please note__: +- `$ref` is resolved as the uri-reference using schema $id as the base URI (see the example). +- References can be recursive (and mutually recursive) to implement the schemas for different data structures (such as linked lists, trees, graphs, etc.). +- You don't have to host your schema files at the URIs that you use as schema $id. These URIs are only used to identify the schemas, and according to JSON Schema specification validators should not expect to be able to download the schemas from these URIs. +- The actual location of the schema file in the file system is not used. +- You can pass the identifier of the schema as the second parameter of `addSchema` method or as a property name in `schemas` option. This identifier can be used instead of (or in addition to) schema $id. +- You cannot have the same $id (or the schema identifier) used for more than one schema - the exception will be thrown. +- You can implement dynamic resolution of the referenced schemas using `compileAsync` method. In this way you can store schemas in any system (files, web, database, etc.) and reference them without explicitly adding to Ajv instance. See [Asynchronous schema compilation](#asynchronous-schema-compilation). + + +## $data reference + +With `$data` option you can use values from the validated data as the values for the schema keywords. See [proposal](https://github.com/json-schema-org/json-schema-spec/issues/51) for more information about how it works. + +`$data` reference is supported in the keywords: const, enum, format, maximum/minimum, exclusiveMaximum / exclusiveMinimum, maxLength / minLength, maxItems / minItems, maxProperties / minProperties, formatMaximum / formatMinimum, formatExclusiveMaximum / formatExclusiveMinimum, multipleOf, pattern, required, uniqueItems. + +The value of "$data" should be a [JSON-pointer](https://tools.ietf.org/html/rfc6901) to the data (the root is always the top level data object, even if the $data reference is inside a referenced subschema) or a [relative JSON-pointer](http://tools.ietf.org/html/draft-luff-relative-json-pointer-00) (it is relative to the current point in data; if the $data reference is inside a referenced subschema it cannot point to the data outside of the root level for this subschema). + +Examples. + +This schema requires that the value in property `smaller` is less or equal than the value in the property larger: + +```javascript +var ajv = new Ajv({$data: true}); + +var schema = { + "properties": { + "smaller": { + "type": "number", + "maximum": { "$data": "1/larger" } + }, + "larger": { "type": "number" } + } +}; + +var validData = { + smaller: 5, + larger: 7 +}; + +ajv.validate(schema, validData); // true +``` + +This schema requires that the properties have the same format as their field names: + +```javascript +var schema = { + "additionalProperties": { + "type": "string", + "format": { "$data": "0#" } + } +}; + +var validData = { + 'date-time': '1963-06-19T08:30:06.283185Z', + email: 'joe.bloggs@example.com' +} +``` + +`$data` reference is resolved safely - it won't throw even if some property is undefined. If `$data` resolves to `undefined` the validation succeeds (with the exclusion of `const` keyword). If `$data` resolves to incorrect type (e.g. not "number" for maximum keyword) the validation fails. + + +## $merge and $patch keywords + +With the package [ajv-merge-patch](https://github.com/ajv-validator/ajv-merge-patch) you can use the keywords `$merge` and `$patch` that allow extending JSON Schemas with patches using formats [JSON Merge Patch (RFC 7396)](https://tools.ietf.org/html/rfc7396) and [JSON Patch (RFC 6902)](https://tools.ietf.org/html/rfc6902). + +To add keywords `$merge` and `$patch` to Ajv instance use this code: + +```javascript +require('ajv-merge-patch')(ajv); +``` + +Examples. + +Using `$merge`: + +```json +{ + "$merge": { + "source": { + "type": "object", + "properties": { "p": { "type": "string" } }, + "additionalProperties": false + }, + "with": { + "properties": { "q": { "type": "number" } } + } + } +} +``` + +Using `$patch`: + +```json +{ + "$patch": { + "source": { + "type": "object", + "properties": { "p": { "type": "string" } }, + "additionalProperties": false + }, + "with": [ + { "op": "add", "path": "/properties/q", "value": { "type": "number" } } + ] + } +} +``` + +The schemas above are equivalent to this schema: + +```json +{ + "type": "object", + "properties": { + "p": { "type": "string" }, + "q": { "type": "number" } }, - required: ["foo"], - additionalProperties: false, + "additionalProperties": false } +``` -const data = { - foo: 1, - bar: "abc", +The properties `source` and `with` in the keywords `$merge` and `$patch` can use absolute or relative `$ref` to point to other schemas previously added to the Ajv instance or to the fragments of the current schema. + +See the package [ajv-merge-patch](https://github.com/ajv-validator/ajv-merge-patch) for more information. + + +## Defining custom keywords + +The advantages of using custom keywords are: + +- allow creating validation scenarios that cannot be expressed using JSON Schema +- simplify your schemas +- help bringing a bigger part of the validation logic to your schemas +- make your schemas more expressive, less verbose and closer to your application domain +- implement custom data processors that modify your data (`modifying` option MUST be used in keyword definition) and/or create side effects while the data is being validated + +If a keyword is used only for side-effects and its validation result is pre-defined, use option `valid: true/false` in keyword definition to simplify both generated code (no error handling in case of `valid: true`) and your keyword functions (no need to return any validation result). + +The concerns you have to be aware of when extending JSON Schema standard with custom keywords are the portability and understanding of your schemas. You will have to support these custom keywords on other platforms and to properly document these keywords so that everybody can understand them in your schemas. + +You can define custom keywords with [addKeyword](#api-addkeyword) method. Keywords are defined on the `ajv` instance level - new instances will not have previously defined keywords. + +Ajv allows defining keywords with: +- validation function +- compilation function +- macro function +- inline compilation function that should return code (as string) that will be inlined in the currently compiled schema. + +Example. `range` and `exclusiveRange` keywords using compiled schema: + +```javascript +ajv.addKeyword('range', { + type: 'number', + compile: function (sch, parentSchema) { + var min = sch[0]; + var max = sch[1]; + + return parentSchema.exclusiveRange === true + ? function (data) { return data > min && data < max; } + : function (data) { return data >= min && data <= max; } + } +}); + +var schema = { "range": [2, 4], "exclusiveRange": true }; +var validate = ajv.compile(schema); +console.log(validate(2.01)); // true +console.log(validate(3.99)); // true +console.log(validate(2)); // false +console.log(validate(4)); // false +``` + +Several custom keywords (typeof, instanceof, range and propertyNames) are defined in [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package - they can be used for your schemas and as a starting point for your own custom keywords. + +See [Defining custom keywords](https://github.com/ajv-validator/ajv/blob/master/CUSTOM.md) for more details. + + +## Asynchronous schema compilation + +During asynchronous compilation remote references are loaded using supplied function. See `compileAsync` [method](#api-compileAsync) and `loadSchema` [option](#options). + +Example: + +```javascript +var ajv = new Ajv({ loadSchema: loadSchema }); + +ajv.compileAsync(schema).then(function (validate) { + var valid = validate(data); + // ... +}); + +function loadSchema(uri) { + return request.json(uri).then(function (res) { + if (res.statusCode >= 400) + throw new Error('Loading error: ' + res.statusCode); + return res.body; + }); } +``` + +__Please note__: [Option](#options) `missingRefs` should NOT be set to `"ignore"` or `"fail"` for asynchronous compilation to work. + + +## Asynchronous validation + +Example in Node.js REPL: https://tonicdev.com/esp/ajv-asynchronous-validation -const validate = ajv.compile(schema) -const valid = validate(data) -if (!valid) console.log(validate.errors) +You can define custom formats and keywords that perform validation asynchronously by accessing database or some other service. You should add `async: true` in the keyword or format definition (see [addFormat](#api-addformat), [addKeyword](#api-addkeyword) and [Defining custom keywords](#defining-custom-keywords)). + +If your schema uses asynchronous formats/keywords or refers to some schema that contains them it should have `"$async": true` keyword so that Ajv can compile it correctly. If asynchronous format/keyword or reference to asynchronous schema is used in the schema without `$async` keyword Ajv will throw an exception during schema compilation. + +__Please note__: all asynchronous subschemas that are referenced from the current or other schemas should have `"$async": true` keyword as well, otherwise the schema compilation will fail. + +Validation function for an asynchronous custom format/keyword should return a promise that resolves with `true` or `false` (or rejects with `new Ajv.ValidationError(errors)` if you want to return custom errors from the keyword function). + +Ajv compiles asynchronous schemas to [es7 async functions](http://tc39.github.io/ecmascript-asyncawait/) that can optionally be transpiled with [nodent](https://github.com/MatAtBread/nodent). Async functions are supported in Node.js 7+ and all modern browsers. You can also supply any other transpiler as a function via `processCode` option. See [Options](#options). + +The compiled validation function has `$async: true` property (if the schema is asynchronous), so you can differentiate these functions if you are using both synchronous and asynchronous schemas. + +Validation result will be a promise that resolves with validated data or rejects with an exception `Ajv.ValidationError` that contains the array of validation errors in `errors` property. + + +Example: + +```javascript +var ajv = new Ajv; +// require('ajv-async')(ajv); + +ajv.addKeyword('idExists', { + async: true, + type: 'number', + validate: checkIdExists +}); + + +function checkIdExists(schema, data) { + return knex(schema.table) + .select('id') + .where('id', data) + .then(function (rows) { + return !!rows.length; // true if record is found + }); +} + +var schema = { + "$async": true, + "properties": { + "userId": { + "type": "integer", + "idExists": { "table": "users" } + }, + "postId": { + "type": "integer", + "idExists": { "table": "posts" } + } + } +}; + +var validate = ajv.compile(schema); + +validate({ userId: 1, postId: 19 }) +.then(function (data) { + console.log('Data is valid', data); // { userId: 1, postId: 19 } +}) +.catch(function (err) { + if (!(err instanceof Ajv.ValidationError)) throw err; + // data is invalid + console.log('Validation errors:', err.errors); +}); ``` -Learn how to use Ajv and see more examples in the [Guide: getting started](https://ajv.js.org/guide/getting-started.html) +### Using transpilers with asynchronous validation functions. -## Changes history +[ajv-async](https://github.com/ajv-validator/ajv-async) uses [nodent](https://github.com/MatAtBread/nodent) to transpile async functions. To use another transpiler you should separately install it (or load its bundle in the browser). -See [https://github.com/ajv-validator/ajv/releases](https://github.com/ajv-validator/ajv/releases) -**Please note**: [Changes in version 8.0.0](https://github.com/ajv-validator/ajv/releases/tag/v8.0.0) +#### Using nodent -[Version 7.0.0](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0) +```javascript +var ajv = new Ajv; +require('ajv-async')(ajv); +// in the browser if you want to load ajv-async bundle separately you can: +// window.ajvAsync(ajv); +var validate = ajv.compile(schema); // transpiled es7 async function +validate(data).then(successFunc).catch(errorFunc); +``` -[Version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0). -## Code of conduct +#### Using other transpilers -Please review and follow the [Code of conduct](./CODE_OF_CONDUCT.md). +```javascript +var ajv = new Ajv({ processCode: transpileFunc }); +var validate = ajv.compile(schema); // transpiled es7 async function +validate(data).then(successFunc).catch(errorFunc); +``` -Please report any unacceptable behaviour to ajv.validator@gmail.com - it will be reviewed by the project team. +See [Options](#options). + + +## Security considerations -## Security contact +JSON Schema, if properly used, can replace data sanitisation. It doesn't replace other API security considerations. It also introduces additional security aspects to consider. + + +##### Security contact To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerabilities via GitHub issues. + +##### Untrusted schemas + +Ajv treats JSON schemas as trusted as your application code. This security model is based on the most common use case, when the schemas are static and bundled together with the application. + +If your schemas are received from untrusted sources (or generated from untrusted data) there are several scenarios you need to prevent: +- compiling schemas can cause stack overflow (if they are too deep) +- compiling schemas can be slow (e.g. [#557](https://github.com/ajv-validator/ajv/issues/557)) +- validating certain data can be slow + +It is difficult to predict all the scenarios, but at the very least it may help to limit the size of untrusted schemas (e.g. limit JSON string length) and also the maximum schema object depth (that can be high for relatively small JSON strings). You also may want to mitigate slow regular expressions in `pattern` and `patternProperties` keywords. + +Regardless the measures you take, using untrusted schemas increases security risks. + + +##### Circular references in JavaScript objects + +Ajv does not support schemas and validated data that have circular references in objects. See [issue #802](https://github.com/ajv-validator/ajv/issues/802). + +An attempt to compile such schemas or validate such data would cause stack overflow (or will not complete in case of asynchronous validation). Depending on the parser you use, untrusted data can lead to circular references. + + +##### Security risks of trusted schemas + +Some keywords in JSON Schemas can lead to very slow validation for certain data. These keywords include (but may be not limited to): + +- `pattern` and `format` for large strings - in some cases using `maxLength` can help mitigate it, but certain regular expressions can lead to exponential validation time even with relatively short strings (see [ReDoS attack](#redos-attack)). +- `patternProperties` for large property names - use `propertyNames` to mitigate, but some regular expressions can have exponential evaluation time as well. +- `uniqueItems` for large non-scalar arrays - use `maxItems` to mitigate + +__Please note__: The suggestions above to prevent slow validation would only work if you do NOT use `allErrors: true` in production code (using it would continue validation after validation errors). + +You can validate your JSON schemas against [this meta-schema](https://github.com/ajv-validator/ajv/blob/master/lib/refs/json-schema-secure.json) to check that these recommendations are followed: + +```javascript +const isSchemaSecure = ajv.compile(require('ajv/lib/refs/json-schema-secure.json')); + +const schema1 = {format: 'email'}; +isSchemaSecure(schema1); // false + +const schema2 = {format: 'email', maxLength: MAX_LENGTH}; +isSchemaSecure(schema2); // true +``` + +__Please note__: following all these recommendation is not a guarantee that validation of untrusted data is safe - it can still lead to some undesirable results. + + +##### Content Security Policies (CSP) +See [Ajv and Content Security Policies (CSP)](#ajv-and-content-security-policies-csp) + + +## ReDoS attack + +Certain regular expressions can lead to the exponential evaluation time even with relatively short strings. + +Please assess the regular expressions you use in the schemas on their vulnerability to this attack - see [safe-regex](https://github.com/substack/safe-regex), for example. + +__Please note__: some formats that Ajv implements use [regular expressions](https://github.com/ajv-validator/ajv/blob/master/lib/compile/formats.js) that can be vulnerable to ReDoS attack, so if you use Ajv to validate data from untrusted sources __it is strongly recommended__ to consider the following: + +- making assessment of "format" implementations in Ajv. +- using `format: 'fast'` option that simplifies some of the regular expressions (although it does not guarantee that they are safe). +- replacing format implementations provided by Ajv with your own implementations of "format" keyword that either uses different regular expressions or another approach to format validation. Please see [addFormat](#api-addformat) method. +- disabling format validation by ignoring "format" keyword with option `format: false` + +Whatever mitigation you choose, please assume all formats provided by Ajv as potentially unsafe and make your own assessment of their suitability for your validation scenarios. + + +## Filtering data + +With [option `removeAdditional`](#options) (added by [andyscott](https://github.com/andyscott)) you can filter data during the validation. + +This option modifies original data. + +Example: + +```javascript +var ajv = new Ajv({ removeAdditional: true }); +var schema = { + "additionalProperties": false, + "properties": { + "foo": { "type": "number" }, + "bar": { + "additionalProperties": { "type": "number" }, + "properties": { + "baz": { "type": "string" } + } + } + } +} + +var data = { + "foo": 0, + "additional1": 1, // will be removed; `additionalProperties` == false + "bar": { + "baz": "abc", + "additional2": 2 // will NOT be removed; `additionalProperties` != false + }, +} + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // { "foo": 0, "bar": { "baz": "abc", "additional2": 2 } +``` + +If `removeAdditional` option in the example above were `"all"` then both `additional1` and `additional2` properties would have been removed. + +If the option were `"failing"` then property `additional1` would have been removed regardless of its value and property `additional2` would have been removed only if its value were failing the schema in the inner `additionalProperties` (so in the example above it would have stayed because it passes the schema, but any non-number would have been removed). + +__Please note__: If you use `removeAdditional` option with `additionalProperties` keyword inside `anyOf`/`oneOf` keywords your validation can fail with this schema, for example: + +```json +{ + "type": "object", + "oneOf": [ + { + "properties": { + "foo": { "type": "string" } + }, + "required": [ "foo" ], + "additionalProperties": false + }, + { + "properties": { + "bar": { "type": "integer" } + }, + "required": [ "bar" ], + "additionalProperties": false + } + ] +} +``` + +The intention of the schema above is to allow objects with either the string property "foo" or the integer property "bar", but not with both and not with any other properties. + +With the option `removeAdditional: true` the validation will pass for the object `{ "foo": "abc"}` but will fail for the object `{"bar": 1}`. It happens because while the first subschema in `oneOf` is validated, the property `bar` is removed because it is an additional property according to the standard (because it is not included in `properties` keyword in the same schema). + +While this behaviour is unexpected (issues [#129](https://github.com/ajv-validator/ajv/issues/129), [#134](https://github.com/ajv-validator/ajv/issues/134)), it is correct. To have the expected behaviour (both objects are allowed and additional properties are removed) the schema has to be refactored in this way: + +```json +{ + "type": "object", + "properties": { + "foo": { "type": "string" }, + "bar": { "type": "integer" } + }, + "additionalProperties": false, + "oneOf": [ + { "required": [ "foo" ] }, + { "required": [ "bar" ] } + ] +} +``` + +The schema above is also more efficient - it will compile into a faster function. + + +## Assigning defaults + +With [option `useDefaults`](#options) Ajv will assign values from `default` keyword in the schemas of `properties` and `items` (when it is the array of schemas) to the missing properties and items. + +With the option value `"empty"` properties and items equal to `null` or `""` (empty string) will be considered missing and assigned defaults. + +This option modifies original data. + +__Please note__: the default value is inserted in the generated validation code as a literal, so the value inserted in the data will be the deep clone of the default in the schema. + + +Example 1 (`default` in `properties`): + +```javascript +var ajv = new Ajv({ useDefaults: true }); +var schema = { + "type": "object", + "properties": { + "foo": { "type": "number" }, + "bar": { "type": "string", "default": "baz" } + }, + "required": [ "foo", "bar" ] +}; + +var data = { "foo": 1 }; + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // { "foo": 1, "bar": "baz" } +``` + +Example 2 (`default` in `items`): + +```javascript +var schema = { + "type": "array", + "items": [ + { "type": "number" }, + { "type": "string", "default": "foo" } + ] +} + +var data = [ 1 ]; + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // [ 1, "foo" ] +``` + +`default` keywords in other cases are ignored: + +- not in `properties` or `items` subschemas +- in schemas inside `anyOf`, `oneOf` and `not` (see [#42](https://github.com/ajv-validator/ajv/issues/42)) +- in `if` subschema of `switch` keyword +- in schemas generated by custom macro keywords + +The [`strictDefaults` option](#options) customizes Ajv's behavior for the defaults that Ajv ignores (`true` raises an error, and `"log"` outputs a warning). + + +## Coercing data types + +When you are validating user inputs all your data properties are usually strings. The option `coerceTypes` allows you to have your data types coerced to the types specified in your schema `type` keywords, both to pass the validation and to use the correctly typed data afterwards. + +This option modifies original data. + +__Please note__: if you pass a scalar value to the validating function its type will be coerced and it will pass the validation, but the value of the variable you pass won't be updated because scalars are passed by value. + + +Example 1: + +```javascript +var ajv = new Ajv({ coerceTypes: true }); +var schema = { + "type": "object", + "properties": { + "foo": { "type": "number" }, + "bar": { "type": "boolean" } + }, + "required": [ "foo", "bar" ] +}; + +var data = { "foo": "1", "bar": "false" }; + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // { "foo": 1, "bar": false } +``` + +Example 2 (array coercions): + +```javascript +var ajv = new Ajv({ coerceTypes: 'array' }); +var schema = { + "properties": { + "foo": { "type": "array", "items": { "type": "number" } }, + "bar": { "type": "boolean" } + } +}; + +var data = { "foo": "1", "bar": ["false"] }; + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // { "foo": [1], "bar": false } +``` + +The coercion rules, as you can see from the example, are different from JavaScript both to validate user input as expected and to have the coercion reversible (to correctly validate cases where different types are defined in subschemas of "anyOf" and other compound keywords). + +See [Coercion rules](https://github.com/ajv-validator/ajv/blob/master/COERCION.md) for details. + + +## API + +##### new Ajv(Object options) -> Object + +Create Ajv instance. + + +##### .compile(Object schema) -> Function<Object data> + +Generate validating function and cache the compiled schema for future use. + +Validating function returns a boolean value. This function has properties `errors` and `schema`. Errors encountered during the last validation are assigned to `errors` property (it is assigned `null` if there was no errors). `schema` property contains the reference to the original schema. + +The schema passed to this method will be validated against meta-schema unless `validateSchema` option is false. If schema is invalid, an error will be thrown. See [options](#options). + + +##### .compileAsync(Object schema [, Boolean meta] [, Function callback]) -> Promise + +Asynchronous version of `compile` method that loads missing remote schemas using asynchronous function in `options.loadSchema`. This function returns a Promise that resolves to a validation function. An optional callback passed to `compileAsync` will be called with 2 parameters: error (or null) and validating function. The returned promise will reject (and the callback will be called with an error) when: + +- missing schema can't be loaded (`loadSchema` returns a Promise that rejects). +- a schema containing a missing reference is loaded, but the reference cannot be resolved. +- schema (or some loaded/referenced schema) is invalid. + +The function compiles schema and loads the first missing schema (or meta-schema) until all missing schemas are loaded. + +You can asynchronously compile meta-schema by passing `true` as the second parameter. + +See example in [Asynchronous compilation](#asynchronous-schema-compilation). + + +##### .validate(Object schema|String key|String ref, data) -> Boolean + +Validate data using passed schema (it will be compiled and cached). + +Instead of the schema you can use the key that was previously passed to `addSchema`, the schema id if it was present in the schema or any previously resolved reference. + +Validation errors will be available in the `errors` property of Ajv instance (`null` if there were no errors). + +__Please note__: every time this method is called the errors are overwritten so you need to copy them to another variable if you want to use them later. + +If the schema is asynchronous (has `$async` keyword on the top level) this method returns a Promise. See [Asynchronous validation](#asynchronous-validation). + + +##### .addSchema(Array<Object>|Object schema [, String key]) -> Ajv + +Add schema(s) to validator instance. This method does not compile schemas (but it still validates them). Because of that dependencies can be added in any order and circular dependencies are supported. It also prevents unnecessary compilation of schemas that are containers for other schemas but not used as a whole. + +Array of schemas can be passed (schemas should have ids), the second parameter will be ignored. + +Key can be passed that can be used to reference the schema and will be used as the schema id if there is no id inside the schema. If the key is not passed, the schema id will be used as the key. + + +Once the schema is added, it (and all the references inside it) can be referenced in other schemas and used to validate data. + +Although `addSchema` does not compile schemas, explicit compilation is not required - the schema will be compiled when it is used first time. + +By default the schema is validated against meta-schema before it is added, and if the schema does not pass validation the exception is thrown. This behaviour is controlled by `validateSchema` option. + +__Please note__: Ajv uses the [method chaining syntax](https://en.wikipedia.org/wiki/Method_chaining) for all methods with the prefix `add*` and `remove*`. +This allows you to do nice things like the following. + +```javascript +var validate = new Ajv().addSchema(schema).addFormat(name, regex).getSchema(uri); +``` + +##### .addMetaSchema(Array<Object>|Object schema [, String key]) -> Ajv + +Adds meta schema(s) that can be used to validate other schemas. That function should be used instead of `addSchema` because there may be instance options that would compile a meta schema incorrectly (at the moment it is `removeAdditional` option). + +There is no need to explicitly add draft-07 meta schema (http://json-schema.org/draft-07/schema) - it is added by default, unless option `meta` is set to `false`. You only need to use it if you have a changed meta-schema that you want to use to validate your schemas. See `validateSchema`. + + +##### .validateSchema(Object schema) -> Boolean + +Validates schema. This method should be used to validate schemas rather than `validate` due to the inconsistency of `uri` format in JSON Schema standard. + +By default this method is called automatically when the schema is added, so you rarely need to use it directly. + +If schema doesn't have `$schema` property, it is validated against draft 6 meta-schema (option `meta` should not be false). + +If schema has `$schema` property, then the schema with this id (that should be previously added) is used to validate passed schema. + +Errors will be available at `ajv.errors`. + + +##### .getSchema(String key) -> Function<Object data> + +Retrieve compiled schema previously added with `addSchema` by the key passed to `addSchema` or by its full reference (id). The returned validating function has `schema` property with the reference to the original schema. + + +##### .removeSchema([Object schema|String key|String ref|RegExp pattern]) -> Ajv + +Remove added/cached schema. Even if schema is referenced by other schemas it can be safely removed as dependent schemas have local references. + +Schema can be removed using: +- key passed to `addSchema` +- it's full reference (id) +- RegExp that should match schema id or key (meta-schemas won't be removed) +- actual schema object that will be stable-stringified to remove schema from cache + +If no parameter is passed all schemas but meta-schemas will be removed and the cache will be cleared. + + +##### .addFormat(String name, String|RegExp|Function|Object format) -> Ajv + +Add custom format to validate strings or numbers. It can also be used to replace pre-defined formats for Ajv instance. + +Strings are converted to RegExp. + +Function should return validation result as `true` or `false`. + +If object is passed it should have properties `validate`, `compare` and `async`: + +- _validate_: a string, RegExp or a function as described above. +- _compare_: an optional comparison function that accepts two strings and compares them according to the format meaning. This function is used with keywords `formatMaximum`/`formatMinimum` (defined in [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package). It should return `1` if the first value is bigger than the second value, `-1` if it is smaller and `0` if it is equal. +- _async_: an optional `true` value if `validate` is an asynchronous function; in this case it should return a promise that resolves with a value `true` or `false`. +- _type_: an optional type of data that the format applies to. It can be `"string"` (default) or `"number"` (see https://github.com/ajv-validator/ajv/issues/291#issuecomment-259923858). If the type of data is different, the validation will pass. + +Custom formats can be also added via `formats` option. + + +##### .addKeyword(String keyword, Object definition) -> Ajv + +Add custom validation keyword to Ajv instance. + +Keyword should be different from all standard JSON Schema keywords and different from previously defined keywords. There is no way to redefine keywords or to remove keyword definition from the instance. + +Keyword must start with a letter, `_` or `$`, and may continue with letters, numbers, `_`, `$`, or `-`. +It is recommended to use an application-specific prefix for keywords to avoid current and future name collisions. + +Example Keywords: +- `"xyz-example"`: valid, and uses prefix for the xyz project to avoid name collisions. +- `"example"`: valid, but not recommended as it could collide with future versions of JSON Schema etc. +- `"3-example"`: invalid as numbers are not allowed to be the first character in a keyword + +Keyword definition is an object with the following properties: + +- _type_: optional string or array of strings with data type(s) that the keyword applies to. If not present, the keyword will apply to all types. +- _validate_: validating function +- _compile_: compiling function +- _macro_: macro function +- _inline_: compiling function that returns code (as string) +- _schema_: an optional `false` value used with "validate" keyword to not pass schema +- _metaSchema_: an optional meta-schema for keyword schema +- _dependencies_: an optional list of properties that must be present in the parent schema - it will be checked during schema compilation +- _modifying_: `true` MUST be passed if keyword modifies data +- _statements_: `true` can be passed in case inline keyword generates statements (as opposed to expression) +- _valid_: pass `true`/`false` to pre-define validation result, the result returned from validation function will be ignored. This option cannot be used with macro keywords. +- _$data_: an optional `true` value to support [$data reference](#data-reference) as the value of custom keyword. The reference will be resolved at validation time. If the keyword has meta-schema it would be extended to allow $data and it will be used to validate the resolved value. Supporting $data reference requires that keyword has validating function (as the only option or in addition to compile, macro or inline function). +- _async_: an optional `true` value if the validation function is asynchronous (whether it is compiled or passed in _validate_ property); in this case it should return a promise that resolves with a value `true` or `false`. This option is ignored in case of "macro" and "inline" keywords. +- _errors_: an optional boolean or string `"full"` indicating whether keyword returns errors. If this property is not set Ajv will determine if the errors were set in case of failed validation. + +_compile_, _macro_ and _inline_ are mutually exclusive, only one should be used at a time. _validate_ can be used separately or in addition to them to support $data reference. + +__Please note__: If the keyword is validating data type that is different from the type(s) in its definition, the validation function will not be called (and expanded macro will not be used), so there is no need to check for data type inside validation function or inside schema returned by macro function (unless you want to enforce a specific type and for some reason do not want to use a separate `type` keyword for that). In the same way as standard keywords work, if the keyword does not apply to the data type being validated, the validation of this keyword will succeed. + +See [Defining custom keywords](#defining-custom-keywords) for more details. + + +##### .getKeyword(String keyword) -> Object|Boolean + +Returns custom keyword definition, `true` for pre-defined keywords and `false` if the keyword is unknown. + + +##### .removeKeyword(String keyword) -> Ajv + +Removes custom or pre-defined keyword so you can redefine them. + +While this method can be used to extend pre-defined keywords, it can also be used to completely change their meaning - it may lead to unexpected results. + +__Please note__: schemas compiled before the keyword is removed will continue to work without changes. To recompile schemas use `removeSchema` method and compile them again. + + +##### .errorsText([Array<Object> errors [, Object options]]) -> String + +Returns the text with all errors in a String. + +Options can have properties `separator` (string used to separate errors, ", " by default) and `dataVar` (the variable name that dataPaths are prefixed with, "data" by default). + + +## Options + +Defaults: + +```javascript +{ + // validation and reporting options: + $data: false, + allErrors: false, + verbose: false, + $comment: false, // NEW in Ajv version 6.0 + jsonPointers: false, + uniqueItems: true, + unicode: true, + nullable: false, + format: 'fast', + formats: {}, + unknownFormats: true, + schemas: {}, + logger: undefined, + // referenced schema options: + schemaId: '$id', + missingRefs: true, + extendRefs: 'ignore', // recommended 'fail' + loadSchema: undefined, // function(uri: string): Promise {} + // options to modify validated data: + removeAdditional: false, + useDefaults: false, + coerceTypes: false, + // strict mode options + strictDefaults: false, + strictKeywords: false, + strictNumbers: false, + // asynchronous validation options: + transpile: undefined, // requires ajv-async package + // advanced options: + meta: true, + validateSchema: true, + addUsedSchema: true, + inlineRefs: true, + passContext: false, + loopRequired: Infinity, + ownProperties: false, + multipleOfPrecision: false, + errorDataPath: 'object', // deprecated + messages: true, + sourceCode: false, + processCode: undefined, // function (str: string, schema: object): string {} + cache: new Cache, + serialize: undefined +} +``` + +##### Validation and reporting options + +- _$data_: support [$data references](#data-reference). Draft 6 meta-schema that is added by default will be extended to allow them. If you want to use another meta-schema you need to use $dataMetaSchema method to add support for $data reference. See [API](#api). +- _allErrors_: check all rules collecting all errors. Default is to return after the first error. +- _verbose_: include the reference to the part of the schema (`schema` and `parentSchema`) and validated data in errors (false by default). +- _$comment_ (NEW in Ajv version 6.0): log or pass the value of `$comment` keyword to a function. Option values: + - `false` (default): ignore $comment keyword. + - `true`: log the keyword value to console. + - function: pass the keyword value, its schema path and root schema to the specified function +- _jsonPointers_: set `dataPath` property of errors using [JSON Pointers](https://tools.ietf.org/html/rfc6901) instead of JavaScript property access notation. +- _uniqueItems_: validate `uniqueItems` keyword (true by default). +- _unicode_: calculate correct length of strings with unicode pairs (true by default). Pass `false` to use `.length` of strings that is faster, but gives "incorrect" lengths of strings with unicode pairs - each unicode pair is counted as two characters. +- _nullable_: support keyword "nullable" from [Open API 3 specification](https://swagger.io/docs/specification/data-models/data-types/). +- _format_: formats validation mode. Option values: + - `"fast"` (default) - simplified and fast validation (see [Formats](#formats) for details of which formats are available and affected by this option). + - `"full"` - more restrictive and slow validation. E.g., 25:00:00 and 2015/14/33 will be invalid time and date in 'full' mode but it will be valid in 'fast' mode. + - `false` - ignore all format keywords. +- _formats_: an object with custom formats. Keys and values will be passed to `addFormat` method. +- _keywords_: an object with custom keywords. Keys and values will be passed to `addKeyword` method. +- _unknownFormats_: handling of unknown formats. Option values: + - `true` (default) - if an unknown format is encountered the exception is thrown during schema compilation. If `format` keyword value is [$data reference](#data-reference) and it is unknown the validation will fail. + - `[String]` - an array of unknown format names that will be ignored. This option can be used to allow usage of third party schemas with format(s) for which you don't have definitions, but still fail if another unknown format is used. If `format` keyword value is [$data reference](#data-reference) and it is not in this array the validation will fail. + - `"ignore"` - to log warning during schema compilation and always pass validation (the default behaviour in versions before 5.0.0). This option is not recommended, as it allows to mistype format name and it won't be validated without any error message. This behaviour is required by JSON Schema specification. +- _schemas_: an array or object of schemas that will be added to the instance. In case you pass the array the schemas must have IDs in them. When the object is passed the method `addSchema(value, key)` will be called for each schema in this object. +- _logger_: sets the logging method. Default is the global `console` object that should have methods `log`, `warn` and `error`. See [Error logging](#error-logging). Option values: + - custom logger - it should have methods `log`, `warn` and `error`. If any of these methods is missing an exception will be thrown. + - `false` - logging is disabled. + + +##### Referenced schema options + +- _schemaId_: this option defines which keywords are used as schema URI. Option value: + - `"$id"` (default) - only use `$id` keyword as schema URI (as specified in JSON Schema draft-06/07), ignore `id` keyword (if it is present a warning will be logged). + - `"id"` - only use `id` keyword as schema URI (as specified in JSON Schema draft-04), ignore `$id` keyword (if it is present a warning will be logged). + - `"auto"` - use both `$id` and `id` keywords as schema URI. If both are present (in the same schema object) and different the exception will be thrown during schema compilation. +- _missingRefs_: handling of missing referenced schemas. Option values: + - `true` (default) - if the reference cannot be resolved during compilation the exception is thrown. The thrown error has properties `missingRef` (with hash fragment) and `missingSchema` (without it). Both properties are resolved relative to the current base id (usually schema id, unless it was substituted). + - `"ignore"` - to log error during compilation and always pass validation. + - `"fail"` - to log error and successfully compile schema but fail validation if this rule is checked. +- _extendRefs_: validation of other keywords when `$ref` is present in the schema. Option values: + - `"ignore"` (default) - when `$ref` is used other keywords are ignored (as per [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03#section-3) standard). A warning will be logged during the schema compilation. + - `"fail"` (recommended) - if other validation keywords are used together with `$ref` the exception will be thrown when the schema is compiled. This option is recommended to make sure schema has no keywords that are ignored, which can be confusing. + - `true` - validate all keywords in the schemas with `$ref` (the default behaviour in versions before 5.0.0). +- _loadSchema_: asynchronous function that will be used to load remote schemas when `compileAsync` [method](#api-compileAsync) is used and some reference is missing (option `missingRefs` should NOT be 'fail' or 'ignore'). This function should accept remote schema uri as a parameter and return a Promise that resolves to a schema. See example in [Asynchronous compilation](#asynchronous-schema-compilation). + + +##### Options to modify validated data + +- _removeAdditional_: remove additional properties - see example in [Filtering data](#filtering-data). This option is not used if schema is added with `addMetaSchema` method. Option values: + - `false` (default) - not to remove additional properties + - `"all"` - all additional properties are removed, regardless of `additionalProperties` keyword in schema (and no validation is made for them). + - `true` - only additional properties with `additionalProperties` keyword equal to `false` are removed. + - `"failing"` - additional properties that fail schema validation will be removed (where `additionalProperties` keyword is `false` or schema). +- _useDefaults_: replace missing or undefined properties and items with the values from corresponding `default` keywords. Default behaviour is to ignore `default` keywords. This option is not used if schema is added with `addMetaSchema` method. See examples in [Assigning defaults](#assigning-defaults). Option values: + - `false` (default) - do not use defaults + - `true` - insert defaults by value (object literal is used). + - `"empty"` - in addition to missing or undefined, use defaults for properties and items that are equal to `null` or `""` (an empty string). + - `"shared"` (deprecated) - insert defaults by reference. If the default is an object, it will be shared by all instances of validated data. If you modify the inserted default in the validated data, it will be modified in the schema as well. +- _coerceTypes_: change data type of data to match `type` keyword. See the example in [Coercing data types](#coercing-data-types) and [coercion rules](https://github.com/ajv-validator/ajv/blob/master/COERCION.md). Option values: + - `false` (default) - no type coercion. + - `true` - coerce scalar data types. + - `"array"` - in addition to coercions between scalar types, coerce scalar data to an array with one element and vice versa (as required by the schema). + + +##### Strict mode options + +- _strictDefaults_: report ignored `default` keywords in schemas. Option values: + - `false` (default) - ignored defaults are not reported + - `true` - if an ignored default is present, throw an error + - `"log"` - if an ignored default is present, log warning +- _strictKeywords_: report unknown keywords in schemas. Option values: + - `false` (default) - unknown keywords are not reported + - `true` - if an unknown keyword is present, throw an error + - `"log"` - if an unknown keyword is present, log warning +- _strictNumbers_: validate numbers strictly, failing validation for NaN and Infinity. Option values: + - `false` (default) - NaN or Infinity will pass validation for numeric types + - `true` - NaN or Infinity will not pass validation for numeric types + +##### Asynchronous validation options + +- _transpile_: Requires [ajv-async](https://github.com/ajv-validator/ajv-async) package. It determines whether Ajv transpiles compiled asynchronous validation function. Option values: + - `undefined` (default) - transpile with [nodent](https://github.com/MatAtBread/nodent) if async functions are not supported. + - `true` - always transpile with nodent. + - `false` - do not transpile; if async functions are not supported an exception will be thrown. + + +##### Advanced options + +- _meta_: add [meta-schema](http://json-schema.org/documentation.html) so it can be used by other schemas (true by default). If an object is passed, it will be used as the default meta-schema for schemas that have no `$schema` keyword. This default meta-schema MUST have `$schema` keyword. +- _validateSchema_: validate added/compiled schemas against meta-schema (true by default). `$schema` property in the schema can be http://json-schema.org/draft-07/schema or absent (draft-07 meta-schema will be used) or can be a reference to the schema previously added with `addMetaSchema` method. Option values: + - `true` (default) - if the validation fails, throw the exception. + - `"log"` - if the validation fails, log error. + - `false` - skip schema validation. +- _addUsedSchema_: by default methods `compile` and `validate` add schemas to the instance if they have `$id` (or `id`) property that doesn't start with "#". If `$id` is present and it is not unique the exception will be thrown. Set this option to `false` to skip adding schemas to the instance and the `$id` uniqueness check when these methods are used. This option does not affect `addSchema` method. +- _inlineRefs_: Affects compilation of referenced schemas. Option values: + - `true` (default) - the referenced schemas that don't have refs in them are inlined, regardless of their size - that substantially improves performance at the cost of the bigger size of compiled schema functions. + - `false` - to not inline referenced schemas (they will be compiled as separate functions). + - integer number - to limit the maximum number of keywords of the schema that will be inlined. +- _passContext_: pass validation context to custom keyword functions. If this option is `true` and you pass some context to the compiled validation function with `validate.call(context, data)`, the `context` will be available as `this` in your custom keywords. By default `this` is Ajv instance. +- _loopRequired_: by default `required` keyword is compiled into a single expression (or a sequence of statements in `allErrors` mode). In case of a very large number of properties in this keyword it may result in a very big validation function. Pass integer to set the number of properties above which `required` keyword will be validated in a loop - smaller validation function size but also worse performance. +- _ownProperties_: by default Ajv iterates over all enumerable object properties; when this option is `true` only own enumerable object properties (i.e. found directly on the object rather than on its prototype) are iterated. Contributed by @mbroadst. +- _multipleOfPrecision_: by default `multipleOf` keyword is validated by comparing the result of division with parseInt() of that result. It works for dividers that are bigger than 1. For small dividers such as 0.01 the result of the division is usually not integer (even when it should be integer, see issue [#84](https://github.com/ajv-validator/ajv/issues/84)). If you need to use fractional dividers set this option to some positive integer N to have `multipleOf` validated using this formula: `Math.abs(Math.round(division) - division) < 1e-N` (it is slower but allows for float arithmetics deviations). +- _errorDataPath_ (deprecated): set `dataPath` to point to 'object' (default) or to 'property' when validating keywords `required`, `additionalProperties` and `dependencies`. +- _messages_: Include human-readable messages in errors. `true` by default. `false` can be passed when custom messages are used (e.g. with [ajv-i18n](https://github.com/ajv-validator/ajv-i18n)). +- _sourceCode_: add `sourceCode` property to validating function (for debugging; this code can be different from the result of toString call). +- _processCode_: an optional function to process generated code before it is passed to Function constructor. It can be used to either beautify (the validating function is generated without line-breaks) or to transpile code. Starting from version 5.0.0 this option replaced options: + - `beautify` that formatted the generated function using [js-beautify](https://github.com/beautify-web/js-beautify). If you want to beautify the generated code pass a function calling `require('js-beautify').js_beautify` as `processCode: code => js_beautify(code)`. + - `transpile` that transpiled asynchronous validation function. You can still use `transpile` option with [ajv-async](https://github.com/ajv-validator/ajv-async) package. See [Asynchronous validation](#asynchronous-validation) for more information. +- _cache_: an optional instance of cache to store compiled schemas using stable-stringified schema as a key. For example, set-associative cache [sacjs](https://github.com/epoberezkin/sacjs) can be used. If not passed then a simple hash is used which is good enough for the common use case (a limited number of statically defined schemas). Cache should have methods `put(key, value)`, `get(key)`, `del(key)` and `clear()`. +- _serialize_: an optional function to serialize schema to cache key. Pass `false` to use schema itself as a key (e.g., if WeakMap used as a cache). By default [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used. + + +## Validation errors + +In case of validation failure, Ajv assigns the array of errors to `errors` property of validation function (or to `errors` property of Ajv instance when `validate` or `validateSchema` methods were called). In case of [asynchronous validation](#asynchronous-validation), the returned promise is rejected with exception `Ajv.ValidationError` that has `errors` property. + + +### Error objects + +Each error is an object with the following properties: + +- _keyword_: validation keyword. +- _dataPath_: the path to the part of the data that was validated. By default `dataPath` uses JavaScript property access notation (e.g., `".prop[1].subProp"`). When the option `jsonPointers` is true (see [Options](#options)) `dataPath` will be set using JSON pointer standard (e.g., `"/prop/1/subProp"`). +- _schemaPath_: the path (JSON-pointer as a URI fragment) to the schema of the keyword that failed validation. +- _params_: the object with the additional information about error that can be used to create custom error messages (e.g., using [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) package). See below for parameters set by all keywords. +- _message_: the standard error message (can be excluded with option `messages` set to false). +- _schema_: the schema of the keyword (added with `verbose` option). +- _parentSchema_: the schema containing the keyword (added with `verbose` option) +- _data_: the data validated by the keyword (added with `verbose` option). + +__Please note__: `propertyNames` keyword schema validation errors have an additional property `propertyName`, `dataPath` points to the object. After schema validation for each property name, if it is invalid an additional error is added with the property `keyword` equal to `"propertyNames"`. + + +### Error parameters + +Properties of `params` object in errors depend on the keyword that failed validation. + +- `maxItems`, `minItems`, `maxLength`, `minLength`, `maxProperties`, `minProperties` - property `limit` (number, the schema of the keyword). +- `additionalItems` - property `limit` (the maximum number of allowed items in case when `items` keyword is an array of schemas and `additionalItems` is false). +- `additionalProperties` - property `additionalProperty` (the property not used in `properties` and `patternProperties` keywords). +- `dependencies` - properties: + - `property` (dependent property), + - `missingProperty` (required missing dependency - only the first one is reported currently) + - `deps` (required dependencies, comma separated list as a string), + - `depsCount` (the number of required dependencies). +- `format` - property `format` (the schema of the keyword). +- `maximum`, `minimum` - properties: + - `limit` (number, the schema of the keyword), + - `exclusive` (boolean, the schema of `exclusiveMaximum` or `exclusiveMinimum`), + - `comparison` (string, comparison operation to compare the data to the limit, with the data on the left and the limit on the right; can be "<", "<=", ">", ">=") +- `multipleOf` - property `multipleOf` (the schema of the keyword) +- `pattern` - property `pattern` (the schema of the keyword) +- `required` - property `missingProperty` (required property that is missing). +- `propertyNames` - property `propertyName` (an invalid property name). +- `patternRequired` (in ajv-keywords) - property `missingPattern` (required pattern that did not match any property). +- `type` - property `type` (required type(s), a string, can be a comma-separated list) +- `uniqueItems` - properties `i` and `j` (indices of duplicate items). +- `const` - property `allowedValue` pointing to the value (the schema of the keyword). +- `enum` - property `allowedValues` pointing to the array of values (the schema of the keyword). +- `$ref` - property `ref` with the referenced schema URI. +- `oneOf` - property `passingSchemas` (array of indices of passing schemas, null if no schema passes). +- custom keywords (in case keyword definition doesn't create errors) - property `keyword` (the keyword name). + + +### Error logging + +Using the `logger` option when initiallizing Ajv will allow you to define custom logging. Here you can build upon the exisiting logging. The use of other logging packages is supported as long as the package or its associated wrapper exposes the required methods. If any of the required methods are missing an exception will be thrown. +- **Required Methods**: `log`, `warn`, `error` + +```javascript +var otherLogger = new OtherLogger(); +var ajv = new Ajv({ + logger: { + log: console.log.bind(console), + warn: function warn() { + otherLogger.logWarn.apply(otherLogger, arguments); + }, + error: function error() { + otherLogger.logError.apply(otherLogger, arguments); + console.error.apply(console, arguments); + } + } +}); +``` + + +## Plugins + +Ajv can be extended with plugins that add custom keywords, formats or functions to process generated code. When such plugin is published as npm package it is recommended that it follows these conventions: + +- it exports a function +- this function accepts ajv instance as the first parameter and returns the same instance to allow chaining +- this function can accept an optional configuration as the second parameter + +If you have published a useful plugin please submit a PR to add it to the next section. + + +## Related packages + +- [ajv-async](https://github.com/ajv-validator/ajv-async) - plugin to configure async validation mode +- [ajv-bsontype](https://github.com/BoLaMN/ajv-bsontype) - plugin to validate mongodb's bsonType formats +- [ajv-cli](https://github.com/jessedc/ajv-cli) - command line interface +- [ajv-errors](https://github.com/ajv-validator/ajv-errors) - plugin for custom error messages +- [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) - internationalised error messages +- [ajv-istanbul](https://github.com/ajv-validator/ajv-istanbul) - plugin to instrument generated validation code to measure test coverage of your schemas +- [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) - plugin with custom validation keywords (select, typeof, etc.) +- [ajv-merge-patch](https://github.com/ajv-validator/ajv-merge-patch) - plugin with keywords $merge and $patch +- [ajv-pack](https://github.com/ajv-validator/ajv-pack) - produces a compact module exporting validation functions +- [ajv-formats-draft2019](https://github.com/luzlab/ajv-formats-draft2019) - format validators for draft2019 that aren't already included in ajv (ie. `idn-hostname`, `idn-email`, `iri`, `iri-reference` and `duration`). + +## Some packages using Ajv + +- [webpack](https://github.com/webpack/webpack) - a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser +- [jsonscript-js](https://github.com/JSONScript/jsonscript-js) - the interpreter for [JSONScript](http://www.jsonscript.org) - scripted processing of existing endpoints and services +- [osprey-method-handler](https://github.com/mulesoft-labs/osprey-method-handler) - Express middleware for validating requests and responses based on a RAML method object, used in [osprey](https://github.com/mulesoft/osprey) - validating API proxy generated from a RAML definition +- [har-validator](https://github.com/ahmadnassri/har-validator) - HTTP Archive (HAR) validator +- [jsoneditor](https://github.com/josdejong/jsoneditor) - a web-based tool to view, edit, format, and validate JSON http://jsoneditoronline.org +- [JSON Schema Lint](https://github.com/nickcmaynard/jsonschemalint) - a web tool to validate JSON/YAML document against a single JSON Schema http://jsonschemalint.com +- [objection](https://github.com/vincit/objection.js) - SQL-friendly ORM for Node.js +- [table](https://github.com/gajus/table) - formats data into a string table +- [ripple-lib](https://github.com/ripple/ripple-lib) - a JavaScript API for interacting with [Ripple](https://ripple.com) in Node.js and the browser +- [restbase](https://github.com/wikimedia/restbase) - distributed storage with REST API & dispatcher for backend services built to provide a low-latency & high-throughput API for Wikipedia / Wikimedia content +- [hippie-swagger](https://github.com/CacheControl/hippie-swagger) - [Hippie](https://github.com/vesln/hippie) wrapper that provides end to end API testing with swagger validation +- [react-form-controlled](https://github.com/seeden/react-form-controlled) - React controlled form components with validation +- [rabbitmq-schema](https://github.com/tjmehta/rabbitmq-schema) - a schema definition module for RabbitMQ graphs and messages +- [@query/schema](https://www.npmjs.com/package/@query/schema) - stream filtering with a URI-safe query syntax parsing to JSON Schema +- [chai-ajv-json-schema](https://github.com/peon374/chai-ajv-json-schema) - chai plugin to us JSON Schema with expect in mocha tests +- [grunt-jsonschema-ajv](https://github.com/SignpostMarv/grunt-jsonschema-ajv) - Grunt plugin for validating files against JSON Schema +- [extract-text-webpack-plugin](https://github.com/webpack-contrib/extract-text-webpack-plugin) - extract text from bundle into a file +- [electron-builder](https://github.com/electron-userland/electron-builder) - a solution to package and build a ready for distribution Electron app +- [addons-linter](https://github.com/mozilla/addons-linter) - Mozilla Add-ons Linter +- [gh-pages-generator](https://github.com/epoberezkin/gh-pages-generator) - multi-page site generator converting markdown files to GitHub pages +- [ESLint](https://github.com/eslint/eslint) - the pluggable linting utility for JavaScript and JSX + + +## Tests + +``` +npm install +git submodule update --init +npm test +``` + +## Contributing + +All validation functions are generated using doT templates in [dot](https://github.com/ajv-validator/ajv/tree/master/lib/dot) folder. Templates are precompiled so doT is not a run-time dependency. + +`npm run build` - compiles templates to [dotjs](https://github.com/ajv-validator/ajv/tree/master/lib/dotjs) folder. + +`npm run watch` - automatically compiles templates when files in dot folder change + +Please see [Contributing guidelines](https://github.com/ajv-validator/ajv/blob/master/CONTRIBUTING.md) + + +## Changes history + +See https://github.com/ajv-validator/ajv/releases + +__Please note__: [Changes in version 7.0.0-beta](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0-beta.0) + +[Version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0). + +## Code of conduct + +Please review and follow the [Code of conduct](https://github.com/ajv-validator/ajv/blob/master/CODE_OF_CONDUCT.md). + +Please report any unacceptable behaviour to ajv.validator@gmail.com - it will be reviewed by the project team. + + ## Open-source software support Ajv is a part of [Tidelift subscription](https://tidelift.com/subscription/pkg/npm-ajv?utm_source=npm-ajv&utm_medium=referral&utm_campaign=readme) - it provides a centralised support to open-source software users, in addition to the support provided by software maintainers. + ## License -[MIT](./LICENSE) +[MIT](https://github.com/ajv-validator/ajv/blob/master/LICENSE) diff --git a/node_modules/ajv/dist/2019.d.ts b/node_modules/ajv/dist/2019.d.ts deleted file mode 100644 index e835e2b..0000000 --- a/node_modules/ajv/dist/2019.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { AnySchemaObject } from "./types"; -import AjvCore, { Options } from "./core"; -export declare class Ajv2019 extends AjvCore { - constructor(opts?: Options); - _addVocabularies(): void; - _addDefaultMetaSchema(): void; - defaultMeta(): string | AnySchemaObject | undefined; -} -export default Ajv2019; -export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, ErrorNoParams, } from "./types"; -export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core"; -export { SchemaCxt, SchemaObjCxt } from "./compile"; -export { KeywordCxt } from "./compile/validate"; -export { DefinedError } from "./vocabularies/errors"; -export { JSONType } from "./compile/rules"; -export { JSONSchemaType } from "./types/json-schema"; -export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; -export { default as ValidationError } from "./runtime/validation_error"; -export { default as MissingRefError } from "./compile/ref_error"; diff --git a/node_modules/ajv/dist/2019.js b/node_modules/ajv/dist/2019.js deleted file mode 100644 index bad415c..0000000 --- a/node_modules/ajv/dist/2019.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv2019 = void 0; -const core_1 = require("./core"); -const draft7_1 = require("./vocabularies/draft7"); -const dynamic_1 = require("./vocabularies/dynamic"); -const next_1 = require("./vocabularies/next"); -const unevaluated_1 = require("./vocabularies/unevaluated"); -const discriminator_1 = require("./vocabularies/discriminator"); -const json_schema_2019_09_1 = require("./refs/json-schema-2019-09"); -const META_SCHEMA_ID = "https://json-schema.org/draft/2019-09/schema"; -class Ajv2019 extends core_1.default { - constructor(opts = {}) { - super({ - ...opts, - dynamicRef: true, - next: true, - unevaluated: true, - }); - } - _addVocabularies() { - super._addVocabularies(); - this.addVocabulary(dynamic_1.default); - draft7_1.default.forEach((v) => this.addVocabulary(v)); - this.addVocabulary(next_1.default); - this.addVocabulary(unevaluated_1.default); - if (this.opts.discriminator) - this.addKeyword(discriminator_1.default); - } - _addDefaultMetaSchema() { - super._addDefaultMetaSchema(); - const { $data, meta } = this.opts; - if (!meta) - return; - json_schema_2019_09_1.default.call(this, $data); - this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID; - } - defaultMeta() { - return (this.opts.defaultMeta = - super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); - } -} -exports.Ajv2019 = Ajv2019; -module.exports = exports = Ajv2019; -module.exports.Ajv2019 = Ajv2019; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = Ajv2019; -var validate_1 = require("./compile/validate"); -Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); -var codegen_1 = require("./compile/codegen"); -Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); -Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); -Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); -Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); -Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); -Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); -var validation_error_1 = require("./runtime/validation_error"); -Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } }); -var ref_error_1 = require("./compile/ref_error"); -Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } }); -//# sourceMappingURL=2019.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/2019.js.map b/node_modules/ajv/dist/2019.js.map deleted file mode 100644 index 7e55d95..0000000 --- a/node_modules/ajv/dist/2019.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"2019.js","sourceRoot":"","sources":["../lib/2019.ts"],"names":[],"mappings":";;;AACA,iCAAuC;AAEvC,kDAAsD;AACtD,oDAAsD;AACtD,8CAAgD;AAChD,4DAA8D;AAC9D,gEAAwD;AACxD,oEAA0D;AAE1D,MAAM,cAAc,GAAG,8CAA8C,CAAA;AAErE,MAAa,OAAQ,SAAQ,cAAO;IAClC,YAAY,OAAgB,EAAE;QAC5B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,IAAI;SAClB,CAAC,CAAA;IACJ,CAAC;IAED,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAA;QACrC,gBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QACxD,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;QAClC,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAA;QACzC,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,UAAU,CAAC,uBAAa,CAAC,CAAA;IAC7D,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,MAAM,EAAC,KAAK,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;QAC/B,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,6BAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACnC,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,GAAG,cAAc,CAAA;IAC7D,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;YAC3B,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IACzF,CAAC;CACF;AA/BD,0BA+BC;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAA;AAClC,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAA;AAChC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,OAAO,CAAA;AAyBtB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAIlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA;AACnD,+DAAqE;AAA7D,mHAAA,OAAO,OAAmB;AAClC,iDAA8D;AAAtD,4GAAA,OAAO,OAAmB"} \ No newline at end of file diff --git a/node_modules/ajv/dist/2020.d.ts b/node_modules/ajv/dist/2020.d.ts deleted file mode 100644 index 2e56c8f..0000000 --- a/node_modules/ajv/dist/2020.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { AnySchemaObject } from "./types"; -import AjvCore, { Options } from "./core"; -export declare class Ajv2020 extends AjvCore { - constructor(opts?: Options); - _addVocabularies(): void; - _addDefaultMetaSchema(): void; - defaultMeta(): string | AnySchemaObject | undefined; -} -export default Ajv2020; -export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, ErrorNoParams, } from "./types"; -export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core"; -export { SchemaCxt, SchemaObjCxt } from "./compile"; -export { KeywordCxt } from "./compile/validate"; -export { DefinedError } from "./vocabularies/errors"; -export { JSONType } from "./compile/rules"; -export { JSONSchemaType } from "./types/json-schema"; -export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; -export { default as ValidationError } from "./runtime/validation_error"; -export { default as MissingRefError } from "./compile/ref_error"; diff --git a/node_modules/ajv/dist/2020.js b/node_modules/ajv/dist/2020.js deleted file mode 100644 index b3fe71c..0000000 --- a/node_modules/ajv/dist/2020.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv2020 = void 0; -const core_1 = require("./core"); -const draft2020_1 = require("./vocabularies/draft2020"); -const discriminator_1 = require("./vocabularies/discriminator"); -const json_schema_2020_12_1 = require("./refs/json-schema-2020-12"); -const META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema"; -class Ajv2020 extends core_1.default { - constructor(opts = {}) { - super({ - ...opts, - dynamicRef: true, - next: true, - unevaluated: true, - }); - } - _addVocabularies() { - super._addVocabularies(); - draft2020_1.default.forEach((v) => this.addVocabulary(v)); - if (this.opts.discriminator) - this.addKeyword(discriminator_1.default); - } - _addDefaultMetaSchema() { - super._addDefaultMetaSchema(); - const { $data, meta } = this.opts; - if (!meta) - return; - json_schema_2020_12_1.default.call(this, $data); - this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID; - } - defaultMeta() { - return (this.opts.defaultMeta = - super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); - } -} -exports.Ajv2020 = Ajv2020; -module.exports = exports = Ajv2020; -module.exports.Ajv2020 = Ajv2020; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = Ajv2020; -var validate_1 = require("./compile/validate"); -Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); -var codegen_1 = require("./compile/codegen"); -Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); -Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); -Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); -Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); -Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); -Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); -var validation_error_1 = require("./runtime/validation_error"); -Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } }); -var ref_error_1 = require("./compile/ref_error"); -Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } }); -//# sourceMappingURL=2020.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/2020.js.map b/node_modules/ajv/dist/2020.js.map deleted file mode 100644 index 2f4fda8..0000000 --- a/node_modules/ajv/dist/2020.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"2020.js","sourceRoot":"","sources":["../lib/2020.ts"],"names":[],"mappings":";;;AACA,iCAAuC;AAEvC,wDAA4D;AAC5D,gEAAwD;AACxD,oEAA0D;AAE1D,MAAM,cAAc,GAAG,8CAA8C,CAAA;AAErE,MAAa,OAAQ,SAAQ,cAAO;IAClC,YAAY,OAAgB,EAAE;QAC5B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,IAAI;SAClB,CAAC,CAAA;IACJ,CAAC;IAED,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,mBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QAC3D,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,UAAU,CAAC,uBAAa,CAAC,CAAA;IAC7D,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,MAAM,EAAC,KAAK,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;QAC/B,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,6BAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACnC,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,GAAG,cAAc,CAAA;IAC7D,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;YAC3B,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IACzF,CAAC;CACF;AA5BD,0BA4BC;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAA;AAClC,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAA;AAChC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,OAAO,CAAA;AAyBtB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAIlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA;AACnD,+DAAqE;AAA7D,mHAAA,OAAO,OAAmB;AAClC,iDAA8D;AAAtD,4GAAA,OAAO,OAAmB"} \ No newline at end of file diff --git a/node_modules/ajv/dist/ajv.d.ts b/node_modules/ajv/dist/ajv.d.ts deleted file mode 100644 index fce3b03..0000000 --- a/node_modules/ajv/dist/ajv.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { AnySchemaObject } from "./types"; -import AjvCore from "./core"; -export declare class Ajv extends AjvCore { - _addVocabularies(): void; - _addDefaultMetaSchema(): void; - defaultMeta(): string | AnySchemaObject | undefined; -} -export default Ajv; -export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, SchemaValidateFunction, ErrorObject, ErrorNoParams, } from "./types"; -export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core"; -export { SchemaCxt, SchemaObjCxt } from "./compile"; -export { KeywordCxt } from "./compile/validate"; -export { DefinedError } from "./vocabularies/errors"; -export { JSONType } from "./compile/rules"; -export { JSONSchemaType } from "./types/json-schema"; -export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; -export { default as ValidationError } from "./runtime/validation_error"; -export { default as MissingRefError } from "./compile/ref_error"; diff --git a/node_modules/ajv/dist/ajv.js b/node_modules/ajv/dist/ajv.js deleted file mode 100644 index 8eecf1b..0000000 --- a/node_modules/ajv/dist/ajv.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = void 0; -const core_1 = require("./core"); -const draft7_1 = require("./vocabularies/draft7"); -const discriminator_1 = require("./vocabularies/discriminator"); -const draft7MetaSchema = require("./refs/json-schema-draft-07.json"); -const META_SUPPORT_DATA = ["/properties"]; -const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema"; -class Ajv extends core_1.default { - _addVocabularies() { - super._addVocabularies(); - draft7_1.default.forEach((v) => this.addVocabulary(v)); - if (this.opts.discriminator) - this.addKeyword(discriminator_1.default); - } - _addDefaultMetaSchema() { - super._addDefaultMetaSchema(); - if (!this.opts.meta) - return; - const metaSchema = this.opts.$data - ? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA) - : draft7MetaSchema; - this.addMetaSchema(metaSchema, META_SCHEMA_ID, false); - this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID; - } - defaultMeta() { - return (this.opts.defaultMeta = - super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); - } -} -exports.Ajv = Ajv; -module.exports = exports = Ajv; -module.exports.Ajv = Ajv; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = Ajv; -var validate_1 = require("./compile/validate"); -Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); -var codegen_1 = require("./compile/codegen"); -Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); -Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); -Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); -Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); -Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); -Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); -var validation_error_1 = require("./runtime/validation_error"); -Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } }); -var ref_error_1 = require("./compile/ref_error"); -Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } }); -//# sourceMappingURL=ajv.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/ajv.js.map b/node_modules/ajv/dist/ajv.js.map deleted file mode 100644 index 42c3edf..0000000 --- a/node_modules/ajv/dist/ajv.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ajv.js","sourceRoot":"","sources":["../lib/ajv.ts"],"names":[],"mappings":";;;AACA,iCAA4B;AAC5B,kDAAsD;AACtD,gEAAwD;AACxD,qEAAoE;AAEpE,MAAM,iBAAiB,GAAG,CAAC,aAAa,CAAC,CAAA;AAEzC,MAAM,cAAc,GAAG,wCAAwC,CAAA;AAE/D,MAAa,GAAI,SAAQ,cAAO;IAC9B,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,gBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QACxD,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,UAAU,CAAC,uBAAa,CAAC,CAAA;IAC7D,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAM;QAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK;YAChC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;YAC3D,CAAC,CAAC,gBAAgB,CAAA;QACpB,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,cAAc,EAAE,KAAK,CAAC,CAAA;QACrD,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,GAAG,cAAc,CAAA;IAC7D,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;YAC3B,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IACzF,CAAC;CACF;AArBD,kBAqBC;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,GAAG,CAAA;AAC9B,MAAM,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAA;AACxB,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,GAAG,CAAA;AA0BlB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAIlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA;AACnD,+DAAqE;AAA7D,mHAAA,OAAO,OAAmB;AAClC,iDAA8D;AAAtD,4GAAA,OAAO,OAAmB"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/codegen/code.d.ts b/node_modules/ajv/dist/compile/codegen/code.d.ts deleted file mode 100644 index a0220ad..0000000 --- a/node_modules/ajv/dist/compile/codegen/code.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -export declare abstract class _CodeOrName { - abstract readonly str: string; - abstract readonly names: UsedNames; - abstract toString(): string; - abstract emptyStr(): boolean; -} -export declare const IDENTIFIER: RegExp; -export declare class Name extends _CodeOrName { - readonly str: string; - constructor(s: string); - toString(): string; - emptyStr(): boolean; - get names(): UsedNames; -} -export declare class _Code extends _CodeOrName { - readonly _items: readonly CodeItem[]; - private _str?; - private _names?; - constructor(code: string | readonly CodeItem[]); - toString(): string; - emptyStr(): boolean; - get str(): string; - get names(): UsedNames; -} -export type CodeItem = Name | string | number | boolean | null; -export type UsedNames = Record; -export type Code = _Code | Name; -export type SafeExpr = Code | number | boolean | null; -export declare const nil: _Code; -type CodeArg = SafeExpr | string | undefined; -export declare function _(strs: TemplateStringsArray, ...args: CodeArg[]): _Code; -export declare function str(strs: TemplateStringsArray, ...args: (CodeArg | string[])[]): _Code; -export declare function addCodeArg(code: CodeItem[], arg: CodeArg | string[]): void; -export declare function strConcat(c1: Code, c2: Code): Code; -export declare function stringify(x: unknown): Code; -export declare function safeStringify(x: unknown): string; -export declare function getProperty(key: Code | string | number): Code; -export declare function getEsmExportName(key: Code | string | number): Code; -export declare function regexpCode(rx: RegExp): Code; -export {}; diff --git a/node_modules/ajv/dist/compile/codegen/code.js b/node_modules/ajv/dist/compile/codegen/code.js deleted file mode 100644 index f9ea525..0000000 --- a/node_modules/ajv/dist/compile/codegen/code.js +++ /dev/null @@ -1,156 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0; -// eslint-disable-next-line @typescript-eslint/no-extraneous-class -class _CodeOrName { -} -exports._CodeOrName = _CodeOrName; -exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; -class Name extends _CodeOrName { - constructor(s) { - super(); - if (!exports.IDENTIFIER.test(s)) - throw new Error("CodeGen: name must be a valid identifier"); - this.str = s; - } - toString() { - return this.str; - } - emptyStr() { - return false; - } - get names() { - return { [this.str]: 1 }; - } -} -exports.Name = Name; -class _Code extends _CodeOrName { - constructor(code) { - super(); - this._items = typeof code === "string" ? [code] : code; - } - toString() { - return this.str; - } - emptyStr() { - if (this._items.length > 1) - return false; - const item = this._items[0]; - return item === "" || item === '""'; - } - get str() { - var _a; - return ((_a = this._str) !== null && _a !== void 0 ? _a : (this._str = this._items.reduce((s, c) => `${s}${c}`, ""))); - } - get names() { - var _a; - return ((_a = this._names) !== null && _a !== void 0 ? _a : (this._names = this._items.reduce((names, c) => { - if (c instanceof Name) - names[c.str] = (names[c.str] || 0) + 1; - return names; - }, {}))); - } -} -exports._Code = _Code; -exports.nil = new _Code(""); -function _(strs, ...args) { - const code = [strs[0]]; - let i = 0; - while (i < args.length) { - addCodeArg(code, args[i]); - code.push(strs[++i]); - } - return new _Code(code); -} -exports._ = _; -const plus = new _Code("+"); -function str(strs, ...args) { - const expr = [safeStringify(strs[0])]; - let i = 0; - while (i < args.length) { - expr.push(plus); - addCodeArg(expr, args[i]); - expr.push(plus, safeStringify(strs[++i])); - } - optimize(expr); - return new _Code(expr); -} -exports.str = str; -function addCodeArg(code, arg) { - if (arg instanceof _Code) - code.push(...arg._items); - else if (arg instanceof Name) - code.push(arg); - else - code.push(interpolate(arg)); -} -exports.addCodeArg = addCodeArg; -function optimize(expr) { - let i = 1; - while (i < expr.length - 1) { - if (expr[i] === plus) { - const res = mergeExprItems(expr[i - 1], expr[i + 1]); - if (res !== undefined) { - expr.splice(i - 1, 3, res); - continue; - } - expr[i++] = "+"; - } - i++; - } -} -function mergeExprItems(a, b) { - if (b === '""') - return a; - if (a === '""') - return b; - if (typeof a == "string") { - if (b instanceof Name || a[a.length - 1] !== '"') - return; - if (typeof b != "string") - return `${a.slice(0, -1)}${b}"`; - if (b[0] === '"') - return a.slice(0, -1) + b.slice(1); - return; - } - if (typeof b == "string" && b[0] === '"' && !(a instanceof Name)) - return `"${a}${b.slice(1)}`; - return; -} -function strConcat(c1, c2) { - return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str `${c1}${c2}`; -} -exports.strConcat = strConcat; -// TODO do not allow arrays here -function interpolate(x) { - return typeof x == "number" || typeof x == "boolean" || x === null - ? x - : safeStringify(Array.isArray(x) ? x.join(",") : x); -} -function stringify(x) { - return new _Code(safeStringify(x)); -} -exports.stringify = stringify; -function safeStringify(x) { - return JSON.stringify(x) - .replace(/\u2028/g, "\\u2028") - .replace(/\u2029/g, "\\u2029"); -} -exports.safeStringify = safeStringify; -function getProperty(key) { - return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`; -} -exports.getProperty = getProperty; -//Does best effort to format the name properly -function getEsmExportName(key) { - if (typeof key == "string" && exports.IDENTIFIER.test(key)) { - return new _Code(`${key}`); - } - throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`); -} -exports.getEsmExportName = getEsmExportName; -function regexpCode(rx) { - return new _Code(rx.toString()); -} -exports.regexpCode = regexpCode; -//# sourceMappingURL=code.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/codegen/code.js.map b/node_modules/ajv/dist/compile/codegen/code.js.map deleted file mode 100644 index 2fe66c1..0000000 --- a/node_modules/ajv/dist/compile/codegen/code.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"code.js","sourceRoot":"","sources":["../../../lib/compile/codegen/code.ts"],"names":[],"mappings":";;;AAAA,kEAAkE;AAClE,MAAsB,WAAW;CAKhC;AALD,kCAKC;AAEY,QAAA,UAAU,GAAG,uBAAuB,CAAA;AAEjD,MAAa,IAAK,SAAQ,WAAW;IAEnC,YAAY,CAAS;QACnB,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,kBAAU,CAAC,IAAI,CAAC,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;QACpF,IAAI,CAAC,GAAG,GAAG,CAAC,CAAA;IACd,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,GAAG,CAAA;IACjB,CAAC;IAED,QAAQ;QACN,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,KAAK;QACP,OAAO,EAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAC,CAAA;IACxB,CAAC;CACF;AAnBD,oBAmBC;AAED,MAAa,KAAM,SAAQ,WAAW;IAKpC,YAAY,IAAkC;QAC5C,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,MAAM,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACxD,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,GAAG,CAAA;IACjB,CAAC;IAED,QAAQ;QACN,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,KAAK,CAAA;QACxC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAC3B,OAAO,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,IAAI,CAAA;IACrC,CAAC;IAED,IAAI,GAAG;;QACL,OAAO,OAAC,IAAI,CAAC,IAAI,oCAAT,IAAI,CAAC,IAAI,GAAK,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAS,EAAE,CAAW,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,EAAC,CAAA;IACvF,CAAC;IAED,IAAI,KAAK;;QACP,OAAO,OAAC,IAAI,CAAC,MAAM,oCAAX,IAAI,CAAC,MAAM,GAAK,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAgB,EAAE,CAAC,EAAE,EAAE;YACjE,IAAI,CAAC,YAAY,IAAI;gBAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA;YAC7D,OAAO,KAAK,CAAA;QACd,CAAC,EAAE,EAAE,CAAC,EAAC,CAAA;IACT,CAAC;CACF;AA9BD,sBA8BC;AAUY,QAAA,GAAG,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAA;AAIhC,SAAgB,CAAC,CAAC,IAA0B,EAAE,GAAG,IAAe;IAC9D,MAAM,IAAI,GAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;IAClC,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;QACzB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IACtB,CAAC;IACD,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,CAAA;AACxB,CAAC;AARD,cAQC;AAED,MAAM,IAAI,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;AAE3B,SAAgB,GAAG,CAAC,IAA0B,EAAE,GAAG,IAA4B;IAC7E,MAAM,IAAI,GAAe,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACjD,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACf,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;QACzB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3C,CAAC;IACD,QAAQ,CAAC,IAAI,CAAC,CAAA;IACd,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,CAAA;AACxB,CAAC;AAVD,kBAUC;AAED,SAAgB,UAAU,CAAC,IAAgB,EAAE,GAAuB;IAClE,IAAI,GAAG,YAAY,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;SAC7C,IAAI,GAAG,YAAY,IAAI;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;;QACvC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;AAClC,CAAC;AAJD,gCAIC;AAED,SAAS,QAAQ,CAAC,IAAgB;IAChC,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACrB,MAAM,GAAG,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;YACpD,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;gBACtB,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAA;gBAC1B,SAAQ;YACV,CAAC;YACD,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,CAAA;QACjB,CAAC;QACD,CAAC,EAAE,CAAA;IACL,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,CAAW,EAAE,CAAW;IAC9C,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,CAAC,CAAA;IACxB,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,CAAC,CAAA;IACxB,IAAI,OAAO,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG;YAAE,OAAM;QACxD,IAAI,OAAO,CAAC,IAAI,QAAQ;YAAE,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAA;QACzD,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG;YAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QACpD,OAAM;IACR,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IAC7F,OAAM;AACR,CAAC;AAED,SAAgB,SAAS,CAAC,EAAQ,EAAE,EAAQ;IAC1C,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA,GAAG,EAAE,GAAG,EAAE,EAAE,CAAA;AAClE,CAAC;AAFD,8BAEC;AAED,gCAAgC;AAChC,SAAS,WAAW,CAAC,CAA+C;IAClE,OAAO,OAAO,CAAC,IAAI,QAAQ,IAAI,OAAO,CAAC,IAAI,SAAS,IAAI,CAAC,KAAK,IAAI;QAChE,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACvD,CAAC;AAED,SAAgB,SAAS,CAAC,CAAU;IAClC,OAAO,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;AACpC,CAAC;AAFD,8BAEC;AAED,SAAgB,aAAa,CAAC,CAAU;IACtC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC;SAC7B,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;AAClC,CAAC;AAJD,sCAIC;AAED,SAAgB,WAAW,CAAC,GAA2B;IACrD,OAAO,OAAO,GAAG,IAAI,QAAQ,IAAI,kBAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,IAAI,GAAG,GAAG,CAAA;AAC5F,CAAC;AAFD,kCAEC;AAED,8CAA8C;AAC9C,SAAgB,gBAAgB,CAAC,GAA2B;IAC1D,IAAI,OAAO,GAAG,IAAI,QAAQ,IAAI,kBAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACnD,OAAO,IAAI,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,CAAA;IAC5B,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,iCAAiC,GAAG,iCAAiC,CAAC,CAAA;AACxF,CAAC;AALD,4CAKC;AAED,SAAgB,UAAU,CAAC,EAAU;IACnC,OAAO,IAAI,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAA;AACjC,CAAC;AAFD,gCAEC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/codegen/index.d.ts b/node_modules/ajv/dist/compile/codegen/index.d.ts deleted file mode 100644 index d586a4b..0000000 --- a/node_modules/ajv/dist/compile/codegen/index.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -import type { ScopeValueSets, NameValue, ValueScope, ValueScopeName } from "./scope"; -import { _Code, Code, Name } from "./code"; -import { Scope } from "./scope"; -export { _, str, strConcat, nil, getProperty, stringify, regexpCode, Name, Code } from "./code"; -export { Scope, ScopeStore, ValueScope, ValueScopeName, ScopeValueSets, varKinds } from "./scope"; -export type SafeExpr = Code | number | boolean | null; -export type Block = Code | (() => void); -export declare const operators: { - GT: _Code; - GTE: _Code; - LT: _Code; - LTE: _Code; - EQ: _Code; - NEQ: _Code; - NOT: _Code; - OR: _Code; - AND: _Code; - ADD: _Code; -}; -export interface CodeGenOptions { - es5?: boolean; - lines?: boolean; - ownProperties?: boolean; -} -export declare class CodeGen { - readonly _scope: Scope; - readonly _extScope: ValueScope; - readonly _values: ScopeValueSets; - private readonly _nodes; - private readonly _blockStarts; - private readonly _constants; - private readonly opts; - constructor(extScope: ValueScope, opts?: CodeGenOptions); - toString(): string; - name(prefix: string): Name; - scopeName(prefix: string): ValueScopeName; - scopeValue(prefixOrName: ValueScopeName | string, value: NameValue): Name; - getScopeValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined; - scopeRefs(scopeName: Name): Code; - scopeCode(): Code; - private _def; - const(nameOrPrefix: Name | string, rhs: SafeExpr, _constant?: boolean): Name; - let(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name; - var(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name; - assign(lhs: Code, rhs: SafeExpr, sideEffects?: boolean): CodeGen; - add(lhs: Code, rhs: SafeExpr): CodeGen; - code(c: Block | SafeExpr): CodeGen; - object(...keyValues: [Name | string, SafeExpr | string][]): _Code; - if(condition: Code | boolean, thenBody?: Block, elseBody?: Block): CodeGen; - elseIf(condition: Code | boolean): CodeGen; - else(): CodeGen; - endIf(): CodeGen; - private _for; - for(iteration: Code, forBody?: Block): CodeGen; - forRange(nameOrPrefix: Name | string, from: SafeExpr, to: SafeExpr, forBody: (index: Name) => void, varKind?: Code): CodeGen; - forOf(nameOrPrefix: Name | string, iterable: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen; - forIn(nameOrPrefix: Name | string, obj: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen; - endFor(): CodeGen; - label(label: Name): CodeGen; - break(label?: Code): CodeGen; - return(value: Block | SafeExpr): CodeGen; - try(tryBody: Block, catchCode?: (e: Name) => void, finallyCode?: Block): CodeGen; - throw(error: Code): CodeGen; - block(body?: Block, nodeCount?: number): CodeGen; - endBlock(nodeCount?: number): CodeGen; - func(name: Name, args?: Code, async?: boolean, funcBody?: Block): CodeGen; - endFunc(): CodeGen; - optimize(n?: number): void; - private _leafNode; - private _blockNode; - private _endBlockNode; - private _elseNode; - private get _root(); - private get _currNode(); - private set _currNode(value); -} -export declare function not(x: T): T; -export declare function and(...args: Code[]): Code; -export declare function or(...args: Code[]): Code; diff --git a/node_modules/ajv/dist/compile/codegen/index.js b/node_modules/ajv/dist/compile/codegen/index.js deleted file mode 100644 index a6c805a..0000000 --- a/node_modules/ajv/dist/compile/codegen/index.js +++ /dev/null @@ -1,697 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0; -const code_1 = require("./code"); -const scope_1 = require("./scope"); -var code_2 = require("./code"); -Object.defineProperty(exports, "_", { enumerable: true, get: function () { return code_2._; } }); -Object.defineProperty(exports, "str", { enumerable: true, get: function () { return code_2.str; } }); -Object.defineProperty(exports, "strConcat", { enumerable: true, get: function () { return code_2.strConcat; } }); -Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return code_2.nil; } }); -Object.defineProperty(exports, "getProperty", { enumerable: true, get: function () { return code_2.getProperty; } }); -Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return code_2.stringify; } }); -Object.defineProperty(exports, "regexpCode", { enumerable: true, get: function () { return code_2.regexpCode; } }); -Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return code_2.Name; } }); -var scope_2 = require("./scope"); -Object.defineProperty(exports, "Scope", { enumerable: true, get: function () { return scope_2.Scope; } }); -Object.defineProperty(exports, "ValueScope", { enumerable: true, get: function () { return scope_2.ValueScope; } }); -Object.defineProperty(exports, "ValueScopeName", { enumerable: true, get: function () { return scope_2.ValueScopeName; } }); -Object.defineProperty(exports, "varKinds", { enumerable: true, get: function () { return scope_2.varKinds; } }); -exports.operators = { - GT: new code_1._Code(">"), - GTE: new code_1._Code(">="), - LT: new code_1._Code("<"), - LTE: new code_1._Code("<="), - EQ: new code_1._Code("==="), - NEQ: new code_1._Code("!=="), - NOT: new code_1._Code("!"), - OR: new code_1._Code("||"), - AND: new code_1._Code("&&"), - ADD: new code_1._Code("+"), -}; -class Node { - optimizeNodes() { - return this; - } - optimizeNames(_names, _constants) { - return this; - } -} -class Def extends Node { - constructor(varKind, name, rhs) { - super(); - this.varKind = varKind; - this.name = name; - this.rhs = rhs; - } - render({ es5, _n }) { - const varKind = es5 ? scope_1.varKinds.var : this.varKind; - const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}`; - return `${varKind} ${this.name}${rhs};` + _n; - } - optimizeNames(names, constants) { - if (!names[this.name.str]) - return; - if (this.rhs) - this.rhs = optimizeExpr(this.rhs, names, constants); - return this; - } - get names() { - return this.rhs instanceof code_1._CodeOrName ? this.rhs.names : {}; - } -} -class Assign extends Node { - constructor(lhs, rhs, sideEffects) { - super(); - this.lhs = lhs; - this.rhs = rhs; - this.sideEffects = sideEffects; - } - render({ _n }) { - return `${this.lhs} = ${this.rhs};` + _n; - } - optimizeNames(names, constants) { - if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects) - return; - this.rhs = optimizeExpr(this.rhs, names, constants); - return this; - } - get names() { - const names = this.lhs instanceof code_1.Name ? {} : { ...this.lhs.names }; - return addExprNames(names, this.rhs); - } -} -class AssignOp extends Assign { - constructor(lhs, op, rhs, sideEffects) { - super(lhs, rhs, sideEffects); - this.op = op; - } - render({ _n }) { - return `${this.lhs} ${this.op}= ${this.rhs};` + _n; - } -} -class Label extends Node { - constructor(label) { - super(); - this.label = label; - this.names = {}; - } - render({ _n }) { - return `${this.label}:` + _n; - } -} -class Break extends Node { - constructor(label) { - super(); - this.label = label; - this.names = {}; - } - render({ _n }) { - const label = this.label ? ` ${this.label}` : ""; - return `break${label};` + _n; - } -} -class Throw extends Node { - constructor(error) { - super(); - this.error = error; - } - render({ _n }) { - return `throw ${this.error};` + _n; - } - get names() { - return this.error.names; - } -} -class AnyCode extends Node { - constructor(code) { - super(); - this.code = code; - } - render({ _n }) { - return `${this.code};` + _n; - } - optimizeNodes() { - return `${this.code}` ? this : undefined; - } - optimizeNames(names, constants) { - this.code = optimizeExpr(this.code, names, constants); - return this; - } - get names() { - return this.code instanceof code_1._CodeOrName ? this.code.names : {}; - } -} -class ParentNode extends Node { - constructor(nodes = []) { - super(); - this.nodes = nodes; - } - render(opts) { - return this.nodes.reduce((code, n) => code + n.render(opts), ""); - } - optimizeNodes() { - const { nodes } = this; - let i = nodes.length; - while (i--) { - const n = nodes[i].optimizeNodes(); - if (Array.isArray(n)) - nodes.splice(i, 1, ...n); - else if (n) - nodes[i] = n; - else - nodes.splice(i, 1); - } - return nodes.length > 0 ? this : undefined; - } - optimizeNames(names, constants) { - const { nodes } = this; - let i = nodes.length; - while (i--) { - // iterating backwards improves 1-pass optimization - const n = nodes[i]; - if (n.optimizeNames(names, constants)) - continue; - subtractNames(names, n.names); - nodes.splice(i, 1); - } - return nodes.length > 0 ? this : undefined; - } - get names() { - return this.nodes.reduce((names, n) => addNames(names, n.names), {}); - } -} -class BlockNode extends ParentNode { - render(opts) { - return "{" + opts._n + super.render(opts) + "}" + opts._n; - } -} -class Root extends ParentNode { -} -class Else extends BlockNode { -} -Else.kind = "else"; -class If extends BlockNode { - constructor(condition, nodes) { - super(nodes); - this.condition = condition; - } - render(opts) { - let code = `if(${this.condition})` + super.render(opts); - if (this.else) - code += "else " + this.else.render(opts); - return code; - } - optimizeNodes() { - super.optimizeNodes(); - const cond = this.condition; - if (cond === true) - return this.nodes; // else is ignored here - let e = this.else; - if (e) { - const ns = e.optimizeNodes(); - e = this.else = Array.isArray(ns) ? new Else(ns) : ns; - } - if (e) { - if (cond === false) - return e instanceof If ? e : e.nodes; - if (this.nodes.length) - return this; - return new If(not(cond), e instanceof If ? [e] : e.nodes); - } - if (cond === false || !this.nodes.length) - return undefined; - return this; - } - optimizeNames(names, constants) { - var _a; - this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants); - if (!(super.optimizeNames(names, constants) || this.else)) - return; - this.condition = optimizeExpr(this.condition, names, constants); - return this; - } - get names() { - const names = super.names; - addExprNames(names, this.condition); - if (this.else) - addNames(names, this.else.names); - return names; - } -} -If.kind = "if"; -class For extends BlockNode { -} -For.kind = "for"; -class ForLoop extends For { - constructor(iteration) { - super(); - this.iteration = iteration; - } - render(opts) { - return `for(${this.iteration})` + super.render(opts); - } - optimizeNames(names, constants) { - if (!super.optimizeNames(names, constants)) - return; - this.iteration = optimizeExpr(this.iteration, names, constants); - return this; - } - get names() { - return addNames(super.names, this.iteration.names); - } -} -class ForRange extends For { - constructor(varKind, name, from, to) { - super(); - this.varKind = varKind; - this.name = name; - this.from = from; - this.to = to; - } - render(opts) { - const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind; - const { name, from, to } = this; - return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts); - } - get names() { - const names = addExprNames(super.names, this.from); - return addExprNames(names, this.to); - } -} -class ForIter extends For { - constructor(loop, varKind, name, iterable) { - super(); - this.loop = loop; - this.varKind = varKind; - this.name = name; - this.iterable = iterable; - } - render(opts) { - return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts); - } - optimizeNames(names, constants) { - if (!super.optimizeNames(names, constants)) - return; - this.iterable = optimizeExpr(this.iterable, names, constants); - return this; - } - get names() { - return addNames(super.names, this.iterable.names); - } -} -class Func extends BlockNode { - constructor(name, args, async) { - super(); - this.name = name; - this.args = args; - this.async = async; - } - render(opts) { - const _async = this.async ? "async " : ""; - return `${_async}function ${this.name}(${this.args})` + super.render(opts); - } -} -Func.kind = "func"; -class Return extends ParentNode { - render(opts) { - return "return " + super.render(opts); - } -} -Return.kind = "return"; -class Try extends BlockNode { - render(opts) { - let code = "try" + super.render(opts); - if (this.catch) - code += this.catch.render(opts); - if (this.finally) - code += this.finally.render(opts); - return code; - } - optimizeNodes() { - var _a, _b; - super.optimizeNodes(); - (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNodes(); - (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes(); - return this; - } - optimizeNames(names, constants) { - var _a, _b; - super.optimizeNames(names, constants); - (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants); - (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants); - return this; - } - get names() { - const names = super.names; - if (this.catch) - addNames(names, this.catch.names); - if (this.finally) - addNames(names, this.finally.names); - return names; - } -} -class Catch extends BlockNode { - constructor(error) { - super(); - this.error = error; - } - render(opts) { - return `catch(${this.error})` + super.render(opts); - } -} -Catch.kind = "catch"; -class Finally extends BlockNode { - render(opts) { - return "finally" + super.render(opts); - } -} -Finally.kind = "finally"; -class CodeGen { - constructor(extScope, opts = {}) { - this._values = {}; - this._blockStarts = []; - this._constants = {}; - this.opts = { ...opts, _n: opts.lines ? "\n" : "" }; - this._extScope = extScope; - this._scope = new scope_1.Scope({ parent: extScope }); - this._nodes = [new Root()]; - } - toString() { - return this._root.render(this.opts); - } - // returns unique name in the internal scope - name(prefix) { - return this._scope.name(prefix); - } - // reserves unique name in the external scope - scopeName(prefix) { - return this._extScope.name(prefix); - } - // reserves unique name in the external scope and assigns value to it - scopeValue(prefixOrName, value) { - const name = this._extScope.value(prefixOrName, value); - const vs = this._values[name.prefix] || (this._values[name.prefix] = new Set()); - vs.add(name); - return name; - } - getScopeValue(prefix, keyOrRef) { - return this._extScope.getValue(prefix, keyOrRef); - } - // return code that assigns values in the external scope to the names that are used internally - // (same names that were returned by gen.scopeName or gen.scopeValue) - scopeRefs(scopeName) { - return this._extScope.scopeRefs(scopeName, this._values); - } - scopeCode() { - return this._extScope.scopeCode(this._values); - } - _def(varKind, nameOrPrefix, rhs, constant) { - const name = this._scope.toName(nameOrPrefix); - if (rhs !== undefined && constant) - this._constants[name.str] = rhs; - this._leafNode(new Def(varKind, name, rhs)); - return name; - } - // `const` declaration (`var` in es5 mode) - const(nameOrPrefix, rhs, _constant) { - return this._def(scope_1.varKinds.const, nameOrPrefix, rhs, _constant); - } - // `let` declaration with optional assignment (`var` in es5 mode) - let(nameOrPrefix, rhs, _constant) { - return this._def(scope_1.varKinds.let, nameOrPrefix, rhs, _constant); - } - // `var` declaration with optional assignment - var(nameOrPrefix, rhs, _constant) { - return this._def(scope_1.varKinds.var, nameOrPrefix, rhs, _constant); - } - // assignment code - assign(lhs, rhs, sideEffects) { - return this._leafNode(new Assign(lhs, rhs, sideEffects)); - } - // `+=` code - add(lhs, rhs) { - return this._leafNode(new AssignOp(lhs, exports.operators.ADD, rhs)); - } - // appends passed SafeExpr to code or executes Block - code(c) { - if (typeof c == "function") - c(); - else if (c !== code_1.nil) - this._leafNode(new AnyCode(c)); - return this; - } - // returns code for object literal for the passed argument list of key-value pairs - object(...keyValues) { - const code = ["{"]; - for (const [key, value] of keyValues) { - if (code.length > 1) - code.push(","); - code.push(key); - if (key !== value || this.opts.es5) { - code.push(":"); - (0, code_1.addCodeArg)(code, value); - } - } - code.push("}"); - return new code_1._Code(code); - } - // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed) - if(condition, thenBody, elseBody) { - this._blockNode(new If(condition)); - if (thenBody && elseBody) { - this.code(thenBody).else().code(elseBody).endIf(); - } - else if (thenBody) { - this.code(thenBody).endIf(); - } - else if (elseBody) { - throw new Error('CodeGen: "else" body without "then" body'); - } - return this; - } - // `else if` clause - invalid without `if` or after `else` clauses - elseIf(condition) { - return this._elseNode(new If(condition)); - } - // `else` clause - only valid after `if` or `else if` clauses - else() { - return this._elseNode(new Else()); - } - // end `if` statement (needed if gen.if was used only with condition) - endIf() { - return this._endBlockNode(If, Else); - } - _for(node, forBody) { - this._blockNode(node); - if (forBody) - this.code(forBody).endFor(); - return this; - } - // a generic `for` clause (or statement if `forBody` is passed) - for(iteration, forBody) { - return this._for(new ForLoop(iteration), forBody); - } - // `for` statement for a range of values - forRange(nameOrPrefix, from, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) { - const name = this._scope.toName(nameOrPrefix); - return this._for(new ForRange(varKind, name, from, to), () => forBody(name)); - } - // `for-of` statement (in es5 mode replace with a normal for loop) - forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) { - const name = this._scope.toName(nameOrPrefix); - if (this.opts.es5) { - const arr = iterable instanceof code_1.Name ? iterable : this.var("_arr", iterable); - return this.forRange("_i", 0, (0, code_1._) `${arr}.length`, (i) => { - this.var(name, (0, code_1._) `${arr}[${i}]`); - forBody(name); - }); - } - return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name)); - } - // `for-in` statement. - // With option `ownProperties` replaced with a `for-of` loop for object keys - forIn(nameOrPrefix, obj, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.const) { - if (this.opts.ownProperties) { - return this.forOf(nameOrPrefix, (0, code_1._) `Object.keys(${obj})`, forBody); - } - const name = this._scope.toName(nameOrPrefix); - return this._for(new ForIter("in", varKind, name, obj), () => forBody(name)); - } - // end `for` loop - endFor() { - return this._endBlockNode(For); - } - // `label` statement - label(label) { - return this._leafNode(new Label(label)); - } - // `break` statement - break(label) { - return this._leafNode(new Break(label)); - } - // `return` statement - return(value) { - const node = new Return(); - this._blockNode(node); - this.code(value); - if (node.nodes.length !== 1) - throw new Error('CodeGen: "return" should have one node'); - return this._endBlockNode(Return); - } - // `try` statement - try(tryBody, catchCode, finallyCode) { - if (!catchCode && !finallyCode) - throw new Error('CodeGen: "try" without "catch" and "finally"'); - const node = new Try(); - this._blockNode(node); - this.code(tryBody); - if (catchCode) { - const error = this.name("e"); - this._currNode = node.catch = new Catch(error); - catchCode(error); - } - if (finallyCode) { - this._currNode = node.finally = new Finally(); - this.code(finallyCode); - } - return this._endBlockNode(Catch, Finally); - } - // `throw` statement - throw(error) { - return this._leafNode(new Throw(error)); - } - // start self-balancing block - block(body, nodeCount) { - this._blockStarts.push(this._nodes.length); - if (body) - this.code(body).endBlock(nodeCount); - return this; - } - // end the current self-balancing block - endBlock(nodeCount) { - const len = this._blockStarts.pop(); - if (len === undefined) - throw new Error("CodeGen: not in self-balancing block"); - const toClose = this._nodes.length - len; - if (toClose < 0 || (nodeCount !== undefined && toClose !== nodeCount)) { - throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`); - } - this._nodes.length = len; - return this; - } - // `function` heading (or definition if funcBody is passed) - func(name, args = code_1.nil, async, funcBody) { - this._blockNode(new Func(name, args, async)); - if (funcBody) - this.code(funcBody).endFunc(); - return this; - } - // end function definition - endFunc() { - return this._endBlockNode(Func); - } - optimize(n = 1) { - while (n-- > 0) { - this._root.optimizeNodes(); - this._root.optimizeNames(this._root.names, this._constants); - } - } - _leafNode(node) { - this._currNode.nodes.push(node); - return this; - } - _blockNode(node) { - this._currNode.nodes.push(node); - this._nodes.push(node); - } - _endBlockNode(N1, N2) { - const n = this._currNode; - if (n instanceof N1 || (N2 && n instanceof N2)) { - this._nodes.pop(); - return this; - } - throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`); - } - _elseNode(node) { - const n = this._currNode; - if (!(n instanceof If)) { - throw new Error('CodeGen: "else" without "if"'); - } - this._currNode = n.else = node; - return this; - } - get _root() { - return this._nodes[0]; - } - get _currNode() { - const ns = this._nodes; - return ns[ns.length - 1]; - } - set _currNode(node) { - const ns = this._nodes; - ns[ns.length - 1] = node; - } -} -exports.CodeGen = CodeGen; -function addNames(names, from) { - for (const n in from) - names[n] = (names[n] || 0) + (from[n] || 0); - return names; -} -function addExprNames(names, from) { - return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names; -} -function optimizeExpr(expr, names, constants) { - if (expr instanceof code_1.Name) - return replaceName(expr); - if (!canOptimize(expr)) - return expr; - return new code_1._Code(expr._items.reduce((items, c) => { - if (c instanceof code_1.Name) - c = replaceName(c); - if (c instanceof code_1._Code) - items.push(...c._items); - else - items.push(c); - return items; - }, [])); - function replaceName(n) { - const c = constants[n.str]; - if (c === undefined || names[n.str] !== 1) - return n; - delete names[n.str]; - return c; - } - function canOptimize(e) { - return (e instanceof code_1._Code && - e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants[c.str] !== undefined)); - } -} -function subtractNames(names, from) { - for (const n in from) - names[n] = (names[n] || 0) - (from[n] || 0); -} -function not(x) { - return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._) `!${par(x)}`; -} -exports.not = not; -const andCode = mappend(exports.operators.AND); -// boolean AND (&&) expression with the passed arguments -function and(...args) { - return args.reduce(andCode); -} -exports.and = and; -const orCode = mappend(exports.operators.OR); -// boolean OR (||) expression with the passed arguments -function or(...args) { - return args.reduce(orCode); -} -exports.or = or; -function mappend(op) { - return (x, y) => (x === code_1.nil ? y : y === code_1.nil ? x : (0, code_1._) `${par(x)} ${op} ${par(y)}`); -} -function par(x) { - return x instanceof code_1.Name ? x : (0, code_1._) `(${x})`; -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/codegen/index.js.map b/node_modules/ajv/dist/compile/codegen/index.js.map deleted file mode 100644 index baef9cf..0000000 --- a/node_modules/ajv/dist/compile/codegen/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/compile/codegen/index.ts"],"names":[],"mappings":";;;AACA,iCAA8F;AAC9F,mCAAuC;AAEvC,+BAA6F;AAArF,yFAAA,CAAC,OAAA;AAAE,2FAAA,GAAG,OAAA;AAAE,iGAAA,SAAS,OAAA;AAAE,2FAAA,GAAG,OAAA;AAAE,mGAAA,WAAW,OAAA;AAAE,iGAAA,SAAS,OAAA;AAAE,kGAAA,UAAU,OAAA;AAAE,4FAAA,IAAI,OAAA;AACxE,iCAA+F;AAAvF,8FAAA,KAAK,OAAA;AAAc,mGAAA,UAAU,OAAA;AAAE,uGAAA,cAAc,OAAA;AAAkB,iGAAA,QAAQ,OAAA;AAQlE,QAAA,SAAS,GAAG;IACvB,EAAE,EAAE,IAAI,YAAK,CAAC,GAAG,CAAC;IAClB,GAAG,EAAE,IAAI,YAAK,CAAC,IAAI,CAAC;IACpB,EAAE,EAAE,IAAI,YAAK,CAAC,GAAG,CAAC;IAClB,GAAG,EAAE,IAAI,YAAK,CAAC,IAAI,CAAC;IACpB,EAAE,EAAE,IAAI,YAAK,CAAC,KAAK,CAAC;IACpB,GAAG,EAAE,IAAI,YAAK,CAAC,KAAK,CAAC;IACrB,GAAG,EAAE,IAAI,YAAK,CAAC,GAAG,CAAC;IACnB,EAAE,EAAE,IAAI,YAAK,CAAC,IAAI,CAAC;IACnB,GAAG,EAAE,IAAI,YAAK,CAAC,IAAI,CAAC;IACpB,GAAG,EAAE,IAAI,YAAK,CAAC,GAAG,CAAC;CACpB,CAAA;AAED,MAAe,IAAI;IAGjB,aAAa;QACX,OAAO,IAAI,CAAA;IACb,CAAC;IAED,aAAa,CAAC,MAAiB,EAAE,UAAqB;QACpD,OAAO,IAAI,CAAA;IACb,CAAC;CAKF;AAED,MAAM,GAAI,SAAQ,IAAI;IACpB,YACmB,OAAa,EACb,IAAU,EACnB,GAAc;QAEtB,KAAK,EAAE,CAAA;QAJU,YAAO,GAAP,OAAO,CAAM;QACb,SAAI,GAAJ,IAAI,CAAM;QACnB,QAAG,GAAH,GAAG,CAAW;IAGxB,CAAC;IAED,MAAM,CAAC,EAAC,GAAG,EAAE,EAAE,EAAY;QACzB,MAAM,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,gBAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAA;QACjD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,CAAA;QAC1D,OAAO,GAAG,OAAO,IAAI,IAAI,CAAC,IAAI,GAAG,GAAG,GAAG,GAAG,EAAE,CAAA;IAC9C,CAAC;IAED,aAAa,CAAC,KAAgB,EAAE,SAAoB;QAClD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,OAAM;QACjC,IAAI,IAAI,CAAC,GAAG;YAAE,IAAI,CAAC,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;QACjE,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,GAAG,YAAY,kBAAW,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IAC9D,CAAC;CACF;AAED,MAAM,MAAO,SAAQ,IAAI;IACvB,YACW,GAAS,EACX,GAAa,EACH,WAAqB;QAEtC,KAAK,EAAE,CAAA;QAJE,QAAG,GAAH,GAAG,CAAM;QACX,QAAG,GAAH,GAAG,CAAU;QACH,gBAAW,GAAX,WAAW,CAAU;IAGxC,CAAC;IAED,MAAM,CAAC,EAAC,EAAE,EAAY;QACpB,OAAO,GAAG,IAAI,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG,GAAG,GAAG,EAAE,CAAA;IAC1C,CAAC;IAED,aAAa,CAAC,KAAgB,EAAE,SAAoB;QAClD,IAAI,IAAI,CAAC,GAAG,YAAY,WAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;YAAE,OAAM;QACjF,IAAI,CAAC,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;QACnD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,KAAK;QACP,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,YAAY,WAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAC,CAAA;QACjE,OAAO,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;IACtC,CAAC;CACF;AAED,MAAM,QAAS,SAAQ,MAAM;IAC3B,YACE,GAAS,EACQ,EAAQ,EACzB,GAAa,EACb,WAAqB;QAErB,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,CAAC,CAAA;QAJX,OAAE,GAAF,EAAE,CAAM;IAK3B,CAAC;IAED,MAAM,CAAC,EAAC,EAAE,EAAY;QACpB,OAAO,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,GAAG,GAAG,GAAG,EAAE,CAAA;IACpD,CAAC;CACF;AAED,MAAM,KAAM,SAAQ,IAAI;IAEtB,YAAqB,KAAW;QAC9B,KAAK,EAAE,CAAA;QADY,UAAK,GAAL,KAAK,CAAM;QADvB,UAAK,GAAc,EAAE,CAAA;IAG9B,CAAC;IAED,MAAM,CAAC,EAAC,EAAE,EAAY;QACpB,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG,GAAG,EAAE,CAAA;IAC9B,CAAC;CACF;AAED,MAAM,KAAM,SAAQ,IAAI;IAEtB,YAAqB,KAAY;QAC/B,KAAK,EAAE,CAAA;QADY,UAAK,GAAL,KAAK,CAAO;QADxB,UAAK,GAAc,EAAE,CAAA;IAG9B,CAAC;IAED,MAAM,CAAC,EAAC,EAAE,EAAY;QACpB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;QAChD,OAAO,QAAQ,KAAK,GAAG,GAAG,EAAE,CAAA;IAC9B,CAAC;CACF;AAED,MAAM,KAAM,SAAQ,IAAI;IACtB,YAAqB,KAAW;QAC9B,KAAK,EAAE,CAAA;QADY,UAAK,GAAL,KAAK,CAAM;IAEhC,CAAC;IAED,MAAM,CAAC,EAAC,EAAE,EAAY;QACpB,OAAO,SAAS,IAAI,CAAC,KAAK,GAAG,GAAG,EAAE,CAAA;IACpC,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAA;IACzB,CAAC;CACF;AAED,MAAM,OAAQ,SAAQ,IAAI;IACxB,YAAoB,IAAc;QAChC,KAAK,EAAE,CAAA;QADW,SAAI,GAAJ,IAAI,CAAU;IAElC,CAAC;IAED,MAAM,CAAC,EAAC,EAAE,EAAY;QACpB,OAAO,GAAG,IAAI,CAAC,IAAI,GAAG,GAAG,EAAE,CAAA;IAC7B,CAAC;IAED,aAAa;QACX,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;IAC1C,CAAC;IAED,aAAa,CAAC,KAAgB,EAAE,SAAoB;QAClD,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;QACrD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,IAAI,YAAY,kBAAW,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IAChE,CAAC;CACF;AAED,MAAe,UAAW,SAAQ,IAAI;IACpC,YAAqB,QAAqB,EAAE;QAC1C,KAAK,EAAE,CAAA;QADY,UAAK,GAAL,KAAK,CAAkB;IAE5C,CAAC;IAED,MAAM,CAAC,IAAe;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAA;IAClE,CAAC;IAED,aAAa;QACX,MAAM,EAAC,KAAK,EAAC,GAAG,IAAI,CAAA;QACpB,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAA;QACpB,OAAO,CAAC,EAAE,EAAE,CAAC;YACX,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAA;YAClC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;gBAAE,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;iBACzC,IAAI,CAAC;gBAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;;gBACnB,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QACzB,CAAC;QACD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;IAC5C,CAAC;IAED,aAAa,CAAC,KAAgB,EAAE,SAAoB;QAClD,MAAM,EAAC,KAAK,EAAC,GAAG,IAAI,CAAA;QACpB,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAA;QACpB,OAAO,CAAC,EAAE,EAAE,CAAC;YACX,mDAAmD;YACnD,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;YAClB,IAAI,CAAC,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC;gBAAE,SAAQ;YAC/C,aAAa,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAA;YAC7B,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QACpB,CAAC;QACD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;IAC5C,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAgB,EAAE,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA;IACjF,CAAC;CAKF;AAED,MAAe,SAAU,SAAQ,UAAU;IACzC,MAAM,CAAC,IAAe;QACpB,OAAO,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAA;IAC3D,CAAC;CACF;AAED,MAAM,IAAK,SAAQ,UAAU;CAAG;AAEhC,MAAM,IAAK,SAAQ,SAAS;;AACV,SAAI,GAAG,MAAM,CAAA;AAG/B,MAAM,EAAG,SAAQ,SAAS;IAGxB,YACU,SAAyB,EACjC,KAAmB;QAEnB,KAAK,CAAC,KAAK,CAAC,CAAA;QAHJ,cAAS,GAAT,SAAS,CAAgB;IAInC,CAAC;IAED,MAAM,CAAC,IAAe;QACpB,IAAI,IAAI,GAAG,MAAM,IAAI,CAAC,SAAS,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACvD,IAAI,IAAI,CAAC,IAAI;YAAE,IAAI,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACvD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,aAAa;QACX,KAAK,CAAC,aAAa,EAAE,CAAA;QACrB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAA;QAC3B,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC,KAAK,CAAA,CAAC,uBAAuB;QAC5D,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAA;QACjB,IAAI,CAAC,EAAE,CAAC;YACN,MAAM,EAAE,GAAG,CAAC,CAAC,aAAa,EAAE,CAAA;YAC5B,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,EAAuB,CAAA;QAC7E,CAAC;QACD,IAAI,CAAC,EAAE,CAAC;YACN,IAAI,IAAI,KAAK,KAAK;gBAAE,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;YACxD,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAA;YAClC,OAAO,IAAI,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;QAC3D,CAAC;QACD,IAAI,IAAI,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,OAAO,SAAS,CAAA;QAC1D,OAAO,IAAI,CAAA;IACb,CAAC;IAED,aAAa,CAAC,KAAgB,EAAE,SAAoB;;QAClD,IAAI,CAAC,IAAI,GAAG,MAAA,IAAI,CAAC,IAAI,0CAAE,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;QACtD,IAAI,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC;YAAE,OAAM;QACjE,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;QAC/D,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,KAAK;QACP,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;QACzB,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;QACnC,IAAI,IAAI,CAAC,IAAI;YAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC/C,OAAO,KAAK,CAAA;IACd,CAAC;;AA7Ce,OAAI,GAAG,IAAI,CAAA;AAoD7B,MAAe,GAAI,SAAQ,SAAS;;AAClB,QAAI,GAAG,KAAK,CAAA;AAG9B,MAAM,OAAQ,SAAQ,GAAG;IACvB,YAAoB,SAAe;QACjC,KAAK,EAAE,CAAA;QADW,cAAS,GAAT,SAAS,CAAM;IAEnC,CAAC;IAED,MAAM,CAAC,IAAe;QACpB,OAAO,OAAO,IAAI,CAAC,SAAS,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACtD,CAAC;IAED,aAAa,CAAC,KAAgB,EAAE,SAAoB;QAClD,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC;YAAE,OAAM;QAClD,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;QAC/D,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,KAAK;QACP,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IACpD,CAAC;CACF;AAED,MAAM,QAAS,SAAQ,GAAG;IACxB,YACmB,OAAa,EACb,IAAU,EACV,IAAc,EACd,EAAY;QAE7B,KAAK,EAAE,CAAA;QALU,YAAO,GAAP,OAAO,CAAM;QACb,SAAI,GAAJ,IAAI,CAAM;QACV,SAAI,GAAJ,IAAI,CAAU;QACd,OAAE,GAAF,EAAE,CAAU;IAG/B,CAAC;IAED,MAAM,CAAC,IAAe;QACpB,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,gBAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAA;QACtD,MAAM,EAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,IAAI,CAAA;QAC7B,OAAO,OAAO,OAAO,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACzF,CAAC;IAED,IAAI,KAAK;QACP,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;QAClD,OAAO,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;IACrC,CAAC;CACF;AAED,MAAM,OAAQ,SAAQ,GAAG;IACvB,YACmB,IAAiB,EACjB,OAAa,EACb,IAAU,EACnB,QAAc;QAEtB,KAAK,EAAE,CAAA;QALU,SAAI,GAAJ,IAAI,CAAa;QACjB,YAAO,GAAP,OAAO,CAAM;QACb,SAAI,GAAJ,IAAI,CAAM;QACnB,aAAQ,GAAR,QAAQ,CAAM;IAGxB,CAAC;IAED,MAAM,CAAC,IAAe;QACpB,OAAO,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC/F,CAAC;IAED,aAAa,CAAC,KAAgB,EAAE,SAAoB;QAClD,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC;YAAE,OAAM;QAClD,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;QAC7D,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,KAAK;QACP,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IACnD,CAAC;CACF;AAED,MAAM,IAAK,SAAQ,SAAS;IAE1B,YACS,IAAU,EACV,IAAU,EACV,KAAe;QAEtB,KAAK,EAAE,CAAA;QAJA,SAAI,GAAJ,IAAI,CAAM;QACV,SAAI,GAAJ,IAAI,CAAM;QACV,UAAK,GAAL,KAAK,CAAU;IAGxB,CAAC;IAED,MAAM,CAAC,IAAe;QACpB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAA;QACzC,OAAO,GAAG,MAAM,YAAY,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC5E,CAAC;;AAZe,SAAI,GAAG,MAAM,CAAA;AAe/B,MAAM,MAAO,SAAQ,UAAU;IAG7B,MAAM,CAAC,IAAe;QACpB,OAAO,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACvC,CAAC;;AAJe,WAAI,GAAG,QAAQ,CAAA;AAOjC,MAAM,GAAI,SAAQ,SAAS;IAIzB,MAAM,CAAC,IAAe;QACpB,IAAI,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACrC,IAAI,IAAI,CAAC,KAAK;YAAE,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAC/C,IAAI,IAAI,CAAC,OAAO;YAAE,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACnD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,aAAa;;QACX,KAAK,CAAC,aAAa,EAAE,CAAA;QACrB,MAAA,IAAI,CAAC,KAAK,0CAAE,aAAa,EAAuB,CAAA;QAChD,MAAA,IAAI,CAAC,OAAO,0CAAE,aAAa,EAAyB,CAAA;QACpD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,aAAa,CAAC,KAAgB,EAAE,SAAoB;;QAClD,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;QACrC,MAAA,IAAI,CAAC,KAAK,0CAAE,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;QAC3C,MAAA,IAAI,CAAC,OAAO,0CAAE,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;QAC7C,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,KAAK;QACP,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;QACzB,IAAI,IAAI,CAAC,KAAK;YAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACjD,IAAI,IAAI,CAAC,OAAO;YAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACrD,OAAO,KAAK,CAAA;IACd,CAAC;CAKF;AAED,MAAM,KAAM,SAAQ,SAAS;IAE3B,YAAqB,KAAW;QAC9B,KAAK,EAAE,CAAA;QADY,UAAK,GAAL,KAAK,CAAM;IAEhC,CAAC;IAED,MAAM,CAAC,IAAe;QACpB,OAAO,SAAS,IAAI,CAAC,KAAK,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACpD,CAAC;;AAPe,UAAI,GAAG,OAAO,CAAA;AAUhC,MAAM,OAAQ,SAAQ,SAAS;IAE7B,MAAM,CAAC,IAAe;QACpB,OAAO,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACvC,CAAC;;AAHe,YAAI,GAAG,SAAS,CAAA;AAiClC,MAAa,OAAO;IASlB,YAAY,QAAoB,EAAE,OAAuB,EAAE;QANlD,YAAO,GAAmB,EAAE,CAAA;QAEpB,iBAAY,GAAa,EAAE,CAAA;QAC3B,eAAU,GAAc,EAAE,CAAA;QAIzC,IAAI,CAAC,IAAI,GAAG,EAAC,GAAG,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAC,CAAA;QACjD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;QACzB,IAAI,CAAC,MAAM,GAAG,IAAI,aAAK,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAC,CAAC,CAAA;QAC3C,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;IAC5B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IAED,4CAA4C;IAC5C,IAAI,CAAC,MAAc;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACjC,CAAC;IAED,6CAA6C;IAC7C,SAAS,CAAC,MAAc;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACpC,CAAC;IAED,qEAAqE;IACrE,UAAU,CAAC,YAAqC,EAAE,KAAgB;QAChE,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,CAAA;QACtD,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC,CAAA;QAC/E,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACZ,OAAO,IAAI,CAAA;IACb,CAAC;IAED,aAAa,CAAC,MAAc,EAAE,QAAiB;QAC7C,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IAClD,CAAC;IAED,8FAA8F;IAC9F,qEAAqE;IACrE,SAAS,CAAC,SAAe;QACvB,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IAC1D,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/C,CAAC;IAEO,IAAI,CACV,OAAa,EACb,YAA2B,EAC3B,GAAc,EACd,QAAkB;QAElB,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;QAC7C,IAAI,GAAG,KAAK,SAAS,IAAI,QAAQ;YAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;QAClE,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,CAAA;QAC3C,OAAO,IAAI,CAAA;IACb,CAAC;IAED,0CAA0C;IAC1C,KAAK,CAAC,YAA2B,EAAE,GAAa,EAAE,SAAmB;QACnE,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAQ,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,SAAS,CAAC,CAAA;IAChE,CAAC;IAED,iEAAiE;IACjE,GAAG,CAAC,YAA2B,EAAE,GAAc,EAAE,SAAmB;QAClE,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAQ,CAAC,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,SAAS,CAAC,CAAA;IAC9D,CAAC;IAED,6CAA6C;IAC7C,GAAG,CAAC,YAA2B,EAAE,GAAc,EAAE,SAAmB;QAClE,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAQ,CAAC,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,SAAS,CAAC,CAAA;IAC9D,CAAC;IAED,kBAAkB;IAClB,MAAM,CAAC,GAAS,EAAE,GAAa,EAAE,WAAqB;QACpD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC,CAAA;IAC1D,CAAC;IAED,YAAY;IACZ,GAAG,CAAC,GAAS,EAAE,GAAa;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,GAAG,EAAE,iBAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED,oDAAoD;IACpD,IAAI,CAAC,CAAmB;QACtB,IAAI,OAAO,CAAC,IAAI,UAAU;YAAE,CAAC,EAAE,CAAA;aAC1B,IAAI,CAAC,KAAK,UAAG;YAAE,IAAI,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;QAClD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,kFAAkF;IAClF,MAAM,CAAC,GAAG,SAA+C;QACvD,MAAM,IAAI,GAAe,CAAC,GAAG,CAAC,CAAA;QAC9B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,SAAS,EAAE,CAAC;YACrC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;gBAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACnC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACd,IAAI,GAAG,KAAK,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;gBACnC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;gBACd,IAAA,iBAAU,EAAC,IAAI,EAAE,KAAK,CAAC,CAAA;YACzB,CAAC;QACH,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACd,OAAO,IAAI,YAAK,CAAC,IAAI,CAAC,CAAA;IACxB,CAAC;IAED,kFAAkF;IAClF,EAAE,CAAC,SAAyB,EAAE,QAAgB,EAAE,QAAgB;QAC9D,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;QAElC,IAAI,QAAQ,IAAI,QAAQ,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAA;QACnD,CAAC;aAAM,IAAI,QAAQ,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAA;QAC7B,CAAC;aAAM,IAAI,QAAQ,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;QAC7D,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,kEAAkE;IAClE,MAAM,CAAC,SAAyB;QAC9B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;IAC1C,CAAC;IAED,6DAA6D;IAC7D,IAAI;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;IACnC,CAAC;IAED,qEAAqE;IACrE,KAAK;QACH,OAAO,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;IACrC,CAAC;IAEO,IAAI,CAAC,IAAS,EAAE,OAAe;QACrC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QACrB,IAAI,OAAO;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAA;QACxC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,+DAA+D;IAC/D,GAAG,CAAC,SAAe,EAAE,OAAe;QAClC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAAA;IACnD,CAAC;IAED,wCAAwC;IACxC,QAAQ,CACN,YAA2B,EAC3B,IAAc,EACd,EAAY,EACZ,OAA8B,EAC9B,UAAgB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,gBAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,gBAAQ,CAAC,GAAG;QAE3D,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;QAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;IAC9E,CAAC;IAED,kEAAkE;IAClE,KAAK,CACH,YAA2B,EAC3B,QAAc,EACd,OAA6B,EAC7B,UAAgB,gBAAQ,CAAC,KAAK;QAE9B,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;QAC7C,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YAClB,MAAM,GAAG,GAAG,QAAQ,YAAY,WAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;YAC5E,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,IAAA,QAAC,EAAA,GAAG,GAAG,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;gBACpD,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAA,QAAC,EAAA,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAA;gBAC/B,OAAO,CAAC,IAAI,CAAC,CAAA;YACf,CAAC,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;IACnF,CAAC;IAED,sBAAsB;IACtB,4EAA4E;IAC5E,KAAK,CACH,YAA2B,EAC3B,GAAS,EACT,OAA6B,EAC7B,UAAgB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,gBAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,gBAAQ,CAAC,KAAK;QAE7D,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,IAAA,QAAC,EAAA,eAAe,GAAG,GAAG,EAAE,OAAO,CAAC,CAAA;QAClE,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;QAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;IAC9E,CAAC;IAED,iBAAiB;IACjB,MAAM;QACJ,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;IAChC,CAAC;IAED,oBAAoB;IACpB,KAAK,CAAC,KAAW;QACf,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;IACzC,CAAC;IAED,oBAAoB;IACpB,KAAK,CAAC,KAAY;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;IACzC,CAAC;IAED,qBAAqB;IACrB,MAAM,CAAC,KAAuB;QAC5B,MAAM,IAAI,GAAG,IAAI,MAAM,EAAE,CAAA;QACzB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QACrB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAChB,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;QACtF,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;IACnC,CAAC;IAED,kBAAkB;IAClB,GAAG,CAAC,OAAc,EAAE,SAA6B,EAAE,WAAmB;QACpE,IAAI,CAAC,SAAS,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;QAC/F,MAAM,IAAI,GAAG,IAAI,GAAG,EAAE,CAAA;QACtB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QACrB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAClB,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,CAAA;YAC9C,SAAS,CAAC,KAAK,CAAC,CAAA;QAClB,CAAC;QACD,IAAI,WAAW,EAAE,CAAC;YAChB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;YAC7C,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACxB,CAAC;QACD,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAC3C,CAAC;IAED,oBAAoB;IACpB,KAAK,CAAC,KAAW;QACf,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;IACzC,CAAC;IAED,6BAA6B;IAC7B,KAAK,CAAC,IAAY,EAAE,SAAkB;QACpC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAC1C,IAAI,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;QAC7C,OAAO,IAAI,CAAA;IACb,CAAC;IAED,uCAAuC;IACvC,QAAQ,CAAC,SAAkB;QACzB,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,CAAA;QACnC,IAAI,GAAG,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;QAC9E,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAA;QACxC,IAAI,OAAO,GAAG,CAAC,IAAI,CAAC,SAAS,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,CAAC,EAAE,CAAC;YACtE,MAAM,IAAI,KAAK,CAAC,mCAAmC,OAAO,OAAO,SAAS,WAAW,CAAC,CAAA;QACxF,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAA;QACxB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,2DAA2D;IAC3D,IAAI,CAAC,IAAU,EAAE,OAAa,UAAG,EAAE,KAAe,EAAE,QAAgB;QAClE,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;QAC5C,IAAI,QAAQ;YAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAA;QAC3C,OAAO,IAAI,CAAA;IACb,CAAC;IAED,0BAA0B;IAC1B,OAAO;QACL,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;IACjC,CAAC;IAED,QAAQ,CAAC,CAAC,GAAG,CAAC;QACZ,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAA;YAC1B,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;QAC7D,CAAC;IACH,CAAC;IAEO,SAAS,CAAC,IAAc;QAC9B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC/B,OAAO,IAAI,CAAA;IACb,CAAC;IAEO,UAAU,CAAC,IAAoB;QACrC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC/B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACxB,CAAC;IAEO,aAAa,CAAC,EAAoB,EAAE,EAAqB;QAC/D,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAA;QACxB,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC;YAC/C,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;YACjB,OAAO,IAAI,CAAA;QACb,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,0BAA0B,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,CAAA;IACtF,CAAC;IAEO,SAAS,CAAC,IAAe;QAC/B,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAA;QACxB,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;QACjD,CAAC;QACD,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,GAAG,IAAI,CAAA;QAC9B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAY,KAAK;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAS,CAAA;IAC/B,CAAC;IAED,IAAY,SAAS;QACnB,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;QACtB,OAAO,EAAE,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAC1B,CAAC;IAED,IAAY,SAAS,CAAC,IAAgB;QACpC,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;QACtB,EAAE,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAA;IAC1B,CAAC;CAKF;AAtUD,0BAsUC;AAED,SAAS,QAAQ,CAAC,KAAgB,EAAE,IAAe;IACjD,KAAK,MAAM,CAAC,IAAI,IAAI;QAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IACjE,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,YAAY,CAAC,KAAgB,EAAE,IAAc;IACpD,OAAO,IAAI,YAAY,kBAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;AAC1E,CAAC;AAGD,SAAS,YAAY,CAAC,IAAc,EAAE,KAAgB,EAAE,SAAoB;IAC1E,IAAI,IAAI,YAAY,WAAI;QAAE,OAAO,WAAW,CAAC,IAAI,CAAC,CAAA;IAClD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IACnC,OAAO,IAAI,YAAK,CACd,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAiB,EAAE,CAAoB,EAAE,EAAE;QAC7D,IAAI,CAAC,YAAY,WAAI;YAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;QACzC,IAAI,CAAC,YAAY,YAAK;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAA;;YAC1C,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAClB,OAAO,KAAK,CAAA;IACd,CAAC,EAAE,EAAE,CAAC,CACP,CAAA;IAED,SAAS,WAAW,CAAC,CAAO;QAC1B,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QAC1B,IAAI,CAAC,KAAK,SAAS,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,CAAC,CAAA;QACnD,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QACnB,OAAO,CAAC,CAAA;IACV,CAAC;IAED,SAAS,WAAW,CAAC,CAAW;QAC9B,OAAO,CACL,CAAC,YAAY,YAAK;YAClB,CAAC,CAAC,MAAM,CAAC,IAAI,CACX,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,YAAY,WAAI,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,SAAS,CACjF,CACF,CAAA;IACH,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,KAAgB,EAAE,IAAe;IACtD,KAAK,MAAM,CAAC,IAAI,IAAI;QAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;AACnE,CAAC;AAGD,SAAgB,GAAG,CAAC,CAAkB;IACpC,OAAO,OAAO,CAAC,IAAI,SAAS,IAAI,OAAO,CAAC,IAAI,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,QAAC,EAAA,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;AACzF,CAAC;AAFD,kBAEC;AAED,MAAM,OAAO,GAAG,OAAO,CAAC,iBAAS,CAAC,GAAG,CAAC,CAAA;AAEtC,wDAAwD;AACxD,SAAgB,GAAG,CAAC,GAAG,IAAY;IACjC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,CAAC;AAFD,kBAEC;AAED,MAAM,MAAM,GAAG,OAAO,CAAC,iBAAS,CAAC,EAAE,CAAC,CAAA;AAEpC,uDAAuD;AACvD,SAAgB,EAAE,CAAC,GAAG,IAAY;IAChC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AAC5B,CAAC;AAFD,gBAEC;AAID,SAAS,OAAO,CAAC,EAAQ;IACvB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,UAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,UAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,QAAC,EAAA,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AACjF,CAAC;AAED,SAAS,GAAG,CAAC,CAAO;IAClB,OAAO,CAAC,YAAY,WAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,QAAC,EAAA,IAAI,CAAC,GAAG,CAAA;AAC1C,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/codegen/scope.d.ts b/node_modules/ajv/dist/compile/codegen/scope.d.ts deleted file mode 100644 index 3d95305..0000000 --- a/node_modules/ajv/dist/compile/codegen/scope.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { Code, Name } from "./code"; -interface NameGroup { - prefix: string; - index: number; -} -export interface NameValue { - ref: ValueReference; - key?: unknown; - code?: Code; -} -export type ValueReference = unknown; -interface ScopeOptions { - prefixes?: Set; - parent?: Scope; -} -interface ValueScopeOptions extends ScopeOptions { - scope: ScopeStore; - es5?: boolean; - lines?: boolean; -} -export type ScopeStore = Record; -type ScopeValues = { - [Prefix in string]?: Map; -}; -export type ScopeValueSets = { - [Prefix in string]?: Set; -}; -export declare enum UsedValueState { - Started = 0, - Completed = 1 -} -export type UsedScopeValues = { - [Prefix in string]?: Map; -}; -export declare const varKinds: { - const: Name; - let: Name; - var: Name; -}; -export declare class Scope { - protected readonly _names: { - [Prefix in string]?: NameGroup; - }; - protected readonly _prefixes?: Set; - protected readonly _parent?: Scope; - constructor({ prefixes, parent }?: ScopeOptions); - toName(nameOrPrefix: Name | string): Name; - name(prefix: string): Name; - protected _newName(prefix: string): string; - private _nameGroup; -} -interface ScopePath { - property: string; - itemIndex: number; -} -export declare class ValueScopeName extends Name { - readonly prefix: string; - value?: NameValue; - scopePath?: Code; - constructor(prefix: string, nameStr: string); - setValue(value: NameValue, { property, itemIndex }: ScopePath): void; -} -interface VSOptions extends ValueScopeOptions { - _n: Code; -} -export declare class ValueScope extends Scope { - protected readonly _values: ScopeValues; - protected readonly _scope: ScopeStore; - readonly opts: VSOptions; - constructor(opts: ValueScopeOptions); - get(): ScopeStore; - name(prefix: string): ValueScopeName; - value(nameOrPrefix: ValueScopeName | string, value: NameValue): ValueScopeName; - getValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined; - scopeRefs(scopeName: Name, values?: ScopeValues | ScopeValueSets): Code; - scopeCode(values?: ScopeValues | ScopeValueSets, usedValues?: UsedScopeValues, getCode?: (n: ValueScopeName) => Code | undefined): Code; - private _reduceValues; -} -export {}; diff --git a/node_modules/ajv/dist/compile/codegen/scope.js b/node_modules/ajv/dist/compile/codegen/scope.js deleted file mode 100644 index 4bc7794..0000000 --- a/node_modules/ajv/dist/compile/codegen/scope.js +++ /dev/null @@ -1,143 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0; -const code_1 = require("./code"); -class ValueError extends Error { - constructor(name) { - super(`CodeGen: "code" for ${name} not defined`); - this.value = name.value; - } -} -var UsedValueState; -(function (UsedValueState) { - UsedValueState[UsedValueState["Started"] = 0] = "Started"; - UsedValueState[UsedValueState["Completed"] = 1] = "Completed"; -})(UsedValueState || (exports.UsedValueState = UsedValueState = {})); -exports.varKinds = { - const: new code_1.Name("const"), - let: new code_1.Name("let"), - var: new code_1.Name("var"), -}; -class Scope { - constructor({ prefixes, parent } = {}) { - this._names = {}; - this._prefixes = prefixes; - this._parent = parent; - } - toName(nameOrPrefix) { - return nameOrPrefix instanceof code_1.Name ? nameOrPrefix : this.name(nameOrPrefix); - } - name(prefix) { - return new code_1.Name(this._newName(prefix)); - } - _newName(prefix) { - const ng = this._names[prefix] || this._nameGroup(prefix); - return `${prefix}${ng.index++}`; - } - _nameGroup(prefix) { - var _a, _b; - if (((_b = (_a = this._parent) === null || _a === void 0 ? void 0 : _a._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || (this._prefixes && !this._prefixes.has(prefix))) { - throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`); - } - return (this._names[prefix] = { prefix, index: 0 }); - } -} -exports.Scope = Scope; -class ValueScopeName extends code_1.Name { - constructor(prefix, nameStr) { - super(nameStr); - this.prefix = prefix; - } - setValue(value, { property, itemIndex }) { - this.value = value; - this.scopePath = (0, code_1._) `.${new code_1.Name(property)}[${itemIndex}]`; - } -} -exports.ValueScopeName = ValueScopeName; -const line = (0, code_1._) `\n`; -class ValueScope extends Scope { - constructor(opts) { - super(opts); - this._values = {}; - this._scope = opts.scope; - this.opts = { ...opts, _n: opts.lines ? line : code_1.nil }; - } - get() { - return this._scope; - } - name(prefix) { - return new ValueScopeName(prefix, this._newName(prefix)); - } - value(nameOrPrefix, value) { - var _a; - if (value.ref === undefined) - throw new Error("CodeGen: ref must be passed in value"); - const name = this.toName(nameOrPrefix); - const { prefix } = name; - const valueKey = (_a = value.key) !== null && _a !== void 0 ? _a : value.ref; - let vs = this._values[prefix]; - if (vs) { - const _name = vs.get(valueKey); - if (_name) - return _name; - } - else { - vs = this._values[prefix] = new Map(); - } - vs.set(valueKey, name); - const s = this._scope[prefix] || (this._scope[prefix] = []); - const itemIndex = s.length; - s[itemIndex] = value.ref; - name.setValue(value, { property: prefix, itemIndex }); - return name; - } - getValue(prefix, keyOrRef) { - const vs = this._values[prefix]; - if (!vs) - return; - return vs.get(keyOrRef); - } - scopeRefs(scopeName, values = this._values) { - return this._reduceValues(values, (name) => { - if (name.scopePath === undefined) - throw new Error(`CodeGen: name "${name}" has no value`); - return (0, code_1._) `${scopeName}${name.scopePath}`; - }); - } - scopeCode(values = this._values, usedValues, getCode) { - return this._reduceValues(values, (name) => { - if (name.value === undefined) - throw new Error(`CodeGen: name "${name}" has no value`); - return name.value.code; - }, usedValues, getCode); - } - _reduceValues(values, valueCode, usedValues = {}, getCode) { - let code = code_1.nil; - for (const prefix in values) { - const vs = values[prefix]; - if (!vs) - continue; - const nameSet = (usedValues[prefix] = usedValues[prefix] || new Map()); - vs.forEach((name) => { - if (nameSet.has(name)) - return; - nameSet.set(name, UsedValueState.Started); - let c = valueCode(name); - if (c) { - const def = this.opts.es5 ? exports.varKinds.var : exports.varKinds.const; - code = (0, code_1._) `${code}${def} ${name} = ${c};${this.opts._n}`; - } - else if ((c = getCode === null || getCode === void 0 ? void 0 : getCode(name))) { - code = (0, code_1._) `${code}${c}${this.opts._n}`; - } - else { - throw new ValueError(name); - } - nameSet.set(name, UsedValueState.Completed); - }); - } - return code; - } -} -exports.ValueScope = ValueScope; -//# sourceMappingURL=scope.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/codegen/scope.js.map b/node_modules/ajv/dist/compile/codegen/scope.js.map deleted file mode 100644 index 911769f..0000000 --- a/node_modules/ajv/dist/compile/codegen/scope.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../../lib/compile/codegen/scope.ts"],"names":[],"mappings":";;;AAAA,iCAAyC;AAezC,MAAM,UAAW,SAAQ,KAAK;IAE5B,YAAY,IAAoB;QAC9B,KAAK,CAAC,uBAAuB,IAAI,cAAc,CAAC,CAAA;QAChD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;IACzB,CAAC;CACF;AAuBD,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yDAAO,CAAA;IACP,6DAAS,CAAA;AACX,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAMY,QAAA,QAAQ,GAAG;IACtB,KAAK,EAAE,IAAI,WAAI,CAAC,OAAO,CAAC;IACxB,GAAG,EAAE,IAAI,WAAI,CAAC,KAAK,CAAC;IACpB,GAAG,EAAE,IAAI,WAAI,CAAC,KAAK,CAAC;CACrB,CAAA;AAED,MAAa,KAAK;IAKhB,YAAY,EAAC,QAAQ,EAAE,MAAM,KAAkB,EAAE;QAJ9B,WAAM,GAAqC,EAAE,CAAA;QAK9D,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;QACzB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACvB,CAAC;IAED,MAAM,CAAC,YAA2B;QAChC,OAAO,YAAY,YAAY,WAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IAC9E,CAAC;IAED,IAAI,CAAC,MAAc;QACjB,OAAO,IAAI,WAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;IACxC,CAAC;IAES,QAAQ,CAAC,MAAc;QAC/B,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;QACzD,OAAO,GAAG,MAAM,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CAAA;IACjC,CAAC;IAEO,UAAU,CAAC,MAAc;;QAC/B,IAAI,CAAA,MAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,SAAS,0CAAE,GAAG,CAAC,MAAM,CAAC,KAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;YAC5F,MAAM,IAAI,KAAK,CAAC,oBAAoB,MAAM,gCAAgC,CAAC,CAAA;QAC7E,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAC,MAAM,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC,CAAA;IACnD,CAAC;CACF;AA7BD,sBA6BC;AAOD,MAAa,cAAe,SAAQ,WAAI;IAKtC,YAAY,MAAc,EAAE,OAAe;QACzC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,QAAQ,CAAC,KAAgB,EAAE,EAAC,QAAQ,EAAE,SAAS,EAAY;QACzD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,SAAS,GAAG,IAAA,QAAC,EAAA,IAAI,IAAI,WAAI,CAAC,QAAQ,CAAC,IAAI,SAAS,GAAG,CAAA;IAC1D,CAAC;CACF;AAdD,wCAcC;AAMD,MAAM,IAAI,GAAG,IAAA,QAAC,EAAA,IAAI,CAAA;AAElB,MAAa,UAAW,SAAQ,KAAK;IAKnC,YAAY,IAAuB;QACjC,KAAK,CAAC,IAAI,CAAC,CAAA;QALM,YAAO,GAAgB,EAAE,CAAA;QAM1C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAA;QACxB,IAAI,CAAC,IAAI,GAAG,EAAC,GAAG,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAG,EAAC,CAAA;IACpD,CAAC;IAED,GAAG;QACD,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED,IAAI,CAAC,MAAc;QACjB,OAAO,IAAI,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;IAC1D,CAAC;IAED,KAAK,CAAC,YAAqC,EAAE,KAAgB;;QAC3D,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;QACpF,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAmB,CAAA;QACxD,MAAM,EAAC,MAAM,EAAC,GAAG,IAAI,CAAA;QACrB,MAAM,QAAQ,GAAG,MAAA,KAAK,CAAC,GAAG,mCAAI,KAAK,CAAC,GAAG,CAAA;QACvC,IAAI,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAC7B,IAAI,EAAE,EAAE,CAAC;YACP,MAAM,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;YAC9B,IAAI,KAAK;gBAAE,OAAO,KAAK,CAAA;QACzB,CAAC;aAAM,CAAC;YACN,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,EAAE,CAAA;QACvC,CAAC;QACD,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;QAEtB,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAA;QAC3D,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAA;QAC1B,CAAC,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,GAAG,CAAA;QACxB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAC,CAAC,CAAA;QACnD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,QAAQ,CAAC,MAAc,EAAE,QAAiB;QACxC,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAC/B,IAAI,CAAC,EAAE;YAAE,OAAM;QACf,OAAO,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACzB,CAAC;IAED,SAAS,CAAC,SAAe,EAAE,SAAuC,IAAI,CAAC,OAAO;QAC5E,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,IAAoB,EAAE,EAAE;YACzD,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,gBAAgB,CAAC,CAAA;YACzF,OAAO,IAAA,QAAC,EAAA,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;QACzC,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,SAAS,CACP,SAAuC,IAAI,CAAC,OAAO,EACnD,UAA4B,EAC5B,OAAiD;QAEjD,OAAO,IAAI,CAAC,aAAa,CACvB,MAAM,EACN,CAAC,IAAoB,EAAE,EAAE;YACvB,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,gBAAgB,CAAC,CAAA;YACrF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAA;QACxB,CAAC,EACD,UAAU,EACV,OAAO,CACR,CAAA;IACH,CAAC;IAEO,aAAa,CACnB,MAAoC,EACpC,SAAkD,EAClD,aAA8B,EAAE,EAChC,OAAiD;QAEjD,IAAI,IAAI,GAAS,UAAG,CAAA;QACpB,KAAK,MAAM,MAAM,IAAI,MAAM,EAAE,CAAC;YAC5B,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;YACzB,IAAI,CAAC,EAAE;gBAAE,SAAQ;YACjB,MAAM,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC,CAAA;YACtE,EAAE,CAAC,OAAO,CAAC,CAAC,IAAoB,EAAE,EAAE;gBAClC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;oBAAE,OAAM;gBAC7B,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,CAAA;gBACzC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;gBACvB,IAAI,CAAC,EAAE,CAAC;oBACN,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,gBAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,gBAAQ,CAAC,KAAK,CAAA;oBACzD,IAAI,GAAG,IAAA,QAAC,EAAA,GAAG,IAAI,GAAG,GAAG,IAAI,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAA;gBACxD,CAAC;qBAAM,IAAI,CAAC,CAAC,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,IAAI,CAAC,CAAC,EAAE,CAAC;oBACjC,IAAI,GAAG,IAAA,QAAC,EAAA,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAA;gBACtC,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,CAAA;gBAC5B,CAAC;gBACD,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;YAC7C,CAAC,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAjGD,gCAiGC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/errors.d.ts b/node_modules/ajv/dist/compile/errors.d.ts deleted file mode 100644 index 74eef7e..0000000 --- a/node_modules/ajv/dist/compile/errors.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { KeywordErrorCxt, KeywordErrorDefinition } from "../types"; -import { CodeGen, Code, Name } from "./codegen"; -export declare const keywordError: KeywordErrorDefinition; -export declare const keyword$DataError: KeywordErrorDefinition; -export interface ErrorPaths { - instancePath?: Code; - schemaPath?: string; - parentSchema?: boolean; -} -export declare function reportError(cxt: KeywordErrorCxt, error?: KeywordErrorDefinition, errorPaths?: ErrorPaths, overrideAllErrors?: boolean): void; -export declare function reportExtraError(cxt: KeywordErrorCxt, error?: KeywordErrorDefinition, errorPaths?: ErrorPaths): void; -export declare function resetErrorsCount(gen: CodeGen, errsCount: Name): void; -export declare function extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }: KeywordErrorCxt): void; diff --git a/node_modules/ajv/dist/compile/errors.js b/node_modules/ajv/dist/compile/errors.js deleted file mode 100644 index 24d721d..0000000 --- a/node_modules/ajv/dist/compile/errors.js +++ /dev/null @@ -1,123 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0; -const codegen_1 = require("./codegen"); -const util_1 = require("./util"); -const names_1 = require("./names"); -exports.keywordError = { - message: ({ keyword }) => (0, codegen_1.str) `must pass "${keyword}" keyword validation`, -}; -exports.keyword$DataError = { - message: ({ keyword, schemaType }) => schemaType - ? (0, codegen_1.str) `"${keyword}" keyword must be ${schemaType} ($data)` - : (0, codegen_1.str) `"${keyword}" keyword is invalid ($data)`, -}; -function reportError(cxt, error = exports.keywordError, errorPaths, overrideAllErrors) { - const { it } = cxt; - const { gen, compositeRule, allErrors } = it; - const errObj = errorObjectCode(cxt, error, errorPaths); - if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : (compositeRule || allErrors)) { - addError(gen, errObj); - } - else { - returnErrors(it, (0, codegen_1._) `[${errObj}]`); - } -} -exports.reportError = reportError; -function reportExtraError(cxt, error = exports.keywordError, errorPaths) { - const { it } = cxt; - const { gen, compositeRule, allErrors } = it; - const errObj = errorObjectCode(cxt, error, errorPaths); - addError(gen, errObj); - if (!(compositeRule || allErrors)) { - returnErrors(it, names_1.default.vErrors); - } -} -exports.reportExtraError = reportExtraError; -function resetErrorsCount(gen, errsCount) { - gen.assign(names_1.default.errors, errsCount); - gen.if((0, codegen_1._) `${names_1.default.vErrors} !== null`, () => gen.if(errsCount, () => gen.assign((0, codegen_1._) `${names_1.default.vErrors}.length`, errsCount), () => gen.assign(names_1.default.vErrors, null))); -} -exports.resetErrorsCount = resetErrorsCount; -function extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }) { - /* istanbul ignore if */ - if (errsCount === undefined) - throw new Error("ajv implementation error"); - const err = gen.name("err"); - gen.forRange("i", errsCount, names_1.default.errors, (i) => { - gen.const(err, (0, codegen_1._) `${names_1.default.vErrors}[${i}]`); - gen.if((0, codegen_1._) `${err}.instancePath === undefined`, () => gen.assign((0, codegen_1._) `${err}.instancePath`, (0, codegen_1.strConcat)(names_1.default.instancePath, it.errorPath))); - gen.assign((0, codegen_1._) `${err}.schemaPath`, (0, codegen_1.str) `${it.errSchemaPath}/${keyword}`); - if (it.opts.verbose) { - gen.assign((0, codegen_1._) `${err}.schema`, schemaValue); - gen.assign((0, codegen_1._) `${err}.data`, data); - } - }); -} -exports.extendErrors = extendErrors; -function addError(gen, errObj) { - const err = gen.const("err", errObj); - gen.if((0, codegen_1._) `${names_1.default.vErrors} === null`, () => gen.assign(names_1.default.vErrors, (0, codegen_1._) `[${err}]`), (0, codegen_1._) `${names_1.default.vErrors}.push(${err})`); - gen.code((0, codegen_1._) `${names_1.default.errors}++`); -} -function returnErrors(it, errs) { - const { gen, validateName, schemaEnv } = it; - if (schemaEnv.$async) { - gen.throw((0, codegen_1._) `new ${it.ValidationError}(${errs})`); - } - else { - gen.assign((0, codegen_1._) `${validateName}.errors`, errs); - gen.return(false); - } -} -const E = { - keyword: new codegen_1.Name("keyword"), - schemaPath: new codegen_1.Name("schemaPath"), // also used in JTD errors - params: new codegen_1.Name("params"), - propertyName: new codegen_1.Name("propertyName"), - message: new codegen_1.Name("message"), - schema: new codegen_1.Name("schema"), - parentSchema: new codegen_1.Name("parentSchema"), -}; -function errorObjectCode(cxt, error, errorPaths) { - const { createErrors } = cxt.it; - if (createErrors === false) - return (0, codegen_1._) `{}`; - return errorObject(cxt, error, errorPaths); -} -function errorObject(cxt, error, errorPaths = {}) { - const { gen, it } = cxt; - const keyValues = [ - errorInstancePath(it, errorPaths), - errorSchemaPath(cxt, errorPaths), - ]; - extraErrorProps(cxt, error, keyValues); - return gen.object(...keyValues); -} -function errorInstancePath({ errorPath }, { instancePath }) { - const instPath = instancePath - ? (0, codegen_1.str) `${errorPath}${(0, util_1.getErrorPath)(instancePath, util_1.Type.Str)}` - : errorPath; - return [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, instPath)]; -} -function errorSchemaPath({ keyword, it: { errSchemaPath } }, { schemaPath, parentSchema }) { - let schPath = parentSchema ? errSchemaPath : (0, codegen_1.str) `${errSchemaPath}/${keyword}`; - if (schemaPath) { - schPath = (0, codegen_1.str) `${schPath}${(0, util_1.getErrorPath)(schemaPath, util_1.Type.Str)}`; - } - return [E.schemaPath, schPath]; -} -function extraErrorProps(cxt, { params, message }, keyValues) { - const { keyword, data, schemaValue, it } = cxt; - const { opts, propertyName, topSchemaRef, schemaPath } = it; - keyValues.push([E.keyword, keyword], [E.params, typeof params == "function" ? params(cxt) : params || (0, codegen_1._) `{}`]); - if (opts.messages) { - keyValues.push([E.message, typeof message == "function" ? message(cxt) : message]); - } - if (opts.verbose) { - keyValues.push([E.schema, schemaValue], [E.parentSchema, (0, codegen_1._) `${topSchemaRef}${schemaPath}`], [names_1.default.data, data]); - } - if (propertyName) - keyValues.push([E.propertyName, propertyName]); -} -//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/errors.js.map b/node_modules/ajv/dist/compile/errors.js.map deleted file mode 100644 index ea08e4e..0000000 --- a/node_modules/ajv/dist/compile/errors.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../lib/compile/errors.ts"],"names":[],"mappings":";;;AAEA,uCAAgE;AAEhE,iCAAyC;AACzC,mCAAuB;AAEV,QAAA,YAAY,GAA2B;IAClD,OAAO,EAAE,CAAC,EAAC,OAAO,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,cAAc,OAAO,sBAAsB;CACvE,CAAA;AAEY,QAAA,iBAAiB,GAA2B;IACvD,OAAO,EAAE,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC,EAAE,EAAE,CACjC,UAAU;QACR,CAAC,CAAC,IAAA,aAAG,EAAA,IAAI,OAAO,qBAAqB,UAAU,UAAU;QACzD,CAAC,CAAC,IAAA,aAAG,EAAA,IAAI,OAAO,8BAA8B;CACnD,CAAA;AAQD,SAAgB,WAAW,CACzB,GAAoB,EACpB,QAAgC,oBAAY,EAC5C,UAAuB,EACvB,iBAA2B;IAE3B,MAAM,EAAC,EAAE,EAAC,GAAG,GAAG,CAAA;IAChB,MAAM,EAAC,GAAG,EAAE,aAAa,EAAE,SAAS,EAAC,GAAG,EAAE,CAAA;IAC1C,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC,CAAA;IACtD,IAAI,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,CAAC,aAAa,IAAI,SAAS,CAAC,EAAE,CAAC;QACtD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IACvB,CAAC;SAAM,CAAC;QACN,YAAY,CAAC,EAAE,EAAE,IAAA,WAAC,EAAA,IAAI,MAAM,GAAG,CAAC,CAAA;IAClC,CAAC;AACH,CAAC;AAdD,kCAcC;AAED,SAAgB,gBAAgB,CAC9B,GAAoB,EACpB,QAAgC,oBAAY,EAC5C,UAAuB;IAEvB,MAAM,EAAC,EAAE,EAAC,GAAG,GAAG,CAAA;IAChB,MAAM,EAAC,GAAG,EAAE,aAAa,EAAE,SAAS,EAAC,GAAG,EAAE,CAAA;IAC1C,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC,CAAA;IACtD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IACrB,IAAI,CAAC,CAAC,aAAa,IAAI,SAAS,CAAC,EAAE,CAAC;QAClC,YAAY,CAAC,EAAE,EAAE,eAAC,CAAC,OAAO,CAAC,CAAA;IAC7B,CAAC;AACH,CAAC;AAZD,4CAYC;AAED,SAAgB,gBAAgB,CAAC,GAAY,EAAE,SAAe;IAC5D,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAC/B,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,OAAO,WAAW,EAAE,GAAG,EAAE,CACpC,GAAG,CAAC,EAAE,CACJ,SAAS,EACT,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,OAAO,SAAS,EAAE,SAAS,CAAC,EACnD,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAClC,CACF,CAAA;AACH,CAAC;AATD,4CASC;AAED,SAAgB,YAAY,CAAC,EAC3B,GAAG,EACH,OAAO,EACP,WAAW,EACX,IAAI,EACJ,SAAS,EACT,EAAE,GACc;IAChB,wBAAwB;IACxB,IAAI,SAAS,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;IACxE,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC3B,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,SAAS,EAAE,eAAC,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE;QAC3C,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;QACrC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,6BAA6B,EAAE,GAAG,EAAE,CAChD,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,eAAe,EAAE,IAAA,mBAAS,EAAC,eAAC,CAAC,YAAY,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAC5E,CAAA;QACD,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,aAAa,EAAE,IAAA,aAAG,EAAA,GAAG,EAAE,CAAC,aAAa,IAAI,OAAO,EAAE,CAAC,CAAA;QACrE,IAAI,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YACpB,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,SAAS,EAAE,WAAW,CAAC,CAAA;YACzC,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AAtBD,oCAsBC;AAED,SAAS,QAAQ,CAAC,GAAY,EAAE,MAAY;IAC1C,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IACpC,GAAG,CAAC,EAAE,CACJ,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,OAAO,WAAW,EACxB,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,IAAI,GAAG,GAAG,CAAC,EACxC,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,OAAO,SAAS,GAAG,GAAG,CAC7B,CAAA;IACD,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,MAAM,IAAI,CAAC,CAAA;AAC5B,CAAC;AAED,SAAS,YAAY,CAAC,EAAa,EAAE,IAAU;IAC7C,MAAM,EAAC,GAAG,EAAE,YAAY,EAAE,SAAS,EAAC,GAAG,EAAE,CAAA;IACzC,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;QACrB,GAAG,CAAC,KAAK,CAAC,IAAA,WAAC,EAAA,OAAO,EAAE,CAAC,eAAuB,IAAI,IAAI,GAAG,CAAC,CAAA;IAC1D,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,YAAY,SAAS,EAAE,IAAI,CAAC,CAAA;QAC3C,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACnB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,GAAG;IACR,OAAO,EAAE,IAAI,cAAI,CAAC,SAAS,CAAC;IAC5B,UAAU,EAAE,IAAI,cAAI,CAAC,YAAY,CAAC,EAAE,0BAA0B;IAC9D,MAAM,EAAE,IAAI,cAAI,CAAC,QAAQ,CAAC;IAC1B,YAAY,EAAE,IAAI,cAAI,CAAC,cAAc,CAAC;IACtC,OAAO,EAAE,IAAI,cAAI,CAAC,SAAS,CAAC;IAC5B,MAAM,EAAE,IAAI,cAAI,CAAC,QAAQ,CAAC;IAC1B,YAAY,EAAE,IAAI,cAAI,CAAC,cAAc,CAAC;CACvC,CAAA;AAED,SAAS,eAAe,CACtB,GAAoB,EACpB,KAA6B,EAC7B,UAAuB;IAEvB,MAAM,EAAC,YAAY,EAAC,GAAG,GAAG,CAAC,EAAE,CAAA;IAC7B,IAAI,YAAY,KAAK,KAAK;QAAE,OAAO,IAAA,WAAC,EAAA,IAAI,CAAA;IACxC,OAAO,WAAW,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC,CAAA;AAC5C,CAAC;AAED,SAAS,WAAW,CAClB,GAAoB,EACpB,KAA6B,EAC7B,aAAyB,EAAE;IAE3B,MAAM,EAAC,GAAG,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IACrB,MAAM,SAAS,GAAgC;QAC7C,iBAAiB,CAAC,EAAE,EAAE,UAAU,CAAC;QACjC,eAAe,CAAC,GAAG,EAAE,UAAU,CAAC;KACjC,CAAA;IACD,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;IACtC,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,CAAA;AACjC,CAAC;AAED,SAAS,iBAAiB,CAAC,EAAC,SAAS,EAAY,EAAE,EAAC,YAAY,EAAa;IAC3E,MAAM,QAAQ,GAAG,YAAY;QAC3B,CAAC,CAAC,IAAA,aAAG,EAAA,GAAG,SAAS,GAAG,IAAA,mBAAY,EAAC,YAAY,EAAE,WAAI,CAAC,GAAG,CAAC,EAAE;QAC1D,CAAC,CAAC,SAAS,CAAA;IACb,OAAO,CAAC,eAAC,CAAC,YAAY,EAAE,IAAA,mBAAS,EAAC,eAAC,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAA;AAC9D,CAAC;AAED,SAAS,eAAe,CACtB,EAAC,OAAO,EAAE,EAAE,EAAE,EAAC,aAAa,EAAC,EAAkB,EAC/C,EAAC,UAAU,EAAE,YAAY,EAAa;IAEtC,IAAI,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAA,aAAG,EAAA,GAAG,aAAa,IAAI,OAAO,EAAE,CAAA;IAC7E,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,GAAG,IAAA,aAAG,EAAA,GAAG,OAAO,GAAG,IAAA,mBAAY,EAAC,UAAU,EAAE,WAAI,CAAC,GAAG,CAAC,EAAE,CAAA;IAChE,CAAC;IACD,OAAO,CAAC,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;AAChC,CAAC;AAED,SAAS,eAAe,CACtB,GAAoB,EACpB,EAAC,MAAM,EAAE,OAAO,EAAyB,EACzC,SAAsC;IAEtC,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAC5C,MAAM,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAC,GAAG,EAAE,CAAA;IACzD,SAAS,CAAC,IAAI,CACZ,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,EACpB,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,MAAM,IAAI,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,IAAA,WAAC,EAAA,IAAI,CAAC,CACxE,CAAA;IACD,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IACpF,CAAC;IACD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,SAAS,CAAC,IAAI,CACZ,CAAC,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,EACvB,CAAC,CAAC,CAAC,YAAY,EAAE,IAAA,WAAC,EAAA,GAAG,YAAY,GAAG,UAAU,EAAE,CAAC,EACjD,CAAC,eAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CACf,CAAA;IACH,CAAC;IACD,IAAI,YAAY;QAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAA;AAClE,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/index.d.ts b/node_modules/ajv/dist/compile/index.d.ts deleted file mode 100644 index 2809353..0000000 --- a/node_modules/ajv/dist/compile/index.d.ts +++ /dev/null @@ -1,80 +0,0 @@ -import type { AnySchema, AnySchemaObject, AnyValidateFunction, EvaluatedProperties, EvaluatedItems } from "../types"; -import type Ajv from "../core"; -import type { InstanceOptions } from "../core"; -import { CodeGen, Name, Code, ValueScopeName } from "./codegen"; -import { LocalRefs } from "./resolve"; -import { JSONType } from "./rules"; -export type SchemaRefs = { - [Ref in string]?: SchemaEnv | AnySchema; -}; -export interface SchemaCxt { - readonly gen: CodeGen; - readonly allErrors?: boolean; - readonly data: Name; - readonly parentData: Name; - readonly parentDataProperty: Code | number; - readonly dataNames: Name[]; - readonly dataPathArr: (Code | number)[]; - readonly dataLevel: number; - dataTypes: JSONType[]; - definedProperties: Set; - readonly topSchemaRef: Code; - readonly validateName: Name; - evaluated?: Name; - readonly ValidationError?: Name; - readonly schema: AnySchema; - readonly schemaEnv: SchemaEnv; - readonly rootId: string; - baseId: string; - readonly schemaPath: Code; - readonly errSchemaPath: string; - readonly errorPath: Code; - readonly propertyName?: Name; - readonly compositeRule?: boolean; - props?: EvaluatedProperties | Name; - items?: EvaluatedItems | Name; - jtdDiscriminator?: string; - jtdMetadata?: boolean; - readonly createErrors?: boolean; - readonly opts: InstanceOptions; - readonly self: Ajv; -} -export interface SchemaObjCxt extends SchemaCxt { - readonly schema: AnySchemaObject; -} -interface SchemaEnvArgs { - readonly schema: AnySchema; - readonly schemaId?: "$id" | "id"; - readonly root?: SchemaEnv; - readonly baseId?: string; - readonly schemaPath?: string; - readonly localRefs?: LocalRefs; - readonly meta?: boolean; -} -export declare class SchemaEnv implements SchemaEnvArgs { - readonly schema: AnySchema; - readonly schemaId?: "$id" | "id"; - readonly root: SchemaEnv; - baseId: string; - schemaPath?: string; - localRefs?: LocalRefs; - readonly meta?: boolean; - readonly $async?: boolean; - readonly refs: SchemaRefs; - readonly dynamicAnchors: { - [Ref in string]?: true; - }; - validate?: AnyValidateFunction; - validateName?: ValueScopeName; - serialize?: (data: unknown) => string; - serializeName?: ValueScopeName; - parse?: (data: string) => unknown; - parseName?: ValueScopeName; - constructor(env: SchemaEnvArgs); -} -export declare function compileSchema(this: Ajv, sch: SchemaEnv): SchemaEnv; -export declare function resolveRef(this: Ajv, root: SchemaEnv, baseId: string, ref: string): AnySchema | SchemaEnv | undefined; -export declare function getCompilingSchema(this: Ajv, schEnv: SchemaEnv): SchemaEnv | void; -export declare function resolveSchema(this: Ajv, root: SchemaEnv, // root object with properties schema, refs TODO below SchemaEnv is assigned to it -ref: string): SchemaEnv | undefined; -export {}; diff --git a/node_modules/ajv/dist/compile/index.js b/node_modules/ajv/dist/compile/index.js deleted file mode 100644 index 9e42a55..0000000 --- a/node_modules/ajv/dist/compile/index.js +++ /dev/null @@ -1,242 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.resolveSchema = exports.getCompilingSchema = exports.resolveRef = exports.compileSchema = exports.SchemaEnv = void 0; -const codegen_1 = require("./codegen"); -const validation_error_1 = require("../runtime/validation_error"); -const names_1 = require("./names"); -const resolve_1 = require("./resolve"); -const util_1 = require("./util"); -const validate_1 = require("./validate"); -class SchemaEnv { - constructor(env) { - var _a; - this.refs = {}; - this.dynamicAnchors = {}; - let schema; - if (typeof env.schema == "object") - schema = env.schema; - this.schema = env.schema; - this.schemaId = env.schemaId; - this.root = env.root || this; - this.baseId = (_a = env.baseId) !== null && _a !== void 0 ? _a : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]); - this.schemaPath = env.schemaPath; - this.localRefs = env.localRefs; - this.meta = env.meta; - this.$async = schema === null || schema === void 0 ? void 0 : schema.$async; - this.refs = {}; - } -} -exports.SchemaEnv = SchemaEnv; -// let codeSize = 0 -// let nodeCount = 0 -// Compiles schema in SchemaEnv -function compileSchema(sch) { - // TODO refactor - remove compilations - const _sch = getCompilingSchema.call(this, sch); - if (_sch) - return _sch; - const rootId = (0, resolve_1.getFullPath)(this.opts.uriResolver, sch.root.baseId); // TODO if getFullPath removed 1 tests fails - const { es5, lines } = this.opts.code; - const { ownProperties } = this.opts; - const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties }); - let _ValidationError; - if (sch.$async) { - _ValidationError = gen.scopeValue("Error", { - ref: validation_error_1.default, - code: (0, codegen_1._) `require("ajv/dist/runtime/validation_error").default`, - }); - } - const validateName = gen.scopeName("validate"); - sch.validateName = validateName; - const schemaCxt = { - gen, - allErrors: this.opts.allErrors, - data: names_1.default.data, - parentData: names_1.default.parentData, - parentDataProperty: names_1.default.parentDataProperty, - dataNames: [names_1.default.data], - dataPathArr: [codegen_1.nil], // TODO can its length be used as dataLevel if nil is removed? - dataLevel: 0, - dataTypes: [], - definedProperties: new Set(), - topSchemaRef: gen.scopeValue("schema", this.opts.code.source === true - ? { ref: sch.schema, code: (0, codegen_1.stringify)(sch.schema) } - : { ref: sch.schema }), - validateName, - ValidationError: _ValidationError, - schema: sch.schema, - schemaEnv: sch, - rootId, - baseId: sch.baseId || rootId, - schemaPath: codegen_1.nil, - errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"), - errorPath: (0, codegen_1._) `""`, - opts: this.opts, - self: this, - }; - let sourceCode; - try { - this._compilations.add(sch); - (0, validate_1.validateFunctionCode)(schemaCxt); - gen.optimize(this.opts.code.optimize); - // gen.optimize(1) - const validateCode = gen.toString(); - sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${validateCode}`; - // console.log((codeSize += sourceCode.length), (nodeCount += gen.nodeCount)) - if (this.opts.code.process) - sourceCode = this.opts.code.process(sourceCode, sch); - // console.log("\n\n\n *** \n", sourceCode) - const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode); - const validate = makeValidate(this, this.scope.get()); - this.scope.value(validateName, { ref: validate }); - validate.errors = null; - validate.schema = sch.schema; - validate.schemaEnv = sch; - if (sch.$async) - validate.$async = true; - if (this.opts.code.source === true) { - validate.source = { validateName, validateCode, scopeValues: gen._values }; - } - if (this.opts.unevaluated) { - const { props, items } = schemaCxt; - validate.evaluated = { - props: props instanceof codegen_1.Name ? undefined : props, - items: items instanceof codegen_1.Name ? undefined : items, - dynamicProps: props instanceof codegen_1.Name, - dynamicItems: items instanceof codegen_1.Name, - }; - if (validate.source) - validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated); - } - sch.validate = validate; - return sch; - } - catch (e) { - delete sch.validate; - delete sch.validateName; - if (sourceCode) - this.logger.error("Error compiling schema, function code:", sourceCode); - // console.log("\n\n\n *** \n", sourceCode, this.opts) - throw e; - } - finally { - this._compilations.delete(sch); - } -} -exports.compileSchema = compileSchema; -function resolveRef(root, baseId, ref) { - var _a; - ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref); - const schOrFunc = root.refs[ref]; - if (schOrFunc) - return schOrFunc; - let _sch = resolve.call(this, root, ref); - if (_sch === undefined) { - const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv - const { schemaId } = this.opts; - if (schema) - _sch = new SchemaEnv({ schema, schemaId, root, baseId }); - } - if (_sch === undefined) - return; - return (root.refs[ref] = inlineOrCompile.call(this, _sch)); -} -exports.resolveRef = resolveRef; -function inlineOrCompile(sch) { - if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs)) - return sch.schema; - return sch.validate ? sch : compileSchema.call(this, sch); -} -// Index of schema compilation in the currently compiled list -function getCompilingSchema(schEnv) { - for (const sch of this._compilations) { - if (sameSchemaEnv(sch, schEnv)) - return sch; - } -} -exports.getCompilingSchema = getCompilingSchema; -function sameSchemaEnv(s1, s2) { - return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId; -} -// resolve and compile the references ($ref) -// TODO returns AnySchemaObject (if the schema can be inlined) or validation function -function resolve(root, // information about the root schema for the current schema -ref // reference to resolve -) { - let sch; - while (typeof (sch = this.refs[ref]) == "string") - ref = sch; - return sch || this.schemas[ref] || resolveSchema.call(this, root, ref); -} -// Resolve schema, its root and baseId -function resolveSchema(root, // root object with properties schema, refs TODO below SchemaEnv is assigned to it -ref // reference to resolve -) { - const p = this.opts.uriResolver.parse(ref); - const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p); - let baseId = (0, resolve_1.getFullPath)(this.opts.uriResolver, root.baseId, undefined); - // TODO `Object.keys(root.schema).length > 0` should not be needed - but removing breaks 2 tests - if (Object.keys(root.schema).length > 0 && refPath === baseId) { - return getJsonPointer.call(this, p, root); - } - const id = (0, resolve_1.normalizeId)(refPath); - const schOrRef = this.refs[id] || this.schemas[id]; - if (typeof schOrRef == "string") { - const sch = resolveSchema.call(this, root, schOrRef); - if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== "object") - return; - return getJsonPointer.call(this, p, sch); - } - if (typeof (schOrRef === null || schOrRef === void 0 ? void 0 : schOrRef.schema) !== "object") - return; - if (!schOrRef.validate) - compileSchema.call(this, schOrRef); - if (id === (0, resolve_1.normalizeId)(ref)) { - const { schema } = schOrRef; - const { schemaId } = this.opts; - const schId = schema[schemaId]; - if (schId) - baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId); - return new SchemaEnv({ schema, schemaId, root, baseId }); - } - return getJsonPointer.call(this, p, schOrRef); -} -exports.resolveSchema = resolveSchema; -const PREVENT_SCOPE_CHANGE = new Set([ - "properties", - "patternProperties", - "enum", - "dependencies", - "definitions", -]); -function getJsonPointer(parsedRef, { baseId, schema, root }) { - var _a; - if (((_a = parsedRef.fragment) === null || _a === void 0 ? void 0 : _a[0]) !== "/") - return; - for (const part of parsedRef.fragment.slice(1).split("/")) { - if (typeof schema === "boolean") - return; - const partSchema = schema[(0, util_1.unescapeFragment)(part)]; - if (partSchema === undefined) - return; - schema = partSchema; - // TODO PREVENT_SCOPE_CHANGE could be defined in keyword def? - const schId = typeof schema === "object" && schema[this.opts.schemaId]; - if (!PREVENT_SCOPE_CHANGE.has(part) && schId) { - baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId); - } - } - let env; - if (typeof schema != "boolean" && schema.$ref && !(0, util_1.schemaHasRulesButRef)(schema, this.RULES)) { - const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema.$ref); - env = resolveSchema.call(this, root, $ref); - } - // even though resolution failed we need to return SchemaEnv to throw exception - // so that compileAsync loads missing schema. - const { schemaId } = this.opts; - env = env || new SchemaEnv({ schema, schemaId, root, baseId }); - if (env.schema !== env.root.schema) - return env; - return undefined; -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/index.js.map b/node_modules/ajv/dist/compile/index.js.map deleted file mode 100644 index 22dcc0b..0000000 --- a/node_modules/ajv/dist/compile/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/compile/index.ts"],"names":[],"mappings":";;;AAUA,uCAAgF;AAChF,kEAAyD;AACzD,mCAAuB;AACvB,uCAAkG;AAClG,iCAA6D;AAC7D,yCAA+C;AA0D/C,MAAa,SAAS;IAkBpB,YAAY,GAAkB;;QATrB,SAAI,GAAe,EAAE,CAAA;QACrB,mBAAc,GAA6B,EAAE,CAAA;QASpD,IAAI,MAAmC,CAAA;QACvC,IAAI,OAAO,GAAG,CAAC,MAAM,IAAI,QAAQ;YAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;QACtD,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,IAAI,CAAA;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAA,GAAG,CAAC,MAAM,mCAAI,IAAA,qBAAW,EAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,GAAG,CAAC,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAA;QACxE,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAA;QAChC,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAA;QAC9B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,EAAE,CAAA;IAChB,CAAC;CACF;AA/BD,8BA+BC;AAED,mBAAmB;AACnB,oBAAoB;AAEpB,+BAA+B;AAC/B,SAAgB,aAAa,CAAY,GAAc;IACrD,sCAAsC;IACtC,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC/C,IAAI,IAAI;QAAE,OAAO,IAAI,CAAA;IACrB,MAAM,MAAM,GAAG,IAAA,qBAAW,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA,CAAC,4CAA4C;IAC/G,MAAM,EAAC,GAAG,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;IACnC,MAAM,EAAC,aAAa,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;IACjC,MAAM,GAAG,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAC,GAAG,EAAE,KAAK,EAAE,aAAa,EAAC,CAAC,CAAA;IAChE,IAAI,gBAAgB,CAAA;IACpB,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QACf,gBAAgB,GAAG,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE;YACzC,GAAG,EAAE,0BAAe;YACpB,IAAI,EAAE,IAAA,WAAC,EAAA,sDAAsD;SAC9D,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,YAAY,GAAG,GAAG,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;IAC9C,GAAG,CAAC,YAAY,GAAG,YAAY,CAAA;IAE/B,MAAM,SAAS,GAAc;QAC3B,GAAG;QACH,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS;QAC9B,IAAI,EAAE,eAAC,CAAC,IAAI;QACZ,UAAU,EAAE,eAAC,CAAC,UAAU;QACxB,kBAAkB,EAAE,eAAC,CAAC,kBAAkB;QACxC,SAAS,EAAE,CAAC,eAAC,CAAC,IAAI,CAAC;QACnB,WAAW,EAAE,CAAC,aAAG,CAAC,EAAE,8DAA8D;QAClF,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,EAAE;QACb,iBAAiB,EAAE,IAAI,GAAG,EAAU;QACpC,YAAY,EAAE,GAAG,CAAC,UAAU,CAC1B,QAAQ,EACR,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI;YAC5B,CAAC,CAAC,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAA,mBAAS,EAAC,GAAG,CAAC,MAAM,CAAC,EAAC;YAChD,CAAC,CAAC,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAC,CACtB;QACD,YAAY;QACZ,eAAe,EAAE,gBAAgB;QACjC,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,SAAS,EAAE,GAAG;QACd,MAAM;QACN,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,MAAM;QAC5B,UAAU,EAAE,aAAG;QACf,aAAa,EAAE,GAAG,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QAC3D,SAAS,EAAE,IAAA,WAAC,EAAA,IAAI;QAChB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,IAAI;KACX,CAAA;IAED,IAAI,UAA8B,CAAA;IAClC,IAAI,CAAC;QACH,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAC3B,IAAA,+BAAoB,EAAC,SAAS,CAAC,CAAA;QAC/B,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACrC,kBAAkB;QAClB,MAAM,YAAY,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAA;QACnC,UAAU,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,eAAC,CAAC,KAAK,CAAC,UAAU,YAAY,EAAE,CAAA;QAC9D,6EAA6E;QAC7E,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAA;QAChF,2CAA2C;QAC3C,MAAM,YAAY,GAAG,IAAI,QAAQ,CAAC,GAAG,eAAC,CAAC,IAAI,EAAE,EAAE,GAAG,eAAC,CAAC,KAAK,EAAE,EAAE,UAAU,CAAC,CAAA;QACxE,MAAM,QAAQ,GAAwB,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAA;QAC1E,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC,CAAC,CAAA;QAE/C,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAA;QACtB,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;QAC5B,QAAQ,CAAC,SAAS,GAAG,GAAG,CAAA;QACxB,IAAI,GAAG,CAAC,MAAM;YAAG,QAAkC,CAAC,MAAM,GAAG,IAAI,CAAA;QACjE,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;YACnC,QAAQ,CAAC,MAAM,GAAG,EAAC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,CAAC,OAAO,EAAC,CAAA;QAC1E,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YAC1B,MAAM,EAAC,KAAK,EAAE,KAAK,EAAC,GAAG,SAAS,CAAA;YAChC,QAAQ,CAAC,SAAS,GAAG;gBACnB,KAAK,EAAE,KAAK,YAAY,cAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK;gBAChD,KAAK,EAAE,KAAK,YAAY,cAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK;gBAChD,YAAY,EAAE,KAAK,YAAY,cAAI;gBACnC,YAAY,EAAE,KAAK,YAAY,cAAI;aACpC,CAAA;YACD,IAAI,QAAQ,CAAC,MAAM;gBAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,GAAG,IAAA,mBAAS,EAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;QAChF,CAAC;QACD,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACvB,OAAO,GAAG,CAAA;IACZ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,GAAG,CAAC,QAAQ,CAAA;QACnB,OAAO,GAAG,CAAC,YAAY,CAAA;QACvB,IAAI,UAAU;YAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wCAAwC,EAAE,UAAU,CAAC,CAAA;QACvF,sDAAsD;QACtD,MAAM,CAAC,CAAA;IACT,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAChC,CAAC;AACH,CAAC;AA5FD,sCA4FC;AAED,SAAgB,UAAU,CAExB,IAAe,EACf,MAAc,EACd,GAAW;;IAEX,GAAG,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;IACpD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAChC,IAAI,SAAS;QAAE,OAAO,SAAS,CAAA;IAE/B,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;IACxC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,MAAA,IAAI,CAAC,SAAS,0CAAG,GAAG,CAAC,CAAA,CAAC,6CAA6C;QAClF,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;QAC5B,IAAI,MAAM;YAAE,IAAI,GAAG,IAAI,SAAS,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC,CAAA;IACpE,CAAC;IAED,IAAI,IAAI,KAAK,SAAS;QAAE,OAAM;IAC9B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;AAC5D,CAAC;AAnBD,gCAmBC;AAED,SAAS,eAAe,CAAY,GAAc;IAChD,IAAI,IAAA,mBAAS,EAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;QAAE,OAAO,GAAG,CAAC,MAAM,CAAA;IAClE,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;AAC3D,CAAC;AAED,6DAA6D;AAC7D,SAAgB,kBAAkB,CAAY,MAAiB;IAC7D,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QACrC,IAAI,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC;YAAE,OAAO,GAAG,CAAA;IAC5C,CAAC;AACH,CAAC;AAJD,gDAIC;AAED,SAAS,aAAa,CAAC,EAAa,EAAE,EAAa;IACjD,OAAO,EAAE,CAAC,MAAM,KAAK,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,MAAM,KAAK,EAAE,CAAC,MAAM,CAAA;AAClF,CAAC;AAED,4CAA4C;AAC5C,qFAAqF;AACrF,SAAS,OAAO,CAEd,IAAe,EAAE,2DAA2D;AAC5E,GAAW,CAAC,uBAAuB;;IAEnC,IAAI,GAAG,CAAA;IACP,OAAO,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,QAAQ;QAAE,GAAG,GAAG,GAAG,CAAA;IAC3D,OAAO,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;AACxE,CAAC;AAED,sCAAsC;AACtC,SAAgB,aAAa,CAE3B,IAAe,EAAE,kFAAkF;AACnG,GAAW,CAAC,uBAAuB;;IAEnC,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC1C,MAAM,OAAO,GAAG,IAAA,sBAAY,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAA;IACtD,IAAI,MAAM,GAAG,IAAA,qBAAW,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IACvE,gGAAgG;IAChG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QAC9D,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;IAC3C,CAAC;IAED,MAAM,EAAE,GAAG,IAAA,qBAAW,EAAC,OAAO,CAAC,CAAA;IAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IAClD,IAAI,OAAO,QAAQ,IAAI,QAAQ,EAAE,CAAC;QAChC,MAAM,GAAG,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;QACpD,IAAI,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,CAAA,KAAK,QAAQ;YAAE,OAAM;QAC3C,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,CAAA;IAC1C,CAAC;IAED,IAAI,OAAO,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAA,KAAK,QAAQ;QAAE,OAAM;IAChD,IAAI,CAAC,QAAQ,CAAC,QAAQ;QAAE,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IAC1D,IAAI,EAAE,KAAK,IAAA,qBAAW,EAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,EAAC,MAAM,EAAC,GAAG,QAAQ,CAAA;QACzB,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;QAC5B,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;QAC9B,IAAI,KAAK;YAAE,MAAM,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;QACpE,OAAO,IAAI,SAAS,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC,CAAA;IACxD,CAAC;IACD,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAA;AAC/C,CAAC;AA/BD,sCA+BC;AAED,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,YAAY;IACZ,mBAAmB;IACnB,MAAM;IACN,cAAc;IACd,aAAa;CACd,CAAC,CAAA;AAEF,SAAS,cAAc,CAErB,SAAuB,EACvB,EAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAY;;IAEjC,IAAI,CAAA,MAAA,SAAS,CAAC,QAAQ,0CAAG,CAAC,CAAC,MAAK,GAAG;QAAE,OAAM;IAC3C,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1D,IAAI,OAAO,MAAM,KAAK,SAAS;YAAE,OAAM;QACvC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAA,uBAAgB,EAAC,IAAI,CAAC,CAAC,CAAA;QACjD,IAAI,UAAU,KAAK,SAAS;YAAE,OAAM;QACpC,MAAM,GAAG,UAAU,CAAA;QACnB,6DAA6D;QAC7D,MAAM,KAAK,GAAG,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACtE,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC;YAC7C,MAAM,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;QAC3D,CAAC;IACH,CAAC;IACD,IAAI,GAA0B,CAAA;IAC9B,IAAI,OAAO,MAAM,IAAI,SAAS,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,IAAA,2BAAoB,EAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3F,MAAM,IAAI,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;QACnE,GAAG,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IAC5C,CAAC;IACD,+EAA+E;IAC/E,6CAA6C;IAC7C,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;IAC5B,GAAG,GAAG,GAAG,IAAI,IAAI,SAAS,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC,CAAA;IAC5D,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,MAAM;QAAE,OAAO,GAAG,CAAA;IAC9C,OAAO,SAAS,CAAA;AAClB,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/jtd/parse.d.ts b/node_modules/ajv/dist/compile/jtd/parse.d.ts deleted file mode 100644 index 618c64a..0000000 --- a/node_modules/ajv/dist/compile/jtd/parse.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type Ajv from "../../core"; -import { SchemaObjectMap } from "./types"; -import { SchemaEnv } from ".."; -export default function compileParser(this: Ajv, sch: SchemaEnv, definitions: SchemaObjectMap): SchemaEnv; diff --git a/node_modules/ajv/dist/compile/jtd/parse.js b/node_modules/ajv/dist/compile/jtd/parse.js deleted file mode 100644 index 8fc94fd..0000000 --- a/node_modules/ajv/dist/compile/jtd/parse.js +++ /dev/null @@ -1,350 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const types_1 = require("./types"); -const __1 = require(".."); -const codegen_1 = require("../codegen"); -const ref_error_1 = require("../ref_error"); -const names_1 = require("../names"); -const code_1 = require("../../vocabularies/code"); -const ref_1 = require("../../vocabularies/jtd/ref"); -const type_1 = require("../../vocabularies/jtd/type"); -const parseJson_1 = require("../../runtime/parseJson"); -const util_1 = require("../util"); -const timestamp_1 = require("../../runtime/timestamp"); -const genParse = { - elements: parseElements, - values: parseValues, - discriminator: parseDiscriminator, - properties: parseProperties, - optionalProperties: parseProperties, - enum: parseEnum, - type: parseType, - ref: parseRef, -}; -function compileParser(sch, definitions) { - const _sch = __1.getCompilingSchema.call(this, sch); - if (_sch) - return _sch; - const { es5, lines } = this.opts.code; - const { ownProperties } = this.opts; - const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties }); - const parseName = gen.scopeName("parse"); - const cxt = { - self: this, - gen, - schema: sch.schema, - schemaEnv: sch, - definitions, - data: names_1.default.data, - parseName, - char: gen.name("c"), - }; - let sourceCode; - try { - this._compilations.add(sch); - sch.parseName = parseName; - parserFunction(cxt); - gen.optimize(this.opts.code.optimize); - const parseFuncCode = gen.toString(); - sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${parseFuncCode}`; - const makeParse = new Function(`${names_1.default.scope}`, sourceCode); - const parse = makeParse(this.scope.get()); - this.scope.value(parseName, { ref: parse }); - sch.parse = parse; - } - catch (e) { - if (sourceCode) - this.logger.error("Error compiling parser, function code:", sourceCode); - delete sch.parse; - delete sch.parseName; - throw e; - } - finally { - this._compilations.delete(sch); - } - return sch; -} -exports.default = compileParser; -const undef = (0, codegen_1._) `undefined`; -function parserFunction(cxt) { - const { gen, parseName, char } = cxt; - gen.func(parseName, (0, codegen_1._) `${names_1.default.json}, ${names_1.default.jsonPos}, ${names_1.default.jsonPart}`, false, () => { - gen.let(names_1.default.data); - gen.let(char); - gen.assign((0, codegen_1._) `${parseName}.message`, undef); - gen.assign((0, codegen_1._) `${parseName}.position`, undef); - gen.assign(names_1.default.jsonPos, (0, codegen_1._) `${names_1.default.jsonPos} || 0`); - gen.const(names_1.default.jsonLen, (0, codegen_1._) `${names_1.default.json}.length`); - parseCode(cxt); - skipWhitespace(cxt); - gen.if(names_1.default.jsonPart, () => { - gen.assign((0, codegen_1._) `${parseName}.position`, names_1.default.jsonPos); - gen.return(names_1.default.data); - }); - gen.if((0, codegen_1._) `${names_1.default.jsonPos} === ${names_1.default.jsonLen}`, () => gen.return(names_1.default.data)); - jsonSyntaxError(cxt); - }); -} -function parseCode(cxt) { - let form; - for (const key of types_1.jtdForms) { - if (key in cxt.schema) { - form = key; - break; - } - } - if (form) - parseNullable(cxt, genParse[form]); - else - parseEmpty(cxt); -} -const parseBoolean = parseBooleanToken(true, parseBooleanToken(false, jsonSyntaxError)); -function parseNullable(cxt, parseForm) { - const { gen, schema, data } = cxt; - if (!schema.nullable) - return parseForm(cxt); - tryParseToken(cxt, "null", parseForm, () => gen.assign(data, null)); -} -function parseElements(cxt) { - const { gen, schema, data } = cxt; - parseToken(cxt, "["); - const ix = gen.let("i", 0); - gen.assign(data, (0, codegen_1._) `[]`); - parseItems(cxt, "]", () => { - const el = gen.let("el"); - parseCode({ ...cxt, schema: schema.elements, data: el }); - gen.assign((0, codegen_1._) `${data}[${ix}++]`, el); - }); -} -function parseValues(cxt) { - const { gen, schema, data } = cxt; - parseToken(cxt, "{"); - gen.assign(data, (0, codegen_1._) `{}`); - parseItems(cxt, "}", () => parseKeyValue(cxt, schema.values)); -} -function parseItems(cxt, endToken, block) { - tryParseItems(cxt, endToken, block); - parseToken(cxt, endToken); -} -function tryParseItems(cxt, endToken, block) { - const { gen } = cxt; - gen.for((0, codegen_1._) `;${names_1.default.jsonPos}<${names_1.default.jsonLen} && ${jsonSlice(1)}!==${endToken};`, () => { - block(); - tryParseToken(cxt, ",", () => gen.break(), hasItem); - }); - function hasItem() { - tryParseToken(cxt, endToken, () => { }, jsonSyntaxError); - } -} -function parseKeyValue(cxt, schema) { - const { gen } = cxt; - const key = gen.let("key"); - parseString({ ...cxt, data: key }); - parseToken(cxt, ":"); - parsePropertyValue(cxt, key, schema); -} -function parseDiscriminator(cxt) { - const { gen, data, schema } = cxt; - const { discriminator, mapping } = schema; - parseToken(cxt, "{"); - gen.assign(data, (0, codegen_1._) `{}`); - const startPos = gen.const("pos", names_1.default.jsonPos); - const value = gen.let("value"); - const tag = gen.let("tag"); - tryParseItems(cxt, "}", () => { - const key = gen.let("key"); - parseString({ ...cxt, data: key }); - parseToken(cxt, ":"); - gen.if((0, codegen_1._) `${key} === ${discriminator}`, () => { - parseString({ ...cxt, data: tag }); - gen.assign((0, codegen_1._) `${data}[${key}]`, tag); - gen.break(); - }, () => parseEmpty({ ...cxt, data: value }) // can be discarded/skipped - ); - }); - gen.assign(names_1.default.jsonPos, startPos); - gen.if((0, codegen_1._) `${tag} === undefined`); - parsingError(cxt, (0, codegen_1.str) `discriminator tag not found`); - for (const tagValue in mapping) { - gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`); - parseSchemaProperties({ ...cxt, schema: mapping[tagValue] }, discriminator); - } - gen.else(); - parsingError(cxt, (0, codegen_1.str) `discriminator value not in schema`); - gen.endIf(); -} -function parseProperties(cxt) { - const { gen, data } = cxt; - parseToken(cxt, "{"); - gen.assign(data, (0, codegen_1._) `{}`); - parseSchemaProperties(cxt); -} -function parseSchemaProperties(cxt, discriminator) { - const { gen, schema, data } = cxt; - const { properties, optionalProperties, additionalProperties } = schema; - parseItems(cxt, "}", () => { - const key = gen.let("key"); - parseString({ ...cxt, data: key }); - parseToken(cxt, ":"); - gen.if(false); - parseDefinedProperty(cxt, key, properties); - parseDefinedProperty(cxt, key, optionalProperties); - if (discriminator) { - gen.elseIf((0, codegen_1._) `${key} === ${discriminator}`); - const tag = gen.let("tag"); - parseString({ ...cxt, data: tag }); // can be discarded, it is already assigned - } - gen.else(); - if (additionalProperties) { - parseEmpty({ ...cxt, data: (0, codegen_1._) `${data}[${key}]` }); - } - else { - parsingError(cxt, (0, codegen_1.str) `property ${key} not allowed`); - } - gen.endIf(); - }); - if (properties) { - const hasProp = (0, code_1.hasPropFunc)(gen); - const allProps = (0, codegen_1.and)(...Object.keys(properties).map((p) => (0, codegen_1._) `${hasProp}.call(${data}, ${p})`)); - gen.if((0, codegen_1.not)(allProps), () => parsingError(cxt, (0, codegen_1.str) `missing required properties`)); - } -} -function parseDefinedProperty(cxt, key, schemas = {}) { - const { gen } = cxt; - for (const prop in schemas) { - gen.elseIf((0, codegen_1._) `${key} === ${prop}`); - parsePropertyValue(cxt, key, schemas[prop]); - } -} -function parsePropertyValue(cxt, key, schema) { - parseCode({ ...cxt, schema, data: (0, codegen_1._) `${cxt.data}[${key}]` }); -} -function parseType(cxt) { - const { gen, schema, data, self } = cxt; - switch (schema.type) { - case "boolean": - parseBoolean(cxt); - break; - case "string": - parseString(cxt); - break; - case "timestamp": { - parseString(cxt); - const vts = (0, util_1.useFunc)(gen, timestamp_1.default); - const { allowDate, parseDate } = self.opts; - const notValid = allowDate ? (0, codegen_1._) `!${vts}(${data}, true)` : (0, codegen_1._) `!${vts}(${data})`; - const fail = parseDate - ? (0, codegen_1.or)(notValid, (0, codegen_1._) `(${data} = new Date(${data}), false)`, (0, codegen_1._) `isNaN(${data}.valueOf())`) - : notValid; - gen.if(fail, () => parsingError(cxt, (0, codegen_1.str) `invalid timestamp`)); - break; - } - case "float32": - case "float64": - parseNumber(cxt); - break; - default: { - const t = schema.type; - if (!self.opts.int32range && (t === "int32" || t === "uint32")) { - parseNumber(cxt, 16); // 2 ** 53 - max safe integer - if (t === "uint32") { - gen.if((0, codegen_1._) `${data} < 0`, () => parsingError(cxt, (0, codegen_1.str) `integer out of range`)); - } - } - else { - const [min, max, maxDigits] = type_1.intRange[t]; - parseNumber(cxt, maxDigits); - gen.if((0, codegen_1._) `${data} < ${min} || ${data} > ${max}`, () => parsingError(cxt, (0, codegen_1.str) `integer out of range`)); - } - } - } -} -function parseString(cxt) { - parseToken(cxt, '"'); - parseWith(cxt, parseJson_1.parseJsonString); -} -function parseEnum(cxt) { - const { gen, data, schema } = cxt; - const enumSch = schema.enum; - parseToken(cxt, '"'); - // TODO loopEnum - gen.if(false); - for (const value of enumSch) { - const valueStr = JSON.stringify(value).slice(1); // remove starting quote - gen.elseIf((0, codegen_1._) `${jsonSlice(valueStr.length)} === ${valueStr}`); - gen.assign(data, (0, codegen_1.str) `${value}`); - gen.add(names_1.default.jsonPos, valueStr.length); - } - gen.else(); - jsonSyntaxError(cxt); - gen.endIf(); -} -function parseNumber(cxt, maxDigits) { - const { gen } = cxt; - skipWhitespace(cxt); - gen.if((0, codegen_1._) `"-0123456789".indexOf(${jsonSlice(1)}) < 0`, () => jsonSyntaxError(cxt), () => parseWith(cxt, parseJson_1.parseJsonNumber, maxDigits)); -} -function parseBooleanToken(bool, fail) { - return (cxt) => { - const { gen, data } = cxt; - tryParseToken(cxt, `${bool}`, () => fail(cxt), () => gen.assign(data, bool)); - }; -} -function parseRef(cxt) { - const { gen, self, definitions, schema, schemaEnv } = cxt; - const { ref } = schema; - const refSchema = definitions[ref]; - if (!refSchema) - throw new ref_error_1.default(self.opts.uriResolver, "", ref, `No definition ${ref}`); - if (!(0, ref_1.hasRef)(refSchema)) - return parseCode({ ...cxt, schema: refSchema }); - const { root } = schemaEnv; - const sch = compileParser.call(self, new __1.SchemaEnv({ schema: refSchema, root }), definitions); - partialParse(cxt, getParser(gen, sch), true); -} -function getParser(gen, sch) { - return sch.parse - ? gen.scopeValue("parse", { ref: sch.parse }) - : (0, codegen_1._) `${gen.scopeValue("wrapper", { ref: sch })}.parse`; -} -function parseEmpty(cxt) { - parseWith(cxt, parseJson_1.parseJson); -} -function parseWith(cxt, parseFunc, args) { - partialParse(cxt, (0, util_1.useFunc)(cxt.gen, parseFunc), args); -} -function partialParse(cxt, parseFunc, args) { - const { gen, data } = cxt; - gen.assign(data, (0, codegen_1._) `${parseFunc}(${names_1.default.json}, ${names_1.default.jsonPos}${args ? (0, codegen_1._) `, ${args}` : codegen_1.nil})`); - gen.assign(names_1.default.jsonPos, (0, codegen_1._) `${parseFunc}.position`); - gen.if((0, codegen_1._) `${data} === undefined`, () => parsingError(cxt, (0, codegen_1._) `${parseFunc}.message`)); -} -function parseToken(cxt, tok) { - tryParseToken(cxt, tok, jsonSyntaxError); -} -function tryParseToken(cxt, tok, fail, success) { - const { gen } = cxt; - const n = tok.length; - skipWhitespace(cxt); - gen.if((0, codegen_1._) `${jsonSlice(n)} === ${tok}`, () => { - gen.add(names_1.default.jsonPos, n); - success === null || success === void 0 ? void 0 : success(cxt); - }, () => fail(cxt)); -} -function skipWhitespace({ gen, char: c }) { - gen.code((0, codegen_1._) `while((${c}=${names_1.default.json}[${names_1.default.jsonPos}],${c}===" "||${c}==="\\n"||${c}==="\\r"||${c}==="\\t"))${names_1.default.jsonPos}++;`); -} -function jsonSlice(len) { - return len === 1 - ? (0, codegen_1._) `${names_1.default.json}[${names_1.default.jsonPos}]` - : (0, codegen_1._) `${names_1.default.json}.slice(${names_1.default.jsonPos}, ${names_1.default.jsonPos}+${len})`; -} -function jsonSyntaxError(cxt) { - parsingError(cxt, (0, codegen_1._) `"unexpected token " + ${names_1.default.json}[${names_1.default.jsonPos}]`); -} -function parsingError({ gen, parseName }, msg) { - gen.assign((0, codegen_1._) `${parseName}.message`, msg); - gen.assign((0, codegen_1._) `${parseName}.position`, names_1.default.jsonPos); - gen.return(undef); -} -//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/jtd/parse.js.map b/node_modules/ajv/dist/compile/jtd/parse.js.map deleted file mode 100644 index 87bd922..0000000 --- a/node_modules/ajv/dist/compile/jtd/parse.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../lib/compile/jtd/parse.ts"],"names":[],"mappings":";;AAEA,mCAA0D;AAC1D,0BAAgD;AAChD,wCAAmF;AACnF,4CAA0C;AAC1C,oCAAwB;AACxB,kDAAmD;AACnD,oDAAiD;AACjD,sDAA6D;AAC7D,uDAAmF;AACnF,kCAA+B;AAC/B,uDAAoD;AAIpD,MAAM,QAAQ,GAA+B;IAC3C,QAAQ,EAAE,aAAa;IACvB,MAAM,EAAE,WAAW;IACnB,aAAa,EAAE,kBAAkB;IACjC,UAAU,EAAE,eAAe;IAC3B,kBAAkB,EAAE,eAAe;IACnC,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,QAAQ;CACd,CAAA;AAaD,SAAwB,aAAa,CAEnC,GAAc,EACd,WAA4B;IAE5B,MAAM,IAAI,GAAG,sBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC/C,IAAI,IAAI;QAAE,OAAO,IAAI,CAAA;IACrB,MAAM,EAAC,GAAG,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;IACnC,MAAM,EAAC,aAAa,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;IACjC,MAAM,GAAG,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAC,GAAG,EAAE,KAAK,EAAE,aAAa,EAAC,CAAC,CAAA;IAChE,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IACxC,MAAM,GAAG,GAAa;QACpB,IAAI,EAAE,IAAI;QACV,GAAG;QACH,MAAM,EAAE,GAAG,CAAC,MAAsB;QAClC,SAAS,EAAE,GAAG;QACd,WAAW;QACX,IAAI,EAAE,eAAC,CAAC,IAAI;QACZ,SAAS;QACT,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;KACpB,CAAA;IAED,IAAI,UAA8B,CAAA;IAClC,IAAI,CAAC;QACH,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAC3B,GAAG,CAAC,SAAS,GAAG,SAAS,CAAA;QACzB,cAAc,CAAC,GAAG,CAAC,CAAA;QACnB,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACrC,MAAM,aAAa,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAA;QACpC,UAAU,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,eAAC,CAAC,KAAK,CAAC,UAAU,aAAa,EAAE,CAAA;QAC/D,MAAM,SAAS,GAAG,IAAI,QAAQ,CAAC,GAAG,eAAC,CAAC,KAAK,EAAE,EAAE,UAAU,CAAC,CAAA;QACxD,MAAM,KAAK,GAA8B,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAA;QACpE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,EAAC,GAAG,EAAE,KAAK,EAAC,CAAC,CAAA;QACzC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAA;IACnB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,UAAU;YAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wCAAwC,EAAE,UAAU,CAAC,CAAA;QACvF,OAAO,GAAG,CAAC,KAAK,CAAA;QAChB,OAAO,GAAG,CAAC,SAAS,CAAA;QACpB,MAAM,CAAC,CAAA;IACT,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAChC,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AA3CD,gCA2CC;AAED,MAAM,KAAK,GAAG,IAAA,WAAC,EAAA,WAAW,CAAA;AAE1B,SAAS,cAAc,CAAC,GAAa;IACnC,MAAM,EAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;IAClC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,IAAI,KAAK,eAAC,CAAC,OAAO,KAAK,eAAC,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;QACzE,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,CAAC,CAAA;QACf,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACb,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,SAAS,UAAU,EAAE,KAAK,CAAC,CAAA;QAC1C,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,SAAS,WAAW,EAAE,KAAK,CAAC,CAAA;QAC3C,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,OAAO,OAAO,CAAC,CAAA;QAC3C,GAAG,CAAC,KAAK,CAAC,eAAC,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,IAAI,SAAS,CAAC,CAAA;QACzC,SAAS,CAAC,GAAG,CAAC,CAAA;QACd,cAAc,CAAC,GAAG,CAAC,CAAA;QACnB,GAAG,CAAC,EAAE,CAAC,eAAC,CAAC,QAAQ,EAAE,GAAG,EAAE;YACtB,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,SAAS,WAAW,EAAE,eAAC,CAAC,OAAO,CAAC,CAAA;YAC/C,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,IAAI,CAAC,CAAA;QACpB,CAAC,CAAC,CAAA;QACF,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,OAAO,QAAQ,eAAC,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,IAAI,CAAC,CAAC,CAAA;QAClE,eAAe,CAAC,GAAG,CAAC,CAAA;IACtB,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,GAAa;IAC9B,IAAI,IAAyB,CAAA;IAC7B,KAAK,MAAM,GAAG,IAAI,gBAAQ,EAAE,CAAC;QAC3B,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YACtB,IAAI,GAAG,GAAG,CAAA;YACV,MAAK;QACP,CAAC;IACH,CAAC;IACD,IAAI,IAAI;QAAE,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAA;;QACvC,UAAU,CAAC,GAAG,CAAC,CAAA;AACtB,CAAC;AAED,MAAM,YAAY,GAAG,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC,CAAA;AAEvF,SAAS,aAAa,CAAC,GAAa,EAAE,SAAmB;IACvD,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;IAC/B,IAAI,CAAC,MAAM,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAC,GAAG,CAAC,CAAA;IAC3C,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;AACrE,CAAC;AAED,SAAS,aAAa,CAAC,GAAa;IAClC,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;IAC/B,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACpB,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;IAC1B,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,IAAI,CAAC,CAAA;IACvB,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;QACxB,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACxB,SAAS,CAAC,EAAC,GAAG,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAC,CAAC,CAAA;QACtD,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,GAAa;IAChC,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;IAC/B,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACpB,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,IAAI,CAAC,CAAA;IACvB,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;AAC/D,CAAC;AAED,SAAS,UAAU,CAAC,GAAa,EAAE,QAAgB,EAAE,KAAiB;IACpE,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAA;IACnC,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;AAC3B,CAAC;AAED,SAAS,aAAa,CAAC,GAAa,EAAE,QAAgB,EAAE,KAAiB;IACvE,MAAM,EAAC,GAAG,EAAC,GAAG,GAAG,CAAA;IACjB,GAAG,CAAC,GAAG,CAAC,IAAA,WAAC,EAAA,IAAI,eAAC,CAAC,OAAO,IAAI,eAAC,CAAC,OAAO,OAAO,SAAS,CAAC,CAAC,CAAC,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE;QAC5E,KAAK,EAAE,CAAA;QACP,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,CAAA;IACrD,CAAC,CAAC,CAAA;IAEF,SAAS,OAAO;QACd,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,eAAe,CAAC,CAAA;IACzD,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,GAAa,EAAE,MAAoB;IACxD,MAAM,EAAC,GAAG,EAAC,GAAG,GAAG,CAAA;IACjB,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAC1B,WAAW,CAAC,EAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,CAAC,CAAA;IAChC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACpB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAED,SAAS,kBAAkB,CAAC,GAAa;IACvC,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;IAC/B,MAAM,EAAC,aAAa,EAAE,OAAO,EAAC,GAAG,MAAM,CAAA;IACvC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACpB,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,IAAI,CAAC,CAAA;IACvB,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,eAAC,CAAC,OAAO,CAAC,CAAA;IAC5C,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IAC9B,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAC1B,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;QAC3B,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAC1B,WAAW,CAAC,EAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,CAAC,CAAA;QAChC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;QACpB,GAAG,CAAC,EAAE,CACJ,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,aAAa,EAAE,EAC9B,GAAG,EAAE;YACH,WAAW,CAAC,EAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,CAAC,CAAA;YAChC,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,IAAI,GAAG,GAAG,EAAE,GAAG,CAAC,CAAA;YACnC,GAAG,CAAC,KAAK,EAAE,CAAA;QACb,CAAC,EACD,GAAG,EAAE,CAAC,UAAU,CAAC,EAAC,GAAG,GAAG,EAAE,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,2BAA2B;SACpE,CAAA;IACH,CAAC,CAAC,CAAA;IACF,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;IAC/B,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,gBAAgB,CAAC,CAAA;IAC/B,YAAY,CAAC,GAAG,EAAE,IAAA,aAAG,EAAA,6BAA6B,CAAC,CAAA;IACnD,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;QAC/B,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,QAAQ,EAAE,CAAC,CAAA;QACrC,qBAAqB,CAAC,EAAC,GAAG,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAC,EAAE,aAAa,CAAC,CAAA;IAC3E,CAAC;IACD,GAAG,CAAC,IAAI,EAAE,CAAA;IACV,YAAY,CAAC,GAAG,EAAE,IAAA,aAAG,EAAA,mCAAmC,CAAC,CAAA;IACzD,GAAG,CAAC,KAAK,EAAE,CAAA;AACb,CAAC;AAED,SAAS,eAAe,CAAC,GAAa;IACpC,MAAM,EAAC,GAAG,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;IACvB,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACpB,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,IAAI,CAAC,CAAA;IACvB,qBAAqB,CAAC,GAAG,CAAC,CAAA;AAC5B,CAAC;AAED,SAAS,qBAAqB,CAAC,GAAa,EAAE,aAAsB;IAClE,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;IAC/B,MAAM,EAAC,UAAU,EAAE,kBAAkB,EAAE,oBAAoB,EAAC,GAAG,MAAM,CAAA;IACrE,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;QACxB,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAC1B,WAAW,CAAC,EAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,CAAC,CAAA;QAChC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;QACpB,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;QACb,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,CAAA;QAC1C,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,kBAAkB,CAAC,CAAA;QAClD,IAAI,aAAa,EAAE,CAAC;YAClB,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,aAAa,EAAE,CAAC,CAAA;YAC1C,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;YAC1B,WAAW,CAAC,EAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,CAAC,CAAA,CAAC,2CAA2C;QAC9E,CAAC;QACD,GAAG,CAAC,IAAI,EAAE,CAAA;QACV,IAAI,oBAAoB,EAAE,CAAC;YACzB,UAAU,CAAC,EAAC,GAAG,GAAG,EAAE,IAAI,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,IAAI,GAAG,GAAG,EAAC,CAAC,CAAA;QAChD,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,GAAG,EAAE,IAAA,aAAG,EAAA,YAAY,GAAG,cAAc,CAAC,CAAA;QACrD,CAAC;QACD,GAAG,CAAC,KAAK,EAAE,CAAA;IACb,CAAC,CAAC,CAAA;IACF,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,IAAA,kBAAW,EAAC,GAAG,CAAC,CAAA;QAChC,MAAM,QAAQ,GAAS,IAAA,aAAG,EACxB,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAQ,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,OAAO,SAAS,IAAI,KAAK,CAAC,GAAG,CAAC,CAC/E,CAAA;QACD,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,IAAA,aAAG,EAAA,6BAA6B,CAAC,CAAC,CAAA;IAClF,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,GAAa,EAAE,GAAS,EAAE,UAA2B,EAAE;IACnF,MAAM,EAAC,GAAG,EAAC,GAAG,GAAG,CAAA;IACjB,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,IAAI,EAAE,CAAC,CAAA;QACjC,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,IAAI,CAAiB,CAAC,CAAA;IAC7D,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,GAAa,EAAE,GAAS,EAAE,MAAoB;IACxE,SAAS,CAAC,EAAC,GAAG,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAA,WAAC,EAAA,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,GAAG,EAAC,CAAC,CAAA;AAC3D,CAAC;AAED,SAAS,SAAS,CAAC,GAAa;IAC9B,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;IACrC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,SAAS;YACZ,YAAY,CAAC,GAAG,CAAC,CAAA;YACjB,MAAK;QACP,KAAK,QAAQ;YACX,WAAW,CAAC,GAAG,CAAC,CAAA;YAChB,MAAK;QACP,KAAK,WAAW,CAAC,CAAC,CAAC;YACjB,WAAW,CAAC,GAAG,CAAC,CAAA;YAChB,MAAM,GAAG,GAAG,IAAA,cAAO,EAAC,GAAG,EAAE,mBAAc,CAAC,CAAA;YACxC,MAAM,EAAC,SAAS,EAAE,SAAS,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;YACxC,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,IAAI,GAAG,IAAI,IAAI,SAAS,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,IAAI,GAAG,IAAI,IAAI,GAAG,CAAA;YAC5E,MAAM,IAAI,GAAS,SAAS;gBAC1B,CAAC,CAAC,IAAA,YAAE,EAAC,QAAQ,EAAE,IAAA,WAAC,EAAA,IAAI,IAAI,eAAe,IAAI,WAAW,EAAE,IAAA,WAAC,EAAA,SAAS,IAAI,aAAa,CAAC;gBACpF,CAAC,CAAC,QAAQ,CAAA;YACZ,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,IAAA,aAAG,EAAA,mBAAmB,CAAC,CAAC,CAAA;YAC7D,MAAK;QACP,CAAC;QACD,KAAK,SAAS,CAAC;QACf,KAAK,SAAS;YACZ,WAAW,CAAC,GAAG,CAAC,CAAA;YAChB,MAAK;QACP,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,CAAC,GAAG,MAAM,CAAC,IAAe,CAAA;YAChC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC,KAAK,OAAO,IAAI,CAAC,KAAK,QAAQ,CAAC,EAAE,CAAC;gBAC/D,WAAW,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA,CAAC,6BAA6B;gBAClD,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;oBACnB,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,MAAM,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,IAAA,aAAG,EAAA,sBAAsB,CAAC,CAAC,CAAA;gBAC5E,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,eAAQ,CAAC,CAAC,CAAC,CAAA;gBACzC,WAAW,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;gBAC3B,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,MAAM,GAAG,OAAO,IAAI,MAAM,GAAG,EAAE,EAAE,GAAG,EAAE,CACnD,YAAY,CAAC,GAAG,EAAE,IAAA,aAAG,EAAA,sBAAsB,CAAC,CAC7C,CAAA;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,GAAa;IAChC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACpB,SAAS,CAAC,GAAG,EAAE,2BAAe,CAAC,CAAA;AACjC,CAAC;AAED,SAAS,SAAS,CAAC,GAAa;IAC9B,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;IAC/B,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAA;IAC3B,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACpB,gBAAgB;IAChB,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACb,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA,CAAC,wBAAwB;QACxE,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,QAAQ,EAAE,CAAC,CAAA;QAC5D,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,GAAG,KAAK,EAAE,CAAC,CAAA;QAC/B,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACrC,CAAC;IACD,GAAG,CAAC,IAAI,EAAE,CAAA;IACV,eAAe,CAAC,GAAG,CAAC,CAAA;IACpB,GAAG,CAAC,KAAK,EAAE,CAAA;AACb,CAAC;AAED,SAAS,WAAW,CAAC,GAAa,EAAE,SAAkB;IACpD,MAAM,EAAC,GAAG,EAAC,GAAG,GAAG,CAAA;IACjB,cAAc,CAAC,GAAG,CAAC,CAAA;IACnB,GAAG,CAAC,EAAE,CACJ,IAAA,WAAC,EAAA,yBAAyB,SAAS,CAAC,CAAC,CAAC,OAAO,EAC7C,GAAG,EAAE,CAAC,eAAe,CAAC,GAAG,CAAC,EAC1B,GAAG,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,2BAAe,EAAE,SAAS,CAAC,CACjD,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAa,EAAE,IAAc;IACtD,OAAO,CAAC,GAAG,EAAE,EAAE;QACb,MAAM,EAAC,GAAG,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;QACvB,aAAa,CACX,GAAG,EACH,GAAG,IAAI,EAAE,EACT,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EACf,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAC7B,CAAA;IACH,CAAC,CAAA;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,GAAa;IAC7B,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAC,GAAG,GAAG,CAAA;IACvD,MAAM,EAAC,GAAG,EAAC,GAAG,MAAM,CAAA;IACpB,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;IAClC,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,mBAAe,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,EAAE,GAAG,EAAE,iBAAiB,GAAG,EAAE,CAAC,CAAA;IACjG,IAAI,CAAC,IAAA,YAAM,EAAC,SAAS,CAAC;QAAE,OAAO,SAAS,CAAC,EAAC,GAAG,GAAG,EAAE,MAAM,EAAE,SAAS,EAAC,CAAC,CAAA;IACrE,MAAM,EAAC,IAAI,EAAC,GAAG,SAAS,CAAA;IACxB,MAAM,GAAG,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,aAAS,CAAC,EAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAC,CAAC,EAAE,WAAW,CAAC,CAAA;IAC3F,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,CAAA;AAC9C,CAAC;AAED,SAAS,SAAS,CAAC,GAAY,EAAE,GAAc;IAC7C,OAAO,GAAG,CAAC,KAAK;QACd,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,EAAC,GAAG,EAAE,GAAG,CAAC,KAAK,EAAC,CAAC;QAC3C,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE,EAAC,GAAG,EAAE,GAAG,EAAC,CAAC,QAAQ,CAAA;AACvD,CAAC;AAED,SAAS,UAAU,CAAC,GAAa;IAC/B,SAAS,CAAC,GAAG,EAAE,qBAAS,CAAC,CAAA;AAC3B,CAAC;AAED,SAAS,SAAS,CAAC,GAAa,EAAE,SAAyB,EAAE,IAAe;IAC1E,YAAY,CAAC,GAAG,EAAE,IAAA,cAAO,EAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,CAAA;AACtD,CAAC;AAED,SAAS,YAAY,CAAC,GAAa,EAAE,SAAe,EAAE,IAAe;IACnE,MAAM,EAAC,GAAG,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;IACvB,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,GAAG,SAAS,IAAI,eAAC,CAAC,IAAI,KAAK,eAAC,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,aAAG,GAAG,CAAC,CAAA;IACtF,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,SAAS,WAAW,CAAC,CAAA;IAC/C,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,gBAAgB,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,IAAA,WAAC,EAAA,GAAG,SAAS,UAAU,CAAC,CAAC,CAAA;AACpF,CAAC;AAED,SAAS,UAAU,CAAC,GAAa,EAAE,GAAW;IAC5C,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,eAAe,CAAC,CAAA;AAC1C,CAAC;AAED,SAAS,aAAa,CAAC,GAAa,EAAE,GAAW,EAAE,IAAc,EAAE,OAAkB;IACnF,MAAM,EAAC,GAAG,EAAC,GAAG,GAAG,CAAA;IACjB,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAA;IACpB,cAAc,CAAC,GAAG,CAAC,CAAA;IACnB,GAAG,CAAC,EAAE,CACJ,IAAA,WAAC,EAAA,GAAG,SAAS,CAAC,CAAC,CAAC,QAAQ,GAAG,EAAE,EAC7B,GAAG,EAAE;QACH,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;QACrB,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,GAAG,CAAC,CAAA;IAChB,CAAC,EACD,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAChB,CAAA;AACH,CAAC;AAED,SAAS,cAAc,CAAC,EAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAW;IAC9C,GAAG,CAAC,IAAI,CACN,IAAA,WAAC,EAAA,UAAU,CAAC,IAAI,eAAC,CAAC,IAAI,IAAI,eAAC,CAAC,OAAO,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,aAAa,CAAC,aAAa,eAAC,CAAC,OAAO,KAAK,CAC7G,CAAA;AACH,CAAC;AAED,SAAS,SAAS,CAAC,GAAkB;IACnC,OAAO,GAAG,KAAK,CAAC;QACd,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,IAAI,IAAI,eAAC,CAAC,OAAO,GAAG;QAC5B,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,IAAI,UAAU,eAAC,CAAC,OAAO,KAAK,eAAC,CAAC,OAAO,IAAI,GAAG,GAAG,CAAA;AAC3D,CAAC;AAED,SAAS,eAAe,CAAC,GAAa;IACpC,YAAY,CAAC,GAAG,EAAE,IAAA,WAAC,EAAA,yBAAyB,eAAC,CAAC,IAAI,IAAI,eAAC,CAAC,OAAO,GAAG,CAAC,CAAA;AACrE,CAAC;AAED,SAAS,YAAY,CAAC,EAAC,GAAG,EAAE,SAAS,EAAW,EAAE,GAAS;IACzD,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,SAAS,UAAU,EAAE,GAAG,CAAC,CAAA;IACxC,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,SAAS,WAAW,EAAE,eAAC,CAAC,OAAO,CAAC,CAAA;IAC/C,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACnB,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/jtd/serialize.d.ts b/node_modules/ajv/dist/compile/jtd/serialize.d.ts deleted file mode 100644 index b0413d7..0000000 --- a/node_modules/ajv/dist/compile/jtd/serialize.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type Ajv from "../../core"; -import { SchemaObjectMap } from "./types"; -import { SchemaEnv } from ".."; -export default function compileSerializer(this: Ajv, sch: SchemaEnv, definitions: SchemaObjectMap): SchemaEnv; diff --git a/node_modules/ajv/dist/compile/jtd/serialize.js b/node_modules/ajv/dist/compile/jtd/serialize.js deleted file mode 100644 index 341c500..0000000 --- a/node_modules/ajv/dist/compile/jtd/serialize.js +++ /dev/null @@ -1,229 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const types_1 = require("./types"); -const __1 = require(".."); -const codegen_1 = require("../codegen"); -const ref_error_1 = require("../ref_error"); -const names_1 = require("../names"); -const code_1 = require("../../vocabularies/code"); -const ref_1 = require("../../vocabularies/jtd/ref"); -const util_1 = require("../util"); -const quote_1 = require("../../runtime/quote"); -const genSerialize = { - elements: serializeElements, - values: serializeValues, - discriminator: serializeDiscriminator, - properties: serializeProperties, - optionalProperties: serializeProperties, - enum: serializeString, - type: serializeType, - ref: serializeRef, -}; -function compileSerializer(sch, definitions) { - const _sch = __1.getCompilingSchema.call(this, sch); - if (_sch) - return _sch; - const { es5, lines } = this.opts.code; - const { ownProperties } = this.opts; - const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties }); - const serializeName = gen.scopeName("serialize"); - const cxt = { - self: this, - gen, - schema: sch.schema, - schemaEnv: sch, - definitions, - data: names_1.default.data, - }; - let sourceCode; - try { - this._compilations.add(sch); - sch.serializeName = serializeName; - gen.func(serializeName, names_1.default.data, false, () => { - gen.let(names_1.default.json, (0, codegen_1.str) ``); - serializeCode(cxt); - gen.return(names_1.default.json); - }); - gen.optimize(this.opts.code.optimize); - const serializeFuncCode = gen.toString(); - sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${serializeFuncCode}`; - const makeSerialize = new Function(`${names_1.default.scope}`, sourceCode); - const serialize = makeSerialize(this.scope.get()); - this.scope.value(serializeName, { ref: serialize }); - sch.serialize = serialize; - } - catch (e) { - if (sourceCode) - this.logger.error("Error compiling serializer, function code:", sourceCode); - delete sch.serialize; - delete sch.serializeName; - throw e; - } - finally { - this._compilations.delete(sch); - } - return sch; -} -exports.default = compileSerializer; -function serializeCode(cxt) { - let form; - for (const key of types_1.jtdForms) { - if (key in cxt.schema) { - form = key; - break; - } - } - serializeNullable(cxt, form ? genSerialize[form] : serializeEmpty); -} -function serializeNullable(cxt, serializeForm) { - const { gen, schema, data } = cxt; - if (!schema.nullable) - return serializeForm(cxt); - gen.if((0, codegen_1._) `${data} === undefined || ${data} === null`, () => gen.add(names_1.default.json, (0, codegen_1._) `"null"`), () => serializeForm(cxt)); -} -function serializeElements(cxt) { - const { gen, schema, data } = cxt; - gen.add(names_1.default.json, (0, codegen_1.str) `[`); - const first = gen.let("first", true); - gen.forOf("el", data, (el) => { - addComma(cxt, first); - serializeCode({ ...cxt, schema: schema.elements, data: el }); - }); - gen.add(names_1.default.json, (0, codegen_1.str) `]`); -} -function serializeValues(cxt) { - const { gen, schema, data } = cxt; - gen.add(names_1.default.json, (0, codegen_1.str) `{`); - const first = gen.let("first", true); - gen.forIn("key", data, (key) => serializeKeyValue(cxt, key, schema.values, first)); - gen.add(names_1.default.json, (0, codegen_1.str) `}`); -} -function serializeKeyValue(cxt, key, schema, first) { - const { gen, data } = cxt; - addComma(cxt, first); - serializeString({ ...cxt, data: key }); - gen.add(names_1.default.json, (0, codegen_1.str) `:`); - const value = gen.const("value", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(key)}`); - serializeCode({ ...cxt, schema, data: value }); -} -function serializeDiscriminator(cxt) { - const { gen, schema, data } = cxt; - const { discriminator } = schema; - gen.add(names_1.default.json, (0, codegen_1.str) `{${JSON.stringify(discriminator)}:`); - const tag = gen.const("tag", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(discriminator)}`); - serializeString({ ...cxt, data: tag }); - gen.if(false); - for (const tagValue in schema.mapping) { - gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`); - const sch = schema.mapping[tagValue]; - serializeSchemaProperties({ ...cxt, schema: sch }, discriminator); - } - gen.endIf(); - gen.add(names_1.default.json, (0, codegen_1.str) `}`); -} -function serializeProperties(cxt) { - const { gen } = cxt; - gen.add(names_1.default.json, (0, codegen_1.str) `{`); - serializeSchemaProperties(cxt); - gen.add(names_1.default.json, (0, codegen_1.str) `}`); -} -function serializeSchemaProperties(cxt, discriminator) { - const { gen, schema, data } = cxt; - const { properties, optionalProperties } = schema; - const props = keys(properties); - const optProps = keys(optionalProperties); - const allProps = allProperties(props.concat(optProps)); - let first = !discriminator; - let firstProp; - for (const key of props) { - if (first) - first = false; - else - gen.add(names_1.default.json, (0, codegen_1.str) `,`); - serializeProperty(key, properties[key], keyValue(key)); - } - if (first) - firstProp = gen.let("first", true); - for (const key of optProps) { - const value = keyValue(key); - gen.if((0, codegen_1.and)((0, codegen_1._) `${value} !== undefined`, (0, code_1.isOwnProperty)(gen, data, key)), () => { - addComma(cxt, firstProp); - serializeProperty(key, optionalProperties[key], value); - }); - } - if (schema.additionalProperties) { - gen.forIn("key", data, (key) => gen.if(isAdditional(key, allProps), () => serializeKeyValue(cxt, key, {}, firstProp))); - } - function keys(ps) { - return ps ? Object.keys(ps) : []; - } - function allProperties(ps) { - if (discriminator) - ps.push(discriminator); - if (new Set(ps).size !== ps.length) { - throw new Error("JTD: properties/optionalProperties/disciminator overlap"); - } - return ps; - } - function keyValue(key) { - return gen.const("value", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(key)}`); - } - function serializeProperty(key, propSchema, value) { - gen.add(names_1.default.json, (0, codegen_1.str) `${JSON.stringify(key)}:`); - serializeCode({ ...cxt, schema: propSchema, data: value }); - } - function isAdditional(key, ps) { - return ps.length ? (0, codegen_1.and)(...ps.map((p) => (0, codegen_1._) `${key} !== ${p}`)) : true; - } -} -function serializeType(cxt) { - const { gen, schema, data } = cxt; - switch (schema.type) { - case "boolean": - gen.add(names_1.default.json, (0, codegen_1._) `${data} ? "true" : "false"`); - break; - case "string": - serializeString(cxt); - break; - case "timestamp": - gen.if((0, codegen_1._) `${data} instanceof Date`, () => gen.add(names_1.default.json, (0, codegen_1._) `'"' + ${data}.toISOString() + '"'`), () => serializeString(cxt)); - break; - default: - serializeNumber(cxt); - } -} -function serializeString({ gen, data }) { - gen.add(names_1.default.json, (0, codegen_1._) `${(0, util_1.useFunc)(gen, quote_1.default)}(${data})`); -} -function serializeNumber({ gen, data }) { - gen.add(names_1.default.json, (0, codegen_1._) `"" + ${data}`); -} -function serializeRef(cxt) { - const { gen, self, data, definitions, schema, schemaEnv } = cxt; - const { ref } = schema; - const refSchema = definitions[ref]; - if (!refSchema) - throw new ref_error_1.default(self.opts.uriResolver, "", ref, `No definition ${ref}`); - if (!(0, ref_1.hasRef)(refSchema)) - return serializeCode({ ...cxt, schema: refSchema }); - const { root } = schemaEnv; - const sch = compileSerializer.call(self, new __1.SchemaEnv({ schema: refSchema, root }), definitions); - gen.add(names_1.default.json, (0, codegen_1._) `${getSerialize(gen, sch)}(${data})`); -} -function getSerialize(gen, sch) { - return sch.serialize - ? gen.scopeValue("serialize", { ref: sch.serialize }) - : (0, codegen_1._) `${gen.scopeValue("wrapper", { ref: sch })}.serialize`; -} -function serializeEmpty({ gen, data }) { - gen.add(names_1.default.json, (0, codegen_1._) `JSON.stringify(${data})`); -} -function addComma({ gen }, first) { - if (first) { - gen.if(first, () => gen.assign(first, false), () => gen.add(names_1.default.json, (0, codegen_1.str) `,`)); - } - else { - gen.add(names_1.default.json, (0, codegen_1.str) `,`); - } -} -//# sourceMappingURL=serialize.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/jtd/serialize.js.map b/node_modules/ajv/dist/compile/jtd/serialize.js.map deleted file mode 100644 index 15c82c7..0000000 --- a/node_modules/ajv/dist/compile/jtd/serialize.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../../lib/compile/jtd/serialize.ts"],"names":[],"mappings":";;AAEA,mCAA0D;AAC1D,0BAAgD;AAChD,wCAAwE;AACxE,4CAA0C;AAC1C,oCAAwB;AACxB,kDAAqD;AACrD,oDAAiD;AACjD,kCAA+B;AAC/B,+CAAuC;AAEvC,MAAM,YAAY,GAAkD;IAClE,QAAQ,EAAE,iBAAiB;IAC3B,MAAM,EAAE,eAAe;IACvB,aAAa,EAAE,sBAAsB;IACrC,UAAU,EAAE,mBAAmB;IAC/B,kBAAkB,EAAE,mBAAmB;IACvC,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,aAAa;IACnB,GAAG,EAAE,YAAY;CAClB,CAAA;AAWD,SAAwB,iBAAiB,CAEvC,GAAc,EACd,WAA4B;IAE5B,MAAM,IAAI,GAAG,sBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC/C,IAAI,IAAI;QAAE,OAAO,IAAI,CAAA;IACrB,MAAM,EAAC,GAAG,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;IACnC,MAAM,EAAC,aAAa,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;IACjC,MAAM,GAAG,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAC,GAAG,EAAE,KAAK,EAAE,aAAa,EAAC,CAAC,CAAA;IAChE,MAAM,aAAa,GAAG,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;IAChD,MAAM,GAAG,GAAiB;QACxB,IAAI,EAAE,IAAI;QACV,GAAG;QACH,MAAM,EAAE,GAAG,CAAC,MAAsB;QAClC,SAAS,EAAE,GAAG;QACd,WAAW;QACX,IAAI,EAAE,eAAC,CAAC,IAAI;KACb,CAAA;IAED,IAAI,UAA8B,CAAA;IAClC,IAAI,CAAC;QACH,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAC3B,GAAG,CAAC,aAAa,GAAG,aAAa,CAAA;QACjC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,eAAC,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE;YAC1C,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,EAAE,CAAC,CAAA;YACtB,aAAa,CAAC,GAAG,CAAC,CAAA;YAClB,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,IAAI,CAAC,CAAA;QACpB,CAAC,CAAC,CAAA;QACF,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACrC,MAAM,iBAAiB,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAA;QACxC,UAAU,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,eAAC,CAAC,KAAK,CAAC,UAAU,iBAAiB,EAAE,CAAA;QACnE,MAAM,aAAa,GAAG,IAAI,QAAQ,CAAC,GAAG,eAAC,CAAC,KAAK,EAAE,EAAE,UAAU,CAAC,CAAA;QAC5D,MAAM,SAAS,GAA8B,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAA;QAC5E,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE,EAAC,GAAG,EAAE,SAAS,EAAC,CAAC,CAAA;QACjD,GAAG,CAAC,SAAS,GAAG,SAAS,CAAA;IAC3B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,UAAU;YAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,4CAA4C,EAAE,UAAU,CAAC,CAAA;QAC3F,OAAO,GAAG,CAAC,SAAS,CAAA;QACpB,OAAO,GAAG,CAAC,aAAa,CAAA;QACxB,MAAM,CAAC,CAAA;IACT,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAChC,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AA7CD,oCA6CC;AAED,SAAS,aAAa,CAAC,GAAiB;IACtC,IAAI,IAAyB,CAAA;IAC7B,KAAK,MAAM,GAAG,IAAI,gBAAQ,EAAE,CAAC;QAC3B,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YACtB,IAAI,GAAG,GAAG,CAAA;YACV,MAAK;QACP,CAAC;IACH,CAAC;IACD,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAA;AACpE,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAiB,EAAE,aAA2C;IACvF,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;IAC/B,IAAI,CAAC,MAAM,CAAC,QAAQ;QAAE,OAAO,aAAa,CAAC,GAAG,CAAC,CAAA;IAC/C,GAAG,CAAC,EAAE,CACJ,IAAA,WAAC,EAAA,GAAG,IAAI,qBAAqB,IAAI,WAAW,EAC5C,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,QAAQ,CAAC,EAChC,GAAG,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CACzB,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAiB;IAC1C,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;IAC/B,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,GAAG,CAAC,CAAA;IACvB,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IACpC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE;QAC3B,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QACpB,aAAa,CAAC,EAAC,GAAG,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAC,CAAC,CAAA;IAC5D,CAAC,CAAC,CAAA;IACF,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,GAAG,CAAC,CAAA;AACzB,CAAC;AAED,SAAS,eAAe,CAAC,GAAiB;IACxC,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;IAC/B,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,GAAG,CAAC,CAAA;IACvB,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IACpC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;IAClF,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,GAAG,CAAC,CAAA;AACzB,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAiB,EAAE,GAAS,EAAE,MAAoB,EAAE,KAAY;IACzF,MAAM,EAAC,GAAG,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;IACvB,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACpB,eAAe,CAAC,EAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,CAAC,CAAA;IACpC,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,GAAG,CAAC,CAAA;IACvB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,GAAG,IAAA,qBAAW,EAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC/D,aAAa,CAAC,EAAC,GAAG,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAC,CAAC,CAAA;AAC9C,CAAC;AAED,SAAS,sBAAsB,CAAC,GAAiB;IAC/C,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;IAC/B,MAAM,EAAC,aAAa,EAAC,GAAG,MAAM,CAAA;IAC9B,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,IAAI,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;IACxD,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,GAAG,IAAA,qBAAW,EAAC,aAAa,CAAC,EAAE,CAAC,CAAA;IACrE,eAAe,CAAC,EAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,CAAC,CAAA;IACpC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACb,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACtC,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,QAAQ,EAAE,CAAC,CAAA;QACrC,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;QACpC,yBAAyB,CAAC,EAAC,GAAG,GAAG,EAAE,MAAM,EAAE,GAAG,EAAC,EAAE,aAAa,CAAC,CAAA;IACjE,CAAC;IACD,GAAG,CAAC,KAAK,EAAE,CAAA;IACX,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,GAAG,CAAC,CAAA;AACzB,CAAC;AAED,SAAS,mBAAmB,CAAC,GAAiB;IAC5C,MAAM,EAAC,GAAG,EAAC,GAAG,GAAG,CAAA;IACjB,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,GAAG,CAAC,CAAA;IACvB,yBAAyB,CAAC,GAAG,CAAC,CAAA;IAC9B,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,GAAG,CAAC,CAAA;AACzB,CAAC;AAED,SAAS,yBAAyB,CAAC,GAAiB,EAAE,aAAsB;IAC1E,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;IAC/B,MAAM,EAAC,UAAU,EAAE,kBAAkB,EAAC,GAAG,MAAM,CAAA;IAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAA;IAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,CAAA;IACzC,MAAM,QAAQ,GAAG,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAA;IACtD,IAAI,KAAK,GAAG,CAAC,aAAa,CAAA;IAC1B,IAAI,SAA2B,CAAA;IAE/B,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;QACxB,IAAI,KAAK;YAAE,KAAK,GAAG,KAAK,CAAA;;YACnB,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,GAAG,CAAC,CAAA;QAC5B,iBAAiB,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;IACxD,CAAC;IACD,IAAI,KAAK;QAAE,SAAS,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IAC7C,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC3B,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAA;QAC3B,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,IAAA,WAAC,EAAA,GAAG,KAAK,gBAAgB,EAAE,IAAA,oBAAa,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE;YACzE,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;YACxB,iBAAiB,CAAC,GAAG,EAAE,kBAAkB,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAA;QACxD,CAAC,CAAC,CAAA;IACJ,CAAC;IACD,IAAI,MAAM,CAAC,oBAAoB,EAAE,CAAC;QAChC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAC7B,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC,CACtF,CAAA;IACH,CAAC;IAED,SAAS,IAAI,CAAC,EAAoB;QAChC,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAClC,CAAC;IAED,SAAS,aAAa,CAAC,EAAY;QACjC,IAAI,aAAa;YAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QACzC,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,MAAM,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAA;QAC5E,CAAC;QACD,OAAO,EAAE,CAAA;IACX,CAAC;IAED,SAAS,QAAQ,CAAC,GAAW;QAC3B,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,GAAG,IAAA,qBAAW,EAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC1D,CAAC;IAED,SAAS,iBAAiB,CAAC,GAAW,EAAE,UAAwB,EAAE,KAAW;QAC3E,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAC7C,aAAa,CAAC,EAAC,GAAG,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAC,CAAC,CAAA;IAC1D,CAAC;IAED,SAAS,YAAY,CAAC,GAAS,EAAE,EAAY;QAC3C,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAA,aAAG,EAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACrE,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,GAAiB;IACtC,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;IAC/B,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,SAAS;YACZ,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,qBAAqB,CAAC,CAAA;YAC9C,MAAK;QACP,KAAK,QAAQ;YACX,eAAe,CAAC,GAAG,CAAC,CAAA;YACpB,MAAK;QACP,KAAK,WAAW;YACd,GAAG,CAAC,EAAE,CACJ,IAAA,WAAC,EAAA,GAAG,IAAI,kBAAkB,EAC1B,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,SAAS,IAAI,sBAAsB,CAAC,EAC3D,GAAG,EAAE,CAAC,eAAe,CAAC,GAAG,CAAC,CAC3B,CAAA;YACD,MAAK;QACP;YACE,eAAe,CAAC,GAAG,CAAC,CAAA;IACxB,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,EAAC,GAAG,EAAE,IAAI,EAAe;IAChD,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,GAAG,IAAA,cAAO,EAAC,GAAG,EAAE,eAAK,CAAC,IAAI,IAAI,GAAG,CAAC,CAAA;AACrD,CAAC;AAED,SAAS,eAAe,CAAC,EAAC,GAAG,EAAE,IAAI,EAAe;IAChD,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,QAAQ,IAAI,EAAE,CAAC,CAAA;AAClC,CAAC;AAED,SAAS,YAAY,CAAC,GAAiB;IACrC,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAC,GAAG,GAAG,CAAA;IAC7D,MAAM,EAAC,GAAG,EAAC,GAAG,MAAM,CAAA;IACpB,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;IAClC,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,mBAAe,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,EAAE,GAAG,EAAE,iBAAiB,GAAG,EAAE,CAAC,CAAA;IACjG,IAAI,CAAC,IAAA,YAAM,EAAC,SAAS,CAAC;QAAE,OAAO,aAAa,CAAC,EAAC,GAAG,GAAG,EAAE,MAAM,EAAE,SAAS,EAAC,CAAC,CAAA;IACzE,MAAM,EAAC,IAAI,EAAC,GAAG,SAAS,CAAA;IACxB,MAAM,GAAG,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,aAAS,CAAC,EAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAC,CAAC,EAAE,WAAW,CAAC,CAAA;IAC/F,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,CAAA;AACxD,CAAC;AAED,SAAS,YAAY,CAAC,GAAY,EAAE,GAAc;IAChD,OAAO,GAAG,CAAC,SAAS;QAClB,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,EAAC,GAAG,EAAE,GAAG,CAAC,SAAS,EAAC,CAAC;QACnD,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE,EAAC,GAAG,EAAE,GAAG,EAAC,CAAC,YAAY,CAAA;AAC3D,CAAC;AAED,SAAS,cAAc,CAAC,EAAC,GAAG,EAAE,IAAI,EAAe;IAC/C,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,kBAAkB,IAAI,GAAG,CAAC,CAAA;AAC7C,CAAC;AAED,SAAS,QAAQ,CAAC,EAAC,GAAG,EAAe,EAAE,KAAY;IACjD,IAAI,KAAK,EAAE,CAAC;QACV,GAAG,CAAC,EAAE,CACJ,KAAK,EACL,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAC9B,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,GAAG,CAAC,CAC9B,CAAA;IACH,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,GAAG,CAAC,CAAA;IACzB,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/jtd/types.d.ts b/node_modules/ajv/dist/compile/jtd/types.d.ts deleted file mode 100644 index 678986f..0000000 --- a/node_modules/ajv/dist/compile/jtd/types.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { SchemaObject } from "../../types"; -export type SchemaObjectMap = { - [Ref in string]?: SchemaObject; -}; -export declare const jtdForms: readonly ["elements", "values", "discriminator", "properties", "optionalProperties", "enum", "type", "ref"]; -export type JTDForm = (typeof jtdForms)[number]; diff --git a/node_modules/ajv/dist/compile/jtd/types.js b/node_modules/ajv/dist/compile/jtd/types.js deleted file mode 100644 index b9c60a9..0000000 --- a/node_modules/ajv/dist/compile/jtd/types.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.jtdForms = void 0; -exports.jtdForms = [ - "elements", - "values", - "discriminator", - "properties", - "optionalProperties", - "enum", - "type", - "ref", -]; -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/jtd/types.js.map b/node_modules/ajv/dist/compile/jtd/types.js.map deleted file mode 100644 index 53439e0..0000000 --- a/node_modules/ajv/dist/compile/jtd/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/compile/jtd/types.ts"],"names":[],"mappings":";;;AAIa,QAAA,QAAQ,GAAG;IACtB,UAAU;IACV,QAAQ;IACR,eAAe;IACf,YAAY;IACZ,oBAAoB;IACpB,MAAM;IACN,MAAM;IACN,KAAK;CACG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/names.d.ts b/node_modules/ajv/dist/compile/names.d.ts deleted file mode 100644 index 5740e82..0000000 --- a/node_modules/ajv/dist/compile/names.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Name } from "./codegen"; -declare const names: { - data: Name; - valCxt: Name; - instancePath: Name; - parentData: Name; - parentDataProperty: Name; - rootData: Name; - dynamicAnchors: Name; - vErrors: Name; - errors: Name; - this: Name; - self: Name; - scope: Name; - json: Name; - jsonPos: Name; - jsonLen: Name; - jsonPart: Name; -}; -export default names; diff --git a/node_modules/ajv/dist/compile/names.js b/node_modules/ajv/dist/compile/names.js deleted file mode 100644 index 3bce5aa..0000000 --- a/node_modules/ajv/dist/compile/names.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("./codegen"); -const names = { - // validation function arguments - data: new codegen_1.Name("data"), // data passed to validation function - // args passed from referencing schema - valCxt: new codegen_1.Name("valCxt"), // validation/data context - should not be used directly, it is destructured to the names below - instancePath: new codegen_1.Name("instancePath"), - parentData: new codegen_1.Name("parentData"), - parentDataProperty: new codegen_1.Name("parentDataProperty"), - rootData: new codegen_1.Name("rootData"), // root data - same as the data passed to the first/top validation function - dynamicAnchors: new codegen_1.Name("dynamicAnchors"), // used to support recursiveRef and dynamicRef - // function scoped variables - vErrors: new codegen_1.Name("vErrors"), // null or array of validation errors - errors: new codegen_1.Name("errors"), // counter of validation errors - this: new codegen_1.Name("this"), - // "globals" - self: new codegen_1.Name("self"), - scope: new codegen_1.Name("scope"), - // JTD serialize/parse name for JSON string and position - json: new codegen_1.Name("json"), - jsonPos: new codegen_1.Name("jsonPos"), - jsonLen: new codegen_1.Name("jsonLen"), - jsonPart: new codegen_1.Name("jsonPart"), -}; -exports.default = names; -//# sourceMappingURL=names.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/names.js.map b/node_modules/ajv/dist/compile/names.js.map deleted file mode 100644 index 971fcbf..0000000 --- a/node_modules/ajv/dist/compile/names.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"names.js","sourceRoot":"","sources":["../../lib/compile/names.ts"],"names":[],"mappings":";;AAAA,uCAA8B;AAE9B,MAAM,KAAK,GAAG;IACZ,gCAAgC;IAChC,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC,EAAE,qCAAqC;IAC7D,sCAAsC;IACtC,MAAM,EAAE,IAAI,cAAI,CAAC,QAAQ,CAAC,EAAE,+FAA+F;IAC3H,YAAY,EAAE,IAAI,cAAI,CAAC,cAAc,CAAC;IACtC,UAAU,EAAE,IAAI,cAAI,CAAC,YAAY,CAAC;IAClC,kBAAkB,EAAE,IAAI,cAAI,CAAC,oBAAoB,CAAC;IAClD,QAAQ,EAAE,IAAI,cAAI,CAAC,UAAU,CAAC,EAAE,2EAA2E;IAC3G,cAAc,EAAE,IAAI,cAAI,CAAC,gBAAgB,CAAC,EAAE,8CAA8C;IAC1F,4BAA4B;IAC5B,OAAO,EAAE,IAAI,cAAI,CAAC,SAAS,CAAC,EAAE,qCAAqC;IACnE,MAAM,EAAE,IAAI,cAAI,CAAC,QAAQ,CAAC,EAAE,+BAA+B;IAC3D,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,YAAY;IACZ,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,KAAK,EAAE,IAAI,cAAI,CAAC,OAAO,CAAC;IACxB,wDAAwD;IACxD,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,OAAO,EAAE,IAAI,cAAI,CAAC,SAAS,CAAC;IAC5B,OAAO,EAAE,IAAI,cAAI,CAAC,SAAS,CAAC;IAC5B,QAAQ,EAAE,IAAI,cAAI,CAAC,UAAU,CAAC;CAC/B,CAAA;AAED,kBAAe,KAAK,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/ref_error.d.ts b/node_modules/ajv/dist/compile/ref_error.d.ts deleted file mode 100644 index 4337443..0000000 --- a/node_modules/ajv/dist/compile/ref_error.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { UriResolver } from "../types"; -export default class MissingRefError extends Error { - readonly missingRef: string; - readonly missingSchema: string; - constructor(resolver: UriResolver, baseId: string, ref: string, msg?: string); -} diff --git a/node_modules/ajv/dist/compile/ref_error.js b/node_modules/ajv/dist/compile/ref_error.js deleted file mode 100644 index 3916dec..0000000 --- a/node_modules/ajv/dist/compile/ref_error.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const resolve_1 = require("./resolve"); -class MissingRefError extends Error { - constructor(resolver, baseId, ref, msg) { - super(msg || `can't resolve reference ${ref} from id ${baseId}`); - this.missingRef = (0, resolve_1.resolveUrl)(resolver, baseId, ref); - this.missingSchema = (0, resolve_1.normalizeId)((0, resolve_1.getFullPath)(resolver, this.missingRef)); - } -} -exports.default = MissingRefError; -//# sourceMappingURL=ref_error.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/ref_error.js.map b/node_modules/ajv/dist/compile/ref_error.js.map deleted file mode 100644 index d13f5f2..0000000 --- a/node_modules/ajv/dist/compile/ref_error.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ref_error.js","sourceRoot":"","sources":["../../lib/compile/ref_error.ts"],"names":[],"mappings":";;AAAA,uCAA8D;AAG9D,MAAqB,eAAgB,SAAQ,KAAK;IAIhD,YAAY,QAAqB,EAAE,MAAc,EAAE,GAAW,EAAE,GAAY;QAC1E,KAAK,CAAC,GAAG,IAAI,2BAA2B,GAAG,YAAY,MAAM,EAAE,CAAC,CAAA;QAChE,IAAI,CAAC,UAAU,GAAG,IAAA,oBAAU,EAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;QACnD,IAAI,CAAC,aAAa,GAAG,IAAA,qBAAW,EAAC,IAAA,qBAAW,EAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAA;IAC1E,CAAC;CACF;AATD,kCASC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/resolve.d.ts b/node_modules/ajv/dist/compile/resolve.d.ts deleted file mode 100644 index 3c20fff..0000000 --- a/node_modules/ajv/dist/compile/resolve.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { AnySchema, AnySchemaObject, UriResolver } from "../types"; -import type Ajv from "../ajv"; -import type { URIComponent } from "fast-uri"; -export type LocalRefs = { - [Ref in string]?: AnySchemaObject; -}; -export declare function inlineRef(schema: AnySchema, limit?: boolean | number): boolean; -export declare function getFullPath(resolver: UriResolver, id?: string, normalize?: boolean): string; -export declare function _getFullPath(resolver: UriResolver, p: URIComponent): string; -export declare function normalizeId(id: string | undefined): string; -export declare function resolveUrl(resolver: UriResolver, baseId: string, id: string): string; -export declare function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): LocalRefs; diff --git a/node_modules/ajv/dist/compile/resolve.js b/node_modules/ajv/dist/compile/resolve.js deleted file mode 100644 index f12f968..0000000 --- a/node_modules/ajv/dist/compile/resolve.js +++ /dev/null @@ -1,155 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getSchemaRefs = exports.resolveUrl = exports.normalizeId = exports._getFullPath = exports.getFullPath = exports.inlineRef = void 0; -const util_1 = require("./util"); -const equal = require("fast-deep-equal"); -const traverse = require("json-schema-traverse"); -// TODO refactor to use keyword definitions -const SIMPLE_INLINED = new Set([ - "type", - "format", - "pattern", - "maxLength", - "minLength", - "maxProperties", - "minProperties", - "maxItems", - "minItems", - "maximum", - "minimum", - "uniqueItems", - "multipleOf", - "required", - "enum", - "const", -]); -function inlineRef(schema, limit = true) { - if (typeof schema == "boolean") - return true; - if (limit === true) - return !hasRef(schema); - if (!limit) - return false; - return countKeys(schema) <= limit; -} -exports.inlineRef = inlineRef; -const REF_KEYWORDS = new Set([ - "$ref", - "$recursiveRef", - "$recursiveAnchor", - "$dynamicRef", - "$dynamicAnchor", -]); -function hasRef(schema) { - for (const key in schema) { - if (REF_KEYWORDS.has(key)) - return true; - const sch = schema[key]; - if (Array.isArray(sch) && sch.some(hasRef)) - return true; - if (typeof sch == "object" && hasRef(sch)) - return true; - } - return false; -} -function countKeys(schema) { - let count = 0; - for (const key in schema) { - if (key === "$ref") - return Infinity; - count++; - if (SIMPLE_INLINED.has(key)) - continue; - if (typeof schema[key] == "object") { - (0, util_1.eachItem)(schema[key], (sch) => (count += countKeys(sch))); - } - if (count === Infinity) - return Infinity; - } - return count; -} -function getFullPath(resolver, id = "", normalize) { - if (normalize !== false) - id = normalizeId(id); - const p = resolver.parse(id); - return _getFullPath(resolver, p); -} -exports.getFullPath = getFullPath; -function _getFullPath(resolver, p) { - const serialized = resolver.serialize(p); - return serialized.split("#")[0] + "#"; -} -exports._getFullPath = _getFullPath; -const TRAILING_SLASH_HASH = /#\/?$/; -function normalizeId(id) { - return id ? id.replace(TRAILING_SLASH_HASH, "") : ""; -} -exports.normalizeId = normalizeId; -function resolveUrl(resolver, baseId, id) { - id = normalizeId(id); - return resolver.resolve(baseId, id); -} -exports.resolveUrl = resolveUrl; -const ANCHOR = /^[a-z_][-a-z0-9._]*$/i; -function getSchemaRefs(schema, baseId) { - if (typeof schema == "boolean") - return {}; - const { schemaId, uriResolver } = this.opts; - const schId = normalizeId(schema[schemaId] || baseId); - const baseIds = { "": schId }; - const pathPrefix = getFullPath(uriResolver, schId, false); - const localRefs = {}; - const schemaRefs = new Set(); - traverse(schema, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => { - if (parentJsonPtr === undefined) - return; - const fullPath = pathPrefix + jsonPtr; - let innerBaseId = baseIds[parentJsonPtr]; - if (typeof sch[schemaId] == "string") - innerBaseId = addRef.call(this, sch[schemaId]); - addAnchor.call(this, sch.$anchor); - addAnchor.call(this, sch.$dynamicAnchor); - baseIds[jsonPtr] = innerBaseId; - function addRef(ref) { - // eslint-disable-next-line @typescript-eslint/unbound-method - const _resolve = this.opts.uriResolver.resolve; - ref = normalizeId(innerBaseId ? _resolve(innerBaseId, ref) : ref); - if (schemaRefs.has(ref)) - throw ambiguos(ref); - schemaRefs.add(ref); - let schOrRef = this.refs[ref]; - if (typeof schOrRef == "string") - schOrRef = this.refs[schOrRef]; - if (typeof schOrRef == "object") { - checkAmbiguosRef(sch, schOrRef.schema, ref); - } - else if (ref !== normalizeId(fullPath)) { - if (ref[0] === "#") { - checkAmbiguosRef(sch, localRefs[ref], ref); - localRefs[ref] = sch; - } - else { - this.refs[ref] = fullPath; - } - } - return ref; - } - function addAnchor(anchor) { - if (typeof anchor == "string") { - if (!ANCHOR.test(anchor)) - throw new Error(`invalid anchor "${anchor}"`); - addRef.call(this, `#${anchor}`); - } - } - }); - return localRefs; - function checkAmbiguosRef(sch1, sch2, ref) { - if (sch2 !== undefined && !equal(sch1, sch2)) - throw ambiguos(ref); - } - function ambiguos(ref) { - return new Error(`reference "${ref}" resolves to more than one schema`); - } -} -exports.getSchemaRefs = getSchemaRefs; -//# sourceMappingURL=resolve.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/resolve.js.map b/node_modules/ajv/dist/compile/resolve.js.map deleted file mode 100644 index f579194..0000000 --- a/node_modules/ajv/dist/compile/resolve.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../lib/compile/resolve.ts"],"names":[],"mappings":";;;AAGA,iCAA+B;AAC/B,yCAAwC;AACxC,iDAAgD;AAKhD,2CAA2C;AAC3C,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,MAAM;IACN,QAAQ;IACR,SAAS;IACT,WAAW;IACX,WAAW;IACX,eAAe;IACf,eAAe;IACf,UAAU;IACV,UAAU;IACV,SAAS;IACT,SAAS;IACT,aAAa;IACb,YAAY;IACZ,UAAU;IACV,MAAM;IACN,OAAO;CACR,CAAC,CAAA;AAEF,SAAgB,SAAS,CAAC,MAAiB,EAAE,QAA0B,IAAI;IACzE,IAAI,OAAO,MAAM,IAAI,SAAS;QAAE,OAAO,IAAI,CAAA;IAC3C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC1C,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAA;IACxB,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,KAAK,CAAA;AACnC,CAAC;AALD,8BAKC;AAED,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,MAAM;IACN,eAAe;IACf,kBAAkB;IAClB,aAAa;IACb,gBAAgB;CACjB,CAAC,CAAA;AAEF,SAAS,MAAM,CAAC,MAAuB;IACrC,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAA;QACtC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;QACvB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,CAAA;QACvD,IAAI,OAAO,GAAG,IAAI,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAA;IACxD,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,SAAS,CAAC,MAAuB;IACxC,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,GAAG,KAAK,MAAM;YAAE,OAAO,QAAQ,CAAA;QACnC,KAAK,EAAE,CAAA;QACP,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAQ;QACrC,IAAI,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,QAAQ,EAAE,CAAC;YACnC,IAAA,eAAQ,EAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QAC3D,CAAC;QACD,IAAI,KAAK,KAAK,QAAQ;YAAE,OAAO,QAAQ,CAAA;IACzC,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAgB,WAAW,CAAC,QAAqB,EAAE,EAAE,GAAG,EAAE,EAAE,SAAmB;IAC7E,IAAI,SAAS,KAAK,KAAK;QAAE,EAAE,GAAG,WAAW,CAAC,EAAE,CAAC,CAAA;IAC7C,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAC5B,OAAO,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;AAClC,CAAC;AAJD,kCAIC;AAED,SAAgB,YAAY,CAAC,QAAqB,EAAE,CAAe;IACjE,MAAM,UAAU,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;IACxC,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;AACvC,CAAC;AAHD,oCAGC;AAED,MAAM,mBAAmB,GAAG,OAAO,CAAA;AACnC,SAAgB,WAAW,CAAC,EAAsB;IAChD,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AACtD,CAAC;AAFD,kCAEC;AAED,SAAgB,UAAU,CAAC,QAAqB,EAAE,MAAc,EAAE,EAAU;IAC1E,EAAE,GAAG,WAAW,CAAC,EAAE,CAAC,CAAA;IACpB,OAAO,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AACrC,CAAC;AAHD,gCAGC;AAED,MAAM,MAAM,GAAG,uBAAuB,CAAA;AAEtC,SAAgB,aAAa,CAAY,MAAiB,EAAE,MAAc;IACxE,IAAI,OAAO,MAAM,IAAI,SAAS;QAAE,OAAO,EAAE,CAAA;IACzC,MAAM,EAAC,QAAQ,EAAE,WAAW,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;IACzC,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAA;IACrD,MAAM,OAAO,GAAmC,EAAC,EAAE,EAAE,KAAK,EAAC,CAAA;IAC3D,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;IACzD,MAAM,SAAS,GAAc,EAAE,CAAA;IAC/B,MAAM,UAAU,GAAgB,IAAI,GAAG,EAAE,CAAA;IAEzC,QAAQ,CAAC,MAAM,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,aAAa,EAAE,EAAE;QACnE,IAAI,aAAa,KAAK,SAAS;YAAE,OAAM;QACvC,MAAM,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAA;QACrC,IAAI,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;QACxC,IAAI,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,QAAQ;YAAE,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAA;QACpF,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;QACjC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,cAAc,CAAC,CAAA;QACxC,OAAO,CAAC,OAAO,CAAC,GAAG,WAAW,CAAA;QAE9B,SAAS,MAAM,CAAY,GAAW;YACpC,6DAA6D;YAC7D,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAA;YAC9C,GAAG,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;YACjE,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAA;YAC5C,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACnB,IAAI,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YAC7B,IAAI,OAAO,QAAQ,IAAI,QAAQ;gBAAE,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YAC/D,IAAI,OAAO,QAAQ,IAAI,QAAQ,EAAE,CAAC;gBAChC,gBAAgB,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;YAC7C,CAAC;iBAAM,IAAI,GAAG,KAAK,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACzC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;oBACnB,gBAAgB,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAA;oBAC1C,SAAS,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;gBACtB,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAA;gBAC3B,CAAC;YACH,CAAC;YACD,OAAO,GAAG,CAAA;QACZ,CAAC;QAED,SAAS,SAAS,CAAY,MAAe;YAC3C,IAAI,OAAO,MAAM,IAAI,QAAQ,EAAE,CAAC;gBAC9B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;oBAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,GAAG,CAAC,CAAA;gBACvE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC,CAAA;YACjC,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,SAAS,CAAA;IAEhB,SAAS,gBAAgB,CAAC,IAAe,EAAE,IAA2B,EAAE,GAAW;QACjF,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;YAAE,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAA;IACnE,CAAC;IAED,SAAS,QAAQ,CAAC,GAAW;QAC3B,OAAO,IAAI,KAAK,CAAC,cAAc,GAAG,oCAAoC,CAAC,CAAA;IACzE,CAAC;AACH,CAAC;AAxDD,sCAwDC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/rules.d.ts b/node_modules/ajv/dist/compile/rules.d.ts deleted file mode 100644 index 51ec46a..0000000 --- a/node_modules/ajv/dist/compile/rules.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { AddedKeywordDefinition } from "../types"; -declare const _jsonTypes: readonly ["string", "number", "integer", "boolean", "null", "object", "array"]; -export type JSONType = (typeof _jsonTypes)[number]; -export declare function isJSONType(x: unknown): x is JSONType; -type ValidationTypes = { - [K in JSONType]: boolean | RuleGroup | undefined; -}; -export interface ValidationRules { - rules: RuleGroup[]; - post: RuleGroup; - all: { - [Key in string]?: boolean | Rule; - }; - keywords: { - [Key in string]?: boolean; - }; - types: ValidationTypes; -} -export interface RuleGroup { - type?: JSONType; - rules: Rule[]; -} -export interface Rule { - keyword: string; - definition: AddedKeywordDefinition; -} -export declare function getRules(): ValidationRules; -export {}; diff --git a/node_modules/ajv/dist/compile/rules.js b/node_modules/ajv/dist/compile/rules.js deleted file mode 100644 index 82a591f..0000000 --- a/node_modules/ajv/dist/compile/rules.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getRules = exports.isJSONType = void 0; -const _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array"]; -const jsonTypes = new Set(_jsonTypes); -function isJSONType(x) { - return typeof x == "string" && jsonTypes.has(x); -} -exports.isJSONType = isJSONType; -function getRules() { - const groups = { - number: { type: "number", rules: [] }, - string: { type: "string", rules: [] }, - array: { type: "array", rules: [] }, - object: { type: "object", rules: [] }, - }; - return { - types: { ...groups, integer: true, boolean: true, null: true }, - rules: [{ rules: [] }, groups.number, groups.string, groups.array, groups.object], - post: { rules: [] }, - all: {}, - keywords: {}, - }; -} -exports.getRules = getRules; -//# sourceMappingURL=rules.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/rules.js.map b/node_modules/ajv/dist/compile/rules.js.map deleted file mode 100644 index 084c70f..0000000 --- a/node_modules/ajv/dist/compile/rules.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../lib/compile/rules.ts"],"names":[],"mappings":";;;AAEA,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAA;AAIjG,MAAM,SAAS,GAAgB,IAAI,GAAG,CAAC,UAAU,CAAC,CAAA;AAElD,SAAgB,UAAU,CAAC,CAAU;IACnC,OAAO,OAAO,CAAC,IAAI,QAAQ,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AACjD,CAAC;AAFD,gCAEC;AAyBD,SAAgB,QAAQ;IACtB,MAAM,MAAM,GAAgE;QAC1E,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC;QACnC,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC;QACnC,KAAK,EAAE,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAC;QACjC,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC;KACpC,CAAA;IACD,OAAO;QACL,KAAK,EAAE,EAAC,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC;QAC5D,KAAK,EAAE,CAAC,EAAC,KAAK,EAAE,EAAE,EAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;QAC/E,IAAI,EAAE,EAAC,KAAK,EAAE,EAAE,EAAC;QACjB,GAAG,EAAE,EAAE;QACP,QAAQ,EAAE,EAAE;KACb,CAAA;AACH,CAAC;AAdD,4BAcC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/util.d.ts b/node_modules/ajv/dist/compile/util.d.ts deleted file mode 100644 index 1ec282a..0000000 --- a/node_modules/ajv/dist/compile/util.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { AnySchema, EvaluatedProperties, EvaluatedItems } from "../types"; -import type { SchemaCxt, SchemaObjCxt } from "."; -import { Code, Name, CodeGen } from "./codegen"; -import type { Rule, ValidationRules } from "./rules"; -export declare function toHash(arr: T[]): { - [K in T]?: true; -}; -export declare function alwaysValidSchema(it: SchemaCxt, schema: AnySchema): boolean | void; -export declare function checkUnknownRules(it: SchemaCxt, schema?: AnySchema): void; -export declare function schemaHasRules(schema: AnySchema, rules: { - [Key in string]?: boolean | Rule; -}): boolean; -export declare function schemaHasRulesButRef(schema: AnySchema, RULES: ValidationRules): boolean; -export declare function schemaRefOrVal({ topSchemaRef, schemaPath }: SchemaObjCxt, schema: unknown, keyword: string, $data?: string | false): Code | number | boolean; -export declare function unescapeFragment(str: string): string; -export declare function escapeFragment(str: string | number): string; -export declare function escapeJsonPointer(str: string | number): string; -export declare function unescapeJsonPointer(str: string): string; -export declare function eachItem(xs: T | T[], f: (x: T) => void): void; -type SomeEvaluated = EvaluatedProperties | EvaluatedItems; -type MergeEvaluatedFunc = (gen: CodeGen, from: Name | T, to: Name | Exclude | undefined, toName?: typeof Name) => Name | T; -interface MergeEvaluated { - props: MergeEvaluatedFunc; - items: MergeEvaluatedFunc; -} -export declare const mergeEvaluated: MergeEvaluated; -export declare function evaluatedPropsToName(gen: CodeGen, ps?: EvaluatedProperties): Name; -export declare function setEvaluated(gen: CodeGen, props: Name, ps: { - [K in string]?: true; -}): void; -export declare function useFunc(gen: CodeGen, f: { - code: string; -}): Name; -export declare enum Type { - Num = 0, - Str = 1 -} -export declare function getErrorPath(dataProp: Name | string | number, dataPropType?: Type, jsPropertySyntax?: boolean): Code | string; -export declare function checkStrictMode(it: SchemaCxt, msg: string, mode?: boolean | "log"): void; -export {}; diff --git a/node_modules/ajv/dist/compile/util.js b/node_modules/ajv/dist/compile/util.js deleted file mode 100644 index 73c87c8..0000000 --- a/node_modules/ajv/dist/compile/util.js +++ /dev/null @@ -1,178 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.checkStrictMode = exports.getErrorPath = exports.Type = exports.useFunc = exports.setEvaluated = exports.evaluatedPropsToName = exports.mergeEvaluated = exports.eachItem = exports.unescapeJsonPointer = exports.escapeJsonPointer = exports.escapeFragment = exports.unescapeFragment = exports.schemaRefOrVal = exports.schemaHasRulesButRef = exports.schemaHasRules = exports.checkUnknownRules = exports.alwaysValidSchema = exports.toHash = void 0; -const codegen_1 = require("./codegen"); -const code_1 = require("./codegen/code"); -// TODO refactor to use Set -function toHash(arr) { - const hash = {}; - for (const item of arr) - hash[item] = true; - return hash; -} -exports.toHash = toHash; -function alwaysValidSchema(it, schema) { - if (typeof schema == "boolean") - return schema; - if (Object.keys(schema).length === 0) - return true; - checkUnknownRules(it, schema); - return !schemaHasRules(schema, it.self.RULES.all); -} -exports.alwaysValidSchema = alwaysValidSchema; -function checkUnknownRules(it, schema = it.schema) { - const { opts, self } = it; - if (!opts.strictSchema) - return; - if (typeof schema === "boolean") - return; - const rules = self.RULES.keywords; - for (const key in schema) { - if (!rules[key]) - checkStrictMode(it, `unknown keyword: "${key}"`); - } -} -exports.checkUnknownRules = checkUnknownRules; -function schemaHasRules(schema, rules) { - if (typeof schema == "boolean") - return !schema; - for (const key in schema) - if (rules[key]) - return true; - return false; -} -exports.schemaHasRules = schemaHasRules; -function schemaHasRulesButRef(schema, RULES) { - if (typeof schema == "boolean") - return !schema; - for (const key in schema) - if (key !== "$ref" && RULES.all[key]) - return true; - return false; -} -exports.schemaHasRulesButRef = schemaHasRulesButRef; -function schemaRefOrVal({ topSchemaRef, schemaPath }, schema, keyword, $data) { - if (!$data) { - if (typeof schema == "number" || typeof schema == "boolean") - return schema; - if (typeof schema == "string") - return (0, codegen_1._) `${schema}`; - } - return (0, codegen_1._) `${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`; -} -exports.schemaRefOrVal = schemaRefOrVal; -function unescapeFragment(str) { - return unescapeJsonPointer(decodeURIComponent(str)); -} -exports.unescapeFragment = unescapeFragment; -function escapeFragment(str) { - return encodeURIComponent(escapeJsonPointer(str)); -} -exports.escapeFragment = escapeFragment; -function escapeJsonPointer(str) { - if (typeof str == "number") - return `${str}`; - return str.replace(/~/g, "~0").replace(/\//g, "~1"); -} -exports.escapeJsonPointer = escapeJsonPointer; -function unescapeJsonPointer(str) { - return str.replace(/~1/g, "/").replace(/~0/g, "~"); -} -exports.unescapeJsonPointer = unescapeJsonPointer; -function eachItem(xs, f) { - if (Array.isArray(xs)) { - for (const x of xs) - f(x); - } - else { - f(xs); - } -} -exports.eachItem = eachItem; -function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues, resultToName, }) { - return (gen, from, to, toName) => { - const res = to === undefined - ? from - : to instanceof codegen_1.Name - ? (from instanceof codegen_1.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) - : from instanceof codegen_1.Name - ? (mergeToName(gen, to, from), from) - : mergeValues(from, to); - return toName === codegen_1.Name && !(res instanceof codegen_1.Name) ? resultToName(gen, res) : res; - }; -} -exports.mergeEvaluated = { - props: makeMergeEvaluated({ - mergeNames: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true && ${from} !== undefined`, () => { - gen.if((0, codegen_1._) `${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1._) `${to} || {}`).code((0, codegen_1._) `Object.assign(${to}, ${from})`)); - }), - mergeToName: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true`, () => { - if (from === true) { - gen.assign(to, true); - } - else { - gen.assign(to, (0, codegen_1._) `${to} || {}`); - setEvaluated(gen, to, from); - } - }), - mergeValues: (from, to) => (from === true ? true : { ...from, ...to }), - resultToName: evaluatedPropsToName, - }), - items: makeMergeEvaluated({ - mergeNames: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1._) `${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)), - mergeToName: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1._) `${to} > ${from} ? ${to} : ${from}`)), - mergeValues: (from, to) => (from === true ? true : Math.max(from, to)), - resultToName: (gen, items) => gen.var("items", items), - }), -}; -function evaluatedPropsToName(gen, ps) { - if (ps === true) - return gen.var("props", true); - const props = gen.var("props", (0, codegen_1._) `{}`); - if (ps !== undefined) - setEvaluated(gen, props, ps); - return props; -} -exports.evaluatedPropsToName = evaluatedPropsToName; -function setEvaluated(gen, props, ps) { - Object.keys(ps).forEach((p) => gen.assign((0, codegen_1._) `${props}${(0, codegen_1.getProperty)(p)}`, true)); -} -exports.setEvaluated = setEvaluated; -const snippets = {}; -function useFunc(gen, f) { - return gen.scopeValue("func", { - ref: f, - code: snippets[f.code] || (snippets[f.code] = new code_1._Code(f.code)), - }); -} -exports.useFunc = useFunc; -var Type; -(function (Type) { - Type[Type["Num"] = 0] = "Num"; - Type[Type["Str"] = 1] = "Str"; -})(Type || (exports.Type = Type = {})); -function getErrorPath(dataProp, dataPropType, jsPropertySyntax) { - // let path - if (dataProp instanceof codegen_1.Name) { - const isNumber = dataPropType === Type.Num; - return jsPropertySyntax - ? isNumber - ? (0, codegen_1._) `"[" + ${dataProp} + "]"` - : (0, codegen_1._) `"['" + ${dataProp} + "']"` - : isNumber - ? (0, codegen_1._) `"/" + ${dataProp}` - : (0, codegen_1._) `"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`; // TODO maybe use global escapePointer - } - return jsPropertySyntax ? (0, codegen_1.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp); -} -exports.getErrorPath = getErrorPath; -function checkStrictMode(it, msg, mode = it.opts.strictSchema) { - if (!mode) - return; - msg = `strict mode: ${msg}`; - if (mode === true) - throw new Error(msg); - it.self.logger.warn(msg); -} -exports.checkStrictMode = checkStrictMode; -//# sourceMappingURL=util.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/util.js.map b/node_modules/ajv/dist/compile/util.js.map deleted file mode 100644 index ee01008..0000000 --- a/node_modules/ajv/dist/compile/util.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"util.js","sourceRoot":"","sources":["../../lib/compile/util.ts"],"names":[],"mappings":";;;AAEA,uCAA6D;AAC7D,yCAAoC;AAGpC,2BAA2B;AAC3B,SAAgB,MAAM,CAA4B,GAAQ;IACxD,MAAM,IAAI,GAAsB,EAAE,CAAA;IAClC,KAAK,MAAM,IAAI,IAAI,GAAG;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACzC,OAAO,IAAI,CAAA;AACb,CAAC;AAJD,wBAIC;AAED,SAAgB,iBAAiB,CAAC,EAAa,EAAE,MAAiB;IAChE,IAAI,OAAO,MAAM,IAAI,SAAS;QAAE,OAAO,MAAM,CAAA;IAC7C,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACjD,iBAAiB,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;IAC7B,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;AACnD,CAAC;AALD,8CAKC;AAED,SAAgB,iBAAiB,CAAC,EAAa,EAAE,SAAoB,EAAE,CAAC,MAAM;IAC5E,MAAM,EAAC,IAAI,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IACvB,IAAI,CAAC,IAAI,CAAC,YAAY;QAAE,OAAM;IAC9B,IAAI,OAAO,MAAM,KAAK,SAAS;QAAE,OAAM;IACvC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAA;IACjC,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;YAAE,eAAe,CAAC,EAAE,EAAE,qBAAqB,GAAG,GAAG,CAAC,CAAA;IACnE,CAAC;AACH,CAAC;AARD,8CAQC;AAED,SAAgB,cAAc,CAC5B,MAAiB,EACjB,KAAyC;IAEzC,IAAI,OAAO,MAAM,IAAI,SAAS;QAAE,OAAO,CAAC,MAAM,CAAA;IAC9C,KAAK,MAAM,GAAG,IAAI,MAAM;QAAE,IAAI,KAAK,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAA;IACrD,OAAO,KAAK,CAAA;AACd,CAAC;AAPD,wCAOC;AAED,SAAgB,oBAAoB,CAAC,MAAiB,EAAE,KAAsB;IAC5E,IAAI,OAAO,MAAM,IAAI,SAAS;QAAE,OAAO,CAAC,MAAM,CAAA;IAC9C,KAAK,MAAM,GAAG,IAAI,MAAM;QAAE,IAAI,GAAG,KAAK,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAA;IAC3E,OAAO,KAAK,CAAA;AACd,CAAC;AAJD,oDAIC;AAED,SAAgB,cAAc,CAC5B,EAAC,YAAY,EAAE,UAAU,EAAe,EACxC,MAAe,EACf,OAAe,EACf,KAAsB;IAEtB,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,IAAI,OAAO,MAAM,IAAI,QAAQ,IAAI,OAAO,MAAM,IAAI,SAAS;YAAE,OAAO,MAAM,CAAA;QAC1E,IAAI,OAAO,MAAM,IAAI,QAAQ;YAAE,OAAO,IAAA,WAAC,EAAA,GAAG,MAAM,EAAE,CAAA;IACpD,CAAC;IACD,OAAO,IAAA,WAAC,EAAA,GAAG,YAAY,GAAG,UAAU,GAAG,IAAA,qBAAW,EAAC,OAAO,CAAC,EAAE,CAAA;AAC/D,CAAC;AAXD,wCAWC;AAED,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,OAAO,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAA;AACrD,CAAC;AAFD,4CAEC;AAED,SAAgB,cAAc,CAAC,GAAoB;IACjD,OAAO,kBAAkB,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAA;AACnD,CAAC;AAFD,wCAEC;AAED,SAAgB,iBAAiB,CAAC,GAAoB;IACpD,IAAI,OAAO,GAAG,IAAI,QAAQ;QAAE,OAAO,GAAG,GAAG,EAAE,CAAA;IAC3C,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;AACrD,CAAC;AAHD,8CAGC;AAED,SAAgB,mBAAmB,CAAC,GAAW;IAC7C,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AACpD,CAAC;AAFD,kDAEC;AAED,SAAgB,QAAQ,CAAI,EAAW,EAAE,CAAiB;IACxD,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;QACtB,KAAK,MAAM,CAAC,IAAI,EAAE;YAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;SAAM,CAAC;QACN,CAAC,CAAC,EAAE,CAAC,CAAA;IACP,CAAC;AACH,CAAC;AAND,4BAMC;AAkBD,SAAS,kBAAkB,CAA0B,EACnD,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,GACS;IACrB,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE;QAC/B,MAAM,GAAG,GACP,EAAE,KAAK,SAAS;YACd,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,EAAE,YAAY,cAAI;gBACpB,CAAC,CAAC,CAAC,IAAI,YAAY,cAAI,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;gBACrF,CAAC,CAAC,IAAI,YAAY,cAAI;oBACtB,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;oBACpC,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;QAC3B,OAAO,MAAM,KAAK,cAAI,IAAI,CAAC,CAAC,GAAG,YAAY,cAAI,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IACjF,CAAC,CAAA;AACH,CAAC;AAOY,QAAA,cAAc,GAAmB;IAC5C,KAAK,EAAE,kBAAkB,CAAC;QACxB,UAAU,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAC5B,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,EAAE,gBAAgB,IAAI,gBAAgB,EAAE,GAAG,EAAE;YACtD,GAAG,CAAC,EAAE,CACJ,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,EACnB,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,EAC1B,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,IAAA,WAAC,EAAA,GAAG,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,iBAAiB,EAAE,KAAK,IAAI,GAAG,CAAC,CAC5E,CAAA;QACH,CAAC,CAAC;QACJ,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAC7B,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE;YAC7B,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;gBAClB,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;YACtB,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,IAAA,WAAC,EAAA,GAAG,EAAE,QAAQ,CAAC,CAAA;gBAC9B,YAAY,CAAC,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,CAAA;YAC7B,CAAC;QACH,CAAC,CAAC;QACJ,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC,GAAG,IAAI,EAAE,GAAG,EAAE,EAAC,CAAC;QACpE,YAAY,EAAE,oBAAoB;KACnC,CAAC;IACF,KAAK,EAAE,kBAAkB,CAAC;QACxB,UAAU,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAC5B,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,EAAE,gBAAgB,IAAI,gBAAgB,EAAE,GAAG,EAAE,CACtD,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,sBAAsB,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,IAAI,EAAE,CAAC,CAC/E;QACH,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAC7B,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,CAC7B,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,IAAI,EAAE,CAAC,CAC5E;QACH,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACtE,YAAY,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC;KACtD,CAAC;CACH,CAAA;AAED,SAAgB,oBAAoB,CAAC,GAAY,EAAE,EAAwB;IACzE,IAAI,EAAE,KAAK,IAAI;QAAE,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IAC9C,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,IAAI,CAAC,CAAA;IACrC,IAAI,EAAE,KAAK,SAAS;QAAE,YAAY,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAA;IAClD,OAAO,KAAK,CAAA;AACd,CAAC;AALD,oDAKC;AAED,SAAgB,YAAY,CAAC,GAAY,EAAE,KAAW,EAAE,EAA0B;IAChF,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,GAAG,IAAA,qBAAW,EAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAA;AAChF,CAAC;AAFD,oCAEC;AAED,MAAM,QAAQ,GAA4B,EAAE,CAAA;AAE5C,SAAgB,OAAO,CAAC,GAAY,EAAE,CAAiB;IACrD,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE;QAC5B,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,YAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;KACjE,CAAC,CAAA;AACJ,CAAC;AALD,0BAKC;AAED,IAAY,IAGX;AAHD,WAAY,IAAI;IACd,6BAAG,CAAA;IACH,6BAAG,CAAA;AACL,CAAC,EAHW,IAAI,oBAAJ,IAAI,QAGf;AAED,SAAgB,YAAY,CAC1B,QAAgC,EAChC,YAAmB,EACnB,gBAA0B;IAE1B,WAAW;IACX,IAAI,QAAQ,YAAY,cAAI,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,YAAY,KAAK,IAAI,CAAC,GAAG,CAAA;QAC1C,OAAO,gBAAgB;YACrB,CAAC,CAAC,QAAQ;gBACR,CAAC,CAAC,IAAA,WAAC,EAAA,SAAS,QAAQ,QAAQ;gBAC5B,CAAC,CAAC,IAAA,WAAC,EAAA,UAAU,QAAQ,SAAS;YAChC,CAAC,CAAC,QAAQ;gBACV,CAAC,CAAC,IAAA,WAAC,EAAA,SAAS,QAAQ,EAAE;gBACtB,CAAC,CAAC,IAAA,WAAC,EAAA,SAAS,QAAQ,4CAA4C,CAAA,CAAC,sCAAsC;IAC3G,CAAC;IACD,OAAO,gBAAgB,CAAC,CAAC,CAAC,IAAA,qBAAW,EAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAA;AAChG,CAAC;AAjBD,oCAiBC;AAED,SAAgB,eAAe,CAC7B,EAAa,EACb,GAAW,EACX,OAAwB,EAAE,CAAC,IAAI,CAAC,YAAY;IAE5C,IAAI,CAAC,IAAI;QAAE,OAAM;IACjB,GAAG,GAAG,gBAAgB,GAAG,EAAE,CAAA;IAC3B,IAAI,IAAI,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;IACvC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,CAAC;AATD,0CASC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/validate/applicability.d.ts b/node_modules/ajv/dist/compile/validate/applicability.d.ts deleted file mode 100644 index 165d375..0000000 --- a/node_modules/ajv/dist/compile/validate/applicability.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { AnySchemaObject } from "../../types"; -import type { SchemaObjCxt } from ".."; -import type { JSONType, RuleGroup, Rule } from "../rules"; -export declare function schemaHasRulesForType({ schema, self }: SchemaObjCxt, type: JSONType): boolean | undefined; -export declare function shouldUseGroup(schema: AnySchemaObject, group: RuleGroup): boolean; -export declare function shouldUseRule(schema: AnySchemaObject, rule: Rule): boolean | undefined; diff --git a/node_modules/ajv/dist/compile/validate/applicability.js b/node_modules/ajv/dist/compile/validate/applicability.js deleted file mode 100644 index 6187dbb..0000000 --- a/node_modules/ajv/dist/compile/validate/applicability.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = void 0; -function schemaHasRulesForType({ schema, self }, type) { - const group = self.RULES.types[type]; - return group && group !== true && shouldUseGroup(schema, group); -} -exports.schemaHasRulesForType = schemaHasRulesForType; -function shouldUseGroup(schema, group) { - return group.rules.some((rule) => shouldUseRule(schema, rule)); -} -exports.shouldUseGroup = shouldUseGroup; -function shouldUseRule(schema, rule) { - var _a; - return (schema[rule.keyword] !== undefined || - ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== undefined))); -} -exports.shouldUseRule = shouldUseRule; -//# sourceMappingURL=applicability.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/validate/applicability.js.map b/node_modules/ajv/dist/compile/validate/applicability.js.map deleted file mode 100644 index 450cfe7..0000000 --- a/node_modules/ajv/dist/compile/validate/applicability.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"applicability.js","sourceRoot":"","sources":["../../../lib/compile/validate/applicability.ts"],"names":[],"mappings":";;;AAIA,SAAgB,qBAAqB,CACnC,EAAC,MAAM,EAAE,IAAI,EAAe,EAC5B,IAAc;IAEd,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACpC,OAAO,KAAK,IAAI,KAAK,KAAK,IAAI,IAAI,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AACjE,CAAC;AAND,sDAMC;AAED,SAAgB,cAAc,CAAC,MAAuB,EAAE,KAAgB;IACtE,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;AAChE,CAAC;AAFD,wCAEC;AAED,SAAgB,aAAa,CAAC,MAAuB,EAAE,IAAU;;IAC/D,OAAO,CACL,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,SAAS;SAClC,MAAA,IAAI,CAAC,UAAU,CAAC,UAAU,0CAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAA,CACrE,CAAA;AACH,CAAC;AALD,sCAKC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/validate/boolSchema.d.ts b/node_modules/ajv/dist/compile/validate/boolSchema.d.ts deleted file mode 100644 index 0ce7952..0000000 --- a/node_modules/ajv/dist/compile/validate/boolSchema.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { SchemaCxt } from ".."; -import { Name } from "../codegen"; -export declare function topBoolOrEmptySchema(it: SchemaCxt): void; -export declare function boolOrEmptySchema(it: SchemaCxt, valid: Name): void; diff --git a/node_modules/ajv/dist/compile/validate/boolSchema.js b/node_modules/ajv/dist/compile/validate/boolSchema.js deleted file mode 100644 index 8eeb7b5..0000000 --- a/node_modules/ajv/dist/compile/validate/boolSchema.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = void 0; -const errors_1 = require("../errors"); -const codegen_1 = require("../codegen"); -const names_1 = require("../names"); -const boolError = { - message: "boolean schema is false", -}; -function topBoolOrEmptySchema(it) { - const { gen, schema, validateName } = it; - if (schema === false) { - falseSchemaError(it, false); - } - else if (typeof schema == "object" && schema.$async === true) { - gen.return(names_1.default.data); - } - else { - gen.assign((0, codegen_1._) `${validateName}.errors`, null); - gen.return(true); - } -} -exports.topBoolOrEmptySchema = topBoolOrEmptySchema; -function boolOrEmptySchema(it, valid) { - const { gen, schema } = it; - if (schema === false) { - gen.var(valid, false); // TODO var - falseSchemaError(it); - } - else { - gen.var(valid, true); // TODO var - } -} -exports.boolOrEmptySchema = boolOrEmptySchema; -function falseSchemaError(it, overrideAllErrors) { - const { gen, data } = it; - // TODO maybe some other interface should be used for non-keyword validation errors... - const cxt = { - gen, - keyword: "false schema", - data, - schema: false, - schemaCode: false, - schemaValue: false, - params: {}, - it, - }; - (0, errors_1.reportError)(cxt, boolError, undefined, overrideAllErrors); -} -//# sourceMappingURL=boolSchema.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/validate/boolSchema.js.map b/node_modules/ajv/dist/compile/validate/boolSchema.js.map deleted file mode 100644 index b7444a2..0000000 --- a/node_modules/ajv/dist/compile/validate/boolSchema.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"boolSchema.js","sourceRoot":"","sources":["../../../lib/compile/validate/boolSchema.ts"],"names":[],"mappings":";;;AAEA,sCAAqC;AACrC,wCAAkC;AAClC,oCAAwB;AAExB,MAAM,SAAS,GAA2B;IACxC,OAAO,EAAE,yBAAyB;CACnC,CAAA;AAED,SAAgB,oBAAoB,CAAC,EAAa;IAChD,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAC,GAAG,EAAE,CAAA;IACtC,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,gBAAgB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;IAC7B,CAAC;SAAM,IAAI,OAAO,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;QAC/D,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,IAAI,CAAC,CAAA;IACpB,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,YAAY,SAAS,EAAE,IAAI,CAAC,CAAA;QAC3C,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAClB,CAAC;AACH,CAAC;AAVD,oDAUC;AAED,SAAgB,iBAAiB,CAAC,EAAa,EAAE,KAAW;IAC1D,MAAM,EAAC,GAAG,EAAE,MAAM,EAAC,GAAG,EAAE,CAAA;IACxB,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA,CAAC,WAAW;QACjC,gBAAgB,CAAC,EAAE,CAAC,CAAA;IACtB,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA,CAAC,WAAW;IAClC,CAAC;AACH,CAAC;AARD,8CAQC;AAED,SAAS,gBAAgB,CAAC,EAAa,EAAE,iBAA2B;IAClE,MAAM,EAAC,GAAG,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IACtB,sFAAsF;IACtF,MAAM,GAAG,GAAoB;QAC3B,GAAG;QACH,OAAO,EAAE,cAAc;QACvB,IAAI;QACJ,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,EAAE;QACV,EAAE;KACH,CAAA;IACD,IAAA,oBAAW,EAAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAA;AAC3D,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/validate/dataType.d.ts b/node_modules/ajv/dist/compile/validate/dataType.d.ts deleted file mode 100644 index 91a6194..0000000 --- a/node_modules/ajv/dist/compile/validate/dataType.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { ErrorObject, AnySchemaObject } from "../../types"; -import type { SchemaObjCxt } from ".."; -import { JSONType } from "../rules"; -import { Code, Name } from "../codegen"; -export declare enum DataType { - Correct = 0, - Wrong = 1 -} -export declare function getSchemaTypes(schema: AnySchemaObject): JSONType[]; -export declare function getJSONTypes(ts: unknown | unknown[]): JSONType[]; -export declare function coerceAndCheckDataType(it: SchemaObjCxt, types: JSONType[]): boolean; -export declare function checkDataType(dataType: JSONType, data: Name, strictNums?: boolean | "log", correct?: DataType): Code; -export declare function checkDataTypes(dataTypes: JSONType[], data: Name, strictNums?: boolean | "log", correct?: DataType): Code; -export type TypeError = ErrorObject<"type", { - type: string; -}>; -export declare function reportTypeError(it: SchemaObjCxt): void; diff --git a/node_modules/ajv/dist/compile/validate/dataType.js b/node_modules/ajv/dist/compile/validate/dataType.js deleted file mode 100644 index 6d03e0d..0000000 --- a/node_modules/ajv/dist/compile/validate/dataType.js +++ /dev/null @@ -1,203 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = void 0; -const rules_1 = require("../rules"); -const applicability_1 = require("./applicability"); -const errors_1 = require("../errors"); -const codegen_1 = require("../codegen"); -const util_1 = require("../util"); -var DataType; -(function (DataType) { - DataType[DataType["Correct"] = 0] = "Correct"; - DataType[DataType["Wrong"] = 1] = "Wrong"; -})(DataType || (exports.DataType = DataType = {})); -function getSchemaTypes(schema) { - const types = getJSONTypes(schema.type); - const hasNull = types.includes("null"); - if (hasNull) { - if (schema.nullable === false) - throw new Error("type: null contradicts nullable: false"); - } - else { - if (!types.length && schema.nullable !== undefined) { - throw new Error('"nullable" cannot be used without "type"'); - } - if (schema.nullable === true) - types.push("null"); - } - return types; -} -exports.getSchemaTypes = getSchemaTypes; -// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents -function getJSONTypes(ts) { - const types = Array.isArray(ts) ? ts : ts ? [ts] : []; - if (types.every(rules_1.isJSONType)) - return types; - throw new Error("type must be JSONType or JSONType[]: " + types.join(",")); -} -exports.getJSONTypes = getJSONTypes; -function coerceAndCheckDataType(it, types) { - const { gen, data, opts } = it; - const coerceTo = coerceToTypes(types, opts.coerceTypes); - const checkTypes = types.length > 0 && - !(coerceTo.length === 0 && types.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types[0])); - if (checkTypes) { - const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong); - gen.if(wrongType, () => { - if (coerceTo.length) - coerceData(it, types, coerceTo); - else - reportTypeError(it); - }); - } - return checkTypes; -} -exports.coerceAndCheckDataType = coerceAndCheckDataType; -const COERCIBLE = new Set(["string", "number", "integer", "boolean", "null"]); -function coerceToTypes(types, coerceTypes) { - return coerceTypes - ? types.filter((t) => COERCIBLE.has(t) || (coerceTypes === "array" && t === "array")) - : []; -} -function coerceData(it, types, coerceTo) { - const { gen, data, opts } = it; - const dataType = gen.let("dataType", (0, codegen_1._) `typeof ${data}`); - const coerced = gen.let("coerced", (0, codegen_1._) `undefined`); - if (opts.coerceTypes === "array") { - gen.if((0, codegen_1._) `${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen - .assign(data, (0, codegen_1._) `${data}[0]`) - .assign(dataType, (0, codegen_1._) `typeof ${data}`) - .if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data))); - } - gen.if((0, codegen_1._) `${coerced} !== undefined`); - for (const t of coerceTo) { - if (COERCIBLE.has(t) || (t === "array" && opts.coerceTypes === "array")) { - coerceSpecificType(t); - } - } - gen.else(); - reportTypeError(it); - gen.endIf(); - gen.if((0, codegen_1._) `${coerced} !== undefined`, () => { - gen.assign(data, coerced); - assignParentData(it, coerced); - }); - function coerceSpecificType(t) { - switch (t) { - case "string": - gen - .elseIf((0, codegen_1._) `${dataType} == "number" || ${dataType} == "boolean"`) - .assign(coerced, (0, codegen_1._) `"" + ${data}`) - .elseIf((0, codegen_1._) `${data} === null`) - .assign(coerced, (0, codegen_1._) `""`); - return; - case "number": - gen - .elseIf((0, codegen_1._) `${dataType} == "boolean" || ${data} === null - || (${dataType} == "string" && ${data} && ${data} == +${data})`) - .assign(coerced, (0, codegen_1._) `+${data}`); - return; - case "integer": - gen - .elseIf((0, codegen_1._) `${dataType} === "boolean" || ${data} === null - || (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`) - .assign(coerced, (0, codegen_1._) `+${data}`); - return; - case "boolean": - gen - .elseIf((0, codegen_1._) `${data} === "false" || ${data} === 0 || ${data} === null`) - .assign(coerced, false) - .elseIf((0, codegen_1._) `${data} === "true" || ${data} === 1`) - .assign(coerced, true); - return; - case "null": - gen.elseIf((0, codegen_1._) `${data} === "" || ${data} === 0 || ${data} === false`); - gen.assign(coerced, null); - return; - case "array": - gen - .elseIf((0, codegen_1._) `${dataType} === "string" || ${dataType} === "number" - || ${dataType} === "boolean" || ${data} === null`) - .assign(coerced, (0, codegen_1._) `[${data}]`); - } - } -} -function assignParentData({ gen, parentData, parentDataProperty }, expr) { - // TODO use gen.property - gen.if((0, codegen_1._) `${parentData} !== undefined`, () => gen.assign((0, codegen_1._) `${parentData}[${parentDataProperty}]`, expr)); -} -function checkDataType(dataType, data, strictNums, correct = DataType.Correct) { - const EQ = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ; - let cond; - switch (dataType) { - case "null": - return (0, codegen_1._) `${data} ${EQ} null`; - case "array": - cond = (0, codegen_1._) `Array.isArray(${data})`; - break; - case "object": - cond = (0, codegen_1._) `${data} && typeof ${data} == "object" && !Array.isArray(${data})`; - break; - case "integer": - cond = numCond((0, codegen_1._) `!(${data} % 1) && !isNaN(${data})`); - break; - case "number": - cond = numCond(); - break; - default: - return (0, codegen_1._) `typeof ${data} ${EQ} ${dataType}`; - } - return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond); - function numCond(_cond = codegen_1.nil) { - return (0, codegen_1.and)((0, codegen_1._) `typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1._) `isFinite(${data})` : codegen_1.nil); - } -} -exports.checkDataType = checkDataType; -function checkDataTypes(dataTypes, data, strictNums, correct) { - if (dataTypes.length === 1) { - return checkDataType(dataTypes[0], data, strictNums, correct); - } - let cond; - const types = (0, util_1.toHash)(dataTypes); - if (types.array && types.object) { - const notObj = (0, codegen_1._) `typeof ${data} != "object"`; - cond = types.null ? notObj : (0, codegen_1._) `!${data} || ${notObj}`; - delete types.null; - delete types.array; - delete types.object; - } - else { - cond = codegen_1.nil; - } - if (types.number) - delete types.integer; - for (const t in types) - cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct)); - return cond; -} -exports.checkDataTypes = checkDataTypes; -const typeError = { - message: ({ schema }) => `must be ${schema}`, - params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1._) `{type: ${schema}}` : (0, codegen_1._) `{type: ${schemaValue}}`, -}; -function reportTypeError(it) { - const cxt = getTypeErrorContext(it); - (0, errors_1.reportError)(cxt, typeError); -} -exports.reportTypeError = reportTypeError; -function getTypeErrorContext(it) { - const { gen, data, schema } = it; - const schemaCode = (0, util_1.schemaRefOrVal)(it, schema, "type"); - return { - gen, - keyword: "type", - data, - schema: schema.type, - schemaCode, - schemaValue: schemaCode, - parentSchema: schema, - params: {}, - it, - }; -} -//# sourceMappingURL=dataType.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/validate/dataType.js.map b/node_modules/ajv/dist/compile/validate/dataType.js.map deleted file mode 100644 index c8fb1c6..0000000 --- a/node_modules/ajv/dist/compile/validate/dataType.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dataType.js","sourceRoot":"","sources":["../../../lib/compile/validate/dataType.ts"],"names":[],"mappings":";;;AAOA,oCAA6C;AAC7C,mDAAqD;AACrD,sCAAqC;AACrC,wCAAkE;AAClE,kCAA8C;AAE9C,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,6CAAO,CAAA;IACP,yCAAK,CAAA;AACP,CAAC,EAHW,QAAQ,wBAAR,QAAQ,QAGnB;AAED,SAAgB,cAAc,CAAC,MAAuB;IACpD,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACvC,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IACtC,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,MAAM,CAAC,QAAQ,KAAK,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;IAC1F,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;QAC7D,CAAC;QACD,IAAI,MAAM,CAAC,QAAQ,KAAK,IAAI;YAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAClD,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAZD,wCAYC;AAED,6EAA6E;AAC7E,SAAgB,YAAY,CAAC,EAAuB;IAClD,MAAM,KAAK,GAAc,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAChE,IAAI,KAAK,CAAC,KAAK,CAAC,kBAAU,CAAC;QAAE,OAAO,KAAK,CAAA;IACzC,MAAM,IAAI,KAAK,CAAC,uCAAuC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AAC5E,CAAC;AAJD,oCAIC;AAED,SAAgB,sBAAsB,CAAC,EAAgB,EAAE,KAAiB;IACxE,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IAC5B,MAAM,QAAQ,GAAG,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;IACvD,MAAM,UAAU,GACd,KAAK,CAAC,MAAM,GAAG,CAAC;QAChB,CAAC,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,IAAA,qCAAqB,EAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACvF,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAA;QACjF,GAAG,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;YACrB,IAAI,QAAQ,CAAC,MAAM;gBAAE,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAA;;gBAC/C,eAAe,CAAC,EAAE,CAAC,CAAA;QAC1B,CAAC,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AAdD,wDAcC;AAED,MAAM,SAAS,GAAkB,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAA;AAC5F,SAAS,aAAa,CAAC,KAAiB,EAAE,WAA+B;IACvE,OAAO,WAAW;QAChB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,KAAK,OAAO,IAAI,CAAC,KAAK,OAAO,CAAC,CAAC;QACrF,CAAC,CAAC,EAAE,CAAA;AACR,CAAC;AAED,SAAS,UAAU,CAAC,EAAgB,EAAE,KAAiB,EAAE,QAAoB;IAC3E,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IAC5B,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,IAAA,WAAC,EAAA,UAAU,IAAI,EAAE,CAAC,CAAA;IACvD,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,IAAA,WAAC,EAAA,WAAW,CAAC,CAAA;IAChD,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO,EAAE,CAAC;QACjC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,QAAQ,iCAAiC,IAAI,QAAQ,IAAI,cAAc,EAAE,GAAG,EAAE,CACvF,GAAG;aACA,MAAM,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,KAAK,CAAC;aAC3B,MAAM,CAAC,QAAQ,EAAE,IAAA,WAAC,EAAA,UAAU,IAAI,EAAE,CAAC;aACnC,EAAE,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CACxF,CAAA;IACH,CAAC;IACD,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,OAAO,gBAAgB,CAAC,CAAA;IACnC,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,OAAO,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO,CAAC,EAAE,CAAC;YACxE,kBAAkB,CAAC,CAAC,CAAC,CAAA;QACvB,CAAC;IACH,CAAC;IACD,GAAG,CAAC,IAAI,EAAE,CAAA;IACV,eAAe,CAAC,EAAE,CAAC,CAAA;IACnB,GAAG,CAAC,KAAK,EAAE,CAAA;IAEX,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,OAAO,gBAAgB,EAAE,GAAG,EAAE;QACvC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QACzB,gBAAgB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IAC/B,CAAC,CAAC,CAAA;IAEF,SAAS,kBAAkB,CAAC,CAAS;QACnC,QAAQ,CAAC,EAAE,CAAC;YACV,KAAK,QAAQ;gBACX,GAAG;qBACA,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,QAAQ,mBAAmB,QAAQ,eAAe,CAAC;qBAC9D,MAAM,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,QAAQ,IAAI,EAAE,CAAC;qBAChC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,CAAC;qBAC3B,MAAM,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,IAAI,CAAC,CAAA;gBACzB,OAAM;YACR,KAAK,QAAQ;gBACX,GAAG;qBACA,MAAM,CACL,IAAA,WAAC,EAAA,GAAG,QAAQ,oBAAoB,IAAI;oBAC5B,QAAQ,mBAAmB,IAAI,OAAO,IAAI,QAAQ,IAAI,GAAG,CAClE;qBACA,MAAM,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,IAAI,IAAI,EAAE,CAAC,CAAA;gBAC/B,OAAM;YACR,KAAK,SAAS;gBACZ,GAAG;qBACA,MAAM,CACL,IAAA,WAAC,EAAA,GAAG,QAAQ,qBAAqB,IAAI;oBAC7B,QAAQ,oBAAoB,IAAI,OAAO,IAAI,QAAQ,IAAI,SAAS,IAAI,QAAQ,CACrF;qBACA,MAAM,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,IAAI,IAAI,EAAE,CAAC,CAAA;gBAC/B,OAAM;YACR,KAAK,SAAS;gBACZ,GAAG;qBACA,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,mBAAmB,IAAI,aAAa,IAAI,WAAW,CAAC;qBACnE,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC;qBACtB,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,kBAAkB,IAAI,QAAQ,CAAC;qBAC9C,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;gBACxB,OAAM;YACR,KAAK,MAAM;gBACT,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,cAAc,IAAI,aAAa,IAAI,YAAY,CAAC,CAAA;gBACnE,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;gBACzB,OAAM;YAER,KAAK,OAAO;gBACV,GAAG;qBACA,MAAM,CACL,IAAA,WAAC,EAAA,GAAG,QAAQ,oBAAoB,QAAQ;mBACjC,QAAQ,qBAAqB,IAAI,WAAW,CACpD;qBACA,MAAM,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,IAAI,IAAI,GAAG,CAAC,CAAA;QACpC,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,EAAC,GAAG,EAAE,UAAU,EAAE,kBAAkB,EAAe,EAAE,IAAU;IACvF,wBAAwB;IACxB,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,UAAU,gBAAgB,EAAE,GAAG,EAAE,CAC1C,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,UAAU,IAAI,kBAAkB,GAAG,EAAE,IAAI,CAAC,CAC1D,CAAA;AACH,CAAC;AAED,SAAgB,aAAa,CAC3B,QAAkB,EAClB,IAAU,EACV,UAA4B,EAC5B,OAAO,GAAG,QAAQ,CAAC,OAAO;IAE1B,MAAM,EAAE,GAAG,OAAO,KAAK,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAS,CAAC,GAAG,CAAA;IACtE,IAAI,IAAU,CAAA;IACd,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,MAAM;YACT,OAAO,IAAA,WAAC,EAAA,GAAG,IAAI,IAAI,EAAE,OAAO,CAAA;QAC9B,KAAK,OAAO;YACV,IAAI,GAAG,IAAA,WAAC,EAAA,iBAAiB,IAAI,GAAG,CAAA;YAChC,MAAK;QACP,KAAK,QAAQ;YACX,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,cAAc,IAAI,kCAAkC,IAAI,GAAG,CAAA;YAC1E,MAAK;QACP,KAAK,SAAS;YACZ,IAAI,GAAG,OAAO,CAAC,IAAA,WAAC,EAAA,KAAK,IAAI,mBAAmB,IAAI,GAAG,CAAC,CAAA;YACpD,MAAK;QACP,KAAK,QAAQ;YACX,IAAI,GAAG,OAAO,EAAE,CAAA;YAChB,MAAK;QACP;YACE,OAAO,IAAA,WAAC,EAAA,UAAU,IAAI,IAAI,EAAE,IAAI,QAAQ,EAAE,CAAA;IAC9C,CAAC;IACD,OAAO,OAAO,KAAK,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,aAAG,EAAC,IAAI,CAAC,CAAA;IAEtD,SAAS,OAAO,CAAC,QAAc,aAAG;QAChC,OAAO,IAAA,aAAG,EAAC,IAAA,WAAC,EAAA,UAAU,IAAI,cAAc,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,YAAY,IAAI,GAAG,CAAC,CAAC,CAAC,aAAG,CAAC,CAAA;IAC3F,CAAC;AACH,CAAC;AA/BD,sCA+BC;AAED,SAAgB,cAAc,CAC5B,SAAqB,EACrB,IAAU,EACV,UAA4B,EAC5B,OAAkB;IAElB,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IAC/D,CAAC;IACD,IAAI,IAAU,CAAA;IACd,MAAM,KAAK,GAAG,IAAA,aAAM,EAAC,SAAS,CAAC,CAAA;IAC/B,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,cAAc,CAAA;QAC5C,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,IAAI,IAAI,OAAO,MAAM,EAAE,CAAA;QACrD,OAAO,KAAK,CAAC,IAAI,CAAA;QACjB,OAAO,KAAK,CAAC,KAAK,CAAA;QAClB,OAAO,KAAK,CAAC,MAAM,CAAA;IACrB,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,aAAG,CAAA;IACZ,CAAC;IACD,IAAI,KAAK,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC,OAAO,CAAA;IACtC,KAAK,MAAM,CAAC,IAAI,KAAK;QAAE,IAAI,GAAG,IAAA,aAAG,EAAC,IAAI,EAAE,aAAa,CAAC,CAAa,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAA;IAChG,OAAO,IAAI,CAAA;AACb,CAAC;AAvBD,wCAuBC;AAID,MAAM,SAAS,GAA2B;IACxC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,WAAW,MAAM,EAAE;IAC1C,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,WAAW,EAAC,EAAE,EAAE,CAChC,OAAO,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,UAAU,MAAM,GAAG,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,UAAU,WAAW,GAAG;CAC/E,CAAA;AAED,SAAgB,eAAe,CAAC,EAAgB;IAC9C,MAAM,GAAG,GAAG,mBAAmB,CAAC,EAAE,CAAC,CAAA;IACnC,IAAA,oBAAW,EAAC,GAAG,EAAE,SAAS,CAAC,CAAA;AAC7B,CAAC;AAHD,0CAGC;AAED,SAAS,mBAAmB,CAAC,EAAgB;IAC3C,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAC,GAAG,EAAE,CAAA;IAC9B,MAAM,UAAU,GAAG,IAAA,qBAAc,EAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACrD,OAAO;QACL,GAAG;QACH,OAAO,EAAE,MAAM;QACf,IAAI;QACJ,MAAM,EAAE,MAAM,CAAC,IAAI;QACnB,UAAU;QACV,WAAW,EAAE,UAAU;QACvB,YAAY,EAAE,MAAM;QACpB,MAAM,EAAE,EAAE;QACV,EAAE;KACH,CAAA;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/validate/defaults.d.ts b/node_modules/ajv/dist/compile/validate/defaults.d.ts deleted file mode 100644 index 02ba453..0000000 --- a/node_modules/ajv/dist/compile/validate/defaults.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type { SchemaObjCxt } from ".."; -export declare function assignDefaults(it: SchemaObjCxt, ty?: string): void; diff --git a/node_modules/ajv/dist/compile/validate/defaults.js b/node_modules/ajv/dist/compile/validate/defaults.js deleted file mode 100644 index cd9c42d..0000000 --- a/node_modules/ajv/dist/compile/validate/defaults.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.assignDefaults = void 0; -const codegen_1 = require("../codegen"); -const util_1 = require("../util"); -function assignDefaults(it, ty) { - const { properties, items } = it.schema; - if (ty === "object" && properties) { - for (const key in properties) { - assignDefault(it, key, properties[key].default); - } - } - else if (ty === "array" && Array.isArray(items)) { - items.forEach((sch, i) => assignDefault(it, i, sch.default)); - } -} -exports.assignDefaults = assignDefaults; -function assignDefault(it, prop, defaultValue) { - const { gen, compositeRule, data, opts } = it; - if (defaultValue === undefined) - return; - const childData = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(prop)}`; - if (compositeRule) { - (0, util_1.checkStrictMode)(it, `default is ignored for: ${childData}`); - return; - } - let condition = (0, codegen_1._) `${childData} === undefined`; - if (opts.useDefaults === "empty") { - condition = (0, codegen_1._) `${condition} || ${childData} === null || ${childData} === ""`; - } - // `${childData} === undefined` + - // (opts.useDefaults === "empty" ? ` || ${childData} === null || ${childData} === ""` : "") - gen.if(condition, (0, codegen_1._) `${childData} = ${(0, codegen_1.stringify)(defaultValue)}`); -} -//# sourceMappingURL=defaults.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/validate/defaults.js.map b/node_modules/ajv/dist/compile/validate/defaults.js.map deleted file mode 100644 index 88d3672..0000000 --- a/node_modules/ajv/dist/compile/validate/defaults.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../lib/compile/validate/defaults.ts"],"names":[],"mappings":";;;AACA,wCAAoD;AACpD,kCAAuC;AAEvC,SAAgB,cAAc,CAAC,EAAgB,EAAE,EAAW;IAC1D,MAAM,EAAC,UAAU,EAAE,KAAK,EAAC,GAAG,EAAE,CAAC,MAAM,CAAA;IACrC,IAAI,EAAE,KAAK,QAAQ,IAAI,UAAU,EAAE,CAAC;QAClC,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;YAC7B,aAAa,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAA;QACjD,CAAC;IACH,CAAC;SAAM,IAAI,EAAE,KAAK,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAClD,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAS,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IACtE,CAAC;AACH,CAAC;AATD,wCASC;AAED,SAAS,aAAa,CAAC,EAAgB,EAAE,IAAqB,EAAE,YAAqB;IACnF,MAAM,EAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IAC3C,IAAI,YAAY,KAAK,SAAS;QAAE,OAAM;IACtC,MAAM,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,GAAG,IAAA,qBAAW,EAAC,IAAI,CAAC,EAAE,CAAA;IAChD,IAAI,aAAa,EAAE,CAAC;QAClB,IAAA,sBAAe,EAAC,EAAE,EAAE,2BAA2B,SAAS,EAAE,CAAC,CAAA;QAC3D,OAAM;IACR,CAAC;IAED,IAAI,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,SAAS,gBAAgB,CAAA;IAC7C,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO,EAAE,CAAC;QACjC,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,SAAS,OAAO,SAAS,gBAAgB,SAAS,SAAS,CAAA;IAC7E,CAAC;IACD,iCAAiC;IACjC,2FAA2F;IAC3F,GAAG,CAAC,EAAE,CAAC,SAAS,EAAE,IAAA,WAAC,EAAA,GAAG,SAAS,MAAM,IAAA,mBAAS,EAAC,YAAY,CAAC,EAAE,CAAC,CAAA;AACjE,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/validate/index.d.ts b/node_modules/ajv/dist/compile/validate/index.d.ts deleted file mode 100644 index 6c533ed..0000000 --- a/node_modules/ajv/dist/compile/validate/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import type { AddedKeywordDefinition, AnySchemaObject, KeywordErrorCxt, KeywordCxtParams } from "../../types"; -import type { SchemaCxt, SchemaObjCxt } from ".."; -import { SubschemaArgs } from "./subschema"; -import { Code, Name, CodeGen } from "../codegen"; -import type { JSONType } from "../rules"; -import { ErrorPaths } from "../errors"; -export declare function validateFunctionCode(it: SchemaCxt): void; -export declare class KeywordCxt implements KeywordErrorCxt { - readonly gen: CodeGen; - readonly allErrors?: boolean; - readonly keyword: string; - readonly data: Name; - readonly $data?: string | false; - schema: any; - readonly schemaValue: Code | number | boolean; - readonly schemaCode: Code | number | boolean; - readonly schemaType: JSONType[]; - readonly parentSchema: AnySchemaObject; - readonly errsCount?: Name; - params: KeywordCxtParams; - readonly it: SchemaObjCxt; - readonly def: AddedKeywordDefinition; - constructor(it: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string); - result(condition: Code, successAction?: () => void, failAction?: () => void): void; - failResult(condition: Code, successAction?: () => void, failAction?: () => void): void; - pass(condition: Code, failAction?: () => void): void; - fail(condition?: Code): void; - fail$data(condition: Code): void; - error(append?: boolean, errorParams?: KeywordCxtParams, errorPaths?: ErrorPaths): void; - private _error; - $dataError(): void; - reset(): void; - ok(cond: Code | boolean): void; - setParams(obj: KeywordCxtParams, assign?: true): void; - block$data(valid: Name, codeBlock: () => void, $dataValid?: Code): void; - check$data(valid?: Name, $dataValid?: Code): void; - invalid$data(): Code; - subschema(appl: SubschemaArgs, valid: Name): SchemaCxt; - mergeEvaluated(schemaCxt: SchemaCxt, toName?: typeof Name): void; - mergeValidEvaluated(schemaCxt: SchemaCxt, valid: Name): boolean | void; -} -export declare function getData($data: string, { dataLevel, dataNames, dataPathArr }: SchemaCxt): Code | number; diff --git a/node_modules/ajv/dist/compile/validate/index.js b/node_modules/ajv/dist/compile/validate/index.js deleted file mode 100644 index 0d68332..0000000 --- a/node_modules/ajv/dist/compile/validate/index.js +++ /dev/null @@ -1,520 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getData = exports.KeywordCxt = exports.validateFunctionCode = void 0; -const boolSchema_1 = require("./boolSchema"); -const dataType_1 = require("./dataType"); -const applicability_1 = require("./applicability"); -const dataType_2 = require("./dataType"); -const defaults_1 = require("./defaults"); -const keyword_1 = require("./keyword"); -const subschema_1 = require("./subschema"); -const codegen_1 = require("../codegen"); -const names_1 = require("../names"); -const resolve_1 = require("../resolve"); -const util_1 = require("../util"); -const errors_1 = require("../errors"); -// schema compilation - generates validation function, subschemaCode (below) is used for subschemas -function validateFunctionCode(it) { - if (isSchemaObj(it)) { - checkKeywords(it); - if (schemaCxtHasRules(it)) { - topSchemaObjCode(it); - return; - } - } - validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it)); -} -exports.validateFunctionCode = validateFunctionCode; -function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) { - if (opts.code.es5) { - gen.func(validateName, (0, codegen_1._) `${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => { - gen.code((0, codegen_1._) `"use strict"; ${funcSourceUrl(schema, opts)}`); - destructureValCxtES5(gen, opts); - gen.code(body); - }); - } - else { - gen.func(validateName, (0, codegen_1._) `${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body)); - } -} -function destructureValCxt(opts) { - return (0, codegen_1._) `{${names_1.default.instancePath}="", ${names_1.default.parentData}, ${names_1.default.parentDataProperty}, ${names_1.default.rootData}=${names_1.default.data}${opts.dynamicRef ? (0, codegen_1._) `, ${names_1.default.dynamicAnchors}={}` : codegen_1.nil}}={}`; -} -function destructureValCxtES5(gen, opts) { - gen.if(names_1.default.valCxt, () => { - gen.var(names_1.default.instancePath, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.instancePath}`); - gen.var(names_1.default.parentData, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.parentData}`); - gen.var(names_1.default.parentDataProperty, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.parentDataProperty}`); - gen.var(names_1.default.rootData, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.rootData}`); - if (opts.dynamicRef) - gen.var(names_1.default.dynamicAnchors, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.dynamicAnchors}`); - }, () => { - gen.var(names_1.default.instancePath, (0, codegen_1._) `""`); - gen.var(names_1.default.parentData, (0, codegen_1._) `undefined`); - gen.var(names_1.default.parentDataProperty, (0, codegen_1._) `undefined`); - gen.var(names_1.default.rootData, names_1.default.data); - if (opts.dynamicRef) - gen.var(names_1.default.dynamicAnchors, (0, codegen_1._) `{}`); - }); -} -function topSchemaObjCode(it) { - const { schema, opts, gen } = it; - validateFunction(it, () => { - if (opts.$comment && schema.$comment) - commentKeyword(it); - checkNoDefault(it); - gen.let(names_1.default.vErrors, null); - gen.let(names_1.default.errors, 0); - if (opts.unevaluated) - resetEvaluated(it); - typeAndKeywords(it); - returnResults(it); - }); - return; -} -function resetEvaluated(it) { - // TODO maybe some hook to execute it in the end to check whether props/items are Name, as in assignEvaluated - const { gen, validateName } = it; - it.evaluated = gen.const("evaluated", (0, codegen_1._) `${validateName}.evaluated`); - gen.if((0, codegen_1._) `${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1._) `${it.evaluated}.props`, (0, codegen_1._) `undefined`)); - gen.if((0, codegen_1._) `${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1._) `${it.evaluated}.items`, (0, codegen_1._) `undefined`)); -} -function funcSourceUrl(schema, opts) { - const schId = typeof schema == "object" && schema[opts.schemaId]; - return schId && (opts.code.source || opts.code.process) ? (0, codegen_1._) `/*# sourceURL=${schId} */` : codegen_1.nil; -} -// schema compilation - this function is used recursively to generate code for sub-schemas -function subschemaCode(it, valid) { - if (isSchemaObj(it)) { - checkKeywords(it); - if (schemaCxtHasRules(it)) { - subSchemaObjCode(it, valid); - return; - } - } - (0, boolSchema_1.boolOrEmptySchema)(it, valid); -} -function schemaCxtHasRules({ schema, self }) { - if (typeof schema == "boolean") - return !schema; - for (const key in schema) - if (self.RULES.all[key]) - return true; - return false; -} -function isSchemaObj(it) { - return typeof it.schema != "boolean"; -} -function subSchemaObjCode(it, valid) { - const { schema, gen, opts } = it; - if (opts.$comment && schema.$comment) - commentKeyword(it); - updateContext(it); - checkAsyncSchema(it); - const errsCount = gen.const("_errs", names_1.default.errors); - typeAndKeywords(it, errsCount); - // TODO var - gen.var(valid, (0, codegen_1._) `${errsCount} === ${names_1.default.errors}`); -} -function checkKeywords(it) { - (0, util_1.checkUnknownRules)(it); - checkRefsAndKeywords(it); -} -function typeAndKeywords(it, errsCount) { - if (it.opts.jtd) - return schemaKeywords(it, [], false, errsCount); - const types = (0, dataType_1.getSchemaTypes)(it.schema); - const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it, types); - schemaKeywords(it, types, !checkedTypes, errsCount); -} -function checkRefsAndKeywords(it) { - const { schema, errSchemaPath, opts, self } = it; - if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema, self.RULES)) { - self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`); - } -} -function checkNoDefault(it) { - const { schema, opts } = it; - if (schema.default !== undefined && opts.useDefaults && opts.strictSchema) { - (0, util_1.checkStrictMode)(it, "default is ignored in the schema root"); - } -} -function updateContext(it) { - const schId = it.schema[it.opts.schemaId]; - if (schId) - it.baseId = (0, resolve_1.resolveUrl)(it.opts.uriResolver, it.baseId, schId); -} -function checkAsyncSchema(it) { - if (it.schema.$async && !it.schemaEnv.$async) - throw new Error("async schema in sync schema"); -} -function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) { - const msg = schema.$comment; - if (opts.$comment === true) { - gen.code((0, codegen_1._) `${names_1.default.self}.logger.log(${msg})`); - } - else if (typeof opts.$comment == "function") { - const schemaPath = (0, codegen_1.str) `${errSchemaPath}/$comment`; - const rootName = gen.scopeValue("root", { ref: schemaEnv.root }); - gen.code((0, codegen_1._) `${names_1.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`); - } -} -function returnResults(it) { - const { gen, schemaEnv, validateName, ValidationError, opts } = it; - if (schemaEnv.$async) { - // TODO assign unevaluated - gen.if((0, codegen_1._) `${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._) `new ${ValidationError}(${names_1.default.vErrors})`)); - } - else { - gen.assign((0, codegen_1._) `${validateName}.errors`, names_1.default.vErrors); - if (opts.unevaluated) - assignEvaluated(it); - gen.return((0, codegen_1._) `${names_1.default.errors} === 0`); - } -} -function assignEvaluated({ gen, evaluated, props, items }) { - if (props instanceof codegen_1.Name) - gen.assign((0, codegen_1._) `${evaluated}.props`, props); - if (items instanceof codegen_1.Name) - gen.assign((0, codegen_1._) `${evaluated}.items`, items); -} -function schemaKeywords(it, types, typeErrors, errsCount) { - const { gen, schema, data, allErrors, opts, self } = it; - const { RULES } = self; - if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema, RULES))) { - gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition)); // TODO typecast - return; - } - if (!opts.jtd) - checkStrictTypes(it, types); - gen.block(() => { - for (const group of RULES.rules) - groupKeywords(group); - groupKeywords(RULES.post); - }); - function groupKeywords(group) { - if (!(0, applicability_1.shouldUseGroup)(schema, group)) - return; - if (group.type) { - gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers)); - iterateKeywords(it, group); - if (types.length === 1 && types[0] === group.type && typeErrors) { - gen.else(); - (0, dataType_2.reportTypeError)(it); - } - gen.endIf(); - } - else { - iterateKeywords(it, group); - } - // TODO make it "ok" call? - if (!allErrors) - gen.if((0, codegen_1._) `${names_1.default.errors} === ${errsCount || 0}`); - } -} -function iterateKeywords(it, group) { - const { gen, schema, opts: { useDefaults }, } = it; - if (useDefaults) - (0, defaults_1.assignDefaults)(it, group.type); - gen.block(() => { - for (const rule of group.rules) { - if ((0, applicability_1.shouldUseRule)(schema, rule)) { - keywordCode(it, rule.keyword, rule.definition, group.type); - } - } - }); -} -function checkStrictTypes(it, types) { - if (it.schemaEnv.meta || !it.opts.strictTypes) - return; - checkContextTypes(it, types); - if (!it.opts.allowUnionTypes) - checkMultipleTypes(it, types); - checkKeywordTypes(it, it.dataTypes); -} -function checkContextTypes(it, types) { - if (!types.length) - return; - if (!it.dataTypes.length) { - it.dataTypes = types; - return; - } - types.forEach((t) => { - if (!includesType(it.dataTypes, t)) { - strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`); - } - }); - narrowSchemaTypes(it, types); -} -function checkMultipleTypes(it, ts) { - if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) { - strictTypesError(it, "use allowUnionTypes to allow union type keyword"); - } -} -function checkKeywordTypes(it, ts) { - const rules = it.self.RULES.all; - for (const keyword in rules) { - const rule = rules[keyword]; - if (typeof rule == "object" && (0, applicability_1.shouldUseRule)(it.schema, rule)) { - const { type } = rule.definition; - if (type.length && !type.some((t) => hasApplicableType(ts, t))) { - strictTypesError(it, `missing type "${type.join(",")}" for keyword "${keyword}"`); - } - } - } -} -function hasApplicableType(schTs, kwdT) { - return schTs.includes(kwdT) || (kwdT === "number" && schTs.includes("integer")); -} -function includesType(ts, t) { - return ts.includes(t) || (t === "integer" && ts.includes("number")); -} -function narrowSchemaTypes(it, withTypes) { - const ts = []; - for (const t of it.dataTypes) { - if (includesType(withTypes, t)) - ts.push(t); - else if (withTypes.includes("integer") && t === "number") - ts.push("integer"); - } - it.dataTypes = ts; -} -function strictTypesError(it, msg) { - const schemaPath = it.schemaEnv.baseId + it.errSchemaPath; - msg += ` at "${schemaPath}" (strictTypes)`; - (0, util_1.checkStrictMode)(it, msg, it.opts.strictTypes); -} -class KeywordCxt { - constructor(it, def, keyword) { - (0, keyword_1.validateKeywordUsage)(it, def, keyword); - this.gen = it.gen; - this.allErrors = it.allErrors; - this.keyword = keyword; - this.data = it.data; - this.schema = it.schema[keyword]; - this.$data = def.$data && it.opts.$data && this.schema && this.schema.$data; - this.schemaValue = (0, util_1.schemaRefOrVal)(it, this.schema, keyword, this.$data); - this.schemaType = def.schemaType; - this.parentSchema = it.schema; - this.params = {}; - this.it = it; - this.def = def; - if (this.$data) { - this.schemaCode = it.gen.const("vSchema", getData(this.$data, it)); - } - else { - this.schemaCode = this.schemaValue; - if (!(0, keyword_1.validSchemaType)(this.schema, def.schemaType, def.allowUndefined)) { - throw new Error(`${keyword} value must be ${JSON.stringify(def.schemaType)}`); - } - } - if ("code" in def ? def.trackErrors : def.errors !== false) { - this.errsCount = it.gen.const("_errs", names_1.default.errors); - } - } - result(condition, successAction, failAction) { - this.failResult((0, codegen_1.not)(condition), successAction, failAction); - } - failResult(condition, successAction, failAction) { - this.gen.if(condition); - if (failAction) - failAction(); - else - this.error(); - if (successAction) { - this.gen.else(); - successAction(); - if (this.allErrors) - this.gen.endIf(); - } - else { - if (this.allErrors) - this.gen.endIf(); - else - this.gen.else(); - } - } - pass(condition, failAction) { - this.failResult((0, codegen_1.not)(condition), undefined, failAction); - } - fail(condition) { - if (condition === undefined) { - this.error(); - if (!this.allErrors) - this.gen.if(false); // this branch will be removed by gen.optimize - return; - } - this.gen.if(condition); - this.error(); - if (this.allErrors) - this.gen.endIf(); - else - this.gen.else(); - } - fail$data(condition) { - if (!this.$data) - return this.fail(condition); - const { schemaCode } = this; - this.fail((0, codegen_1._) `${schemaCode} !== undefined && (${(0, codegen_1.or)(this.invalid$data(), condition)})`); - } - error(append, errorParams, errorPaths) { - if (errorParams) { - this.setParams(errorParams); - this._error(append, errorPaths); - this.setParams({}); - return; - } - this._error(append, errorPaths); - } - _error(append, errorPaths) { - ; - (append ? errors_1.reportExtraError : errors_1.reportError)(this, this.def.error, errorPaths); - } - $dataError() { - (0, errors_1.reportError)(this, this.def.$dataError || errors_1.keyword$DataError); - } - reset() { - if (this.errsCount === undefined) - throw new Error('add "trackErrors" to keyword definition'); - (0, errors_1.resetErrorsCount)(this.gen, this.errsCount); - } - ok(cond) { - if (!this.allErrors) - this.gen.if(cond); - } - setParams(obj, assign) { - if (assign) - Object.assign(this.params, obj); - else - this.params = obj; - } - block$data(valid, codeBlock, $dataValid = codegen_1.nil) { - this.gen.block(() => { - this.check$data(valid, $dataValid); - codeBlock(); - }); - } - check$data(valid = codegen_1.nil, $dataValid = codegen_1.nil) { - if (!this.$data) - return; - const { gen, schemaCode, schemaType, def } = this; - gen.if((0, codegen_1.or)((0, codegen_1._) `${schemaCode} === undefined`, $dataValid)); - if (valid !== codegen_1.nil) - gen.assign(valid, true); - if (schemaType.length || def.validateSchema) { - gen.elseIf(this.invalid$data()); - this.$dataError(); - if (valid !== codegen_1.nil) - gen.assign(valid, false); - } - gen.else(); - } - invalid$data() { - const { gen, schemaCode, schemaType, def, it } = this; - return (0, codegen_1.or)(wrong$DataType(), invalid$DataSchema()); - function wrong$DataType() { - if (schemaType.length) { - /* istanbul ignore if */ - if (!(schemaCode instanceof codegen_1.Name)) - throw new Error("ajv implementation error"); - const st = Array.isArray(schemaType) ? schemaType : [schemaType]; - return (0, codegen_1._) `${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`; - } - return codegen_1.nil; - } - function invalid$DataSchema() { - if (def.validateSchema) { - const validateSchemaRef = gen.scopeValue("validate$data", { ref: def.validateSchema }); // TODO value.code for standalone - return (0, codegen_1._) `!${validateSchemaRef}(${schemaCode})`; - } - return codegen_1.nil; - } - } - subschema(appl, valid) { - const subschema = (0, subschema_1.getSubschema)(this.it, appl); - (0, subschema_1.extendSubschemaData)(subschema, this.it, appl); - (0, subschema_1.extendSubschemaMode)(subschema, appl); - const nextContext = { ...this.it, ...subschema, items: undefined, props: undefined }; - subschemaCode(nextContext, valid); - return nextContext; - } - mergeEvaluated(schemaCxt, toName) { - const { it, gen } = this; - if (!it.opts.unevaluated) - return; - if (it.props !== true && schemaCxt.props !== undefined) { - it.props = util_1.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName); - } - if (it.items !== true && schemaCxt.items !== undefined) { - it.items = util_1.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName); - } - } - mergeValidEvaluated(schemaCxt, valid) { - const { it, gen } = this; - if (it.opts.unevaluated && (it.props !== true || it.items !== true)) { - gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_1.Name)); - return true; - } - } -} -exports.KeywordCxt = KeywordCxt; -function keywordCode(it, keyword, def, ruleType) { - const cxt = new KeywordCxt(it, def, keyword); - if ("code" in def) { - def.code(cxt, ruleType); - } - else if (cxt.$data && def.validate) { - (0, keyword_1.funcKeywordCode)(cxt, def); - } - else if ("macro" in def) { - (0, keyword_1.macroKeywordCode)(cxt, def); - } - else if (def.compile || def.validate) { - (0, keyword_1.funcKeywordCode)(cxt, def); - } -} -const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/; -const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; -function getData($data, { dataLevel, dataNames, dataPathArr }) { - let jsonPointer; - let data; - if ($data === "") - return names_1.default.rootData; - if ($data[0] === "/") { - if (!JSON_POINTER.test($data)) - throw new Error(`Invalid JSON-pointer: ${$data}`); - jsonPointer = $data; - data = names_1.default.rootData; - } - else { - const matches = RELATIVE_JSON_POINTER.exec($data); - if (!matches) - throw new Error(`Invalid JSON-pointer: ${$data}`); - const up = +matches[1]; - jsonPointer = matches[2]; - if (jsonPointer === "#") { - if (up >= dataLevel) - throw new Error(errorMsg("property/index", up)); - return dataPathArr[dataLevel - up]; - } - if (up > dataLevel) - throw new Error(errorMsg("data", up)); - data = dataNames[dataLevel - up]; - if (!jsonPointer) - return data; - } - let expr = data; - const segments = jsonPointer.split("/"); - for (const segment of segments) { - if (segment) { - data = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)((0, util_1.unescapeJsonPointer)(segment))}`; - expr = (0, codegen_1._) `${expr} && ${data}`; - } - } - return expr; - function errorMsg(pointerType, up) { - return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`; - } -} -exports.getData = getData; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/validate/index.js.map b/node_modules/ajv/dist/compile/validate/index.js.map deleted file mode 100644 index cdf5854..0000000 --- a/node_modules/ajv/dist/compile/validate/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/compile/validate/index.ts"],"names":[],"mappings":";;;AASA,6CAAoE;AACpE,yCAAiE;AACjE,mDAA6D;AAC7D,yCAAmF;AACnF,yCAAyC;AACzC,uCAAkG;AAClG,2CAAiG;AACjG,wCAAwF;AACxF,oCAAwB;AACxB,wCAAqC;AACrC,kCAOgB;AAEhB,sCAMkB;AAElB,mGAAmG;AACnG,SAAgB,oBAAoB,CAAC,EAAa;IAChD,IAAI,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC;QACpB,aAAa,CAAC,EAAE,CAAC,CAAA;QACjB,IAAI,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC;YAC1B,gBAAgB,CAAC,EAAE,CAAC,CAAA;YACpB,OAAM;QACR,CAAC;IACH,CAAC;IACD,gBAAgB,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,IAAA,iCAAoB,EAAC,EAAE,CAAC,CAAC,CAAA;AACtD,CAAC;AATD,oDASC;AAED,SAAS,gBAAgB,CACvB,EAAC,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAY,EACvD,IAAW;IAEX,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAClB,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,IAAI,KAAK,eAAC,CAAC,MAAM,EAAE,EAAE,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE;YACvE,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,iBAAiB,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;YACzD,oBAAoB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;YAC/B,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAChB,CAAC,CAAC,CAAA;IACJ,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,IAAI,KAAK,iBAAiB,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,CACtF,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CACjD,CAAA;IACH,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAqB;IAC9C,OAAO,IAAA,WAAC,EAAA,IAAI,eAAC,CAAC,YAAY,QAAQ,eAAC,CAAC,UAAU,KAAK,eAAC,CAAC,kBAAkB,KAAK,eAAC,CAAC,QAAQ,IACpF,eAAC,CAAC,IACJ,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,KAAK,eAAC,CAAC,cAAc,KAAK,CAAC,CAAC,CAAC,aAAG,MAAM,CAAA;AAC9D,CAAC;AAED,SAAS,oBAAoB,CAAC,GAAY,EAAE,IAAqB;IAC/D,GAAG,CAAC,EAAE,CACJ,eAAC,CAAC,MAAM,EACR,GAAG,EAAE;QACH,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,YAAY,EAAE,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,MAAM,IAAI,eAAC,CAAC,YAAY,EAAE,CAAC,CAAA;QACzD,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,UAAU,EAAE,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,MAAM,IAAI,eAAC,CAAC,UAAU,EAAE,CAAC,CAAA;QACrD,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,kBAAkB,EAAE,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,MAAM,IAAI,eAAC,CAAC,kBAAkB,EAAE,CAAC,CAAA;QACrE,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,QAAQ,EAAE,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,MAAM,IAAI,eAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;QACjD,IAAI,IAAI,CAAC,UAAU;YAAE,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,cAAc,EAAE,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,MAAM,IAAI,eAAC,CAAC,cAAc,EAAE,CAAC,CAAA;IACpF,CAAC,EACD,GAAG,EAAE;QACH,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,YAAY,EAAE,IAAA,WAAC,EAAA,IAAI,CAAC,CAAA;QAC9B,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,UAAU,EAAE,IAAA,WAAC,EAAA,WAAW,CAAC,CAAA;QACnC,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,kBAAkB,EAAE,IAAA,WAAC,EAAA,WAAW,CAAC,CAAA;QAC3C,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,QAAQ,EAAE,eAAC,CAAC,IAAI,CAAC,CAAA;QAC3B,IAAI,IAAI,CAAC,UAAU;YAAE,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,cAAc,EAAE,IAAA,WAAC,EAAA,IAAI,CAAC,CAAA;IACvD,CAAC,CACF,CAAA;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,EAAgB;IACxC,MAAM,EAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAC,GAAG,EAAE,CAAA;IAC9B,gBAAgB,CAAC,EAAE,EAAE,GAAG,EAAE;QACxB,IAAI,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ;YAAE,cAAc,CAAC,EAAE,CAAC,CAAA;QACxD,cAAc,CAAC,EAAE,CAAC,CAAA;QAClB,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QACxB,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;QACpB,IAAI,IAAI,CAAC,WAAW;YAAE,cAAc,CAAC,EAAE,CAAC,CAAA;QACxC,eAAe,CAAC,EAAE,CAAC,CAAA;QACnB,aAAa,CAAC,EAAE,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;IACF,OAAM;AACR,CAAC;AAED,SAAS,cAAc,CAAC,EAAgB;IACtC,6GAA6G;IAC7G,MAAM,EAAC,GAAG,EAAE,YAAY,EAAC,GAAG,EAAE,CAAA;IAC9B,EAAE,CAAC,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,IAAA,WAAC,EAAA,GAAG,YAAY,YAAY,CAAC,CAAA;IACnE,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,EAAE,CAAC,SAAS,eAAe,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,EAAE,CAAC,SAAS,QAAQ,EAAE,IAAA,WAAC,EAAA,WAAW,CAAC,CAAC,CAAA;IACjG,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,EAAE,CAAC,SAAS,eAAe,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,EAAE,CAAC,SAAS,QAAQ,EAAE,IAAA,WAAC,EAAA,WAAW,CAAC,CAAC,CAAA;AACnG,CAAC;AAED,SAAS,aAAa,CAAC,MAAiB,EAAE,IAAqB;IAC7D,MAAM,KAAK,GAAG,OAAO,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAChE,OAAO,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,iBAAiB,KAAK,KAAK,CAAC,CAAC,CAAC,aAAG,CAAA;AAC9F,CAAC;AAED,0FAA0F;AAC1F,SAAS,aAAa,CAAC,EAAa,EAAE,KAAW;IAC/C,IAAI,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC;QACpB,aAAa,CAAC,EAAE,CAAC,CAAA;QACjB,IAAI,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC;YAC1B,gBAAgB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;YAC3B,OAAM;QACR,CAAC;IACH,CAAC;IACD,IAAA,8BAAiB,EAAC,EAAE,EAAE,KAAK,CAAC,CAAA;AAC9B,CAAC;AAED,SAAS,iBAAiB,CAAC,EAAC,MAAM,EAAE,IAAI,EAAY;IAClD,IAAI,OAAO,MAAM,IAAI,SAAS;QAAE,OAAO,CAAC,MAAM,CAAA;IAC9C,KAAK,MAAM,GAAG,IAAI,MAAM;QAAE,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAA;IAC9D,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,WAAW,CAAC,EAAa;IAChC,OAAO,OAAO,EAAE,CAAC,MAAM,IAAI,SAAS,CAAA;AACtC,CAAC;AAED,SAAS,gBAAgB,CAAC,EAAgB,EAAE,KAAW;IACrD,MAAM,EAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IAC9B,IAAI,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ;QAAE,cAAc,CAAC,EAAE,CAAC,CAAA;IACxD,aAAa,CAAC,EAAE,CAAC,CAAA;IACjB,gBAAgB,CAAC,EAAE,CAAC,CAAA;IACpB,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,eAAC,CAAC,MAAM,CAAC,CAAA;IAC9C,eAAe,CAAC,EAAE,EAAE,SAAS,CAAC,CAAA;IAC9B,WAAW;IACX,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,SAAS,QAAQ,eAAC,CAAC,MAAM,EAAE,CAAC,CAAA;AACjD,CAAC;AAED,SAAS,aAAa,CAAC,EAAgB;IACrC,IAAA,wBAAiB,EAAC,EAAE,CAAC,CAAA;IACrB,oBAAoB,CAAC,EAAE,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,eAAe,CAAC,EAAgB,EAAE,SAAgB;IACzD,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG;QAAE,OAAO,cAAc,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;IAChE,MAAM,KAAK,GAAG,IAAA,yBAAc,EAAC,EAAE,CAAC,MAAM,CAAC,CAAA;IACvC,MAAM,YAAY,GAAG,IAAA,iCAAsB,EAAC,EAAE,EAAE,KAAK,CAAC,CAAA;IACtD,cAAc,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC,CAAA;AACrD,CAAC;AAED,SAAS,oBAAoB,CAAC,EAAgB;IAC5C,MAAM,EAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IAC9C,IAAI,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,qBAAqB,IAAI,IAAA,2BAAoB,EAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1F,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,6CAA6C,aAAa,GAAG,CAAC,CAAA;IACjF,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,EAAgB;IACtC,MAAM,EAAC,MAAM,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IACzB,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;QAC1E,IAAA,sBAAe,EAAC,EAAE,EAAE,uCAAuC,CAAC,CAAA;IAC9D,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,EAAgB;IACrC,MAAM,KAAK,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACzC,IAAI,KAAK;QAAE,EAAE,CAAC,MAAM,GAAG,IAAA,oBAAU,EAAC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AAC1E,CAAC;AAED,SAAS,gBAAgB,CAAC,EAAgB;IACxC,IAAI,EAAE,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;AAC9F,CAAC;AAED,SAAS,cAAc,CAAC,EAAC,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAe;IACjF,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAA;IAC3B,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC3B,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,IAAI,eAAe,GAAG,GAAG,CAAC,CAAA;IAC3C,CAAC;SAAM,IAAI,OAAO,IAAI,CAAC,QAAQ,IAAI,UAAU,EAAE,CAAC;QAC9C,MAAM,UAAU,GAAG,IAAA,aAAG,EAAA,GAAG,aAAa,WAAW,CAAA;QACjD,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE,EAAC,GAAG,EAAE,SAAS,CAAC,IAAI,EAAC,CAAC,CAAA;QAC9D,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,IAAI,kBAAkB,GAAG,KAAK,UAAU,KAAK,QAAQ,UAAU,CAAC,CAAA;IACjF,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,EAAa;IAClC,MAAM,EAAC,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IAChE,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;QACrB,0BAA0B;QAC1B,GAAG,CAAC,EAAE,CACJ,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,MAAM,QAAQ,EACpB,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,IAAI,CAAC,EACxB,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAA,WAAC,EAAA,OAAO,eAAuB,IAAI,eAAC,CAAC,OAAO,GAAG,CAAC,CACjE,CAAA;IACH,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,YAAY,SAAS,EAAE,eAAC,CAAC,OAAO,CAAC,CAAA;QAChD,IAAI,IAAI,CAAC,WAAW;YAAE,eAAe,CAAC,EAAE,CAAC,CAAA;QACzC,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,MAAM,QAAQ,CAAC,CAAA;IAClC,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,EAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAY;IAChE,IAAI,KAAK,YAAY,cAAI;QAAE,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,SAAS,QAAQ,EAAE,KAAK,CAAC,CAAA;IACnE,IAAI,KAAK,YAAY,cAAI;QAAE,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,SAAS,QAAQ,EAAE,KAAK,CAAC,CAAA;AACrE,CAAC;AAED,SAAS,cAAc,CACrB,EAAgB,EAChB,KAAiB,EACjB,UAAmB,EACnB,SAAgB;IAEhB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IACrD,MAAM,EAAC,KAAK,EAAC,GAAG,IAAI,CAAA;IACpB,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,CAAC,IAAA,2BAAoB,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;QACxF,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,MAAM,EAAG,KAAK,CAAC,GAAG,CAAC,IAAa,CAAC,UAAU,CAAC,CAAC,CAAA,CAAC,gBAAgB;QAC9F,OAAM;IACR,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,GAAG;QAAE,gBAAgB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;IAC1C,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE;QACb,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,KAAK;YAAE,aAAa,CAAC,KAAK,CAAC,CAAA;QACrD,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC,CAAC,CAAA;IAEF,SAAS,aAAa,CAAC,KAAgB;QACrC,IAAI,CAAC,IAAA,8BAAc,EAAC,MAAM,EAAE,KAAK,CAAC;YAAE,OAAM;QAC1C,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YACf,GAAG,CAAC,EAAE,CAAC,IAAA,wBAAa,EAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAA;YAC3D,eAAe,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;YAC1B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,IAAI,IAAI,UAAU,EAAE,CAAC;gBAChE,GAAG,CAAC,IAAI,EAAE,CAAA;gBACV,IAAA,0BAAe,EAAC,EAAE,CAAC,CAAA;YACrB,CAAC;YACD,GAAG,CAAC,KAAK,EAAE,CAAA;QACb,CAAC;aAAM,CAAC;YACN,eAAe,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;QAC5B,CAAC;QACD,0BAA0B;QAC1B,IAAI,CAAC,SAAS;YAAE,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,MAAM,QAAQ,SAAS,IAAI,CAAC,EAAE,CAAC,CAAA;IAC9D,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,EAAgB,EAAE,KAAgB;IACzD,MAAM,EACJ,GAAG,EACH,MAAM,EACN,IAAI,EAAE,EAAC,WAAW,EAAC,GACpB,GAAG,EAAE,CAAA;IACN,IAAI,WAAW;QAAE,IAAA,yBAAc,EAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;IAC/C,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE;QACb,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAC/B,IAAI,IAAA,6BAAa,EAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;gBAChC,WAAW,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;YAC5D,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,EAAgB,EAAE,KAAiB;IAC3D,IAAI,EAAE,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW;QAAE,OAAM;IACrD,iBAAiB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;IAC5B,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,eAAe;QAAE,kBAAkB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;IAC3D,iBAAiB,CAAC,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,CAAA;AACrC,CAAC;AAED,SAAS,iBAAiB,CAAC,EAAgB,EAAE,KAAiB;IAC5D,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAM;IACzB,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;QACzB,EAAE,CAAC,SAAS,GAAG,KAAK,CAAA;QACpB,OAAM;IACR,CAAC;IACD,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QAClB,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;YACnC,gBAAgB,CAAC,EAAE,EAAE,SAAS,CAAC,6BAA6B,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACxF,CAAC;IACH,CAAC,CAAC,CAAA;IACF,iBAAiB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;AAC9B,CAAC;AAED,SAAS,kBAAkB,CAAC,EAAgB,EAAE,EAAc;IAC1D,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;QAC/D,gBAAgB,CAAC,EAAE,EAAE,iDAAiD,CAAC,CAAA;IACzE,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,EAAgB,EAAE,EAAc;IACzD,MAAM,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAA;IAC/B,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,CAAA;QAC3B,IAAI,OAAO,IAAI,IAAI,QAAQ,IAAI,IAAA,6BAAa,EAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;YAC9D,MAAM,EAAC,IAAI,EAAC,GAAG,IAAI,CAAC,UAAU,CAAA;YAC9B,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC/D,gBAAgB,CAAC,EAAE,EAAE,iBAAiB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,kBAAkB,OAAO,GAAG,CAAC,CAAA;YACnF,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAiB,EAAE,IAAc;IAC1D,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAA;AACjF,CAAC;AAED,SAAS,YAAY,CAAC,EAAc,EAAE,CAAW;IAC/C,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,SAAS,IAAI,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAA;AACrE,CAAC;AAED,SAAS,iBAAiB,CAAC,EAAgB,EAAE,SAAqB;IAChE,MAAM,EAAE,GAAe,EAAE,CAAA;IACzB,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC;QAC7B,IAAI,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC;YAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;aACrC,IAAI,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,QAAQ;YAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAC9E,CAAC;IACD,EAAE,CAAC,SAAS,GAAG,EAAE,CAAA;AACnB,CAAC;AAED,SAAS,gBAAgB,CAAC,EAAgB,EAAE,GAAW;IACrD,MAAM,UAAU,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,GAAG,EAAE,CAAC,aAAa,CAAA;IACzD,GAAG,IAAI,QAAQ,UAAU,iBAAiB,CAAA;IAC1C,IAAA,sBAAe,EAAC,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;AAC/C,CAAC;AAED,MAAa,UAAU;IAiBrB,YAAY,EAAgB,EAAE,GAA2B,EAAE,OAAe;QACxE,IAAA,8BAAoB,EAAC,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,CAAA;QACtC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,CAAA;QACjB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,CAAA;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAA;QACnB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAChC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAA;QAC3E,IAAI,CAAC,WAAW,GAAG,IAAA,qBAAc,EAAC,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;QACvE,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAA;QAChC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC,MAAM,CAAA;QAC7B,IAAI,CAAC,MAAM,GAAG,EAAE,CAAA;QAChB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QAEd,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAA;QACpE,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAA;YAClC,IAAI,CAAC,IAAA,yBAAe,EAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;gBACtE,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,kBAAkB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;YAC/E,CAAC;QACH,CAAC;QAED,IAAI,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;YAC3D,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,eAAC,CAAC,MAAM,CAAC,CAAA;QAClD,CAAC;IACH,CAAC;IAED,MAAM,CAAC,SAAe,EAAE,aAA0B,EAAE,UAAuB;QACzE,IAAI,CAAC,UAAU,CAAC,IAAA,aAAG,EAAC,SAAS,CAAC,EAAE,aAAa,EAAE,UAAU,CAAC,CAAA;IAC5D,CAAC;IAED,UAAU,CAAC,SAAe,EAAE,aAA0B,EAAE,UAAuB;QAC7E,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,CAAA;QACtB,IAAI,UAAU;YAAE,UAAU,EAAE,CAAA;;YACvB,IAAI,CAAC,KAAK,EAAE,CAAA;QACjB,IAAI,aAAa,EAAE,CAAC;YAClB,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;YACf,aAAa,EAAE,CAAA;YACf,IAAI,IAAI,CAAC,SAAS;gBAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAA;QACtC,CAAC;aAAM,CAAC;YACN,IAAI,IAAI,CAAC,SAAS;gBAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAA;;gBAC/B,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;QACtB,CAAC;IACH,CAAC;IAED,IAAI,CAAC,SAAe,EAAE,UAAuB;QAC3C,IAAI,CAAC,UAAU,CAAC,IAAA,aAAG,EAAC,SAAS,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAA;IACxD,CAAC;IAED,IAAI,CAAC,SAAgB;QACnB,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,IAAI,CAAC,KAAK,EAAE,CAAA;YACZ,IAAI,CAAC,IAAI,CAAC,SAAS;gBAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA,CAAC,8CAA8C;YACtF,OAAM;QACR,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,CAAA;QACtB,IAAI,CAAC,KAAK,EAAE,CAAA;QACZ,IAAI,IAAI,CAAC,SAAS;YAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAA;;YAC/B,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;IACtB,CAAC;IAED,SAAS,CAAC,SAAe;QACvB,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAC5C,MAAM,EAAC,UAAU,EAAC,GAAG,IAAI,CAAA;QACzB,IAAI,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,UAAU,sBAAsB,IAAA,YAAE,EAAC,IAAI,CAAC,YAAY,EAAE,EAAE,SAAS,CAAC,GAAG,CAAC,CAAA;IACtF,CAAC;IAED,KAAK,CAAC,MAAgB,EAAE,WAA8B,EAAE,UAAuB;QAC7E,IAAI,WAAW,EAAE,CAAC;YAChB,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;YAC3B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;YAC/B,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;YAClB,OAAM;QACR,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACjC,CAAC;IAEO,MAAM,CAAC,MAAgB,EAAE,UAAuB;QACtD,CAAC;QAAA,CAAC,MAAM,CAAC,CAAC,CAAC,yBAAgB,CAAC,CAAC,CAAC,oBAAW,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;IAC9E,CAAC;IAED,UAAU;QACR,IAAA,oBAAW,EAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,IAAI,0BAAiB,CAAC,CAAA;IAC7D,CAAC;IAED,KAAK;QACH,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAA;QAC5F,IAAA,yBAAgB,EAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;IAC5C,CAAC;IAED,EAAE,CAAC,IAAoB;QACrB,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;IACxC,CAAC;IAED,SAAS,CAAC,GAAqB,EAAE,MAAa;QAC5C,IAAI,MAAM;YAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;;YACtC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAA;IACxB,CAAC;IAED,UAAU,CAAC,KAAW,EAAE,SAAqB,EAAE,aAAmB,aAAG;QACnE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE;YAClB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;YAClC,SAAS,EAAE,CAAA;QACb,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,UAAU,CAAC,QAAc,aAAG,EAAE,aAAmB,aAAG;QAClD,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAM;QACvB,MAAM,EAAC,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAC,GAAG,IAAI,CAAA;QAC/C,GAAG,CAAC,EAAE,CAAC,IAAA,YAAE,EAAC,IAAA,WAAC,EAAA,GAAG,UAAU,gBAAgB,EAAE,UAAU,CAAC,CAAC,CAAA;QACtD,IAAI,KAAK,KAAK,aAAG;YAAE,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QAC1C,IAAI,UAAU,CAAC,MAAM,IAAI,GAAG,CAAC,cAAc,EAAE,CAAC;YAC5C,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAA;YAC/B,IAAI,CAAC,UAAU,EAAE,CAAA;YACjB,IAAI,KAAK,KAAK,aAAG;gBAAE,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;QAC7C,CAAC;QACD,GAAG,CAAC,IAAI,EAAE,CAAA;IACZ,CAAC;IAED,YAAY;QACV,MAAM,EAAC,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE,EAAC,GAAG,IAAI,CAAA;QACnD,OAAO,IAAA,YAAE,EAAC,cAAc,EAAE,EAAE,kBAAkB,EAAE,CAAC,CAAA;QAEjD,SAAS,cAAc;YACrB,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;gBACtB,wBAAwB;gBACxB,IAAI,CAAC,CAAC,UAAU,YAAY,cAAI,CAAC;oBAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;gBAC9E,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;gBAChE,OAAO,IAAA,WAAC,EAAA,GAAG,IAAA,yBAAc,EAAC,EAAE,EAAE,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,mBAAQ,CAAC,KAAK,CAAC,EAAE,CAAA;YACpF,CAAC;YACD,OAAO,aAAG,CAAA;QACZ,CAAC;QAED,SAAS,kBAAkB;YACzB,IAAI,GAAG,CAAC,cAAc,EAAE,CAAC;gBACvB,MAAM,iBAAiB,GAAG,GAAG,CAAC,UAAU,CAAC,eAAe,EAAE,EAAC,GAAG,EAAE,GAAG,CAAC,cAAc,EAAC,CAAC,CAAA,CAAC,iCAAiC;gBACtH,OAAO,IAAA,WAAC,EAAA,IAAI,iBAAiB,IAAI,UAAU,GAAG,CAAA;YAChD,CAAC;YACD,OAAO,aAAG,CAAA;QACZ,CAAC;IACH,CAAC;IAED,SAAS,CAAC,IAAmB,EAAE,KAAW;QACxC,MAAM,SAAS,GAAG,IAAA,wBAAY,EAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;QAC7C,IAAA,+BAAmB,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;QAC7C,IAAA,+BAAmB,EAAC,SAAS,EAAE,IAAI,CAAC,CAAA;QACpC,MAAM,WAAW,GAAG,EAAC,GAAG,IAAI,CAAC,EAAE,EAAE,GAAG,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAC,CAAA;QAClF,aAAa,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;QACjC,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,cAAc,CAAC,SAAoB,EAAE,MAAoB;QACvD,MAAM,EAAC,EAAE,EAAE,GAAG,EAAC,GAAG,IAAI,CAAA;QACtB,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW;YAAE,OAAM;QAChC,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,SAAS,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YACvD,EAAE,CAAC,KAAK,GAAG,qBAAc,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QACzE,CAAC;QACD,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,SAAS,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YACvD,EAAE,CAAC,KAAK,GAAG,qBAAc,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QACzE,CAAC;IACH,CAAC;IAED,mBAAmB,CAAC,SAAoB,EAAE,KAAW;QACnD,MAAM,EAAC,EAAE,EAAE,GAAG,EAAC,GAAG,IAAI,CAAA;QACtB,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,EAAE,CAAC;YACpE,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,cAAI,CAAC,CAAC,CAAA;YACzD,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;CACF;AA5LD,gCA4LC;AAED,SAAS,WAAW,CAClB,EAAgB,EAChB,OAAe,EACf,GAA2B,EAC3B,QAAmB;IAEnB,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,CAAA;IAC5C,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;QAClB,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IACzB,CAAC;SAAM,IAAI,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;QACrC,IAAA,yBAAe,EAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC3B,CAAC;SAAM,IAAI,OAAO,IAAI,GAAG,EAAE,CAAC;QAC1B,IAAA,0BAAgB,EAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC5B,CAAC;SAAM,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;QACvC,IAAA,yBAAe,EAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC3B,CAAC;AACH,CAAC;AAED,MAAM,YAAY,GAAG,qBAAqB,CAAA;AAC1C,MAAM,qBAAqB,GAAG,kCAAkC,CAAA;AAChE,SAAgB,OAAO,CACrB,KAAa,EACb,EAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAY;IAE9C,IAAI,WAAW,CAAA;IACf,IAAI,IAAU,CAAA;IACd,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,eAAC,CAAC,QAAQ,CAAA;IACnC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,KAAK,EAAE,CAAC,CAAA;QAChF,WAAW,GAAG,KAAK,CAAA;QACnB,IAAI,GAAG,eAAC,CAAC,QAAQ,CAAA;IACnB,CAAC;SAAM,CAAC;QACN,MAAM,OAAO,GAAG,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACjD,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,KAAK,EAAE,CAAC,CAAA;QAC/D,MAAM,EAAE,GAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;QAC9B,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;QACxB,IAAI,WAAW,KAAK,GAAG,EAAE,CAAC;YACxB,IAAI,EAAE,IAAI,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC,CAAA;YACpE,OAAO,WAAW,CAAC,SAAS,GAAG,EAAE,CAAC,CAAA;QACpC,CAAC;QACD,IAAI,EAAE,GAAG,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAA;QACzD,IAAI,GAAG,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC,CAAA;QAChC,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAA;IAC/B,CAAC;IAED,IAAI,IAAI,GAAG,IAAI,CAAA;IACf,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACvC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,GAAG,IAAA,qBAAW,EAAC,IAAA,0BAAmB,EAAC,OAAO,CAAC,CAAC,EAAE,CAAA;YAC7D,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,OAAO,IAAI,EAAE,CAAA;QAC9B,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAA;IAEX,SAAS,QAAQ,CAAC,WAAmB,EAAE,EAAU;QAC/C,OAAO,iBAAiB,WAAW,IAAI,EAAE,gCAAgC,SAAS,EAAE,CAAA;IACtF,CAAC;AACH,CAAC;AAtCD,0BAsCC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/validate/keyword.d.ts b/node_modules/ajv/dist/compile/validate/keyword.d.ts deleted file mode 100644 index d15cee8..0000000 --- a/node_modules/ajv/dist/compile/validate/keyword.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { KeywordCxt } from "."; -import type { AddedKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition } from "../../types"; -import type { SchemaObjCxt } from ".."; -import type { JSONType } from "../rules"; -export declare function macroKeywordCode(cxt: KeywordCxt, def: MacroKeywordDefinition): void; -export declare function funcKeywordCode(cxt: KeywordCxt, def: FuncKeywordDefinition): void; -export declare function validSchemaType(schema: unknown, schemaType: JSONType[], allowUndefined?: boolean): boolean; -export declare function validateKeywordUsage({ schema, opts, self, errSchemaPath }: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string): void; diff --git a/node_modules/ajv/dist/compile/validate/keyword.js b/node_modules/ajv/dist/compile/validate/keyword.js deleted file mode 100644 index 1109d3a..0000000 --- a/node_modules/ajv/dist/compile/validate/keyword.js +++ /dev/null @@ -1,124 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.validateKeywordUsage = exports.validSchemaType = exports.funcKeywordCode = exports.macroKeywordCode = void 0; -const codegen_1 = require("../codegen"); -const names_1 = require("../names"); -const code_1 = require("../../vocabularies/code"); -const errors_1 = require("../errors"); -function macroKeywordCode(cxt, def) { - const { gen, keyword, schema, parentSchema, it } = cxt; - const macroSchema = def.macro.call(it.self, schema, parentSchema, it); - const schemaRef = useKeyword(gen, keyword, macroSchema); - if (it.opts.validateSchema !== false) - it.self.validateSchema(macroSchema, true); - const valid = gen.name("valid"); - cxt.subschema({ - schema: macroSchema, - schemaPath: codegen_1.nil, - errSchemaPath: `${it.errSchemaPath}/${keyword}`, - topSchemaRef: schemaRef, - compositeRule: true, - }, valid); - cxt.pass(valid, () => cxt.error(true)); -} -exports.macroKeywordCode = macroKeywordCode; -function funcKeywordCode(cxt, def) { - var _a; - const { gen, keyword, schema, parentSchema, $data, it } = cxt; - checkAsyncKeyword(it, def); - const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate; - const validateRef = useKeyword(gen, keyword, validate); - const valid = gen.let("valid"); - cxt.block$data(valid, validateKeyword); - cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid); - function validateKeyword() { - if (def.errors === false) { - assignValid(); - if (def.modifying) - modifyData(cxt); - reportErrs(() => cxt.error()); - } - else { - const ruleErrs = def.async ? validateAsync() : validateSync(); - if (def.modifying) - modifyData(cxt); - reportErrs(() => addErrs(cxt, ruleErrs)); - } - } - function validateAsync() { - const ruleErrs = gen.let("ruleErrs", null); - gen.try(() => assignValid((0, codegen_1._) `await `), (e) => gen.assign(valid, false).if((0, codegen_1._) `${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_1._) `${e}.errors`), () => gen.throw(e))); - return ruleErrs; - } - function validateSync() { - const validateErrs = (0, codegen_1._) `${validateRef}.errors`; - gen.assign(validateErrs, null); - assignValid(codegen_1.nil); - return validateErrs; - } - function assignValid(_await = def.async ? (0, codegen_1._) `await ` : codegen_1.nil) { - const passCxt = it.opts.passContext ? names_1.default.this : names_1.default.self; - const passSchema = !(("compile" in def && !$data) || def.schema === false); - gen.assign(valid, (0, codegen_1._) `${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying); - } - function reportErrs(errors) { - var _a; - gen.if((0, codegen_1.not)((_a = def.valid) !== null && _a !== void 0 ? _a : valid), errors); - } -} -exports.funcKeywordCode = funcKeywordCode; -function modifyData(cxt) { - const { gen, data, it } = cxt; - gen.if(it.parentData, () => gen.assign(data, (0, codegen_1._) `${it.parentData}[${it.parentDataProperty}]`)); -} -function addErrs(cxt, errs) { - const { gen } = cxt; - gen.if((0, codegen_1._) `Array.isArray(${errs})`, () => { - gen - .assign(names_1.default.vErrors, (0, codegen_1._) `${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`) - .assign(names_1.default.errors, (0, codegen_1._) `${names_1.default.vErrors}.length`); - (0, errors_1.extendErrors)(cxt); - }, () => cxt.error()); -} -function checkAsyncKeyword({ schemaEnv }, def) { - if (def.async && !schemaEnv.$async) - throw new Error("async keyword in sync schema"); -} -function useKeyword(gen, keyword, result) { - if (result === undefined) - throw new Error(`keyword "${keyword}" failed to compile`); - return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_1.stringify)(result) }); -} -function validSchemaType(schema, schemaType, allowUndefined = false) { - // TODO add tests - return (!schemaType.length || - schemaType.some((st) => st === "array" - ? Array.isArray(schema) - : st === "object" - ? schema && typeof schema == "object" && !Array.isArray(schema) - : typeof schema == st || (allowUndefined && typeof schema == "undefined"))); -} -exports.validSchemaType = validSchemaType; -function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def, keyword) { - /* istanbul ignore if */ - if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) { - throw new Error("ajv implementation error"); - } - const deps = def.dependencies; - if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) { - throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`); - } - if (def.validateSchema) { - const valid = def.validateSchema(schema[keyword]); - if (!valid) { - const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + - self.errorsText(def.validateSchema.errors); - if (opts.validateSchema === "log") - self.logger.error(msg); - else - throw new Error(msg); - } - } -} -exports.validateKeywordUsage = validateKeywordUsage; -//# sourceMappingURL=keyword.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/validate/keyword.js.map b/node_modules/ajv/dist/compile/validate/keyword.js.map deleted file mode 100644 index ad1d1b9..0000000 --- a/node_modules/ajv/dist/compile/validate/keyword.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keyword.js","sourceRoot":"","sources":["../../../lib/compile/validate/keyword.ts"],"names":[],"mappings":";;;AAUA,wCAAsE;AACtE,oCAAwB;AAExB,kDAAwD;AACxD,sCAAsC;AAItC,SAAgB,gBAAgB,CAAC,GAAe,EAAE,GAA2B;IAC3E,MAAM,EAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IACpD,MAAM,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,CAAC,CAAA;IACrE,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,CAAC,CAAA;IACvD,IAAI,EAAE,CAAC,IAAI,CAAC,cAAc,KAAK,KAAK;QAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;IAE/E,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/B,GAAG,CAAC,SAAS,CACX;QACE,MAAM,EAAE,WAAW;QACnB,UAAU,EAAE,aAAG;QACf,aAAa,EAAE,GAAG,EAAE,CAAC,aAAa,IAAI,OAAO,EAAE;QAC/C,YAAY,EAAE,SAAS;QACvB,aAAa,EAAE,IAAI;KACpB,EACD,KAAK,CACN,CAAA;IACD,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;AACxC,CAAC;AAlBD,4CAkBC;AAED,SAAgB,eAAe,CAAC,GAAe,EAAE,GAA0B;;IACzE,MAAM,EAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAC3D,iBAAiB,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA;IAC1B,MAAM,QAAQ,GACZ,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAA;IAC5F,MAAM,WAAW,GAAG,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;IACtD,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IAC9B,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,eAAe,CAAC,CAAA;IACtC,GAAG,CAAC,EAAE,CAAC,MAAA,GAAG,CAAC,KAAK,mCAAI,KAAK,CAAC,CAAA;IAE1B,SAAS,eAAe;QACtB,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;YACzB,WAAW,EAAE,CAAA;YACb,IAAI,GAAG,CAAC,SAAS;gBAAE,UAAU,CAAC,GAAG,CAAC,CAAA;YAClC,UAAU,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;QAC/B,CAAC;aAAM,CAAC;YACN,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,YAAY,EAAE,CAAA;YAC7D,IAAI,GAAG,CAAC,SAAS;gBAAE,UAAU,CAAC,GAAG,CAAC,CAAA;YAClC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAA;QAC1C,CAAC;IACH,CAAC;IAED,SAAS,aAAa;QACpB,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;QAC1C,GAAG,CAAC,GAAG,CACL,GAAG,EAAE,CAAC,WAAW,CAAC,IAAA,WAAC,EAAA,QAAQ,CAAC,EAC5B,CAAC,CAAC,EAAE,EAAE,CACJ,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CACzB,IAAA,WAAC,EAAA,GAAG,CAAC,eAAe,EAAE,CAAC,eAAuB,EAAE,EAChD,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAA,WAAC,EAAA,GAAG,CAAC,SAAS,CAAC,EAC1C,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CACnB,CACJ,CAAA;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,SAAS,YAAY;QACnB,MAAM,YAAY,GAAG,IAAA,WAAC,EAAA,GAAG,WAAW,SAAS,CAAA;QAC7C,GAAG,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;QAC9B,WAAW,CAAC,aAAG,CAAC,CAAA;QAChB,OAAO,YAAY,CAAA;IACrB,CAAC;IAED,SAAS,WAAW,CAAC,SAAe,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,QAAQ,CAAC,CAAC,CAAC,aAAG;QAC7D,MAAM,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,eAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAC,CAAC,IAAI,CAAA;QACrD,MAAM,UAAU,GAAG,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,CAAC,CAAA;QAC1E,GAAG,CAAC,MAAM,CACR,KAAK,EACL,IAAA,WAAC,EAAA,GAAG,MAAM,GAAG,IAAA,uBAAgB,EAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,EACtE,GAAG,CAAC,SAAS,CACd,CAAA;IACH,CAAC;IAED,SAAS,UAAU,CAAC,MAAkB;;QACpC,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,MAAA,GAAG,CAAC,KAAK,mCAAI,KAAK,CAAC,EAAE,MAAM,CAAC,CAAA;IACzC,CAAC;AACH,CAAC;AAxDD,0CAwDC;AAED,SAAS,UAAU,CAAC,GAAe;IACjC,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAC3B,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,GAAG,EAAE,CAAC,UAAU,IAAI,EAAE,CAAC,kBAAkB,GAAG,CAAC,CAAC,CAAA;AAC9F,CAAC;AAED,SAAS,OAAO,CAAC,GAAe,EAAE,IAAU;IAC1C,MAAM,EAAC,GAAG,EAAC,GAAG,GAAG,CAAA;IACjB,GAAG,CAAC,EAAE,CACJ,IAAA,WAAC,EAAA,iBAAiB,IAAI,GAAG,EACzB,GAAG,EAAE;QACH,GAAG;aACA,MAAM,CAAC,eAAC,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,OAAO,eAAe,IAAI,MAAM,eAAC,CAAC,OAAO,WAAW,IAAI,GAAG,CAAC;aACpF,MAAM,CAAC,eAAC,CAAC,MAAM,EAAE,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,OAAO,SAAS,CAAC,CAAA;QAC3C,IAAA,qBAAY,EAAC,GAAG,CAAC,CAAA;IACnB,CAAC,EACD,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAClB,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,EAAC,SAAS,EAAe,EAAE,GAA0B;IAC9E,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;AACrF,CAAC;AAED,SAAS,UAAU,CAAC,GAAY,EAAE,OAAe,EAAE,MAAiC;IAClF,IAAI,MAAM,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,YAAY,OAAO,qBAAqB,CAAC,CAAA;IACnF,OAAO,GAAG,CAAC,UAAU,CACnB,SAAS,EACT,OAAO,MAAM,IAAI,UAAU,CAAC,CAAC,CAAC,EAAC,GAAG,EAAE,MAAM,EAAC,CAAC,CAAC,CAAC,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAA,mBAAS,EAAC,MAAM,CAAC,EAAC,CACrF,CAAA;AACH,CAAC;AAED,SAAgB,eAAe,CAC7B,MAAe,EACf,UAAsB,EACtB,cAAc,GAAG,KAAK;IAEtB,iBAAiB;IACjB,OAAO,CACL,CAAC,UAAU,CAAC,MAAM;QAClB,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CACrB,EAAE,KAAK,OAAO;YACZ,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YACvB,CAAC,CAAC,EAAE,KAAK,QAAQ;gBACjB,CAAC,CAAC,MAAM,IAAI,OAAO,MAAM,IAAI,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;gBAC/D,CAAC,CAAC,OAAO,MAAM,IAAI,EAAE,IAAI,CAAC,cAAc,IAAI,OAAO,MAAM,IAAI,WAAW,CAAC,CAC5E,CACF,CAAA;AACH,CAAC;AAhBD,0CAgBC;AAED,SAAgB,oBAAoB,CAClC,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,EAAe,EACjD,GAA2B,EAC3B,OAAe;IAEf,wBAAwB;IACxB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAC1F,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;IAC7C,CAAC;IAED,MAAM,IAAI,GAAG,GAAG,CAAC,YAAY,CAAA;IAC7B,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;QAC5E,MAAM,IAAI,KAAK,CAAC,2CAA2C,OAAO,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC1F,CAAC;IAED,IAAI,GAAG,CAAC,cAAc,EAAE,CAAC;QACvB,MAAM,KAAK,GAAG,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;QACjD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,GAAG,GACP,YAAY,OAAO,+BAA+B,aAAa,KAAK;gBACpE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;YAC5C,IAAI,IAAI,CAAC,cAAc,KAAK,KAAK;gBAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;;gBACpD,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;QAC3B,CAAC;IACH,CAAC;AACH,CAAC;AAzBD,oDAyBC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/validate/subschema.d.ts b/node_modules/ajv/dist/compile/validate/subschema.d.ts deleted file mode 100644 index b92785f..0000000 --- a/node_modules/ajv/dist/compile/validate/subschema.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -import type { AnySchema } from "../../types"; -import type { SchemaObjCxt } from ".."; -import { Code, Name } from "../codegen"; -import { Type } from "../util"; -import type { JSONType } from "../rules"; -export interface SubschemaContext { - schema: AnySchema; - schemaPath: Code; - errSchemaPath: string; - topSchemaRef?: Code; - errorPath?: Code; - dataLevel?: number; - dataTypes?: JSONType[]; - data?: Name; - parentData?: Name; - parentDataProperty?: Code | number; - dataNames?: Name[]; - dataPathArr?: (Code | number)[]; - propertyName?: Name; - jtdDiscriminator?: string; - jtdMetadata?: boolean; - compositeRule?: true; - createErrors?: boolean; - allErrors?: boolean; -} -export type SubschemaArgs = Partial<{ - keyword: string; - schemaProp: string | number; - schema: AnySchema; - schemaPath: Code; - errSchemaPath: string; - topSchemaRef: Code; - data: Name | Code; - dataProp: Code | string | number; - dataTypes: JSONType[]; - definedProperties: Set; - propertyName: Name; - dataPropType: Type; - jtdDiscriminator: string; - jtdMetadata: boolean; - compositeRule: true; - createErrors: boolean; - allErrors: boolean; -}>; -export declare function getSubschema(it: SchemaObjCxt, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }: SubschemaArgs): SubschemaContext; -export declare function extendSubschemaData(subschema: SubschemaContext, it: SchemaObjCxt, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }: SubschemaArgs): void; -export declare function extendSubschemaMode(subschema: SubschemaContext, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }: SubschemaArgs): void; diff --git a/node_modules/ajv/dist/compile/validate/subschema.js b/node_modules/ajv/dist/compile/validate/subschema.js deleted file mode 100644 index 9de2828..0000000 --- a/node_modules/ajv/dist/compile/validate/subschema.js +++ /dev/null @@ -1,81 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.extendSubschemaMode = exports.extendSubschemaData = exports.getSubschema = void 0; -const codegen_1 = require("../codegen"); -const util_1 = require("../util"); -function getSubschema(it, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) { - if (keyword !== undefined && schema !== undefined) { - throw new Error('both "keyword" and "schema" passed, only one allowed'); - } - if (keyword !== undefined) { - const sch = it.schema[keyword]; - return schemaProp === undefined - ? { - schema: sch, - schemaPath: (0, codegen_1._) `${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}`, - errSchemaPath: `${it.errSchemaPath}/${keyword}`, - } - : { - schema: sch[schemaProp], - schemaPath: (0, codegen_1._) `${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}${(0, codegen_1.getProperty)(schemaProp)}`, - errSchemaPath: `${it.errSchemaPath}/${keyword}/${(0, util_1.escapeFragment)(schemaProp)}`, - }; - } - if (schema !== undefined) { - if (schemaPath === undefined || errSchemaPath === undefined || topSchemaRef === undefined) { - throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"'); - } - return { - schema, - schemaPath, - topSchemaRef, - errSchemaPath, - }; - } - throw new Error('either "keyword" or "schema" must be passed'); -} -exports.getSubschema = getSubschema; -function extendSubschemaData(subschema, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) { - if (data !== undefined && dataProp !== undefined) { - throw new Error('both "data" and "dataProp" passed, only one allowed'); - } - const { gen } = it; - if (dataProp !== undefined) { - const { errorPath, dataPathArr, opts } = it; - const nextData = gen.let("data", (0, codegen_1._) `${it.data}${(0, codegen_1.getProperty)(dataProp)}`, true); - dataContextProps(nextData); - subschema.errorPath = (0, codegen_1.str) `${errorPath}${(0, util_1.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`; - subschema.parentDataProperty = (0, codegen_1._) `${dataProp}`; - subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty]; - } - if (data !== undefined) { - const nextData = data instanceof codegen_1.Name ? data : gen.let("data", data, true); // replaceable if used once? - dataContextProps(nextData); - if (propertyName !== undefined) - subschema.propertyName = propertyName; - // TODO something is possibly wrong here with not changing parentDataProperty and not appending dataPathArr - } - if (dataTypes) - subschema.dataTypes = dataTypes; - function dataContextProps(_nextData) { - subschema.data = _nextData; - subschema.dataLevel = it.dataLevel + 1; - subschema.dataTypes = []; - it.definedProperties = new Set(); - subschema.parentData = it.data; - subschema.dataNames = [...it.dataNames, _nextData]; - } -} -exports.extendSubschemaData = extendSubschemaData; -function extendSubschemaMode(subschema, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) { - if (compositeRule !== undefined) - subschema.compositeRule = compositeRule; - if (createErrors !== undefined) - subschema.createErrors = createErrors; - if (allErrors !== undefined) - subschema.allErrors = allErrors; - subschema.jtdDiscriminator = jtdDiscriminator; // not inherited - subschema.jtdMetadata = jtdMetadata; // not inherited -} -exports.extendSubschemaMode = extendSubschemaMode; -//# sourceMappingURL=subschema.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/compile/validate/subschema.js.map b/node_modules/ajv/dist/compile/validate/subschema.js.map deleted file mode 100644 index e4f903f..0000000 --- a/node_modules/ajv/dist/compile/validate/subschema.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subschema.js","sourceRoot":"","sources":["../../../lib/compile/validate/subschema.ts"],"names":[],"mappings":";;;AAEA,wCAA0D;AAC1D,kCAA0D;AA6C1D,SAAgB,YAAY,CAC1B,EAAgB,EAChB,EAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAgB;IAErF,IAAI,OAAO,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACzE,CAAC;IAED,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAC9B,OAAO,UAAU,KAAK,SAAS;YAC7B,CAAC,CAAC;gBACE,MAAM,EAAE,GAAG;gBACX,UAAU,EAAE,IAAA,WAAC,EAAA,GAAG,EAAE,CAAC,UAAU,GAAG,IAAA,qBAAW,EAAC,OAAO,CAAC,EAAE;gBACtD,aAAa,EAAE,GAAG,EAAE,CAAC,aAAa,IAAI,OAAO,EAAE;aAChD;YACH,CAAC,CAAC;gBACE,MAAM,EAAE,GAAG,CAAC,UAAU,CAAC;gBACvB,UAAU,EAAE,IAAA,WAAC,EAAA,GAAG,EAAE,CAAC,UAAU,GAAG,IAAA,qBAAW,EAAC,OAAO,CAAC,GAAG,IAAA,qBAAW,EAAC,UAAU,CAAC,EAAE;gBAChF,aAAa,EAAE,GAAG,EAAE,CAAC,aAAa,IAAI,OAAO,IAAI,IAAA,qBAAc,EAAC,UAAU,CAAC,EAAE;aAC9E,CAAA;IACP,CAAC;IAED,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,IAAI,UAAU,KAAK,SAAS,IAAI,aAAa,KAAK,SAAS,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC1F,MAAM,IAAI,KAAK,CAAC,6EAA6E,CAAC,CAAA;QAChG,CAAC;QACD,OAAO;YACL,MAAM;YACN,UAAU;YACV,YAAY;YACZ,aAAa;SACd,CAAA;IACH,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;AAChE,CAAC;AApCD,oCAoCC;AAED,SAAgB,mBAAmB,CACjC,SAA2B,EAC3B,EAAgB,EAChB,EAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAgB;IAE9E,IAAI,IAAI,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAA;IACxE,CAAC;IAED,MAAM,EAAC,GAAG,EAAC,GAAG,EAAE,CAAA;IAEhB,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,EAAC,SAAS,EAAE,WAAW,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;QACzC,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,IAAA,WAAC,EAAA,GAAG,EAAE,CAAC,IAAI,GAAG,IAAA,qBAAW,EAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;QAC7E,gBAAgB,CAAC,QAAQ,CAAC,CAAA;QAC1B,SAAS,CAAC,SAAS,GAAG,IAAA,aAAG,EAAA,GAAG,SAAS,GAAG,IAAA,mBAAY,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAA;QAC/F,SAAS,CAAC,kBAAkB,GAAG,IAAA,WAAC,EAAA,GAAG,QAAQ,EAAE,CAAA;QAC7C,SAAS,CAAC,WAAW,GAAG,CAAC,GAAG,WAAW,EAAE,SAAS,CAAC,kBAAkB,CAAC,CAAA;IACxE,CAAC;IAED,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAG,IAAI,YAAY,cAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA,CAAC,4BAA4B;QACvG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;QAC1B,IAAI,YAAY,KAAK,SAAS;YAAE,SAAS,CAAC,YAAY,GAAG,YAAY,CAAA;QACrE,2GAA2G;IAC7G,CAAC;IAED,IAAI,SAAS;QAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAA;IAE9C,SAAS,gBAAgB,CAAC,SAAe;QACvC,SAAS,CAAC,IAAI,GAAG,SAAS,CAAA;QAC1B,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,GAAG,CAAC,CAAA;QACtC,SAAS,CAAC,SAAS,GAAG,EAAE,CAAA;QACxB,EAAE,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAA;QACxC,SAAS,CAAC,UAAU,GAAG,EAAE,CAAC,IAAI,CAAA;QAC9B,SAAS,CAAC,SAAS,GAAG,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;IACpD,CAAC;AACH,CAAC;AArCD,kDAqCC;AAED,SAAgB,mBAAmB,CACjC,SAA2B,EAC3B,EAAC,gBAAgB,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAgB;IAEtF,IAAI,aAAa,KAAK,SAAS;QAAE,SAAS,CAAC,aAAa,GAAG,aAAa,CAAA;IACxE,IAAI,YAAY,KAAK,SAAS;QAAE,SAAS,CAAC,YAAY,GAAG,YAAY,CAAA;IACrE,IAAI,SAAS,KAAK,SAAS;QAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5D,SAAS,CAAC,gBAAgB,GAAG,gBAAgB,CAAA,CAAC,gBAAgB;IAC9D,SAAS,CAAC,WAAW,GAAG,WAAW,CAAA,CAAC,gBAAgB;AACtD,CAAC;AATD,kDASC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/core.d.ts b/node_modules/ajv/dist/core.d.ts deleted file mode 100644 index 4591ed9..0000000 --- a/node_modules/ajv/dist/core.d.ts +++ /dev/null @@ -1,173 +0,0 @@ -export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, AnyValidateFunction, ErrorObject, ErrorNoParams, } from "./types"; -export { SchemaCxt, SchemaObjCxt } from "./compile"; -export interface Plugin { - (ajv: Ajv, options?: Opts): Ajv; - [prop: string]: any; -} -export { KeywordCxt } from "./compile/validate"; -export { DefinedError } from "./vocabularies/errors"; -export { JSONType } from "./compile/rules"; -export { JSONSchemaType } from "./types/json-schema"; -export { JTDSchemaType, SomeJTDSchemaType, JTDDataType } from "./types/jtd-schema"; -export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; -import type { Schema, AnySchema, AnySchemaObject, SchemaObject, AsyncSchema, Vocabulary, KeywordDefinition, AddedKeywordDefinition, AnyValidateFunction, ValidateFunction, AsyncValidateFunction, ErrorObject, Format, AddedFormat, RegExpEngine, UriResolver } from "./types"; -import type { JSONSchemaType } from "./types/json-schema"; -import type { JTDSchemaType, SomeJTDSchemaType, JTDDataType } from "./types/jtd-schema"; -import ValidationError from "./runtime/validation_error"; -import MissingRefError from "./compile/ref_error"; -import { ValidationRules } from "./compile/rules"; -import { SchemaEnv } from "./compile"; -import { Code, ValueScope } from "./compile/codegen"; -export type Options = CurrentOptions & DeprecatedOptions; -export interface CurrentOptions { - strict?: boolean | "log"; - strictSchema?: boolean | "log"; - strictNumbers?: boolean | "log"; - strictTypes?: boolean | "log"; - strictTuples?: boolean | "log"; - strictRequired?: boolean | "log"; - allowMatchingProperties?: boolean; - allowUnionTypes?: boolean; - validateFormats?: boolean; - $data?: boolean; - allErrors?: boolean; - verbose?: boolean; - discriminator?: boolean; - unicodeRegExp?: boolean; - timestamp?: "string" | "date"; - parseDate?: boolean; - allowDate?: boolean; - $comment?: true | ((comment: string, schemaPath?: string, rootSchema?: AnySchemaObject) => unknown); - formats?: { - [Name in string]?: Format; - }; - keywords?: Vocabulary; - schemas?: AnySchema[] | { - [Key in string]?: AnySchema; - }; - logger?: Logger | false; - loadSchema?: (uri: string) => Promise; - removeAdditional?: boolean | "all" | "failing"; - useDefaults?: boolean | "empty"; - coerceTypes?: boolean | "array"; - next?: boolean; - unevaluated?: boolean; - dynamicRef?: boolean; - schemaId?: "id" | "$id"; - jtd?: boolean; - meta?: SchemaObject | boolean; - defaultMeta?: string | AnySchemaObject; - validateSchema?: boolean | "log"; - addUsedSchema?: boolean; - inlineRefs?: boolean | number; - passContext?: boolean; - loopRequired?: number; - loopEnum?: number; - ownProperties?: boolean; - multipleOfPrecision?: number; - int32range?: boolean; - messages?: boolean; - code?: CodeOptions; - uriResolver?: UriResolver; -} -export interface CodeOptions { - es5?: boolean; - esm?: boolean; - lines?: boolean; - optimize?: boolean | number; - formats?: Code; - source?: boolean; - process?: (code: string, schema?: SchemaEnv) => string; - regExp?: RegExpEngine; -} -interface InstanceCodeOptions extends CodeOptions { - regExp: RegExpEngine; - optimize: number; -} -interface DeprecatedOptions { - /** @deprecated */ - ignoreKeywordsWithRef?: boolean; - /** @deprecated */ - jsPropertySyntax?: boolean; - /** @deprecated */ - unicode?: boolean; -} -type RequiredInstanceOptions = { - [K in "strictSchema" | "strictNumbers" | "strictTypes" | "strictTuples" | "strictRequired" | "inlineRefs" | "loopRequired" | "loopEnum" | "meta" | "messages" | "schemaId" | "addUsedSchema" | "validateSchema" | "validateFormats" | "int32range" | "unicodeRegExp" | "uriResolver"]: NonNullable; -} & { - code: InstanceCodeOptions; -}; -export type InstanceOptions = Options & RequiredInstanceOptions; -export interface Logger { - log(...args: unknown[]): unknown; - warn(...args: unknown[]): unknown; - error(...args: unknown[]): unknown; -} -export default class Ajv { - opts: InstanceOptions; - errors?: ErrorObject[] | null; - logger: Logger; - readonly scope: ValueScope; - readonly schemas: { - [Key in string]?: SchemaEnv; - }; - readonly refs: { - [Ref in string]?: SchemaEnv | string; - }; - readonly formats: { - [Name in string]?: AddedFormat; - }; - readonly RULES: ValidationRules; - readonly _compilations: Set; - private readonly _loading; - private readonly _cache; - private readonly _metaOpts; - static ValidationError: typeof ValidationError; - static MissingRefError: typeof MissingRefError; - constructor(opts?: Options); - _addVocabularies(): void; - _addDefaultMetaSchema(): void; - defaultMeta(): string | AnySchemaObject | undefined; - validate(schema: Schema | string, data: unknown): boolean; - validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise; - validate(schema: Schema | JSONSchemaType | string, data: unknown): data is T; - validate(schema: JTDSchemaType, data: unknown): data is T; - validate(schema: T, data: unknown): data is JTDDataType; - validate(schema: AsyncSchema, data: unknown | T): Promise; - validate(schemaKeyRef: AnySchema | string, data: unknown): data is T | Promise; - compile(schema: Schema | JSONSchemaType, _meta?: boolean): ValidateFunction; - compile(schema: JTDSchemaType, _meta?: boolean): ValidateFunction; - compile(schema: T, _meta?: boolean): ValidateFunction>; - compile(schema: AsyncSchema, _meta?: boolean): AsyncValidateFunction; - compile(schema: AnySchema, _meta?: boolean): AnyValidateFunction; - compileAsync(schema: SchemaObject | JSONSchemaType, _meta?: boolean): Promise>; - compileAsync(schema: JTDSchemaType, _meta?: boolean): Promise>; - compileAsync(schema: AsyncSchema, meta?: boolean): Promise>; - compileAsync(schema: AnySchemaObject, meta?: boolean): Promise>; - addSchema(schema: AnySchema | AnySchema[], // If array is passed, `key` will be ignored - key?: string, // Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. - _meta?: boolean, // true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. - _validateSchema?: boolean | "log"): Ajv; - addMetaSchema(schema: AnySchemaObject, key?: string, // schema key - _validateSchema?: boolean | "log"): Ajv; - validateSchema(schema: AnySchema, throwOrLogError?: boolean): boolean | Promise; - getSchema(keyRef: string): AnyValidateFunction | undefined; - removeSchema(schemaKeyRef?: AnySchema | string | RegExp): Ajv; - addVocabulary(definitions: Vocabulary): Ajv; - addKeyword(kwdOrDef: string | KeywordDefinition, def?: KeywordDefinition): Ajv; - getKeyword(keyword: string): AddedKeywordDefinition | boolean; - removeKeyword(keyword: string): Ajv; - addFormat(name: string, format: Format): Ajv; - errorsText(errors?: ErrorObject[] | null | undefined, // optional array of validation errors - { separator, dataVar }?: ErrorsTextOptions): string; - $dataMetaSchema(metaSchema: AnySchemaObject, keywordsJsonPointers: string[]): AnySchemaObject; - private _removeAllSchemas; - _addSchema(schema: AnySchema, meta?: boolean, baseId?: string, validateSchema?: boolean | "log", addSchema?: boolean): SchemaEnv; - private _checkUnique; - private _compileSchemaEnv; - private _compileMetaSchema; -} -export interface ErrorsTextOptions { - separator?: string; - dataVar?: string; -} diff --git a/node_modules/ajv/dist/core.js b/node_modules/ajv/dist/core.js deleted file mode 100644 index 7e30c83..0000000 --- a/node_modules/ajv/dist/core.js +++ /dev/null @@ -1,618 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0; -var validate_1 = require("./compile/validate"); -Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); -var codegen_1 = require("./compile/codegen"); -Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); -Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); -Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); -Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); -Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); -Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); -const validation_error_1 = require("./runtime/validation_error"); -const ref_error_1 = require("./compile/ref_error"); -const rules_1 = require("./compile/rules"); -const compile_1 = require("./compile"); -const codegen_2 = require("./compile/codegen"); -const resolve_1 = require("./compile/resolve"); -const dataType_1 = require("./compile/validate/dataType"); -const util_1 = require("./compile/util"); -const $dataRefSchema = require("./refs/data.json"); -const uri_1 = require("./runtime/uri"); -const defaultRegExp = (str, flags) => new RegExp(str, flags); -defaultRegExp.code = "new RegExp"; -const META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"]; -const EXT_SCOPE_NAMES = new Set([ - "validate", - "serialize", - "parse", - "wrapper", - "root", - "schema", - "keyword", - "pattern", - "formats", - "validate$data", - "func", - "obj", - "Error", -]); -const removedOptions = { - errorDataPath: "", - format: "`validateFormats: false` can be used instead.", - nullable: '"nullable" keyword is supported by default.', - jsonPointers: "Deprecated jsPropertySyntax can be used instead.", - extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.", - missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.", - processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`", - sourceCode: "Use option `code: {source: true}`", - strictDefaults: "It is default now, see option `strict`.", - strictKeywords: "It is default now, see option `strict`.", - uniqueItems: '"uniqueItems" keyword is always validated.', - unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).", - cache: "Map is used as cache, schema object as key.", - serialize: "Map is used as cache, schema object as key.", - ajvErrors: "It is default now.", -}; -const deprecatedOptions = { - ignoreKeywordsWithRef: "", - jsPropertySyntax: "", - unicode: '"minLength"/"maxLength" account for unicode characters by default.', -}; -const MAX_EXPRESSION = 200; -// eslint-disable-next-line complexity -function requiredOptions(o) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0; - const s = o.strict; - const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize; - const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0; - const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp; - const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default; - return { - strictSchema: (_f = (_e = o.strictSchema) !== null && _e !== void 0 ? _e : s) !== null && _f !== void 0 ? _f : true, - strictNumbers: (_h = (_g = o.strictNumbers) !== null && _g !== void 0 ? _g : s) !== null && _h !== void 0 ? _h : true, - strictTypes: (_k = (_j = o.strictTypes) !== null && _j !== void 0 ? _j : s) !== null && _k !== void 0 ? _k : "log", - strictTuples: (_m = (_l = o.strictTuples) !== null && _l !== void 0 ? _l : s) !== null && _m !== void 0 ? _m : "log", - strictRequired: (_p = (_o = o.strictRequired) !== null && _o !== void 0 ? _o : s) !== null && _p !== void 0 ? _p : false, - code: o.code ? { ...o.code, optimize, regExp } : { optimize, regExp }, - loopRequired: (_q = o.loopRequired) !== null && _q !== void 0 ? _q : MAX_EXPRESSION, - loopEnum: (_r = o.loopEnum) !== null && _r !== void 0 ? _r : MAX_EXPRESSION, - meta: (_s = o.meta) !== null && _s !== void 0 ? _s : true, - messages: (_t = o.messages) !== null && _t !== void 0 ? _t : true, - inlineRefs: (_u = o.inlineRefs) !== null && _u !== void 0 ? _u : true, - schemaId: (_v = o.schemaId) !== null && _v !== void 0 ? _v : "$id", - addUsedSchema: (_w = o.addUsedSchema) !== null && _w !== void 0 ? _w : true, - validateSchema: (_x = o.validateSchema) !== null && _x !== void 0 ? _x : true, - validateFormats: (_y = o.validateFormats) !== null && _y !== void 0 ? _y : true, - unicodeRegExp: (_z = o.unicodeRegExp) !== null && _z !== void 0 ? _z : true, - int32range: (_0 = o.int32range) !== null && _0 !== void 0 ? _0 : true, - uriResolver: uriResolver, - }; -} -class Ajv { - constructor(opts = {}) { - this.schemas = {}; - this.refs = {}; - this.formats = {}; - this._compilations = new Set(); - this._loading = {}; - this._cache = new Map(); - opts = this.opts = { ...opts, ...requiredOptions(opts) }; - const { es5, lines } = this.opts.code; - this.scope = new codegen_2.ValueScope({ scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines }); - this.logger = getLogger(opts.logger); - const formatOpt = opts.validateFormats; - opts.validateFormats = false; - this.RULES = (0, rules_1.getRules)(); - checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED"); - checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn"); - this._metaOpts = getMetaSchemaOptions.call(this); - if (opts.formats) - addInitialFormats.call(this); - this._addVocabularies(); - this._addDefaultMetaSchema(); - if (opts.keywords) - addInitialKeywords.call(this, opts.keywords); - if (typeof opts.meta == "object") - this.addMetaSchema(opts.meta); - addInitialSchemas.call(this); - opts.validateFormats = formatOpt; - } - _addVocabularies() { - this.addKeyword("$async"); - } - _addDefaultMetaSchema() { - const { $data, meta, schemaId } = this.opts; - let _dataRefSchema = $dataRefSchema; - if (schemaId === "id") { - _dataRefSchema = { ...$dataRefSchema }; - _dataRefSchema.id = _dataRefSchema.$id; - delete _dataRefSchema.$id; - } - if (meta && $data) - this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false); - } - defaultMeta() { - const { meta, schemaId } = this.opts; - return (this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : undefined); - } - validate(schemaKeyRef, // key, ref or schema object - // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents - data // to be validated - ) { - let v; - if (typeof schemaKeyRef == "string") { - v = this.getSchema(schemaKeyRef); - if (!v) - throw new Error(`no schema with key or ref "${schemaKeyRef}"`); - } - else { - v = this.compile(schemaKeyRef); - } - const valid = v(data); - if (!("$async" in v)) - this.errors = v.errors; - return valid; - } - compile(schema, _meta) { - const sch = this._addSchema(schema, _meta); - return (sch.validate || this._compileSchemaEnv(sch)); - } - compileAsync(schema, meta) { - if (typeof this.opts.loadSchema != "function") { - throw new Error("options.loadSchema should be a function"); - } - const { loadSchema } = this.opts; - return runCompileAsync.call(this, schema, meta); - async function runCompileAsync(_schema, _meta) { - await loadMetaSchema.call(this, _schema.$schema); - const sch = this._addSchema(_schema, _meta); - return sch.validate || _compileAsync.call(this, sch); - } - async function loadMetaSchema($ref) { - if ($ref && !this.getSchema($ref)) { - await runCompileAsync.call(this, { $ref }, true); - } - } - async function _compileAsync(sch) { - try { - return this._compileSchemaEnv(sch); - } - catch (e) { - if (!(e instanceof ref_error_1.default)) - throw e; - checkLoaded.call(this, e); - await loadMissingSchema.call(this, e.missingSchema); - return _compileAsync.call(this, sch); - } - } - function checkLoaded({ missingSchema: ref, missingRef }) { - if (this.refs[ref]) { - throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`); - } - } - async function loadMissingSchema(ref) { - const _schema = await _loadSchema.call(this, ref); - if (!this.refs[ref]) - await loadMetaSchema.call(this, _schema.$schema); - if (!this.refs[ref]) - this.addSchema(_schema, ref, meta); - } - async function _loadSchema(ref) { - const p = this._loading[ref]; - if (p) - return p; - try { - return await (this._loading[ref] = loadSchema(ref)); - } - finally { - delete this._loading[ref]; - } - } - } - // Adds schema to the instance - addSchema(schema, // If array is passed, `key` will be ignored - key, // Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. - _meta, // true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. - _validateSchema = this.opts.validateSchema // false to skip schema validation. Used internally, option validateSchema should be used instead. - ) { - if (Array.isArray(schema)) { - for (const sch of schema) - this.addSchema(sch, undefined, _meta, _validateSchema); - return this; - } - let id; - if (typeof schema === "object") { - const { schemaId } = this.opts; - id = schema[schemaId]; - if (id !== undefined && typeof id != "string") { - throw new Error(`schema ${schemaId} must be string`); - } - } - key = (0, resolve_1.normalizeId)(key || id); - this._checkUnique(key); - this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true); - return this; - } - // Add schema that will be used to validate other schemas - // options in META_IGNORE_OPTIONS are alway set to false - addMetaSchema(schema, key, // schema key - _validateSchema = this.opts.validateSchema // false to skip schema validation, can be used to override validateSchema option for meta-schema - ) { - this.addSchema(schema, key, true, _validateSchema); - return this; - } - // Validate schema against its meta-schema - validateSchema(schema, throwOrLogError) { - if (typeof schema == "boolean") - return true; - let $schema; - $schema = schema.$schema; - if ($schema !== undefined && typeof $schema != "string") { - throw new Error("$schema must be a string"); - } - $schema = $schema || this.opts.defaultMeta || this.defaultMeta(); - if (!$schema) { - this.logger.warn("meta-schema not available"); - this.errors = null; - return true; - } - const valid = this.validate($schema, schema); - if (!valid && throwOrLogError) { - const message = "schema is invalid: " + this.errorsText(); - if (this.opts.validateSchema === "log") - this.logger.error(message); - else - throw new Error(message); - } - return valid; - } - // Get compiled schema by `key` or `ref`. - // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id) - getSchema(keyRef) { - let sch; - while (typeof (sch = getSchEnv.call(this, keyRef)) == "string") - keyRef = sch; - if (sch === undefined) { - const { schemaId } = this.opts; - const root = new compile_1.SchemaEnv({ schema: {}, schemaId }); - sch = compile_1.resolveSchema.call(this, root, keyRef); - if (!sch) - return; - this.refs[keyRef] = sch; - } - return (sch.validate || this._compileSchemaEnv(sch)); - } - // Remove cached schema(s). - // If no parameter is passed all schemas but meta-schemas are removed. - // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. - // Even if schema is referenced by other schemas it still can be removed as other schemas have local references. - removeSchema(schemaKeyRef) { - if (schemaKeyRef instanceof RegExp) { - this._removeAllSchemas(this.schemas, schemaKeyRef); - this._removeAllSchemas(this.refs, schemaKeyRef); - return this; - } - switch (typeof schemaKeyRef) { - case "undefined": - this._removeAllSchemas(this.schemas); - this._removeAllSchemas(this.refs); - this._cache.clear(); - return this; - case "string": { - const sch = getSchEnv.call(this, schemaKeyRef); - if (typeof sch == "object") - this._cache.delete(sch.schema); - delete this.schemas[schemaKeyRef]; - delete this.refs[schemaKeyRef]; - return this; - } - case "object": { - const cacheKey = schemaKeyRef; - this._cache.delete(cacheKey); - let id = schemaKeyRef[this.opts.schemaId]; - if (id) { - id = (0, resolve_1.normalizeId)(id); - delete this.schemas[id]; - delete this.refs[id]; - } - return this; - } - default: - throw new Error("ajv.removeSchema: invalid parameter"); - } - } - // add "vocabulary" - a collection of keywords - addVocabulary(definitions) { - for (const def of definitions) - this.addKeyword(def); - return this; - } - addKeyword(kwdOrDef, def // deprecated - ) { - let keyword; - if (typeof kwdOrDef == "string") { - keyword = kwdOrDef; - if (typeof def == "object") { - this.logger.warn("these parameters are deprecated, see docs for addKeyword"); - def.keyword = keyword; - } - } - else if (typeof kwdOrDef == "object" && def === undefined) { - def = kwdOrDef; - keyword = def.keyword; - if (Array.isArray(keyword) && !keyword.length) { - throw new Error("addKeywords: keyword must be string or non-empty array"); - } - } - else { - throw new Error("invalid addKeywords parameters"); - } - checkKeyword.call(this, keyword, def); - if (!def) { - (0, util_1.eachItem)(keyword, (kwd) => addRule.call(this, kwd)); - return this; - } - keywordMetaschema.call(this, def); - const definition = { - ...def, - type: (0, dataType_1.getJSONTypes)(def.type), - schemaType: (0, dataType_1.getJSONTypes)(def.schemaType), - }; - (0, util_1.eachItem)(keyword, definition.type.length === 0 - ? (k) => addRule.call(this, k, definition) - : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t))); - return this; - } - getKeyword(keyword) { - const rule = this.RULES.all[keyword]; - return typeof rule == "object" ? rule.definition : !!rule; - } - // Remove keyword - removeKeyword(keyword) { - // TODO return type should be Ajv - const { RULES } = this; - delete RULES.keywords[keyword]; - delete RULES.all[keyword]; - for (const group of RULES.rules) { - const i = group.rules.findIndex((rule) => rule.keyword === keyword); - if (i >= 0) - group.rules.splice(i, 1); - } - return this; - } - // Add format - addFormat(name, format) { - if (typeof format == "string") - format = new RegExp(format); - this.formats[name] = format; - return this; - } - errorsText(errors = this.errors, // optional array of validation errors - { separator = ", ", dataVar = "data" } = {} // optional options with properties `separator` and `dataVar` - ) { - if (!errors || errors.length === 0) - return "No errors"; - return errors - .map((e) => `${dataVar}${e.instancePath} ${e.message}`) - .reduce((text, msg) => text + separator + msg); - } - $dataMetaSchema(metaSchema, keywordsJsonPointers) { - const rules = this.RULES.all; - metaSchema = JSON.parse(JSON.stringify(metaSchema)); - for (const jsonPointer of keywordsJsonPointers) { - const segments = jsonPointer.split("/").slice(1); // first segment is an empty string - let keywords = metaSchema; - for (const seg of segments) - keywords = keywords[seg]; - for (const key in rules) { - const rule = rules[key]; - if (typeof rule != "object") - continue; - const { $data } = rule.definition; - const schema = keywords[key]; - if ($data && schema) - keywords[key] = schemaOrData(schema); - } - } - return metaSchema; - } - _removeAllSchemas(schemas, regex) { - for (const keyRef in schemas) { - const sch = schemas[keyRef]; - if (!regex || regex.test(keyRef)) { - if (typeof sch == "string") { - delete schemas[keyRef]; - } - else if (sch && !sch.meta) { - this._cache.delete(sch.schema); - delete schemas[keyRef]; - } - } - } - } - _addSchema(schema, meta, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) { - let id; - const { schemaId } = this.opts; - if (typeof schema == "object") { - id = schema[schemaId]; - } - else { - if (this.opts.jtd) - throw new Error("schema must be object"); - else if (typeof schema != "boolean") - throw new Error("schema must be object or boolean"); - } - let sch = this._cache.get(schema); - if (sch !== undefined) - return sch; - baseId = (0, resolve_1.normalizeId)(id || baseId); - const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId); - sch = new compile_1.SchemaEnv({ schema, schemaId, meta, baseId, localRefs }); - this._cache.set(sch.schema, sch); - if (addSchema && !baseId.startsWith("#")) { - // TODO atm it is allowed to overwrite schemas without id (instead of not adding them) - if (baseId) - this._checkUnique(baseId); - this.refs[baseId] = sch; - } - if (validateSchema) - this.validateSchema(schema, true); - return sch; - } - _checkUnique(id) { - if (this.schemas[id] || this.refs[id]) { - throw new Error(`schema with key or id "${id}" already exists`); - } - } - _compileSchemaEnv(sch) { - if (sch.meta) - this._compileMetaSchema(sch); - else - compile_1.compileSchema.call(this, sch); - /* istanbul ignore if */ - if (!sch.validate) - throw new Error("ajv implementation error"); - return sch.validate; - } - _compileMetaSchema(sch) { - const currentOpts = this.opts; - this.opts = this._metaOpts; - try { - compile_1.compileSchema.call(this, sch); - } - finally { - this.opts = currentOpts; - } - } -} -Ajv.ValidationError = validation_error_1.default; -Ajv.MissingRefError = ref_error_1.default; -exports.default = Ajv; -function checkOptions(checkOpts, options, msg, log = "error") { - for (const key in checkOpts) { - const opt = key; - if (opt in options) - this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`); - } -} -function getSchEnv(keyRef) { - keyRef = (0, resolve_1.normalizeId)(keyRef); // TODO tests fail without this line - return this.schemas[keyRef] || this.refs[keyRef]; -} -function addInitialSchemas() { - const optsSchemas = this.opts.schemas; - if (!optsSchemas) - return; - if (Array.isArray(optsSchemas)) - this.addSchema(optsSchemas); - else - for (const key in optsSchemas) - this.addSchema(optsSchemas[key], key); -} -function addInitialFormats() { - for (const name in this.opts.formats) { - const format = this.opts.formats[name]; - if (format) - this.addFormat(name, format); - } -} -function addInitialKeywords(defs) { - if (Array.isArray(defs)) { - this.addVocabulary(defs); - return; - } - this.logger.warn("keywords option as map is deprecated, pass array"); - for (const keyword in defs) { - const def = defs[keyword]; - if (!def.keyword) - def.keyword = keyword; - this.addKeyword(def); - } -} -function getMetaSchemaOptions() { - const metaOpts = { ...this.opts }; - for (const opt of META_IGNORE_OPTIONS) - delete metaOpts[opt]; - return metaOpts; -} -const noLogs = { log() { }, warn() { }, error() { } }; -function getLogger(logger) { - if (logger === false) - return noLogs; - if (logger === undefined) - return console; - if (logger.log && logger.warn && logger.error) - return logger; - throw new Error("logger must implement log, warn and error methods"); -} -const KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i; -function checkKeyword(keyword, def) { - const { RULES } = this; - (0, util_1.eachItem)(keyword, (kwd) => { - if (RULES.keywords[kwd]) - throw new Error(`Keyword ${kwd} is already defined`); - if (!KEYWORD_NAME.test(kwd)) - throw new Error(`Keyword ${kwd} has invalid name`); - }); - if (!def) - return; - if (def.$data && !("code" in def || "validate" in def)) { - throw new Error('$data keyword must have "code" or "validate" function'); - } -} -function addRule(keyword, definition, dataType) { - var _a; - const post = definition === null || definition === void 0 ? void 0 : definition.post; - if (dataType && post) - throw new Error('keyword with "post" flag cannot have "type"'); - const { RULES } = this; - let ruleGroup = post ? RULES.post : RULES.rules.find(({ type: t }) => t === dataType); - if (!ruleGroup) { - ruleGroup = { type: dataType, rules: [] }; - RULES.rules.push(ruleGroup); - } - RULES.keywords[keyword] = true; - if (!definition) - return; - const rule = { - keyword, - definition: { - ...definition, - type: (0, dataType_1.getJSONTypes)(definition.type), - schemaType: (0, dataType_1.getJSONTypes)(definition.schemaType), - }, - }; - if (definition.before) - addBeforeRule.call(this, ruleGroup, rule, definition.before); - else - ruleGroup.rules.push(rule); - RULES.all[keyword] = rule; - (_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd)); -} -function addBeforeRule(ruleGroup, rule, before) { - const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before); - if (i >= 0) { - ruleGroup.rules.splice(i, 0, rule); - } - else { - ruleGroup.rules.push(rule); - this.logger.warn(`rule ${before} is not defined`); - } -} -function keywordMetaschema(def) { - let { metaSchema } = def; - if (metaSchema === undefined) - return; - if (def.$data && this.opts.$data) - metaSchema = schemaOrData(metaSchema); - def.validateSchema = this.compile(metaSchema, true); -} -const $dataRef = { - $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", -}; -function schemaOrData(schema) { - return { anyOf: [schema, $dataRef] }; -} -//# sourceMappingURL=core.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/core.js.map b/node_modules/ajv/dist/core.js.map deleted file mode 100644 index 3760c3e..0000000 --- a/node_modules/ajv/dist/core.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"core.js","sourceRoot":"","sources":["../lib/core.ts"],"names":[],"mappings":";;;AA4BA,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAKlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA;AAsBnD,iEAAwD;AACxD,mDAAiD;AACjD,2CAAoF;AACpF,uCAAiE;AACjE,+CAAkD;AAClD,+CAA4D;AAC5D,0DAAwD;AACxD,yCAAuC;AACvC,mDAAkD;AAElD,uCAA8C;AAE9C,MAAM,aAAa,GAAiB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;AAC1E,aAAa,CAAC,IAAI,GAAG,YAAY,CAAA;AAEjC,MAAM,mBAAmB,GAAsB,CAAC,kBAAkB,EAAE,aAAa,EAAE,aAAa,CAAC,CAAA;AACjG,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,UAAU;IACV,WAAW;IACX,OAAO;IACP,SAAS;IACT,MAAM;IACN,QAAQ;IACR,SAAS;IACT,SAAS;IACT,SAAS;IACT,eAAe;IACf,MAAM;IACN,KAAK;IACL,OAAO;CACR,CAAC,CAAA;AAyGF,MAAM,cAAc,GAAgC;IAClD,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE,+CAA+C;IACvD,QAAQ,EAAE,6CAA6C;IACvD,YAAY,EAAE,kDAAkD;IAChE,UAAU,EAAE,uDAAuD;IACnE,WAAW,EAAE,qEAAqE;IAClF,WAAW,EAAE,mEAAmE;IAChF,UAAU,EAAE,mCAAmC;IAC/C,cAAc,EAAE,yCAAyC;IACzD,cAAc,EAAE,yCAAyC;IACzD,WAAW,EAAE,4CAA4C;IACzD,cAAc,EAAE,8EAA8E;IAC9F,KAAK,EAAE,6CAA6C;IACpD,SAAS,EAAE,6CAA6C;IACxD,SAAS,EAAE,oBAAoB;CAChC,CAAA;AAED,MAAM,iBAAiB,GAAmC;IACxD,qBAAqB,EAAE,EAAE;IACzB,gBAAgB,EAAE,EAAE;IACpB,OAAO,EAAE,oEAAoE;CAC9E,CAAA;AAyBD,MAAM,cAAc,GAAG,GAAG,CAAA;AAE1B,sCAAsC;AACtC,SAAS,eAAe,CAAC,CAAU;;IACjC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAA;IAClB,MAAM,KAAK,GAAG,MAAA,CAAC,CAAC,IAAI,0CAAE,QAAQ,CAAA;IAC9B,MAAM,QAAQ,GAAG,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAA;IACvE,MAAM,MAAM,GAAG,MAAA,MAAA,CAAC,CAAC,IAAI,0CAAE,MAAM,mCAAI,aAAa,CAAA;IAC9C,MAAM,WAAW,GAAG,MAAA,CAAC,CAAC,WAAW,mCAAI,aAAkB,CAAA;IACvD,OAAO;QACL,YAAY,EAAE,MAAA,MAAA,CAAC,CAAC,YAAY,mCAAI,CAAC,mCAAI,IAAI;QACzC,aAAa,EAAE,MAAA,MAAA,CAAC,CAAC,aAAa,mCAAI,CAAC,mCAAI,IAAI;QAC3C,WAAW,EAAE,MAAA,MAAA,CAAC,CAAC,WAAW,mCAAI,CAAC,mCAAI,KAAK;QACxC,YAAY,EAAE,MAAA,MAAA,CAAC,CAAC,YAAY,mCAAI,CAAC,mCAAI,KAAK;QAC1C,cAAc,EAAE,MAAA,MAAA,CAAC,CAAC,cAAc,mCAAI,CAAC,mCAAI,KAAK;QAC9C,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC,GAAG,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAC,CAAC,CAAC,CAAC,EAAC,QAAQ,EAAE,MAAM,EAAC;QACjE,YAAY,EAAE,MAAA,CAAC,CAAC,YAAY,mCAAI,cAAc;QAC9C,QAAQ,EAAE,MAAA,CAAC,CAAC,QAAQ,mCAAI,cAAc;QACtC,IAAI,EAAE,MAAA,CAAC,CAAC,IAAI,mCAAI,IAAI;QACpB,QAAQ,EAAE,MAAA,CAAC,CAAC,QAAQ,mCAAI,IAAI;QAC5B,UAAU,EAAE,MAAA,CAAC,CAAC,UAAU,mCAAI,IAAI;QAChC,QAAQ,EAAE,MAAA,CAAC,CAAC,QAAQ,mCAAI,KAAK;QAC7B,aAAa,EAAE,MAAA,CAAC,CAAC,aAAa,mCAAI,IAAI;QACtC,cAAc,EAAE,MAAA,CAAC,CAAC,cAAc,mCAAI,IAAI;QACxC,eAAe,EAAE,MAAA,CAAC,CAAC,eAAe,mCAAI,IAAI;QAC1C,aAAa,EAAE,MAAA,CAAC,CAAC,aAAa,mCAAI,IAAI;QACtC,UAAU,EAAE,MAAA,CAAC,CAAC,UAAU,mCAAI,IAAI;QAChC,WAAW,EAAE,WAAW;KACzB,CAAA;AACH,CAAC;AAQD,MAAqB,GAAG;IAkBtB,YAAY,OAAgB,EAAE;QAZrB,YAAO,GAAkC,EAAE,CAAA;QAC3C,SAAI,GAA2C,EAAE,CAAA;QACjD,YAAO,GAAqC,EAAE,CAAA;QAE9C,kBAAa,GAAmB,IAAI,GAAG,EAAE,CAAA;QACjC,aAAQ,GAAiD,EAAE,CAAA;QAC3D,WAAM,GAA8B,IAAI,GAAG,EAAE,CAAA;QAO5D,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,EAAC,GAAG,IAAI,EAAE,GAAG,eAAe,CAAC,IAAI,CAAC,EAAC,CAAA;QACtD,MAAM,EAAC,GAAG,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;QAEnC,IAAI,CAAC,KAAK,GAAG,IAAI,oBAAU,CAAC,EAAC,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,EAAE,KAAK,EAAC,CAAC,CAAA;QAC/E,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACpC,MAAM,SAAS,GAAG,IAAI,CAAC,eAAe,CAAA;QACtC,IAAI,CAAC,eAAe,GAAG,KAAK,CAAA;QAE5B,IAAI,CAAC,KAAK,GAAG,IAAA,gBAAQ,GAAE,CAAA;QACvB,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,eAAe,CAAC,CAAA;QAC9D,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,CAAA;QACtE,IAAI,CAAC,SAAS,GAAG,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAEhD,IAAI,IAAI,CAAC,OAAO;YAAE,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC9C,IAAI,CAAC,gBAAgB,EAAE,CAAA;QACvB,IAAI,CAAC,qBAAqB,EAAE,CAAA;QAC5B,IAAI,IAAI,CAAC,QAAQ;YAAE,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC/D,IAAI,OAAO,IAAI,CAAC,IAAI,IAAI,QAAQ;YAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC/D,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC5B,IAAI,CAAC,eAAe,GAAG,SAAS,CAAA;IAClC,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IAC3B,CAAC;IAED,qBAAqB;QACnB,MAAM,EAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;QACzC,IAAI,cAAc,GAAiB,cAAc,CAAA;QACjD,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtB,cAAc,GAAG,EAAC,GAAG,cAAc,EAAC,CAAA;YACpC,cAAc,CAAC,EAAE,GAAG,cAAc,CAAC,GAAG,CAAA;YACtC,OAAO,cAAc,CAAC,GAAG,CAAA;QAC3B,CAAC;QACD,IAAI,IAAI,IAAI,KAAK;YAAE,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,cAAc,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAA;IACxF,CAAC;IAED,WAAW;QACT,MAAM,EAAC,IAAI,EAAE,QAAQ,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;QAClC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,OAAO,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;IAC/F,CAAC;IAoBD,QAAQ,CACN,YAAgC,EAAE,4BAA4B;IAC9D,6EAA6E;IAC7E,IAAiB,CAAC,kBAAkB;;QAEpC,IAAI,CAAkC,CAAA;QACtC,IAAI,OAAO,YAAY,IAAI,QAAQ,EAAE,CAAC;YACpC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAI,YAAY,CAAC,CAAA;YACnC,IAAI,CAAC,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,YAAY,GAAG,CAAC,CAAA;QACxE,CAAC;aAAM,CAAC;YACN,CAAC,GAAG,IAAI,CAAC,OAAO,CAAI,YAAY,CAAC,CAAA;QACnC,CAAC;QAED,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,CAAA;QACrB,IAAI,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC;YAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAA;QAC5C,OAAO,KAAK,CAAA;IACd,CAAC;IAiBD,OAAO,CAAc,MAAiB,EAAE,KAAe;QACrD,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QAC1C,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAA2B,CAAA;IAChF,CAAC;IAmBD,YAAY,CACV,MAAuB,EACvB,IAAc;QAEd,IAAI,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,UAAU,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAA;QAC5D,CAAC;QACD,MAAM,EAAC,UAAU,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;QAC9B,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;QAE/C,KAAK,UAAU,eAAe,CAE5B,OAAwB,EACxB,KAAe;YAEf,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;YAChD,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;YAC3C,OAAO,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QACtD,CAAC;QAED,KAAK,UAAU,cAAc,CAAY,IAAa;YACpD,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;gBAClC,MAAM,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,EAAC,IAAI,EAAC,EAAE,IAAI,CAAC,CAAA;YAChD,CAAC;QACH,CAAC;QAED,KAAK,UAAU,aAAa,CAAY,GAAc;YACpD,IAAI,CAAC;gBACH,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAA;YACpC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,IAAI,CAAC,CAAC,CAAC,YAAY,mBAAe,CAAC;oBAAE,MAAM,CAAC,CAAA;gBAC5C,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;gBACzB,MAAM,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,CAAA;gBACnD,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;YACtC,CAAC;QACH,CAAC;QAED,SAAS,WAAW,CAAY,EAAC,aAAa,EAAE,GAAG,EAAE,UAAU,EAAkB;YAC/E,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnB,MAAM,IAAI,KAAK,CAAC,aAAa,GAAG,kBAAkB,UAAU,qBAAqB,CAAC,CAAA;YACpF,CAAC;QACH,CAAC;QAED,KAAK,UAAU,iBAAiB,CAAY,GAAW;YACrD,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;YACjD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;gBAAE,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;YACrE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;gBAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;QACzD,CAAC;QAED,KAAK,UAAU,WAAW,CAAY,GAAW;YAC/C,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;YAC5B,IAAI,CAAC;gBAAE,OAAO,CAAC,CAAA;YACf,IAAI,CAAC;gBACH,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAA;YACrD,CAAC;oBAAS,CAAC;gBACT,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED,8BAA8B;IAC9B,SAAS,CACP,MAA+B,EAAE,4CAA4C;IAC7E,GAAY,EAAE,qJAAqJ;IACnK,KAAe,EAAE,0FAA0F;IAC3G,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,kGAAkG;;QAE7I,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,KAAK,MAAM,GAAG,IAAI,MAAM;gBAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,CAAC,CAAA;YAChF,OAAO,IAAI,CAAA;QACb,CAAC;QACD,IAAI,EAAsB,CAAA;QAC1B,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;YAC5B,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;YACrB,IAAI,EAAE,KAAK,SAAS,IAAI,OAAO,EAAE,IAAI,QAAQ,EAAE,CAAC;gBAC9C,MAAM,IAAI,KAAK,CAAC,UAAU,QAAQ,iBAAiB,CAAC,CAAA;YACtD,CAAC;QACH,CAAC;QACD,GAAG,GAAG,IAAA,qBAAW,EAAC,GAAG,IAAI,EAAE,CAAC,CAAA;QAC5B,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;QACtB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,CAAC,CAAA;QAC9E,OAAO,IAAI,CAAA;IACb,CAAC;IAED,yDAAyD;IACzD,wDAAwD;IACxD,aAAa,CACX,MAAuB,EACvB,GAAY,EAAE,aAAa;IAC3B,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,iGAAiG;;QAE5I,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,eAAe,CAAC,CAAA;QAClD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,2CAA2C;IAC3C,cAAc,CAAC,MAAiB,EAAE,eAAyB;QACzD,IAAI,OAAO,MAAM,IAAI,SAAS;YAAE,OAAO,IAAI,CAAA;QAC3C,IAAI,OAA6C,CAAA;QACjD,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;QACxB,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,OAAO,IAAI,QAAQ,EAAE,CAAC;YACxD,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC7C,CAAC;QACD,OAAO,GAAG,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,EAAE,CAAA;QAChE,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAA;YAC7C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;YAClB,OAAO,IAAI,CAAA;QACb,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAC5C,IAAI,CAAC,KAAK,IAAI,eAAe,EAAE,CAAC;YAC9B,MAAM,OAAO,GAAG,qBAAqB,GAAG,IAAI,CAAC,UAAU,EAAE,CAAA;YACzD,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,KAAK,KAAK;gBAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;;gBAC7D,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA;QAC/B,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,yCAAyC;IACzC,gGAAgG;IAChG,SAAS,CAAc,MAAc;QACnC,IAAI,GAAG,CAAA;QACP,OAAO,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,QAAQ;YAAE,MAAM,GAAG,GAAG,CAAA;QAC5E,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;YAC5B,MAAM,IAAI,GAAG,IAAI,mBAAS,CAAC,EAAC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAC,CAAC,CAAA;YAClD,GAAG,GAAG,uBAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;YAC5C,IAAI,CAAC,GAAG;gBAAE,OAAM;YAChB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,CAAA;QACzB,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAuC,CAAA;IAC5F,CAAC;IAED,2BAA2B;IAC3B,sEAAsE;IACtE,6FAA6F;IAC7F,gHAAgH;IAChH,YAAY,CAAC,YAA0C;QACrD,IAAI,YAAY,YAAY,MAAM,EAAE,CAAC;YACnC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;YAClD,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;YAC/C,OAAO,IAAI,CAAA;QACb,CAAC;QACD,QAAQ,OAAO,YAAY,EAAE,CAAC;YAC5B,KAAK,WAAW;gBACd,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;gBACpC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBACjC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;gBACnB,OAAO,IAAI,CAAA;YACb,KAAK,QAAQ,CAAC,CAAC,CAAC;gBACd,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;gBAC9C,IAAI,OAAO,GAAG,IAAI,QAAQ;oBAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;gBAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;gBACjC,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;gBAC9B,OAAO,IAAI,CAAA;YACb,CAAC;YACD,KAAK,QAAQ,CAAC,CAAC,CAAC;gBACd,MAAM,QAAQ,GAAG,YAAY,CAAA;gBAC7B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;gBAC5B,IAAI,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;gBACzC,IAAI,EAAE,EAAE,CAAC;oBACP,EAAE,GAAG,IAAA,qBAAW,EAAC,EAAE,CAAC,CAAA;oBACpB,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;oBACvB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gBACtB,CAAC;gBACD,OAAO,IAAI,CAAA;YACb,CAAC;YACD;gBACE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;QAC1D,CAAC;IACH,CAAC;IAED,8CAA8C;IAC9C,aAAa,CAAC,WAAuB;QACnC,KAAK,MAAM,GAAG,IAAI,WAAW;YAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;QACnD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,UAAU,CACR,QAAoC,EACpC,GAAuB,CAAC,aAAa;;QAErC,IAAI,OAA0B,CAAA;QAC9B,IAAI,OAAO,QAAQ,IAAI,QAAQ,EAAE,CAAC;YAChC,OAAO,GAAG,QAAQ,CAAA;YAClB,IAAI,OAAO,GAAG,IAAI,QAAQ,EAAE,CAAC;gBAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAA;gBAC5E,GAAG,CAAC,OAAO,GAAG,OAAO,CAAA;YACvB,CAAC;QACH,CAAC;aAAM,IAAI,OAAO,QAAQ,IAAI,QAAQ,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YAC5D,GAAG,GAAG,QAAQ,CAAA;YACd,OAAO,GAAG,GAAG,CAAC,OAAO,CAAA;YACrB,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBAC9C,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;YAC3E,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QACnD,CAAC;QAED,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,CAAA;QACrC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,IAAA,eAAQ,EAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAA;YACnD,OAAO,IAAI,CAAA;QACb,CAAC;QACD,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QACjC,MAAM,UAAU,GAA2B;YACzC,GAAG,GAAG;YACN,IAAI,EAAE,IAAA,uBAAY,EAAC,GAAG,CAAC,IAAI,CAAC;YAC5B,UAAU,EAAE,IAAA,uBAAY,EAAC,GAAG,CAAC,UAAU,CAAC;SACzC,CAAA;QACD,IAAA,eAAQ,EACN,OAAO,EACP,UAAU,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;YAC1B,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,UAAU,CAAC;YAC1C,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAChF,CAAA;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,UAAU,CAAC,OAAe;QACxB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QACpC,OAAO,OAAO,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAC3D,CAAC;IAED,iBAAiB;IACjB,aAAa,CAAC,OAAe;QAC3B,iCAAiC;QACjC,MAAM,EAAC,KAAK,EAAC,GAAG,IAAI,CAAA;QACpB,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QAC9B,OAAO,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QACzB,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAChC,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,OAAO,CAAC,CAAA;YACnE,IAAI,CAAC,IAAI,CAAC;gBAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QACtC,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,aAAa;IACb,SAAS,CAAC,IAAY,EAAE,MAAc;QACpC,IAAI,OAAO,MAAM,IAAI,QAAQ;YAAE,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAA;QAC1D,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAA;QAC3B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,UAAU,CACR,SAA2C,IAAI,CAAC,MAAM,EAAE,sCAAsC;IAC9F,EAAC,SAAS,GAAG,IAAI,EAAE,OAAO,GAAG,MAAM,KAAuB,EAAE,CAAC,6DAA6D;;QAE1H,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,WAAW,CAAA;QACtD,OAAO,MAAM;aACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;aACtD,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,SAAS,GAAG,GAAG,CAAC,CAAA;IAClD,CAAC;IAED,eAAe,CAAC,UAA2B,EAAE,oBAA8B;QACzE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAA;QAC5B,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAA;QACnD,KAAK,MAAM,WAAW,IAAI,oBAAoB,EAAE,CAAC;YAC/C,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA,CAAC,mCAAmC;YACpF,IAAI,QAAQ,GAAG,UAAU,CAAA;YACzB,KAAK,MAAM,GAAG,IAAI,QAAQ;gBAAE,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAoB,CAAA;YAEvE,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;gBACxB,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAA;gBACvB,IAAI,OAAO,IAAI,IAAI,QAAQ;oBAAE,SAAQ;gBACrC,MAAM,EAAC,KAAK,EAAC,GAAG,IAAI,CAAC,UAAU,CAAA;gBAC/B,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAgC,CAAA;gBAC3D,IAAI,KAAK,IAAI,MAAM;oBAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC,CAAA;YAC3D,CAAC;QACH,CAAC;QAED,OAAO,UAAU,CAAA;IACnB,CAAC;IAEO,iBAAiB,CAAC,OAA+C,EAAE,KAAc;QACvF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;YAC3B,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;gBACjC,IAAI,OAAO,GAAG,IAAI,QAAQ,EAAE,CAAC;oBAC3B,OAAO,OAAO,CAAC,MAAM,CAAC,CAAA;gBACxB,CAAC;qBAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;oBAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;oBAC9B,OAAO,OAAO,CAAC,MAAM,CAAC,CAAA;gBACxB,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,UAAU,CACR,MAAiB,EACjB,IAAc,EACd,MAAe,EACf,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EACzC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa;QAEnC,IAAI,EAAsB,CAAA;QAC1B,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;QAC5B,IAAI,OAAO,MAAM,IAAI,QAAQ,EAAE,CAAC;YAC9B,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;QACvB,CAAC;aAAM,CAAC;YACN,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG;gBAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;iBACtD,IAAI,OAAO,MAAM,IAAI,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAA;QAC1F,CAAC;QACD,IAAI,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QACjC,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,GAAG,CAAA;QAEjC,MAAM,GAAG,IAAA,qBAAW,EAAC,EAAE,IAAI,MAAM,CAAC,CAAA;QAClC,MAAM,SAAS,GAAG,uBAAa,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QAC1D,GAAG,GAAG,IAAI,mBAAS,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAC,CAAC,CAAA;QAChE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QAChC,IAAI,SAAS,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACzC,sFAAsF;YACtF,IAAI,MAAM;gBAAE,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;YACrC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,CAAA;QACzB,CAAC;QACD,IAAI,cAAc;YAAE,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QACrD,OAAO,GAAG,CAAA;IACZ,CAAC;IAEO,YAAY,CAAC,EAAU;QAC7B,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,0BAA0B,EAAE,kBAAkB,CAAC,CAAA;QACjE,CAAC;IACH,CAAC;IAEO,iBAAiB,CAAC,GAAc;QACtC,IAAI,GAAG,CAAC,IAAI;YAAE,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAA;;YACrC,uBAAa,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QAElC,wBAAwB;QACxB,IAAI,CAAC,GAAG,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC9D,OAAO,GAAG,CAAC,QAAQ,CAAA;IACrB,CAAC;IAEO,kBAAkB,CAAC,GAAc;QACvC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAA;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAA;QAC1B,IAAI,CAAC;YACH,uBAAa,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QAC/B,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,IAAI,GAAG,WAAW,CAAA;QACzB,CAAC;IACH,CAAC;;AA9cM,mBAAe,GAAG,0BAAe,AAAlB,CAAkB;AACjC,mBAAe,GAAG,mBAAe,AAAlB,CAAkB;kBAhBrB,GAAG;AAqexB,SAAS,YAAY,CAEnB,SAA0D,EAC1D,OAAiC,EACjC,GAAW,EACX,MAAwB,OAAO;IAE/B,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,GAA6B,CAAA;QACzC,IAAI,GAAG,IAAI,OAAO;YAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,YAAY,GAAG,KAAK,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAClF,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAY,MAAc;IAC1C,MAAM,GAAG,IAAA,qBAAW,EAAC,MAAM,CAAC,CAAA,CAAC,oCAAoC;IACjE,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAClD,CAAC;AAED,SAAS,iBAAiB;IACxB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAA;IACrC,IAAI,CAAC,WAAW;QAAE,OAAM;IACxB,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC;QAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;;QACtD,KAAK,MAAM,GAAG,IAAI,WAAW;YAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAc,EAAE,GAAG,CAAC,CAAA;AACxF,CAAC;AAED,SAAS,iBAAiB;IACxB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QACtC,IAAI,MAAM;YAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAC1C,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB,CAEzB,IAAsD;IAEtD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;QACxB,OAAM;IACR,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAA;IACpE,KAAK,MAAM,OAAO,IAAI,IAAI,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAsB,CAAA;QAC9C,IAAI,CAAC,GAAG,CAAC,OAAO;YAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAA;QACvC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;IACtB,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB;IAC3B,MAAM,QAAQ,GAAG,EAAC,GAAG,IAAI,CAAC,IAAI,EAAC,CAAA;IAC/B,KAAK,MAAM,GAAG,IAAI,mBAAmB;QAAE,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAA;IAC3D,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,MAAM,MAAM,GAAG,EAAC,GAAG,KAAI,CAAC,EAAE,IAAI,KAAI,CAAC,EAAE,KAAK,KAAI,CAAC,EAAC,CAAA;AAEhD,SAAS,SAAS,CAAC,MAAgC;IACjD,IAAI,MAAM,KAAK,KAAK;QAAE,OAAO,MAAM,CAAA;IACnC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,OAAO,CAAA;IACxC,IAAI,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,KAAK;QAAE,OAAO,MAAgB,CAAA;IACtE,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAA;AACtE,CAAC;AAED,MAAM,YAAY,GAAG,yBAAyB,CAAA;AAE9C,SAAS,YAAY,CAAY,OAA0B,EAAE,GAAuB;IAClF,MAAM,EAAC,KAAK,EAAC,GAAG,IAAI,CAAA;IACpB,IAAA,eAAQ,EAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACxB,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,WAAW,GAAG,qBAAqB,CAAC,CAAA;QAC7E,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,WAAW,GAAG,mBAAmB,CAAC,CAAA;IACjF,CAAC,CAAC,CAAA;IACF,IAAI,CAAC,GAAG;QAAE,OAAM;IAChB,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,IAAI,GAAG,IAAI,UAAU,IAAI,GAAG,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;IAC1E,CAAC;AACH,CAAC;AAED,SAAS,OAAO,CAEd,OAAe,EACf,UAAmC,EACnC,QAAmB;;IAEnB,MAAM,IAAI,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,CAAA;IAC7B,IAAI,QAAQ,IAAI,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;IACpF,MAAM,EAAC,KAAK,EAAC,GAAG,IAAI,CAAA;IACpB,IAAI,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAC,IAAI,EAAE,CAAC,EAAC,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAA;IACnF,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,SAAS,GAAG,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC,CAAA;QACvC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAC7B,CAAC;IACD,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;IAC9B,IAAI,CAAC,UAAU;QAAE,OAAM;IAEvB,MAAM,IAAI,GAAS;QACjB,OAAO;QACP,UAAU,EAAE;YACV,GAAG,UAAU;YACb,IAAI,EAAE,IAAA,uBAAY,EAAC,UAAU,CAAC,IAAI,CAAC;YACnC,UAAU,EAAE,IAAA,uBAAY,EAAC,UAAU,CAAC,UAAU,CAAC;SAChD;KACF,CAAA;IACD,IAAI,UAAU,CAAC,MAAM;QAAE,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;;QAC9E,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC/B,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;IACzB,MAAA,UAAU,CAAC,UAAU,0CAAE,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAA;AAC/D,CAAC;AAED,SAAS,aAAa,CAAY,SAAoB,EAAE,IAAU,EAAE,MAAc;IAChF,MAAM,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,KAAK,MAAM,CAAC,CAAA;IACxE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACX,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;IACpC,CAAC;SAAM,CAAC;QACN,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC1B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,MAAM,iBAAiB,CAAC,CAAA;IACnD,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAY,GAAsB;IAC1D,IAAI,EAAC,UAAU,EAAC,GAAG,GAAG,CAAA;IACtB,IAAI,UAAU,KAAK,SAAS;QAAE,OAAM;IACpC,IAAI,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK;QAAE,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,CAAA;IACvE,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;AACrD,CAAC;AAED,MAAM,QAAQ,GAAG;IACf,IAAI,EAAE,gFAAgF;CACvF,CAAA;AAED,SAAS,YAAY,CAAC,MAAiB;IACrC,OAAO,EAAC,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAC,CAAA;AACpC,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/jtd.d.ts b/node_modules/ajv/dist/jtd.d.ts deleted file mode 100644 index a079ba4..0000000 --- a/node_modules/ajv/dist/jtd.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -import type { AnySchemaObject, SchemaObject, JTDParser } from "./types"; -import type { JTDSchemaType, SomeJTDSchemaType, JTDDataType } from "./types/jtd-schema"; -import AjvCore, { CurrentOptions } from "./core"; -type JTDOptions = CurrentOptions & { - strict?: never; - allowMatchingProperties?: never; - allowUnionTypes?: never; - validateFormats?: never; - $data?: never; - verbose?: boolean; - $comment?: never; - formats?: never; - loadSchema?: never; - useDefaults?: never; - coerceTypes?: never; - next?: never; - unevaluated?: never; - dynamicRef?: never; - meta?: boolean; - defaultMeta?: never; - inlineRefs?: boolean; - loopRequired?: never; - multipleOfPrecision?: never; -}; -export declare class Ajv extends AjvCore { - constructor(opts?: JTDOptions); - _addVocabularies(): void; - _addDefaultMetaSchema(): void; - defaultMeta(): string | AnySchemaObject | undefined; - compileSerializer(schema: SchemaObject): (data: T) => string; - compileSerializer(schema: JTDSchemaType): (data: T) => string; - compileParser(schema: SchemaObject): JTDParser; - compileParser(schema: JTDSchemaType): JTDParser; - private _compileSerializer; - private _compileParser; -} -export default Ajv; -export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, ErrorNoParams, JTDParser, } from "./types"; -export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core"; -export { SchemaCxt, SchemaObjCxt } from "./compile"; -export { KeywordCxt } from "./compile/validate"; -export { JTDErrorObject } from "./vocabularies/jtd"; -export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; -export { JTDSchemaType, SomeJTDSchemaType, JTDDataType }; -export { JTDOptions }; -export { default as ValidationError } from "./runtime/validation_error"; -export { default as MissingRefError } from "./compile/ref_error"; diff --git a/node_modules/ajv/dist/jtd.js b/node_modules/ajv/dist/jtd.js deleted file mode 100644 index 1a3baaf..0000000 --- a/node_modules/ajv/dist/jtd.js +++ /dev/null @@ -1,72 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = void 0; -const core_1 = require("./core"); -const jtd_1 = require("./vocabularies/jtd"); -const jtd_schema_1 = require("./refs/jtd-schema"); -const serialize_1 = require("./compile/jtd/serialize"); -const parse_1 = require("./compile/jtd/parse"); -const META_SCHEMA_ID = "JTD-meta-schema"; -class Ajv extends core_1.default { - constructor(opts = {}) { - super({ - ...opts, - jtd: true, - }); - } - _addVocabularies() { - super._addVocabularies(); - this.addVocabulary(jtd_1.default); - } - _addDefaultMetaSchema() { - super._addDefaultMetaSchema(); - if (!this.opts.meta) - return; - this.addMetaSchema(jtd_schema_1.default, META_SCHEMA_ID, false); - } - defaultMeta() { - return (this.opts.defaultMeta = - super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); - } - compileSerializer(schema) { - const sch = this._addSchema(schema); - return sch.serialize || this._compileSerializer(sch); - } - compileParser(schema) { - const sch = this._addSchema(schema); - return (sch.parse || this._compileParser(sch)); - } - _compileSerializer(sch) { - serialize_1.default.call(this, sch, sch.schema.definitions || {}); - /* istanbul ignore if */ - if (!sch.serialize) - throw new Error("ajv implementation error"); - return sch.serialize; - } - _compileParser(sch) { - parse_1.default.call(this, sch, sch.schema.definitions || {}); - /* istanbul ignore if */ - if (!sch.parse) - throw new Error("ajv implementation error"); - return sch.parse; - } -} -exports.Ajv = Ajv; -module.exports = exports = Ajv; -module.exports.Ajv = Ajv; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = Ajv; -var validate_1 = require("./compile/validate"); -Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); -var codegen_1 = require("./compile/codegen"); -Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); -Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); -Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); -Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); -Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); -Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); -var validation_error_1 = require("./runtime/validation_error"); -Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } }); -var ref_error_1 = require("./compile/ref_error"); -Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } }); -//# sourceMappingURL=jtd.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/jtd.js.map b/node_modules/ajv/dist/jtd.js.map deleted file mode 100644 index 6bf9f3b..0000000 --- a/node_modules/ajv/dist/jtd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"jtd.js","sourceRoot":"","sources":["../lib/jtd.ts"],"names":[],"mappings":";;;AAEA,iCAA8C;AAC9C,4CAA8C;AAC9C,kDAA6C;AAC7C,uDAAuD;AACvD,+CAA+C;AAG/C,MAAM,cAAc,GAAG,iBAAiB,CAAA;AA4BxC,MAAa,GAAI,SAAQ,cAAO;IAC9B,YAAY,OAAmB,EAAE;QAC/B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,GAAG,EAAE,IAAI;SACV,CAAC,CAAA;IACJ,CAAC;IAED,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAA;IACnC,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAM;QAC3B,IAAI,CAAC,aAAa,CAAC,oBAAa,EAAE,cAAc,EAAE,KAAK,CAAC,CAAA;IAC1D,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;YAC3B,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IACzF,CAAC;IAMD,iBAAiB,CAAc,MAAoB;QACjD,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;QACnC,OAAO,GAAG,CAAC,SAAS,IAAI,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAA;IACtD,CAAC;IAMD,aAAa,CAAc,MAAoB;QAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;QACnC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAiB,CAAA;IAChE,CAAC;IAEO,kBAAkB,CAAI,GAAc;QAC1C,mBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAG,GAAG,CAAC,MAA0B,CAAC,WAAW,IAAI,EAAE,CAAC,CAAA;QACpF,wBAAwB;QACxB,IAAI,CAAC,GAAG,CAAC,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC/D,OAAO,GAAG,CAAC,SAAS,CAAA;IACtB,CAAC;IAEO,cAAc,CAAC,GAAc;QACnC,eAAa,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAG,GAAG,CAAC,MAA0B,CAAC,WAAW,IAAI,EAAE,CAAC,CAAA;QAChF,wBAAwB;QACxB,IAAI,CAAC,GAAG,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC3D,OAAO,GAAG,CAAC,KAAK,CAAA;IAClB,CAAC;CACF;AAvDD,kBAuDC;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,GAAG,CAAA;AAC9B,MAAM,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAA;AACxB,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,GAAG,CAAA;AA0BlB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAElB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA;AAInD,+DAAqE;AAA7D,mHAAA,OAAO,OAAmB;AAClC,iDAA8D;AAAtD,4GAAA,OAAO,OAAmB"} \ No newline at end of file diff --git a/node_modules/ajv/dist/refs/data.json b/node_modules/ajv/dist/refs/data.json deleted file mode 100644 index 9ffc9f5..0000000 --- a/node_modules/ajv/dist/refs/data.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", - "description": "Meta-schema for $data reference (JSON AnySchema extension proposal)", - "type": "object", - "required": ["$data"], - "properties": { - "$data": { - "type": "string", - "anyOf": [{"format": "relative-json-pointer"}, {"format": "json-pointer"}] - } - }, - "additionalProperties": false -} diff --git a/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts b/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts deleted file mode 100644 index cf00833..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type Ajv from "../../core"; -export default function addMetaSchema2019(this: Ajv, $data?: boolean): Ajv; diff --git a/node_modules/ajv/dist/refs/json-schema-2019-09/index.js b/node_modules/ajv/dist/refs/json-schema-2019-09/index.js deleted file mode 100644 index e864962..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2019-09/index.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const metaSchema = require("./schema.json"); -const applicator = require("./meta/applicator.json"); -const content = require("./meta/content.json"); -const core = require("./meta/core.json"); -const format = require("./meta/format.json"); -const metadata = require("./meta/meta-data.json"); -const validation = require("./meta/validation.json"); -const META_SUPPORT_DATA = ["/properties"]; -function addMetaSchema2019($data) { - ; - [ - metaSchema, - applicator, - content, - core, - with$data(this, format), - metadata, - with$data(this, validation), - ].forEach((sch) => this.addMetaSchema(sch, undefined, false)); - return this; - function with$data(ajv, sch) { - return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch; - } -} -exports.default = addMetaSchema2019; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map b/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map deleted file mode 100644 index 9b8a36d..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/refs/json-schema-2019-09/index.ts"],"names":[],"mappings":";;AAEA,4CAA2C;AAC3C,qDAAoD;AACpD,+CAA8C;AAC9C,yCAAwC;AACxC,6CAA4C;AAC5C,kDAAiD;AACjD,qDAAoD;AAEpD,MAAM,iBAAiB,GAAG,CAAC,aAAa,CAAC,CAAA;AAEzC,SAAwB,iBAAiB,CAAY,KAAe;IAClE,CAAC;IAAA;QACC,UAAU;QACV,UAAU;QACV,OAAO;QACP,IAAI;QACJ,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;QACvB,QAAQ;QACR,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC;KAC5B,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAA;IAC7D,OAAO,IAAI,CAAA;IAEX,SAAS,SAAS,CAAC,GAAQ,EAAE,GAAoB;QAC/C,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IAClE,CAAC;AACH,CAAC;AAfD,oCAeC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json b/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json deleted file mode 100644 index c5e91cf..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "https://json-schema.org/draft/2019-09/meta/applicator", - "$vocabulary": { - "https://json-schema.org/draft/2019-09/vocab/applicator": true - }, - "$recursiveAnchor": true, - - "title": "Applicator vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "additionalItems": {"$recursiveRef": "#"}, - "unevaluatedItems": {"$recursiveRef": "#"}, - "items": { - "anyOf": [{"$recursiveRef": "#"}, {"$ref": "#/$defs/schemaArray"}] - }, - "contains": {"$recursiveRef": "#"}, - "additionalProperties": {"$recursiveRef": "#"}, - "unevaluatedProperties": {"$recursiveRef": "#"}, - "properties": { - "type": "object", - "additionalProperties": {"$recursiveRef": "#"}, - "default": {} - }, - "patternProperties": { - "type": "object", - "additionalProperties": {"$recursiveRef": "#"}, - "propertyNames": {"format": "regex"}, - "default": {} - }, - "dependentSchemas": { - "type": "object", - "additionalProperties": { - "$recursiveRef": "#" - } - }, - "propertyNames": {"$recursiveRef": "#"}, - "if": {"$recursiveRef": "#"}, - "then": {"$recursiveRef": "#"}, - "else": {"$recursiveRef": "#"}, - "allOf": {"$ref": "#/$defs/schemaArray"}, - "anyOf": {"$ref": "#/$defs/schemaArray"}, - "oneOf": {"$ref": "#/$defs/schemaArray"}, - "not": {"$recursiveRef": "#"} - }, - "$defs": { - "schemaArray": { - "type": "array", - "minItems": 1, - "items": {"$recursiveRef": "#"} - } - } -} diff --git a/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json b/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json deleted file mode 100644 index b8f6373..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "https://json-schema.org/draft/2019-09/meta/content", - "$vocabulary": { - "https://json-schema.org/draft/2019-09/vocab/content": true - }, - "$recursiveAnchor": true, - - "title": "Content vocabulary meta-schema", - - "type": ["object", "boolean"], - "properties": { - "contentMediaType": {"type": "string"}, - "contentEncoding": {"type": "string"}, - "contentSchema": {"$recursiveRef": "#"} - } -} diff --git a/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json b/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json deleted file mode 100644 index f71adbf..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "https://json-schema.org/draft/2019-09/meta/core", - "$vocabulary": { - "https://json-schema.org/draft/2019-09/vocab/core": true - }, - "$recursiveAnchor": true, - - "title": "Core vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "$id": { - "type": "string", - "format": "uri-reference", - "$comment": "Non-empty fragments not allowed.", - "pattern": "^[^#]*#?$" - }, - "$schema": { - "type": "string", - "format": "uri" - }, - "$anchor": { - "type": "string", - "pattern": "^[A-Za-z][-A-Za-z0-9.:_]*$" - }, - "$ref": { - "type": "string", - "format": "uri-reference" - }, - "$recursiveRef": { - "type": "string", - "format": "uri-reference" - }, - "$recursiveAnchor": { - "type": "boolean", - "default": false - }, - "$vocabulary": { - "type": "object", - "propertyNames": { - "type": "string", - "format": "uri" - }, - "additionalProperties": { - "type": "boolean" - } - }, - "$comment": { - "type": "string" - }, - "$defs": { - "type": "object", - "additionalProperties": {"$recursiveRef": "#"}, - "default": {} - } - } -} diff --git a/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json b/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json deleted file mode 100644 index 03ccfce..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "https://json-schema.org/draft/2019-09/meta/format", - "$vocabulary": { - "https://json-schema.org/draft/2019-09/vocab/format": true - }, - "$recursiveAnchor": true, - - "title": "Format vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "format": {"type": "string"} - } -} diff --git a/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json b/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json deleted file mode 100644 index 0e19432..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "https://json-schema.org/draft/2019-09/meta/meta-data", - "$vocabulary": { - "https://json-schema.org/draft/2019-09/vocab/meta-data": true - }, - "$recursiveAnchor": true, - - "title": "Meta-data vocabulary meta-schema", - - "type": ["object", "boolean"], - "properties": { - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "default": true, - "deprecated": { - "type": "boolean", - "default": false - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "writeOnly": { - "type": "boolean", - "default": false - }, - "examples": { - "type": "array", - "items": true - } - } -} diff --git a/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json b/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json deleted file mode 100644 index 7027a12..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "https://json-schema.org/draft/2019-09/meta/validation", - "$vocabulary": { - "https://json-schema.org/draft/2019-09/vocab/validation": true - }, - "$recursiveAnchor": true, - - "title": "Validation vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "multipleOf": { - "type": "number", - "exclusiveMinimum": 0 - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "number" - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "number" - }, - "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, - "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, - "pattern": { - "type": "string", - "format": "regex" - }, - "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, - "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, - "minContains": { - "$ref": "#/$defs/nonNegativeInteger", - "default": 1 - }, - "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, - "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, - "required": {"$ref": "#/$defs/stringArray"}, - "dependentRequired": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/stringArray" - } - }, - "const": true, - "enum": { - "type": "array", - "items": true - }, - "type": { - "anyOf": [ - {"$ref": "#/$defs/simpleTypes"}, - { - "type": "array", - "items": {"$ref": "#/$defs/simpleTypes"}, - "minItems": 1, - "uniqueItems": true - } - ] - } - }, - "$defs": { - "nonNegativeInteger": { - "type": "integer", - "minimum": 0 - }, - "nonNegativeIntegerDefault0": { - "$ref": "#/$defs/nonNegativeInteger", - "default": 0 - }, - "simpleTypes": { - "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] - }, - "stringArray": { - "type": "array", - "items": {"type": "string"}, - "uniqueItems": true, - "default": [] - } - } -} diff --git a/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json b/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json deleted file mode 100644 index 54eb715..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "https://json-schema.org/draft/2019-09/schema", - "$vocabulary": { - "https://json-schema.org/draft/2019-09/vocab/core": true, - "https://json-schema.org/draft/2019-09/vocab/applicator": true, - "https://json-schema.org/draft/2019-09/vocab/validation": true, - "https://json-schema.org/draft/2019-09/vocab/meta-data": true, - "https://json-schema.org/draft/2019-09/vocab/format": false, - "https://json-schema.org/draft/2019-09/vocab/content": true - }, - "$recursiveAnchor": true, - - "title": "Core and Validation specifications meta-schema", - "allOf": [ - {"$ref": "meta/core"}, - {"$ref": "meta/applicator"}, - {"$ref": "meta/validation"}, - {"$ref": "meta/meta-data"}, - {"$ref": "meta/format"}, - {"$ref": "meta/content"} - ], - "type": ["object", "boolean"], - "properties": { - "definitions": { - "$comment": "While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.", - "type": "object", - "additionalProperties": {"$recursiveRef": "#"}, - "default": {} - }, - "dependencies": { - "$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"dependentSchemas\" and \"dependentRequired\"", - "type": "object", - "additionalProperties": { - "anyOf": [{"$recursiveRef": "#"}, {"$ref": "meta/validation#/$defs/stringArray"}] - } - } - } -} diff --git a/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts b/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts deleted file mode 100644 index c232ab0..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type Ajv from "../../core"; -export default function addMetaSchema2020(this: Ajv, $data?: boolean): Ajv; diff --git a/node_modules/ajv/dist/refs/json-schema-2020-12/index.js b/node_modules/ajv/dist/refs/json-schema-2020-12/index.js deleted file mode 100644 index d925675..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const metaSchema = require("./schema.json"); -const applicator = require("./meta/applicator.json"); -const unevaluated = require("./meta/unevaluated.json"); -const content = require("./meta/content.json"); -const core = require("./meta/core.json"); -const format = require("./meta/format-annotation.json"); -const metadata = require("./meta/meta-data.json"); -const validation = require("./meta/validation.json"); -const META_SUPPORT_DATA = ["/properties"]; -function addMetaSchema2020($data) { - ; - [ - metaSchema, - applicator, - unevaluated, - content, - core, - with$data(this, format), - metadata, - with$data(this, validation), - ].forEach((sch) => this.addMetaSchema(sch, undefined, false)); - return this; - function with$data(ajv, sch) { - return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch; - } -} -exports.default = addMetaSchema2020; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map b/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map deleted file mode 100644 index eb90027..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/refs/json-schema-2020-12/index.ts"],"names":[],"mappings":";;AAEA,4CAA2C;AAC3C,qDAAoD;AACpD,uDAAsD;AACtD,+CAA8C;AAC9C,yCAAwC;AACxC,wDAAuD;AACvD,kDAAiD;AACjD,qDAAoD;AAEpD,MAAM,iBAAiB,GAAG,CAAC,aAAa,CAAC,CAAA;AAEzC,SAAwB,iBAAiB,CAAY,KAAe;IAClE,CAAC;IAAA;QACC,UAAU;QACV,UAAU;QACV,WAAW;QACX,OAAO;QACP,IAAI;QACJ,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;QACvB,QAAQ;QACR,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC;KAC5B,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAA;IAC7D,OAAO,IAAI,CAAA;IAEX,SAAS,SAAS,CAAC,GAAQ,EAAE,GAAoB;QAC/C,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IAClE,CAAC;AACH,CAAC;AAhBD,oCAgBC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json b/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json deleted file mode 100644 index 674c913..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://json-schema.org/draft/2020-12/meta/applicator", - "$vocabulary": { - "https://json-schema.org/draft/2020-12/vocab/applicator": true - }, - "$dynamicAnchor": "meta", - - "title": "Applicator vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "prefixItems": {"$ref": "#/$defs/schemaArray"}, - "items": {"$dynamicRef": "#meta"}, - "contains": {"$dynamicRef": "#meta"}, - "additionalProperties": {"$dynamicRef": "#meta"}, - "properties": { - "type": "object", - "additionalProperties": {"$dynamicRef": "#meta"}, - "default": {} - }, - "patternProperties": { - "type": "object", - "additionalProperties": {"$dynamicRef": "#meta"}, - "propertyNames": {"format": "regex"}, - "default": {} - }, - "dependentSchemas": { - "type": "object", - "additionalProperties": {"$dynamicRef": "#meta"}, - "default": {} - }, - "propertyNames": {"$dynamicRef": "#meta"}, - "if": {"$dynamicRef": "#meta"}, - "then": {"$dynamicRef": "#meta"}, - "else": {"$dynamicRef": "#meta"}, - "allOf": {"$ref": "#/$defs/schemaArray"}, - "anyOf": {"$ref": "#/$defs/schemaArray"}, - "oneOf": {"$ref": "#/$defs/schemaArray"}, - "not": {"$dynamicRef": "#meta"} - }, - "$defs": { - "schemaArray": { - "type": "array", - "minItems": 1, - "items": {"$dynamicRef": "#meta"} - } - } -} diff --git a/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json b/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json deleted file mode 100644 index 2ae23dd..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://json-schema.org/draft/2020-12/meta/content", - "$vocabulary": { - "https://json-schema.org/draft/2020-12/vocab/content": true - }, - "$dynamicAnchor": "meta", - - "title": "Content vocabulary meta-schema", - - "type": ["object", "boolean"], - "properties": { - "contentEncoding": {"type": "string"}, - "contentMediaType": {"type": "string"}, - "contentSchema": {"$dynamicRef": "#meta"} - } -} diff --git a/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json b/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json deleted file mode 100644 index 4c8e5cb..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://json-schema.org/draft/2020-12/meta/core", - "$vocabulary": { - "https://json-schema.org/draft/2020-12/vocab/core": true - }, - "$dynamicAnchor": "meta", - - "title": "Core vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "$id": { - "$ref": "#/$defs/uriReferenceString", - "$comment": "Non-empty fragments not allowed.", - "pattern": "^[^#]*#?$" - }, - "$schema": {"$ref": "#/$defs/uriString"}, - "$ref": {"$ref": "#/$defs/uriReferenceString"}, - "$anchor": {"$ref": "#/$defs/anchorString"}, - "$dynamicRef": {"$ref": "#/$defs/uriReferenceString"}, - "$dynamicAnchor": {"$ref": "#/$defs/anchorString"}, - "$vocabulary": { - "type": "object", - "propertyNames": {"$ref": "#/$defs/uriString"}, - "additionalProperties": { - "type": "boolean" - } - }, - "$comment": { - "type": "string" - }, - "$defs": { - "type": "object", - "additionalProperties": {"$dynamicRef": "#meta"} - } - }, - "$defs": { - "anchorString": { - "type": "string", - "pattern": "^[A-Za-z_][-A-Za-z0-9._]*$" - }, - "uriString": { - "type": "string", - "format": "uri" - }, - "uriReferenceString": { - "type": "string", - "format": "uri-reference" - } - } -} diff --git a/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json b/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json deleted file mode 100644 index 83c26e3..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://json-schema.org/draft/2020-12/meta/format-annotation", - "$vocabulary": { - "https://json-schema.org/draft/2020-12/vocab/format-annotation": true - }, - "$dynamicAnchor": "meta", - - "title": "Format vocabulary meta-schema for annotation results", - "type": ["object", "boolean"], - "properties": { - "format": {"type": "string"} - } -} diff --git a/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json b/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json deleted file mode 100644 index 11946fb..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://json-schema.org/draft/2020-12/meta/meta-data", - "$vocabulary": { - "https://json-schema.org/draft/2020-12/vocab/meta-data": true - }, - "$dynamicAnchor": "meta", - - "title": "Meta-data vocabulary meta-schema", - - "type": ["object", "boolean"], - "properties": { - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "default": true, - "deprecated": { - "type": "boolean", - "default": false - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "writeOnly": { - "type": "boolean", - "default": false - }, - "examples": { - "type": "array", - "items": true - } - } -} diff --git a/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json b/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json deleted file mode 100644 index 5e4b203..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://json-schema.org/draft/2020-12/meta/unevaluated", - "$vocabulary": { - "https://json-schema.org/draft/2020-12/vocab/unevaluated": true - }, - "$dynamicAnchor": "meta", - - "title": "Unevaluated applicator vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "unevaluatedItems": {"$dynamicRef": "#meta"}, - "unevaluatedProperties": {"$dynamicRef": "#meta"} - } -} diff --git a/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json b/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json deleted file mode 100644 index e0ae13d..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://json-schema.org/draft/2020-12/meta/validation", - "$vocabulary": { - "https://json-schema.org/draft/2020-12/vocab/validation": true - }, - "$dynamicAnchor": "meta", - - "title": "Validation vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "type": { - "anyOf": [ - {"$ref": "#/$defs/simpleTypes"}, - { - "type": "array", - "items": {"$ref": "#/$defs/simpleTypes"}, - "minItems": 1, - "uniqueItems": true - } - ] - }, - "const": true, - "enum": { - "type": "array", - "items": true - }, - "multipleOf": { - "type": "number", - "exclusiveMinimum": 0 - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "number" - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "number" - }, - "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, - "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, - "pattern": { - "type": "string", - "format": "regex" - }, - "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, - "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, - "minContains": { - "$ref": "#/$defs/nonNegativeInteger", - "default": 1 - }, - "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, - "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, - "required": {"$ref": "#/$defs/stringArray"}, - "dependentRequired": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/stringArray" - } - } - }, - "$defs": { - "nonNegativeInteger": { - "type": "integer", - "minimum": 0 - }, - "nonNegativeIntegerDefault0": { - "$ref": "#/$defs/nonNegativeInteger", - "default": 0 - }, - "simpleTypes": { - "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] - }, - "stringArray": { - "type": "array", - "items": {"type": "string"}, - "uniqueItems": true, - "default": [] - } - } -} diff --git a/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json b/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json deleted file mode 100644 index 1c68270..0000000 --- a/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://json-schema.org/draft/2020-12/schema", - "$vocabulary": { - "https://json-schema.org/draft/2020-12/vocab/core": true, - "https://json-schema.org/draft/2020-12/vocab/applicator": true, - "https://json-schema.org/draft/2020-12/vocab/unevaluated": true, - "https://json-schema.org/draft/2020-12/vocab/validation": true, - "https://json-schema.org/draft/2020-12/vocab/meta-data": true, - "https://json-schema.org/draft/2020-12/vocab/format-annotation": true, - "https://json-schema.org/draft/2020-12/vocab/content": true - }, - "$dynamicAnchor": "meta", - - "title": "Core and Validation specifications meta-schema", - "allOf": [ - {"$ref": "meta/core"}, - {"$ref": "meta/applicator"}, - {"$ref": "meta/unevaluated"}, - {"$ref": "meta/validation"}, - {"$ref": "meta/meta-data"}, - {"$ref": "meta/format-annotation"}, - {"$ref": "meta/content"} - ], - "type": ["object", "boolean"], - "$comment": "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.", - "properties": { - "definitions": { - "$comment": "\"definitions\" has been replaced by \"$defs\".", - "type": "object", - "additionalProperties": {"$dynamicRef": "#meta"}, - "deprecated": true, - "default": {} - }, - "dependencies": { - "$comment": "\"dependencies\" has been split and replaced by \"dependentSchemas\" and \"dependentRequired\" in order to serve their differing semantics.", - "type": "object", - "additionalProperties": { - "anyOf": [{"$dynamicRef": "#meta"}, {"$ref": "meta/validation#/$defs/stringArray"}] - }, - "deprecated": true, - "default": {} - }, - "$recursiveAnchor": { - "$comment": "\"$recursiveAnchor\" has been replaced by \"$dynamicAnchor\".", - "$ref": "meta/core#/$defs/anchorString", - "deprecated": true - }, - "$recursiveRef": { - "$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".", - "$ref": "meta/core#/$defs/uriReferenceString", - "deprecated": true - } - } -} diff --git a/node_modules/ajv/dist/refs/json-schema-draft-06.json b/node_modules/ajv/dist/refs/json-schema-draft-06.json deleted file mode 100644 index 5410064..0000000 --- a/node_modules/ajv/dist/refs/json-schema-draft-06.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-06/schema#", - "$id": "http://json-schema.org/draft-06/schema#", - "title": "Core schema meta-schema", - "definitions": { - "schemaArray": { - "type": "array", - "minItems": 1, - "items": {"$ref": "#"} - }, - "nonNegativeInteger": { - "type": "integer", - "minimum": 0 - }, - "nonNegativeIntegerDefault0": { - "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] - }, - "simpleTypes": { - "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] - }, - "stringArray": { - "type": "array", - "items": {"type": "string"}, - "uniqueItems": true, - "default": [] - } - }, - "type": ["object", "boolean"], - "properties": { - "$id": { - "type": "string", - "format": "uri-reference" - }, - "$schema": { - "type": "string", - "format": "uri" - }, - "$ref": { - "type": "string", - "format": "uri-reference" - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "default": {}, - "examples": { - "type": "array", - "items": {} - }, - "multipleOf": { - "type": "number", - "exclusiveMinimum": 0 - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "number" - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "number" - }, - "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, - "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, - "pattern": { - "type": "string", - "format": "regex" - }, - "additionalItems": {"$ref": "#"}, - "items": { - "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], - "default": {} - }, - "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, - "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "contains": {"$ref": "#"}, - "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, - "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, - "required": {"$ref": "#/definitions/stringArray"}, - "additionalProperties": {"$ref": "#"}, - "definitions": { - "type": "object", - "additionalProperties": {"$ref": "#"}, - "default": {} - }, - "properties": { - "type": "object", - "additionalProperties": {"$ref": "#"}, - "default": {} - }, - "patternProperties": { - "type": "object", - "additionalProperties": {"$ref": "#"}, - "default": {} - }, - "dependencies": { - "type": "object", - "additionalProperties": { - "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] - } - }, - "propertyNames": {"$ref": "#"}, - "const": {}, - "enum": { - "type": "array", - "minItems": 1, - "uniqueItems": true - }, - "type": { - "anyOf": [ - {"$ref": "#/definitions/simpleTypes"}, - { - "type": "array", - "items": {"$ref": "#/definitions/simpleTypes"}, - "minItems": 1, - "uniqueItems": true - } - ] - }, - "format": {"type": "string"}, - "allOf": {"$ref": "#/definitions/schemaArray"}, - "anyOf": {"$ref": "#/definitions/schemaArray"}, - "oneOf": {"$ref": "#/definitions/schemaArray"}, - "not": {"$ref": "#"} - }, - "default": {} -} diff --git a/node_modules/ajv/dist/refs/json-schema-draft-07.json b/node_modules/ajv/dist/refs/json-schema-draft-07.json deleted file mode 100644 index 6a74851..0000000 --- a/node_modules/ajv/dist/refs/json-schema-draft-07.json +++ /dev/null @@ -1,151 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://json-schema.org/draft-07/schema#", - "title": "Core schema meta-schema", - "definitions": { - "schemaArray": { - "type": "array", - "minItems": 1, - "items": {"$ref": "#"} - }, - "nonNegativeInteger": { - "type": "integer", - "minimum": 0 - }, - "nonNegativeIntegerDefault0": { - "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] - }, - "simpleTypes": { - "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] - }, - "stringArray": { - "type": "array", - "items": {"type": "string"}, - "uniqueItems": true, - "default": [] - } - }, - "type": ["object", "boolean"], - "properties": { - "$id": { - "type": "string", - "format": "uri-reference" - }, - "$schema": { - "type": "string", - "format": "uri" - }, - "$ref": { - "type": "string", - "format": "uri-reference" - }, - "$comment": { - "type": "string" - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "default": true, - "readOnly": { - "type": "boolean", - "default": false - }, - "examples": { - "type": "array", - "items": true - }, - "multipleOf": { - "type": "number", - "exclusiveMinimum": 0 - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "number" - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "number" - }, - "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, - "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, - "pattern": { - "type": "string", - "format": "regex" - }, - "additionalItems": {"$ref": "#"}, - "items": { - "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], - "default": true - }, - "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, - "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "contains": {"$ref": "#"}, - "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, - "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, - "required": {"$ref": "#/definitions/stringArray"}, - "additionalProperties": {"$ref": "#"}, - "definitions": { - "type": "object", - "additionalProperties": {"$ref": "#"}, - "default": {} - }, - "properties": { - "type": "object", - "additionalProperties": {"$ref": "#"}, - "default": {} - }, - "patternProperties": { - "type": "object", - "additionalProperties": {"$ref": "#"}, - "propertyNames": {"format": "regex"}, - "default": {} - }, - "dependencies": { - "type": "object", - "additionalProperties": { - "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] - } - }, - "propertyNames": {"$ref": "#"}, - "const": true, - "enum": { - "type": "array", - "items": true, - "minItems": 1, - "uniqueItems": true - }, - "type": { - "anyOf": [ - {"$ref": "#/definitions/simpleTypes"}, - { - "type": "array", - "items": {"$ref": "#/definitions/simpleTypes"}, - "minItems": 1, - "uniqueItems": true - } - ] - }, - "format": {"type": "string"}, - "contentMediaType": {"type": "string"}, - "contentEncoding": {"type": "string"}, - "if": {"$ref": "#"}, - "then": {"$ref": "#"}, - "else": {"$ref": "#"}, - "allOf": {"$ref": "#/definitions/schemaArray"}, - "anyOf": {"$ref": "#/definitions/schemaArray"}, - "oneOf": {"$ref": "#/definitions/schemaArray"}, - "not": {"$ref": "#"} - }, - "default": true -} diff --git a/node_modules/ajv/dist/refs/json-schema-secure.json b/node_modules/ajv/dist/refs/json-schema-secure.json deleted file mode 100644 index 3968abd..0000000 --- a/node_modules/ajv/dist/refs/json-schema-secure.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/json-schema-secure.json#", - "title": "Meta-schema for the security assessment of JSON Schemas", - "description": "If a JSON AnySchema fails validation against this meta-schema, it may be unsafe to validate untrusted data", - "definitions": { - "schemaArray": { - "type": "array", - "minItems": 1, - "items": {"$ref": "#"} - } - }, - "dependencies": { - "patternProperties": { - "description": "prevent slow validation of large property names", - "required": ["propertyNames"], - "properties": { - "propertyNames": { - "required": ["maxLength"] - } - } - }, - "uniqueItems": { - "description": "prevent slow validation of large non-scalar arrays", - "if": { - "properties": { - "uniqueItems": {"const": true}, - "items": { - "properties": { - "type": { - "anyOf": [ - { - "enum": ["object", "array"] - }, - { - "type": "array", - "contains": {"enum": ["object", "array"]} - } - ] - } - } - } - } - }, - "then": { - "required": ["maxItems"] - } - }, - "pattern": { - "description": "prevent slow pattern matching of large strings", - "required": ["maxLength"] - }, - "format": { - "description": "prevent slow format validation of large strings", - "required": ["maxLength"] - } - }, - "properties": { - "additionalItems": {"$ref": "#"}, - "additionalProperties": {"$ref": "#"}, - "dependencies": { - "additionalProperties": { - "anyOf": [{"type": "array"}, {"$ref": "#"}] - } - }, - "items": { - "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}] - }, - "definitions": { - "additionalProperties": {"$ref": "#"} - }, - "patternProperties": { - "additionalProperties": {"$ref": "#"} - }, - "properties": { - "additionalProperties": {"$ref": "#"} - }, - "if": {"$ref": "#"}, - "then": {"$ref": "#"}, - "else": {"$ref": "#"}, - "allOf": {"$ref": "#/definitions/schemaArray"}, - "anyOf": {"$ref": "#/definitions/schemaArray"}, - "oneOf": {"$ref": "#/definitions/schemaArray"}, - "not": {"$ref": "#"}, - "contains": {"$ref": "#"}, - "propertyNames": {"$ref": "#"} - } -} diff --git a/node_modules/ajv/dist/refs/jtd-schema.d.ts b/node_modules/ajv/dist/refs/jtd-schema.d.ts deleted file mode 100644 index 932797a..0000000 --- a/node_modules/ajv/dist/refs/jtd-schema.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { SchemaObject } from "../types"; -declare const jtdMetaSchema: SchemaObject; -export default jtdMetaSchema; diff --git a/node_modules/ajv/dist/refs/jtd-schema.js b/node_modules/ajv/dist/refs/jtd-schema.js deleted file mode 100644 index 1ee940a..0000000 --- a/node_modules/ajv/dist/refs/jtd-schema.js +++ /dev/null @@ -1,118 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const shared = (root) => { - const sch = { - nullable: { type: "boolean" }, - metadata: { - optionalProperties: { - union: { elements: { ref: "schema" } }, - }, - additionalProperties: true, - }, - }; - if (root) - sch.definitions = { values: { ref: "schema" } }; - return sch; -}; -const emptyForm = (root) => ({ - optionalProperties: shared(root), -}); -const refForm = (root) => ({ - properties: { - ref: { type: "string" }, - }, - optionalProperties: shared(root), -}); -const typeForm = (root) => ({ - properties: { - type: { - enum: [ - "boolean", - "timestamp", - "string", - "float32", - "float64", - "int8", - "uint8", - "int16", - "uint16", - "int32", - "uint32", - ], - }, - }, - optionalProperties: shared(root), -}); -const enumForm = (root) => ({ - properties: { - enum: { elements: { type: "string" } }, - }, - optionalProperties: shared(root), -}); -const elementsForm = (root) => ({ - properties: { - elements: { ref: "schema" }, - }, - optionalProperties: shared(root), -}); -const propertiesForm = (root) => ({ - properties: { - properties: { values: { ref: "schema" } }, - }, - optionalProperties: { - optionalProperties: { values: { ref: "schema" } }, - additionalProperties: { type: "boolean" }, - ...shared(root), - }, -}); -const optionalPropertiesForm = (root) => ({ - properties: { - optionalProperties: { values: { ref: "schema" } }, - }, - optionalProperties: { - additionalProperties: { type: "boolean" }, - ...shared(root), - }, -}); -const discriminatorForm = (root) => ({ - properties: { - discriminator: { type: "string" }, - mapping: { - values: { - metadata: { - union: [propertiesForm(false), optionalPropertiesForm(false)], - }, - }, - }, - }, - optionalProperties: shared(root), -}); -const valuesForm = (root) => ({ - properties: { - values: { ref: "schema" }, - }, - optionalProperties: shared(root), -}); -const schema = (root) => ({ - metadata: { - union: [ - emptyForm, - refForm, - typeForm, - enumForm, - elementsForm, - propertiesForm, - optionalPropertiesForm, - discriminatorForm, - valuesForm, - ].map((s) => s(root)), - }, -}); -const jtdMetaSchema = { - definitions: { - schema: schema(false), - }, - ...schema(true), -}; -exports.default = jtdMetaSchema; -//# sourceMappingURL=jtd-schema.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/refs/jtd-schema.js.map b/node_modules/ajv/dist/refs/jtd-schema.js.map deleted file mode 100644 index d46755b..0000000 --- a/node_modules/ajv/dist/refs/jtd-schema.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"jtd-schema.js","sourceRoot":"","sources":["../../lib/refs/jtd-schema.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAe,CAAC,IAAI,EAAE,EAAE;IAClC,MAAM,GAAG,GAAiB;QACxB,QAAQ,EAAE,EAAC,IAAI,EAAE,SAAS,EAAC;QAC3B,QAAQ,EAAE;YACR,kBAAkB,EAAE;gBAClB,KAAK,EAAE,EAAC,QAAQ,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC,EAAC;aACnC;YACD,oBAAoB,EAAE,IAAI;SAC3B;KACF,CAAA;IACD,IAAI,IAAI;QAAE,GAAG,CAAC,WAAW,GAAG,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC,EAAC,CAAA;IACrD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,SAAS,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACvC,kBAAkB,EAAE,MAAM,CAAC,IAAI,CAAC;CACjC,CAAC,CAAA;AAEF,MAAM,OAAO,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACrC,UAAU,EAAE;QACV,GAAG,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;KACtB;IACD,kBAAkB,EAAE,MAAM,CAAC,IAAI,CAAC;CACjC,CAAC,CAAA;AAEF,MAAM,QAAQ,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACtC,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,SAAS;gBACT,WAAW;gBACX,QAAQ;gBACR,SAAS;gBACT,SAAS;gBACT,MAAM;gBACN,OAAO;gBACP,OAAO;gBACP,QAAQ;gBACR,OAAO;gBACP,QAAQ;aACT;SACF;KACF;IACD,kBAAkB,EAAE,MAAM,CAAC,IAAI,CAAC;CACjC,CAAC,CAAA;AAEF,MAAM,QAAQ,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACtC,UAAU,EAAE;QACV,IAAI,EAAE,EAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAC;KACnC;IACD,kBAAkB,EAAE,MAAM,CAAC,IAAI,CAAC;CACjC,CAAC,CAAA;AAEF,MAAM,YAAY,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC1C,UAAU,EAAE;QACV,QAAQ,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC;KAC1B;IACD,kBAAkB,EAAE,MAAM,CAAC,IAAI,CAAC;CACjC,CAAC,CAAA;AAEF,MAAM,cAAc,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC5C,UAAU,EAAE;QACV,UAAU,EAAE,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC,EAAC;KACtC;IACD,kBAAkB,EAAE;QAClB,kBAAkB,EAAE,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC,EAAC;QAC7C,oBAAoB,EAAE,EAAC,IAAI,EAAE,SAAS,EAAC;QACvC,GAAG,MAAM,CAAC,IAAI,CAAC;KAChB;CACF,CAAC,CAAA;AAEF,MAAM,sBAAsB,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACpD,UAAU,EAAE;QACV,kBAAkB,EAAE,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC,EAAC;KAC9C;IACD,kBAAkB,EAAE;QAClB,oBAAoB,EAAE,EAAC,IAAI,EAAE,SAAS,EAAC;QACvC,GAAG,MAAM,CAAC,IAAI,CAAC;KAChB;CACF,CAAC,CAAA;AAEF,MAAM,iBAAiB,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC/C,UAAU,EAAE;QACV,aAAa,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC/B,OAAO,EAAE;YACP,MAAM,EAAE;gBACN,QAAQ,EAAE;oBACR,KAAK,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAC;iBAC9D;aACF;SACF;KACF;IACD,kBAAkB,EAAE,MAAM,CAAC,IAAI,CAAC;CACjC,CAAC,CAAA;AAEF,MAAM,UAAU,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACxC,UAAU,EAAE;QACV,MAAM,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC;KACxB;IACD,kBAAkB,EAAE,MAAM,CAAC,IAAI,CAAC;CACjC,CAAC,CAAA;AAEF,MAAM,MAAM,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACpC,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,SAAS;YACT,OAAO;YACP,QAAQ;YACR,QAAQ;YACR,YAAY;YACZ,cAAc;YACd,sBAAsB;YACtB,iBAAiB;YACjB,UAAU;SACX,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;KACtB;CACF,CAAC,CAAA;AAEF,MAAM,aAAa,GAAiB;IAClC,WAAW,EAAE;QACX,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC;KACtB;IACD,GAAG,MAAM,CAAC,IAAI,CAAC;CAChB,CAAA;AAED,kBAAe,aAAa,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/runtime/equal.d.ts b/node_modules/ajv/dist/runtime/equal.d.ts deleted file mode 100644 index 777cae2..0000000 --- a/node_modules/ajv/dist/runtime/equal.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as equal from "fast-deep-equal"; -type Equal = typeof equal & { - code: string; -}; -declare const _default: Equal; -export default _default; diff --git a/node_modules/ajv/dist/runtime/equal.js b/node_modules/ajv/dist/runtime/equal.js deleted file mode 100644 index 774bba0..0000000 --- a/node_modules/ajv/dist/runtime/equal.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// https://github.com/ajv-validator/ajv/issues/889 -const equal = require("fast-deep-equal"); -equal.code = 'require("ajv/dist/runtime/equal").default'; -exports.default = equal; -//# sourceMappingURL=equal.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/runtime/equal.js.map b/node_modules/ajv/dist/runtime/equal.js.map deleted file mode 100644 index 0e17901..0000000 --- a/node_modules/ajv/dist/runtime/equal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"equal.js","sourceRoot":"","sources":["../../lib/runtime/equal.ts"],"names":[],"mappings":";;AAAA,kDAAkD;AAClD,yCAAwC;AAGtC,KAAe,CAAC,IAAI,GAAG,2CAA2C,CAAA;AAEpE,kBAAe,KAAc,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/runtime/parseJson.d.ts b/node_modules/ajv/dist/runtime/parseJson.d.ts deleted file mode 100644 index 85f1d56..0000000 --- a/node_modules/ajv/dist/runtime/parseJson.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -export declare function parseJson(s: string, pos: number): unknown; -export declare namespace parseJson { - var message: string | undefined; - var position: number; - var code: string; -} -export declare function parseJsonNumber(s: string, pos: number, maxDigits?: number): number | undefined; -export declare namespace parseJsonNumber { - var message: string | undefined; - var position: number; - var code: string; -} -export declare function parseJsonString(s: string, pos: number): string | undefined; -export declare namespace parseJsonString { - var message: string | undefined; - var position: number; - var code: string; -} diff --git a/node_modules/ajv/dist/runtime/parseJson.js b/node_modules/ajv/dist/runtime/parseJson.js deleted file mode 100644 index eaa2838..0000000 --- a/node_modules/ajv/dist/runtime/parseJson.js +++ /dev/null @@ -1,185 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.parseJsonString = exports.parseJsonNumber = exports.parseJson = void 0; -const rxParseJson = /position\s(\d+)(?: \(line \d+ column \d+\))?$/; -function parseJson(s, pos) { - let endPos; - parseJson.message = undefined; - let matches; - if (pos) - s = s.slice(pos); - try { - parseJson.position = pos + s.length; - return JSON.parse(s); - } - catch (e) { - matches = rxParseJson.exec(e.message); - if (!matches) { - parseJson.message = "unexpected end"; - return undefined; - } - endPos = +matches[1]; - const c = s[endPos]; - s = s.slice(0, endPos); - parseJson.position = pos + endPos; - try { - return JSON.parse(s); - } - catch (e1) { - parseJson.message = `unexpected token ${c}`; - return undefined; - } - } -} -exports.parseJson = parseJson; -parseJson.message = undefined; -parseJson.position = 0; -parseJson.code = 'require("ajv/dist/runtime/parseJson").parseJson'; -function parseJsonNumber(s, pos, maxDigits) { - let numStr = ""; - let c; - parseJsonNumber.message = undefined; - if (s[pos] === "-") { - numStr += "-"; - pos++; - } - if (s[pos] === "0") { - numStr += "0"; - pos++; - } - else { - if (!parseDigits(maxDigits)) { - errorMessage(); - return undefined; - } - } - if (maxDigits) { - parseJsonNumber.position = pos; - return +numStr; - } - if (s[pos] === ".") { - numStr += "."; - pos++; - if (!parseDigits()) { - errorMessage(); - return undefined; - } - } - if (((c = s[pos]), c === "e" || c === "E")) { - numStr += "e"; - pos++; - if (((c = s[pos]), c === "+" || c === "-")) { - numStr += c; - pos++; - } - if (!parseDigits()) { - errorMessage(); - return undefined; - } - } - parseJsonNumber.position = pos; - return +numStr; - function parseDigits(maxLen) { - let digit = false; - while (((c = s[pos]), c >= "0" && c <= "9" && (maxLen === undefined || maxLen-- > 0))) { - digit = true; - numStr += c; - pos++; - } - return digit; - } - function errorMessage() { - parseJsonNumber.position = pos; - parseJsonNumber.message = pos < s.length ? `unexpected token ${s[pos]}` : "unexpected end"; - } -} -exports.parseJsonNumber = parseJsonNumber; -parseJsonNumber.message = undefined; -parseJsonNumber.position = 0; -parseJsonNumber.code = 'require("ajv/dist/runtime/parseJson").parseJsonNumber'; -const escapedChars = { - b: "\b", - f: "\f", - n: "\n", - r: "\r", - t: "\t", - '"': '"', - "/": "/", - "\\": "\\", -}; -const CODE_A = "a".charCodeAt(0); -const CODE_0 = "0".charCodeAt(0); -function parseJsonString(s, pos) { - let str = ""; - let c; - parseJsonString.message = undefined; - // eslint-disable-next-line no-constant-condition, @typescript-eslint/no-unnecessary-condition - while (true) { - c = s[pos++]; - if (c === '"') - break; - if (c === "\\") { - c = s[pos]; - if (c in escapedChars) { - str += escapedChars[c]; - pos++; - } - else if (c === "u") { - pos++; - let count = 4; - let code = 0; - while (count--) { - code <<= 4; - c = s[pos]; - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (c === undefined) { - errorMessage("unexpected end"); - return undefined; - } - c = c.toLowerCase(); - if (c >= "a" && c <= "f") { - code += c.charCodeAt(0) - CODE_A + 10; - } - else if (c >= "0" && c <= "9") { - code += c.charCodeAt(0) - CODE_0; - } - else { - errorMessage(`unexpected token ${c}`); - return undefined; - } - pos++; - } - str += String.fromCharCode(code); - } - else { - errorMessage(`unexpected token ${c}`); - return undefined; - } - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - } - else if (c === undefined) { - errorMessage("unexpected end"); - return undefined; - } - else { - if (c.charCodeAt(0) >= 0x20) { - str += c; - } - else { - errorMessage(`unexpected token ${c}`); - return undefined; - } - } - } - parseJsonString.position = pos; - return str; - function errorMessage(msg) { - parseJsonString.position = pos; - parseJsonString.message = msg; - } -} -exports.parseJsonString = parseJsonString; -parseJsonString.message = undefined; -parseJsonString.position = 0; -parseJsonString.code = 'require("ajv/dist/runtime/parseJson").parseJsonString'; -//# sourceMappingURL=parseJson.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/runtime/parseJson.js.map b/node_modules/ajv/dist/runtime/parseJson.js.map deleted file mode 100644 index 7c125f8..0000000 --- a/node_modules/ajv/dist/runtime/parseJson.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parseJson.js","sourceRoot":"","sources":["../../lib/runtime/parseJson.ts"],"names":[],"mappings":";;;AAAA,MAAM,WAAW,GAAG,+CAA+C,CAAA;AAEnE,SAAgB,SAAS,CAAC,CAAS,EAAE,GAAW;IAC9C,IAAI,MAA0B,CAAA;IAC9B,SAAS,CAAC,OAAO,GAAG,SAAS,CAAA;IAC7B,IAAI,OAA+B,CAAA;IACnC,IAAI,GAAG;QAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACzB,IAAI,CAAC;QACH,SAAS,CAAC,QAAQ,GAAG,GAAG,GAAG,CAAC,CAAC,MAAM,CAAA;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACtB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,GAAG,WAAW,CAAC,IAAI,CAAE,CAAW,CAAC,OAAO,CAAC,CAAA;QAChD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,SAAS,CAAC,OAAO,GAAG,gBAAgB,CAAA;YACpC,OAAO,SAAS,CAAA;QAClB,CAAC;QACD,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;QACpB,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAA;QACnB,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;QACtB,SAAS,CAAC,QAAQ,GAAG,GAAG,GAAG,MAAM,CAAA;QACjC,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QACtB,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC;YACZ,SAAS,CAAC,OAAO,GAAG,oBAAoB,CAAC,EAAE,CAAA;YAC3C,OAAO,SAAS,CAAA;QAClB,CAAC;IACH,CAAC;AACH,CAAC;AAzBD,8BAyBC;AAED,SAAS,CAAC,OAAO,GAAG,SAA+B,CAAA;AACnD,SAAS,CAAC,QAAQ,GAAG,CAAW,CAAA;AAChC,SAAS,CAAC,IAAI,GAAG,iDAAiD,CAAA;AAElE,SAAgB,eAAe,CAAC,CAAS,EAAE,GAAW,EAAE,SAAkB;IACxE,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,IAAI,CAAS,CAAA;IACb,eAAe,CAAC,OAAO,GAAG,SAAS,CAAA;IACnC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC;QACnB,MAAM,IAAI,GAAG,CAAA;QACb,GAAG,EAAE,CAAA;IACP,CAAC;IACD,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC;QACnB,MAAM,IAAI,GAAG,CAAA;QACb,GAAG,EAAE,CAAA;IACP,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5B,YAAY,EAAE,CAAA;YACd,OAAO,SAAS,CAAA;QAClB,CAAC;IACH,CAAC;IACD,IAAI,SAAS,EAAE,CAAC;QACd,eAAe,CAAC,QAAQ,GAAG,GAAG,CAAA;QAC9B,OAAO,CAAC,MAAM,CAAA;IAChB,CAAC;IACD,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC;QACnB,MAAM,IAAI,GAAG,CAAA;QACb,GAAG,EAAE,CAAA;QACL,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACnB,YAAY,EAAE,CAAA;YACd,OAAO,SAAS,CAAA;QAClB,CAAC;IACH,CAAC;IACD,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,GAAG,CAAA;QACb,GAAG,EAAE,CAAA;QACL,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;YAC3C,MAAM,IAAI,CAAC,CAAA;YACX,GAAG,EAAE,CAAA;QACP,CAAC;QACD,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACnB,YAAY,EAAE,CAAA;YACd,OAAO,SAAS,CAAA;QAClB,CAAC;IACH,CAAC;IACD,eAAe,CAAC,QAAQ,GAAG,GAAG,CAAA;IAC9B,OAAO,CAAC,MAAM,CAAA;IAEd,SAAS,WAAW,CAAC,MAAe;QAClC,IAAI,KAAK,GAAG,KAAK,CAAA;QACjB,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACtF,KAAK,GAAG,IAAI,CAAA;YACZ,MAAM,IAAI,CAAC,CAAA;YACX,GAAG,EAAE,CAAA;QACP,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,SAAS,YAAY;QACnB,eAAe,CAAC,QAAQ,GAAG,GAAG,CAAA;QAC9B,eAAe,CAAC,OAAO,GAAG,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAA;IAC5F,CAAC;AACH,CAAC;AA1DD,0CA0DC;AAED,eAAe,CAAC,OAAO,GAAG,SAA+B,CAAA;AACzD,eAAe,CAAC,QAAQ,GAAG,CAAW,CAAA;AACtC,eAAe,CAAC,IAAI,GAAG,uDAAuD,CAAA;AAE9E,MAAM,YAAY,GAA6B;IAC7C,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,IAAI;IACP,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,IAAI,EAAE,IAAI;CACX,CAAA;AAED,MAAM,MAAM,GAAW,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;AACxC,MAAM,MAAM,GAAW,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;AAExC,SAAgB,eAAe,CAAC,CAAS,EAAE,GAAW;IACpD,IAAI,GAAG,GAAG,EAAE,CAAA;IACZ,IAAI,CAAqB,CAAA;IACzB,eAAe,CAAC,OAAO,GAAG,SAAS,CAAA;IACnC,8FAA8F;IAC9F,OAAO,IAAI,EAAE,CAAC;QACZ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAA;QACZ,IAAI,CAAC,KAAK,GAAG;YAAE,MAAK;QACpB,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YACf,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;YACV,IAAI,CAAC,IAAI,YAAY,EAAE,CAAC;gBACtB,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAA;gBACtB,GAAG,EAAE,CAAA;YACP,CAAC;iBAAM,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;gBACrB,GAAG,EAAE,CAAA;gBACL,IAAI,KAAK,GAAG,CAAC,CAAA;gBACb,IAAI,IAAI,GAAG,CAAC,CAAA;gBACZ,OAAO,KAAK,EAAE,EAAE,CAAC;oBACf,IAAI,KAAK,CAAC,CAAA;oBACV,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;oBACV,uEAAuE;oBACvE,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;wBACpB,YAAY,CAAC,gBAAgB,CAAC,CAAA;wBAC9B,OAAO,SAAS,CAAA;oBAClB,CAAC;oBACD,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAA;oBACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;wBACzB,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,EAAE,CAAA;oBACvC,CAAC;yBAAM,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;wBAChC,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,CAAA;oBAClC,CAAC;yBAAM,CAAC;wBACN,YAAY,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAA;wBACrC,OAAO,SAAS,CAAA;oBAClB,CAAC;oBACD,GAAG,EAAE,CAAA;gBACP,CAAC;gBACD,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;YAClC,CAAC;iBAAM,CAAC;gBACN,YAAY,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAA;gBACrC,OAAO,SAAS,CAAA;YAClB,CAAC;YACD,uEAAuE;QACzE,CAAC;aAAM,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YAC3B,YAAY,CAAC,gBAAgB,CAAC,CAAA;YAC9B,OAAO,SAAS,CAAA;QAClB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;gBAC5B,GAAG,IAAI,CAAC,CAAA;YACV,CAAC;iBAAM,CAAC;gBACN,YAAY,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAA;gBACrC,OAAO,SAAS,CAAA;YAClB,CAAC;QACH,CAAC;IACH,CAAC;IACD,eAAe,CAAC,QAAQ,GAAG,GAAG,CAAA;IAC9B,OAAO,GAAG,CAAA;IAEV,SAAS,YAAY,CAAC,GAAW;QAC/B,eAAe,CAAC,QAAQ,GAAG,GAAG,CAAA;QAC9B,eAAe,CAAC,OAAO,GAAG,GAAG,CAAA;IAC/B,CAAC;AACH,CAAC;AA7DD,0CA6DC;AAED,eAAe,CAAC,OAAO,GAAG,SAA+B,CAAA;AACzD,eAAe,CAAC,QAAQ,GAAG,CAAW,CAAA;AACtC,eAAe,CAAC,IAAI,GAAG,uDAAuD,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/runtime/quote.d.ts b/node_modules/ajv/dist/runtime/quote.d.ts deleted file mode 100644 index 0579dd3..0000000 --- a/node_modules/ajv/dist/runtime/quote.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare function quote(s: string): string; -declare namespace quote { - var code: string; -} -export default quote; diff --git a/node_modules/ajv/dist/runtime/quote.js b/node_modules/ajv/dist/runtime/quote.js deleted file mode 100644 index ebf78f7..0000000 --- a/node_modules/ajv/dist/runtime/quote.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const rxEscapable = -// eslint-disable-next-line no-control-regex, no-misleading-character-class -/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; -const escaped = { - "\b": "\\b", - "\t": "\\t", - "\n": "\\n", - "\f": "\\f", - "\r": "\\r", - '"': '\\"', - "\\": "\\\\", -}; -function quote(s) { - rxEscapable.lastIndex = 0; - return ('"' + - (rxEscapable.test(s) - ? s.replace(rxEscapable, (a) => { - const c = escaped[a]; - return typeof c === "string" - ? c - : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4); - }) - : s) + - '"'); -} -exports.default = quote; -quote.code = 'require("ajv/dist/runtime/quote").default'; -//# sourceMappingURL=quote.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/runtime/quote.js.map b/node_modules/ajv/dist/runtime/quote.js.map deleted file mode 100644 index 4d22625..0000000 --- a/node_modules/ajv/dist/runtime/quote.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"quote.js","sourceRoot":"","sources":["../../lib/runtime/quote.ts"],"names":[],"mappings":";;AAAA,MAAM,WAAW;AACf,2EAA2E;AAC3E,iIAAiI,CAAA;AAEnI,MAAM,OAAO,GAA6B;IACxC,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACb,CAAA;AAED,SAAwB,KAAK,CAAC,CAAS;IACrC,WAAW,CAAC,SAAS,GAAG,CAAC,CAAA;IACzB,OAAO,CACL,GAAG;QACH,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE;gBAC3B,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;gBACpB,OAAO,OAAO,CAAC,KAAK,QAAQ;oBAC1B,CAAC,CAAC,CAAC;oBACH,CAAC,CAAC,KAAK,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YAC/D,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC,CAAC;QACN,GAAG,CACJ,CAAA;AACH,CAAC;AAdD,wBAcC;AAED,KAAK,CAAC,IAAI,GAAG,2CAA2C,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/runtime/re2.d.ts b/node_modules/ajv/dist/runtime/re2.d.ts deleted file mode 100644 index c34a98f..0000000 --- a/node_modules/ajv/dist/runtime/re2.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as re2 from "re2"; -type Re2 = typeof re2 & { - code: string; -}; -declare const _default: Re2; -export default _default; diff --git a/node_modules/ajv/dist/runtime/re2.js b/node_modules/ajv/dist/runtime/re2.js deleted file mode 100644 index 4b1ee25..0000000 --- a/node_modules/ajv/dist/runtime/re2.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const re2 = require("re2"); -re2.code = 'require("ajv/dist/runtime/re2").default'; -exports.default = re2; -//# sourceMappingURL=re2.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/runtime/re2.js.map b/node_modules/ajv/dist/runtime/re2.js.map deleted file mode 100644 index bb938a2..0000000 --- a/node_modules/ajv/dist/runtime/re2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"re2.js","sourceRoot":"","sources":["../../lib/runtime/re2.ts"],"names":[],"mappings":";;AAAA,2BAA0B;AAGxB,GAAW,CAAC,IAAI,GAAG,yCAAyC,CAAA;AAE9D,kBAAe,GAAU,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/runtime/timestamp.d.ts b/node_modules/ajv/dist/runtime/timestamp.d.ts deleted file mode 100644 index cd48326..0000000 --- a/node_modules/ajv/dist/runtime/timestamp.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare function validTimestamp(str: string, allowDate: boolean): boolean; -declare namespace validTimestamp { - var code: string; -} -export default validTimestamp; diff --git a/node_modules/ajv/dist/runtime/timestamp.js b/node_modules/ajv/dist/runtime/timestamp.js deleted file mode 100644 index 5e0f065..0000000 --- a/node_modules/ajv/dist/runtime/timestamp.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const DT_SEPARATOR = /t|\s/i; -const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/; -const TIME = /^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:z|([+-]\d\d)(?::?(\d\d))?)$/i; -const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; -function validTimestamp(str, allowDate) { - // http://tools.ietf.org/html/rfc3339#section-5.6 - const dt = str.split(DT_SEPARATOR); - return ((dt.length === 2 && validDate(dt[0]) && validTime(dt[1])) || - (allowDate && dt.length === 1 && validDate(dt[0]))); -} -exports.default = validTimestamp; -function validDate(str) { - const matches = DATE.exec(str); - if (!matches) - return false; - const y = +matches[1]; - const m = +matches[2]; - const d = +matches[3]; - return (m >= 1 && - m <= 12 && - d >= 1 && - (d <= DAYS[m] || - // leap year: https://tools.ietf.org/html/rfc3339#appendix-C - (m === 2 && d === 29 && (y % 100 === 0 ? y % 400 === 0 : y % 4 === 0)))); -} -function validTime(str) { - const matches = TIME.exec(str); - if (!matches) - return false; - const hr = +matches[1]; - const min = +matches[2]; - const sec = +matches[3]; - const tzH = +(matches[4] || 0); - const tzM = +(matches[5] || 0); - return ((hr <= 23 && min <= 59 && sec <= 59) || - // leap second - (hr - tzH === 23 && min - tzM === 59 && sec === 60)); -} -validTimestamp.code = 'require("ajv/dist/runtime/timestamp").default'; -//# sourceMappingURL=timestamp.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/runtime/timestamp.js.map b/node_modules/ajv/dist/runtime/timestamp.js.map deleted file mode 100644 index 6b0eee0..0000000 --- a/node_modules/ajv/dist/runtime/timestamp.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"timestamp.js","sourceRoot":"","sources":["../../lib/runtime/timestamp.ts"],"names":[],"mappings":";;AAAA,MAAM,YAAY,GAAG,OAAO,CAAA;AAC5B,MAAM,IAAI,GAAG,4BAA4B,CAAA;AACzC,MAAM,IAAI,GAAG,gEAAgE,CAAA;AAC7E,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;AAEhE,SAAwB,cAAc,CAAC,GAAW,EAAE,SAAkB;IACpE,iDAAiD;IACjD,MAAM,EAAE,GAAa,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;IAC5C,OAAO,CACL,CAAC,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC,SAAS,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CACnD,CAAA;AACH,CAAC;AAPD,iCAOC;AAED,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,OAAO,GAAoB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC/C,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAA;IAC1B,MAAM,CAAC,GAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC7B,MAAM,CAAC,GAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC7B,MAAM,CAAC,GAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC7B,OAAO,CACL,CAAC,IAAI,CAAC;QACN,CAAC,IAAI,EAAE;QACP,CAAC,IAAI,CAAC;QACN,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;YACX,4DAA4D;YAC5D,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAC1E,CAAA;AACH,CAAC;AAED,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,OAAO,GAAoB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC/C,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAA;IAC1B,MAAM,EAAE,GAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC9B,MAAM,GAAG,GAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC/B,MAAM,GAAG,GAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC/B,MAAM,GAAG,GAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IACtC,MAAM,GAAG,GAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IACtC,OAAO,CACL,CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,CAAC;QACpC,cAAc;QACd,CAAC,EAAE,GAAG,GAAG,KAAK,EAAE,IAAI,GAAG,GAAG,GAAG,KAAK,EAAE,IAAI,GAAG,KAAK,EAAE,CAAC,CACpD,CAAA;AACH,CAAC;AAED,cAAc,CAAC,IAAI,GAAG,+CAA+C,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/runtime/ucs2length.d.ts b/node_modules/ajv/dist/runtime/ucs2length.d.ts deleted file mode 100644 index ecbee69..0000000 --- a/node_modules/ajv/dist/runtime/ucs2length.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare function ucs2length(str: string): number; -declare namespace ucs2length { - var code: string; -} -export default ucs2length; diff --git a/node_modules/ajv/dist/runtime/ucs2length.js b/node_modules/ajv/dist/runtime/ucs2length.js deleted file mode 100644 index 92ea0c0..0000000 --- a/node_modules/ajv/dist/runtime/ucs2length.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// https://mathiasbynens.be/notes/javascript-encoding -// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode -function ucs2length(str) { - const len = str.length; - let length = 0; - let pos = 0; - let value; - while (pos < len) { - length++; - value = str.charCodeAt(pos++); - if (value >= 0xd800 && value <= 0xdbff && pos < len) { - // high surrogate, and there is a next character - value = str.charCodeAt(pos); - if ((value & 0xfc00) === 0xdc00) - pos++; // low surrogate - } - } - return length; -} -exports.default = ucs2length; -ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default'; -//# sourceMappingURL=ucs2length.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/runtime/ucs2length.js.map b/node_modules/ajv/dist/runtime/ucs2length.js.map deleted file mode 100644 index a5ceb6b..0000000 --- a/node_modules/ajv/dist/runtime/ucs2length.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ucs2length.js","sourceRoot":"","sources":["../../lib/runtime/ucs2length.ts"],"names":[],"mappings":";;AAAA,qDAAqD;AACrD,iEAAiE;AACjE,SAAwB,UAAU,CAAC,GAAW;IAC5C,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAA;IACtB,IAAI,MAAM,GAAG,CAAC,CAAA;IACd,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,IAAI,KAAa,CAAA;IACjB,OAAO,GAAG,GAAG,GAAG,EAAE,CAAC;QACjB,MAAM,EAAE,CAAA;QACR,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,CAAA;QAC7B,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,MAAM,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC;YACpD,gDAAgD;YAChD,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;YAC3B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,MAAM;gBAAE,GAAG,EAAE,CAAA,CAAC,gBAAgB;QACzD,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAfD,6BAeC;AAED,UAAU,CAAC,IAAI,GAAG,gDAAgD,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/runtime/uri.d.ts b/node_modules/ajv/dist/runtime/uri.d.ts deleted file mode 100644 index 8e9e079..0000000 --- a/node_modules/ajv/dist/runtime/uri.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as uri from "fast-uri"; -type URI = typeof uri & { - code: string; -}; -declare const _default: URI; -export default _default; diff --git a/node_modules/ajv/dist/runtime/uri.js b/node_modules/ajv/dist/runtime/uri.js deleted file mode 100644 index bbd2f05..0000000 --- a/node_modules/ajv/dist/runtime/uri.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const uri = require("fast-uri"); -uri.code = 'require("ajv/dist/runtime/uri").default'; -exports.default = uri; -//# sourceMappingURL=uri.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/runtime/uri.js.map b/node_modules/ajv/dist/runtime/uri.js.map deleted file mode 100644 index 3f80a4c..0000000 --- a/node_modules/ajv/dist/runtime/uri.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"uri.js","sourceRoot":"","sources":["../../lib/runtime/uri.ts"],"names":[],"mappings":";;AAAA,gCAA+B;AAG7B,GAAW,CAAC,IAAI,GAAG,yCAAyC,CAAA;AAE9D,kBAAe,GAAU,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/runtime/validation_error.d.ts b/node_modules/ajv/dist/runtime/validation_error.d.ts deleted file mode 100644 index b0ee969..0000000 --- a/node_modules/ajv/dist/runtime/validation_error.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { ErrorObject } from "../types"; -export default class ValidationError extends Error { - readonly errors: Partial[]; - readonly ajv: true; - readonly validation: true; - constructor(errors: Partial[]); -} diff --git a/node_modules/ajv/dist/runtime/validation_error.js b/node_modules/ajv/dist/runtime/validation_error.js deleted file mode 100644 index 353502c..0000000 --- a/node_modules/ajv/dist/runtime/validation_error.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -class ValidationError extends Error { - constructor(errors) { - super("validation failed"); - this.errors = errors; - this.ajv = this.validation = true; - } -} -exports.default = ValidationError; -//# sourceMappingURL=validation_error.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/runtime/validation_error.js.map b/node_modules/ajv/dist/runtime/validation_error.js.map deleted file mode 100644 index 70206fb..0000000 --- a/node_modules/ajv/dist/runtime/validation_error.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"validation_error.js","sourceRoot":"","sources":["../../lib/runtime/validation_error.ts"],"names":[],"mappings":";;AAEA,MAAqB,eAAgB,SAAQ,KAAK;IAKhD,YAAY,MAA8B;QACxC,KAAK,CAAC,mBAAmB,CAAC,CAAA;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;IACnC,CAAC;CACF;AAVD,kCAUC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/standalone/index.d.ts b/node_modules/ajv/dist/standalone/index.d.ts deleted file mode 100644 index a9141c3..0000000 --- a/node_modules/ajv/dist/standalone/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type AjvCore from "../core"; -import type { AnyValidateFunction } from "../types"; -declare function standaloneCode(ajv: AjvCore, refsOrFunc?: { - [K in string]?: string; -} | AnyValidateFunction): string; -export default standaloneCode; diff --git a/node_modules/ajv/dist/standalone/index.js b/node_modules/ajv/dist/standalone/index.js deleted file mode 100644 index b44bb5d..0000000 --- a/node_modules/ajv/dist/standalone/index.js +++ /dev/null @@ -1,90 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const scope_1 = require("../compile/codegen/scope"); -const code_1 = require("../compile/codegen/code"); -function standaloneCode(ajv, refsOrFunc) { - if (!ajv.opts.code.source) { - throw new Error("moduleCode: ajv instance must have code.source option"); - } - const { _n } = ajv.scope.opts; - return typeof refsOrFunc == "function" - ? funcExportCode(refsOrFunc.source) - : refsOrFunc !== undefined - ? multiExportsCode(refsOrFunc, getValidate) - : multiExportsCode(ajv.schemas, (sch) => sch.meta ? undefined : ajv.compile(sch.schema)); - function getValidate(id) { - const v = ajv.getSchema(id); - if (!v) - throw new Error(`moduleCode: no schema with id ${id}`); - return v; - } - function funcExportCode(source) { - const usedValues = {}; - const n = source === null || source === void 0 ? void 0 : source.validateName; - const vCode = validateCode(usedValues, source); - if (ajv.opts.code.esm) { - // Always do named export as `validate` rather than the variable `n` which is `validateXX` for known export value - return `"use strict";${_n}export const validate = ${n};${_n}export default ${n};${_n}${vCode}`; - } - return `"use strict";${_n}module.exports = ${n};${_n}module.exports.default = ${n};${_n}${vCode}`; - } - function multiExportsCode(schemas, getValidateFunc) { - var _a; - const usedValues = {}; - let code = (0, code_1._) `"use strict";`; - for (const name in schemas) { - const v = getValidateFunc(schemas[name]); - if (v) { - const vCode = validateCode(usedValues, v.source); - const exportSyntax = ajv.opts.code.esm - ? (0, code_1._) `export const ${(0, code_1.getEsmExportName)(name)}` - : (0, code_1._) `exports${(0, code_1.getProperty)(name)}`; - code = (0, code_1._) `${code}${_n}${exportSyntax} = ${(_a = v.source) === null || _a === void 0 ? void 0 : _a.validateName};${_n}${vCode}`; - } - } - return `${code}`; - } - function validateCode(usedValues, s) { - if (!s) - throw new Error('moduleCode: function does not have "source" property'); - if (usedState(s.validateName) === scope_1.UsedValueState.Completed) - return code_1.nil; - setUsedState(s.validateName, scope_1.UsedValueState.Started); - const scopeCode = ajv.scope.scopeCode(s.scopeValues, usedValues, refValidateCode); - const code = new code_1._Code(`${scopeCode}${_n}${s.validateCode}`); - return s.evaluated ? (0, code_1._) `${code}${s.validateName}.evaluated = ${s.evaluated};${_n}` : code; - function refValidateCode(n) { - var _a; - const vRef = (_a = n.value) === null || _a === void 0 ? void 0 : _a.ref; - if (n.prefix === "validate" && typeof vRef == "function") { - const v = vRef; - return validateCode(usedValues, v.source); - } - else if ((n.prefix === "root" || n.prefix === "wrapper") && typeof vRef == "object") { - const { validate, validateName } = vRef; - if (!validateName) - throw new Error("ajv internal error"); - const def = ajv.opts.code.es5 ? scope_1.varKinds.var : scope_1.varKinds.const; - const wrapper = (0, code_1._) `${def} ${n} = {validate: ${validateName}};`; - if (usedState(validateName) === scope_1.UsedValueState.Started) - return wrapper; - const vCode = validateCode(usedValues, validate === null || validate === void 0 ? void 0 : validate.source); - return (0, code_1._) `${wrapper}${_n}${vCode}`; - } - return undefined; - } - function usedState(name) { - var _a; - return (_a = usedValues[name.prefix]) === null || _a === void 0 ? void 0 : _a.get(name); - } - function setUsedState(name, state) { - const { prefix } = name; - const names = (usedValues[prefix] = usedValues[prefix] || new Map()); - names.set(name, state); - } - } -} -module.exports = exports = standaloneCode; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = standaloneCode; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/standalone/index.js.map b/node_modules/ajv/dist/standalone/index.js.map deleted file mode 100644 index 8551fe9..0000000 --- a/node_modules/ajv/dist/standalone/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/standalone/index.ts"],"names":[],"mappings":";;AAGA,oDAAkG;AAClG,kDAA0F;AAE1F,SAAS,cAAc,CACrB,GAAY,EACZ,UAA2D;IAE3D,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;IAC1E,CAAC;IACD,MAAM,EAAC,EAAE,EAAC,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAA;IAC3B,OAAO,OAAO,UAAU,IAAI,UAAU;QACpC,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC;QACnC,CAAC,CAAC,UAAU,KAAK,SAAS;YAC1B,CAAC,CAAC,gBAAgB,CAAS,UAAU,EAAE,WAAW,CAAC;YACnD,CAAC,CAAC,gBAAgB,CAAY,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAC/C,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAC/C,CAAA;IAEL,SAAS,WAAW,CAAC,EAAU;QAC7B,MAAM,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAC3B,IAAI,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,EAAE,EAAE,CAAC,CAAA;QAC9D,OAAO,CAAC,CAAA;IACV,CAAC;IAED,SAAS,cAAc,CAAC,MAAmB;QACzC,MAAM,UAAU,GAAoB,EAAE,CAAA;QACtC,MAAM,CAAC,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,CAAA;QAC9B,MAAM,KAAK,GAAG,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;QAC9C,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YACtB,iHAAiH;YACjH,OAAO,gBAAgB,EAAE,2BAA2B,CAAC,IAAI,EAAE,kBAAkB,CAAC,IAAI,EAAE,GAAG,KAAK,EAAE,CAAA;QAChG,CAAC;QACD,OAAO,gBAAgB,EAAE,oBAAoB,CAAC,IAAI,EAAE,4BAA4B,CAAC,IAAI,EAAE,GAAG,KAAK,EAAE,CAAA;IACnG,CAAC;IAED,SAAS,gBAAgB,CACvB,OAA4B,EAC5B,eAAgE;;QAEhE,MAAM,UAAU,GAAoB,EAAE,CAAA;QACtC,IAAI,IAAI,GAAG,IAAA,QAAC,EAAA,eAAe,CAAA;QAC3B,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC,IAAI,CAAM,CAAC,CAAA;YAC7C,IAAI,CAAC,EAAE,CAAC;gBACN,MAAM,KAAK,GAAG,YAAY,CAAC,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;gBAChD,MAAM,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;oBACpC,CAAC,CAAC,IAAA,QAAC,EAAA,gBAAgB,IAAA,uBAAgB,EAAC,IAAI,CAAC,EAAE;oBAC3C,CAAC,CAAC,IAAA,QAAC,EAAA,UAAU,IAAA,kBAAW,EAAC,IAAI,CAAC,EAAE,CAAA;gBAClC,IAAI,GAAG,IAAA,QAAC,EAAA,GAAG,IAAI,GAAG,EAAE,GAAG,YAAY,MAAM,MAAA,CAAC,CAAC,MAAM,0CAAE,YAAY,IAAI,EAAE,GAAG,KAAK,EAAE,CAAA;YACjF,CAAC;QACH,CAAC;QACD,OAAO,GAAG,IAAI,EAAE,CAAA;IAClB,CAAC;IAED,SAAS,YAAY,CAAC,UAA2B,EAAE,CAAc;QAC/D,IAAI,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;QAC/E,IAAI,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,sBAAc,CAAC,SAAS;YAAE,OAAO,UAAG,CAAA;QACtE,YAAY,CAAC,CAAC,CAAC,YAAY,EAAE,sBAAc,CAAC,OAAO,CAAC,CAAA;QAEpD,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,EAAE,UAAU,EAAE,eAAe,CAAC,CAAA;QACjF,MAAM,IAAI,GAAG,IAAI,YAAK,CAAC,GAAG,SAAS,GAAG,EAAE,GAAG,CAAC,CAAC,YAAY,EAAE,CAAC,CAAA;QAC5D,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,QAAC,EAAA,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,gBAAgB,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;QAExF,SAAS,eAAe,CAAC,CAAiB;;YACxC,MAAM,IAAI,GAAG,MAAA,CAAC,CAAC,KAAK,0CAAE,GAAG,CAAA;YACzB,IAAI,CAAC,CAAC,MAAM,KAAK,UAAU,IAAI,OAAO,IAAI,IAAI,UAAU,EAAE,CAAC;gBACzD,MAAM,CAAC,GAAG,IAA2B,CAAA;gBACrC,OAAO,YAAY,CAAC,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;YAC3C,CAAC;iBAAM,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,IAAI,OAAO,IAAI,IAAI,QAAQ,EAAE,CAAC;gBACtF,MAAM,EAAC,QAAQ,EAAE,YAAY,EAAC,GAAG,IAAiB,CAAA;gBAClD,IAAI,CAAC,YAAY;oBAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAA;gBACxD,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,gBAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,gBAAQ,CAAC,KAAK,CAAA;gBAC7D,MAAM,OAAO,GAAG,IAAA,QAAC,EAAA,GAAG,GAAG,IAAI,CAAC,iBAAiB,YAAY,IAAI,CAAA;gBAC7D,IAAI,SAAS,CAAC,YAAY,CAAC,KAAK,sBAAc,CAAC,OAAO;oBAAE,OAAO,OAAO,CAAA;gBACtE,MAAM,KAAK,GAAG,YAAY,CAAC,UAAU,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC,CAAA;gBACxD,OAAO,IAAA,QAAC,EAAA,GAAG,OAAO,GAAG,EAAE,GAAG,KAAK,EAAE,CAAA;YACnC,CAAC;YACD,OAAO,SAAS,CAAA;QAClB,CAAC;QAED,SAAS,SAAS,CAAC,IAAoB;;YACrC,OAAO,MAAA,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,0CAAE,GAAG,CAAC,IAAI,CAAC,CAAA;QAC3C,CAAC;QAED,SAAS,YAAY,CAAC,IAAoB,EAAE,KAAqB;YAC/D,MAAM,EAAC,MAAM,EAAC,GAAG,IAAI,CAAA;YACrB,MAAM,KAAK,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC,CAAA;YACpE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACxB,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,cAAc,CAAA;AACzC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,cAAc,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/standalone/instance.d.ts b/node_modules/ajv/dist/standalone/instance.d.ts deleted file mode 100644 index 156ac32..0000000 --- a/node_modules/ajv/dist/standalone/instance.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Ajv, { AnySchema, AnyValidateFunction, ErrorObject } from "../core"; -export default class AjvPack { - readonly ajv: Ajv; - errors?: ErrorObject[] | null; - constructor(ajv: Ajv); - validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise; - compile(schema: AnySchema, meta?: boolean): AnyValidateFunction; - getSchema(keyRef: string): AnyValidateFunction | undefined; - private getStandalone; - addSchema(...args: Parameters): AjvPack; - addKeyword(...args: Parameters): AjvPack; -} diff --git a/node_modules/ajv/dist/standalone/instance.js b/node_modules/ajv/dist/standalone/instance.js deleted file mode 100644 index 35e5c99..0000000 --- a/node_modules/ajv/dist/standalone/instance.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const core_1 = require("../core"); -const _1 = require("."); -const requireFromString = require("require-from-string"); -class AjvPack { - constructor(ajv) { - this.ajv = ajv; - } - validate(schemaKeyRef, data) { - return core_1.default.prototype.validate.call(this, schemaKeyRef, data); - } - compile(schema, meta) { - return this.getStandalone(this.ajv.compile(schema, meta)); - } - getSchema(keyRef) { - const v = this.ajv.getSchema(keyRef); - if (!v) - return undefined; - return this.getStandalone(v); - } - getStandalone(v) { - return requireFromString((0, _1.default)(this.ajv, v)); - } - addSchema(...args) { - this.ajv.addSchema.call(this.ajv, ...args); - return this; - } - addKeyword(...args) { - this.ajv.addKeyword.call(this.ajv, ...args); - return this; - } -} -exports.default = AjvPack; -//# sourceMappingURL=instance.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/standalone/instance.js.map b/node_modules/ajv/dist/standalone/instance.js.map deleted file mode 100644 index 6ac33b1..0000000 --- a/node_modules/ajv/dist/standalone/instance.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"instance.js","sourceRoot":"","sources":["../../lib/standalone/instance.ts"],"names":[],"mappings":";;AAAA,kCAAwE;AACxE,wBAA8B;AAC9B,yDAAwD;AAExD,MAAqB,OAAO;IAE1B,YAAqB,GAAQ;QAAR,QAAG,GAAH,GAAG,CAAK;IAAG,CAAC;IAEjC,QAAQ,CAAC,YAAgC,EAAE,IAAa;QACtD,OAAO,cAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,CAAA;IAC9D,CAAC;IAED,OAAO,CAAc,MAAiB,EAAE,IAAc;QACpD,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAI,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED,SAAS,CAAc,MAAc;QACnC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAI,MAAM,CAAC,CAAA;QACvC,IAAI,CAAC,CAAC;YAAE,OAAO,SAAS,CAAA;QACxB,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAA;IAC9B,CAAC;IAEO,aAAa,CAAc,CAAyB;QAC1D,OAAO,iBAAiB,CAAC,IAAA,UAAc,EAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAA2B,CAAA;IACjF,CAAC;IAED,SAAS,CAAC,GAAG,IAAgD;QAC3D,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;QAC1C,OAAO,IAAI,CAAA;IACb,CAAC;IAED,UAAU,CAAC,GAAG,IAAiD;QAC7D,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;QAC3C,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA/BD,0BA+BC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/types/index.d.ts b/node_modules/ajv/dist/types/index.d.ts deleted file mode 100644 index 49903cd..0000000 --- a/node_modules/ajv/dist/types/index.d.ts +++ /dev/null @@ -1,183 +0,0 @@ -import { URIComponent } from "fast-uri"; -import type { CodeGen, Code, Name, ScopeValueSets, ValueScopeName } from "../compile/codegen"; -import type { SchemaEnv, SchemaCxt, SchemaObjCxt } from "../compile"; -import type { JSONType } from "../compile/rules"; -import type { KeywordCxt } from "../compile/validate"; -import type Ajv from "../core"; -interface _SchemaObject { - id?: string; - $id?: string; - $schema?: string; - [x: string]: any; -} -export interface SchemaObject extends _SchemaObject { - id?: string; - $id?: string; - $schema?: string; - $async?: false; - [x: string]: any; -} -export interface AsyncSchema extends _SchemaObject { - $async: true; -} -export type AnySchemaObject = SchemaObject | AsyncSchema; -export type Schema = SchemaObject | boolean; -export type AnySchema = Schema | AsyncSchema; -export type SchemaMap = { - [Key in string]?: AnySchema; -}; -export interface SourceCode { - validateName: ValueScopeName; - validateCode: string; - scopeValues: ScopeValueSets; - evaluated?: Code; -} -export interface DataValidationCxt { - instancePath: string; - parentData: { - [K in T]: any; - }; - parentDataProperty: T; - rootData: Record | any[]; - dynamicAnchors: { - [Ref in string]?: ValidateFunction; - }; -} -export interface ValidateFunction { - (this: Ajv | any, data: any, dataCxt?: DataValidationCxt): data is T; - errors?: null | ErrorObject[]; - evaluated?: Evaluated; - schema: AnySchema; - schemaEnv: SchemaEnv; - source?: SourceCode; -} -export interface JTDParser { - (json: string): T | undefined; - message?: string; - position?: number; -} -export type EvaluatedProperties = { - [K in string]?: true; -} | true; -export type EvaluatedItems = number | true; -export interface Evaluated { - props?: EvaluatedProperties; - items?: EvaluatedItems; - dynamicProps: boolean; - dynamicItems: boolean; -} -export interface AsyncValidateFunction extends ValidateFunction { - (...args: Parameters>): Promise; - $async: true; -} -export type AnyValidateFunction = ValidateFunction | AsyncValidateFunction; -export interface ErrorObject, S = unknown> { - keyword: K; - instancePath: string; - schemaPath: string; - params: P; - propertyName?: string; - message?: string; - schema?: S; - parentSchema?: AnySchemaObject; - data?: unknown; -} -export type ErrorNoParams = ErrorObject, S>; -interface _KeywordDef { - keyword: string | string[]; - type?: JSONType | JSONType[]; - schemaType?: JSONType | JSONType[]; - allowUndefined?: boolean; - $data?: boolean; - implements?: string[]; - before?: string; - post?: boolean; - metaSchema?: AnySchemaObject; - validateSchema?: AnyValidateFunction; - dependencies?: string[]; - error?: KeywordErrorDefinition; - $dataError?: KeywordErrorDefinition; -} -export interface CodeKeywordDefinition extends _KeywordDef { - code: (cxt: KeywordCxt, ruleType?: string) => void; - trackErrors?: boolean; -} -export type MacroKeywordFunc = (schema: any, parentSchema: AnySchemaObject, it: SchemaCxt) => AnySchema; -export type CompileKeywordFunc = (schema: any, parentSchema: AnySchemaObject, it: SchemaObjCxt) => DataValidateFunction; -export interface DataValidateFunction { - (...args: Parameters): boolean | Promise; - errors?: Partial[]; -} -export interface SchemaValidateFunction { - (schema: any, data: any, parentSchema?: AnySchemaObject, dataCxt?: DataValidationCxt): boolean | Promise; - errors?: Partial[]; -} -export interface FuncKeywordDefinition extends _KeywordDef { - validate?: SchemaValidateFunction | DataValidateFunction; - compile?: CompileKeywordFunc; - schema?: boolean; - modifying?: boolean; - async?: boolean; - valid?: boolean; - errors?: boolean | "full"; -} -export interface MacroKeywordDefinition extends FuncKeywordDefinition { - macro: MacroKeywordFunc; -} -export type KeywordDefinition = CodeKeywordDefinition | FuncKeywordDefinition | MacroKeywordDefinition; -export type AddedKeywordDefinition = KeywordDefinition & { - type: JSONType[]; - schemaType: JSONType[]; -}; -export interface KeywordErrorDefinition { - message: string | Code | ((cxt: KeywordErrorCxt) => string | Code); - params?: Code | ((cxt: KeywordErrorCxt) => Code); -} -export type Vocabulary = (KeywordDefinition | string)[]; -export interface KeywordErrorCxt { - gen: CodeGen; - keyword: string; - data: Name; - $data?: string | false; - schema: any; - parentSchema?: AnySchemaObject; - schemaCode: Code | number | boolean; - schemaValue: Code | number | boolean; - schemaType?: JSONType[]; - errsCount?: Name; - params: KeywordCxtParams; - it: SchemaCxt; -} -export type KeywordCxtParams = { - [P in string]?: Code | string | number; -}; -export type FormatValidator = (data: T) => boolean; -export type FormatCompare = (data1: T, data2: T) => number | undefined; -export type AsyncFormatValidator = (data: T) => Promise; -export interface FormatDefinition { - type?: T extends string ? "string" | undefined : "number"; - validate: FormatValidator | (T extends string ? string | RegExp : never); - async?: false | undefined; - compare?: FormatCompare; -} -export interface AsyncFormatDefinition { - type?: T extends string ? "string" | undefined : "number"; - validate: AsyncFormatValidator; - async: true; - compare?: FormatCompare; -} -export type AddedFormat = true | RegExp | FormatValidator | FormatDefinition | FormatDefinition | AsyncFormatDefinition | AsyncFormatDefinition; -export type Format = AddedFormat | string; -export interface RegExpEngine { - (pattern: string, u: string): RegExpLike; - code: string; -} -export interface RegExpLike { - test: (s: string) => boolean; -} -export interface UriResolver { - parse(uri: string): URIComponent; - resolve(base: string, path: string): string; - serialize(component: URIComponent): string; -} -export {}; diff --git a/node_modules/ajv/dist/types/index.js b/node_modules/ajv/dist/types/index.js deleted file mode 100644 index aa219d8..0000000 --- a/node_modules/ajv/dist/types/index.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/types/index.js.map b/node_modules/ajv/dist/types/index.js.map deleted file mode 100644 index 1f80f85..0000000 --- a/node_modules/ajv/dist/types/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/types/index.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/ajv/dist/types/json-schema.d.ts b/node_modules/ajv/dist/types/json-schema.d.ts deleted file mode 100644 index a391fef..0000000 --- a/node_modules/ajv/dist/types/json-schema.d.ts +++ /dev/null @@ -1,125 +0,0 @@ -type StrictNullChecksWrapper = undefined extends null ? `strictNullChecks must be true in tsconfig to use ${Name}` : Type; -type UnionToIntersection = (U extends any ? (_: U) => void : never) extends (_: infer I) => void ? I : never; -export type SomeJSONSchema = UncheckedJSONSchemaType; -type UncheckedPartialSchema = Partial>; -export type PartialSchema = StrictNullChecksWrapper<"PartialSchema", UncheckedPartialSchema>; -type JSONType = IsPartial extends true ? T | undefined : T; -interface NumberKeywords { - minimum?: number; - maximum?: number; - exclusiveMinimum?: number; - exclusiveMaximum?: number; - multipleOf?: number; - format?: string; -} -interface StringKeywords { - minLength?: number; - maxLength?: number; - pattern?: string; - format?: string; -} -type UncheckedJSONSchemaType = (// these two unions allow arbitrary unions of types -{ - anyOf: readonly UncheckedJSONSchemaType[]; -} | { - oneOf: readonly UncheckedJSONSchemaType[]; -} | ({ - type: readonly (T extends number ? JSONType<"number" | "integer", IsPartial> : T extends string ? JSONType<"string", IsPartial> : T extends boolean ? JSONType<"boolean", IsPartial> : never)[]; -} & UnionToIntersection) | ((T extends number ? { - type: JSONType<"number" | "integer", IsPartial>; -} & NumberKeywords : T extends string ? { - type: JSONType<"string", IsPartial>; -} & StringKeywords : T extends boolean ? { - type: JSONType<"boolean", IsPartial>; -} : T extends readonly [any, ...any[]] ? { - type: JSONType<"array", IsPartial>; - items: { - readonly [K in keyof T]-?: UncheckedJSONSchemaType & Nullable; - } & { - length: T["length"]; - }; - minItems: T["length"]; -} & ({ - maxItems: T["length"]; -} | { - additionalItems: false; -}) : T extends readonly any[] ? { - type: JSONType<"array", IsPartial>; - items: UncheckedJSONSchemaType; - contains?: UncheckedPartialSchema; - minItems?: number; - maxItems?: number; - minContains?: number; - maxContains?: number; - uniqueItems?: true; - additionalItems?: never; -} : T extends Record ? { - type: JSONType<"object", IsPartial>; - additionalProperties?: boolean | UncheckedJSONSchemaType; - unevaluatedProperties?: boolean | UncheckedJSONSchemaType; - properties?: IsPartial extends true ? Partial> : UncheckedPropertiesSchema; - patternProperties?: Record>; - propertyNames?: Omit, "type"> & { - type?: "string"; - }; - dependencies?: { - [K in keyof T]?: readonly (keyof T)[] | UncheckedPartialSchema; - }; - dependentRequired?: { - [K in keyof T]?: readonly (keyof T)[]; - }; - dependentSchemas?: { - [K in keyof T]?: UncheckedPartialSchema; - }; - minProperties?: number; - maxProperties?: number; -} & (IsPartial extends true ? { - required: readonly (keyof T)[]; -} : [UncheckedRequiredMembers] extends [never] ? { - required?: readonly UncheckedRequiredMembers[]; -} : { - required: readonly UncheckedRequiredMembers[]; -}) : T extends null ? { - type: JSONType<"null", IsPartial>; - nullable: true; -} : never) & { - allOf?: readonly UncheckedPartialSchema[]; - anyOf?: readonly UncheckedPartialSchema[]; - oneOf?: readonly UncheckedPartialSchema[]; - if?: UncheckedPartialSchema; - then?: UncheckedPartialSchema; - else?: UncheckedPartialSchema; - not?: UncheckedPartialSchema; -})) & { - [keyword: string]: any; - $id?: string; - $ref?: string; - $defs?: Record>; - definitions?: Record>; -}; -export type JSONSchemaType = StrictNullChecksWrapper<"JSONSchemaType", UncheckedJSONSchemaType>; -type Known = { - [key: string]: Known; -} | [Known, ...Known[]] | Known[] | number | string | boolean | null; -type UncheckedPropertiesSchema = { - [K in keyof T]-?: (UncheckedJSONSchemaType & Nullable) | { - $ref: string; - }; -}; -export type PropertiesSchema = StrictNullChecksWrapper<"PropertiesSchema", UncheckedPropertiesSchema>; -type UncheckedRequiredMembers = { - [K in keyof T]-?: undefined extends T[K] ? never : K; -}[keyof T]; -export type RequiredMembers = StrictNullChecksWrapper<"RequiredMembers", UncheckedRequiredMembers>; -type Nullable = undefined extends T ? { - nullable: true; - const?: null; - enum?: readonly (T | null)[]; - default?: T | null; -} : { - nullable?: false; - const?: T; - enum?: readonly T[]; - default?: T; -}; -export {}; diff --git a/node_modules/ajv/dist/types/json-schema.js b/node_modules/ajv/dist/types/json-schema.js deleted file mode 100644 index 2d8f98d..0000000 --- a/node_modules/ajv/dist/types/json-schema.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=json-schema.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/types/json-schema.js.map b/node_modules/ajv/dist/types/json-schema.js.map deleted file mode 100644 index ae6b4d0..0000000 --- a/node_modules/ajv/dist/types/json-schema.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json-schema.js","sourceRoot":"","sources":["../../lib/types/json-schema.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/ajv/dist/types/jtd-schema.d.ts b/node_modules/ajv/dist/types/jtd-schema.d.ts deleted file mode 100644 index 80ad312..0000000 --- a/node_modules/ajv/dist/types/jtd-schema.d.ts +++ /dev/null @@ -1,174 +0,0 @@ -/** numeric strings */ -type NumberType = "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32"; -/** string strings */ -type StringType = "string" | "timestamp"; -/** Generic JTD Schema without inference of the represented type */ -export type SomeJTDSchemaType = (// ref -{ - ref: string; -} | { - type: NumberType | StringType | "boolean"; -} | { - enum: string[]; -} | { - elements: SomeJTDSchemaType; -} | { - values: SomeJTDSchemaType; -} | { - properties: Record; - optionalProperties?: Record; - additionalProperties?: boolean; -} | { - properties?: Record; - optionalProperties: Record; - additionalProperties?: boolean; -} | { - discriminator: string; - mapping: Record; -} | {}) & { - nullable?: boolean; - metadata?: Record; - definitions?: Record; -}; -/** required keys of an object, not undefined */ -type RequiredKeys = { - [K in keyof T]-?: undefined extends T[K] ? never : K; -}[keyof T]; -/** optional or undifined-able keys of an object */ -type OptionalKeys = { - [K in keyof T]-?: undefined extends T[K] ? K : never; -}[keyof T]; -/** type is true if T is a union type */ -type IsUnion_ = false extends (T extends unknown ? ([U] extends [T] ? false : true) : never) ? false : true; -type IsUnion = IsUnion_; -/** type is true if T is identically E */ -type TypeEquality = [T] extends [E] ? ([E] extends [T] ? true : false) : false; -/** type is true if T or null is identically E or null*/ -type NullTypeEquality = TypeEquality; -/** gets only the string literals of a type or null if a type isn't a string literal */ -type EnumString = [T] extends [never] ? null : T extends string ? string extends T ? null : T : null; -/** true if type is a union of string literals */ -type IsEnum = null extends EnumString ? false : true; -/** true only if all types are array types (not tuples) */ -type IsElements = false extends IsUnion ? [T] extends [readonly unknown[]] ? undefined extends T[0.5] ? false : true : false : false; -/** true if the the type is a values type */ -type IsValues = false extends IsUnion ? TypeEquality : false; -/** true if type is a properties type and Union is false, or type is a discriminator type and Union is true */ -type IsRecord = Union extends IsUnion ? null extends EnumString ? false : true : false; -/** true if type represents an empty record */ -type IsEmptyRecord = [T] extends [Record] ? [T] extends [never] ? false : true : false; -/** actual schema */ -export type JTDSchemaType = Record> = (// refs - where null wasn't specified, must match exactly -(null extends EnumString ? never : ({ - [K in keyof D]: [T] extends [D[K]] ? { - ref: K; - } : never; -}[keyof D] & { - nullable?: false; -}) | (null extends T ? { - [K in keyof D]: [Exclude] extends [Exclude] ? { - ref: K; - } : never; -}[keyof D] & { - nullable: true; -} : never)) | (unknown extends T ? { - nullable?: boolean; -} : never) | ((true extends NullTypeEquality ? { - type: NumberType; -} : true extends NullTypeEquality ? { - type: "boolean"; -} : true extends NullTypeEquality ? { - type: StringType; -} : true extends NullTypeEquality ? { - type: "timestamp"; -} : true extends IsEnum> ? { - enum: EnumString>[]; -} : true extends IsElements> ? T extends readonly (infer E)[] ? { - elements: JTDSchemaType; -} : never : true extends IsEmptyRecord> ? { - properties: Record; - optionalProperties?: Record; -} | { - optionalProperties: Record; -} : true extends IsValues> ? T extends Record ? { - values: JTDSchemaType; -} : never : true extends IsRecord, false> ? ([RequiredKeys>] extends [never] ? { - properties?: Record; -} : { - properties: { - [K in RequiredKeys]: JTDSchemaType; - }; -}) & ([OptionalKeys>] extends [never] ? { - optionalProperties?: Record; -} : { - optionalProperties: { - [K in OptionalKeys]: JTDSchemaType, D>; - }; -}) & { - additionalProperties?: boolean; -} : true extends IsRecord, true> ? { - [K in keyof Exclude]-?: Exclude[K] extends string ? { - discriminator: K; - mapping: { - [M in Exclude[K]]: JTDSchemaType ? T : never, K>, D>; - }; - } : never; -}[keyof Exclude] : never) & (null extends T ? { - nullable: true; -} : { - nullable?: false; -}))) & { - metadata?: Record; - definitions?: { - [K in keyof D]: JTDSchemaType; - }; -}; -type JTDDataDef> = // ref -(S extends { - ref: string; -} ? D extends { - [K in S["ref"]]: infer V; -} ? JTDDataDef : never : S extends { - type: NumberType; -} ? number : S extends { - type: "boolean"; -} ? boolean : S extends { - type: "string"; -} ? string : S extends { - type: "timestamp"; -} ? string | Date : S extends { - enum: readonly (infer E)[]; -} ? string extends E ? never : [E] extends [string] ? E : never : S extends { - elements: infer E; -} ? JTDDataDef[] : S extends { - properties: Record; - optionalProperties?: Record; - additionalProperties?: boolean; -} ? { - -readonly [K in keyof S["properties"]]-?: JTDDataDef; -} & { - -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef; -} & ([S["additionalProperties"]] extends [true] ? Record : unknown) : S extends { - properties?: Record; - optionalProperties: Record; - additionalProperties?: boolean; -} ? { - -readonly [K in keyof S["properties"]]-?: JTDDataDef; -} & { - -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef; -} & ([S["additionalProperties"]] extends [true] ? Record : unknown) : S extends { - values: infer V; -} ? Record> : S extends { - discriminator: infer M; - mapping: Record; -} ? [M] extends [string] ? { - [K in keyof S["mapping"]]: JTDDataDef & { - [KM in M]: K; - }; -}[keyof S["mapping"]] : never : unknown) | (S extends { - nullable: true; -} ? null : never); -export type JTDDataType = S extends { - definitions: Record; -} ? JTDDataDef : JTDDataDef>; -export {}; diff --git a/node_modules/ajv/dist/types/jtd-schema.js b/node_modules/ajv/dist/types/jtd-schema.js deleted file mode 100644 index 11338aa..0000000 --- a/node_modules/ajv/dist/types/jtd-schema.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=jtd-schema.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/types/jtd-schema.js.map b/node_modules/ajv/dist/types/jtd-schema.js.map deleted file mode 100644 index add89bd..0000000 --- a/node_modules/ajv/dist/types/jtd-schema.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"jtd-schema.js","sourceRoot":"","sources":["../../lib/types/jtd-schema.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts b/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts deleted file mode 100644 index 6075156..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; -import type { KeywordCxt } from "../../compile/validate"; -export type AdditionalItemsError = ErrorObject<"additionalItems", { - limit: number; -}, AnySchema>; -declare const def: CodeKeywordDefinition; -export declare function validateAdditionalItems(cxt: KeywordCxt, items: AnySchema[]): void; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js b/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js deleted file mode 100644 index 608d51e..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.validateAdditionalItems = void 0; -const codegen_1 = require("../../compile/codegen"); -const util_1 = require("../../compile/util"); -const error = { - message: ({ params: { len } }) => (0, codegen_1.str) `must NOT have more than ${len} items`, - params: ({ params: { len } }) => (0, codegen_1._) `{limit: ${len}}`, -}; -const def = { - keyword: "additionalItems", - type: "array", - schemaType: ["boolean", "object"], - before: "uniqueItems", - error, - code(cxt) { - const { parentSchema, it } = cxt; - const { items } = parentSchema; - if (!Array.isArray(items)) { - (0, util_1.checkStrictMode)(it, '"additionalItems" is ignored when "items" is not an array of schemas'); - return; - } - validateAdditionalItems(cxt, items); - }, -}; -function validateAdditionalItems(cxt, items) { - const { gen, schema, data, keyword, it } = cxt; - it.items = true; - const len = gen.const("len", (0, codegen_1._) `${data}.length`); - if (schema === false) { - cxt.setParams({ len: items.length }); - cxt.pass((0, codegen_1._) `${len} <= ${items.length}`); - } - else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) { - const valid = gen.var("valid", (0, codegen_1._) `${len} <= ${items.length}`); // TODO var - gen.if((0, codegen_1.not)(valid), () => validateItems(valid)); - cxt.ok(valid); - } - function validateItems(valid) { - gen.forRange("i", items.length, len, (i) => { - cxt.subschema({ keyword, dataProp: i, dataPropType: util_1.Type.Num }, valid); - if (!it.allErrors) - gen.if((0, codegen_1.not)(valid), () => gen.break()); - }); - } -} -exports.validateAdditionalItems = validateAdditionalItems; -exports.default = def; -//# sourceMappingURL=additionalItems.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map b/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map deleted file mode 100644 index 0091d31..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"additionalItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/additionalItems.ts"],"names":[],"mappings":";;;AAOA,mDAAuD;AACvD,6CAA2E;AAI3E,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,2BAA2B,GAAG,QAAQ;IACvE,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,GAAG,GAAG;CAChD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,iBAA0B;IACnC,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;IACjC,MAAM,EAAE,aAAa;IACrB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC9B,MAAM,EAAC,KAAK,EAAC,GAAG,YAAY,CAAA;QAC5B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,IAAA,sBAAe,EAAC,EAAE,EAAE,sEAAsE,CAAC,CAAA;YAC3F,OAAM;QACR,CAAC;QACD,uBAAuB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACrC,CAAC;CACF,CAAA;AAED,SAAgB,uBAAuB,CAAC,GAAe,EAAE,KAAkB;IACzE,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAC5C,EAAE,CAAC,KAAK,GAAG,IAAI,CAAA;IACf,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,SAAS,CAAC,CAAA;IAC/C,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,GAAG,CAAC,SAAS,CAAC,EAAC,GAAG,EAAE,KAAK,CAAC,MAAM,EAAC,CAAC,CAAA;QAClC,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;IACxC,CAAC;SAAM,IAAI,OAAO,MAAM,IAAI,QAAQ,IAAI,CAAC,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;QACvE,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,GAAG,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA,CAAC,WAAW;QACxE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAA;QAC9C,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;IAED,SAAS,aAAa,CAAC,KAAW;QAChC,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE;YACzC,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,YAAY,EAAE,WAAI,CAAC,GAAG,EAAC,EAAE,KAAK,CAAC,CAAA;YACpE,IAAI,CAAC,EAAE,CAAC,SAAS;gBAAE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;QAC1D,CAAC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC;AAnBD,0DAmBC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts b/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts deleted file mode 100644 index 74698c7..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { CodeKeywordDefinition, AddedKeywordDefinition, ErrorObject, AnySchema } from "../../types"; -export type AdditionalPropertiesError = ErrorObject<"additionalProperties", { - additionalProperty: string; -}, AnySchema>; -declare const def: CodeKeywordDefinition & AddedKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js b/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js deleted file mode 100644 index 1d3374b..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +++ /dev/null @@ -1,106 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const code_1 = require("../code"); -const codegen_1 = require("../../compile/codegen"); -const names_1 = require("../../compile/names"); -const util_1 = require("../../compile/util"); -const error = { - message: "must NOT have additional properties", - params: ({ params }) => (0, codegen_1._) `{additionalProperty: ${params.additionalProperty}}`, -}; -const def = { - keyword: "additionalProperties", - type: ["object"], - schemaType: ["boolean", "object"], - allowUndefined: true, - trackErrors: true, - error, - code(cxt) { - const { gen, schema, parentSchema, data, errsCount, it } = cxt; - /* istanbul ignore if */ - if (!errsCount) - throw new Error("ajv implementation error"); - const { allErrors, opts } = it; - it.props = true; - if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it, schema)) - return; - const props = (0, code_1.allSchemaProperties)(parentSchema.properties); - const patProps = (0, code_1.allSchemaProperties)(parentSchema.patternProperties); - checkAdditionalProperties(); - cxt.ok((0, codegen_1._) `${errsCount} === ${names_1.default.errors}`); - function checkAdditionalProperties() { - gen.forIn("key", data, (key) => { - if (!props.length && !patProps.length) - additionalPropertyCode(key); - else - gen.if(isAdditional(key), () => additionalPropertyCode(key)); - }); - } - function isAdditional(key) { - let definedProp; - if (props.length > 8) { - // TODO maybe an option instead of hard-coded 8? - const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema.properties, "properties"); - definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key); - } - else if (props.length) { - definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._) `${key} === ${p}`)); - } - else { - definedProp = codegen_1.nil; - } - if (patProps.length) { - definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._) `${(0, code_1.usePattern)(cxt, p)}.test(${key})`)); - } - return (0, codegen_1.not)(definedProp); - } - function deleteAdditional(key) { - gen.code((0, codegen_1._) `delete ${data}[${key}]`); - } - function additionalPropertyCode(key) { - if (opts.removeAdditional === "all" || (opts.removeAdditional && schema === false)) { - deleteAdditional(key); - return; - } - if (schema === false) { - cxt.setParams({ additionalProperty: key }); - cxt.error(); - if (!allErrors) - gen.break(); - return; - } - if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) { - const valid = gen.name("valid"); - if (opts.removeAdditional === "failing") { - applyAdditionalSchema(key, valid, false); - gen.if((0, codegen_1.not)(valid), () => { - cxt.reset(); - deleteAdditional(key); - }); - } - else { - applyAdditionalSchema(key, valid); - if (!allErrors) - gen.if((0, codegen_1.not)(valid), () => gen.break()); - } - } - } - function applyAdditionalSchema(key, valid, errors) { - const subschema = { - keyword: "additionalProperties", - dataProp: key, - dataPropType: util_1.Type.Str, - }; - if (errors === false) { - Object.assign(subschema, { - compositeRule: true, - createErrors: false, - allErrors: false, - }); - } - cxt.subschema(subschema, valid); - } - }, -}; -exports.default = def; -//# sourceMappingURL=additionalProperties.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map b/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map deleted file mode 100644 index 649ddae..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"additionalProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/additionalProperties.ts"],"names":[],"mappings":";;AAOA,kCAAsE;AACtE,mDAAiE;AACjE,+CAAmC;AAEnC,6CAA0E;AAQ1E,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,qCAAqC;IAC9C,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,wBAAwB,MAAM,CAAC,kBAAkB,GAAG;CAC5E,CAAA;AAED,MAAM,GAAG,GAAmD;IAC1D,OAAO,EAAE,sBAAsB;IAC/B,IAAI,EAAE,CAAC,QAAQ,CAAC;IAChB,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;IACjC,cAAc,EAAE,IAAI;IACpB,WAAW,EAAE,IAAI;IACjB,KAAK;IACL,IAAI,CAAC,GAAG;QACN,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC5D,wBAAwB;QACxB,IAAI,CAAC,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC3D,MAAM,EAAC,SAAS,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;QAC5B,EAAE,CAAC,KAAK,GAAG,IAAI,CAAA;QACf,IAAI,IAAI,CAAC,gBAAgB,KAAK,KAAK,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QAC5E,MAAM,KAAK,GAAG,IAAA,0BAAmB,EAAC,YAAY,CAAC,UAAU,CAAC,CAAA;QAC1D,MAAM,QAAQ,GAAG,IAAA,0BAAmB,EAAC,YAAY,CAAC,iBAAiB,CAAC,CAAA;QACpE,yBAAyB,EAAE,CAAA;QAC3B,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,SAAS,QAAQ,eAAC,CAAC,MAAM,EAAE,CAAC,CAAA;QAEvC,SAAS,yBAAyB;YAChC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,GAAS,EAAE,EAAE;gBACnC,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM;oBAAE,sBAAsB,CAAC,GAAG,CAAC,CAAA;;oBAC7D,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,CAAA;YACnE,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,SAAS,YAAY,CAAC,GAAS;YAC7B,IAAI,WAAiB,CAAA;YACrB,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrB,gDAAgD;gBAChD,MAAM,WAAW,GAAG,IAAA,qBAAc,EAAC,EAAE,EAAE,YAAY,CAAC,UAAU,EAAE,YAAY,CAAC,CAAA;gBAC7E,WAAW,GAAG,IAAA,oBAAa,EAAC,GAAG,EAAE,WAAmB,EAAE,GAAG,CAAC,CAAA;YAC5D,CAAC;iBAAM,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;gBACxB,WAAW,GAAG,IAAA,YAAE,EAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;YAC3D,CAAC;iBAAM,CAAC;gBACN,WAAW,GAAG,aAAG,CAAA;YACnB,CAAC;YACD,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;gBACpB,WAAW,GAAG,IAAA,YAAE,EAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,IAAA,iBAAU,EAAC,GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAA;YAC9F,CAAC;YACD,OAAO,IAAA,aAAG,EAAC,WAAW,CAAC,CAAA;QACzB,CAAC;QAED,SAAS,gBAAgB,CAAC,GAAS;YACjC,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,UAAU,IAAI,IAAI,GAAG,GAAG,CAAC,CAAA;QACrC,CAAC;QAED,SAAS,sBAAsB,CAAC,GAAS;YACvC,IAAI,IAAI,CAAC,gBAAgB,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,MAAM,KAAK,KAAK,CAAC,EAAE,CAAC;gBACnF,gBAAgB,CAAC,GAAG,CAAC,CAAA;gBACrB,OAAM;YACR,CAAC;YAED,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;gBACrB,GAAG,CAAC,SAAS,CAAC,EAAC,kBAAkB,EAAE,GAAG,EAAC,CAAC,CAAA;gBACxC,GAAG,CAAC,KAAK,EAAE,CAAA;gBACX,IAAI,CAAC,SAAS;oBAAE,GAAG,CAAC,KAAK,EAAE,CAAA;gBAC3B,OAAM;YACR,CAAC;YAED,IAAI,OAAO,MAAM,IAAI,QAAQ,IAAI,CAAC,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;gBAChE,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;gBAC/B,IAAI,IAAI,CAAC,gBAAgB,KAAK,SAAS,EAAE,CAAC;oBACxC,qBAAqB,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;oBACxC,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE;wBACtB,GAAG,CAAC,KAAK,EAAE,CAAA;wBACX,gBAAgB,CAAC,GAAG,CAAC,CAAA;oBACvB,CAAC,CAAC,CAAA;gBACJ,CAAC;qBAAM,CAAC;oBACN,qBAAqB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;oBACjC,IAAI,CAAC,SAAS;wBAAE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;gBACvD,CAAC;YACH,CAAC;QACH,CAAC;QAED,SAAS,qBAAqB,CAAC,GAAS,EAAE,KAAW,EAAE,MAAc;YACnE,MAAM,SAAS,GAAkB;gBAC/B,OAAO,EAAE,sBAAsB;gBAC/B,QAAQ,EAAE,GAAG;gBACb,YAAY,EAAE,WAAI,CAAC,GAAG;aACvB,CAAA;YACD,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;gBACrB,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE;oBACvB,aAAa,EAAE,IAAI;oBACnB,YAAY,EAAE,KAAK;oBACnB,SAAS,EAAE,KAAK;iBACjB,CAAC,CAAA;YACJ,CAAC;YACD,GAAG,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QACjC,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts b/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts deleted file mode 100644 index cde2aa2..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/applicator/allOf.js b/node_modules/ajv/dist/vocabularies/applicator/allOf.js deleted file mode 100644 index 1b1ae73..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/allOf.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const util_1 = require("../../compile/util"); -const def = { - keyword: "allOf", - schemaType: "array", - code(cxt) { - const { gen, schema, it } = cxt; - /* istanbul ignore if */ - if (!Array.isArray(schema)) - throw new Error("ajv implementation error"); - const valid = gen.name("valid"); - schema.forEach((sch, i) => { - if ((0, util_1.alwaysValidSchema)(it, sch)) - return; - const schCxt = cxt.subschema({ keyword: "allOf", schemaProp: i }, valid); - cxt.ok(valid); - cxt.mergeEvaluated(schCxt); - }); - }, -}; -exports.default = def; -//# sourceMappingURL=allOf.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map b/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map deleted file mode 100644 index d119d0e..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"allOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/allOf.ts"],"names":[],"mappings":";;AAEA,6CAAoD;AAEpD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC7B,wBAAwB;QACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QACvE,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,MAAM,CAAC,OAAO,CAAC,CAAC,GAAc,EAAE,CAAS,EAAE,EAAE;YAC3C,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,GAAG,CAAC;gBAAE,OAAM;YACtC,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAAC,EAAE,KAAK,CAAC,CAAA;YACtE,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;YACb,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;QAC5B,CAAC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts b/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts deleted file mode 100644 index 61bca56..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { CodeKeywordDefinition, ErrorNoParams, AnySchema } from "../../types"; -export type AnyOfError = ErrorNoParams<"anyOf", AnySchema[]>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/applicator/anyOf.js b/node_modules/ajv/dist/vocabularies/applicator/anyOf.js deleted file mode 100644 index 66cfce2..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const code_1 = require("../code"); -const def = { - keyword: "anyOf", - schemaType: "array", - trackErrors: true, - code: code_1.validateUnion, - error: { message: "must match a schema in anyOf" }, -}; -exports.default = def; -//# sourceMappingURL=anyOf.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map b/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map deleted file mode 100644 index 537ffcb..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"anyOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/anyOf.ts"],"names":[],"mappings":";;AACA,kCAAqC;AAIrC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,IAAI;IACjB,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE,EAAC,OAAO,EAAE,8BAA8B,EAAC;CACjD,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts b/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts deleted file mode 100644 index 5493e84..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; -export type ContainsError = ErrorObject<"contains", { - minContains: number; - maxContains?: number; -}, AnySchema>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/applicator/contains.js b/node_modules/ajv/dist/vocabularies/applicator/contains.js deleted file mode 100644 index 6c5473f..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/contains.js +++ /dev/null @@ -1,95 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const util_1 = require("../../compile/util"); -const error = { - message: ({ params: { min, max } }) => max === undefined - ? (0, codegen_1.str) `must contain at least ${min} valid item(s)` - : (0, codegen_1.str) `must contain at least ${min} and no more than ${max} valid item(s)`, - params: ({ params: { min, max } }) => max === undefined ? (0, codegen_1._) `{minContains: ${min}}` : (0, codegen_1._) `{minContains: ${min}, maxContains: ${max}}`, -}; -const def = { - keyword: "contains", - type: "array", - schemaType: ["object", "boolean"], - before: "uniqueItems", - trackErrors: true, - error, - code(cxt) { - const { gen, schema, parentSchema, data, it } = cxt; - let min; - let max; - const { minContains, maxContains } = parentSchema; - if (it.opts.next) { - min = minContains === undefined ? 1 : minContains; - max = maxContains; - } - else { - min = 1; - } - const len = gen.const("len", (0, codegen_1._) `${data}.length`); - cxt.setParams({ min, max }); - if (max === undefined && min === 0) { - (0, util_1.checkStrictMode)(it, `"minContains" == 0 without "maxContains": "contains" keyword ignored`); - return; - } - if (max !== undefined && min > max) { - (0, util_1.checkStrictMode)(it, `"minContains" > "maxContains" is always invalid`); - cxt.fail(); - return; - } - if ((0, util_1.alwaysValidSchema)(it, schema)) { - let cond = (0, codegen_1._) `${len} >= ${min}`; - if (max !== undefined) - cond = (0, codegen_1._) `${cond} && ${len} <= ${max}`; - cxt.pass(cond); - return; - } - it.items = true; - const valid = gen.name("valid"); - if (max === undefined && min === 1) { - validateItems(valid, () => gen.if(valid, () => gen.break())); - } - else if (min === 0) { - gen.let(valid, true); - if (max !== undefined) - gen.if((0, codegen_1._) `${data}.length > 0`, validateItemsWithCount); - } - else { - gen.let(valid, false); - validateItemsWithCount(); - } - cxt.result(valid, () => cxt.reset()); - function validateItemsWithCount() { - const schValid = gen.name("_valid"); - const count = gen.let("count", 0); - validateItems(schValid, () => gen.if(schValid, () => checkLimits(count))); - } - function validateItems(_valid, block) { - gen.forRange("i", 0, len, (i) => { - cxt.subschema({ - keyword: "contains", - dataProp: i, - dataPropType: util_1.Type.Num, - compositeRule: true, - }, _valid); - block(); - }); - } - function checkLimits(count) { - gen.code((0, codegen_1._) `${count}++`); - if (max === undefined) { - gen.if((0, codegen_1._) `${count} >= ${min}`, () => gen.assign(valid, true).break()); - } - else { - gen.if((0, codegen_1._) `${count} > ${max}`, () => gen.assign(valid, false).break()); - if (min === 1) - gen.assign(valid, true); - else - gen.if((0, codegen_1._) `${count} >= ${min}`, () => gen.assign(valid, true)); - } - } - }, -}; -exports.default = def; -//# sourceMappingURL=contains.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/contains.js.map b/node_modules/ajv/dist/vocabularies/applicator/contains.js.map deleted file mode 100644 index 4157928..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contains.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/contains.ts"],"names":[],"mappings":";;AAOA,mDAAkD;AAClD,6CAA2E;AAQ3E,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,GAAG,EAAC,EAAC,EAAE,EAAE,CAChC,GAAG,KAAK,SAAS;QACf,CAAC,CAAC,IAAA,aAAG,EAAA,yBAAyB,GAAG,gBAAgB;QACjD,CAAC,CAAC,IAAA,aAAG,EAAA,yBAAyB,GAAG,qBAAqB,GAAG,gBAAgB;IAC7E,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,GAAG,EAAC,EAAC,EAAE,EAAE,CAC/B,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,iBAAiB,GAAG,GAAG,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,iBAAiB,GAAG,kBAAkB,GAAG,GAAG;CAC/F,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,MAAM,EAAE,aAAa;IACrB,WAAW,EAAE,IAAI;IACjB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACjD,IAAI,GAAW,CAAA;QACf,IAAI,GAAuB,CAAA;QAC3B,MAAM,EAAC,WAAW,EAAE,WAAW,EAAC,GAAG,YAAY,CAAA;QAC/C,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACjB,GAAG,GAAG,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAA;YACjD,GAAG,GAAG,WAAW,CAAA;QACnB,CAAC;aAAM,CAAC;YACN,GAAG,GAAG,CAAC,CAAA;QACT,CAAC;QACD,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,SAAS,CAAC,CAAA;QAC/C,GAAG,CAAC,SAAS,CAAC,EAAC,GAAG,EAAE,GAAG,EAAC,CAAC,CAAA;QACzB,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;YACnC,IAAA,sBAAe,EAAC,EAAE,EAAE,sEAAsE,CAAC,CAAA;YAC3F,OAAM;QACR,CAAC;QACD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC;YACnC,IAAA,sBAAe,EAAC,EAAE,EAAE,iDAAiD,CAAC,CAAA;YACtE,GAAG,CAAC,IAAI,EAAE,CAAA;YACV,OAAM;QACR,CAAC;QACD,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;YAClC,IAAI,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,GAAG,OAAO,GAAG,EAAE,CAAA;YAC9B,IAAI,GAAG,KAAK,SAAS;gBAAE,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,OAAO,GAAG,OAAO,GAAG,EAAE,CAAA;YAC5D,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACd,OAAM;QACR,CAAC;QAED,EAAE,CAAC,KAAK,GAAG,IAAI,CAAA;QACf,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;YACnC,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;QAC9D,CAAC;aAAM,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;YACrB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;YACpB,IAAI,GAAG,KAAK,SAAS;gBAAE,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,aAAa,EAAE,sBAAsB,CAAC,CAAA;QAC9E,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;YACrB,sBAAsB,EAAE,CAAA;QAC1B,CAAC;QACD,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;QAEpC,SAAS,sBAAsB;YAC7B,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YACnC,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;YACjC,aAAa,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAC3E,CAAC;QAED,SAAS,aAAa,CAAC,MAAY,EAAE,KAAiB;YACpD,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE;gBAC9B,GAAG,CAAC,SAAS,CACX;oBACE,OAAO,EAAE,UAAU;oBACnB,QAAQ,EAAE,CAAC;oBACX,YAAY,EAAE,WAAI,CAAC,GAAG;oBACtB,aAAa,EAAE,IAAI;iBACpB,EACD,MAAM,CACP,CAAA;gBACD,KAAK,EAAE,CAAA;YACT,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,SAAS,WAAW,CAAC,KAAW;YAC9B,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,IAAI,CAAC,CAAA;YACvB,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;gBACtB,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,OAAO,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;YACtE,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,MAAM,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;gBACpE,IAAI,GAAG,KAAK,CAAC;oBAAE,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;;oBACjC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,OAAO,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;YACnE,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts b/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts deleted file mode 100644 index 05900e0..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition, SchemaMap, AnySchema } from "../../types"; -import type { KeywordCxt } from "../../compile/validate"; -export type PropertyDependencies = { - [K in string]?: string[]; -}; -export interface DependenciesErrorParams { - property: string; - missingProperty: string; - depsCount: number; - deps: string; -} -export type DependenciesError = ErrorObject<"dependencies", DependenciesErrorParams, { - [K in string]?: string[] | AnySchema; -}>; -export declare const error: KeywordErrorDefinition; -declare const def: CodeKeywordDefinition; -export declare function validatePropertyDeps(cxt: KeywordCxt, propertyDeps?: { - [K in string]?: string[]; -}): void; -export declare function validateSchemaDeps(cxt: KeywordCxt, schemaDeps?: SchemaMap): void; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/applicator/dependencies.js b/node_modules/ajv/dist/vocabularies/applicator/dependencies.js deleted file mode 100644 index e81f86d..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +++ /dev/null @@ -1,85 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0; -const codegen_1 = require("../../compile/codegen"); -const util_1 = require("../../compile/util"); -const code_1 = require("../code"); -exports.error = { - message: ({ params: { property, depsCount, deps } }) => { - const property_ies = depsCount === 1 ? "property" : "properties"; - return (0, codegen_1.str) `must have ${property_ies} ${deps} when property ${property} is present`; - }, - params: ({ params: { property, depsCount, deps, missingProperty } }) => (0, codegen_1._) `{property: ${property}, - missingProperty: ${missingProperty}, - depsCount: ${depsCount}, - deps: ${deps}}`, // TODO change to reference -}; -const def = { - keyword: "dependencies", - type: "object", - schemaType: "object", - error: exports.error, - code(cxt) { - const [propDeps, schDeps] = splitDependencies(cxt); - validatePropertyDeps(cxt, propDeps); - validateSchemaDeps(cxt, schDeps); - }, -}; -function splitDependencies({ schema }) { - const propertyDeps = {}; - const schemaDeps = {}; - for (const key in schema) { - if (key === "__proto__") - continue; - const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps; - deps[key] = schema[key]; - } - return [propertyDeps, schemaDeps]; -} -function validatePropertyDeps(cxt, propertyDeps = cxt.schema) { - const { gen, data, it } = cxt; - if (Object.keys(propertyDeps).length === 0) - return; - const missing = gen.let("missing"); - for (const prop in propertyDeps) { - const deps = propertyDeps[prop]; - if (deps.length === 0) - continue; - const hasProperty = (0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties); - cxt.setParams({ - property: prop, - depsCount: deps.length, - deps: deps.join(", "), - }); - if (it.allErrors) { - gen.if(hasProperty, () => { - for (const depProp of deps) { - (0, code_1.checkReportMissingProp)(cxt, depProp); - } - }); - } - else { - gen.if((0, codegen_1._) `${hasProperty} && (${(0, code_1.checkMissingProp)(cxt, deps, missing)})`); - (0, code_1.reportMissingProp)(cxt, missing); - gen.else(); - } - } -} -exports.validatePropertyDeps = validatePropertyDeps; -function validateSchemaDeps(cxt, schemaDeps = cxt.schema) { - const { gen, data, keyword, it } = cxt; - const valid = gen.name("valid"); - for (const prop in schemaDeps) { - if ((0, util_1.alwaysValidSchema)(it, schemaDeps[prop])) - continue; - gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties), () => { - const schCxt = cxt.subschema({ keyword, schemaProp: prop }, valid); - cxt.mergeValidEvaluated(schCxt, valid); - }, () => gen.var(valid, true) // TODO var - ); - cxt.ok(valid); - } -} -exports.validateSchemaDeps = validateSchemaDeps; -exports.default = def; -//# sourceMappingURL=dependencies.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map b/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map deleted file mode 100644 index 50d7ca3..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/dependencies.ts"],"names":[],"mappings":";;;AAQA,mDAA4C;AAC5C,6CAAoD;AACpD,kCAAmG;AAmBtF,QAAA,KAAK,GAA2B;IAC3C,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAC,EAAC,EAAE,EAAE;QACjD,MAAM,YAAY,GAAG,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAA;QAChE,OAAO,IAAA,aAAG,EAAA,aAAa,YAAY,IAAI,IAAI,kBAAkB,QAAQ,aAAa,CAAA;IACpF,CAAC;IACD,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAC,EAAC,EAAE,EAAE,CACjE,IAAA,WAAC,EAAA,cAAc,QAAQ;uBACJ,eAAe;iBACrB,SAAS;YACd,IAAI,GAAG,EAAE,2BAA2B;CAC/C,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,cAAc;IACvB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAL,aAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAA;QAClD,oBAAoB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;QACnC,kBAAkB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAClC,CAAC;CACF,CAAA;AAED,SAAS,iBAAiB,CAAC,EAAC,MAAM,EAAa;IAC7C,MAAM,YAAY,GAAyB,EAAE,CAAA;IAC7C,MAAM,UAAU,GAAuB,EAAE,CAAA;IACzC,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,GAAG,KAAK,WAAW;YAAE,SAAQ;QACjC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAA;QACnE,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;IACzB,CAAC;IACD,OAAO,CAAC,YAAY,EAAE,UAAU,CAAC,CAAA;AACnC,CAAC;AAED,SAAgB,oBAAoB,CAClC,GAAe,EACf,eAA2C,GAAG,CAAC,MAAM;IAErD,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAC3B,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAM;IAClD,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IAClC,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;QAChC,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAa,CAAA;QAC3C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,SAAQ;QAC/B,MAAM,WAAW,GAAG,IAAA,qBAAc,EAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QAC1E,GAAG,CAAC,SAAS,CAAC;YACZ,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,IAAI,CAAC,MAAM;YACtB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;SACtB,CAAC,CAAA;QACF,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC;YACjB,GAAG,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;gBACvB,KAAK,MAAM,OAAO,IAAI,IAAI,EAAE,CAAC;oBAC3B,IAAA,6BAAsB,EAAC,GAAG,EAAE,OAAO,CAAC,CAAA;gBACtC,CAAC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,WAAW,QAAQ,IAAA,uBAAgB,EAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA;YACtE,IAAA,wBAAiB,EAAC,GAAG,EAAE,OAAO,CAAC,CAAA;YAC/B,GAAG,CAAC,IAAI,EAAE,CAAA;QACZ,CAAC;IACH,CAAC;AACH,CAAC;AA5BD,oDA4BC;AAED,SAAgB,kBAAkB,CAAC,GAAe,EAAE,aAAwB,GAAG,CAAC,MAAM;IACpF,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IACpC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/B,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,UAAU,CAAC,IAAI,CAAc,CAAC;YAAE,SAAQ;QAClE,GAAG,CAAC,EAAE,CACJ,IAAA,qBAAc,EAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,EACtD,GAAG,EAAE;YACH,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;YAChE,GAAG,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACxC,CAAC,EACD,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,WAAW;SACvC,CAAA;QACD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;AACH,CAAC;AAfD,gDAeC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts b/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts deleted file mode 100644 index cde2aa2..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js b/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js deleted file mode 100644 index 66ef2e8..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const dependencies_1 = require("./dependencies"); -const def = { - keyword: "dependentSchemas", - type: "object", - schemaType: "object", - code: (cxt) => (0, dependencies_1.validateSchemaDeps)(cxt), -}; -exports.default = def; -//# sourceMappingURL=dependentSchemas.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map b/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map deleted file mode 100644 index 17712e6..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dependentSchemas.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/dependentSchemas.ts"],"names":[],"mappings":";;AACA,iDAAiD;AAEjD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,iCAAkB,EAAC,GAAG,CAAC;CACvC,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/if.d.ts b/node_modules/ajv/dist/vocabularies/applicator/if.d.ts deleted file mode 100644 index 8f602e3..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/if.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; -export type IfKeywordError = ErrorObject<"if", { - failingKeyword: string; -}, AnySchema>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/applicator/if.js b/node_modules/ajv/dist/vocabularies/applicator/if.js deleted file mode 100644 index 2c42a3e..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/if.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const util_1 = require("../../compile/util"); -const error = { - message: ({ params }) => (0, codegen_1.str) `must match "${params.ifClause}" schema`, - params: ({ params }) => (0, codegen_1._) `{failingKeyword: ${params.ifClause}}`, -}; -const def = { - keyword: "if", - schemaType: ["object", "boolean"], - trackErrors: true, - error, - code(cxt) { - const { gen, parentSchema, it } = cxt; - if (parentSchema.then === undefined && parentSchema.else === undefined) { - (0, util_1.checkStrictMode)(it, '"if" without "then" and "else" is ignored'); - } - const hasThen = hasSchema(it, "then"); - const hasElse = hasSchema(it, "else"); - if (!hasThen && !hasElse) - return; - const valid = gen.let("valid", true); - const schValid = gen.name("_valid"); - validateIf(); - cxt.reset(); - if (hasThen && hasElse) { - const ifClause = gen.let("ifClause"); - cxt.setParams({ ifClause }); - gen.if(schValid, validateClause("then", ifClause), validateClause("else", ifClause)); - } - else if (hasThen) { - gen.if(schValid, validateClause("then")); - } - else { - gen.if((0, codegen_1.not)(schValid), validateClause("else")); - } - cxt.pass(valid, () => cxt.error(true)); - function validateIf() { - const schCxt = cxt.subschema({ - keyword: "if", - compositeRule: true, - createErrors: false, - allErrors: false, - }, schValid); - cxt.mergeEvaluated(schCxt); - } - function validateClause(keyword, ifClause) { - return () => { - const schCxt = cxt.subschema({ keyword }, schValid); - gen.assign(valid, schValid); - cxt.mergeValidEvaluated(schCxt, valid); - if (ifClause) - gen.assign(ifClause, (0, codegen_1._) `${keyword}`); - else - cxt.setParams({ ifClause: keyword }); - }; - } - }, -}; -function hasSchema(it, keyword) { - const schema = it.schema[keyword]; - return schema !== undefined && !(0, util_1.alwaysValidSchema)(it, schema); -} -exports.default = def; -//# sourceMappingURL=if.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/if.js.map b/node_modules/ajv/dist/vocabularies/applicator/if.js.map deleted file mode 100644 index 54efb1d..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/if.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"if.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/if.ts"],"names":[],"mappings":";;AAQA,mDAAuD;AACvD,6CAAqE;AAIrE,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,eAAe,MAAM,CAAC,QAAQ,UAAU;IAClE,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,oBAAoB,MAAM,CAAC,QAAQ,GAAG;CAC9D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,WAAW,EAAE,IAAI;IACjB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,IAAI,YAAY,CAAC,IAAI,KAAK,SAAS,IAAI,YAAY,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACvE,IAAA,sBAAe,EAAC,EAAE,EAAE,2CAA2C,CAAC,CAAA;QAClE,CAAC;QACD,MAAM,OAAO,GAAG,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;QACrC,MAAM,OAAO,GAAG,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;QACrC,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO;YAAE,OAAM;QAEhC,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QACpC,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACnC,UAAU,EAAE,CAAA;QACZ,GAAG,CAAC,KAAK,EAAE,CAAA;QAEX,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;YACvB,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;YACpC,GAAG,CAAC,SAAS,CAAC,EAAC,QAAQ,EAAC,CAAC,CAAA;YACzB,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAA;QACtF,CAAC;aAAM,IAAI,OAAO,EAAE,CAAC;YACnB,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAA;QAC1C,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,QAAQ,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAA;QAC/C,CAAC;QAED,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;QAEtC,SAAS,UAAU;YACjB,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAC1B;gBACE,OAAO,EAAE,IAAI;gBACb,aAAa,EAAE,IAAI;gBACnB,YAAY,EAAE,KAAK;gBACnB,SAAS,EAAE,KAAK;aACjB,EACD,QAAQ,CACT,CAAA;YACD,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;QAC5B,CAAC;QAED,SAAS,cAAc,CAAC,OAAe,EAAE,QAAe;YACtD,OAAO,GAAG,EAAE;gBACV,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAC,EAAE,QAAQ,CAAC,CAAA;gBACjD,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;gBAC3B,GAAG,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;gBACtC,IAAI,QAAQ;oBAAE,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAA,WAAC,EAAA,GAAG,OAAO,EAAE,CAAC,CAAA;;oBAC5C,GAAG,CAAC,SAAS,CAAC,EAAC,QAAQ,EAAE,OAAO,EAAC,CAAC,CAAA;YACzC,CAAC,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,SAAS,SAAS,CAAC,EAAgB,EAAE,OAAe;IAClD,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACjC,OAAO,MAAM,KAAK,SAAS,IAAI,CAAC,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,CAAA;AAC/D,CAAC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/index.d.ts b/node_modules/ajv/dist/vocabularies/applicator/index.d.ts deleted file mode 100644 index b9cc5f5..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { ErrorNoParams, Vocabulary } from "../../types"; -import { AdditionalItemsError } from "./additionalItems"; -import { ItemsError } from "./items2020"; -import { ContainsError } from "./contains"; -import { DependenciesError } from "./dependencies"; -import { PropertyNamesError } from "./propertyNames"; -import { AdditionalPropertiesError } from "./additionalProperties"; -import { NotKeywordError } from "./not"; -import { AnyOfError } from "./anyOf"; -import { OneOfError } from "./oneOf"; -import { IfKeywordError } from "./if"; -export default function getApplicator(draft2020?: boolean): Vocabulary; -export type ApplicatorKeywordError = ErrorNoParams<"false schema"> | AdditionalItemsError | ItemsError | ContainsError | AdditionalPropertiesError | DependenciesError | IfKeywordError | AnyOfError | OneOfError | NotKeywordError | PropertyNamesError; diff --git a/node_modules/ajv/dist/vocabularies/applicator/index.js b/node_modules/ajv/dist/vocabularies/applicator/index.js deleted file mode 100644 index cf592f2..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/index.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const additionalItems_1 = require("./additionalItems"); -const prefixItems_1 = require("./prefixItems"); -const items_1 = require("./items"); -const items2020_1 = require("./items2020"); -const contains_1 = require("./contains"); -const dependencies_1 = require("./dependencies"); -const propertyNames_1 = require("./propertyNames"); -const additionalProperties_1 = require("./additionalProperties"); -const properties_1 = require("./properties"); -const patternProperties_1 = require("./patternProperties"); -const not_1 = require("./not"); -const anyOf_1 = require("./anyOf"); -const oneOf_1 = require("./oneOf"); -const allOf_1 = require("./allOf"); -const if_1 = require("./if"); -const thenElse_1 = require("./thenElse"); -function getApplicator(draft2020 = false) { - const applicator = [ - // any - not_1.default, - anyOf_1.default, - oneOf_1.default, - allOf_1.default, - if_1.default, - thenElse_1.default, - // object - propertyNames_1.default, - additionalProperties_1.default, - dependencies_1.default, - properties_1.default, - patternProperties_1.default, - ]; - // array - if (draft2020) - applicator.push(prefixItems_1.default, items2020_1.default); - else - applicator.push(additionalItems_1.default, items_1.default); - applicator.push(contains_1.default); - return applicator; -} -exports.default = getApplicator; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/index.js.map b/node_modules/ajv/dist/vocabularies/applicator/index.js.map deleted file mode 100644 index ebcb853..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/index.ts"],"names":[],"mappings":";;AACA,uDAAuE;AACvE,+CAAuC;AACvC,mCAA2B;AAC3B,2CAAiD;AACjD,yCAAkD;AAClD,iDAA8D;AAC9D,mDAAiE;AACjE,iEAAsF;AACtF,6CAAqC;AACrC,2DAAmD;AACnD,+BAAiD;AACjD,mCAAyC;AACzC,mCAAyC;AACzC,mCAA2B;AAC3B,6BAA8C;AAC9C,yCAAiC;AAEjC,SAAwB,aAAa,CAAC,SAAS,GAAG,KAAK;IACrD,MAAM,UAAU,GAAG;QACjB,MAAM;QACN,aAAU;QACV,eAAK;QACL,eAAK;QACL,eAAK;QACL,YAAS;QACT,kBAAQ;QACR,SAAS;QACT,uBAAa;QACb,8BAAoB;QACpB,sBAAY;QACZ,oBAAU;QACV,2BAAiB;KAClB,CAAA;IACD,QAAQ;IACR,IAAI,SAAS;QAAE,UAAU,CAAC,IAAI,CAAC,qBAAW,EAAE,mBAAS,CAAC,CAAA;;QACjD,UAAU,CAAC,IAAI,CAAC,yBAAe,EAAE,eAAK,CAAC,CAAA;IAC5C,UAAU,CAAC,IAAI,CAAC,kBAAQ,CAAC,CAAA;IACzB,OAAO,UAAU,CAAA;AACnB,CAAC;AArBD,gCAqBC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/items.d.ts b/node_modules/ajv/dist/vocabularies/applicator/items.d.ts deleted file mode 100644 index 8e608ca..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/items.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { CodeKeywordDefinition, AnySchema } from "../../types"; -import type { KeywordCxt } from "../../compile/validate"; -declare const def: CodeKeywordDefinition; -export declare function validateTuple(cxt: KeywordCxt, extraItems: string, schArr?: AnySchema[]): void; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/applicator/items.js b/node_modules/ajv/dist/vocabularies/applicator/items.js deleted file mode 100644 index 26f527b..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/items.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.validateTuple = void 0; -const codegen_1 = require("../../compile/codegen"); -const util_1 = require("../../compile/util"); -const code_1 = require("../code"); -const def = { - keyword: "items", - type: "array", - schemaType: ["object", "array", "boolean"], - before: "uniqueItems", - code(cxt) { - const { schema, it } = cxt; - if (Array.isArray(schema)) - return validateTuple(cxt, "additionalItems", schema); - it.items = true; - if ((0, util_1.alwaysValidSchema)(it, schema)) - return; - cxt.ok((0, code_1.validateArray)(cxt)); - }, -}; -function validateTuple(cxt, extraItems, schArr = cxt.schema) { - const { gen, parentSchema, data, keyword, it } = cxt; - checkStrictTuple(parentSchema); - if (it.opts.unevaluated && schArr.length && it.items !== true) { - it.items = util_1.mergeEvaluated.items(gen, schArr.length, it.items); - } - const valid = gen.name("valid"); - const len = gen.const("len", (0, codegen_1._) `${data}.length`); - schArr.forEach((sch, i) => { - if ((0, util_1.alwaysValidSchema)(it, sch)) - return; - gen.if((0, codegen_1._) `${len} > ${i}`, () => cxt.subschema({ - keyword, - schemaProp: i, - dataProp: i, - }, valid)); - cxt.ok(valid); - }); - function checkStrictTuple(sch) { - const { opts, errSchemaPath } = it; - const l = schArr.length; - const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false); - if (opts.strictTuples && !fullTuple) { - const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"`; - (0, util_1.checkStrictMode)(it, msg, opts.strictTuples); - } - } -} -exports.validateTuple = validateTuple; -exports.default = def; -//# sourceMappingURL=items.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/items.js.map b/node_modules/ajv/dist/vocabularies/applicator/items.js.map deleted file mode 100644 index ef55118..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/items.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"items.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/items.ts"],"names":[],"mappings":";;;AAEA,mDAAuC;AACvC,6CAAqF;AACrF,kCAAqC;AAErC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;IAC1C,MAAM,EAAE,aAAa;IACrB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACxB,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,OAAO,aAAa,CAAC,GAAG,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAA;QAC/E,EAAE,CAAC,KAAK,GAAG,IAAI,CAAA;QACf,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,GAAG,CAAC,EAAE,CAAC,IAAA,oBAAa,EAAC,GAAG,CAAC,CAAC,CAAA;IAC5B,CAAC;CACF,CAAA;AAED,SAAgB,aAAa,CAC3B,GAAe,EACf,UAAkB,EAClB,SAAsB,GAAG,CAAC,MAAM;IAEhC,MAAM,EAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAClD,gBAAgB,CAAC,YAAY,CAAC,CAAA;IAC9B,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;QAC9D,EAAE,CAAC,KAAK,GAAG,qBAAc,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,CAAA;IAC/D,CAAC;IACD,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/B,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,SAAS,CAAC,CAAA;IAC/C,MAAM,CAAC,OAAO,CAAC,CAAC,GAAc,EAAE,CAAS,EAAE,EAAE;QAC3C,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,GAAG,CAAC;YAAE,OAAM;QACtC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,CAC5B,GAAG,CAAC,SAAS,CACX;YACE,OAAO;YACP,UAAU,EAAE,CAAC;YACb,QAAQ,EAAE,CAAC;SACZ,EACD,KAAK,CACN,CACF,CAAA;QACD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC,CAAC,CAAA;IAEF,SAAS,gBAAgB,CAAC,GAAoB;QAC5C,MAAM,EAAC,IAAI,EAAE,aAAa,EAAC,GAAG,EAAE,CAAA;QAChC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAA;QACvB,MAAM,SAAS,GAAG,CAAC,KAAK,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,KAAK,CAAC,CAAA;QACzF,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,SAAS,EAAE,CAAC;YACpC,MAAM,GAAG,GAAG,IAAI,OAAO,QAAQ,CAAC,oCAAoC,UAAU,4CAA4C,aAAa,GAAG,CAAA;YAC1I,IAAA,sBAAe,EAAC,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;QAC7C,CAAC;IACH,CAAC;AACH,CAAC;AApCD,sCAoCC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts b/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts deleted file mode 100644 index a2565b2..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; -export type ItemsError = ErrorObject<"items", { - limit: number; -}, AnySchema>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/applicator/items2020.js b/node_modules/ajv/dist/vocabularies/applicator/items2020.js deleted file mode 100644 index f2387d7..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/items2020.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const util_1 = require("../../compile/util"); -const code_1 = require("../code"); -const additionalItems_1 = require("./additionalItems"); -const error = { - message: ({ params: { len } }) => (0, codegen_1.str) `must NOT have more than ${len} items`, - params: ({ params: { len } }) => (0, codegen_1._) `{limit: ${len}}`, -}; -const def = { - keyword: "items", - type: "array", - schemaType: ["object", "boolean"], - before: "uniqueItems", - error, - code(cxt) { - const { schema, parentSchema, it } = cxt; - const { prefixItems } = parentSchema; - it.items = true; - if ((0, util_1.alwaysValidSchema)(it, schema)) - return; - if (prefixItems) - (0, additionalItems_1.validateAdditionalItems)(cxt, prefixItems); - else - cxt.ok((0, code_1.validateArray)(cxt)); - }, -}; -exports.default = def; -//# sourceMappingURL=items2020.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map b/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map deleted file mode 100644 index 5034acd..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"items2020.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/items2020.ts"],"names":[],"mappings":";;AAOA,mDAA4C;AAC5C,6CAAoD;AACpD,kCAAqC;AACrC,uDAAyD;AAIzD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,2BAA2B,GAAG,QAAQ;IACvE,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,GAAG,GAAG;CAChD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,MAAM,EAAE,aAAa;IACrB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,MAAM,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACtC,MAAM,EAAC,WAAW,EAAC,GAAG,YAAY,CAAA;QAClC,EAAE,CAAC,KAAK,GAAG,IAAI,CAAA;QACf,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,IAAI,WAAW;YAAE,IAAA,yCAAuB,EAAC,GAAG,EAAE,WAAW,CAAC,CAAA;;YACrD,GAAG,CAAC,EAAE,CAAC,IAAA,oBAAa,EAAC,GAAG,CAAC,CAAC,CAAA;IACjC,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/not.d.ts b/node_modules/ajv/dist/vocabularies/applicator/not.d.ts deleted file mode 100644 index d2f4888..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/not.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { CodeKeywordDefinition, ErrorNoParams, AnySchema } from "../../types"; -export type NotKeywordError = ErrorNoParams<"not", AnySchema>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/applicator/not.js b/node_modules/ajv/dist/vocabularies/applicator/not.js deleted file mode 100644 index 89f6fdd..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/not.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const util_1 = require("../../compile/util"); -const def = { - keyword: "not", - schemaType: ["object", "boolean"], - trackErrors: true, - code(cxt) { - const { gen, schema, it } = cxt; - if ((0, util_1.alwaysValidSchema)(it, schema)) { - cxt.fail(); - return; - } - const valid = gen.name("valid"); - cxt.subschema({ - keyword: "not", - compositeRule: true, - createErrors: false, - allErrors: false, - }, valid); - cxt.failResult(valid, () => cxt.reset(), () => cxt.error()); - }, - error: { message: "must NOT be valid" }, -}; -exports.default = def; -//# sourceMappingURL=not.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/not.js.map b/node_modules/ajv/dist/vocabularies/applicator/not.js.map deleted file mode 100644 index d99e6ea..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/not.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"not.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/not.ts"],"names":[],"mappings":";;AAEA,6CAAoD;AAIpD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,WAAW,EAAE,IAAI;IACjB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC7B,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;YAClC,GAAG,CAAC,IAAI,EAAE,CAAA;YACV,OAAM;QACR,CAAC;QAED,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,GAAG,CAAC,SAAS,CACX;YACE,OAAO,EAAE,KAAK;YACd,aAAa,EAAE,IAAI;YACnB,YAAY,EAAE,KAAK;YACnB,SAAS,EAAE,KAAK;SACjB,EACD,KAAK,CACN,CAAA;QAED,GAAG,CAAC,UAAU,CACZ,KAAK,EACL,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,EACjB,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAClB,CAAA;IACH,CAAC;IACD,KAAK,EAAE,EAAC,OAAO,EAAE,mBAAmB,EAAC;CACtC,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts b/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts deleted file mode 100644 index 1e1d34f..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; -export type OneOfError = ErrorObject<"oneOf", { - passingSchemas: [number, number] | null; -}, AnySchema[]>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/applicator/oneOf.js b/node_modules/ajv/dist/vocabularies/applicator/oneOf.js deleted file mode 100644 index 441db2a..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const util_1 = require("../../compile/util"); -const error = { - message: "must match exactly one schema in oneOf", - params: ({ params }) => (0, codegen_1._) `{passingSchemas: ${params.passing}}`, -}; -const def = { - keyword: "oneOf", - schemaType: "array", - trackErrors: true, - error, - code(cxt) { - const { gen, schema, parentSchema, it } = cxt; - /* istanbul ignore if */ - if (!Array.isArray(schema)) - throw new Error("ajv implementation error"); - if (it.opts.discriminator && parentSchema.discriminator) - return; - const schArr = schema; - const valid = gen.let("valid", false); - const passing = gen.let("passing", null); - const schValid = gen.name("_valid"); - cxt.setParams({ passing }); - // TODO possibly fail straight away (with warning or exception) if there are two empty always valid schemas - gen.block(validateOneOf); - cxt.result(valid, () => cxt.reset(), () => cxt.error(true)); - function validateOneOf() { - schArr.forEach((sch, i) => { - let schCxt; - if ((0, util_1.alwaysValidSchema)(it, sch)) { - gen.var(schValid, true); - } - else { - schCxt = cxt.subschema({ - keyword: "oneOf", - schemaProp: i, - compositeRule: true, - }, schValid); - } - if (i > 0) { - gen - .if((0, codegen_1._) `${schValid} && ${valid}`) - .assign(valid, false) - .assign(passing, (0, codegen_1._) `[${passing}, ${i}]`) - .else(); - } - gen.if(schValid, () => { - gen.assign(valid, true); - gen.assign(passing, i); - if (schCxt) - cxt.mergeEvaluated(schCxt, codegen_1.Name); - }); - }); - } - }, -}; -exports.default = def; -//# sourceMappingURL=oneOf.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map b/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map deleted file mode 100644 index 13b8bfe..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oneOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/oneOf.ts"],"names":[],"mappings":";;AAOA,mDAA6C;AAC7C,6CAAoD;AASpD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,wCAAwC;IACjD,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,oBAAoB,MAAM,CAAC,OAAO,GAAG;CAC7D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,IAAI;IACjB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC3C,wBAAwB;QACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QACvE,IAAI,EAAE,CAAC,IAAI,CAAC,aAAa,IAAI,YAAY,CAAC,aAAa;YAAE,OAAM;QAC/D,MAAM,MAAM,GAAgB,MAAM,CAAA;QAClC,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;QACrC,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;QACxC,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACnC,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAC,CAAC,CAAA;QACxB,2GAA2G;QAE3G,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QAExB,GAAG,CAAC,MAAM,CACR,KAAK,EACL,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,EACjB,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CACtB,CAAA;QAED,SAAS,aAAa;YACpB,MAAM,CAAC,OAAO,CAAC,CAAC,GAAc,EAAE,CAAS,EAAE,EAAE;gBAC3C,IAAI,MAA6B,CAAA;gBACjC,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC;oBAC/B,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;gBACzB,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,GAAG,CAAC,SAAS,CACpB;wBACE,OAAO,EAAE,OAAO;wBAChB,UAAU,EAAE,CAAC;wBACb,aAAa,EAAE,IAAI;qBACpB,EACD,QAAQ,CACT,CAAA;gBACH,CAAC;gBAED,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;oBACV,GAAG;yBACA,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,QAAQ,OAAO,KAAK,EAAE,CAAC;yBAC9B,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC;yBACpB,MAAM,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,IAAI,OAAO,KAAK,CAAC,GAAG,CAAC;yBACtC,IAAI,EAAE,CAAA;gBACX,CAAC;gBAED,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;oBACpB,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;oBACvB,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;oBACtB,IAAI,MAAM;wBAAE,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,cAAI,CAAC,CAAA;gBAC9C,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts b/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts deleted file mode 100644 index cde2aa2..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js b/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js deleted file mode 100644 index 48501c6..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const code_1 = require("../code"); -const codegen_1 = require("../../compile/codegen"); -const util_1 = require("../../compile/util"); -const util_2 = require("../../compile/util"); -const def = { - keyword: "patternProperties", - type: "object", - schemaType: "object", - code(cxt) { - const { gen, schema, data, parentSchema, it } = cxt; - const { opts } = it; - const patterns = (0, code_1.allSchemaProperties)(schema); - const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it, schema[p])); - if (patterns.length === 0 || - (alwaysValidPatterns.length === patterns.length && - (!it.opts.unevaluated || it.props === true))) { - return; - } - const checkProperties = opts.strictSchema && !opts.allowMatchingProperties && parentSchema.properties; - const valid = gen.name("valid"); - if (it.props !== true && !(it.props instanceof codegen_1.Name)) { - it.props = (0, util_2.evaluatedPropsToName)(gen, it.props); - } - const { props } = it; - validatePatternProperties(); - function validatePatternProperties() { - for (const pat of patterns) { - if (checkProperties) - checkMatchingProperties(pat); - if (it.allErrors) { - validateProperties(pat); - } - else { - gen.var(valid, true); // TODO var - validateProperties(pat); - gen.if(valid); - } - } - } - function checkMatchingProperties(pat) { - for (const prop in checkProperties) { - if (new RegExp(pat).test(prop)) { - (0, util_1.checkStrictMode)(it, `property ${prop} matches pattern ${pat} (use allowMatchingProperties)`); - } - } - } - function validateProperties(pat) { - gen.forIn("key", data, (key) => { - gen.if((0, codegen_1._) `${(0, code_1.usePattern)(cxt, pat)}.test(${key})`, () => { - const alwaysValid = alwaysValidPatterns.includes(pat); - if (!alwaysValid) { - cxt.subschema({ - keyword: "patternProperties", - schemaProp: pat, - dataProp: key, - dataPropType: util_2.Type.Str, - }, valid); - } - if (it.opts.unevaluated && props !== true) { - gen.assign((0, codegen_1._) `${props}[${key}]`, true); - } - else if (!alwaysValid && !it.allErrors) { - // can short-circuit if `unevaluatedProperties` is not supported (opts.next === false) - // or if all properties were evaluated (props === true) - gen.if((0, codegen_1.not)(valid), () => gen.break()); - } - }); - }); - } - }, -}; -exports.default = def; -//# sourceMappingURL=patternProperties.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map b/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map deleted file mode 100644 index 231b081..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"patternProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/patternProperties.ts"],"names":[],"mappings":";;AAEA,kCAAuD;AACvD,mDAAkD;AAClD,6CAAqE;AACrE,6CAA6D;AAG7D,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,mBAAmB;IAC5B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACjD,MAAM,EAAC,IAAI,EAAC,GAAG,EAAE,CAAA;QACjB,MAAM,QAAQ,GAAG,IAAA,0BAAmB,EAAC,MAAM,CAAC,CAAA;QAC5C,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAChD,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAc,CAAC,CAC9C,CAAA;QAED,IACE,QAAQ,CAAC,MAAM,KAAK,CAAC;YACrB,CAAC,mBAAmB,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM;gBAC7C,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,EAC9C,CAAC;YACD,OAAM;QACR,CAAC;QAED,MAAM,eAAe,GACnB,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,uBAAuB,IAAI,YAAY,CAAC,UAAU,CAAA;QAC/E,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,YAAY,cAAI,CAAC,EAAE,CAAC;YACrD,EAAE,CAAC,KAAK,GAAG,IAAA,2BAAoB,EAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,CAAA;QAChD,CAAC;QACD,MAAM,EAAC,KAAK,EAAC,GAAG,EAAE,CAAA;QAClB,yBAAyB,EAAE,CAAA;QAE3B,SAAS,yBAAyB;YAChC,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;gBAC3B,IAAI,eAAe;oBAAE,uBAAuB,CAAC,GAAG,CAAC,CAAA;gBACjD,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC;oBACjB,kBAAkB,CAAC,GAAG,CAAC,CAAA;gBACzB,CAAC;qBAAM,CAAC;oBACN,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA,CAAC,WAAW;oBAChC,kBAAkB,CAAC,GAAG,CAAC,CAAA;oBACvB,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;gBACf,CAAC;YACH,CAAC;QACH,CAAC;QAED,SAAS,uBAAuB,CAAC,GAAW;YAC1C,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;gBACnC,IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC/B,IAAA,sBAAe,EACb,EAAE,EACF,YAAY,IAAI,oBAAoB,GAAG,gCAAgC,CACxE,CAAA;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,SAAS,kBAAkB,CAAC,GAAW;YACrC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;gBAC7B,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,IAAA,iBAAU,EAAC,GAAG,EAAE,GAAG,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG,EAAE;oBACnD,MAAM,WAAW,GAAG,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;oBACrD,IAAI,CAAC,WAAW,EAAE,CAAC;wBACjB,GAAG,CAAC,SAAS,CACX;4BACE,OAAO,EAAE,mBAAmB;4BAC5B,UAAU,EAAE,GAAG;4BACf,QAAQ,EAAE,GAAG;4BACb,YAAY,EAAE,WAAI,CAAC,GAAG;yBACvB,EACD,KAAK,CACN,CAAA;oBACH,CAAC;oBAED,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;wBAC1C,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,IAAI,GAAG,GAAG,EAAE,IAAI,CAAC,CAAA;oBACvC,CAAC;yBAAM,IAAI,CAAC,WAAW,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC;wBACzC,sFAAsF;wBACtF,uDAAuD;wBACvD,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;oBACvC,CAAC;gBACH,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts b/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts deleted file mode 100644 index cde2aa2..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js b/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js deleted file mode 100644 index 727bc23..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const items_1 = require("./items"); -const def = { - keyword: "prefixItems", - type: "array", - schemaType: ["array"], - before: "uniqueItems", - code: (cxt) => (0, items_1.validateTuple)(cxt, "items"), -}; -exports.default = def; -//# sourceMappingURL=prefixItems.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map b/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map deleted file mode 100644 index deef718..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"prefixItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/prefixItems.ts"],"names":[],"mappings":";;AACA,mCAAqC;AAErC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,OAAO,CAAC;IACrB,MAAM,EAAE,aAAa;IACrB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,qBAAa,EAAC,GAAG,EAAE,OAAO,CAAC;CAC3C,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts b/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts deleted file mode 100644 index cde2aa2..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/applicator/properties.js b/node_modules/ajv/dist/vocabularies/applicator/properties.js deleted file mode 100644 index 7347358..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/properties.js +++ /dev/null @@ -1,54 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const validate_1 = require("../../compile/validate"); -const code_1 = require("../code"); -const util_1 = require("../../compile/util"); -const additionalProperties_1 = require("./additionalProperties"); -const def = { - keyword: "properties", - type: "object", - schemaType: "object", - code(cxt) { - const { gen, schema, parentSchema, data, it } = cxt; - if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === undefined) { - additionalProperties_1.default.code(new validate_1.KeywordCxt(it, additionalProperties_1.default, "additionalProperties")); - } - const allProps = (0, code_1.allSchemaProperties)(schema); - for (const prop of allProps) { - it.definedProperties.add(prop); - } - if (it.opts.unevaluated && allProps.length && it.props !== true) { - it.props = util_1.mergeEvaluated.props(gen, (0, util_1.toHash)(allProps), it.props); - } - const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p])); - if (properties.length === 0) - return; - const valid = gen.name("valid"); - for (const prop of properties) { - if (hasDefault(prop)) { - applyPropertySchema(prop); - } - else { - gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties)); - applyPropertySchema(prop); - if (!it.allErrors) - gen.else().var(valid, true); - gen.endIf(); - } - cxt.it.definedProperties.add(prop); - cxt.ok(valid); - } - function hasDefault(prop) { - return it.opts.useDefaults && !it.compositeRule && schema[prop].default !== undefined; - } - function applyPropertySchema(prop) { - cxt.subschema({ - keyword: "properties", - schemaProp: prop, - dataProp: prop, - }, valid); - } - }, -}; -exports.default = def; -//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/properties.js.map b/node_modules/ajv/dist/vocabularies/applicator/properties.js.map deleted file mode 100644 index 13cd347..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/properties.ts"],"names":[],"mappings":";;AACA,qDAAiD;AACjD,kCAA2D;AAC3D,6CAA4E;AAC5E,iEAA0C;AAE1C,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,YAAY;IACrB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACjD,IAAI,EAAE,CAAC,IAAI,CAAC,gBAAgB,KAAK,KAAK,IAAI,YAAY,CAAC,oBAAoB,KAAK,SAAS,EAAE,CAAC;YAC1F,8BAAK,CAAC,IAAI,CAAC,IAAI,qBAAU,CAAC,EAAE,EAAE,8BAAK,EAAE,sBAAsB,CAAC,CAAC,CAAA;QAC/D,CAAC;QACD,MAAM,QAAQ,GAAG,IAAA,0BAAmB,EAAC,MAAM,CAAC,CAAA;QAC5C,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC5B,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAChC,CAAC;QACD,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YAChE,EAAE,CAAC,KAAK,GAAG,qBAAc,CAAC,KAAK,CAAC,GAAG,EAAE,IAAA,aAAM,EAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAA;QAClE,CAAC;QACD,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC5E,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;YAAE,OAAM;QACnC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAE/B,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;YAC9B,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrB,mBAAmB,CAAC,IAAI,CAAC,CAAA;YAC3B,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,EAAE,CAAC,IAAA,qBAAc,EAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAA;gBAC9D,mBAAmB,CAAC,IAAI,CAAC,CAAA;gBACzB,IAAI,CAAC,EAAE,CAAC,SAAS;oBAAE,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;gBAC9C,GAAG,CAAC,KAAK,EAAE,CAAA;YACb,CAAC;YACD,GAAG,CAAC,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YAClC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;QACf,CAAC;QAED,SAAS,UAAU,CAAC,IAAY;YAC9B,OAAO,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,EAAE,CAAC,aAAa,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,SAAS,CAAA;QACvF,CAAC;QAED,SAAS,mBAAmB,CAAC,IAAY;YACvC,GAAG,CAAC,SAAS,CACX;gBACE,OAAO,EAAE,YAAY;gBACrB,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE,IAAI;aACf,EACD,KAAK,CACN,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts b/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts deleted file mode 100644 index a806da3..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; -export type PropertyNamesError = ErrorObject<"propertyNames", { - propertyName: string; -}, AnySchema>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js b/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js deleted file mode 100644 index f387115..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const util_1 = require("../../compile/util"); -const error = { - message: "property name must be valid", - params: ({ params }) => (0, codegen_1._) `{propertyName: ${params.propertyName}}`, -}; -const def = { - keyword: "propertyNames", - type: "object", - schemaType: ["object", "boolean"], - error, - code(cxt) { - const { gen, schema, data, it } = cxt; - if ((0, util_1.alwaysValidSchema)(it, schema)) - return; - const valid = gen.name("valid"); - gen.forIn("key", data, (key) => { - cxt.setParams({ propertyName: key }); - cxt.subschema({ - keyword: "propertyNames", - data: key, - dataTypes: ["string"], - propertyName: key, - compositeRule: true, - }, valid); - gen.if((0, codegen_1.not)(valid), () => { - cxt.error(true); - if (!it.allErrors) - gen.break(); - }); - }); - cxt.ok(valid); - }, -}; -exports.default = def; -//# sourceMappingURL=propertyNames.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map b/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map deleted file mode 100644 index 835b2bb..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"propertyNames.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/propertyNames.ts"],"names":[],"mappings":";;AAOA,mDAA4C;AAC5C,6CAAoD;AAIpD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,6BAA6B;IACtC,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,kBAAkB,MAAM,CAAC,YAAY,GAAG;CAChE,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,eAAe;IACxB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAE/B,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;YAC7B,GAAG,CAAC,SAAS,CAAC,EAAC,YAAY,EAAE,GAAG,EAAC,CAAC,CAAA;YAClC,GAAG,CAAC,SAAS,CACX;gBACE,OAAO,EAAE,eAAe;gBACxB,IAAI,EAAE,GAAG;gBACT,SAAS,EAAE,CAAC,QAAQ,CAAC;gBACrB,YAAY,EAAE,GAAG;gBACjB,aAAa,EAAE,IAAI;aACpB,EACD,KAAK,CACN,CAAA;YACD,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE;gBACtB,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;gBACf,IAAI,CAAC,EAAE,CAAC,SAAS;oBAAE,GAAG,CAAC,KAAK,EAAE,CAAA;YAChC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts b/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts deleted file mode 100644 index cde2aa2..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/applicator/thenElse.js b/node_modules/ajv/dist/vocabularies/applicator/thenElse.js deleted file mode 100644 index 1ae6390..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const util_1 = require("../../compile/util"); -const def = { - keyword: ["then", "else"], - schemaType: ["object", "boolean"], - code({ keyword, parentSchema, it }) { - if (parentSchema.if === undefined) - (0, util_1.checkStrictMode)(it, `"${keyword}" without "if" is ignored`); - }, -}; -exports.default = def; -//# sourceMappingURL=thenElse.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map b/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map deleted file mode 100644 index 2629f4f..0000000 --- a/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"thenElse.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/thenElse.ts"],"names":[],"mappings":";;AAEA,6CAAkD;AAElD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,IAAI,CAAC,EAAC,OAAO,EAAE,YAAY,EAAE,EAAE,EAAa;QAC1C,IAAI,YAAY,CAAC,EAAE,KAAK,SAAS;YAAE,IAAA,sBAAe,EAAC,EAAE,EAAE,IAAI,OAAO,2BAA2B,CAAC,CAAA;IAChG,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/code.d.ts b/node_modules/ajv/dist/vocabularies/code.d.ts deleted file mode 100644 index f914bac..0000000 --- a/node_modules/ajv/dist/vocabularies/code.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { SchemaMap } from "../types"; -import type { SchemaCxt } from "../compile"; -import type { KeywordCxt } from "../compile/validate"; -import { CodeGen, Code, Name } from "../compile/codegen"; -export declare function checkReportMissingProp(cxt: KeywordCxt, prop: string): void; -export declare function checkMissingProp({ gen, data, it: { opts } }: KeywordCxt, properties: string[], missing: Name): Code; -export declare function reportMissingProp(cxt: KeywordCxt, missing: Name): void; -export declare function hasPropFunc(gen: CodeGen): Name; -export declare function isOwnProperty(gen: CodeGen, data: Name, property: Name | string): Code; -export declare function propertyInData(gen: CodeGen, data: Name, property: Name | string, ownProperties?: boolean): Code; -export declare function noPropertyInData(gen: CodeGen, data: Name, property: Name | string, ownProperties?: boolean): Code; -export declare function allSchemaProperties(schemaMap?: SchemaMap): string[]; -export declare function schemaProperties(it: SchemaCxt, schemaMap: SchemaMap): string[]; -export declare function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }: KeywordCxt, func: Code, context: Code, passSchema?: boolean): Code; -export declare function usePattern({ gen, it: { opts } }: KeywordCxt, pattern: string): Name; -export declare function validateArray(cxt: KeywordCxt): Name; -export declare function validateUnion(cxt: KeywordCxt): void; diff --git a/node_modules/ajv/dist/vocabularies/code.js b/node_modules/ajv/dist/vocabularies/code.js deleted file mode 100644 index 8cb8993..0000000 --- a/node_modules/ajv/dist/vocabularies/code.js +++ /dev/null @@ -1,131 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.validateUnion = exports.validateArray = exports.usePattern = exports.callValidateCode = exports.schemaProperties = exports.allSchemaProperties = exports.noPropertyInData = exports.propertyInData = exports.isOwnProperty = exports.hasPropFunc = exports.reportMissingProp = exports.checkMissingProp = exports.checkReportMissingProp = void 0; -const codegen_1 = require("../compile/codegen"); -const util_1 = require("../compile/util"); -const names_1 = require("../compile/names"); -const util_2 = require("../compile/util"); -function checkReportMissingProp(cxt, prop) { - const { gen, data, it } = cxt; - gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => { - cxt.setParams({ missingProperty: (0, codegen_1._) `${prop}` }, true); - cxt.error(); - }); -} -exports.checkReportMissingProp = checkReportMissingProp; -function checkMissingProp({ gen, data, it: { opts } }, properties, missing) { - return (0, codegen_1.or)(...properties.map((prop) => (0, codegen_1.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1._) `${missing} = ${prop}`))); -} -exports.checkMissingProp = checkMissingProp; -function reportMissingProp(cxt, missing) { - cxt.setParams({ missingProperty: missing }, true); - cxt.error(); -} -exports.reportMissingProp = reportMissingProp; -function hasPropFunc(gen) { - return gen.scopeValue("func", { - // eslint-disable-next-line @typescript-eslint/unbound-method - ref: Object.prototype.hasOwnProperty, - code: (0, codegen_1._) `Object.prototype.hasOwnProperty`, - }); -} -exports.hasPropFunc = hasPropFunc; -function isOwnProperty(gen, data, property) { - return (0, codegen_1._) `${hasPropFunc(gen)}.call(${data}, ${property})`; -} -exports.isOwnProperty = isOwnProperty; -function propertyInData(gen, data, property, ownProperties) { - const cond = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(property)} !== undefined`; - return ownProperties ? (0, codegen_1._) `${cond} && ${isOwnProperty(gen, data, property)}` : cond; -} -exports.propertyInData = propertyInData; -function noPropertyInData(gen, data, property, ownProperties) { - const cond = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(property)} === undefined`; - return ownProperties ? (0, codegen_1.or)(cond, (0, codegen_1.not)(isOwnProperty(gen, data, property))) : cond; -} -exports.noPropertyInData = noPropertyInData; -function allSchemaProperties(schemaMap) { - return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : []; -} -exports.allSchemaProperties = allSchemaProperties; -function schemaProperties(it, schemaMap) { - return allSchemaProperties(schemaMap).filter((p) => !(0, util_1.alwaysValidSchema)(it, schemaMap[p])); -} -exports.schemaProperties = schemaProperties; -function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) { - const dataAndSchema = passSchema ? (0, codegen_1._) `${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data; - const valCxt = [ - [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, errorPath)], - [names_1.default.parentData, it.parentData], - [names_1.default.parentDataProperty, it.parentDataProperty], - [names_1.default.rootData, names_1.default.rootData], - ]; - if (it.opts.dynamicRef) - valCxt.push([names_1.default.dynamicAnchors, names_1.default.dynamicAnchors]); - const args = (0, codegen_1._) `${dataAndSchema}, ${gen.object(...valCxt)}`; - return context !== codegen_1.nil ? (0, codegen_1._) `${func}.call(${context}, ${args})` : (0, codegen_1._) `${func}(${args})`; -} -exports.callValidateCode = callValidateCode; -const newRegExp = (0, codegen_1._) `new RegExp`; -function usePattern({ gen, it: { opts } }, pattern) { - const u = opts.unicodeRegExp ? "u" : ""; - const { regExp } = opts.code; - const rx = regExp(pattern, u); - return gen.scopeValue("pattern", { - key: rx.toString(), - ref: rx, - code: (0, codegen_1._) `${regExp.code === "new RegExp" ? newRegExp : (0, util_2.useFunc)(gen, regExp)}(${pattern}, ${u})`, - }); -} -exports.usePattern = usePattern; -function validateArray(cxt) { - const { gen, data, keyword, it } = cxt; - const valid = gen.name("valid"); - if (it.allErrors) { - const validArr = gen.let("valid", true); - validateItems(() => gen.assign(validArr, false)); - return validArr; - } - gen.var(valid, true); - validateItems(() => gen.break()); - return valid; - function validateItems(notValid) { - const len = gen.const("len", (0, codegen_1._) `${data}.length`); - gen.forRange("i", 0, len, (i) => { - cxt.subschema({ - keyword, - dataProp: i, - dataPropType: util_1.Type.Num, - }, valid); - gen.if((0, codegen_1.not)(valid), notValid); - }); - } -} -exports.validateArray = validateArray; -function validateUnion(cxt) { - const { gen, schema, keyword, it } = cxt; - /* istanbul ignore if */ - if (!Array.isArray(schema)) - throw new Error("ajv implementation error"); - const alwaysValid = schema.some((sch) => (0, util_1.alwaysValidSchema)(it, sch)); - if (alwaysValid && !it.opts.unevaluated) - return; - const valid = gen.let("valid", false); - const schValid = gen.name("_valid"); - gen.block(() => schema.forEach((_sch, i) => { - const schCxt = cxt.subschema({ - keyword, - schemaProp: i, - compositeRule: true, - }, schValid); - gen.assign(valid, (0, codegen_1._) `${valid} || ${schValid}`); - const merged = cxt.mergeValidEvaluated(schCxt, schValid); - // can short-circuit if `unevaluatedProperties/Items` not supported (opts.unevaluated !== true) - // or if all properties and items were evaluated (it.props === true && it.items === true) - if (!merged) - gen.if((0, codegen_1.not)(valid)); - })); - cxt.result(valid, () => cxt.reset(), () => cxt.error(true)); -} -exports.validateUnion = validateUnion; -//# sourceMappingURL=code.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/code.js.map b/node_modules/ajv/dist/vocabularies/code.js.map deleted file mode 100644 index ef06de2..0000000 --- a/node_modules/ajv/dist/vocabularies/code.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"code.js","sourceRoot":"","sources":["../../lib/vocabularies/code.ts"],"names":[],"mappings":";;;AAGA,gDAAoG;AACpG,0CAAuD;AACvD,4CAAgC;AAChC,0CAAuC;AACvC,SAAgB,sBAAsB,CAAC,GAAe,EAAE,IAAY;IAClE,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAC3B,GAAG,CAAC,EAAE,CAAC,gBAAgB,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE;QACpE,GAAG,CAAC,SAAS,CAAC,EAAC,eAAe,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,EAAE,EAAC,EAAE,IAAI,CAAC,CAAA;QAClD,GAAG,CAAC,KAAK,EAAE,CAAA;IACb,CAAC,CAAC,CAAA;AACJ,CAAC;AAND,wDAMC;AAED,SAAgB,gBAAgB,CAC9B,EAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,EAAC,IAAI,EAAC,EAAa,EACnC,UAAoB,EACpB,OAAa;IAEb,OAAO,IAAA,YAAE,EACP,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACzB,IAAA,aAAG,EAAC,gBAAgB,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,EAAE,IAAA,WAAC,EAAA,GAAG,OAAO,MAAM,IAAI,EAAE,CAAC,CACpF,CACF,CAAA;AACH,CAAC;AAVD,4CAUC;AAED,SAAgB,iBAAiB,CAAC,GAAe,EAAE,OAAa;IAC9D,GAAG,CAAC,SAAS,CAAC,EAAC,eAAe,EAAE,OAAO,EAAC,EAAE,IAAI,CAAC,CAAA;IAC/C,GAAG,CAAC,KAAK,EAAE,CAAA;AACb,CAAC;AAHD,8CAGC;AAED,SAAgB,WAAW,CAAC,GAAY;IACtC,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE;QAC5B,6DAA6D;QAC7D,GAAG,EAAE,MAAM,CAAC,SAAS,CAAC,cAAc;QACpC,IAAI,EAAE,IAAA,WAAC,EAAA,iCAAiC;KACzC,CAAC,CAAA;AACJ,CAAC;AAND,kCAMC;AAED,SAAgB,aAAa,CAAC,GAAY,EAAE,IAAU,EAAE,QAAuB;IAC7E,OAAO,IAAA,WAAC,EAAA,GAAG,WAAW,CAAC,GAAG,CAAC,SAAS,IAAI,KAAK,QAAQ,GAAG,CAAA;AAC1D,CAAC;AAFD,sCAEC;AAED,SAAgB,cAAc,CAC5B,GAAY,EACZ,IAAU,EACV,QAAuB,EACvB,aAAuB;IAEvB,MAAM,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,GAAG,IAAA,qBAAW,EAAC,QAAQ,CAAC,gBAAgB,CAAA;IAC7D,OAAO,aAAa,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,OAAO,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACnF,CAAC;AARD,wCAQC;AAED,SAAgB,gBAAgB,CAC9B,GAAY,EACZ,IAAU,EACV,QAAuB,EACvB,aAAuB;IAEvB,MAAM,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,GAAG,IAAA,qBAAW,EAAC,QAAQ,CAAC,gBAAgB,CAAA;IAC7D,OAAO,aAAa,CAAC,CAAC,CAAC,IAAA,YAAE,EAAC,IAAI,EAAE,IAAA,aAAG,EAAC,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACjF,CAAC;AARD,4CAQC;AAED,SAAgB,mBAAmB,CAAC,SAAqB;IACvD,OAAO,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AACjF,CAAC;AAFD,kDAEC;AAED,SAAgB,gBAAgB,CAAC,EAAa,EAAE,SAAoB;IAClE,OAAO,mBAAmB,CAAC,SAAS,CAAC,CAAC,MAAM,CAC1C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAA,wBAAiB,EAAC,EAAE,EAAE,SAAS,CAAC,CAAC,CAAc,CAAC,CACzD,CAAA;AACH,CAAC;AAJD,4CAIC;AAED,SAAgB,gBAAgB,CAC9B,EAAC,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,EAAC,GAAG,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAC,EAAE,EAAE,EAAa,EAClF,IAAU,EACV,OAAa,EACb,UAAoB;IAEpB,MAAM,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,UAAU,KAAK,IAAI,KAAK,YAAY,GAAG,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;IACjG,MAAM,MAAM,GAA4B;QACtC,CAAC,eAAC,CAAC,YAAY,EAAE,IAAA,mBAAS,EAAC,eAAC,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QACtD,CAAC,eAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC;QAC7B,CAAC,eAAC,CAAC,kBAAkB,EAAE,EAAE,CAAC,kBAAkB,CAAC;QAC7C,CAAC,eAAC,CAAC,QAAQ,EAAE,eAAC,CAAC,QAAQ,CAAC;KACzB,CAAA;IACD,IAAI,EAAE,CAAC,IAAI,CAAC,UAAU;QAAE,MAAM,CAAC,IAAI,CAAC,CAAC,eAAC,CAAC,cAAc,EAAE,eAAC,CAAC,cAAc,CAAC,CAAC,CAAA;IACzE,MAAM,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,aAAa,KAAK,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,CAAA;IAC1D,OAAO,OAAO,KAAK,aAAG,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,SAAS,OAAO,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,IAAI,IAAI,GAAG,CAAA;AACrF,CAAC;AAhBD,4CAgBC;AAED,MAAM,SAAS,GAAG,IAAA,WAAC,EAAA,YAAY,CAAA;AAE/B,SAAgB,UAAU,CAAC,EAAC,GAAG,EAAE,EAAE,EAAE,EAAC,IAAI,EAAC,EAAa,EAAE,OAAe;IACvE,MAAM,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IACvC,MAAM,EAAC,MAAM,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;IAC1B,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;IAE7B,OAAO,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE;QAC/B,GAAG,EAAE,EAAE,CAAC,QAAQ,EAAE;QAClB,GAAG,EAAE,EAAE;QACP,IAAI,EAAE,IAAA,WAAC,EAAA,GAAG,MAAM,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,cAAO,EAAC,GAAG,EAAE,MAAM,CAAC,IAAI,OAAO,KAAK,CAAC,GAAG;KAC9F,CAAC,CAAA;AACJ,CAAC;AAVD,gCAUC;AAED,SAAgB,aAAa,CAAC,GAAe;IAC3C,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IACpC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/B,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC;QACjB,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QACvC,aAAa,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAA;QAChD,OAAO,QAAQ,CAAA;IACjB,CAAC;IACD,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IACpB,aAAa,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;IAChC,OAAO,KAAK,CAAA;IAEZ,SAAS,aAAa,CAAC,QAAoB;QACzC,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,SAAS,CAAC,CAAA;QAC/C,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE;YAC9B,GAAG,CAAC,SAAS,CACX;gBACE,OAAO;gBACP,QAAQ,EAAE,CAAC;gBACX,YAAY,EAAE,WAAI,CAAC,GAAG;aACvB,EACD,KAAK,CACN,CAAA;YACD,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,CAAA;QAC9B,CAAC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC;AA1BD,sCA0BC;AAED,SAAgB,aAAa,CAAC,GAAe;IAC3C,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IACtC,wBAAwB;IACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;IACvE,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,GAAc,EAAE,EAAE,CAAC,IAAA,wBAAiB,EAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAA;IAC/E,IAAI,WAAW,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW;QAAE,OAAM;IAE/C,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IACrC,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAEnC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CACb,MAAM,CAAC,OAAO,CAAC,CAAC,IAAe,EAAE,CAAS,EAAE,EAAE;QAC5C,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAC1B;YACE,OAAO;YACP,UAAU,EAAE,CAAC;YACb,aAAa,EAAE,IAAI;SACpB,EACD,QAAQ,CACT,CAAA;QACD,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,KAAK,OAAO,QAAQ,EAAE,CAAC,CAAA;QAC7C,MAAM,MAAM,GAAG,GAAG,CAAC,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QACxD,+FAA+F;QAC/F,yFAAyF;QACzF,IAAI,CAAC,MAAM;YAAE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,CAAC,CAAA;IACjC,CAAC,CAAC,CACH,CAAA;IAED,GAAG,CAAC,MAAM,CACR,KAAK,EACL,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,EACjB,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CACtB,CAAA;AACH,CAAC;AAjCD,sCAiCC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/core/id.d.ts b/node_modules/ajv/dist/vocabularies/core/id.d.ts deleted file mode 100644 index cde2aa2..0000000 --- a/node_modules/ajv/dist/vocabularies/core/id.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/core/id.js b/node_modules/ajv/dist/vocabularies/core/id.js deleted file mode 100644 index 313598a..0000000 --- a/node_modules/ajv/dist/vocabularies/core/id.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const def = { - keyword: "id", - code() { - throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID'); - }, -}; -exports.default = def; -//# sourceMappingURL=id.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/core/id.js.map b/node_modules/ajv/dist/vocabularies/core/id.js.map deleted file mode 100644 index 4eb27eb..0000000 --- a/node_modules/ajv/dist/vocabularies/core/id.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"id.js","sourceRoot":"","sources":["../../../lib/vocabularies/core/id.ts"],"names":[],"mappings":";;AAEA,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,IAAI;IACb,IAAI;QACF,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACzE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/core/index.d.ts b/node_modules/ajv/dist/vocabularies/core/index.d.ts deleted file mode 100644 index f2e34ee..0000000 --- a/node_modules/ajv/dist/vocabularies/core/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Vocabulary } from "../../types"; -declare const core: Vocabulary; -export default core; diff --git a/node_modules/ajv/dist/vocabularies/core/index.js b/node_modules/ajv/dist/vocabularies/core/index.js deleted file mode 100644 index 87656d7..0000000 --- a/node_modules/ajv/dist/vocabularies/core/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const id_1 = require("./id"); -const ref_1 = require("./ref"); -const core = [ - "$schema", - "$id", - "$defs", - "$vocabulary", - { keyword: "$comment" }, - "definitions", - id_1.default, - ref_1.default, -]; -exports.default = core; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/core/index.js.map b/node_modules/ajv/dist/vocabularies/core/index.js.map deleted file mode 100644 index 5bf65f9..0000000 --- a/node_modules/ajv/dist/vocabularies/core/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/core/index.ts"],"names":[],"mappings":";;AACA,6BAA4B;AAC5B,+BAA8B;AAE9B,MAAM,IAAI,GAAe;IACvB,SAAS;IACT,KAAK;IACL,OAAO;IACP,aAAa;IACb,EAAC,OAAO,EAAE,UAAU,EAAC;IACrB,aAAa;IACb,YAAS;IACT,aAAU;CACX,CAAA;AAED,kBAAe,IAAI,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/core/ref.d.ts b/node_modules/ajv/dist/vocabularies/core/ref.d.ts deleted file mode 100644 index 6a0967d..0000000 --- a/node_modules/ajv/dist/vocabularies/core/ref.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -import type { KeywordCxt } from "../../compile/validate"; -import { Code } from "../../compile/codegen"; -import { SchemaEnv } from "../../compile"; -declare const def: CodeKeywordDefinition; -export declare function getValidate(cxt: KeywordCxt, sch: SchemaEnv): Code; -export declare function callRef(cxt: KeywordCxt, v: Code, sch?: SchemaEnv, $async?: boolean): void; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/core/ref.js b/node_modules/ajv/dist/vocabularies/core/ref.js deleted file mode 100644 index bac1ae8..0000000 --- a/node_modules/ajv/dist/vocabularies/core/ref.js +++ /dev/null @@ -1,122 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.callRef = exports.getValidate = void 0; -const ref_error_1 = require("../../compile/ref_error"); -const code_1 = require("../code"); -const codegen_1 = require("../../compile/codegen"); -const names_1 = require("../../compile/names"); -const compile_1 = require("../../compile"); -const util_1 = require("../../compile/util"); -const def = { - keyword: "$ref", - schemaType: "string", - code(cxt) { - const { gen, schema: $ref, it } = cxt; - const { baseId, schemaEnv: env, validateName, opts, self } = it; - const { root } = env; - if (($ref === "#" || $ref === "#/") && baseId === root.baseId) - return callRootRef(); - const schOrEnv = compile_1.resolveRef.call(self, root, baseId, $ref); - if (schOrEnv === undefined) - throw new ref_error_1.default(it.opts.uriResolver, baseId, $ref); - if (schOrEnv instanceof compile_1.SchemaEnv) - return callValidate(schOrEnv); - return inlineRefSchema(schOrEnv); - function callRootRef() { - if (env === root) - return callRef(cxt, validateName, env, env.$async); - const rootName = gen.scopeValue("root", { ref: root }); - return callRef(cxt, (0, codegen_1._) `${rootName}.validate`, root, root.$async); - } - function callValidate(sch) { - const v = getValidate(cxt, sch); - callRef(cxt, v, sch, sch.$async); - } - function inlineRefSchema(sch) { - const schName = gen.scopeValue("schema", opts.code.source === true ? { ref: sch, code: (0, codegen_1.stringify)(sch) } : { ref: sch }); - const valid = gen.name("valid"); - const schCxt = cxt.subschema({ - schema: sch, - dataTypes: [], - schemaPath: codegen_1.nil, - topSchemaRef: schName, - errSchemaPath: $ref, - }, valid); - cxt.mergeEvaluated(schCxt); - cxt.ok(valid); - } - }, -}; -function getValidate(cxt, sch) { - const { gen } = cxt; - return sch.validate - ? gen.scopeValue("validate", { ref: sch.validate }) - : (0, codegen_1._) `${gen.scopeValue("wrapper", { ref: sch })}.validate`; -} -exports.getValidate = getValidate; -function callRef(cxt, v, sch, $async) { - const { gen, it } = cxt; - const { allErrors, schemaEnv: env, opts } = it; - const passCxt = opts.passContext ? names_1.default.this : codegen_1.nil; - if ($async) - callAsyncRef(); - else - callSyncRef(); - function callAsyncRef() { - if (!env.$async) - throw new Error("async schema referenced by sync schema"); - const valid = gen.let("valid"); - gen.try(() => { - gen.code((0, codegen_1._) `await ${(0, code_1.callValidateCode)(cxt, v, passCxt)}`); - addEvaluatedFrom(v); // TODO will not work with async, it has to be returned with the result - if (!allErrors) - gen.assign(valid, true); - }, (e) => { - gen.if((0, codegen_1._) `!(${e} instanceof ${it.ValidationError})`, () => gen.throw(e)); - addErrorsFrom(e); - if (!allErrors) - gen.assign(valid, false); - }); - cxt.ok(valid); - } - function callSyncRef() { - cxt.result((0, code_1.callValidateCode)(cxt, v, passCxt), () => addEvaluatedFrom(v), () => addErrorsFrom(v)); - } - function addErrorsFrom(source) { - const errs = (0, codegen_1._) `${source}.errors`; - gen.assign(names_1.default.vErrors, (0, codegen_1._) `${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`); // TODO tagged - gen.assign(names_1.default.errors, (0, codegen_1._) `${names_1.default.vErrors}.length`); - } - function addEvaluatedFrom(source) { - var _a; - if (!it.opts.unevaluated) - return; - const schEvaluated = (_a = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a === void 0 ? void 0 : _a.evaluated; - // TODO refactor - if (it.props !== true) { - if (schEvaluated && !schEvaluated.dynamicProps) { - if (schEvaluated.props !== undefined) { - it.props = util_1.mergeEvaluated.props(gen, schEvaluated.props, it.props); - } - } - else { - const props = gen.var("props", (0, codegen_1._) `${source}.evaluated.props`); - it.props = util_1.mergeEvaluated.props(gen, props, it.props, codegen_1.Name); - } - } - if (it.items !== true) { - if (schEvaluated && !schEvaluated.dynamicItems) { - if (schEvaluated.items !== undefined) { - it.items = util_1.mergeEvaluated.items(gen, schEvaluated.items, it.items); - } - } - else { - const items = gen.var("items", (0, codegen_1._) `${source}.evaluated.items`); - it.items = util_1.mergeEvaluated.items(gen, items, it.items, codegen_1.Name); - } - } - } -} -exports.callRef = callRef; -exports.default = def; -//# sourceMappingURL=ref.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/core/ref.js.map b/node_modules/ajv/dist/vocabularies/core/ref.js.map deleted file mode 100644 index 3125bb8..0000000 --- a/node_modules/ajv/dist/vocabularies/core/ref.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ref.js","sourceRoot":"","sources":["../../../lib/vocabularies/core/ref.ts"],"names":[],"mappings":";;;AAEA,uDAAqD;AACrD,kCAAwC;AACxC,mDAAmE;AACnE,+CAAmC;AACnC,2CAAmD;AACnD,6CAAiD;AAEjD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,MAAM,EAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;QAC7D,MAAM,EAAC,IAAI,EAAC,GAAG,GAAG,CAAA;QAClB,IAAI,CAAC,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,CAAC,IAAI,MAAM,KAAK,IAAI,CAAC,MAAM;YAAE,OAAO,WAAW,EAAE,CAAA;QACnF,MAAM,QAAQ,GAAG,oBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;QAC1D,IAAI,QAAQ,KAAK,SAAS;YAAE,MAAM,IAAI,mBAAe,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;QACxF,IAAI,QAAQ,YAAY,mBAAS;YAAE,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAA;QAChE,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAA;QAEhC,SAAS,WAAW;YAClB,IAAI,GAAG,KAAK,IAAI;gBAAE,OAAO,OAAO,CAAC,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;YACpE,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE,EAAC,GAAG,EAAE,IAAI,EAAC,CAAC,CAAA;YACpD,OAAO,OAAO,CAAC,GAAG,EAAE,IAAA,WAAC,EAAA,GAAG,QAAQ,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QACjE,CAAC;QAED,SAAS,YAAY,CAAC,GAAc;YAClC,MAAM,CAAC,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;YAC/B,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;QAClC,CAAC;QAED,SAAS,eAAe,CAAC,GAAc;YACrC,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,CAC5B,QAAQ,EACR,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAA,mBAAS,EAAC,GAAG,CAAC,EAAC,CAAC,CAAC,CAAC,EAAC,GAAG,EAAE,GAAG,EAAC,CAC1E,CAAA;YACD,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAC/B,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAC1B;gBACE,MAAM,EAAE,GAAG;gBACX,SAAS,EAAE,EAAE;gBACb,UAAU,EAAE,aAAG;gBACf,YAAY,EAAE,OAAO;gBACrB,aAAa,EAAE,IAAI;aACpB,EACD,KAAK,CACN,CAAA;YACD,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;YAC1B,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;QACf,CAAC;IACH,CAAC;CACF,CAAA;AAED,SAAgB,WAAW,CAAC,GAAe,EAAE,GAAc;IACzD,MAAM,EAAC,GAAG,EAAC,GAAG,GAAG,CAAA;IACjB,OAAO,GAAG,CAAC,QAAQ;QACjB,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,EAAE,EAAC,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAC,CAAC;QACjD,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE,EAAC,GAAG,EAAE,GAAG,EAAC,CAAC,WAAW,CAAA;AAC1D,CAAC;AALD,kCAKC;AAED,SAAgB,OAAO,CAAC,GAAe,EAAE,CAAO,EAAE,GAAe,EAAE,MAAgB;IACjF,MAAM,EAAC,GAAG,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IACrB,MAAM,EAAC,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,eAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAG,CAAA;IAC/C,IAAI,MAAM;QAAE,YAAY,EAAE,CAAA;;QACrB,WAAW,EAAE,CAAA;IAElB,SAAS,YAAY;QACnB,IAAI,CAAC,GAAG,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;QAC1E,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QAC9B,GAAG,CAAC,GAAG,CACL,GAAG,EAAE;YACH,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,SAAS,IAAA,uBAAgB,EAAC,GAAG,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAA;YACvD,gBAAgB,CAAC,CAAC,CAAC,CAAA,CAAC,uEAAuE;YAC3F,IAAI,CAAC,SAAS;gBAAE,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QACzC,CAAC,EACD,CAAC,CAAC,EAAE,EAAE;YACJ,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,KAAK,CAAC,eAAe,EAAE,CAAC,eAAuB,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YAC/E,aAAa,CAAC,CAAC,CAAC,CAAA;YAChB,IAAI,CAAC,SAAS;gBAAE,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;QAC1C,CAAC,CACF,CAAA;QACD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;IAED,SAAS,WAAW;QAClB,GAAG,CAAC,MAAM,CACR,IAAA,uBAAgB,EAAC,GAAG,EAAE,CAAC,EAAE,OAAO,CAAC,EACjC,GAAG,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,EACzB,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,CACvB,CAAA;IACH,CAAC;IAED,SAAS,aAAa,CAAC,MAAY;QACjC,MAAM,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,MAAM,SAAS,CAAA;QAChC,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,OAAO,eAAe,IAAI,MAAM,eAAC,CAAC,OAAO,WAAW,IAAI,GAAG,CAAC,CAAA,CAAC,cAAc;QACvG,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,MAAM,EAAE,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,OAAO,SAAS,CAAC,CAAA;IAC9C,CAAC;IAED,SAAS,gBAAgB,CAAC,MAAY;;QACpC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW;YAAE,OAAM;QAChC,MAAM,YAAY,GAAG,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,SAAS,CAAA;QAC7C,gBAAgB;QAChB,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACtB,IAAI,YAAY,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;gBAC/C,IAAI,YAAY,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;oBACrC,EAAE,CAAC,KAAK,GAAG,qBAAc,CAAC,KAAK,CAAC,GAAG,EAAE,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAA;gBACpE,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,MAAM,kBAAkB,CAAC,CAAA;gBAC5D,EAAE,CAAC,KAAK,GAAG,qBAAc,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,cAAI,CAAC,CAAA;YAC7D,CAAC;QACH,CAAC;QACD,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACtB,IAAI,YAAY,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;gBAC/C,IAAI,YAAY,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;oBACrC,EAAE,CAAC,KAAK,GAAG,qBAAc,CAAC,KAAK,CAAC,GAAG,EAAE,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAA;gBACpE,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,MAAM,kBAAkB,CAAC,CAAA;gBAC5D,EAAE,CAAC,KAAK,GAAG,qBAAc,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,cAAI,CAAC,CAAA;YAC7D,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAhED,0BAgEC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts b/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts deleted file mode 100644 index ab3669a..0000000 --- a/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -import { DiscrError, DiscrErrorObj } from "../discriminator/types"; -export type DiscriminatorError = DiscrErrorObj | DiscrErrorObj; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/discriminator/index.js b/node_modules/ajv/dist/vocabularies/discriminator/index.js deleted file mode 100644 index e113aed..0000000 --- a/node_modules/ajv/dist/vocabularies/discriminator/index.js +++ /dev/null @@ -1,104 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const types_1 = require("../discriminator/types"); -const compile_1 = require("../../compile"); -const ref_error_1 = require("../../compile/ref_error"); -const util_1 = require("../../compile/util"); -const error = { - message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag - ? `tag "${tagName}" must be string` - : `value of tag "${tagName}" must be in oneOf`, - params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._) `{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`, -}; -const def = { - keyword: "discriminator", - type: "object", - schemaType: "object", - error, - code(cxt) { - const { gen, data, schema, parentSchema, it } = cxt; - const { oneOf } = parentSchema; - if (!it.opts.discriminator) { - throw new Error("discriminator: requires discriminator option"); - } - const tagName = schema.propertyName; - if (typeof tagName != "string") - throw new Error("discriminator: requires propertyName"); - if (schema.mapping) - throw new Error("discriminator: mapping is not supported"); - if (!oneOf) - throw new Error("discriminator: requires oneOf keyword"); - const valid = gen.let("valid", false); - const tag = gen.const("tag", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(tagName)}`); - gen.if((0, codegen_1._) `typeof ${tag} == "string"`, () => validateMapping(), () => cxt.error(false, { discrError: types_1.DiscrError.Tag, tag, tagName })); - cxt.ok(valid); - function validateMapping() { - const mapping = getMapping(); - gen.if(false); - for (const tagValue in mapping) { - gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`); - gen.assign(valid, applyTagSchema(mapping[tagValue])); - } - gen.else(); - cxt.error(false, { discrError: types_1.DiscrError.Mapping, tag, tagName }); - gen.endIf(); - } - function applyTagSchema(schemaProp) { - const _valid = gen.name("valid"); - const schCxt = cxt.subschema({ keyword: "oneOf", schemaProp }, _valid); - cxt.mergeEvaluated(schCxt, codegen_1.Name); - return _valid; - } - function getMapping() { - var _a; - const oneOfMapping = {}; - const topRequired = hasRequired(parentSchema); - let tagRequired = true; - for (let i = 0; i < oneOf.length; i++) { - let sch = oneOf[i]; - if ((sch === null || sch === void 0 ? void 0 : sch.$ref) && !(0, util_1.schemaHasRulesButRef)(sch, it.self.RULES)) { - const ref = sch.$ref; - sch = compile_1.resolveRef.call(it.self, it.schemaEnv.root, it.baseId, ref); - if (sch instanceof compile_1.SchemaEnv) - sch = sch.schema; - if (sch === undefined) - throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref); - } - const propSch = (_a = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a === void 0 ? void 0 : _a[tagName]; - if (typeof propSch != "object") { - throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`); - } - tagRequired = tagRequired && (topRequired || hasRequired(sch)); - addMappings(propSch, i); - } - if (!tagRequired) - throw new Error(`discriminator: "${tagName}" must be required`); - return oneOfMapping; - function hasRequired({ required }) { - return Array.isArray(required) && required.includes(tagName); - } - function addMappings(sch, i) { - if (sch.const) { - addMapping(sch.const, i); - } - else if (sch.enum) { - for (const tagValue of sch.enum) { - addMapping(tagValue, i); - } - } - else { - throw new Error(`discriminator: "properties/${tagName}" must have "const" or "enum"`); - } - } - function addMapping(tagValue, i) { - if (typeof tagValue != "string" || tagValue in oneOfMapping) { - throw new Error(`discriminator: "${tagName}" values must be unique strings`); - } - oneOfMapping[tagValue] = i; - } - } - }, -}; -exports.default = def; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/discriminator/index.js.map b/node_modules/ajv/dist/vocabularies/discriminator/index.js.map deleted file mode 100644 index f9d69db..0000000 --- a/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/discriminator/index.ts"],"names":[],"mappings":";;AAEA,mDAA0D;AAC1D,kDAAgE;AAChE,2CAAmD;AACnD,uDAAqD;AACrD,6CAAuD;AAIvD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,UAAU,EAAE,OAAO,EAAC,EAAC,EAAE,EAAE,CAC3C,UAAU,KAAK,kBAAU,CAAC,GAAG;QAC3B,CAAC,CAAC,QAAQ,OAAO,kBAAkB;QACnC,CAAC,CAAC,iBAAiB,OAAO,oBAAoB;IAClD,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,UAAU,EAAE,GAAG,EAAE,OAAO,EAAC,EAAC,EAAE,EAAE,CAC/C,IAAA,WAAC,EAAA,WAAW,UAAU,UAAU,OAAO,eAAe,GAAG,GAAG;CAC/D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,eAAe;IACxB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACjD,MAAM,EAAC,KAAK,EAAC,GAAG,YAAY,CAAA;QAC5B,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;QACjE,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,CAAC,YAAY,CAAA;QACnC,IAAI,OAAO,OAAO,IAAI,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;QACvF,IAAI,MAAM,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAA;QAC9E,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;QACpE,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;QACrC,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,GAAG,IAAA,qBAAW,EAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QAC/D,GAAG,CAAC,EAAE,CACJ,IAAA,WAAC,EAAA,UAAU,GAAG,cAAc,EAC5B,GAAG,EAAE,CAAC,eAAe,EAAE,EACvB,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,EAAC,UAAU,EAAE,kBAAU,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAC,CAAC,CACnE,CAAA;QACD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;QAEb,SAAS,eAAe;YACtB,MAAM,OAAO,GAAG,UAAU,EAAE,CAAA;YAC5B,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;YACb,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;gBAC/B,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,QAAQ,EAAE,CAAC,CAAA;gBACrC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;YACtD,CAAC;YACD,GAAG,CAAC,IAAI,EAAE,CAAA;YACV,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,EAAC,UAAU,EAAE,kBAAU,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAC,CAAC,CAAA;YAChE,GAAG,CAAC,KAAK,EAAE,CAAA;QACb,CAAC;QAED,SAAS,cAAc,CAAC,UAAmB;YACzC,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAChC,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAC,EAAE,MAAM,CAAC,CAAA;YACpE,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,cAAI,CAAC,CAAA;YAChC,OAAO,MAAM,CAAA;QACf,CAAC;QAED,SAAS,UAAU;;YACjB,MAAM,YAAY,GAA6B,EAAE,CAAA;YACjD,MAAM,WAAW,GAAG,WAAW,CAAC,YAAY,CAAC,CAAA;YAC7C,IAAI,WAAW,GAAG,IAAI,CAAA;YACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACtC,IAAI,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;gBAClB,IAAI,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,KAAI,CAAC,IAAA,2BAAoB,EAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC3D,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAA;oBACpB,GAAG,GAAG,oBAAU,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;oBACjE,IAAI,GAAG,YAAY,mBAAS;wBAAE,GAAG,GAAG,GAAG,CAAC,MAAM,CAAA;oBAC9C,IAAI,GAAG,KAAK,SAAS;wBAAE,MAAM,IAAI,mBAAe,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;gBACvF,CAAC;gBACD,MAAM,OAAO,GAAG,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,UAAU,0CAAG,OAAO,CAAC,CAAA;gBAC1C,IAAI,OAAO,OAAO,IAAI,QAAQ,EAAE,CAAC;oBAC/B,MAAM,IAAI,KAAK,CACb,iFAAiF,OAAO,GAAG,CAC5F,CAAA;gBACH,CAAC;gBACD,WAAW,GAAG,WAAW,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;gBAC9D,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;YACzB,CAAC;YACD,IAAI,CAAC,WAAW;gBAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,OAAO,oBAAoB,CAAC,CAAA;YACjF,OAAO,YAAY,CAAA;YAEnB,SAAS,WAAW,CAAC,EAAC,QAAQ,EAAkB;gBAC9C,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;YAC9D,CAAC;YAED,SAAS,WAAW,CAAC,GAAoB,EAAE,CAAS;gBAClD,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;oBACd,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;gBAC1B,CAAC;qBAAM,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;oBACpB,KAAK,MAAM,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;wBAChC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;oBACzB,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,+BAA+B,CAAC,CAAA;gBACvF,CAAC;YACH,CAAC;YAED,SAAS,UAAU,CAAC,QAAiB,EAAE,CAAS;gBAC9C,IAAI,OAAO,QAAQ,IAAI,QAAQ,IAAI,QAAQ,IAAI,YAAY,EAAE,CAAC;oBAC5D,MAAM,IAAI,KAAK,CAAC,mBAAmB,OAAO,iCAAiC,CAAC,CAAA;gBAC9E,CAAC;gBACD,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;YAC5B,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts b/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts deleted file mode 100644 index 8550f6d..0000000 --- a/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { ErrorObject } from "../../types"; -export declare enum DiscrError { - Tag = "tag", - Mapping = "mapping" -} -export type DiscrErrorObj = ErrorObject<"discriminator", { - error: E; - tag: string; - tagValue: unknown; -}, string>; diff --git a/node_modules/ajv/dist/vocabularies/discriminator/types.js b/node_modules/ajv/dist/vocabularies/discriminator/types.js deleted file mode 100644 index edf4da5..0000000 --- a/node_modules/ajv/dist/vocabularies/discriminator/types.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DiscrError = void 0; -var DiscrError; -(function (DiscrError) { - DiscrError["Tag"] = "tag"; - DiscrError["Mapping"] = "mapping"; -})(DiscrError || (exports.DiscrError = DiscrError = {})); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/discriminator/types.js.map b/node_modules/ajv/dist/vocabularies/discriminator/types.js.map deleted file mode 100644 index 028633b..0000000 --- a/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/vocabularies/discriminator/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,iCAAmB,CAAA;AACrB,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/draft2020.d.ts b/node_modules/ajv/dist/vocabularies/draft2020.d.ts deleted file mode 100644 index d65752c..0000000 --- a/node_modules/ajv/dist/vocabularies/draft2020.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Vocabulary } from "../types"; -declare const draft2020Vocabularies: Vocabulary[]; -export default draft2020Vocabularies; diff --git a/node_modules/ajv/dist/vocabularies/draft2020.js b/node_modules/ajv/dist/vocabularies/draft2020.js deleted file mode 100644 index 23d244a..0000000 --- a/node_modules/ajv/dist/vocabularies/draft2020.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const core_1 = require("./core"); -const validation_1 = require("./validation"); -const applicator_1 = require("./applicator"); -const dynamic_1 = require("./dynamic"); -const next_1 = require("./next"); -const unevaluated_1 = require("./unevaluated"); -const format_1 = require("./format"); -const metadata_1 = require("./metadata"); -const draft2020Vocabularies = [ - dynamic_1.default, - core_1.default, - validation_1.default, - (0, applicator_1.default)(true), - format_1.default, - metadata_1.metadataVocabulary, - metadata_1.contentVocabulary, - next_1.default, - unevaluated_1.default, -]; -exports.default = draft2020Vocabularies; -//# sourceMappingURL=draft2020.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/draft2020.js.map b/node_modules/ajv/dist/vocabularies/draft2020.js.map deleted file mode 100644 index ae1a4d8..0000000 --- a/node_modules/ajv/dist/vocabularies/draft2020.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"draft2020.js","sourceRoot":"","sources":["../../lib/vocabularies/draft2020.ts"],"names":[],"mappings":";;AACA,iCAAmC;AACnC,6CAA+C;AAC/C,6CAAkD;AAClD,uCAAyC;AACzC,iCAAmC;AACnC,+CAAiD;AACjD,qCAAuC;AACvC,yCAAgE;AAEhE,MAAM,qBAAqB,GAAiB;IAC1C,iBAAiB;IACjB,cAAc;IACd,oBAAoB;IACpB,IAAA,oBAAuB,EAAC,IAAI,CAAC;IAC7B,gBAAgB;IAChB,6BAAkB;IAClB,4BAAiB;IACjB,cAAc;IACd,qBAAqB;CACtB,CAAA;AAED,kBAAe,qBAAqB,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/draft7.d.ts b/node_modules/ajv/dist/vocabularies/draft7.d.ts deleted file mode 100644 index 469fb84..0000000 --- a/node_modules/ajv/dist/vocabularies/draft7.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Vocabulary } from "../types"; -declare const draft7Vocabularies: Vocabulary[]; -export default draft7Vocabularies; diff --git a/node_modules/ajv/dist/vocabularies/draft7.js b/node_modules/ajv/dist/vocabularies/draft7.js deleted file mode 100644 index 1e993de..0000000 --- a/node_modules/ajv/dist/vocabularies/draft7.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const core_1 = require("./core"); -const validation_1 = require("./validation"); -const applicator_1 = require("./applicator"); -const format_1 = require("./format"); -const metadata_1 = require("./metadata"); -const draft7Vocabularies = [ - core_1.default, - validation_1.default, - (0, applicator_1.default)(), - format_1.default, - metadata_1.metadataVocabulary, - metadata_1.contentVocabulary, -]; -exports.default = draft7Vocabularies; -//# sourceMappingURL=draft7.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/draft7.js.map b/node_modules/ajv/dist/vocabularies/draft7.js.map deleted file mode 100644 index bc7389c..0000000 --- a/node_modules/ajv/dist/vocabularies/draft7.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"draft7.js","sourceRoot":"","sources":["../../lib/vocabularies/draft7.ts"],"names":[],"mappings":";;AACA,iCAAmC;AACnC,6CAA+C;AAC/C,6CAAkD;AAClD,qCAAuC;AACvC,yCAAgE;AAEhE,MAAM,kBAAkB,GAAiB;IACvC,cAAc;IACd,oBAAoB;IACpB,IAAA,oBAAuB,GAAE;IACzB,gBAAgB;IAChB,6BAAkB;IAClB,4BAAiB;CAClB,CAAA;AAED,kBAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts b/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts deleted file mode 100644 index 5621213..0000000 --- a/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -import type { KeywordCxt } from "../../compile/validate"; -declare const def: CodeKeywordDefinition; -export declare function dynamicAnchor(cxt: KeywordCxt, anchor: string): void; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js b/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js deleted file mode 100644 index 972dc35..0000000 --- a/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.dynamicAnchor = void 0; -const codegen_1 = require("../../compile/codegen"); -const names_1 = require("../../compile/names"); -const compile_1 = require("../../compile"); -const ref_1 = require("../core/ref"); -const def = { - keyword: "$dynamicAnchor", - schemaType: "string", - code: (cxt) => dynamicAnchor(cxt, cxt.schema), -}; -function dynamicAnchor(cxt, anchor) { - const { gen, it } = cxt; - it.schemaEnv.root.dynamicAnchors[anchor] = true; - const v = (0, codegen_1._) `${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`; - const validate = it.errSchemaPath === "#" ? it.validateName : _getValidate(cxt); - gen.if((0, codegen_1._) `!${v}`, () => gen.assign(v, validate)); -} -exports.dynamicAnchor = dynamicAnchor; -function _getValidate(cxt) { - const { schemaEnv, schema, self } = cxt.it; - const { root, baseId, localRefs, meta } = schemaEnv.root; - const { schemaId } = self.opts; - const sch = new compile_1.SchemaEnv({ schema, schemaId, root, baseId, localRefs, meta }); - compile_1.compileSchema.call(self, sch); - return (0, ref_1.getValidate)(cxt, sch); -} -exports.default = def; -//# sourceMappingURL=dynamicAnchor.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map b/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map deleted file mode 100644 index e70afe3..0000000 --- a/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dynamicAnchor.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/dynamicAnchor.ts"],"names":[],"mappings":";;;AAEA,mDAA0D;AAC1D,+CAAmC;AACnC,2CAAsD;AACtD,qCAAuC;AAEvC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,gBAAgB;IACzB,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;CAC9C,CAAA;AAED,SAAgB,aAAa,CAAC,GAAe,EAAE,MAAc;IAC3D,MAAM,EAAC,GAAG,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IACrB,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;IAC/C,MAAM,CAAC,GAAG,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,cAAc,GAAG,IAAA,qBAAW,EAAC,MAAM,CAAC,EAAE,CAAA;IACtD,MAAM,QAAQ,GAAG,EAAE,CAAC,aAAa,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IAC/E,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAA;AACjD,CAAC;AAND,sCAMC;AAED,SAAS,YAAY,CAAC,GAAe;IACnC,MAAM,EAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,GAAG,CAAC,EAAE,CAAA;IACxC,MAAM,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAC,GAAG,SAAS,CAAC,IAAI,CAAA;IACtD,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;IAC5B,MAAM,GAAG,GAAG,IAAI,mBAAS,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAC,CAAC,CAAA;IAC5E,uBAAa,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC7B,OAAO,IAAA,iBAAW,EAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAC9B,CAAC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts b/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts deleted file mode 100644 index fa2f2b8..0000000 --- a/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -import type { KeywordCxt } from "../../compile/validate"; -declare const def: CodeKeywordDefinition; -export declare function dynamicRef(cxt: KeywordCxt, ref: string): void; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js b/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js deleted file mode 100644 index 9f010a0..0000000 --- a/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.dynamicRef = void 0; -const codegen_1 = require("../../compile/codegen"); -const names_1 = require("../../compile/names"); -const ref_1 = require("../core/ref"); -const def = { - keyword: "$dynamicRef", - schemaType: "string", - code: (cxt) => dynamicRef(cxt, cxt.schema), -}; -function dynamicRef(cxt, ref) { - const { gen, keyword, it } = cxt; - if (ref[0] !== "#") - throw new Error(`"${keyword}" only supports hash fragment reference`); - const anchor = ref.slice(1); - if (it.allErrors) { - _dynamicRef(); - } - else { - const valid = gen.let("valid", false); - _dynamicRef(valid); - cxt.ok(valid); - } - function _dynamicRef(valid) { - // TODO the assumption here is that `recursiveRef: #` always points to the root - // of the schema object, which is not correct, because there may be $id that - // makes # point to it, and the target schema may not contain dynamic/recursiveAnchor. - // Because of that 2 tests in recursiveRef.json fail. - // This is a similar problem to #815 (`$id` doesn't alter resolution scope for `{ "$ref": "#" }`). - // (This problem is not tested in JSON-Schema-Test-Suite) - if (it.schemaEnv.root.dynamicAnchors[anchor]) { - const v = gen.let("_v", (0, codegen_1._) `${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`); - gen.if(v, _callRef(v, valid), _callRef(it.validateName, valid)); - } - else { - _callRef(it.validateName, valid)(); - } - } - function _callRef(validate, valid) { - return valid - ? () => gen.block(() => { - (0, ref_1.callRef)(cxt, validate); - gen.let(valid, true); - }) - : () => (0, ref_1.callRef)(cxt, validate); - } -} -exports.dynamicRef = dynamicRef; -exports.default = def; -//# sourceMappingURL=dynamicRef.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map b/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map deleted file mode 100644 index 69afd4d..0000000 --- a/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dynamicRef.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/dynamicRef.ts"],"names":[],"mappings":";;;AAEA,mDAAgE;AAChE,+CAAmC;AACnC,qCAAmC;AAEnC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,aAAa;IACtB,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;CAC3C,CAAA;AAED,SAAgB,UAAU,CAAC,GAAe,EAAE,GAAW;IACrD,MAAM,EAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAC9B,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,OAAO,yCAAyC,CAAC,CAAA;IACzF,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAC3B,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC;QACjB,WAAW,EAAE,CAAA;IACf,CAAC;SAAM,CAAC;QACN,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;QACrC,WAAW,CAAC,KAAK,CAAC,CAAA;QAClB,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;IAED,SAAS,WAAW,CAAC,KAAY;QAC/B,+EAA+E;QAC/E,4EAA4E;QAC5E,sFAAsF;QACtF,qDAAqD;QACrD,kGAAkG;QAClG,yDAAyD;QACzD,IAAI,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7C,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,cAAc,GAAG,IAAA,qBAAW,EAAC,MAAM,CAAC,EAAE,CAAC,CAAA;YACrE,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAA;QACjE,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE,CAAA;QACpC,CAAC;IACH,CAAC;IAED,SAAS,QAAQ,CAAC,QAAc,EAAE,KAAY;QAC5C,OAAO,KAAK;YACV,CAAC,CAAC,GAAG,EAAE,CACH,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE;gBACb,IAAA,aAAO,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;gBACtB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;YACtB,CAAC,CAAC;YACN,CAAC,CAAC,GAAG,EAAE,CAAC,IAAA,aAAO,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAClC,CAAC;AACH,CAAC;AApCD,gCAoCC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts b/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts deleted file mode 100644 index 0c751d9..0000000 --- a/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Vocabulary } from "../../types"; -declare const dynamic: Vocabulary; -export default dynamic; diff --git a/node_modules/ajv/dist/vocabularies/dynamic/index.js b/node_modules/ajv/dist/vocabularies/dynamic/index.js deleted file mode 100644 index f2388a7..0000000 --- a/node_modules/ajv/dist/vocabularies/dynamic/index.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const dynamicAnchor_1 = require("./dynamicAnchor"); -const dynamicRef_1 = require("./dynamicRef"); -const recursiveAnchor_1 = require("./recursiveAnchor"); -const recursiveRef_1 = require("./recursiveRef"); -const dynamic = [dynamicAnchor_1.default, dynamicRef_1.default, recursiveAnchor_1.default, recursiveRef_1.default]; -exports.default = dynamic; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/dynamic/index.js.map b/node_modules/ajv/dist/vocabularies/dynamic/index.js.map deleted file mode 100644 index f96ba76..0000000 --- a/node_modules/ajv/dist/vocabularies/dynamic/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/index.ts"],"names":[],"mappings":";;AACA,mDAA2C;AAC3C,6CAAqC;AACrC,uDAA+C;AAC/C,iDAAyC;AAEzC,MAAM,OAAO,GAAe,CAAC,uBAAa,EAAE,oBAAU,EAAE,yBAAe,EAAE,sBAAY,CAAC,CAAA;AAEtF,kBAAe,OAAO,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts b/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts deleted file mode 100644 index cde2aa2..0000000 --- a/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js b/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js deleted file mode 100644 index 9fd8323..0000000 --- a/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const dynamicAnchor_1 = require("./dynamicAnchor"); -const util_1 = require("../../compile/util"); -const def = { - keyword: "$recursiveAnchor", - schemaType: "boolean", - code(cxt) { - if (cxt.schema) - (0, dynamicAnchor_1.dynamicAnchor)(cxt, ""); - else - (0, util_1.checkStrictMode)(cxt.it, "$recursiveAnchor: false is ignored"); - }, -}; -exports.default = def; -//# sourceMappingURL=recursiveAnchor.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map b/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map deleted file mode 100644 index 5d5e381..0000000 --- a/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"recursiveAnchor.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/recursiveAnchor.ts"],"names":[],"mappings":";;AACA,mDAA6C;AAC7C,6CAAkD;AAElD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,kBAAkB;IAC3B,UAAU,EAAE,SAAS;IACrB,IAAI,CAAC,GAAG;QACN,IAAI,GAAG,CAAC,MAAM;YAAE,IAAA,6BAAa,EAAC,GAAG,EAAE,EAAE,CAAC,CAAA;;YACjC,IAAA,sBAAe,EAAC,GAAG,CAAC,EAAE,EAAE,oCAAoC,CAAC,CAAA;IACpE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts b/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts deleted file mode 100644 index cde2aa2..0000000 --- a/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js b/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js deleted file mode 100644 index 8cd5c69..0000000 --- a/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const dynamicRef_1 = require("./dynamicRef"); -const def = { - keyword: "$recursiveRef", - schemaType: "string", - code: (cxt) => (0, dynamicRef_1.dynamicRef)(cxt, cxt.schema), -}; -exports.default = def; -//# sourceMappingURL=recursiveRef.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map b/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map deleted file mode 100644 index f813804..0000000 --- a/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"recursiveRef.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/recursiveRef.ts"],"names":[],"mappings":";;AACA,6CAAuC;AAEvC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,eAAe;IACxB,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,uBAAU,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;CAC3C,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/errors.d.ts b/node_modules/ajv/dist/vocabularies/errors.d.ts deleted file mode 100644 index be67f2e..0000000 --- a/node_modules/ajv/dist/vocabularies/errors.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { TypeError } from "../compile/validate/dataType"; -import type { ApplicatorKeywordError } from "./applicator"; -import type { ValidationKeywordError } from "./validation"; -import type { FormatError } from "./format/format"; -import type { UnevaluatedPropertiesError } from "./unevaluated/unevaluatedProperties"; -import type { UnevaluatedItemsError } from "./unevaluated/unevaluatedItems"; -import type { DependentRequiredError } from "./validation/dependentRequired"; -import type { DiscriminatorError } from "./discriminator"; -export type DefinedError = TypeError | ApplicatorKeywordError | ValidationKeywordError | FormatError | UnevaluatedPropertiesError | UnevaluatedItemsError | DependentRequiredError | DiscriminatorError; diff --git a/node_modules/ajv/dist/vocabularies/errors.js b/node_modules/ajv/dist/vocabularies/errors.js deleted file mode 100644 index d4d3fba..0000000 --- a/node_modules/ajv/dist/vocabularies/errors.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/errors.js.map b/node_modules/ajv/dist/vocabularies/errors.js.map deleted file mode 100644 index 56bad73..0000000 --- a/node_modules/ajv/dist/vocabularies/errors.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../lib/vocabularies/errors.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/format/format.d.ts b/node_modules/ajv/dist/vocabularies/format/format.d.ts deleted file mode 100644 index 04dc98f..0000000 --- a/node_modules/ajv/dist/vocabularies/format/format.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject } from "../../types"; -export type FormatError = ErrorObject<"format", { - format: string; -}, string | { - $data: string; -}>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/format/format.js b/node_modules/ajv/dist/vocabularies/format/format.js deleted file mode 100644 index aa667c1..0000000 --- a/node_modules/ajv/dist/vocabularies/format/format.js +++ /dev/null @@ -1,92 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const error = { - message: ({ schemaCode }) => (0, codegen_1.str) `must match format "${schemaCode}"`, - params: ({ schemaCode }) => (0, codegen_1._) `{format: ${schemaCode}}`, -}; -const def = { - keyword: "format", - type: ["number", "string"], - schemaType: "string", - $data: true, - error, - code(cxt, ruleType) { - const { gen, data, $data, schema, schemaCode, it } = cxt; - const { opts, errSchemaPath, schemaEnv, self } = it; - if (!opts.validateFormats) - return; - if ($data) - validate$DataFormat(); - else - validateFormat(); - function validate$DataFormat() { - const fmts = gen.scopeValue("formats", { - ref: self.formats, - code: opts.code.formats, - }); - const fDef = gen.const("fDef", (0, codegen_1._) `${fmts}[${schemaCode}]`); - const fType = gen.let("fType"); - const format = gen.let("format"); - // TODO simplify - gen.if((0, codegen_1._) `typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._) `${fDef}.type || "string"`).assign(format, (0, codegen_1._) `${fDef}.validate`), () => gen.assign(fType, (0, codegen_1._) `"string"`).assign(format, fDef)); - cxt.fail$data((0, codegen_1.or)(unknownFmt(), invalidFmt())); - function unknownFmt() { - if (opts.strictSchema === false) - return codegen_1.nil; - return (0, codegen_1._) `${schemaCode} && !${format}`; - } - function invalidFmt() { - const callFormat = schemaEnv.$async - ? (0, codegen_1._) `(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))` - : (0, codegen_1._) `${format}(${data})`; - const validData = (0, codegen_1._) `(typeof ${format} == "function" ? ${callFormat} : ${format}.test(${data}))`; - return (0, codegen_1._) `${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}`; - } - } - function validateFormat() { - const formatDef = self.formats[schema]; - if (!formatDef) { - unknownFormat(); - return; - } - if (formatDef === true) - return; - const [fmtType, format, fmtRef] = getFormat(formatDef); - if (fmtType === ruleType) - cxt.pass(validCondition()); - function unknownFormat() { - if (opts.strictSchema === false) { - self.logger.warn(unknownMsg()); - return; - } - throw new Error(unknownMsg()); - function unknownMsg() { - return `unknown format "${schema}" ignored in schema at path "${errSchemaPath}"`; - } - } - function getFormat(fmtDef) { - const code = fmtDef instanceof RegExp - ? (0, codegen_1.regexpCode)(fmtDef) - : opts.code.formats - ? (0, codegen_1._) `${opts.code.formats}${(0, codegen_1.getProperty)(schema)}` - : undefined; - const fmt = gen.scopeValue("formats", { key: schema, ref: fmtDef, code }); - if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) { - return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._) `${fmt}.validate`]; - } - return ["string", fmtDef, fmt]; - } - function validCondition() { - if (typeof formatDef == "object" && !(formatDef instanceof RegExp) && formatDef.async) { - if (!schemaEnv.$async) - throw new Error("async format in sync schema"); - return (0, codegen_1._) `await ${fmtRef}(${data})`; - } - return typeof format == "function" ? (0, codegen_1._) `${fmtRef}(${data})` : (0, codegen_1._) `${fmtRef}.test(${data})`; - } - } - }, -}; -exports.default = def; -//# sourceMappingURL=format.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/format/format.js.map b/node_modules/ajv/dist/vocabularies/format/format.js.map deleted file mode 100644 index b6d93c9..0000000 --- a/node_modules/ajv/dist/vocabularies/format/format.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../lib/vocabularies/format/format.ts"],"names":[],"mappings":";;AASA,mDAAoF;AAapF,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,sBAAsB,UAAU,GAAG;IACjE,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,YAAY,UAAU,GAAG;CACrD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,QAAQ;IACjB,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC1B,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe,EAAE,QAAiB;QACrC,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACtD,MAAM,EAAC,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;QACjD,IAAI,CAAC,IAAI,CAAC,eAAe;YAAE,OAAM;QAEjC,IAAI,KAAK;YAAE,mBAAmB,EAAE,CAAA;;YAC3B,cAAc,EAAE,CAAA;QAErB,SAAS,mBAAmB;YAC1B,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE;gBACrC,GAAG,EAAE,IAAI,CAAC,OAAO;gBACjB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO;aACxB,CAAC,CAAA;YACF,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,IAAI,UAAU,GAAG,CAAC,CAAA;YACzD,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YAC9B,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;YAChC,gBAAgB;YAChB,GAAG,CAAC,EAAE,CACJ,IAAA,WAAC,EAAA,UAAU,IAAI,qBAAqB,IAAI,qBAAqB,EAC7D,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,mBAAmB,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,CAAC,EACxF,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,UAAU,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAC1D,CAAA;YACD,GAAG,CAAC,SAAS,CAAC,IAAA,YAAE,EAAC,UAAU,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,CAAA;YAE7C,SAAS,UAAU;gBACjB,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK;oBAAE,OAAO,aAAG,CAAA;gBAC3C,OAAO,IAAA,WAAC,EAAA,GAAG,UAAU,QAAQ,MAAM,EAAE,CAAA;YACvC,CAAC;YAED,SAAS,UAAU;gBACjB,MAAM,UAAU,GAAG,SAAS,CAAC,MAAM;oBACjC,CAAC,CAAC,IAAA,WAAC,EAAA,IAAI,IAAI,kBAAkB,MAAM,IAAI,IAAI,OAAO,MAAM,IAAI,IAAI,IAAI;oBACpE,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,MAAM,IAAI,IAAI,GAAG,CAAA;gBACzB,MAAM,SAAS,GAAG,IAAA,WAAC,EAAA,WAAW,MAAM,oBAAoB,UAAU,MAAM,MAAM,SAAS,IAAI,IAAI,CAAA;gBAC/F,OAAO,IAAA,WAAC,EAAA,GAAG,MAAM,OAAO,MAAM,gBAAgB,KAAK,QAAQ,QAAQ,QAAQ,SAAS,EAAE,CAAA;YACxF,CAAC;QACH,CAAC;QAED,SAAS,cAAc;YACrB,MAAM,SAAS,GAA4B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YAC/D,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,aAAa,EAAE,CAAA;gBACf,OAAM;YACR,CAAC;YACD,IAAI,SAAS,KAAK,IAAI;gBAAE,OAAM;YAC9B,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,CAAA;YACtD,IAAI,OAAO,KAAK,QAAQ;gBAAE,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAA;YAEpD,SAAS,aAAa;gBACpB,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,EAAE,CAAC;oBAChC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;oBAC9B,OAAM;gBACR,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC,CAAA;gBAE7B,SAAS,UAAU;oBACjB,OAAO,mBAAmB,MAAgB,gCAAgC,aAAa,GAAG,CAAA;gBAC5F,CAAC;YACH,CAAC;YAED,SAAS,SAAS,CAAC,MAAmB;gBACpC,MAAM,IAAI,GACR,MAAM,YAAY,MAAM;oBACtB,CAAC,CAAC,IAAA,oBAAU,EAAC,MAAM,CAAC;oBACpB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO;wBACnB,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,IAAA,qBAAW,EAAC,MAAM,CAAC,EAAE;wBAC/C,CAAC,CAAC,SAAS,CAAA;gBACf,MAAM,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE,EAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAC,CAAC,CAAA;gBACvE,IAAI,OAAO,MAAM,IAAI,QAAQ,IAAI,CAAC,CAAC,MAAM,YAAY,MAAM,CAAC,EAAE,CAAC;oBAC7D,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAA,WAAC,EAAA,GAAG,GAAG,WAAW,CAAC,CAAA;gBACvE,CAAC;gBAED,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;YAChC,CAAC;YAED,SAAS,cAAc;gBACrB,IAAI,OAAO,SAAS,IAAI,QAAQ,IAAI,CAAC,CAAC,SAAS,YAAY,MAAM,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;oBACtF,IAAI,CAAC,SAAS,CAAC,MAAM;wBAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;oBACrE,OAAO,IAAA,WAAC,EAAA,SAAS,MAAM,IAAI,IAAI,GAAG,CAAA;gBACpC,CAAC;gBACD,OAAO,OAAO,MAAM,IAAI,UAAU,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,MAAM,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,MAAM,SAAS,IAAI,GAAG,CAAA;YACzF,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/format/index.d.ts b/node_modules/ajv/dist/vocabularies/format/index.d.ts deleted file mode 100644 index c8019c9..0000000 --- a/node_modules/ajv/dist/vocabularies/format/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Vocabulary } from "../../types"; -declare const format: Vocabulary; -export default format; diff --git a/node_modules/ajv/dist/vocabularies/format/index.js b/node_modules/ajv/dist/vocabularies/format/index.js deleted file mode 100644 index d19023d..0000000 --- a/node_modules/ajv/dist/vocabularies/format/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const format_1 = require("./format"); -const format = [format_1.default]; -exports.default = format; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/format/index.js.map b/node_modules/ajv/dist/vocabularies/format/index.js.map deleted file mode 100644 index 6315bfe..0000000 --- a/node_modules/ajv/dist/vocabularies/format/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/format/index.ts"],"names":[],"mappings":";;AACA,qCAAoC;AAEpC,MAAM,MAAM,GAAe,CAAC,gBAAa,CAAC,CAAA;AAE1C,kBAAe,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts b/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts deleted file mode 100644 index 85e16df..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -import { _JTDTypeError } from "./error"; -import { DiscrError, DiscrErrorObj } from "../discriminator/types"; -export type JTDDiscriminatorError = _JTDTypeError<"discriminator", "object", string> | DiscrErrorObj | DiscrErrorObj; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/jtd/discriminator.js b/node_modules/ajv/dist/vocabularies/jtd/discriminator.js deleted file mode 100644 index e7074d2..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/discriminator.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const metadata_1 = require("./metadata"); -const nullable_1 = require("./nullable"); -const error_1 = require("./error"); -const types_1 = require("../discriminator/types"); -const error = { - message: (cxt) => { - const { schema, params } = cxt; - return params.discrError - ? params.discrError === types_1.DiscrError.Tag - ? `tag "${schema}" must be string` - : `value of tag "${schema}" must be in mapping` - : (0, error_1.typeErrorMessage)(cxt, "object"); - }, - params: (cxt) => { - const { schema, params } = cxt; - return params.discrError - ? (0, codegen_1._) `{error: ${params.discrError}, tag: ${schema}, tagValue: ${params.tag}}` - : (0, error_1.typeErrorParams)(cxt, "object"); - }, -}; -const def = { - keyword: "discriminator", - schemaType: "string", - implements: ["mapping"], - error, - code(cxt) { - (0, metadata_1.checkMetadata)(cxt); - const { gen, data, schema, parentSchema } = cxt; - const [valid, cond] = (0, nullable_1.checkNullableObject)(cxt, data); - gen.if(cond); - validateDiscriminator(); - gen.elseIf((0, codegen_1.not)(valid)); - cxt.error(); - gen.endIf(); - cxt.ok(valid); - function validateDiscriminator() { - const tag = gen.const("tag", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(schema)}`); - gen.if((0, codegen_1._) `${tag} === undefined`); - cxt.error(false, { discrError: types_1.DiscrError.Tag, tag }); - gen.elseIf((0, codegen_1._) `typeof ${tag} == "string"`); - validateMapping(tag); - gen.else(); - cxt.error(false, { discrError: types_1.DiscrError.Tag, tag }, { instancePath: schema }); - gen.endIf(); - } - function validateMapping(tag) { - gen.if(false); - for (const tagValue in parentSchema.mapping) { - gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`); - gen.assign(valid, applyTagSchema(tagValue)); - } - gen.else(); - cxt.error(false, { discrError: types_1.DiscrError.Mapping, tag }, { instancePath: schema, schemaPath: "mapping", parentSchema: true }); - gen.endIf(); - } - function applyTagSchema(schemaProp) { - const _valid = gen.name("valid"); - cxt.subschema({ - keyword: "mapping", - schemaProp, - jtdDiscriminator: schema, - }, _valid); - return _valid; - } - }, -}; -exports.default = def; -//# sourceMappingURL=discriminator.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map b/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map deleted file mode 100644 index ca2a5ab..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"discriminator.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/discriminator.ts"],"names":[],"mappings":";;AAEA,mDAA+D;AAC/D,yCAAwC;AACxC,yCAA8C;AAC9C,mCAAwE;AACxE,kDAAgE;AAOhE,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACf,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;QAC5B,OAAO,MAAM,CAAC,UAAU;YACtB,CAAC,CAAC,MAAM,CAAC,UAAU,KAAK,kBAAU,CAAC,GAAG;gBACpC,CAAC,CAAC,QAAQ,MAAM,kBAAkB;gBAClC,CAAC,CAAC,iBAAiB,MAAM,sBAAsB;YACjD,CAAC,CAAC,IAAA,wBAAgB,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IACrC,CAAC;IACD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;QACd,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;QAC5B,OAAO,MAAM,CAAC,UAAU;YACtB,CAAC,CAAC,IAAA,WAAC,EAAA,WAAW,MAAM,CAAC,UAAU,UAAU,MAAM,eAAe,MAAM,CAAC,GAAG,GAAG;YAC3E,CAAC,CAAC,IAAA,uBAAe,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IACpC,CAAC;CACF,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,eAAe;IACxB,UAAU,EAAE,QAAQ;IACpB,UAAU,EAAE,CAAC,SAAS,CAAC;IACvB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAC,GAAG,GAAG,CAAA;QAC7C,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,IAAA,8BAAmB,EAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QAEpD,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;QACZ,qBAAqB,EAAE,CAAA;QACvB,GAAG,CAAC,MAAM,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,CAAC,CAAA;QACtB,GAAG,CAAC,KAAK,EAAE,CAAA;QACX,GAAG,CAAC,KAAK,EAAE,CAAA;QACX,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;QAEb,SAAS,qBAAqB;YAC5B,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,GAAG,IAAA,qBAAW,EAAC,MAAM,CAAC,EAAE,CAAC,CAAA;YAC9D,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,gBAAgB,CAAC,CAAA;YAC/B,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,EAAC,UAAU,EAAE,kBAAU,CAAC,GAAG,EAAE,GAAG,EAAC,CAAC,CAAA;YACnD,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,UAAU,GAAG,cAAc,CAAC,CAAA;YACxC,eAAe,CAAC,GAAG,CAAC,CAAA;YACpB,GAAG,CAAC,IAAI,EAAE,CAAA;YACV,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,EAAC,UAAU,EAAE,kBAAU,CAAC,GAAG,EAAE,GAAG,EAAC,EAAE,EAAC,YAAY,EAAE,MAAM,EAAC,CAAC,CAAA;YAC3E,GAAG,CAAC,KAAK,EAAE,CAAA;QACb,CAAC;QAED,SAAS,eAAe,CAAC,GAAS;YAChC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;YACb,KAAK,MAAM,QAAQ,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;gBAC5C,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,QAAQ,EAAE,CAAC,CAAA;gBACrC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAA;YAC7C,CAAC;YACD,GAAG,CAAC,IAAI,EAAE,CAAA;YACV,GAAG,CAAC,KAAK,CACP,KAAK,EACL,EAAC,UAAU,EAAE,kBAAU,CAAC,OAAO,EAAE,GAAG,EAAC,EACrC,EAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAC,CAClE,CAAA;YACD,GAAG,CAAC,KAAK,EAAE,CAAA;QACb,CAAC;QAED,SAAS,cAAc,CAAC,UAAkB;YACxC,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAChC,GAAG,CAAC,SAAS,CACX;gBACE,OAAO,EAAE,SAAS;gBAClB,UAAU;gBACV,gBAAgB,EAAE,MAAM;aACzB,EACD,MAAM,CACP,CAAA;YACD,OAAO,MAAM,CAAA;QACf,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts b/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts deleted file mode 100644 index 82c942c..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { CodeKeywordDefinition, SchemaObject } from "../../types"; -import { _JTDTypeError } from "./error"; -export type JTDElementsError = _JTDTypeError<"elements", "array", SchemaObject>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/jtd/elements.js b/node_modules/ajv/dist/vocabularies/jtd/elements.js deleted file mode 100644 index 9b8fb54..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/elements.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const util_1 = require("../../compile/util"); -const code_1 = require("../code"); -const codegen_1 = require("../../compile/codegen"); -const metadata_1 = require("./metadata"); -const nullable_1 = require("./nullable"); -const error_1 = require("./error"); -const def = { - keyword: "elements", - schemaType: "object", - error: (0, error_1.typeError)("array"), - code(cxt) { - (0, metadata_1.checkMetadata)(cxt); - const { gen, data, schema, it } = cxt; - if ((0, util_1.alwaysValidSchema)(it, schema)) - return; - const [valid] = (0, nullable_1.checkNullable)(cxt); - gen.if((0, codegen_1.not)(valid), () => gen.if((0, codegen_1._) `Array.isArray(${data})`, () => gen.assign(valid, (0, code_1.validateArray)(cxt)), () => cxt.error())); - cxt.ok(valid); - }, -}; -exports.default = def; -//# sourceMappingURL=elements.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/elements.js.map b/node_modules/ajv/dist/vocabularies/jtd/elements.js.map deleted file mode 100644 index 38fe3a1..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/elements.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/elements.ts"],"names":[],"mappings":";;AAEA,6CAAoD;AACpD,kCAAqC;AACrC,mDAA4C;AAC5C,yCAAwC;AACxC,yCAAwC;AACxC,mCAAgD;AAIhD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAA,iBAAS,EAAC,OAAO,CAAC;IACzB,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClC,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CACtB,GAAG,CAAC,EAAE,CACJ,IAAA,WAAC,EAAA,iBAAiB,IAAI,GAAG,EACzB,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAA,oBAAa,EAAC,GAAG,CAAC,CAAC,EAC3C,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAClB,CACF,CAAA;QACD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts b/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts deleted file mode 100644 index 8ba1790..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject } from "../../types"; -export type JTDEnumError = ErrorObject<"enum", { - allowedValues: string[]; -}, string[]>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/jtd/enum.js b/node_modules/ajv/dist/vocabularies/jtd/enum.js deleted file mode 100644 index 78b01ee..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/enum.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const metadata_1 = require("./metadata"); -const nullable_1 = require("./nullable"); -const error = { - message: "must be equal to one of the allowed values", - params: ({ schemaCode }) => (0, codegen_1._) `{allowedValues: ${schemaCode}}`, -}; -const def = { - keyword: "enum", - schemaType: "array", - error, - code(cxt) { - (0, metadata_1.checkMetadata)(cxt); - const { gen, data, schema, schemaValue, parentSchema, it } = cxt; - if (schema.length === 0) - throw new Error("enum must have non-empty array"); - if (schema.length !== new Set(schema).size) - throw new Error("enum items must be unique"); - let valid; - const isString = (0, codegen_1._) `typeof ${data} == "string"`; - if (schema.length >= it.opts.loopEnum) { - let cond; - [valid, cond] = (0, nullable_1.checkNullable)(cxt, isString); - gen.if(cond, loopEnum); - } - else { - /* istanbul ignore if */ - if (!Array.isArray(schema)) - throw new Error("ajv implementation error"); - valid = (0, codegen_1.and)(isString, (0, codegen_1.or)(...schema.map((value) => (0, codegen_1._) `${data} === ${value}`))); - if (parentSchema.nullable) - valid = (0, codegen_1.or)((0, codegen_1._) `${data} === null`, valid); - } - cxt.pass(valid); - function loopEnum() { - gen.forOf("v", schemaValue, (v) => gen.if((0, codegen_1._) `${valid} = ${data} === ${v}`, () => gen.break())); - } - }, -}; -exports.default = def; -//# sourceMappingURL=enum.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/enum.js.map b/node_modules/ajv/dist/vocabularies/jtd/enum.js.map deleted file mode 100644 index 06ee9e2..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/enum.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/enum.ts"],"names":[],"mappings":";;AAEA,mDAAsD;AACtD,yCAAwC;AACxC,yCAAwC;AAIxC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,4CAA4C;IACrD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,mBAAmB,UAAU,GAAG;CAC5D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,OAAO;IACnB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC9D,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QAC1E,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;QACxF,IAAI,KAAW,CAAA;QACf,MAAM,QAAQ,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,cAAc,CAAA;QAC9C,IAAI,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACtC,IAAI,IAAU,CACb;YAAA,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,IAAA,wBAAa,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YAC7C,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;QACxB,CAAC;aAAM,CAAC;YACN,wBAAwB;YACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;YACvE,KAAK,GAAG,IAAA,aAAG,EAAC,QAAQ,EAAE,IAAA,YAAE,EAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;YACpF,IAAI,YAAY,CAAC,QAAQ;gBAAE,KAAK,GAAG,IAAA,YAAE,EAAC,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,EAAE,KAAK,CAAC,CAAA;QACnE,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAEf,SAAS,QAAQ;YACf,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,WAAmB,EAAE,CAAC,CAAC,EAAE,EAAE,CACxC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,MAAM,IAAI,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAC1D,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/error.d.ts b/node_modules/ajv/dist/vocabularies/jtd/error.d.ts deleted file mode 100644 index d334ff5..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/error.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { KeywordErrorDefinition, KeywordErrorCxt, ErrorObject } from "../../types"; -import { Code } from "../../compile/codegen"; -export type _JTDTypeError = ErrorObject; -export declare function typeError(t: string): KeywordErrorDefinition; -export declare function typeErrorMessage({ parentSchema }: KeywordErrorCxt, t: string): string; -export declare function typeErrorParams({ parentSchema }: KeywordErrorCxt, t: string): Code; diff --git a/node_modules/ajv/dist/vocabularies/jtd/error.js b/node_modules/ajv/dist/vocabularies/jtd/error.js deleted file mode 100644 index 1a3920a..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/error.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.typeErrorParams = exports.typeErrorMessage = exports.typeError = void 0; -const codegen_1 = require("../../compile/codegen"); -function typeError(t) { - return { - message: (cxt) => typeErrorMessage(cxt, t), - params: (cxt) => typeErrorParams(cxt, t), - }; -} -exports.typeError = typeError; -function typeErrorMessage({ parentSchema }, t) { - return (parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.nullable) ? `must be ${t} or null` : `must be ${t}`; -} -exports.typeErrorMessage = typeErrorMessage; -function typeErrorParams({ parentSchema }, t) { - return (0, codegen_1._) `{type: ${t}, nullable: ${!!(parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.nullable)}}`; -} -exports.typeErrorParams = typeErrorParams; -//# sourceMappingURL=error.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/error.js.map b/node_modules/ajv/dist/vocabularies/jtd/error.js.map deleted file mode 100644 index db55967..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/error.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/error.ts"],"names":[],"mappings":";;;AACA,mDAA6C;AAQ7C,SAAgB,SAAS,CAAC,CAAS;IACjC,OAAO;QACL,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC,CAAC;QAC1C,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,CAAC;KACzC,CAAA;AACH,CAAC;AALD,8BAKC;AAED,SAAgB,gBAAgB,CAAC,EAAC,YAAY,EAAkB,EAAE,CAAS;IACzE,OAAO,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,EAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAA;AACzE,CAAC;AAFD,4CAEC;AAED,SAAgB,eAAe,CAAC,EAAC,YAAY,EAAkB,EAAE,CAAS;IACxE,OAAO,IAAA,WAAC,EAAA,UAAU,CAAC,eAAe,CAAC,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,CAAA,GAAG,CAAA;AAC/D,CAAC;AAFD,0CAEC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/index.d.ts b/node_modules/ajv/dist/vocabularies/jtd/index.d.ts deleted file mode 100644 index c56246b..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { Vocabulary } from "../../types"; -import { JTDTypeError } from "./type"; -import { JTDEnumError } from "./enum"; -import { JTDElementsError } from "./elements"; -import { JTDPropertiesError } from "./properties"; -import { JTDDiscriminatorError } from "./discriminator"; -import { JTDValuesError } from "./values"; -declare const jtdVocabulary: Vocabulary; -export default jtdVocabulary; -export type JTDErrorObject = JTDTypeError | JTDEnumError | JTDElementsError | JTDPropertiesError | JTDDiscriminatorError | JTDValuesError; diff --git a/node_modules/ajv/dist/vocabularies/jtd/index.js b/node_modules/ajv/dist/vocabularies/jtd/index.js deleted file mode 100644 index 18f40ab..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/index.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const ref_1 = require("./ref"); -const type_1 = require("./type"); -const enum_1 = require("./enum"); -const elements_1 = require("./elements"); -const properties_1 = require("./properties"); -const optionalProperties_1 = require("./optionalProperties"); -const discriminator_1 = require("./discriminator"); -const values_1 = require("./values"); -const union_1 = require("./union"); -const metadata_1 = require("./metadata"); -const jtdVocabulary = [ - "definitions", - ref_1.default, - type_1.default, - enum_1.default, - elements_1.default, - properties_1.default, - optionalProperties_1.default, - discriminator_1.default, - values_1.default, - union_1.default, - metadata_1.default, - { keyword: "additionalProperties", schemaType: "boolean" }, - { keyword: "nullable", schemaType: "boolean" }, -]; -exports.default = jtdVocabulary; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/index.js.map b/node_modules/ajv/dist/vocabularies/jtd/index.js.map deleted file mode 100644 index 713a187..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/index.ts"],"names":[],"mappings":";;AACA,+BAA8B;AAC9B,iCAAgD;AAChD,iCAAgD;AAChD,yCAAqD;AACrD,6CAA2D;AAC3D,6DAAqD;AACrD,mDAAoE;AACpE,qCAA+C;AAC/C,mCAA2B;AAC3B,yCAAiC;AAEjC,MAAM,aAAa,GAAe;IAChC,aAAa;IACb,aAAU;IACV,cAAW;IACX,cAAW;IACX,kBAAQ;IACR,oBAAU;IACV,4BAAkB;IAClB,uBAAa;IACb,gBAAM;IACN,eAAK;IACL,kBAAQ;IACR,EAAC,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,SAAS,EAAC;IACxD,EAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAC;CAC7C,CAAA;AAED,kBAAe,aAAa,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts b/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts deleted file mode 100644 index 86e15a8..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { KeywordCxt } from "../../ajv"; -import type { CodeKeywordDefinition } from "../../types"; -declare const def: CodeKeywordDefinition; -export declare function checkMetadata({ it, keyword }: KeywordCxt, metadata?: boolean): void; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/jtd/metadata.js b/node_modules/ajv/dist/vocabularies/jtd/metadata.js deleted file mode 100644 index eeb3c91..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/metadata.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.checkMetadata = void 0; -const util_1 = require("../../compile/util"); -const def = { - keyword: "metadata", - schemaType: "object", - code(cxt) { - checkMetadata(cxt); - const { gen, schema, it } = cxt; - if ((0, util_1.alwaysValidSchema)(it, schema)) - return; - const valid = gen.name("valid"); - cxt.subschema({ keyword: "metadata", jtdMetadata: true }, valid); - cxt.ok(valid); - }, -}; -function checkMetadata({ it, keyword }, metadata) { - if (it.jtdMetadata !== metadata) { - throw new Error(`JTD: "${keyword}" cannot be used in this schema location`); - } -} -exports.checkMetadata = checkMetadata; -exports.default = def; -//# sourceMappingURL=metadata.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map b/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map deleted file mode 100644 index 2fea91c..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/metadata.ts"],"names":[],"mappings":";;;AAEA,6CAAoD;AAEpD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,GAAe;QAClB,aAAa,CAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC7B,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;QAC9D,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;CACF,CAAA;AAED,SAAgB,aAAa,CAAC,EAAC,EAAE,EAAE,OAAO,EAAa,EAAE,QAAkB;IACzE,IAAI,EAAE,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,SAAS,OAAO,0CAA0C,CAAC,CAAA;IAC7E,CAAC;AACH,CAAC;AAJD,sCAIC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts b/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts deleted file mode 100644 index 254f760..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { KeywordCxt } from "../../compile/validate"; -import { Code, Name } from "../../compile/codegen"; -export declare function checkNullable({ gen, data, parentSchema }: KeywordCxt, cond?: Code): [Name, Code]; -export declare function checkNullableObject(cxt: KeywordCxt, cond: Code): [Name, Code]; diff --git a/node_modules/ajv/dist/vocabularies/jtd/nullable.js b/node_modules/ajv/dist/vocabularies/jtd/nullable.js deleted file mode 100644 index 8c92d2c..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/nullable.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.checkNullableObject = exports.checkNullable = void 0; -const codegen_1 = require("../../compile/codegen"); -function checkNullable({ gen, data, parentSchema }, cond = codegen_1.nil) { - const valid = gen.name("valid"); - if (parentSchema.nullable) { - gen.let(valid, (0, codegen_1._) `${data} === null`); - cond = (0, codegen_1.not)(valid); - } - else { - gen.let(valid, false); - } - return [valid, cond]; -} -exports.checkNullable = checkNullable; -function checkNullableObject(cxt, cond) { - const [valid, cond_] = checkNullable(cxt, cond); - return [valid, (0, codegen_1._) `${cond_} && typeof ${cxt.data} == "object" && !Array.isArray(${cxt.data})`]; -} -exports.checkNullableObject = checkNullableObject; -//# sourceMappingURL=nullable.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map b/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map deleted file mode 100644 index 7d7a3f1..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"nullable.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/nullable.ts"],"names":[],"mappings":";;;AACA,mDAA6D;AAE7D,SAAgB,aAAa,CAC3B,EAAC,GAAG,EAAE,IAAI,EAAE,YAAY,EAAa,EACrC,OAAa,aAAG;IAEhB,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/B,IAAI,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC1B,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,CAAC,CAAA;QACnC,IAAI,GAAG,IAAA,aAAG,EAAC,KAAK,CAAC,CAAA;IACnB,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IACvB,CAAC;IACD,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAZD,sCAYC;AAED,SAAgB,mBAAmB,CAAC,GAAe,EAAE,IAAU;IAC7D,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC/C,OAAO,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,KAAK,cAAc,GAAG,CAAC,IAAI,kCAAkC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAA;AAC9F,CAAC;AAHD,kDAGC"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts b/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts deleted file mode 100644 index cde2aa2..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js b/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js deleted file mode 100644 index fe27275..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const properties_1 = require("./properties"); -const def = { - keyword: "optionalProperties", - schemaType: "object", - error: properties_1.error, - code(cxt) { - if (cxt.parentSchema.properties) - return; - (0, properties_1.validateProperties)(cxt); - }, -}; -exports.default = def; -//# sourceMappingURL=optionalProperties.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map b/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map deleted file mode 100644 index 21e5f0d..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"optionalProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/optionalProperties.ts"],"names":[],"mappings":";;AAEA,6CAAsD;AAEtD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,oBAAoB;IAC7B,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAL,kBAAK;IACL,IAAI,CAAC,GAAe;QAClB,IAAI,GAAG,CAAC,YAAY,CAAC,UAAU;YAAE,OAAM;QACvC,IAAA,+BAAkB,EAAC,GAAG,CAAC,CAAA;IACzB,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts b/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts deleted file mode 100644 index 54e3b34..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition, SchemaObject } from "../../types"; -import type { KeywordCxt } from "../../compile/validate"; -import { _JTDTypeError } from "./error"; -declare enum PropError { - Additional = "additional", - Missing = "missing" -} -type PropKeyword = "properties" | "optionalProperties"; -type PropSchema = { - [P in string]?: SchemaObject; -}; -export type JTDPropertiesError = _JTDTypeError | ErrorObject | ErrorObject; -export declare const error: KeywordErrorDefinition; -declare const def: CodeKeywordDefinition; -export declare function validateProperties(cxt: KeywordCxt): void; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/jtd/properties.js b/node_modules/ajv/dist/vocabularies/jtd/properties.js deleted file mode 100644 index f4e9de4..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/properties.js +++ /dev/null @@ -1,149 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.validateProperties = exports.error = void 0; -const code_1 = require("../code"); -const util_1 = require("../../compile/util"); -const codegen_1 = require("../../compile/codegen"); -const metadata_1 = require("./metadata"); -const nullable_1 = require("./nullable"); -const error_1 = require("./error"); -var PropError; -(function (PropError) { - PropError["Additional"] = "additional"; - PropError["Missing"] = "missing"; -})(PropError || (PropError = {})); -exports.error = { - message: (cxt) => { - const { params } = cxt; - return params.propError - ? params.propError === PropError.Additional - ? "must NOT have additional properties" - : `must have property '${params.missingProperty}'` - : (0, error_1.typeErrorMessage)(cxt, "object"); - }, - params: (cxt) => { - const { params } = cxt; - return params.propError - ? params.propError === PropError.Additional - ? (0, codegen_1._) `{error: ${params.propError}, additionalProperty: ${params.additionalProperty}}` - : (0, codegen_1._) `{error: ${params.propError}, missingProperty: ${params.missingProperty}}` - : (0, error_1.typeErrorParams)(cxt, "object"); - }, -}; -const def = { - keyword: "properties", - schemaType: "object", - error: exports.error, - code: validateProperties, -}; -// const error: KeywordErrorDefinition = { -// message: "should NOT have additional properties", -// params: ({params}) => _`{additionalProperty: ${params.additionalProperty}}`, -// } -function validateProperties(cxt) { - (0, metadata_1.checkMetadata)(cxt); - const { gen, data, parentSchema, it } = cxt; - const { additionalProperties, nullable } = parentSchema; - if (it.jtdDiscriminator && nullable) - throw new Error("JTD: nullable inside discriminator mapping"); - if (commonProperties()) { - throw new Error("JTD: properties and optionalProperties have common members"); - } - const [allProps, properties] = schemaProperties("properties"); - const [allOptProps, optProperties] = schemaProperties("optionalProperties"); - if (properties.length === 0 && optProperties.length === 0 && additionalProperties) { - return; - } - const [valid, cond] = it.jtdDiscriminator === undefined - ? (0, nullable_1.checkNullableObject)(cxt, data) - : [gen.let("valid", false), true]; - gen.if(cond, () => gen.assign(valid, true).block(() => { - validateProps(properties, "properties", true); - validateProps(optProperties, "optionalProperties"); - if (!additionalProperties) - validateAdditional(); - })); - cxt.pass(valid); - function commonProperties() { - const props = parentSchema.properties; - const optProps = parentSchema.optionalProperties; - if (!(props && optProps)) - return false; - for (const p in props) { - if (Object.prototype.hasOwnProperty.call(optProps, p)) - return true; - } - return false; - } - function schemaProperties(keyword) { - const schema = parentSchema[keyword]; - const allPs = schema ? (0, code_1.allSchemaProperties)(schema) : []; - if (it.jtdDiscriminator && allPs.some((p) => p === it.jtdDiscriminator)) { - throw new Error(`JTD: discriminator tag used in ${keyword}`); - } - const ps = allPs.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p])); - return [allPs, ps]; - } - function validateProps(props, keyword, required) { - const _valid = gen.var("valid"); - for (const prop of props) { - gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties), () => applyPropertySchema(prop, keyword, _valid), () => missingProperty(prop)); - cxt.ok(_valid); - } - function missingProperty(prop) { - if (required) { - gen.assign(_valid, false); - cxt.error(false, { propError: PropError.Missing, missingProperty: prop }, { schemaPath: prop }); - } - else { - gen.assign(_valid, true); - } - } - } - function applyPropertySchema(prop, keyword, _valid) { - cxt.subschema({ - keyword, - schemaProp: prop, - dataProp: prop, - }, _valid); - } - function validateAdditional() { - gen.forIn("key", data, (key) => { - const addProp = isAdditional(key, allProps, "properties", it.jtdDiscriminator); - const addOptProp = isAdditional(key, allOptProps, "optionalProperties"); - const extra = addProp === true ? addOptProp : addOptProp === true ? addProp : (0, codegen_1.and)(addProp, addOptProp); - gen.if(extra, () => { - if (it.opts.removeAdditional) { - gen.code((0, codegen_1._) `delete ${data}[${key}]`); - } - else { - cxt.error(false, { propError: PropError.Additional, additionalProperty: key }, { instancePath: key, parentSchema: true }); - if (!it.opts.allErrors) - gen.break(); - } - }); - }); - } - function isAdditional(key, props, keyword, jtdDiscriminator) { - let additional; - if (props.length > 8) { - // TODO maybe an option instead of hard-coded 8? - const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema[keyword], keyword); - additional = (0, codegen_1.not)((0, code_1.isOwnProperty)(gen, propsSchema, key)); - if (jtdDiscriminator !== undefined) { - additional = (0, codegen_1.and)(additional, (0, codegen_1._) `${key} !== ${jtdDiscriminator}`); - } - } - else if (props.length || jtdDiscriminator !== undefined) { - const ps = jtdDiscriminator === undefined ? props : [jtdDiscriminator].concat(props); - additional = (0, codegen_1.and)(...ps.map((p) => (0, codegen_1._) `${key} !== ${p}`)); - } - else { - additional = true; - } - return additional; - } -} -exports.validateProperties = validateProperties; -exports.default = def; -//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/properties.js.map b/node_modules/ajv/dist/vocabularies/jtd/properties.js.map deleted file mode 100644 index 184111e..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/properties.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/properties.ts"],"names":[],"mappings":";;;AAOA,kCAA0E;AAC1E,6CAAoE;AACpE,mDAA6D;AAC7D,yCAAwC;AACxC,yCAA8C;AAC9C,mCAAwE;AAExE,IAAK,SAGJ;AAHD,WAAK,SAAS;IACZ,sCAAyB,CAAA;IACzB,gCAAmB,CAAA;AACrB,CAAC,EAHI,SAAS,KAAT,SAAS,QAGb;AAWY,QAAA,KAAK,GAA2B;IAC3C,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACf,MAAM,EAAC,MAAM,EAAC,GAAG,GAAG,CAAA;QACpB,OAAO,MAAM,CAAC,SAAS;YACrB,CAAC,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,UAAU;gBACzC,CAAC,CAAC,qCAAqC;gBACvC,CAAC,CAAC,uBAAuB,MAAM,CAAC,eAAe,GAAG;YACpD,CAAC,CAAC,IAAA,wBAAgB,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IACrC,CAAC;IACD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;QACd,MAAM,EAAC,MAAM,EAAC,GAAG,GAAG,CAAA;QACpB,OAAO,MAAM,CAAC,SAAS;YACrB,CAAC,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,UAAU;gBACzC,CAAC,CAAC,IAAA,WAAC,EAAA,WAAW,MAAM,CAAC,SAAS,yBAAyB,MAAM,CAAC,kBAAkB,GAAG;gBACnF,CAAC,CAAC,IAAA,WAAC,EAAA,WAAW,MAAM,CAAC,SAAS,sBAAsB,MAAM,CAAC,eAAe,GAAG;YAC/E,CAAC,CAAC,IAAA,uBAAe,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IACpC,CAAC;CACF,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,YAAY;IACrB,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAL,aAAK;IACL,IAAI,EAAE,kBAAkB;CACzB,CAAA;AAED,0CAA0C;AAC1C,sDAAsD;AACtD,iFAAiF;AACjF,IAAI;AAEJ,SAAgB,kBAAkB,CAAC,GAAe;IAChD,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;IAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IACzC,MAAM,EAAC,oBAAoB,EAAE,QAAQ,EAAC,GAAG,YAAY,CAAA;IACrD,IAAI,EAAE,CAAC,gBAAgB,IAAI,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;IAClG,IAAI,gBAAgB,EAAE,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAA;IAC/E,CAAC;IACD,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAA;IAC7D,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,GAAG,gBAAgB,CAAC,oBAAoB,CAAC,CAAA;IAC3E,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,IAAI,oBAAoB,EAAE,CAAC;QAClF,OAAM;IACR,CAAC;IAED,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GACjB,EAAE,CAAC,gBAAgB,KAAK,SAAS;QAC/B,CAAC,CAAC,IAAA,8BAAmB,EAAC,GAAG,EAAE,IAAI,CAAC;QAChC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,CAAA;IACrC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,CAChB,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;QACjC,aAAa,CAAC,UAAU,EAAE,YAAY,EAAE,IAAI,CAAC,CAAA;QAC7C,aAAa,CAAC,aAAa,EAAE,oBAAoB,CAAC,CAAA;QAClD,IAAI,CAAC,oBAAoB;YAAE,kBAAkB,EAAE,CAAA;IACjD,CAAC,CAAC,CACH,CAAA;IACD,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAEf,SAAS,gBAAgB;QACvB,MAAM,KAAK,GAAG,YAAY,CAAC,UAA6C,CAAA;QACxE,MAAM,QAAQ,GAAG,YAAY,CAAC,kBAAqD,CAAA;QACnF,IAAI,CAAC,CAAC,KAAK,IAAI,QAAQ,CAAC;YAAE,OAAO,KAAK,CAAA;QACtC,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAAE,OAAO,IAAI,CAAA;QACpE,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,SAAS,gBAAgB,CAAC,OAAe;QACvC,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;QACpC,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,IAAA,0BAAmB,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;QACvD,IAAI,EAAE,CAAC,gBAAgB,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACxE,MAAM,IAAI,KAAK,CAAC,kCAAkC,OAAO,EAAE,CAAC,CAAA;QAC9D,CAAC;QACD,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACjE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IACpB,CAAC;IAED,SAAS,aAAa,CAAC,KAAe,EAAE,OAAe,EAAE,QAAkB;QACzE,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,GAAG,CAAC,EAAE,CACJ,IAAA,qBAAc,EAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,EACtD,GAAG,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,EAChD,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAC5B,CAAA;YACD,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,CAAA;QAChB,CAAC;QAED,SAAS,eAAe,CAAC,IAAY;YACnC,IAAI,QAAQ,EAAE,CAAC;gBACb,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;gBACzB,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,EAAC,SAAS,EAAE,SAAS,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAC,EAAE,EAAC,UAAU,EAAE,IAAI,EAAC,CAAC,CAAA;YAC7F,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;YAC1B,CAAC;QACH,CAAC;IACH,CAAC;IAED,SAAS,mBAAmB,CAAC,IAAY,EAAE,OAAe,EAAE,MAAY;QACtE,GAAG,CAAC,SAAS,CACX;YACE,OAAO;YACP,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE,IAAI;SACf,EACD,MAAM,CACP,CAAA;IACH,CAAC;IAED,SAAS,kBAAkB;QACzB,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,GAAS,EAAE,EAAE;YACnC,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAA;YAC9E,MAAM,UAAU,GAAG,YAAY,CAAC,GAAG,EAAE,WAAW,EAAE,oBAAoB,CAAC,CAAA;YACvE,MAAM,KAAK,GACT,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAA,aAAG,EAAC,OAAO,EAAE,UAAU,CAAC,CAAA;YAC1F,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;gBACjB,IAAI,EAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;oBAC7B,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,UAAU,IAAI,IAAI,GAAG,GAAG,CAAC,CAAA;gBACrC,CAAC;qBAAM,CAAC;oBACN,GAAG,CAAC,KAAK,CACP,KAAK,EACL,EAAC,SAAS,EAAE,SAAS,CAAC,UAAU,EAAE,kBAAkB,EAAE,GAAG,EAAC,EAC1D,EAAC,YAAY,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAC,CACxC,CAAA;oBACD,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS;wBAAE,GAAG,CAAC,KAAK,EAAE,CAAA;gBACrC,CAAC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,SAAS,YAAY,CACnB,GAAS,EACT,KAAe,EACf,OAAe,EACf,gBAAyB;QAEzB,IAAI,UAA0B,CAAA;QAC9B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,gDAAgD;YAChD,MAAM,WAAW,GAAG,IAAA,qBAAc,EAAC,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAA;YACtE,UAAU,GAAG,IAAA,aAAG,EAAC,IAAA,oBAAa,EAAC,GAAG,EAAE,WAAmB,EAAE,GAAG,CAAC,CAAC,CAAA;YAC9D,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACnC,UAAU,GAAG,IAAA,aAAG,EAAC,UAAU,EAAE,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,gBAAgB,EAAE,CAAC,CAAA;YACjE,CAAC;QACH,CAAC;aAAM,IAAI,KAAK,CAAC,MAAM,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;YAC1D,MAAM,EAAE,GAAG,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YACpF,UAAU,GAAG,IAAA,aAAG,EAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;QACxD,CAAC;aAAM,CAAC;YACN,UAAU,GAAG,IAAI,CAAA;QACnB,CAAC;QACD,OAAO,UAAU,CAAA;IACnB,CAAC;AACH,CAAC;AA1HD,gDA0HC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts b/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts deleted file mode 100644 index ccdf84c..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { CodeKeywordDefinition, AnySchemaObject } from "../../types"; -declare const def: CodeKeywordDefinition; -export declare function hasRef(schema: AnySchemaObject): boolean; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/jtd/ref.js b/node_modules/ajv/dist/vocabularies/jtd/ref.js deleted file mode 100644 index b7c6b02..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/ref.js +++ /dev/null @@ -1,67 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.hasRef = void 0; -const compile_1 = require("../../compile"); -const codegen_1 = require("../../compile/codegen"); -const ref_error_1 = require("../../compile/ref_error"); -const names_1 = require("../../compile/names"); -const ref_1 = require("../core/ref"); -const metadata_1 = require("./metadata"); -const def = { - keyword: "ref", - schemaType: "string", - code(cxt) { - (0, metadata_1.checkMetadata)(cxt); - const { gen, data, schema: ref, parentSchema, it } = cxt; - const { schemaEnv: { root }, } = it; - const valid = gen.name("valid"); - if (parentSchema.nullable) { - gen.var(valid, (0, codegen_1._) `${data} === null`); - gen.if((0, codegen_1.not)(valid), validateJtdRef); - } - else { - gen.var(valid, false); - validateJtdRef(); - } - cxt.ok(valid); - function validateJtdRef() { - var _a; - const refSchema = (_a = root.schema.definitions) === null || _a === void 0 ? void 0 : _a[ref]; - if (!refSchema) { - throw new ref_error_1.default(it.opts.uriResolver, "", ref, `No definition ${ref}`); - } - if (hasRef(refSchema) || !it.opts.inlineRefs) - callValidate(refSchema); - else - inlineRefSchema(refSchema); - } - function callValidate(schema) { - const sch = compile_1.compileSchema.call(it.self, new compile_1.SchemaEnv({ schema, root, schemaPath: `/definitions/${ref}` })); - const v = (0, ref_1.getValidate)(cxt, sch); - const errsCount = gen.const("_errs", names_1.default.errors); - (0, ref_1.callRef)(cxt, v, sch, sch.$async); - gen.assign(valid, (0, codegen_1._) `${errsCount} === ${names_1.default.errors}`); - } - function inlineRefSchema(schema) { - const schName = gen.scopeValue("schema", it.opts.code.source === true ? { ref: schema, code: (0, codegen_1.stringify)(schema) } : { ref: schema }); - cxt.subschema({ - schema, - dataTypes: [], - schemaPath: codegen_1.nil, - topSchemaRef: schName, - errSchemaPath: `/definitions/${ref}`, - }, valid); - } - }, -}; -function hasRef(schema) { - for (const key in schema) { - let sch; - if (key === "ref" || (typeof (sch = schema[key]) == "object" && hasRef(sch))) - return true; - } - return false; -} -exports.hasRef = hasRef; -exports.default = def; -//# sourceMappingURL=ref.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/ref.js.map b/node_modules/ajv/dist/vocabularies/jtd/ref.js.map deleted file mode 100644 index c15dbf9..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/ref.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ref.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/ref.ts"],"names":[],"mappings":";;;AAEA,2CAAsD;AACtD,mDAA4D;AAC5D,uDAAqD;AACrD,+CAAmC;AACnC,qCAAgD;AAChD,yCAAwC;AAExC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACtD,MAAM,EACJ,SAAS,EAAE,EAAC,IAAI,EAAC,GAClB,GAAG,EAAE,CAAA;QACN,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,IAAI,YAAY,CAAC,QAAQ,EAAE,CAAC;YAC1B,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,CAAC,CAAA;YACnC,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,cAAc,CAAC,CAAA;QACpC,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;YACrB,cAAc,EAAE,CAAA;QAClB,CAAC;QACD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;QAEb,SAAS,cAAc;;YACrB,MAAM,SAAS,GAAG,MAAC,IAAI,CAAC,MAA0B,CAAC,WAAW,0CAAG,GAAG,CAAC,CAAA;YACrE,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,MAAM,IAAI,mBAAe,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,EAAE,GAAG,EAAE,iBAAiB,GAAG,EAAE,CAAC,CAAA;YACjF,CAAC;YACD,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU;gBAAE,YAAY,CAAC,SAAS,CAAC,CAAA;;gBAChE,eAAe,CAAC,SAAS,CAAC,CAAA;QACjC,CAAC;QAED,SAAS,YAAY,CAAC,MAAuB;YAC3C,MAAM,GAAG,GAAG,uBAAa,CAAC,IAAI,CAC5B,EAAE,CAAC,IAAI,EACP,IAAI,mBAAS,CAAC,EAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,GAAG,EAAE,EAAC,CAAC,CACjE,CAAA;YACD,MAAM,CAAC,GAAG,IAAA,iBAAW,EAAC,GAAG,EAAE,GAAG,CAAC,CAAA;YAC/B,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,eAAC,CAAC,MAAM,CAAC,CAAA;YAC9C,IAAA,aAAO,EAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;YAChC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,SAAS,QAAQ,eAAC,CAAC,MAAM,EAAE,CAAC,CAAA;QACpD,CAAC;QAED,SAAS,eAAe,CAAC,MAAuB;YAC9C,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,CAC5B,QAAQ,EACR,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAA,mBAAS,EAAC,MAAM,CAAC,EAAC,CAAC,CAAC,CAAC,EAAC,GAAG,EAAE,MAAM,EAAC,CACtF,CAAA;YACD,GAAG,CAAC,SAAS,CACX;gBACE,MAAM;gBACN,SAAS,EAAE,EAAE;gBACb,UAAU,EAAE,aAAG;gBACf,YAAY,EAAE,OAAO;gBACrB,aAAa,EAAE,gBAAgB,GAAG,EAAE;aACrC,EACD,KAAK,CACN,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,SAAgB,MAAM,CAAC,MAAuB;IAC5C,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,GAAoB,CAAA;QACxB,IAAI,GAAG,KAAK,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC;YAAE,OAAO,IAAI,CAAA;IAC3F,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAND,wBAMC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/type.d.ts b/node_modules/ajv/dist/vocabularies/jtd/type.d.ts deleted file mode 100644 index a115c7d..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/type.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -import { _JTDTypeError } from "./error"; -export type JTDTypeError = _JTDTypeError<"type", JTDType, JTDType>; -export type IntType = "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32"; -export declare const intRange: { - [T in IntType]: [number, number, number]; -}; -export type JTDType = "boolean" | "string" | "timestamp" | "float32" | "float64" | IntType; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/jtd/type.js b/node_modules/ajv/dist/vocabularies/jtd/type.js deleted file mode 100644 index 17a0b51..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/type.js +++ /dev/null @@ -1,69 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.intRange = void 0; -const codegen_1 = require("../../compile/codegen"); -const timestamp_1 = require("../../runtime/timestamp"); -const util_1 = require("../../compile/util"); -const metadata_1 = require("./metadata"); -const error_1 = require("./error"); -exports.intRange = { - int8: [-128, 127, 3], - uint8: [0, 255, 3], - int16: [-32768, 32767, 5], - uint16: [0, 65535, 5], - int32: [-2147483648, 2147483647, 10], - uint32: [0, 4294967295, 10], -}; -const error = { - message: (cxt) => (0, error_1.typeErrorMessage)(cxt, cxt.schema), - params: (cxt) => (0, error_1.typeErrorParams)(cxt, cxt.schema), -}; -function timestampCode(cxt) { - const { gen, data, it } = cxt; - const { timestamp, allowDate } = it.opts; - if (timestamp === "date") - return (0, codegen_1._) `${data} instanceof Date `; - const vts = (0, util_1.useFunc)(gen, timestamp_1.default); - const allowDateArg = allowDate ? (0, codegen_1._) `, true` : codegen_1.nil; - const validString = (0, codegen_1._) `typeof ${data} == "string" && ${vts}(${data}${allowDateArg})`; - return timestamp === "string" ? validString : (0, codegen_1.or)((0, codegen_1._) `${data} instanceof Date`, validString); -} -const def = { - keyword: "type", - schemaType: "string", - error, - code(cxt) { - (0, metadata_1.checkMetadata)(cxt); - const { data, schema, parentSchema, it } = cxt; - let cond; - switch (schema) { - case "boolean": - case "string": - cond = (0, codegen_1._) `typeof ${data} == ${schema}`; - break; - case "timestamp": { - cond = timestampCode(cxt); - break; - } - case "float32": - case "float64": - cond = (0, codegen_1._) `typeof ${data} == "number"`; - break; - default: { - const sch = schema; - cond = (0, codegen_1._) `typeof ${data} == "number" && isFinite(${data}) && !(${data} % 1)`; - if (!it.opts.int32range && (sch === "int32" || sch === "uint32")) { - if (sch === "uint32") - cond = (0, codegen_1._) `${cond} && ${data} >= 0`; - } - else { - const [min, max] = exports.intRange[sch]; - cond = (0, codegen_1._) `${cond} && ${data} >= ${min} && ${data} <= ${max}`; - } - } - } - cxt.pass(parentSchema.nullable ? (0, codegen_1.or)((0, codegen_1._) `${data} === null`, cond) : cond); - }, -}; -exports.default = def; -//# sourceMappingURL=type.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/type.js.map b/node_modules/ajv/dist/vocabularies/jtd/type.js.map deleted file mode 100644 index cf538ed..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/type.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/type.ts"],"names":[],"mappings":";;;AAEA,mDAAsD;AACtD,uDAAoD;AACpD,6CAA0C;AAC1C,yCAAwC;AACxC,mCAAwE;AAM3D,QAAA,QAAQ,GAA+C;IAClE,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IACpB,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAClB,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACzB,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACrB,KAAK,EAAE,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC;IACpC,MAAM,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,CAAC;CAC5B,CAAA;AAID,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,wBAAgB,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;IACnD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,uBAAe,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;CAClD,CAAA;AAED,SAAS,aAAa,CAAC,GAAe;IACpC,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAC3B,MAAM,EAAC,SAAS,EAAE,SAAS,EAAC,GAAG,EAAE,CAAC,IAAI,CAAA;IACtC,IAAI,SAAS,KAAK,MAAM;QAAE,OAAO,IAAA,WAAC,EAAA,GAAG,IAAI,mBAAmB,CAAA;IAC5D,MAAM,GAAG,GAAG,IAAA,cAAO,EAAC,GAAG,EAAE,mBAAc,CAAC,CAAA;IACxC,MAAM,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,QAAQ,CAAC,CAAC,CAAC,aAAG,CAAA;IAChD,MAAM,WAAW,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,mBAAmB,GAAG,IAAI,IAAI,GAAG,YAAY,GAAG,CAAA;IACnF,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAA,YAAE,EAAC,IAAA,WAAC,EAAA,GAAG,IAAI,kBAAkB,EAAE,WAAW,CAAC,CAAA;AAC3F,CAAC;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC5C,IAAI,IAAU,CAAA;QACd,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,SAAS,CAAC;YACf,KAAK,QAAQ;gBACX,IAAI,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,OAAO,MAAM,EAAE,CAAA;gBACrC,MAAK;YACP,KAAK,WAAW,CAAC,CAAC,CAAC;gBACjB,IAAI,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;gBACzB,MAAK;YACP,CAAC;YACD,KAAK,SAAS,CAAC;YACf,KAAK,SAAS;gBACZ,IAAI,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,cAAc,CAAA;gBACpC,MAAK;YACP,OAAO,CAAC,CAAC,CAAC;gBACR,MAAM,GAAG,GAAG,MAAiB,CAAA;gBAC7B,IAAI,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,4BAA4B,IAAI,UAAU,IAAI,OAAO,CAAA;gBAC3E,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,QAAQ,CAAC,EAAE,CAAC;oBACjE,IAAI,GAAG,KAAK,QAAQ;wBAAE,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,OAAO,IAAI,OAAO,CAAA;gBACzD,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,gBAAQ,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,OAAO,IAAI,OAAO,GAAG,OAAO,IAAI,OAAO,GAAG,EAAE,CAAA;gBAC7D,CAAC;YACH,CAAC;QACH,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAA,YAAE,EAAC,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACxE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/union.d.ts b/node_modules/ajv/dist/vocabularies/jtd/union.d.ts deleted file mode 100644 index cde2aa2..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/union.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/jtd/union.js b/node_modules/ajv/dist/vocabularies/jtd/union.js deleted file mode 100644 index 01a9439..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/union.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const code_1 = require("../code"); -const def = { - keyword: "union", - schemaType: "array", - trackErrors: true, - code: code_1.validateUnion, - error: { message: "must match a schema in union" }, -}; -exports.default = def; -//# sourceMappingURL=union.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/union.js.map b/node_modules/ajv/dist/vocabularies/jtd/union.js.map deleted file mode 100644 index 4d6eb41..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/union.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"union.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/union.ts"],"names":[],"mappings":";;AACA,kCAAqC;AAErC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,IAAI;IACjB,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE,EAAC,OAAO,EAAE,8BAA8B,EAAC;CACjD,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/values.d.ts b/node_modules/ajv/dist/vocabularies/jtd/values.d.ts deleted file mode 100644 index 1eaa884..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/values.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { CodeKeywordDefinition, SchemaObject } from "../../types"; -import { _JTDTypeError } from "./error"; -export type JTDValuesError = _JTDTypeError<"values", "object", SchemaObject>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/jtd/values.js b/node_modules/ajv/dist/vocabularies/jtd/values.js deleted file mode 100644 index 3c2c95f..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/values.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const util_1 = require("../../compile/util"); -const codegen_1 = require("../../compile/codegen"); -const metadata_1 = require("./metadata"); -const nullable_1 = require("./nullable"); -const error_1 = require("./error"); -const def = { - keyword: "values", - schemaType: "object", - error: (0, error_1.typeError)("object"), - code(cxt) { - (0, metadata_1.checkMetadata)(cxt); - const { gen, data, schema, it } = cxt; - const [valid, cond] = (0, nullable_1.checkNullableObject)(cxt, data); - if ((0, util_1.alwaysValidSchema)(it, schema)) { - gen.if((0, codegen_1.not)((0, codegen_1.or)(cond, valid)), () => cxt.error()); - } - else { - gen.if(cond); - gen.assign(valid, validateMap()); - gen.elseIf((0, codegen_1.not)(valid)); - cxt.error(); - gen.endIf(); - } - cxt.ok(valid); - function validateMap() { - const _valid = gen.name("valid"); - if (it.allErrors) { - const validMap = gen.let("valid", true); - validateValues(() => gen.assign(validMap, false)); - return validMap; - } - gen.var(_valid, true); - validateValues(() => gen.break()); - return _valid; - function validateValues(notValid) { - gen.forIn("key", data, (key) => { - cxt.subschema({ - keyword: "values", - dataProp: key, - dataPropType: util_1.Type.Str, - }, _valid); - gen.if((0, codegen_1.not)(_valid), notValid); - }); - } - } - }, -}; -exports.default = def; -//# sourceMappingURL=values.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/jtd/values.js.map b/node_modules/ajv/dist/vocabularies/jtd/values.js.map deleted file mode 100644 index 8a1a5c2..0000000 --- a/node_modules/ajv/dist/vocabularies/jtd/values.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"values.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/values.ts"],"names":[],"mappings":";;AAEA,6CAA0D;AAC1D,mDAAmD;AACnD,yCAAwC;AACxC,yCAA8C;AAC9C,mCAAgD;AAIhD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,QAAQ;IACjB,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAA,iBAAS,EAAC,QAAQ,CAAC;IAC1B,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,IAAA,8BAAmB,EAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QACpD,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;YAClC,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,IAAA,YAAE,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;QACjD,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;YACZ,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,CAAA;YAChC,GAAG,CAAC,MAAM,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,CAAC,CAAA;YACtB,GAAG,CAAC,KAAK,EAAE,CAAA;YACX,GAAG,CAAC,KAAK,EAAE,CAAA;QACb,CAAC;QACD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;QAEb,SAAS,WAAW;YAClB,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAChC,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC;gBACjB,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;gBACvC,cAAc,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAA;gBACjD,OAAO,QAAQ,CAAA;YACjB,CAAC;YACD,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;YACrB,cAAc,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;YACjC,OAAO,MAAM,CAAA;YAEb,SAAS,cAAc,CAAC,QAAoB;gBAC1C,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;oBAC7B,GAAG,CAAC,SAAS,CACX;wBACE,OAAO,EAAE,QAAQ;wBACjB,QAAQ,EAAE,GAAG;wBACb,YAAY,EAAE,WAAI,CAAC,GAAG;qBACvB,EACD,MAAM,CACP,CAAA;oBACD,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAA;gBAC/B,CAAC,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/metadata.d.ts b/node_modules/ajv/dist/vocabularies/metadata.d.ts deleted file mode 100644 index df9cc07..0000000 --- a/node_modules/ajv/dist/vocabularies/metadata.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Vocabulary } from "../types"; -export declare const metadataVocabulary: Vocabulary; -export declare const contentVocabulary: Vocabulary; diff --git a/node_modules/ajv/dist/vocabularies/metadata.js b/node_modules/ajv/dist/vocabularies/metadata.js deleted file mode 100644 index f07bf28..0000000 --- a/node_modules/ajv/dist/vocabularies/metadata.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.contentVocabulary = exports.metadataVocabulary = void 0; -exports.metadataVocabulary = [ - "title", - "description", - "default", - "deprecated", - "readOnly", - "writeOnly", - "examples", -]; -exports.contentVocabulary = [ - "contentMediaType", - "contentEncoding", - "contentSchema", -]; -//# sourceMappingURL=metadata.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/metadata.js.map b/node_modules/ajv/dist/vocabularies/metadata.js.map deleted file mode 100644 index 0d61f08..0000000 --- a/node_modules/ajv/dist/vocabularies/metadata.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../lib/vocabularies/metadata.ts"],"names":[],"mappings":";;;AAEa,QAAA,kBAAkB,GAAe;IAC5C,OAAO;IACP,aAAa;IACb,SAAS;IACT,YAAY;IACZ,UAAU;IACV,WAAW;IACX,UAAU;CACX,CAAA;AAEY,QAAA,iBAAiB,GAAe;IAC3C,kBAAkB;IAClB,iBAAiB;IACjB,eAAe;CAChB,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/next.d.ts b/node_modules/ajv/dist/vocabularies/next.d.ts deleted file mode 100644 index 7fd5c64..0000000 --- a/node_modules/ajv/dist/vocabularies/next.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Vocabulary } from "../types"; -declare const next: Vocabulary; -export default next; diff --git a/node_modules/ajv/dist/vocabularies/next.js b/node_modules/ajv/dist/vocabularies/next.js deleted file mode 100644 index c861b32..0000000 --- a/node_modules/ajv/dist/vocabularies/next.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const dependentRequired_1 = require("./validation/dependentRequired"); -const dependentSchemas_1 = require("./applicator/dependentSchemas"); -const limitContains_1 = require("./validation/limitContains"); -const next = [dependentRequired_1.default, dependentSchemas_1.default, limitContains_1.default]; -exports.default = next; -//# sourceMappingURL=next.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/next.js.map b/node_modules/ajv/dist/vocabularies/next.js.map deleted file mode 100644 index 474a6d4..0000000 --- a/node_modules/ajv/dist/vocabularies/next.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"next.js","sourceRoot":"","sources":["../../lib/vocabularies/next.ts"],"names":[],"mappings":";;AACA,sEAA8D;AAC9D,oEAA4D;AAC5D,8DAAsD;AAEtD,MAAM,IAAI,GAAe,CAAC,2BAAiB,EAAE,0BAAgB,EAAE,uBAAa,CAAC,CAAA;AAE7E,kBAAe,IAAI,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts b/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts deleted file mode 100644 index ec67e63..0000000 --- a/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Vocabulary } from "../../types"; -declare const unevaluated: Vocabulary; -export default unevaluated; diff --git a/node_modules/ajv/dist/vocabularies/unevaluated/index.js b/node_modules/ajv/dist/vocabularies/unevaluated/index.js deleted file mode 100644 index 30e3167..0000000 --- a/node_modules/ajv/dist/vocabularies/unevaluated/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const unevaluatedProperties_1 = require("./unevaluatedProperties"); -const unevaluatedItems_1 = require("./unevaluatedItems"); -const unevaluated = [unevaluatedProperties_1.default, unevaluatedItems_1.default]; -exports.default = unevaluated; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map b/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map deleted file mode 100644 index a4872ea..0000000 --- a/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/unevaluated/index.ts"],"names":[],"mappings":";;AACA,mEAA2D;AAC3D,yDAAiD;AAEjD,MAAM,WAAW,GAAe,CAAC,+BAAqB,EAAE,0BAAgB,CAAC,CAAA;AAEzE,kBAAe,WAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts b/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts deleted file mode 100644 index 06f0239..0000000 --- a/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; -export type UnevaluatedItemsError = ErrorObject<"unevaluatedItems", { - limit: number; -}, AnySchema>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js b/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js deleted file mode 100644 index 0a0cd3a..0000000 --- a/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const util_1 = require("../../compile/util"); -const error = { - message: ({ params: { len } }) => (0, codegen_1.str) `must NOT have more than ${len} items`, - params: ({ params: { len } }) => (0, codegen_1._) `{limit: ${len}}`, -}; -const def = { - keyword: "unevaluatedItems", - type: "array", - schemaType: ["boolean", "object"], - error, - code(cxt) { - const { gen, schema, data, it } = cxt; - const items = it.items || 0; - if (items === true) - return; - const len = gen.const("len", (0, codegen_1._) `${data}.length`); - if (schema === false) { - cxt.setParams({ len: items }); - cxt.fail((0, codegen_1._) `${len} > ${items}`); - } - else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) { - const valid = gen.var("valid", (0, codegen_1._) `${len} <= ${items}`); - gen.if((0, codegen_1.not)(valid), () => validateItems(valid, items)); - cxt.ok(valid); - } - it.items = true; - function validateItems(valid, from) { - gen.forRange("i", from, len, (i) => { - cxt.subschema({ keyword: "unevaluatedItems", dataProp: i, dataPropType: util_1.Type.Num }, valid); - if (!it.allErrors) - gen.if((0, codegen_1.not)(valid), () => gen.break()); - }); - } - }, -}; -exports.default = def; -//# sourceMappingURL=unevaluatedItems.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map b/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map deleted file mode 100644 index b91f86e..0000000 --- a/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"unevaluatedItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/unevaluated/unevaluatedItems.ts"],"names":[],"mappings":";;AAOA,mDAAuD;AACvD,6CAA0D;AAI1D,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,2BAA2B,GAAG,QAAQ;IACvE,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,GAAG,GAAG;CAChD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;IACjC,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC,CAAA;QAC3B,IAAI,KAAK,KAAK,IAAI;YAAE,OAAM;QAC1B,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,SAAS,CAAC,CAAA;QAC/C,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;YACrB,GAAG,CAAC,SAAS,CAAC,EAAC,GAAG,EAAE,KAAK,EAAC,CAAC,CAAA;YAC3B,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,MAAM,KAAK,EAAE,CAAC,CAAA;QAChC,CAAC;aAAM,IAAI,OAAO,MAAM,IAAI,QAAQ,IAAI,CAAC,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;YACvE,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,GAAG,OAAO,KAAK,EAAE,CAAC,CAAA;YACrD,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAA;YACrD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;QACf,CAAC;QACD,EAAE,CAAC,KAAK,GAAG,IAAI,CAAA;QAEf,SAAS,aAAa,CAAC,KAAW,EAAE,IAAmB;YACrD,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE;gBACjC,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,CAAC,EAAE,YAAY,EAAE,WAAI,CAAC,GAAG,EAAC,EAAE,KAAK,CAAC,CAAA;gBACxF,IAAI,CAAC,EAAE,CAAC,SAAS;oBAAE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;YAC1D,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts b/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts deleted file mode 100644 index ba63f62..0000000 --- a/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; -export type UnevaluatedPropertiesError = ErrorObject<"unevaluatedProperties", { - unevaluatedProperty: string; -}, AnySchema>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js b/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js deleted file mode 100644 index ad29849..0000000 --- a/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const util_1 = require("../../compile/util"); -const names_1 = require("../../compile/names"); -const error = { - message: "must NOT have unevaluated properties", - params: ({ params }) => (0, codegen_1._) `{unevaluatedProperty: ${params.unevaluatedProperty}}`, -}; -const def = { - keyword: "unevaluatedProperties", - type: "object", - schemaType: ["boolean", "object"], - trackErrors: true, - error, - code(cxt) { - const { gen, schema, data, errsCount, it } = cxt; - /* istanbul ignore if */ - if (!errsCount) - throw new Error("ajv implementation error"); - const { allErrors, props } = it; - if (props instanceof codegen_1.Name) { - gen.if((0, codegen_1._) `${props} !== true`, () => gen.forIn("key", data, (key) => gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key)))); - } - else if (props !== true) { - gen.forIn("key", data, (key) => props === undefined - ? unevaluatedPropCode(key) - : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key))); - } - it.props = true; - cxt.ok((0, codegen_1._) `${errsCount} === ${names_1.default.errors}`); - function unevaluatedPropCode(key) { - if (schema === false) { - cxt.setParams({ unevaluatedProperty: key }); - cxt.error(); - if (!allErrors) - gen.break(); - return; - } - if (!(0, util_1.alwaysValidSchema)(it, schema)) { - const valid = gen.name("valid"); - cxt.subschema({ - keyword: "unevaluatedProperties", - dataProp: key, - dataPropType: util_1.Type.Str, - }, valid); - if (!allErrors) - gen.if((0, codegen_1.not)(valid), () => gen.break()); - } - } - function unevaluatedDynamic(evaluatedProps, key) { - return (0, codegen_1._) `!${evaluatedProps} || !${evaluatedProps}[${key}]`; - } - function unevaluatedStatic(evaluatedProps, key) { - const ps = []; - for (const p in evaluatedProps) { - if (evaluatedProps[p] === true) - ps.push((0, codegen_1._) `${key} !== ${p}`); - } - return (0, codegen_1.and)(...ps); - } - }, -}; -exports.default = def; -//# sourceMappingURL=unevaluatedProperties.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map b/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map deleted file mode 100644 index f83022e..0000000 --- a/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"unevaluatedProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/unevaluated/unevaluatedProperties.ts"],"names":[],"mappings":";;AAMA,mDAA6D;AAC7D,6CAA0D;AAC1D,+CAAmC;AAQnC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,sCAAsC;IAC/C,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,yBAAyB,MAAM,CAAC,mBAAmB,GAAG;CAC9E,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,uBAAuB;IAChC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;IACjC,WAAW,EAAE,IAAI;IACjB,KAAK;IACL,IAAI,CAAC,GAAG;QACN,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC9C,wBAAwB;QACxB,IAAI,CAAC,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC3D,MAAM,EAAC,SAAS,EAAE,KAAK,EAAC,GAAG,EAAE,CAAA;QAC7B,IAAI,KAAK,YAAY,cAAI,EAAE,CAAC;YAC1B,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,WAAW,EAAE,GAAG,EAAE,CAChC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,GAAS,EAAE,EAAE,CACnC,GAAG,CAAC,EAAE,CAAC,kBAAkB,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CACvE,CACF,CAAA;QACH,CAAC;aAAM,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAC1B,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,GAAS,EAAE,EAAE,CACnC,KAAK,KAAK,SAAS;gBACjB,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC;gBAC1B,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAC1E,CAAA;QACH,CAAC;QACD,EAAE,CAAC,KAAK,GAAG,IAAI,CAAA;QACf,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,SAAS,QAAQ,eAAC,CAAC,MAAM,EAAE,CAAC,CAAA;QAEvC,SAAS,mBAAmB,CAAC,GAAS;YACpC,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;gBACrB,GAAG,CAAC,SAAS,CAAC,EAAC,mBAAmB,EAAE,GAAG,EAAC,CAAC,CAAA;gBACzC,GAAG,CAAC,KAAK,EAAE,CAAA;gBACX,IAAI,CAAC,SAAS;oBAAE,GAAG,CAAC,KAAK,EAAE,CAAA;gBAC3B,OAAM;YACR,CAAC;YAED,IAAI,CAAC,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;gBACnC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;gBAC/B,GAAG,CAAC,SAAS,CACX;oBACE,OAAO,EAAE,uBAAuB;oBAChC,QAAQ,EAAE,GAAG;oBACb,YAAY,EAAE,WAAI,CAAC,GAAG;iBACvB,EACD,KAAK,CACN,CAAA;gBACD,IAAI,CAAC,SAAS;oBAAE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;YACvD,CAAC;QACH,CAAC;QAED,SAAS,kBAAkB,CAAC,cAAoB,EAAE,GAAS;YACzD,OAAO,IAAA,WAAC,EAAA,IAAI,cAAc,QAAQ,cAAc,IAAI,GAAG,GAAG,CAAA;QAC5D,CAAC;QAED,SAAS,iBAAiB,CAAC,cAAsC,EAAE,GAAS;YAC1E,MAAM,EAAE,GAAW,EAAE,CAAA;YACrB,KAAK,MAAM,CAAC,IAAI,cAAc,EAAE,CAAC;gBAC/B,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI;oBAAE,EAAE,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;YAC7D,CAAC;YACD,OAAO,IAAA,aAAG,EAAC,GAAG,EAAE,CAAC,CAAA;QACnB,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/const.d.ts b/node_modules/ajv/dist/vocabularies/validation/const.d.ts deleted file mode 100644 index af91a90..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/const.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject } from "../../types"; -export type ConstError = ErrorObject<"const", { - allowedValue: any; -}>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/validation/const.js b/node_modules/ajv/dist/vocabularies/validation/const.js deleted file mode 100644 index 9564496..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/const.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const util_1 = require("../../compile/util"); -const equal_1 = require("../../runtime/equal"); -const error = { - message: "must be equal to constant", - params: ({ schemaCode }) => (0, codegen_1._) `{allowedValue: ${schemaCode}}`, -}; -const def = { - keyword: "const", - $data: true, - error, - code(cxt) { - const { gen, data, $data, schemaCode, schema } = cxt; - if ($data || (schema && typeof schema == "object")) { - cxt.fail$data((0, codegen_1._) `!${(0, util_1.useFunc)(gen, equal_1.default)}(${data}, ${schemaCode})`); - } - else { - cxt.fail((0, codegen_1._) `${schema} !== ${data}`); - } - }, -}; -exports.default = def; -//# sourceMappingURL=const.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/const.js.map b/node_modules/ajv/dist/vocabularies/validation/const.js.map deleted file mode 100644 index 63cfe60..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/const.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/const.ts"],"names":[],"mappings":";;AAEA,mDAAuC;AACvC,6CAA0C;AAC1C,+CAAuC;AAIvC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,2BAA2B;IACpC,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,kBAAkB,UAAU,GAAG;CAC3D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;QAClD,IAAI,KAAK,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,IAAI,QAAQ,CAAC,EAAE,CAAC;YACnD,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,IAAI,IAAA,cAAO,EAAC,GAAG,EAAE,eAAK,CAAC,IAAI,IAAI,KAAK,UAAU,GAAG,CAAC,CAAA;QACnE,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,MAAM,QAAQ,IAAI,EAAE,CAAC,CAAA;QACpC,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts b/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts deleted file mode 100644 index 00f0d37..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject } from "../../types"; -import { DependenciesErrorParams, PropertyDependencies } from "../applicator/dependencies"; -export type DependentRequiredError = ErrorObject<"dependentRequired", DependenciesErrorParams, PropertyDependencies>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js b/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js deleted file mode 100644 index 09e5963..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const dependencies_1 = require("../applicator/dependencies"); -const def = { - keyword: "dependentRequired", - type: "object", - schemaType: "object", - error: dependencies_1.error, - code: (cxt) => (0, dependencies_1.validatePropertyDeps)(cxt), -}; -exports.default = def; -//# sourceMappingURL=dependentRequired.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map b/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map deleted file mode 100644 index c7e88f8..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dependentRequired.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/dependentRequired.ts"],"names":[],"mappings":";;AACA,6DAKmC;AAQnC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,mBAAmB;IAC5B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAL,oBAAK;IACL,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,mCAAoB,EAAC,GAAG,CAAC;CACzC,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/enum.d.ts b/node_modules/ajv/dist/vocabularies/validation/enum.d.ts deleted file mode 100644 index 6231082..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/enum.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject } from "../../types"; -export type EnumError = ErrorObject<"enum", { - allowedValues: any[]; -}, any[] | { - $data: string; -}>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/validation/enum.js b/node_modules/ajv/dist/vocabularies/validation/enum.js deleted file mode 100644 index eab6487..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/enum.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const util_1 = require("../../compile/util"); -const equal_1 = require("../../runtime/equal"); -const error = { - message: "must be equal to one of the allowed values", - params: ({ schemaCode }) => (0, codegen_1._) `{allowedValues: ${schemaCode}}`, -}; -const def = { - keyword: "enum", - schemaType: "array", - $data: true, - error, - code(cxt) { - const { gen, data, $data, schema, schemaCode, it } = cxt; - if (!$data && schema.length === 0) - throw new Error("enum must have non-empty array"); - const useLoop = schema.length >= it.opts.loopEnum; - let eql; - const getEql = () => (eql !== null && eql !== void 0 ? eql : (eql = (0, util_1.useFunc)(gen, equal_1.default))); - let valid; - if (useLoop || $data) { - valid = gen.let("valid"); - cxt.block$data(valid, loopEnum); - } - else { - /* istanbul ignore if */ - if (!Array.isArray(schema)) - throw new Error("ajv implementation error"); - const vSchema = gen.const("vSchema", schemaCode); - valid = (0, codegen_1.or)(...schema.map((_x, i) => equalCode(vSchema, i))); - } - cxt.pass(valid); - function loopEnum() { - gen.assign(valid, false); - gen.forOf("v", schemaCode, (v) => gen.if((0, codegen_1._) `${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break())); - } - function equalCode(vSchema, i) { - const sch = schema[i]; - return typeof sch === "object" && sch !== null - ? (0, codegen_1._) `${getEql()}(${data}, ${vSchema}[${i}])` - : (0, codegen_1._) `${data} === ${sch}`; - } - }, -}; -exports.default = def; -//# sourceMappingURL=enum.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/enum.js.map b/node_modules/ajv/dist/vocabularies/validation/enum.js.map deleted file mode 100644 index 33afdcf..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/enum.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/enum.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AACvD,6CAA0C;AAC1C,+CAAuC;AAIvC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,4CAA4C;IACrD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,mBAAmB,UAAU,GAAG;CAC5D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,OAAO;IACnB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACtD,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QACpF,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAA;QACjD,IAAI,GAAqB,CAAA;QACzB,MAAM,MAAM,GAAG,GAAS,EAAE,CAAC,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,IAAH,GAAG,GAAK,IAAA,cAAO,EAAC,GAAG,EAAE,eAAK,CAAC,EAAC,CAAA;QAExD,IAAI,KAAW,CAAA;QACf,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;YACrB,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YACxB,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;QACjC,CAAC;aAAM,CAAC;YACN,wBAAwB;YACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;YACvE,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;YAChD,KAAK,GAAG,IAAA,YAAE,EAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAW,EAAE,CAAS,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;QAC9E,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAEf,SAAS,QAAQ;YACf,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;YACxB,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,UAAkB,EAAE,CAAC,CAAC,EAAE,EAAE,CACvC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,MAAM,EAAE,IAAI,IAAI,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAC7E,CAAA;QACH,CAAC;QAED,SAAS,SAAS,CAAC,OAAa,EAAE,CAAS;YACzC,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;YACrB,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;gBAC5C,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,MAAM,EAAE,IAAI,IAAI,KAAK,OAAO,IAAI,CAAC,IAAI;gBAC3C,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,QAAQ,GAAG,EAAE,CAAA;QAC3B,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/index.d.ts b/node_modules/ajv/dist/vocabularies/validation/index.d.ts deleted file mode 100644 index a078be5..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { ErrorObject, Vocabulary } from "../../types"; -import { LimitNumberError } from "./limitNumber"; -import { MultipleOfError } from "./multipleOf"; -import { PatternError } from "./pattern"; -import { RequiredError } from "./required"; -import { UniqueItemsError } from "./uniqueItems"; -import { ConstError } from "./const"; -import { EnumError } from "./enum"; -declare const validation: Vocabulary; -export default validation; -type LimitError = ErrorObject<"maxItems" | "minItems" | "minProperties" | "maxProperties" | "minLength" | "maxLength", { - limit: number; -}, number | { - $data: string; -}>; -export type ValidationKeywordError = LimitError | LimitNumberError | MultipleOfError | PatternError | RequiredError | UniqueItemsError | ConstError | EnumError; diff --git a/node_modules/ajv/dist/vocabularies/validation/index.js b/node_modules/ajv/dist/vocabularies/validation/index.js deleted file mode 100644 index 7b56b4e..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/index.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const limitNumber_1 = require("./limitNumber"); -const multipleOf_1 = require("./multipleOf"); -const limitLength_1 = require("./limitLength"); -const pattern_1 = require("./pattern"); -const limitProperties_1 = require("./limitProperties"); -const required_1 = require("./required"); -const limitItems_1 = require("./limitItems"); -const uniqueItems_1 = require("./uniqueItems"); -const const_1 = require("./const"); -const enum_1 = require("./enum"); -const validation = [ - // number - limitNumber_1.default, - multipleOf_1.default, - // string - limitLength_1.default, - pattern_1.default, - // object - limitProperties_1.default, - required_1.default, - // array - limitItems_1.default, - uniqueItems_1.default, - // any - { keyword: "type", schemaType: ["string", "array"] }, - { keyword: "nullable", schemaType: "boolean" }, - const_1.default, - enum_1.default, -]; -exports.default = validation; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/index.js.map b/node_modules/ajv/dist/vocabularies/validation/index.js.map deleted file mode 100644 index 69436fb..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/index.ts"],"names":[],"mappings":";;AACA,+CAA2D;AAC3D,6CAAwD;AACxD,+CAAuC;AACvC,uCAA+C;AAC/C,uDAA+C;AAC/C,yCAAkD;AAClD,6CAAqC;AACrC,+CAA2D;AAC3D,mCAAgD;AAChD,iCAA6C;AAE7C,MAAM,UAAU,GAAe;IAC7B,SAAS;IACT,qBAAW;IACX,oBAAU;IACV,SAAS;IACT,qBAAW;IACX,iBAAO;IACP,SAAS;IACT,yBAAe;IACf,kBAAQ;IACR,QAAQ;IACR,oBAAU;IACV,qBAAW;IACX,MAAM;IACN,EAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAC;IAClD,EAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAC;IAC5C,eAAY;IACZ,cAAW;CACZ,CAAA;AAED,kBAAe,UAAU,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts b/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts deleted file mode 100644 index cde2aa2..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/validation/limitContains.js b/node_modules/ajv/dist/vocabularies/validation/limitContains.js deleted file mode 100644 index c884dae..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/limitContains.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const util_1 = require("../../compile/util"); -const def = { - keyword: ["maxContains", "minContains"], - type: "array", - schemaType: "number", - code({ keyword, parentSchema, it }) { - if (parentSchema.contains === undefined) { - (0, util_1.checkStrictMode)(it, `"${keyword}" without "contains" is ignored`); - } - }, -}; -exports.default = def; -//# sourceMappingURL=limitContains.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map b/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map deleted file mode 100644 index 084ee2c..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"limitContains.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitContains.ts"],"names":[],"mappings":";;AAEA,6CAAkD;AAElD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,aAAa,EAAE,aAAa,CAAC;IACvC,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,EAAC,OAAO,EAAE,YAAY,EAAE,EAAE,EAAa;QAC1C,IAAI,YAAY,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACxC,IAAA,sBAAe,EAAC,EAAE,EAAE,IAAI,OAAO,iCAAiC,CAAC,CAAA;QACnE,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts b/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts deleted file mode 100644 index cde2aa2..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/validation/limitItems.js b/node_modules/ajv/dist/vocabularies/validation/limitItems.js deleted file mode 100644 index e1386f8..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/limitItems.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const error = { - message({ keyword, schemaCode }) { - const comp = keyword === "maxItems" ? "more" : "fewer"; - return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} items`; - }, - params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`, -}; -const def = { - keyword: ["maxItems", "minItems"], - type: "array", - schemaType: "number", - $data: true, - error, - code(cxt) { - const { keyword, data, schemaCode } = cxt; - const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT; - cxt.fail$data((0, codegen_1._) `${data}.length ${op} ${schemaCode}`); - }, -}; -exports.default = def; -//# sourceMappingURL=limitItems.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map b/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map deleted file mode 100644 index 690c734..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"limitItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitItems.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AAEvD,MAAM,KAAK,GAA2B;IACpC,OAAO,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;QACtD,OAAO,IAAA,aAAG,EAAA,iBAAiB,IAAI,SAAS,UAAU,QAAQ,CAAA;IAC5D,CAAC;IACD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,UAAU,GAAG;CACpD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC;IACjC,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAC,GAAG,GAAG,CAAA;QACvC,MAAM,EAAE,GAAG,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAA;QAC/D,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,EAAE,IAAI,UAAU,EAAE,CAAC,CAAA;IACtD,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts b/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts deleted file mode 100644 index cde2aa2..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/validation/limitLength.js b/node_modules/ajv/dist/vocabularies/validation/limitLength.js deleted file mode 100644 index 6ae5f92..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/limitLength.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const util_1 = require("../../compile/util"); -const ucs2length_1 = require("../../runtime/ucs2length"); -const error = { - message({ keyword, schemaCode }) { - const comp = keyword === "maxLength" ? "more" : "fewer"; - return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} characters`; - }, - params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`, -}; -const def = { - keyword: ["maxLength", "minLength"], - type: "string", - schemaType: "number", - $data: true, - error, - code(cxt) { - const { keyword, data, schemaCode, it } = cxt; - const op = keyword === "maxLength" ? codegen_1.operators.GT : codegen_1.operators.LT; - const len = it.opts.unicode === false ? (0, codegen_1._) `${data}.length` : (0, codegen_1._) `${(0, util_1.useFunc)(cxt.gen, ucs2length_1.default)}(${data})`; - cxt.fail$data((0, codegen_1._) `${len} ${op} ${schemaCode}`); - }, -}; -exports.default = def; -//# sourceMappingURL=limitLength.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map b/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map deleted file mode 100644 index f09c35e..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"limitLength.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitLength.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AACvD,6CAA0C;AAC1C,yDAAiD;AAEjD,MAAM,KAAK,GAA2B;IACpC,OAAO,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;QACvD,OAAO,IAAA,aAAG,EAAA,iBAAiB,IAAI,SAAS,UAAU,aAAa,CAAA;IACjE,CAAC;IACD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,UAAU,GAAG;CACpD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC;IACnC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC3C,MAAM,EAAE,GAAG,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAA;QAChE,MAAM,GAAG,GACP,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,IAAA,cAAO,EAAC,GAAG,CAAC,GAAG,EAAE,oBAAU,CAAC,IAAI,IAAI,GAAG,CAAA;QAC7F,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,IAAI,EAAE,IAAI,UAAU,EAAE,CAAC,CAAA;IAC9C,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts b/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts deleted file mode 100644 index 7b35096..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject } from "../../types"; -type Kwd = "maximum" | "minimum" | "exclusiveMaximum" | "exclusiveMinimum"; -type Comparison = "<=" | ">=" | "<" | ">"; -export type LimitNumberError = ErrorObject; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/validation/limitNumber.js b/node_modules/ajv/dist/vocabularies/validation/limitNumber.js deleted file mode 100644 index a97c0eb..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const ops = codegen_1.operators; -const KWDs = { - maximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT }, - minimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT }, - exclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE }, - exclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }, -}; -const error = { - message: ({ keyword, schemaCode }) => (0, codegen_1.str) `must be ${KWDs[keyword].okStr} ${schemaCode}`, - params: ({ keyword, schemaCode }) => (0, codegen_1._) `{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`, -}; -const def = { - keyword: Object.keys(KWDs), - type: "number", - schemaType: "number", - $data: true, - error, - code(cxt) { - const { keyword, data, schemaCode } = cxt; - cxt.fail$data((0, codegen_1._) `${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`); - }, -}; -exports.default = def; -//# sourceMappingURL=limitNumber.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map b/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map deleted file mode 100644 index 18a3653..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"limitNumber.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitNumber.ts"],"names":[],"mappings":";;AAEA,mDAA6D;AAE7D,MAAM,GAAG,GAAG,mBAAS,CAAA;AAMrB,MAAM,IAAI,GAA4D;IACpE,OAAO,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,EAAC;IACjD,OAAO,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,EAAC;IACjD,gBAAgB,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,EAAC;IACzD,gBAAgB,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,EAAC;CAC1D,CAAA;AAQD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,WAAW,IAAI,CAAC,OAAc,CAAC,CAAC,KAAK,IAAI,UAAU,EAAE;IAC5F,MAAM,EAAE,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC,EAAE,EAAE,CAChC,IAAA,WAAC,EAAA,gBAAgB,IAAI,CAAC,OAAc,CAAC,CAAC,KAAK,YAAY,UAAU,GAAG;CACvE,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;IAC1B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAC,GAAG,GAAG,CAAA;QACvC,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,IAAI,IAAI,CAAC,OAAc,CAAC,CAAC,IAAI,IAAI,UAAU,aAAa,IAAI,GAAG,CAAC,CAAA;IACxF,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts b/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts deleted file mode 100644 index cde2aa2..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { CodeKeywordDefinition } from "../../types"; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/validation/limitProperties.js b/node_modules/ajv/dist/vocabularies/validation/limitProperties.js deleted file mode 100644 index e6fc40c..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const error = { - message({ keyword, schemaCode }) { - const comp = keyword === "maxProperties" ? "more" : "fewer"; - return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} properties`; - }, - params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`, -}; -const def = { - keyword: ["maxProperties", "minProperties"], - type: "object", - schemaType: "number", - $data: true, - error, - code(cxt) { - const { keyword, data, schemaCode } = cxt; - const op = keyword === "maxProperties" ? codegen_1.operators.GT : codegen_1.operators.LT; - cxt.fail$data((0, codegen_1._) `Object.keys(${data}).length ${op} ${schemaCode}`); - }, -}; -exports.default = def; -//# sourceMappingURL=limitProperties.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map b/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map deleted file mode 100644 index a695943..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"limitProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitProperties.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AAEvD,MAAM,KAAK,GAA2B;IACpC,OAAO,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;QAC3D,OAAO,IAAA,aAAG,EAAA,iBAAiB,IAAI,SAAS,UAAU,aAAa,CAAA;IACjE,CAAC;IACD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,UAAU,GAAG;CACpD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;IAC3C,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAC,GAAG,GAAG,CAAA;QACvC,MAAM,EAAE,GAAG,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAA;QACpE,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,eAAe,IAAI,YAAY,EAAE,IAAI,UAAU,EAAE,CAAC,CAAA;IACnE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts b/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts deleted file mode 100644 index 67685dc..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject } from "../../types"; -export type MultipleOfError = ErrorObject<"multipleOf", { - multipleOf: number; -}, number | { - $data: string; -}>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/validation/multipleOf.js b/node_modules/ajv/dist/vocabularies/validation/multipleOf.js deleted file mode 100644 index 43cf67b..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const codegen_1 = require("../../compile/codegen"); -const error = { - message: ({ schemaCode }) => (0, codegen_1.str) `must be multiple of ${schemaCode}`, - params: ({ schemaCode }) => (0, codegen_1._) `{multipleOf: ${schemaCode}}`, -}; -const def = { - keyword: "multipleOf", - type: "number", - schemaType: "number", - $data: true, - error, - code(cxt) { - const { gen, data, schemaCode, it } = cxt; - // const bdt = bad$DataType(schemaCode, def.schemaType, $data) - const prec = it.opts.multipleOfPrecision; - const res = gen.let("res"); - const invalid = prec - ? (0, codegen_1._) `Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` - : (0, codegen_1._) `${res} !== parseInt(${res})`; - cxt.fail$data((0, codegen_1._) `(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid}))`); - }, -}; -exports.default = def; -//# sourceMappingURL=multipleOf.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map b/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map deleted file mode 100644 index 9ef825b..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"multipleOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/multipleOf.ts"],"names":[],"mappings":";;AAEA,mDAA4C;AAQ5C,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,uBAAuB,UAAU,EAAE;IACjE,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,gBAAgB,UAAU,GAAG;CACzD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,YAAY;IACrB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACvC,sEAAsE;QACtE,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAA;QACxC,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAC1B,MAAM,OAAO,GAAG,IAAI;YAClB,CAAC,CAAC,IAAA,WAAC,EAAA,uBAAuB,GAAG,OAAO,GAAG,UAAU,IAAI,EAAE;YACvD,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,iBAAiB,GAAG,GAAG,CAAA;QAClC,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,IAAI,UAAU,cAAc,GAAG,MAAM,IAAI,IAAI,UAAU,KAAK,OAAO,IAAI,CAAC,CAAA;IACzF,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts b/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts deleted file mode 100644 index 7edbfda..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject } from "../../types"; -export type PatternError = ErrorObject<"pattern", { - pattern: string; -}, string | { - $data: string; -}>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/validation/pattern.js b/node_modules/ajv/dist/vocabularies/validation/pattern.js deleted file mode 100644 index f8ccdf2..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/pattern.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const code_1 = require("../code"); -const codegen_1 = require("../../compile/codegen"); -const error = { - message: ({ schemaCode }) => (0, codegen_1.str) `must match pattern "${schemaCode}"`, - params: ({ schemaCode }) => (0, codegen_1._) `{pattern: ${schemaCode}}`, -}; -const def = { - keyword: "pattern", - type: "string", - schemaType: "string", - $data: true, - error, - code(cxt) { - const { data, $data, schema, schemaCode, it } = cxt; - // TODO regexp should be wrapped in try/catchs - const u = it.opts.unicodeRegExp ? "u" : ""; - const regExp = $data ? (0, codegen_1._) `(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema); - cxt.fail$data((0, codegen_1._) `!${regExp}.test(${data})`); - }, -}; -exports.default = def; -//# sourceMappingURL=pattern.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/pattern.js.map b/node_modules/ajv/dist/vocabularies/validation/pattern.js.map deleted file mode 100644 index 82fa5d7..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pattern.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/pattern.ts"],"names":[],"mappings":";;AAEA,kCAAkC;AAClC,mDAA4C;AAI5C,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,uBAAuB,UAAU,GAAG;IAClE,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,aAAa,UAAU,GAAG;CACtD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACjD,8CAA8C;QAC9C,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;QAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,eAAe,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,iBAAU,EAAC,GAAG,EAAE,MAAM,CAAC,CAAA;QACrF,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,IAAI,MAAM,SAAS,IAAI,GAAG,CAAC,CAAA;IAC5C,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/required.d.ts b/node_modules/ajv/dist/vocabularies/validation/required.d.ts deleted file mode 100644 index c9cffda..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/required.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject } from "../../types"; -export type RequiredError = ErrorObject<"required", { - missingProperty: string; -}, string[] | { - $data: string; -}>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/validation/required.js b/node_modules/ajv/dist/vocabularies/validation/required.js deleted file mode 100644 index 1d8e292..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/required.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const code_1 = require("../code"); -const codegen_1 = require("../../compile/codegen"); -const util_1 = require("../../compile/util"); -const error = { - message: ({ params: { missingProperty } }) => (0, codegen_1.str) `must have required property '${missingProperty}'`, - params: ({ params: { missingProperty } }) => (0, codegen_1._) `{missingProperty: ${missingProperty}}`, -}; -const def = { - keyword: "required", - type: "object", - schemaType: "array", - $data: true, - error, - code(cxt) { - const { gen, schema, schemaCode, data, $data, it } = cxt; - const { opts } = it; - if (!$data && schema.length === 0) - return; - const useLoop = schema.length >= opts.loopRequired; - if (it.allErrors) - allErrorsMode(); - else - exitOnErrorMode(); - if (opts.strictRequired) { - const props = cxt.parentSchema.properties; - const { definedProperties } = cxt.it; - for (const requiredKey of schema) { - if ((props === null || props === void 0 ? void 0 : props[requiredKey]) === undefined && !definedProperties.has(requiredKey)) { - const schemaPath = it.schemaEnv.baseId + it.errSchemaPath; - const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)`; - (0, util_1.checkStrictMode)(it, msg, it.opts.strictRequired); - } - } - } - function allErrorsMode() { - if (useLoop || $data) { - cxt.block$data(codegen_1.nil, loopAllRequired); - } - else { - for (const prop of schema) { - (0, code_1.checkReportMissingProp)(cxt, prop); - } - } - } - function exitOnErrorMode() { - const missing = gen.let("missing"); - if (useLoop || $data) { - const valid = gen.let("valid", true); - cxt.block$data(valid, () => loopUntilMissing(missing, valid)); - cxt.ok(valid); - } - else { - gen.if((0, code_1.checkMissingProp)(cxt, schema, missing)); - (0, code_1.reportMissingProp)(cxt, missing); - gen.else(); - } - } - function loopAllRequired() { - gen.forOf("prop", schemaCode, (prop) => { - cxt.setParams({ missingProperty: prop }); - gen.if((0, code_1.noPropertyInData)(gen, data, prop, opts.ownProperties), () => cxt.error()); - }); - } - function loopUntilMissing(missing, valid) { - cxt.setParams({ missingProperty: missing }); - gen.forOf(missing, schemaCode, () => { - gen.assign(valid, (0, code_1.propertyInData)(gen, data, missing, opts.ownProperties)); - gen.if((0, codegen_1.not)(valid), () => { - cxt.error(); - gen.break(); - }); - }, codegen_1.nil); - } - }, -}; -exports.default = def; -//# sourceMappingURL=required.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/required.js.map b/node_modules/ajv/dist/vocabularies/validation/required.js.map deleted file mode 100644 index 9ec186f..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/required.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"required.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/required.ts"],"names":[],"mappings":";;AAEA,kCAMgB;AAChB,mDAAkE;AAClE,6CAAkD;AAQlD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,eAAe,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,gCAAgC,eAAe,GAAG;IAC/F,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,eAAe,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,qBAAqB,eAAe,GAAG;CAClF,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,OAAO;IACnB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACtD,MAAM,EAAC,IAAI,EAAC,GAAG,EAAE,CAAA;QACjB,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAM;QACzC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,YAAY,CAAA;QAClD,IAAI,EAAE,CAAC,SAAS;YAAE,aAAa,EAAE,CAAA;;YAC5B,eAAe,EAAE,CAAA;QAEtB,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,MAAM,KAAK,GAAG,GAAG,CAAC,YAAY,CAAC,UAAU,CAAA;YACzC,MAAM,EAAC,iBAAiB,EAAC,GAAG,GAAG,CAAC,EAAE,CAAA;YAClC,KAAK,MAAM,WAAW,IAAI,MAAM,EAAE,CAAC;gBACjC,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,WAAW,CAAC,MAAK,SAAS,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;oBAC9E,MAAM,UAAU,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,GAAG,EAAE,CAAC,aAAa,CAAA;oBACzD,MAAM,GAAG,GAAG,sBAAsB,WAAW,wBAAwB,UAAU,oBAAoB,CAAA;oBACnG,IAAA,sBAAe,EAAC,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;gBAClD,CAAC;YACH,CAAC;QACH,CAAC;QAED,SAAS,aAAa;YACpB,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;gBACrB,GAAG,CAAC,UAAU,CAAC,aAAG,EAAE,eAAe,CAAC,CAAA;YACtC,CAAC;iBAAM,CAAC;gBACN,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;oBAC1B,IAAA,6BAAsB,EAAC,GAAG,EAAE,IAAI,CAAC,CAAA;gBACnC,CAAC;YACH,CAAC;QACH,CAAC;QAED,SAAS,eAAe;YACtB,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;YAClC,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;gBACrB,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;gBACpC,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;gBAC7D,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;YACf,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,EAAE,CAAC,IAAA,uBAAgB,EAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;gBAC9C,IAAA,wBAAiB,EAAC,GAAG,EAAE,OAAO,CAAC,CAAA;gBAC/B,GAAG,CAAC,IAAI,EAAE,CAAA;YACZ,CAAC;QACH,CAAC;QAED,SAAS,eAAe;YACtB,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,UAAkB,EAAE,CAAC,IAAI,EAAE,EAAE;gBAC7C,GAAG,CAAC,SAAS,CAAC,EAAC,eAAe,EAAE,IAAI,EAAC,CAAC,CAAA;gBACtC,GAAG,CAAC,EAAE,CAAC,IAAA,uBAAgB,EAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;YAClF,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,SAAS,gBAAgB,CAAC,OAAa,EAAE,KAAW;YAClD,GAAG,CAAC,SAAS,CAAC,EAAC,eAAe,EAAE,OAAO,EAAC,CAAC,CAAA;YACzC,GAAG,CAAC,KAAK,CACP,OAAO,EACP,UAAkB,EAClB,GAAG,EAAE;gBACH,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAA,qBAAc,EAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAA;gBACzE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE;oBACtB,GAAG,CAAC,KAAK,EAAE,CAAA;oBACX,GAAG,CAAC,KAAK,EAAE,CAAA;gBACb,CAAC,CAAC,CAAA;YACJ,CAAC,EACD,aAAG,CACJ,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts b/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts deleted file mode 100644 index e7c241b..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { CodeKeywordDefinition, ErrorObject } from "../../types"; -export type UniqueItemsError = ErrorObject<"uniqueItems", { - i: number; - j: number; -}, boolean | { - $data: string; -}>; -declare const def: CodeKeywordDefinition; -export default def; diff --git a/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js b/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js deleted file mode 100644 index cdbecea..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +++ /dev/null @@ -1,64 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const dataType_1 = require("../../compile/validate/dataType"); -const codegen_1 = require("../../compile/codegen"); -const util_1 = require("../../compile/util"); -const equal_1 = require("../../runtime/equal"); -const error = { - message: ({ params: { i, j } }) => (0, codegen_1.str) `must NOT have duplicate items (items ## ${j} and ${i} are identical)`, - params: ({ params: { i, j } }) => (0, codegen_1._) `{i: ${i}, j: ${j}}`, -}; -const def = { - keyword: "uniqueItems", - type: "array", - schemaType: "boolean", - $data: true, - error, - code(cxt) { - const { gen, data, $data, schema, parentSchema, schemaCode, it } = cxt; - if (!$data && !schema) - return; - const valid = gen.let("valid"); - const itemTypes = parentSchema.items ? (0, dataType_1.getSchemaTypes)(parentSchema.items) : []; - cxt.block$data(valid, validateUniqueItems, (0, codegen_1._) `${schemaCode} === false`); - cxt.ok(valid); - function validateUniqueItems() { - const i = gen.let("i", (0, codegen_1._) `${data}.length`); - const j = gen.let("j"); - cxt.setParams({ i, j }); - gen.assign(valid, true); - gen.if((0, codegen_1._) `${i} > 1`, () => (canOptimize() ? loopN : loopN2)(i, j)); - } - function canOptimize() { - return itemTypes.length > 0 && !itemTypes.some((t) => t === "object" || t === "array"); - } - function loopN(i, j) { - const item = gen.name("item"); - const wrongType = (0, dataType_1.checkDataTypes)(itemTypes, item, it.opts.strictNumbers, dataType_1.DataType.Wrong); - const indices = gen.const("indices", (0, codegen_1._) `{}`); - gen.for((0, codegen_1._) `;${i}--;`, () => { - gen.let(item, (0, codegen_1._) `${data}[${i}]`); - gen.if(wrongType, (0, codegen_1._) `continue`); - if (itemTypes.length > 1) - gen.if((0, codegen_1._) `typeof ${item} == "string"`, (0, codegen_1._) `${item} += "_"`); - gen - .if((0, codegen_1._) `typeof ${indices}[${item}] == "number"`, () => { - gen.assign(j, (0, codegen_1._) `${indices}[${item}]`); - cxt.error(); - gen.assign(valid, false).break(); - }) - .code((0, codegen_1._) `${indices}[${item}] = ${i}`); - }); - } - function loopN2(i, j) { - const eql = (0, util_1.useFunc)(gen, equal_1.default); - const outer = gen.name("outer"); - gen.label(outer).for((0, codegen_1._) `;${i}--;`, () => gen.for((0, codegen_1._) `${j} = ${i}; ${j}--;`, () => gen.if((0, codegen_1._) `${eql}(${data}[${i}], ${data}[${j}])`, () => { - cxt.error(); - gen.assign(valid, false).break(outer); - }))); - } - }, -}; -exports.default = def; -//# sourceMappingURL=uniqueItems.js.map \ No newline at end of file diff --git a/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map b/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map deleted file mode 100644 index 46eb7a2..0000000 --- a/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"uniqueItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/uniqueItems.ts"],"names":[],"mappings":";;AAEA,8DAAwF;AACxF,mDAAkD;AAClD,6CAA0C;AAC1C,+CAAuC;AAQvC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,CAAC,EAAE,CAAC,EAAC,EAAC,EAAE,EAAE,CAC5B,IAAA,aAAG,EAAA,2CAA2C,CAAC,QAAQ,CAAC,iBAAiB;IAC3E,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,CAAC,EAAE,CAAC,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,OAAO,CAAC,QAAQ,CAAC,GAAG;CACpD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACpE,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM;YAAE,OAAM;QAC7B,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QAC9B,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,IAAA,yBAAc,EAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;QAC9E,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,mBAAmB,EAAE,IAAA,WAAC,EAAA,GAAG,UAAU,YAAY,CAAC,CAAA;QACtE,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;QAEb,SAAS,mBAAmB;YAC1B,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,SAAS,CAAC,CAAA;YACzC,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACtB,GAAG,CAAC,SAAS,CAAC,EAAC,CAAC,EAAE,CAAC,EAAC,CAAC,CAAA;YACrB,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;YACvB,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QACnE,CAAC;QAED,SAAS,WAAW;YAClB,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,OAAO,CAAC,CAAA;QACxF,CAAC;QAED,SAAS,KAAK,CAAC,CAAO,EAAE,CAAO;YAC7B,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YAC7B,MAAM,SAAS,GAAG,IAAA,yBAAc,EAAC,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,mBAAQ,CAAC,KAAK,CAAC,CAAA;YACxF,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE,IAAA,WAAC,EAAA,IAAI,CAAC,CAAA;YAC3C,GAAG,CAAC,GAAG,CAAC,IAAA,WAAC,EAAA,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE;gBACxB,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAA;gBAC/B,GAAG,CAAC,EAAE,CAAC,SAAS,EAAE,IAAA,WAAC,EAAA,UAAU,CAAC,CAAA;gBAC9B,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;oBAAE,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,UAAU,IAAI,cAAc,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,SAAS,CAAC,CAAA;gBAClF,GAAG;qBACA,EAAE,CAAC,IAAA,WAAC,EAAA,UAAU,OAAO,IAAI,IAAI,eAAe,EAAE,GAAG,EAAE;oBAClD,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,IAAA,WAAC,EAAA,GAAG,OAAO,IAAI,IAAI,GAAG,CAAC,CAAA;oBACrC,GAAG,CAAC,KAAK,EAAE,CAAA;oBACX,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,CAAA;gBAClC,CAAC,CAAC;qBACD,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,OAAO,IAAI,IAAI,OAAO,CAAC,EAAE,CAAC,CAAA;YACxC,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,SAAS,MAAM,CAAC,CAAO,EAAE,CAAO;YAC9B,MAAM,GAAG,GAAG,IAAA,cAAO,EAAC,GAAG,EAAE,eAAK,CAAC,CAAA;YAC/B,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAC/B,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAA,WAAC,EAAA,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,CACrC,GAAG,CAAC,GAAG,CAAC,IAAA,WAAC,EAAA,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,CACpC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE;gBACnD,GAAG,CAAC,KAAK,EAAE,CAAA;gBACX,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YACvC,CAAC,CAAC,CACH,CACF,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv/lib/2019.ts b/node_modules/ajv/lib/2019.ts deleted file mode 100644 index 3f7194f..0000000 --- a/node_modules/ajv/lib/2019.ts +++ /dev/null @@ -1,81 +0,0 @@ -import type {AnySchemaObject} from "./types" -import AjvCore, {Options} from "./core" - -import draft7Vocabularies from "./vocabularies/draft7" -import dynamicVocabulary from "./vocabularies/dynamic" -import nextVocabulary from "./vocabularies/next" -import unevaluatedVocabulary from "./vocabularies/unevaluated" -import discriminator from "./vocabularies/discriminator" -import addMetaSchema2019 from "./refs/json-schema-2019-09" - -const META_SCHEMA_ID = "https://json-schema.org/draft/2019-09/schema" - -export class Ajv2019 extends AjvCore { - constructor(opts: Options = {}) { - super({ - ...opts, - dynamicRef: true, - next: true, - unevaluated: true, - }) - } - - _addVocabularies(): void { - super._addVocabularies() - this.addVocabulary(dynamicVocabulary) - draft7Vocabularies.forEach((v) => this.addVocabulary(v)) - this.addVocabulary(nextVocabulary) - this.addVocabulary(unevaluatedVocabulary) - if (this.opts.discriminator) this.addKeyword(discriminator) - } - - _addDefaultMetaSchema(): void { - super._addDefaultMetaSchema() - const {$data, meta} = this.opts - if (!meta) return - addMetaSchema2019.call(this, $data) - this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID - } - - defaultMeta(): string | AnySchemaObject | undefined { - return (this.opts.defaultMeta = - super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)) - } -} - -module.exports = exports = Ajv2019 -module.exports.Ajv2019 = Ajv2019 -Object.defineProperty(exports, "__esModule", {value: true}) - -export default Ajv2019 - -export { - Format, - FormatDefinition, - AsyncFormatDefinition, - KeywordDefinition, - KeywordErrorDefinition, - CodeKeywordDefinition, - MacroKeywordDefinition, - FuncKeywordDefinition, - Vocabulary, - Schema, - SchemaObject, - AnySchemaObject, - AsyncSchema, - AnySchema, - ValidateFunction, - AsyncValidateFunction, - ErrorObject, - ErrorNoParams, -} from "./types" - -export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core" -export {SchemaCxt, SchemaObjCxt} from "./compile" -export {KeywordCxt} from "./compile/validate" -export {DefinedError} from "./vocabularies/errors" -export {JSONType} from "./compile/rules" -export {JSONSchemaType} from "./types/json-schema" -export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" -export {default as ValidationError} from "./runtime/validation_error" -export {default as MissingRefError} from "./compile/ref_error" diff --git a/node_modules/ajv/lib/2020.ts b/node_modules/ajv/lib/2020.ts deleted file mode 100644 index cfb36af..0000000 --- a/node_modules/ajv/lib/2020.ts +++ /dev/null @@ -1,75 +0,0 @@ -import type {AnySchemaObject} from "./types" -import AjvCore, {Options} from "./core" - -import draft2020Vocabularies from "./vocabularies/draft2020" -import discriminator from "./vocabularies/discriminator" -import addMetaSchema2020 from "./refs/json-schema-2020-12" - -const META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema" - -export class Ajv2020 extends AjvCore { - constructor(opts: Options = {}) { - super({ - ...opts, - dynamicRef: true, - next: true, - unevaluated: true, - }) - } - - _addVocabularies(): void { - super._addVocabularies() - draft2020Vocabularies.forEach((v) => this.addVocabulary(v)) - if (this.opts.discriminator) this.addKeyword(discriminator) - } - - _addDefaultMetaSchema(): void { - super._addDefaultMetaSchema() - const {$data, meta} = this.opts - if (!meta) return - addMetaSchema2020.call(this, $data) - this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID - } - - defaultMeta(): string | AnySchemaObject | undefined { - return (this.opts.defaultMeta = - super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)) - } -} - -module.exports = exports = Ajv2020 -module.exports.Ajv2020 = Ajv2020 -Object.defineProperty(exports, "__esModule", {value: true}) - -export default Ajv2020 - -export { - Format, - FormatDefinition, - AsyncFormatDefinition, - KeywordDefinition, - KeywordErrorDefinition, - CodeKeywordDefinition, - MacroKeywordDefinition, - FuncKeywordDefinition, - Vocabulary, - Schema, - SchemaObject, - AnySchemaObject, - AsyncSchema, - AnySchema, - ValidateFunction, - AsyncValidateFunction, - ErrorObject, - ErrorNoParams, -} from "./types" - -export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core" -export {SchemaCxt, SchemaObjCxt} from "./compile" -export {KeywordCxt} from "./compile/validate" -export {DefinedError} from "./vocabularies/errors" -export {JSONType} from "./compile/rules" -export {JSONSchemaType} from "./types/json-schema" -export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" -export {default as ValidationError} from "./runtime/validation_error" -export {default as MissingRefError} from "./compile/ref_error" diff --git a/node_modules/ajv/lib/ajv.ts b/node_modules/ajv/lib/ajv.ts deleted file mode 100644 index 8275b93..0000000 --- a/node_modules/ajv/lib/ajv.ts +++ /dev/null @@ -1,70 +0,0 @@ -import type {AnySchemaObject} from "./types" -import AjvCore from "./core" -import draft7Vocabularies from "./vocabularies/draft7" -import discriminator from "./vocabularies/discriminator" -import * as draft7MetaSchema from "./refs/json-schema-draft-07.json" - -const META_SUPPORT_DATA = ["/properties"] - -const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema" - -export class Ajv extends AjvCore { - _addVocabularies(): void { - super._addVocabularies() - draft7Vocabularies.forEach((v) => this.addVocabulary(v)) - if (this.opts.discriminator) this.addKeyword(discriminator) - } - - _addDefaultMetaSchema(): void { - super._addDefaultMetaSchema() - if (!this.opts.meta) return - const metaSchema = this.opts.$data - ? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA) - : draft7MetaSchema - this.addMetaSchema(metaSchema, META_SCHEMA_ID, false) - this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID - } - - defaultMeta(): string | AnySchemaObject | undefined { - return (this.opts.defaultMeta = - super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)) - } -} - -module.exports = exports = Ajv -module.exports.Ajv = Ajv -Object.defineProperty(exports, "__esModule", {value: true}) - -export default Ajv - -export { - Format, - FormatDefinition, - AsyncFormatDefinition, - KeywordDefinition, - KeywordErrorDefinition, - CodeKeywordDefinition, - MacroKeywordDefinition, - FuncKeywordDefinition, - Vocabulary, - Schema, - SchemaObject, - AnySchemaObject, - AsyncSchema, - AnySchema, - ValidateFunction, - AsyncValidateFunction, - SchemaValidateFunction, - ErrorObject, - ErrorNoParams, -} from "./types" - -export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core" -export {SchemaCxt, SchemaObjCxt} from "./compile" -export {KeywordCxt} from "./compile/validate" -export {DefinedError} from "./vocabularies/errors" -export {JSONType} from "./compile/rules" -export {JSONSchemaType} from "./types/json-schema" -export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" -export {default as ValidationError} from "./runtime/validation_error" -export {default as MissingRefError} from "./compile/ref_error" diff --git a/node_modules/ajv/lib/compile/codegen/code.ts b/node_modules/ajv/lib/compile/codegen/code.ts deleted file mode 100644 index 9d4de61..0000000 --- a/node_modules/ajv/lib/compile/codegen/code.ts +++ /dev/null @@ -1,169 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-extraneous-class -export abstract class _CodeOrName { - abstract readonly str: string - abstract readonly names: UsedNames - abstract toString(): string - abstract emptyStr(): boolean -} - -export const IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i - -export class Name extends _CodeOrName { - readonly str: string - constructor(s: string) { - super() - if (!IDENTIFIER.test(s)) throw new Error("CodeGen: name must be a valid identifier") - this.str = s - } - - toString(): string { - return this.str - } - - emptyStr(): boolean { - return false - } - - get names(): UsedNames { - return {[this.str]: 1} - } -} - -export class _Code extends _CodeOrName { - readonly _items: readonly CodeItem[] - private _str?: string - private _names?: UsedNames - - constructor(code: string | readonly CodeItem[]) { - super() - this._items = typeof code === "string" ? [code] : code - } - - toString(): string { - return this.str - } - - emptyStr(): boolean { - if (this._items.length > 1) return false - const item = this._items[0] - return item === "" || item === '""' - } - - get str(): string { - return (this._str ??= this._items.reduce((s: string, c: CodeItem) => `${s}${c}`, "")) - } - - get names(): UsedNames { - return (this._names ??= this._items.reduce((names: UsedNames, c) => { - if (c instanceof Name) names[c.str] = (names[c.str] || 0) + 1 - return names - }, {})) - } -} - -export type CodeItem = Name | string | number | boolean | null - -export type UsedNames = Record - -export type Code = _Code | Name - -export type SafeExpr = Code | number | boolean | null - -export const nil = new _Code("") - -type CodeArg = SafeExpr | string | undefined - -export function _(strs: TemplateStringsArray, ...args: CodeArg[]): _Code { - const code: CodeItem[] = [strs[0]] - let i = 0 - while (i < args.length) { - addCodeArg(code, args[i]) - code.push(strs[++i]) - } - return new _Code(code) -} - -const plus = new _Code("+") - -export function str(strs: TemplateStringsArray, ...args: (CodeArg | string[])[]): _Code { - const expr: CodeItem[] = [safeStringify(strs[0])] - let i = 0 - while (i < args.length) { - expr.push(plus) - addCodeArg(expr, args[i]) - expr.push(plus, safeStringify(strs[++i])) - } - optimize(expr) - return new _Code(expr) -} - -export function addCodeArg(code: CodeItem[], arg: CodeArg | string[]): void { - if (arg instanceof _Code) code.push(...arg._items) - else if (arg instanceof Name) code.push(arg) - else code.push(interpolate(arg)) -} - -function optimize(expr: CodeItem[]): void { - let i = 1 - while (i < expr.length - 1) { - if (expr[i] === plus) { - const res = mergeExprItems(expr[i - 1], expr[i + 1]) - if (res !== undefined) { - expr.splice(i - 1, 3, res) - continue - } - expr[i++] = "+" - } - i++ - } -} - -function mergeExprItems(a: CodeItem, b: CodeItem): CodeItem | undefined { - if (b === '""') return a - if (a === '""') return b - if (typeof a == "string") { - if (b instanceof Name || a[a.length - 1] !== '"') return - if (typeof b != "string") return `${a.slice(0, -1)}${b}"` - if (b[0] === '"') return a.slice(0, -1) + b.slice(1) - return - } - if (typeof b == "string" && b[0] === '"' && !(a instanceof Name)) return `"${a}${b.slice(1)}` - return -} - -export function strConcat(c1: Code, c2: Code): Code { - return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str`${c1}${c2}` -} - -// TODO do not allow arrays here -function interpolate(x?: string | string[] | number | boolean | null): SafeExpr | string { - return typeof x == "number" || typeof x == "boolean" || x === null - ? x - : safeStringify(Array.isArray(x) ? x.join(",") : x) -} - -export function stringify(x: unknown): Code { - return new _Code(safeStringify(x)) -} - -export function safeStringify(x: unknown): string { - return JSON.stringify(x) - .replace(/\u2028/g, "\\u2028") - .replace(/\u2029/g, "\\u2029") -} - -export function getProperty(key: Code | string | number): Code { - return typeof key == "string" && IDENTIFIER.test(key) ? new _Code(`.${key}`) : _`[${key}]` -} - -//Does best effort to format the name properly -export function getEsmExportName(key: Code | string | number): Code { - if (typeof key == "string" && IDENTIFIER.test(key)) { - return new _Code(`${key}`) - } - throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`) -} - -export function regexpCode(rx: RegExp): Code { - return new _Code(rx.toString()) -} diff --git a/node_modules/ajv/lib/compile/codegen/index.ts b/node_modules/ajv/lib/compile/codegen/index.ts deleted file mode 100644 index 5a6d1ee..0000000 --- a/node_modules/ajv/lib/compile/codegen/index.ts +++ /dev/null @@ -1,852 +0,0 @@ -import type {ScopeValueSets, NameValue, ValueScope, ValueScopeName} from "./scope" -import {_, nil, _Code, Code, Name, UsedNames, CodeItem, addCodeArg, _CodeOrName} from "./code" -import {Scope, varKinds} from "./scope" - -export {_, str, strConcat, nil, getProperty, stringify, regexpCode, Name, Code} from "./code" -export {Scope, ScopeStore, ValueScope, ValueScopeName, ScopeValueSets, varKinds} from "./scope" - -// type for expressions that can be safely inserted in code without quotes -export type SafeExpr = Code | number | boolean | null - -// type that is either Code of function that adds code to CodeGen instance using its methods -export type Block = Code | (() => void) - -export const operators = { - GT: new _Code(">"), - GTE: new _Code(">="), - LT: new _Code("<"), - LTE: new _Code("<="), - EQ: new _Code("==="), - NEQ: new _Code("!=="), - NOT: new _Code("!"), - OR: new _Code("||"), - AND: new _Code("&&"), - ADD: new _Code("+"), -} - -abstract class Node { - abstract readonly names: UsedNames - - optimizeNodes(): this | ChildNode | ChildNode[] | undefined { - return this - } - - optimizeNames(_names: UsedNames, _constants: Constants): this | undefined { - return this - } - - // get count(): number { - // return 1 - // } -} - -class Def extends Node { - constructor( - private readonly varKind: Name, - private readonly name: Name, - private rhs?: SafeExpr - ) { - super() - } - - render({es5, _n}: CGOptions): string { - const varKind = es5 ? varKinds.var : this.varKind - const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}` - return `${varKind} ${this.name}${rhs};` + _n - } - - optimizeNames(names: UsedNames, constants: Constants): this | undefined { - if (!names[this.name.str]) return - if (this.rhs) this.rhs = optimizeExpr(this.rhs, names, constants) - return this - } - - get names(): UsedNames { - return this.rhs instanceof _CodeOrName ? this.rhs.names : {} - } -} - -class Assign extends Node { - constructor( - readonly lhs: Code, - public rhs: SafeExpr, - private readonly sideEffects?: boolean - ) { - super() - } - - render({_n}: CGOptions): string { - return `${this.lhs} = ${this.rhs};` + _n - } - - optimizeNames(names: UsedNames, constants: Constants): this | undefined { - if (this.lhs instanceof Name && !names[this.lhs.str] && !this.sideEffects) return - this.rhs = optimizeExpr(this.rhs, names, constants) - return this - } - - get names(): UsedNames { - const names = this.lhs instanceof Name ? {} : {...this.lhs.names} - return addExprNames(names, this.rhs) - } -} - -class AssignOp extends Assign { - constructor( - lhs: Code, - private readonly op: Code, - rhs: SafeExpr, - sideEffects?: boolean - ) { - super(lhs, rhs, sideEffects) - } - - render({_n}: CGOptions): string { - return `${this.lhs} ${this.op}= ${this.rhs};` + _n - } -} - -class Label extends Node { - readonly names: UsedNames = {} - constructor(readonly label: Name) { - super() - } - - render({_n}: CGOptions): string { - return `${this.label}:` + _n - } -} - -class Break extends Node { - readonly names: UsedNames = {} - constructor(readonly label?: Code) { - super() - } - - render({_n}: CGOptions): string { - const label = this.label ? ` ${this.label}` : "" - return `break${label};` + _n - } -} - -class Throw extends Node { - constructor(readonly error: Code) { - super() - } - - render({_n}: CGOptions): string { - return `throw ${this.error};` + _n - } - - get names(): UsedNames { - return this.error.names - } -} - -class AnyCode extends Node { - constructor(private code: SafeExpr) { - super() - } - - render({_n}: CGOptions): string { - return `${this.code};` + _n - } - - optimizeNodes(): this | undefined { - return `${this.code}` ? this : undefined - } - - optimizeNames(names: UsedNames, constants: Constants): this { - this.code = optimizeExpr(this.code, names, constants) - return this - } - - get names(): UsedNames { - return this.code instanceof _CodeOrName ? this.code.names : {} - } -} - -abstract class ParentNode extends Node { - constructor(readonly nodes: ChildNode[] = []) { - super() - } - - render(opts: CGOptions): string { - return this.nodes.reduce((code, n) => code + n.render(opts), "") - } - - optimizeNodes(): this | ChildNode | ChildNode[] | undefined { - const {nodes} = this - let i = nodes.length - while (i--) { - const n = nodes[i].optimizeNodes() - if (Array.isArray(n)) nodes.splice(i, 1, ...n) - else if (n) nodes[i] = n - else nodes.splice(i, 1) - } - return nodes.length > 0 ? this : undefined - } - - optimizeNames(names: UsedNames, constants: Constants): this | undefined { - const {nodes} = this - let i = nodes.length - while (i--) { - // iterating backwards improves 1-pass optimization - const n = nodes[i] - if (n.optimizeNames(names, constants)) continue - subtractNames(names, n.names) - nodes.splice(i, 1) - } - return nodes.length > 0 ? this : undefined - } - - get names(): UsedNames { - return this.nodes.reduce((names: UsedNames, n) => addNames(names, n.names), {}) - } - - // get count(): number { - // return this.nodes.reduce((c, n) => c + n.count, 1) - // } -} - -abstract class BlockNode extends ParentNode { - render(opts: CGOptions): string { - return "{" + opts._n + super.render(opts) + "}" + opts._n - } -} - -class Root extends ParentNode {} - -class Else extends BlockNode { - static readonly kind = "else" -} - -class If extends BlockNode { - static readonly kind = "if" - else?: If | Else - constructor( - private condition: Code | boolean, - nodes?: ChildNode[] - ) { - super(nodes) - } - - render(opts: CGOptions): string { - let code = `if(${this.condition})` + super.render(opts) - if (this.else) code += "else " + this.else.render(opts) - return code - } - - optimizeNodes(): If | ChildNode[] | undefined { - super.optimizeNodes() - const cond = this.condition - if (cond === true) return this.nodes // else is ignored here - let e = this.else - if (e) { - const ns = e.optimizeNodes() - e = this.else = Array.isArray(ns) ? new Else(ns) : (ns as Else | undefined) - } - if (e) { - if (cond === false) return e instanceof If ? e : e.nodes - if (this.nodes.length) return this - return new If(not(cond), e instanceof If ? [e] : e.nodes) - } - if (cond === false || !this.nodes.length) return undefined - return this - } - - optimizeNames(names: UsedNames, constants: Constants): this | undefined { - this.else = this.else?.optimizeNames(names, constants) - if (!(super.optimizeNames(names, constants) || this.else)) return - this.condition = optimizeExpr(this.condition, names, constants) - return this - } - - get names(): UsedNames { - const names = super.names - addExprNames(names, this.condition) - if (this.else) addNames(names, this.else.names) - return names - } - - // get count(): number { - // return super.count + (this.else?.count || 0) - // } -} - -abstract class For extends BlockNode { - static readonly kind = "for" -} - -class ForLoop extends For { - constructor(private iteration: Code) { - super() - } - - render(opts: CGOptions): string { - return `for(${this.iteration})` + super.render(opts) - } - - optimizeNames(names: UsedNames, constants: Constants): this | undefined { - if (!super.optimizeNames(names, constants)) return - this.iteration = optimizeExpr(this.iteration, names, constants) - return this - } - - get names(): UsedNames { - return addNames(super.names, this.iteration.names) - } -} - -class ForRange extends For { - constructor( - private readonly varKind: Name, - private readonly name: Name, - private readonly from: SafeExpr, - private readonly to: SafeExpr - ) { - super() - } - - render(opts: CGOptions): string { - const varKind = opts.es5 ? varKinds.var : this.varKind - const {name, from, to} = this - return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts) - } - - get names(): UsedNames { - const names = addExprNames(super.names, this.from) - return addExprNames(names, this.to) - } -} - -class ForIter extends For { - constructor( - private readonly loop: "of" | "in", - private readonly varKind: Name, - private readonly name: Name, - private iterable: Code - ) { - super() - } - - render(opts: CGOptions): string { - return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts) - } - - optimizeNames(names: UsedNames, constants: Constants): this | undefined { - if (!super.optimizeNames(names, constants)) return - this.iterable = optimizeExpr(this.iterable, names, constants) - return this - } - - get names(): UsedNames { - return addNames(super.names, this.iterable.names) - } -} - -class Func extends BlockNode { - static readonly kind = "func" - constructor( - public name: Name, - public args: Code, - public async?: boolean - ) { - super() - } - - render(opts: CGOptions): string { - const _async = this.async ? "async " : "" - return `${_async}function ${this.name}(${this.args})` + super.render(opts) - } -} - -class Return extends ParentNode { - static readonly kind = "return" - - render(opts: CGOptions): string { - return "return " + super.render(opts) - } -} - -class Try extends BlockNode { - catch?: Catch - finally?: Finally - - render(opts: CGOptions): string { - let code = "try" + super.render(opts) - if (this.catch) code += this.catch.render(opts) - if (this.finally) code += this.finally.render(opts) - return code - } - - optimizeNodes(): this { - super.optimizeNodes() - this.catch?.optimizeNodes() as Catch | undefined - this.finally?.optimizeNodes() as Finally | undefined - return this - } - - optimizeNames(names: UsedNames, constants: Constants): this { - super.optimizeNames(names, constants) - this.catch?.optimizeNames(names, constants) - this.finally?.optimizeNames(names, constants) - return this - } - - get names(): UsedNames { - const names = super.names - if (this.catch) addNames(names, this.catch.names) - if (this.finally) addNames(names, this.finally.names) - return names - } - - // get count(): number { - // return super.count + (this.catch?.count || 0) + (this.finally?.count || 0) - // } -} - -class Catch extends BlockNode { - static readonly kind = "catch" - constructor(readonly error: Name) { - super() - } - - render(opts: CGOptions): string { - return `catch(${this.error})` + super.render(opts) - } -} - -class Finally extends BlockNode { - static readonly kind = "finally" - render(opts: CGOptions): string { - return "finally" + super.render(opts) - } -} - -type StartBlockNode = If | For | Func | Return | Try - -type LeafNode = Def | Assign | Label | Break | Throw | AnyCode - -type ChildNode = StartBlockNode | LeafNode - -type EndBlockNodeType = - | typeof If - | typeof Else - | typeof For - | typeof Func - | typeof Return - | typeof Catch - | typeof Finally - -type Constants = Record - -export interface CodeGenOptions { - es5?: boolean - lines?: boolean - ownProperties?: boolean -} - -interface CGOptions extends CodeGenOptions { - _n: "\n" | "" -} - -export class CodeGen { - readonly _scope: Scope - readonly _extScope: ValueScope - readonly _values: ScopeValueSets = {} - private readonly _nodes: ParentNode[] - private readonly _blockStarts: number[] = [] - private readonly _constants: Constants = {} - private readonly opts: CGOptions - - constructor(extScope: ValueScope, opts: CodeGenOptions = {}) { - this.opts = {...opts, _n: opts.lines ? "\n" : ""} - this._extScope = extScope - this._scope = new Scope({parent: extScope}) - this._nodes = [new Root()] - } - - toString(): string { - return this._root.render(this.opts) - } - - // returns unique name in the internal scope - name(prefix: string): Name { - return this._scope.name(prefix) - } - - // reserves unique name in the external scope - scopeName(prefix: string): ValueScopeName { - return this._extScope.name(prefix) - } - - // reserves unique name in the external scope and assigns value to it - scopeValue(prefixOrName: ValueScopeName | string, value: NameValue): Name { - const name = this._extScope.value(prefixOrName, value) - const vs = this._values[name.prefix] || (this._values[name.prefix] = new Set()) - vs.add(name) - return name - } - - getScopeValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined { - return this._extScope.getValue(prefix, keyOrRef) - } - - // return code that assigns values in the external scope to the names that are used internally - // (same names that were returned by gen.scopeName or gen.scopeValue) - scopeRefs(scopeName: Name): Code { - return this._extScope.scopeRefs(scopeName, this._values) - } - - scopeCode(): Code { - return this._extScope.scopeCode(this._values) - } - - private _def( - varKind: Name, - nameOrPrefix: Name | string, - rhs?: SafeExpr, - constant?: boolean - ): Name { - const name = this._scope.toName(nameOrPrefix) - if (rhs !== undefined && constant) this._constants[name.str] = rhs - this._leafNode(new Def(varKind, name, rhs)) - return name - } - - // `const` declaration (`var` in es5 mode) - const(nameOrPrefix: Name | string, rhs: SafeExpr, _constant?: boolean): Name { - return this._def(varKinds.const, nameOrPrefix, rhs, _constant) - } - - // `let` declaration with optional assignment (`var` in es5 mode) - let(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name { - return this._def(varKinds.let, nameOrPrefix, rhs, _constant) - } - - // `var` declaration with optional assignment - var(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name { - return this._def(varKinds.var, nameOrPrefix, rhs, _constant) - } - - // assignment code - assign(lhs: Code, rhs: SafeExpr, sideEffects?: boolean): CodeGen { - return this._leafNode(new Assign(lhs, rhs, sideEffects)) - } - - // `+=` code - add(lhs: Code, rhs: SafeExpr): CodeGen { - return this._leafNode(new AssignOp(lhs, operators.ADD, rhs)) - } - - // appends passed SafeExpr to code or executes Block - code(c: Block | SafeExpr): CodeGen { - if (typeof c == "function") c() - else if (c !== nil) this._leafNode(new AnyCode(c)) - return this - } - - // returns code for object literal for the passed argument list of key-value pairs - object(...keyValues: [Name | string, SafeExpr | string][]): _Code { - const code: CodeItem[] = ["{"] - for (const [key, value] of keyValues) { - if (code.length > 1) code.push(",") - code.push(key) - if (key !== value || this.opts.es5) { - code.push(":") - addCodeArg(code, value) - } - } - code.push("}") - return new _Code(code) - } - - // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed) - if(condition: Code | boolean, thenBody?: Block, elseBody?: Block): CodeGen { - this._blockNode(new If(condition)) - - if (thenBody && elseBody) { - this.code(thenBody).else().code(elseBody).endIf() - } else if (thenBody) { - this.code(thenBody).endIf() - } else if (elseBody) { - throw new Error('CodeGen: "else" body without "then" body') - } - return this - } - - // `else if` clause - invalid without `if` or after `else` clauses - elseIf(condition: Code | boolean): CodeGen { - return this._elseNode(new If(condition)) - } - - // `else` clause - only valid after `if` or `else if` clauses - else(): CodeGen { - return this._elseNode(new Else()) - } - - // end `if` statement (needed if gen.if was used only with condition) - endIf(): CodeGen { - return this._endBlockNode(If, Else) - } - - private _for(node: For, forBody?: Block): CodeGen { - this._blockNode(node) - if (forBody) this.code(forBody).endFor() - return this - } - - // a generic `for` clause (or statement if `forBody` is passed) - for(iteration: Code, forBody?: Block): CodeGen { - return this._for(new ForLoop(iteration), forBody) - } - - // `for` statement for a range of values - forRange( - nameOrPrefix: Name | string, - from: SafeExpr, - to: SafeExpr, - forBody: (index: Name) => void, - varKind: Code = this.opts.es5 ? varKinds.var : varKinds.let - ): CodeGen { - const name = this._scope.toName(nameOrPrefix) - return this._for(new ForRange(varKind, name, from, to), () => forBody(name)) - } - - // `for-of` statement (in es5 mode replace with a normal for loop) - forOf( - nameOrPrefix: Name | string, - iterable: Code, - forBody: (item: Name) => void, - varKind: Code = varKinds.const - ): CodeGen { - const name = this._scope.toName(nameOrPrefix) - if (this.opts.es5) { - const arr = iterable instanceof Name ? iterable : this.var("_arr", iterable) - return this.forRange("_i", 0, _`${arr}.length`, (i) => { - this.var(name, _`${arr}[${i}]`) - forBody(name) - }) - } - return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name)) - } - - // `for-in` statement. - // With option `ownProperties` replaced with a `for-of` loop for object keys - forIn( - nameOrPrefix: Name | string, - obj: Code, - forBody: (item: Name) => void, - varKind: Code = this.opts.es5 ? varKinds.var : varKinds.const - ): CodeGen { - if (this.opts.ownProperties) { - return this.forOf(nameOrPrefix, _`Object.keys(${obj})`, forBody) - } - const name = this._scope.toName(nameOrPrefix) - return this._for(new ForIter("in", varKind, name, obj), () => forBody(name)) - } - - // end `for` loop - endFor(): CodeGen { - return this._endBlockNode(For) - } - - // `label` statement - label(label: Name): CodeGen { - return this._leafNode(new Label(label)) - } - - // `break` statement - break(label?: Code): CodeGen { - return this._leafNode(new Break(label)) - } - - // `return` statement - return(value: Block | SafeExpr): CodeGen { - const node = new Return() - this._blockNode(node) - this.code(value) - if (node.nodes.length !== 1) throw new Error('CodeGen: "return" should have one node') - return this._endBlockNode(Return) - } - - // `try` statement - try(tryBody: Block, catchCode?: (e: Name) => void, finallyCode?: Block): CodeGen { - if (!catchCode && !finallyCode) throw new Error('CodeGen: "try" without "catch" and "finally"') - const node = new Try() - this._blockNode(node) - this.code(tryBody) - if (catchCode) { - const error = this.name("e") - this._currNode = node.catch = new Catch(error) - catchCode(error) - } - if (finallyCode) { - this._currNode = node.finally = new Finally() - this.code(finallyCode) - } - return this._endBlockNode(Catch, Finally) - } - - // `throw` statement - throw(error: Code): CodeGen { - return this._leafNode(new Throw(error)) - } - - // start self-balancing block - block(body?: Block, nodeCount?: number): CodeGen { - this._blockStarts.push(this._nodes.length) - if (body) this.code(body).endBlock(nodeCount) - return this - } - - // end the current self-balancing block - endBlock(nodeCount?: number): CodeGen { - const len = this._blockStarts.pop() - if (len === undefined) throw new Error("CodeGen: not in self-balancing block") - const toClose = this._nodes.length - len - if (toClose < 0 || (nodeCount !== undefined && toClose !== nodeCount)) { - throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`) - } - this._nodes.length = len - return this - } - - // `function` heading (or definition if funcBody is passed) - func(name: Name, args: Code = nil, async?: boolean, funcBody?: Block): CodeGen { - this._blockNode(new Func(name, args, async)) - if (funcBody) this.code(funcBody).endFunc() - return this - } - - // end function definition - endFunc(): CodeGen { - return this._endBlockNode(Func) - } - - optimize(n = 1): void { - while (n-- > 0) { - this._root.optimizeNodes() - this._root.optimizeNames(this._root.names, this._constants) - } - } - - private _leafNode(node: LeafNode): CodeGen { - this._currNode.nodes.push(node) - return this - } - - private _blockNode(node: StartBlockNode): void { - this._currNode.nodes.push(node) - this._nodes.push(node) - } - - private _endBlockNode(N1: EndBlockNodeType, N2?: EndBlockNodeType): CodeGen { - const n = this._currNode - if (n instanceof N1 || (N2 && n instanceof N2)) { - this._nodes.pop() - return this - } - throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`) - } - - private _elseNode(node: If | Else): CodeGen { - const n = this._currNode - if (!(n instanceof If)) { - throw new Error('CodeGen: "else" without "if"') - } - this._currNode = n.else = node - return this - } - - private get _root(): Root { - return this._nodes[0] as Root - } - - private get _currNode(): ParentNode { - const ns = this._nodes - return ns[ns.length - 1] - } - - private set _currNode(node: ParentNode) { - const ns = this._nodes - ns[ns.length - 1] = node - } - - // get nodeCount(): number { - // return this._root.count - // } -} - -function addNames(names: UsedNames, from: UsedNames): UsedNames { - for (const n in from) names[n] = (names[n] || 0) + (from[n] || 0) - return names -} - -function addExprNames(names: UsedNames, from: SafeExpr): UsedNames { - return from instanceof _CodeOrName ? addNames(names, from.names) : names -} - -function optimizeExpr(expr: T, names: UsedNames, constants: Constants): T -function optimizeExpr(expr: SafeExpr, names: UsedNames, constants: Constants): SafeExpr { - if (expr instanceof Name) return replaceName(expr) - if (!canOptimize(expr)) return expr - return new _Code( - expr._items.reduce((items: CodeItem[], c: SafeExpr | string) => { - if (c instanceof Name) c = replaceName(c) - if (c instanceof _Code) items.push(...c._items) - else items.push(c) - return items - }, []) - ) - - function replaceName(n: Name): SafeExpr { - const c = constants[n.str] - if (c === undefined || names[n.str] !== 1) return n - delete names[n.str] - return c - } - - function canOptimize(e: SafeExpr): e is _Code { - return ( - e instanceof _Code && - e._items.some( - (c) => c instanceof Name && names[c.str] === 1 && constants[c.str] !== undefined - ) - ) - } -} - -function subtractNames(names: UsedNames, from: UsedNames): void { - for (const n in from) names[n] = (names[n] || 0) - (from[n] || 0) -} - -export function not(x: T): T -export function not(x: Code | SafeExpr): Code | SafeExpr { - return typeof x == "boolean" || typeof x == "number" || x === null ? !x : _`!${par(x)}` -} - -const andCode = mappend(operators.AND) - -// boolean AND (&&) expression with the passed arguments -export function and(...args: Code[]): Code { - return args.reduce(andCode) -} - -const orCode = mappend(operators.OR) - -// boolean OR (||) expression with the passed arguments -export function or(...args: Code[]): Code { - return args.reduce(orCode) -} - -type MAppend = (x: Code, y: Code) => Code - -function mappend(op: Code): MAppend { - return (x, y) => (x === nil ? y : y === nil ? x : _`${par(x)} ${op} ${par(y)}`) -} - -function par(x: Code): Code { - return x instanceof Name ? x : _`(${x})` -} diff --git a/node_modules/ajv/lib/compile/codegen/scope.ts b/node_modules/ajv/lib/compile/codegen/scope.ts deleted file mode 100644 index 5119922..0000000 --- a/node_modules/ajv/lib/compile/codegen/scope.ts +++ /dev/null @@ -1,215 +0,0 @@ -import {_, nil, Code, Name} from "./code" - -interface NameGroup { - prefix: string - index: number -} - -export interface NameValue { - ref: ValueReference // this is the reference to any value that can be referred to from generated code via `globals` var in the closure - key?: unknown // any key to identify a global to avoid duplicates, if not passed ref is used - code?: Code // this is the code creating the value needed for standalone code wit_out closure - can be a primitive value, function or import (`require`) -} - -export type ValueReference = unknown // possibly make CodeGen parameterized type on this type - -class ValueError extends Error { - readonly value?: NameValue - constructor(name: ValueScopeName) { - super(`CodeGen: "code" for ${name} not defined`) - this.value = name.value - } -} - -interface ScopeOptions { - prefixes?: Set - parent?: Scope -} - -interface ValueScopeOptions extends ScopeOptions { - scope: ScopeStore - es5?: boolean - lines?: boolean -} - -export type ScopeStore = Record - -type ScopeValues = { - [Prefix in string]?: Map -} - -export type ScopeValueSets = { - [Prefix in string]?: Set -} - -export enum UsedValueState { - Started, - Completed, -} - -export type UsedScopeValues = { - [Prefix in string]?: Map -} - -export const varKinds = { - const: new Name("const"), - let: new Name("let"), - var: new Name("var"), -} - -export class Scope { - protected readonly _names: {[Prefix in string]?: NameGroup} = {} - protected readonly _prefixes?: Set - protected readonly _parent?: Scope - - constructor({prefixes, parent}: ScopeOptions = {}) { - this._prefixes = prefixes - this._parent = parent - } - - toName(nameOrPrefix: Name | string): Name { - return nameOrPrefix instanceof Name ? nameOrPrefix : this.name(nameOrPrefix) - } - - name(prefix: string): Name { - return new Name(this._newName(prefix)) - } - - protected _newName(prefix: string): string { - const ng = this._names[prefix] || this._nameGroup(prefix) - return `${prefix}${ng.index++}` - } - - private _nameGroup(prefix: string): NameGroup { - if (this._parent?._prefixes?.has(prefix) || (this._prefixes && !this._prefixes.has(prefix))) { - throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`) - } - return (this._names[prefix] = {prefix, index: 0}) - } -} - -interface ScopePath { - property: string - itemIndex: number -} - -export class ValueScopeName extends Name { - readonly prefix: string - value?: NameValue - scopePath?: Code - - constructor(prefix: string, nameStr: string) { - super(nameStr) - this.prefix = prefix - } - - setValue(value: NameValue, {property, itemIndex}: ScopePath): void { - this.value = value - this.scopePath = _`.${new Name(property)}[${itemIndex}]` - } -} - -interface VSOptions extends ValueScopeOptions { - _n: Code -} - -const line = _`\n` - -export class ValueScope extends Scope { - protected readonly _values: ScopeValues = {} - protected readonly _scope: ScopeStore - readonly opts: VSOptions - - constructor(opts: ValueScopeOptions) { - super(opts) - this._scope = opts.scope - this.opts = {...opts, _n: opts.lines ? line : nil} - } - - get(): ScopeStore { - return this._scope - } - - name(prefix: string): ValueScopeName { - return new ValueScopeName(prefix, this._newName(prefix)) - } - - value(nameOrPrefix: ValueScopeName | string, value: NameValue): ValueScopeName { - if (value.ref === undefined) throw new Error("CodeGen: ref must be passed in value") - const name = this.toName(nameOrPrefix) as ValueScopeName - const {prefix} = name - const valueKey = value.key ?? value.ref - let vs = this._values[prefix] - if (vs) { - const _name = vs.get(valueKey) - if (_name) return _name - } else { - vs = this._values[prefix] = new Map() - } - vs.set(valueKey, name) - - const s = this._scope[prefix] || (this._scope[prefix] = []) - const itemIndex = s.length - s[itemIndex] = value.ref - name.setValue(value, {property: prefix, itemIndex}) - return name - } - - getValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined { - const vs = this._values[prefix] - if (!vs) return - return vs.get(keyOrRef) - } - - scopeRefs(scopeName: Name, values: ScopeValues | ScopeValueSets = this._values): Code { - return this._reduceValues(values, (name: ValueScopeName) => { - if (name.scopePath === undefined) throw new Error(`CodeGen: name "${name}" has no value`) - return _`${scopeName}${name.scopePath}` - }) - } - - scopeCode( - values: ScopeValues | ScopeValueSets = this._values, - usedValues?: UsedScopeValues, - getCode?: (n: ValueScopeName) => Code | undefined - ): Code { - return this._reduceValues( - values, - (name: ValueScopeName) => { - if (name.value === undefined) throw new Error(`CodeGen: name "${name}" has no value`) - return name.value.code - }, - usedValues, - getCode - ) - } - - private _reduceValues( - values: ScopeValues | ScopeValueSets, - valueCode: (n: ValueScopeName) => Code | undefined, - usedValues: UsedScopeValues = {}, - getCode?: (n: ValueScopeName) => Code | undefined - ): Code { - let code: Code = nil - for (const prefix in values) { - const vs = values[prefix] - if (!vs) continue - const nameSet = (usedValues[prefix] = usedValues[prefix] || new Map()) - vs.forEach((name: ValueScopeName) => { - if (nameSet.has(name)) return - nameSet.set(name, UsedValueState.Started) - let c = valueCode(name) - if (c) { - const def = this.opts.es5 ? varKinds.var : varKinds.const - code = _`${code}${def} ${name} = ${c};${this.opts._n}` - } else if ((c = getCode?.(name))) { - code = _`${code}${c}${this.opts._n}` - } else { - throw new ValueError(name) - } - nameSet.set(name, UsedValueState.Completed) - }) - } - return code - } -} diff --git a/node_modules/ajv/lib/compile/errors.ts b/node_modules/ajv/lib/compile/errors.ts deleted file mode 100644 index 18424a0..0000000 --- a/node_modules/ajv/lib/compile/errors.ts +++ /dev/null @@ -1,184 +0,0 @@ -import type {KeywordErrorCxt, KeywordErrorDefinition} from "../types" -import type {SchemaCxt} from "./index" -import {CodeGen, _, str, strConcat, Code, Name} from "./codegen" -import {SafeExpr} from "./codegen/code" -import {getErrorPath, Type} from "./util" -import N from "./names" - -export const keywordError: KeywordErrorDefinition = { - message: ({keyword}) => str`must pass "${keyword}" keyword validation`, -} - -export const keyword$DataError: KeywordErrorDefinition = { - message: ({keyword, schemaType}) => - schemaType - ? str`"${keyword}" keyword must be ${schemaType} ($data)` - : str`"${keyword}" keyword is invalid ($data)`, -} - -export interface ErrorPaths { - instancePath?: Code - schemaPath?: string - parentSchema?: boolean -} - -export function reportError( - cxt: KeywordErrorCxt, - error: KeywordErrorDefinition = keywordError, - errorPaths?: ErrorPaths, - overrideAllErrors?: boolean -): void { - const {it} = cxt - const {gen, compositeRule, allErrors} = it - const errObj = errorObjectCode(cxt, error, errorPaths) - if (overrideAllErrors ?? (compositeRule || allErrors)) { - addError(gen, errObj) - } else { - returnErrors(it, _`[${errObj}]`) - } -} - -export function reportExtraError( - cxt: KeywordErrorCxt, - error: KeywordErrorDefinition = keywordError, - errorPaths?: ErrorPaths -): void { - const {it} = cxt - const {gen, compositeRule, allErrors} = it - const errObj = errorObjectCode(cxt, error, errorPaths) - addError(gen, errObj) - if (!(compositeRule || allErrors)) { - returnErrors(it, N.vErrors) - } -} - -export function resetErrorsCount(gen: CodeGen, errsCount: Name): void { - gen.assign(N.errors, errsCount) - gen.if(_`${N.vErrors} !== null`, () => - gen.if( - errsCount, - () => gen.assign(_`${N.vErrors}.length`, errsCount), - () => gen.assign(N.vErrors, null) - ) - ) -} - -export function extendErrors({ - gen, - keyword, - schemaValue, - data, - errsCount, - it, -}: KeywordErrorCxt): void { - /* istanbul ignore if */ - if (errsCount === undefined) throw new Error("ajv implementation error") - const err = gen.name("err") - gen.forRange("i", errsCount, N.errors, (i) => { - gen.const(err, _`${N.vErrors}[${i}]`) - gen.if(_`${err}.instancePath === undefined`, () => - gen.assign(_`${err}.instancePath`, strConcat(N.instancePath, it.errorPath)) - ) - gen.assign(_`${err}.schemaPath`, str`${it.errSchemaPath}/${keyword}`) - if (it.opts.verbose) { - gen.assign(_`${err}.schema`, schemaValue) - gen.assign(_`${err}.data`, data) - } - }) -} - -function addError(gen: CodeGen, errObj: Code): void { - const err = gen.const("err", errObj) - gen.if( - _`${N.vErrors} === null`, - () => gen.assign(N.vErrors, _`[${err}]`), - _`${N.vErrors}.push(${err})` - ) - gen.code(_`${N.errors}++`) -} - -function returnErrors(it: SchemaCxt, errs: Code): void { - const {gen, validateName, schemaEnv} = it - if (schemaEnv.$async) { - gen.throw(_`new ${it.ValidationError as Name}(${errs})`) - } else { - gen.assign(_`${validateName}.errors`, errs) - gen.return(false) - } -} - -const E = { - keyword: new Name("keyword"), - schemaPath: new Name("schemaPath"), // also used in JTD errors - params: new Name("params"), - propertyName: new Name("propertyName"), - message: new Name("message"), - schema: new Name("schema"), - parentSchema: new Name("parentSchema"), -} - -function errorObjectCode( - cxt: KeywordErrorCxt, - error: KeywordErrorDefinition, - errorPaths?: ErrorPaths -): Code { - const {createErrors} = cxt.it - if (createErrors === false) return _`{}` - return errorObject(cxt, error, errorPaths) -} - -function errorObject( - cxt: KeywordErrorCxt, - error: KeywordErrorDefinition, - errorPaths: ErrorPaths = {} -): Code { - const {gen, it} = cxt - const keyValues: [Name, SafeExpr | string][] = [ - errorInstancePath(it, errorPaths), - errorSchemaPath(cxt, errorPaths), - ] - extraErrorProps(cxt, error, keyValues) - return gen.object(...keyValues) -} - -function errorInstancePath({errorPath}: SchemaCxt, {instancePath}: ErrorPaths): [Name, Code] { - const instPath = instancePath - ? str`${errorPath}${getErrorPath(instancePath, Type.Str)}` - : errorPath - return [N.instancePath, strConcat(N.instancePath, instPath)] -} - -function errorSchemaPath( - {keyword, it: {errSchemaPath}}: KeywordErrorCxt, - {schemaPath, parentSchema}: ErrorPaths -): [Name, string | Code] { - let schPath = parentSchema ? errSchemaPath : str`${errSchemaPath}/${keyword}` - if (schemaPath) { - schPath = str`${schPath}${getErrorPath(schemaPath, Type.Str)}` - } - return [E.schemaPath, schPath] -} - -function extraErrorProps( - cxt: KeywordErrorCxt, - {params, message}: KeywordErrorDefinition, - keyValues: [Name, SafeExpr | string][] -): void { - const {keyword, data, schemaValue, it} = cxt - const {opts, propertyName, topSchemaRef, schemaPath} = it - keyValues.push( - [E.keyword, keyword], - [E.params, typeof params == "function" ? params(cxt) : params || _`{}`] - ) - if (opts.messages) { - keyValues.push([E.message, typeof message == "function" ? message(cxt) : message]) - } - if (opts.verbose) { - keyValues.push( - [E.schema, schemaValue], - [E.parentSchema, _`${topSchemaRef}${schemaPath}`], - [N.data, data] - ) - } - if (propertyName) keyValues.push([E.propertyName, propertyName]) -} diff --git a/node_modules/ajv/lib/compile/index.ts b/node_modules/ajv/lib/compile/index.ts deleted file mode 100644 index bfc3934..0000000 --- a/node_modules/ajv/lib/compile/index.ts +++ /dev/null @@ -1,324 +0,0 @@ -import type { - AnySchema, - AnySchemaObject, - AnyValidateFunction, - AsyncValidateFunction, - EvaluatedProperties, - EvaluatedItems, -} from "../types" -import type Ajv from "../core" -import type {InstanceOptions} from "../core" -import {CodeGen, _, nil, stringify, Name, Code, ValueScopeName} from "./codegen" -import ValidationError from "../runtime/validation_error" -import N from "./names" -import {LocalRefs, getFullPath, _getFullPath, inlineRef, normalizeId, resolveUrl} from "./resolve" -import {schemaHasRulesButRef, unescapeFragment} from "./util" -import {validateFunctionCode} from "./validate" -import {URIComponent} from "fast-uri" -import {JSONType} from "./rules" - -export type SchemaRefs = { - [Ref in string]?: SchemaEnv | AnySchema -} - -export interface SchemaCxt { - readonly gen: CodeGen - readonly allErrors?: boolean // validation mode - whether to collect all errors or break on error - readonly data: Name // Name with reference to the current part of data instance - readonly parentData: Name // should be used in keywords modifying data - readonly parentDataProperty: Code | number // should be used in keywords modifying data - readonly dataNames: Name[] - readonly dataPathArr: (Code | number)[] - readonly dataLevel: number // the level of the currently validated data, - // it can be used to access both the property names and the data on all levels from the top. - dataTypes: JSONType[] // data types applied to the current part of data instance - definedProperties: Set // set of properties to keep track of for required checks - readonly topSchemaRef: Code - readonly validateName: Name - evaluated?: Name - readonly ValidationError?: Name - readonly schema: AnySchema // current schema object - equal to parentSchema passed via KeywordCxt - readonly schemaEnv: SchemaEnv - readonly rootId: string - baseId: string // the current schema base URI that should be used as the base for resolving URIs in references (\$ref) - readonly schemaPath: Code // the run-time expression that evaluates to the property name of the current schema - readonly errSchemaPath: string // this is actual string, should not be changed to Code - readonly errorPath: Code - readonly propertyName?: Name - readonly compositeRule?: boolean // true indicates that the current schema is inside the compound keyword, - // where failing some rule doesn't mean validation failure (`anyOf`, `oneOf`, `not`, `if`). - // This flag is used to determine whether you can return validation result immediately after any error in case the option `allErrors` is not `true. - // You only need to use it if you have many steps in your keywords and potentially can define multiple errors. - props?: EvaluatedProperties | Name // properties evaluated by this schema - used by parent schema or assigned to validation function - items?: EvaluatedItems | Name // last item evaluated by this schema - used by parent schema or assigned to validation function - jtdDiscriminator?: string - jtdMetadata?: boolean - readonly createErrors?: boolean - readonly opts: InstanceOptions // Ajv instance option. - readonly self: Ajv // current Ajv instance -} - -export interface SchemaObjCxt extends SchemaCxt { - readonly schema: AnySchemaObject -} -interface SchemaEnvArgs { - readonly schema: AnySchema - readonly schemaId?: "$id" | "id" - readonly root?: SchemaEnv - readonly baseId?: string - readonly schemaPath?: string - readonly localRefs?: LocalRefs - readonly meta?: boolean -} - -export class SchemaEnv implements SchemaEnvArgs { - readonly schema: AnySchema - readonly schemaId?: "$id" | "id" - readonly root: SchemaEnv - baseId: string // TODO possibly, it should be readonly - schemaPath?: string - localRefs?: LocalRefs - readonly meta?: boolean - readonly $async?: boolean // true if the current schema is asynchronous. - readonly refs: SchemaRefs = {} - readonly dynamicAnchors: {[Ref in string]?: true} = {} - validate?: AnyValidateFunction - validateName?: ValueScopeName - serialize?: (data: unknown) => string - serializeName?: ValueScopeName - parse?: (data: string) => unknown - parseName?: ValueScopeName - - constructor(env: SchemaEnvArgs) { - let schema: AnySchemaObject | undefined - if (typeof env.schema == "object") schema = env.schema - this.schema = env.schema - this.schemaId = env.schemaId - this.root = env.root || this - this.baseId = env.baseId ?? normalizeId(schema?.[env.schemaId || "$id"]) - this.schemaPath = env.schemaPath - this.localRefs = env.localRefs - this.meta = env.meta - this.$async = schema?.$async - this.refs = {} - } -} - -// let codeSize = 0 -// let nodeCount = 0 - -// Compiles schema in SchemaEnv -export function compileSchema(this: Ajv, sch: SchemaEnv): SchemaEnv { - // TODO refactor - remove compilations - const _sch = getCompilingSchema.call(this, sch) - if (_sch) return _sch - const rootId = getFullPath(this.opts.uriResolver, sch.root.baseId) // TODO if getFullPath removed 1 tests fails - const {es5, lines} = this.opts.code - const {ownProperties} = this.opts - const gen = new CodeGen(this.scope, {es5, lines, ownProperties}) - let _ValidationError - if (sch.$async) { - _ValidationError = gen.scopeValue("Error", { - ref: ValidationError, - code: _`require("ajv/dist/runtime/validation_error").default`, - }) - } - - const validateName = gen.scopeName("validate") - sch.validateName = validateName - - const schemaCxt: SchemaCxt = { - gen, - allErrors: this.opts.allErrors, - data: N.data, - parentData: N.parentData, - parentDataProperty: N.parentDataProperty, - dataNames: [N.data], - dataPathArr: [nil], // TODO can its length be used as dataLevel if nil is removed? - dataLevel: 0, - dataTypes: [], - definedProperties: new Set(), - topSchemaRef: gen.scopeValue( - "schema", - this.opts.code.source === true - ? {ref: sch.schema, code: stringify(sch.schema)} - : {ref: sch.schema} - ), - validateName, - ValidationError: _ValidationError, - schema: sch.schema, - schemaEnv: sch, - rootId, - baseId: sch.baseId || rootId, - schemaPath: nil, - errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"), - errorPath: _`""`, - opts: this.opts, - self: this, - } - - let sourceCode: string | undefined - try { - this._compilations.add(sch) - validateFunctionCode(schemaCxt) - gen.optimize(this.opts.code.optimize) - // gen.optimize(1) - const validateCode = gen.toString() - sourceCode = `${gen.scopeRefs(N.scope)}return ${validateCode}` - // console.log((codeSize += sourceCode.length), (nodeCount += gen.nodeCount)) - if (this.opts.code.process) sourceCode = this.opts.code.process(sourceCode, sch) - // console.log("\n\n\n *** \n", sourceCode) - const makeValidate = new Function(`${N.self}`, `${N.scope}`, sourceCode) - const validate: AnyValidateFunction = makeValidate(this, this.scope.get()) - this.scope.value(validateName, {ref: validate}) - - validate.errors = null - validate.schema = sch.schema - validate.schemaEnv = sch - if (sch.$async) (validate as AsyncValidateFunction).$async = true - if (this.opts.code.source === true) { - validate.source = {validateName, validateCode, scopeValues: gen._values} - } - if (this.opts.unevaluated) { - const {props, items} = schemaCxt - validate.evaluated = { - props: props instanceof Name ? undefined : props, - items: items instanceof Name ? undefined : items, - dynamicProps: props instanceof Name, - dynamicItems: items instanceof Name, - } - if (validate.source) validate.source.evaluated = stringify(validate.evaluated) - } - sch.validate = validate - return sch - } catch (e) { - delete sch.validate - delete sch.validateName - if (sourceCode) this.logger.error("Error compiling schema, function code:", sourceCode) - // console.log("\n\n\n *** \n", sourceCode, this.opts) - throw e - } finally { - this._compilations.delete(sch) - } -} - -export function resolveRef( - this: Ajv, - root: SchemaEnv, - baseId: string, - ref: string -): AnySchema | SchemaEnv | undefined { - ref = resolveUrl(this.opts.uriResolver, baseId, ref) - const schOrFunc = root.refs[ref] - if (schOrFunc) return schOrFunc - - let _sch = resolve.call(this, root, ref) - if (_sch === undefined) { - const schema = root.localRefs?.[ref] // TODO maybe localRefs should hold SchemaEnv - const {schemaId} = this.opts - if (schema) _sch = new SchemaEnv({schema, schemaId, root, baseId}) - } - - if (_sch === undefined) return - return (root.refs[ref] = inlineOrCompile.call(this, _sch)) -} - -function inlineOrCompile(this: Ajv, sch: SchemaEnv): AnySchema | SchemaEnv { - if (inlineRef(sch.schema, this.opts.inlineRefs)) return sch.schema - return sch.validate ? sch : compileSchema.call(this, sch) -} - -// Index of schema compilation in the currently compiled list -export function getCompilingSchema(this: Ajv, schEnv: SchemaEnv): SchemaEnv | void { - for (const sch of this._compilations) { - if (sameSchemaEnv(sch, schEnv)) return sch - } -} - -function sameSchemaEnv(s1: SchemaEnv, s2: SchemaEnv): boolean { - return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId -} - -// resolve and compile the references ($ref) -// TODO returns AnySchemaObject (if the schema can be inlined) or validation function -function resolve( - this: Ajv, - root: SchemaEnv, // information about the root schema for the current schema - ref: string // reference to resolve -): SchemaEnv | undefined { - let sch - while (typeof (sch = this.refs[ref]) == "string") ref = sch - return sch || this.schemas[ref] || resolveSchema.call(this, root, ref) -} - -// Resolve schema, its root and baseId -export function resolveSchema( - this: Ajv, - root: SchemaEnv, // root object with properties schema, refs TODO below SchemaEnv is assigned to it - ref: string // reference to resolve -): SchemaEnv | undefined { - const p = this.opts.uriResolver.parse(ref) - const refPath = _getFullPath(this.opts.uriResolver, p) - let baseId = getFullPath(this.opts.uriResolver, root.baseId, undefined) - // TODO `Object.keys(root.schema).length > 0` should not be needed - but removing breaks 2 tests - if (Object.keys(root.schema).length > 0 && refPath === baseId) { - return getJsonPointer.call(this, p, root) - } - - const id = normalizeId(refPath) - const schOrRef = this.refs[id] || this.schemas[id] - if (typeof schOrRef == "string") { - const sch = resolveSchema.call(this, root, schOrRef) - if (typeof sch?.schema !== "object") return - return getJsonPointer.call(this, p, sch) - } - - if (typeof schOrRef?.schema !== "object") return - if (!schOrRef.validate) compileSchema.call(this, schOrRef) - if (id === normalizeId(ref)) { - const {schema} = schOrRef - const {schemaId} = this.opts - const schId = schema[schemaId] - if (schId) baseId = resolveUrl(this.opts.uriResolver, baseId, schId) - return new SchemaEnv({schema, schemaId, root, baseId}) - } - return getJsonPointer.call(this, p, schOrRef) -} - -const PREVENT_SCOPE_CHANGE = new Set([ - "properties", - "patternProperties", - "enum", - "dependencies", - "definitions", -]) - -function getJsonPointer( - this: Ajv, - parsedRef: URIComponent, - {baseId, schema, root}: SchemaEnv -): SchemaEnv | undefined { - if (parsedRef.fragment?.[0] !== "/") return - for (const part of parsedRef.fragment.slice(1).split("/")) { - if (typeof schema === "boolean") return - const partSchema = schema[unescapeFragment(part)] - if (partSchema === undefined) return - schema = partSchema - // TODO PREVENT_SCOPE_CHANGE could be defined in keyword def? - const schId = typeof schema === "object" && schema[this.opts.schemaId] - if (!PREVENT_SCOPE_CHANGE.has(part) && schId) { - baseId = resolveUrl(this.opts.uriResolver, baseId, schId) - } - } - let env: SchemaEnv | undefined - if (typeof schema != "boolean" && schema.$ref && !schemaHasRulesButRef(schema, this.RULES)) { - const $ref = resolveUrl(this.opts.uriResolver, baseId, schema.$ref) - env = resolveSchema.call(this, root, $ref) - } - // even though resolution failed we need to return SchemaEnv to throw exception - // so that compileAsync loads missing schema. - const {schemaId} = this.opts - env = env || new SchemaEnv({schema, schemaId, root, baseId}) - if (env.schema !== env.root.schema) return env - return undefined -} diff --git a/node_modules/ajv/lib/compile/jtd/parse.ts b/node_modules/ajv/lib/compile/jtd/parse.ts deleted file mode 100644 index a0141c7..0000000 --- a/node_modules/ajv/lib/compile/jtd/parse.ts +++ /dev/null @@ -1,411 +0,0 @@ -import type Ajv from "../../core" -import type {SchemaObject} from "../../types" -import {jtdForms, JTDForm, SchemaObjectMap} from "./types" -import {SchemaEnv, getCompilingSchema} from ".." -import {_, str, and, or, nil, not, CodeGen, Code, Name, SafeExpr} from "../codegen" -import MissingRefError from "../ref_error" -import N from "../names" -import {hasPropFunc} from "../../vocabularies/code" -import {hasRef} from "../../vocabularies/jtd/ref" -import {intRange, IntType} from "../../vocabularies/jtd/type" -import {parseJson, parseJsonNumber, parseJsonString} from "../../runtime/parseJson" -import {useFunc} from "../util" -import validTimestamp from "../../runtime/timestamp" - -type GenParse = (cxt: ParseCxt) => void - -const genParse: {[F in JTDForm]: GenParse} = { - elements: parseElements, - values: parseValues, - discriminator: parseDiscriminator, - properties: parseProperties, - optionalProperties: parseProperties, - enum: parseEnum, - type: parseType, - ref: parseRef, -} - -interface ParseCxt { - readonly gen: CodeGen - readonly self: Ajv // current Ajv instance - readonly schemaEnv: SchemaEnv - readonly definitions: SchemaObjectMap - schema: SchemaObject - data: Code - parseName: Name - char: Name -} - -export default function compileParser( - this: Ajv, - sch: SchemaEnv, - definitions: SchemaObjectMap -): SchemaEnv { - const _sch = getCompilingSchema.call(this, sch) - if (_sch) return _sch - const {es5, lines} = this.opts.code - const {ownProperties} = this.opts - const gen = new CodeGen(this.scope, {es5, lines, ownProperties}) - const parseName = gen.scopeName("parse") - const cxt: ParseCxt = { - self: this, - gen, - schema: sch.schema as SchemaObject, - schemaEnv: sch, - definitions, - data: N.data, - parseName, - char: gen.name("c"), - } - - let sourceCode: string | undefined - try { - this._compilations.add(sch) - sch.parseName = parseName - parserFunction(cxt) - gen.optimize(this.opts.code.optimize) - const parseFuncCode = gen.toString() - sourceCode = `${gen.scopeRefs(N.scope)}return ${parseFuncCode}` - const makeParse = new Function(`${N.scope}`, sourceCode) - const parse: (json: string) => unknown = makeParse(this.scope.get()) - this.scope.value(parseName, {ref: parse}) - sch.parse = parse - } catch (e) { - if (sourceCode) this.logger.error("Error compiling parser, function code:", sourceCode) - delete sch.parse - delete sch.parseName - throw e - } finally { - this._compilations.delete(sch) - } - return sch -} - -const undef = _`undefined` - -function parserFunction(cxt: ParseCxt): void { - const {gen, parseName, char} = cxt - gen.func(parseName, _`${N.json}, ${N.jsonPos}, ${N.jsonPart}`, false, () => { - gen.let(N.data) - gen.let(char) - gen.assign(_`${parseName}.message`, undef) - gen.assign(_`${parseName}.position`, undef) - gen.assign(N.jsonPos, _`${N.jsonPos} || 0`) - gen.const(N.jsonLen, _`${N.json}.length`) - parseCode(cxt) - skipWhitespace(cxt) - gen.if(N.jsonPart, () => { - gen.assign(_`${parseName}.position`, N.jsonPos) - gen.return(N.data) - }) - gen.if(_`${N.jsonPos} === ${N.jsonLen}`, () => gen.return(N.data)) - jsonSyntaxError(cxt) - }) -} - -function parseCode(cxt: ParseCxt): void { - let form: JTDForm | undefined - for (const key of jtdForms) { - if (key in cxt.schema) { - form = key - break - } - } - if (form) parseNullable(cxt, genParse[form]) - else parseEmpty(cxt) -} - -const parseBoolean = parseBooleanToken(true, parseBooleanToken(false, jsonSyntaxError)) - -function parseNullable(cxt: ParseCxt, parseForm: GenParse): void { - const {gen, schema, data} = cxt - if (!schema.nullable) return parseForm(cxt) - tryParseToken(cxt, "null", parseForm, () => gen.assign(data, null)) -} - -function parseElements(cxt: ParseCxt): void { - const {gen, schema, data} = cxt - parseToken(cxt, "[") - const ix = gen.let("i", 0) - gen.assign(data, _`[]`) - parseItems(cxt, "]", () => { - const el = gen.let("el") - parseCode({...cxt, schema: schema.elements, data: el}) - gen.assign(_`${data}[${ix}++]`, el) - }) -} - -function parseValues(cxt: ParseCxt): void { - const {gen, schema, data} = cxt - parseToken(cxt, "{") - gen.assign(data, _`{}`) - parseItems(cxt, "}", () => parseKeyValue(cxt, schema.values)) -} - -function parseItems(cxt: ParseCxt, endToken: string, block: () => void): void { - tryParseItems(cxt, endToken, block) - parseToken(cxt, endToken) -} - -function tryParseItems(cxt: ParseCxt, endToken: string, block: () => void): void { - const {gen} = cxt - gen.for(_`;${N.jsonPos}<${N.jsonLen} && ${jsonSlice(1)}!==${endToken};`, () => { - block() - tryParseToken(cxt, ",", () => gen.break(), hasItem) - }) - - function hasItem(): void { - tryParseToken(cxt, endToken, () => {}, jsonSyntaxError) - } -} - -function parseKeyValue(cxt: ParseCxt, schema: SchemaObject): void { - const {gen} = cxt - const key = gen.let("key") - parseString({...cxt, data: key}) - parseToken(cxt, ":") - parsePropertyValue(cxt, key, schema) -} - -function parseDiscriminator(cxt: ParseCxt): void { - const {gen, data, schema} = cxt - const {discriminator, mapping} = schema - parseToken(cxt, "{") - gen.assign(data, _`{}`) - const startPos = gen.const("pos", N.jsonPos) - const value = gen.let("value") - const tag = gen.let("tag") - tryParseItems(cxt, "}", () => { - const key = gen.let("key") - parseString({...cxt, data: key}) - parseToken(cxt, ":") - gen.if( - _`${key} === ${discriminator}`, - () => { - parseString({...cxt, data: tag}) - gen.assign(_`${data}[${key}]`, tag) - gen.break() - }, - () => parseEmpty({...cxt, data: value}) // can be discarded/skipped - ) - }) - gen.assign(N.jsonPos, startPos) - gen.if(_`${tag} === undefined`) - parsingError(cxt, str`discriminator tag not found`) - for (const tagValue in mapping) { - gen.elseIf(_`${tag} === ${tagValue}`) - parseSchemaProperties({...cxt, schema: mapping[tagValue]}, discriminator) - } - gen.else() - parsingError(cxt, str`discriminator value not in schema`) - gen.endIf() -} - -function parseProperties(cxt: ParseCxt): void { - const {gen, data} = cxt - parseToken(cxt, "{") - gen.assign(data, _`{}`) - parseSchemaProperties(cxt) -} - -function parseSchemaProperties(cxt: ParseCxt, discriminator?: string): void { - const {gen, schema, data} = cxt - const {properties, optionalProperties, additionalProperties} = schema - parseItems(cxt, "}", () => { - const key = gen.let("key") - parseString({...cxt, data: key}) - parseToken(cxt, ":") - gen.if(false) - parseDefinedProperty(cxt, key, properties) - parseDefinedProperty(cxt, key, optionalProperties) - if (discriminator) { - gen.elseIf(_`${key} === ${discriminator}`) - const tag = gen.let("tag") - parseString({...cxt, data: tag}) // can be discarded, it is already assigned - } - gen.else() - if (additionalProperties) { - parseEmpty({...cxt, data: _`${data}[${key}]`}) - } else { - parsingError(cxt, str`property ${key} not allowed`) - } - gen.endIf() - }) - if (properties) { - const hasProp = hasPropFunc(gen) - const allProps: Code = and( - ...Object.keys(properties).map((p): Code => _`${hasProp}.call(${data}, ${p})`) - ) - gen.if(not(allProps), () => parsingError(cxt, str`missing required properties`)) - } -} - -function parseDefinedProperty(cxt: ParseCxt, key: Name, schemas: SchemaObjectMap = {}): void { - const {gen} = cxt - for (const prop in schemas) { - gen.elseIf(_`${key} === ${prop}`) - parsePropertyValue(cxt, key, schemas[prop] as SchemaObject) - } -} - -function parsePropertyValue(cxt: ParseCxt, key: Name, schema: SchemaObject): void { - parseCode({...cxt, schema, data: _`${cxt.data}[${key}]`}) -} - -function parseType(cxt: ParseCxt): void { - const {gen, schema, data, self} = cxt - switch (schema.type) { - case "boolean": - parseBoolean(cxt) - break - case "string": - parseString(cxt) - break - case "timestamp": { - parseString(cxt) - const vts = useFunc(gen, validTimestamp) - const {allowDate, parseDate} = self.opts - const notValid = allowDate ? _`!${vts}(${data}, true)` : _`!${vts}(${data})` - const fail: Code = parseDate - ? or(notValid, _`(${data} = new Date(${data}), false)`, _`isNaN(${data}.valueOf())`) - : notValid - gen.if(fail, () => parsingError(cxt, str`invalid timestamp`)) - break - } - case "float32": - case "float64": - parseNumber(cxt) - break - default: { - const t = schema.type as IntType - if (!self.opts.int32range && (t === "int32" || t === "uint32")) { - parseNumber(cxt, 16) // 2 ** 53 - max safe integer - if (t === "uint32") { - gen.if(_`${data} < 0`, () => parsingError(cxt, str`integer out of range`)) - } - } else { - const [min, max, maxDigits] = intRange[t] - parseNumber(cxt, maxDigits) - gen.if(_`${data} < ${min} || ${data} > ${max}`, () => - parsingError(cxt, str`integer out of range`) - ) - } - } - } -} - -function parseString(cxt: ParseCxt): void { - parseToken(cxt, '"') - parseWith(cxt, parseJsonString) -} - -function parseEnum(cxt: ParseCxt): void { - const {gen, data, schema} = cxt - const enumSch = schema.enum - parseToken(cxt, '"') - // TODO loopEnum - gen.if(false) - for (const value of enumSch) { - const valueStr = JSON.stringify(value).slice(1) // remove starting quote - gen.elseIf(_`${jsonSlice(valueStr.length)} === ${valueStr}`) - gen.assign(data, str`${value}`) - gen.add(N.jsonPos, valueStr.length) - } - gen.else() - jsonSyntaxError(cxt) - gen.endIf() -} - -function parseNumber(cxt: ParseCxt, maxDigits?: number): void { - const {gen} = cxt - skipWhitespace(cxt) - gen.if( - _`"-0123456789".indexOf(${jsonSlice(1)}) < 0`, - () => jsonSyntaxError(cxt), - () => parseWith(cxt, parseJsonNumber, maxDigits) - ) -} - -function parseBooleanToken(bool: boolean, fail: GenParse): GenParse { - return (cxt) => { - const {gen, data} = cxt - tryParseToken( - cxt, - `${bool}`, - () => fail(cxt), - () => gen.assign(data, bool) - ) - } -} - -function parseRef(cxt: ParseCxt): void { - const {gen, self, definitions, schema, schemaEnv} = cxt - const {ref} = schema - const refSchema = definitions[ref] - if (!refSchema) throw new MissingRefError(self.opts.uriResolver, "", ref, `No definition ${ref}`) - if (!hasRef(refSchema)) return parseCode({...cxt, schema: refSchema}) - const {root} = schemaEnv - const sch = compileParser.call(self, new SchemaEnv({schema: refSchema, root}), definitions) - partialParse(cxt, getParser(gen, sch), true) -} - -function getParser(gen: CodeGen, sch: SchemaEnv): Code { - return sch.parse - ? gen.scopeValue("parse", {ref: sch.parse}) - : _`${gen.scopeValue("wrapper", {ref: sch})}.parse` -} - -function parseEmpty(cxt: ParseCxt): void { - parseWith(cxt, parseJson) -} - -function parseWith(cxt: ParseCxt, parseFunc: {code: string}, args?: SafeExpr): void { - partialParse(cxt, useFunc(cxt.gen, parseFunc), args) -} - -function partialParse(cxt: ParseCxt, parseFunc: Name, args?: SafeExpr): void { - const {gen, data} = cxt - gen.assign(data, _`${parseFunc}(${N.json}, ${N.jsonPos}${args ? _`, ${args}` : nil})`) - gen.assign(N.jsonPos, _`${parseFunc}.position`) - gen.if(_`${data} === undefined`, () => parsingError(cxt, _`${parseFunc}.message`)) -} - -function parseToken(cxt: ParseCxt, tok: string): void { - tryParseToken(cxt, tok, jsonSyntaxError) -} - -function tryParseToken(cxt: ParseCxt, tok: string, fail: GenParse, success?: GenParse): void { - const {gen} = cxt - const n = tok.length - skipWhitespace(cxt) - gen.if( - _`${jsonSlice(n)} === ${tok}`, - () => { - gen.add(N.jsonPos, n) - success?.(cxt) - }, - () => fail(cxt) - ) -} - -function skipWhitespace({gen, char: c}: ParseCxt): void { - gen.code( - _`while((${c}=${N.json}[${N.jsonPos}],${c}===" "||${c}==="\\n"||${c}==="\\r"||${c}==="\\t"))${N.jsonPos}++;` - ) -} - -function jsonSlice(len: number | Name): Code { - return len === 1 - ? _`${N.json}[${N.jsonPos}]` - : _`${N.json}.slice(${N.jsonPos}, ${N.jsonPos}+${len})` -} - -function jsonSyntaxError(cxt: ParseCxt): void { - parsingError(cxt, _`"unexpected token " + ${N.json}[${N.jsonPos}]`) -} - -function parsingError({gen, parseName}: ParseCxt, msg: Code): void { - gen.assign(_`${parseName}.message`, msg) - gen.assign(_`${parseName}.position`, N.jsonPos) - gen.return(undef) -} diff --git a/node_modules/ajv/lib/compile/jtd/serialize.ts b/node_modules/ajv/lib/compile/jtd/serialize.ts deleted file mode 100644 index 1d22882..0000000 --- a/node_modules/ajv/lib/compile/jtd/serialize.ts +++ /dev/null @@ -1,266 +0,0 @@ -import type Ajv from "../../core" -import type {SchemaObject} from "../../types" -import {jtdForms, JTDForm, SchemaObjectMap} from "./types" -import {SchemaEnv, getCompilingSchema} from ".." -import {_, str, and, getProperty, CodeGen, Code, Name} from "../codegen" -import MissingRefError from "../ref_error" -import N from "../names" -import {isOwnProperty} from "../../vocabularies/code" -import {hasRef} from "../../vocabularies/jtd/ref" -import {useFunc} from "../util" -import quote from "../../runtime/quote" - -const genSerialize: {[F in JTDForm]: (cxt: SerializeCxt) => void} = { - elements: serializeElements, - values: serializeValues, - discriminator: serializeDiscriminator, - properties: serializeProperties, - optionalProperties: serializeProperties, - enum: serializeString, - type: serializeType, - ref: serializeRef, -} - -interface SerializeCxt { - readonly gen: CodeGen - readonly self: Ajv // current Ajv instance - readonly schemaEnv: SchemaEnv - readonly definitions: SchemaObjectMap - schema: SchemaObject - data: Code -} - -export default function compileSerializer( - this: Ajv, - sch: SchemaEnv, - definitions: SchemaObjectMap -): SchemaEnv { - const _sch = getCompilingSchema.call(this, sch) - if (_sch) return _sch - const {es5, lines} = this.opts.code - const {ownProperties} = this.opts - const gen = new CodeGen(this.scope, {es5, lines, ownProperties}) - const serializeName = gen.scopeName("serialize") - const cxt: SerializeCxt = { - self: this, - gen, - schema: sch.schema as SchemaObject, - schemaEnv: sch, - definitions, - data: N.data, - } - - let sourceCode: string | undefined - try { - this._compilations.add(sch) - sch.serializeName = serializeName - gen.func(serializeName, N.data, false, () => { - gen.let(N.json, str``) - serializeCode(cxt) - gen.return(N.json) - }) - gen.optimize(this.opts.code.optimize) - const serializeFuncCode = gen.toString() - sourceCode = `${gen.scopeRefs(N.scope)}return ${serializeFuncCode}` - const makeSerialize = new Function(`${N.scope}`, sourceCode) - const serialize: (data: unknown) => string = makeSerialize(this.scope.get()) - this.scope.value(serializeName, {ref: serialize}) - sch.serialize = serialize - } catch (e) { - if (sourceCode) this.logger.error("Error compiling serializer, function code:", sourceCode) - delete sch.serialize - delete sch.serializeName - throw e - } finally { - this._compilations.delete(sch) - } - return sch -} - -function serializeCode(cxt: SerializeCxt): void { - let form: JTDForm | undefined - for (const key of jtdForms) { - if (key in cxt.schema) { - form = key - break - } - } - serializeNullable(cxt, form ? genSerialize[form] : serializeEmpty) -} - -function serializeNullable(cxt: SerializeCxt, serializeForm: (_cxt: SerializeCxt) => void): void { - const {gen, schema, data} = cxt - if (!schema.nullable) return serializeForm(cxt) - gen.if( - _`${data} === undefined || ${data} === null`, - () => gen.add(N.json, _`"null"`), - () => serializeForm(cxt) - ) -} - -function serializeElements(cxt: SerializeCxt): void { - const {gen, schema, data} = cxt - gen.add(N.json, str`[`) - const first = gen.let("first", true) - gen.forOf("el", data, (el) => { - addComma(cxt, first) - serializeCode({...cxt, schema: schema.elements, data: el}) - }) - gen.add(N.json, str`]`) -} - -function serializeValues(cxt: SerializeCxt): void { - const {gen, schema, data} = cxt - gen.add(N.json, str`{`) - const first = gen.let("first", true) - gen.forIn("key", data, (key) => serializeKeyValue(cxt, key, schema.values, first)) - gen.add(N.json, str`}`) -} - -function serializeKeyValue(cxt: SerializeCxt, key: Name, schema: SchemaObject, first?: Name): void { - const {gen, data} = cxt - addComma(cxt, first) - serializeString({...cxt, data: key}) - gen.add(N.json, str`:`) - const value = gen.const("value", _`${data}${getProperty(key)}`) - serializeCode({...cxt, schema, data: value}) -} - -function serializeDiscriminator(cxt: SerializeCxt): void { - const {gen, schema, data} = cxt - const {discriminator} = schema - gen.add(N.json, str`{${JSON.stringify(discriminator)}:`) - const tag = gen.const("tag", _`${data}${getProperty(discriminator)}`) - serializeString({...cxt, data: tag}) - gen.if(false) - for (const tagValue in schema.mapping) { - gen.elseIf(_`${tag} === ${tagValue}`) - const sch = schema.mapping[tagValue] - serializeSchemaProperties({...cxt, schema: sch}, discriminator) - } - gen.endIf() - gen.add(N.json, str`}`) -} - -function serializeProperties(cxt: SerializeCxt): void { - const {gen} = cxt - gen.add(N.json, str`{`) - serializeSchemaProperties(cxt) - gen.add(N.json, str`}`) -} - -function serializeSchemaProperties(cxt: SerializeCxt, discriminator?: string): void { - const {gen, schema, data} = cxt - const {properties, optionalProperties} = schema - const props = keys(properties) - const optProps = keys(optionalProperties) - const allProps = allProperties(props.concat(optProps)) - let first = !discriminator - let firstProp: Name | undefined - - for (const key of props) { - if (first) first = false - else gen.add(N.json, str`,`) - serializeProperty(key, properties[key], keyValue(key)) - } - if (first) firstProp = gen.let("first", true) - for (const key of optProps) { - const value = keyValue(key) - gen.if(and(_`${value} !== undefined`, isOwnProperty(gen, data, key)), () => { - addComma(cxt, firstProp) - serializeProperty(key, optionalProperties[key], value) - }) - } - if (schema.additionalProperties) { - gen.forIn("key", data, (key) => - gen.if(isAdditional(key, allProps), () => serializeKeyValue(cxt, key, {}, firstProp)) - ) - } - - function keys(ps?: SchemaObjectMap): string[] { - return ps ? Object.keys(ps) : [] - } - - function allProperties(ps: string[]): string[] { - if (discriminator) ps.push(discriminator) - if (new Set(ps).size !== ps.length) { - throw new Error("JTD: properties/optionalProperties/disciminator overlap") - } - return ps - } - - function keyValue(key: string): Name { - return gen.const("value", _`${data}${getProperty(key)}`) - } - - function serializeProperty(key: string, propSchema: SchemaObject, value: Name): void { - gen.add(N.json, str`${JSON.stringify(key)}:`) - serializeCode({...cxt, schema: propSchema, data: value}) - } - - function isAdditional(key: Name, ps: string[]): Code | true { - return ps.length ? and(...ps.map((p) => _`${key} !== ${p}`)) : true - } -} - -function serializeType(cxt: SerializeCxt): void { - const {gen, schema, data} = cxt - switch (schema.type) { - case "boolean": - gen.add(N.json, _`${data} ? "true" : "false"`) - break - case "string": - serializeString(cxt) - break - case "timestamp": - gen.if( - _`${data} instanceof Date`, - () => gen.add(N.json, _`'"' + ${data}.toISOString() + '"'`), - () => serializeString(cxt) - ) - break - default: - serializeNumber(cxt) - } -} - -function serializeString({gen, data}: SerializeCxt): void { - gen.add(N.json, _`${useFunc(gen, quote)}(${data})`) -} - -function serializeNumber({gen, data}: SerializeCxt): void { - gen.add(N.json, _`"" + ${data}`) -} - -function serializeRef(cxt: SerializeCxt): void { - const {gen, self, data, definitions, schema, schemaEnv} = cxt - const {ref} = schema - const refSchema = definitions[ref] - if (!refSchema) throw new MissingRefError(self.opts.uriResolver, "", ref, `No definition ${ref}`) - if (!hasRef(refSchema)) return serializeCode({...cxt, schema: refSchema}) - const {root} = schemaEnv - const sch = compileSerializer.call(self, new SchemaEnv({schema: refSchema, root}), definitions) - gen.add(N.json, _`${getSerialize(gen, sch)}(${data})`) -} - -function getSerialize(gen: CodeGen, sch: SchemaEnv): Code { - return sch.serialize - ? gen.scopeValue("serialize", {ref: sch.serialize}) - : _`${gen.scopeValue("wrapper", {ref: sch})}.serialize` -} - -function serializeEmpty({gen, data}: SerializeCxt): void { - gen.add(N.json, _`JSON.stringify(${data})`) -} - -function addComma({gen}: SerializeCxt, first?: Name): void { - if (first) { - gen.if( - first, - () => gen.assign(first, false), - () => gen.add(N.json, str`,`) - ) - } else { - gen.add(N.json, str`,`) - } -} diff --git a/node_modules/ajv/lib/compile/jtd/types.ts b/node_modules/ajv/lib/compile/jtd/types.ts deleted file mode 100644 index 1258050..0000000 --- a/node_modules/ajv/lib/compile/jtd/types.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type {SchemaObject} from "../../types" - -export type SchemaObjectMap = {[Ref in string]?: SchemaObject} - -export const jtdForms = [ - "elements", - "values", - "discriminator", - "properties", - "optionalProperties", - "enum", - "type", - "ref", -] as const - -export type JTDForm = (typeof jtdForms)[number] diff --git a/node_modules/ajv/lib/compile/names.ts b/node_modules/ajv/lib/compile/names.ts deleted file mode 100644 index b4b242e..0000000 --- a/node_modules/ajv/lib/compile/names.ts +++ /dev/null @@ -1,27 +0,0 @@ -import {Name} from "./codegen" - -const names = { - // validation function arguments - data: new Name("data"), // data passed to validation function - // args passed from referencing schema - valCxt: new Name("valCxt"), // validation/data context - should not be used directly, it is destructured to the names below - instancePath: new Name("instancePath"), - parentData: new Name("parentData"), - parentDataProperty: new Name("parentDataProperty"), - rootData: new Name("rootData"), // root data - same as the data passed to the first/top validation function - dynamicAnchors: new Name("dynamicAnchors"), // used to support recursiveRef and dynamicRef - // function scoped variables - vErrors: new Name("vErrors"), // null or array of validation errors - errors: new Name("errors"), // counter of validation errors - this: new Name("this"), - // "globals" - self: new Name("self"), - scope: new Name("scope"), - // JTD serialize/parse name for JSON string and position - json: new Name("json"), - jsonPos: new Name("jsonPos"), - jsonLen: new Name("jsonLen"), - jsonPart: new Name("jsonPart"), -} - -export default names diff --git a/node_modules/ajv/lib/compile/ref_error.ts b/node_modules/ajv/lib/compile/ref_error.ts deleted file mode 100644 index 386bf04..0000000 --- a/node_modules/ajv/lib/compile/ref_error.ts +++ /dev/null @@ -1,13 +0,0 @@ -import {resolveUrl, normalizeId, getFullPath} from "./resolve" -import type {UriResolver} from "../types" - -export default class MissingRefError extends Error { - readonly missingRef: string - readonly missingSchema: string - - constructor(resolver: UriResolver, baseId: string, ref: string, msg?: string) { - super(msg || `can't resolve reference ${ref} from id ${baseId}`) - this.missingRef = resolveUrl(resolver, baseId, ref) - this.missingSchema = normalizeId(getFullPath(resolver, this.missingRef)) - } -} diff --git a/node_modules/ajv/lib/compile/resolve.ts b/node_modules/ajv/lib/compile/resolve.ts deleted file mode 100644 index b8c4aca..0000000 --- a/node_modules/ajv/lib/compile/resolve.ts +++ /dev/null @@ -1,149 +0,0 @@ -import type {AnySchema, AnySchemaObject, UriResolver} from "../types" -import type Ajv from "../ajv" -import type {URIComponent} from "fast-uri" -import {eachItem} from "./util" -import * as equal from "fast-deep-equal" -import * as traverse from "json-schema-traverse" - -// the hash of local references inside the schema (created by getSchemaRefs), used for inline resolution -export type LocalRefs = {[Ref in string]?: AnySchemaObject} - -// TODO refactor to use keyword definitions -const SIMPLE_INLINED = new Set([ - "type", - "format", - "pattern", - "maxLength", - "minLength", - "maxProperties", - "minProperties", - "maxItems", - "minItems", - "maximum", - "minimum", - "uniqueItems", - "multipleOf", - "required", - "enum", - "const", -]) - -export function inlineRef(schema: AnySchema, limit: boolean | number = true): boolean { - if (typeof schema == "boolean") return true - if (limit === true) return !hasRef(schema) - if (!limit) return false - return countKeys(schema) <= limit -} - -const REF_KEYWORDS = new Set([ - "$ref", - "$recursiveRef", - "$recursiveAnchor", - "$dynamicRef", - "$dynamicAnchor", -]) - -function hasRef(schema: AnySchemaObject): boolean { - for (const key in schema) { - if (REF_KEYWORDS.has(key)) return true - const sch = schema[key] - if (Array.isArray(sch) && sch.some(hasRef)) return true - if (typeof sch == "object" && hasRef(sch)) return true - } - return false -} - -function countKeys(schema: AnySchemaObject): number { - let count = 0 - for (const key in schema) { - if (key === "$ref") return Infinity - count++ - if (SIMPLE_INLINED.has(key)) continue - if (typeof schema[key] == "object") { - eachItem(schema[key], (sch) => (count += countKeys(sch))) - } - if (count === Infinity) return Infinity - } - return count -} - -export function getFullPath(resolver: UriResolver, id = "", normalize?: boolean): string { - if (normalize !== false) id = normalizeId(id) - const p = resolver.parse(id) - return _getFullPath(resolver, p) -} - -export function _getFullPath(resolver: UriResolver, p: URIComponent): string { - const serialized = resolver.serialize(p) - return serialized.split("#")[0] + "#" -} - -const TRAILING_SLASH_HASH = /#\/?$/ -export function normalizeId(id: string | undefined): string { - return id ? id.replace(TRAILING_SLASH_HASH, "") : "" -} - -export function resolveUrl(resolver: UriResolver, baseId: string, id: string): string { - id = normalizeId(id) - return resolver.resolve(baseId, id) -} - -const ANCHOR = /^[a-z_][-a-z0-9._]*$/i - -export function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): LocalRefs { - if (typeof schema == "boolean") return {} - const {schemaId, uriResolver} = this.opts - const schId = normalizeId(schema[schemaId] || baseId) - const baseIds: {[JsonPtr in string]?: string} = {"": schId} - const pathPrefix = getFullPath(uriResolver, schId, false) - const localRefs: LocalRefs = {} - const schemaRefs: Set = new Set() - - traverse(schema, {allKeys: true}, (sch, jsonPtr, _, parentJsonPtr) => { - if (parentJsonPtr === undefined) return - const fullPath = pathPrefix + jsonPtr - let innerBaseId = baseIds[parentJsonPtr] - if (typeof sch[schemaId] == "string") innerBaseId = addRef.call(this, sch[schemaId]) - addAnchor.call(this, sch.$anchor) - addAnchor.call(this, sch.$dynamicAnchor) - baseIds[jsonPtr] = innerBaseId - - function addRef(this: Ajv, ref: string): string { - // eslint-disable-next-line @typescript-eslint/unbound-method - const _resolve = this.opts.uriResolver.resolve - ref = normalizeId(innerBaseId ? _resolve(innerBaseId, ref) : ref) - if (schemaRefs.has(ref)) throw ambiguos(ref) - schemaRefs.add(ref) - let schOrRef = this.refs[ref] - if (typeof schOrRef == "string") schOrRef = this.refs[schOrRef] - if (typeof schOrRef == "object") { - checkAmbiguosRef(sch, schOrRef.schema, ref) - } else if (ref !== normalizeId(fullPath)) { - if (ref[0] === "#") { - checkAmbiguosRef(sch, localRefs[ref], ref) - localRefs[ref] = sch - } else { - this.refs[ref] = fullPath - } - } - return ref - } - - function addAnchor(this: Ajv, anchor: unknown): void { - if (typeof anchor == "string") { - if (!ANCHOR.test(anchor)) throw new Error(`invalid anchor "${anchor}"`) - addRef.call(this, `#${anchor}`) - } - } - }) - - return localRefs - - function checkAmbiguosRef(sch1: AnySchema, sch2: AnySchema | undefined, ref: string): void { - if (sch2 !== undefined && !equal(sch1, sch2)) throw ambiguos(ref) - } - - function ambiguos(ref: string): Error { - return new Error(`reference "${ref}" resolves to more than one schema`) - } -} diff --git a/node_modules/ajv/lib/compile/rules.ts b/node_modules/ajv/lib/compile/rules.ts deleted file mode 100644 index 7dbf7ab..0000000 --- a/node_modules/ajv/lib/compile/rules.ts +++ /dev/null @@ -1,50 +0,0 @@ -import type {AddedKeywordDefinition} from "../types" - -const _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array"] as const - -export type JSONType = (typeof _jsonTypes)[number] - -const jsonTypes: Set = new Set(_jsonTypes) - -export function isJSONType(x: unknown): x is JSONType { - return typeof x == "string" && jsonTypes.has(x) -} - -type ValidationTypes = { - [K in JSONType]: boolean | RuleGroup | undefined -} - -export interface ValidationRules { - rules: RuleGroup[] - post: RuleGroup - all: {[Key in string]?: boolean | Rule} // rules that have to be validated - keywords: {[Key in string]?: boolean} // all known keywords (superset of "all") - types: ValidationTypes -} - -export interface RuleGroup { - type?: JSONType - rules: Rule[] -} - -// This interface wraps KeywordDefinition because definition can have multiple keywords -export interface Rule { - keyword: string - definition: AddedKeywordDefinition -} - -export function getRules(): ValidationRules { - const groups: Record<"number" | "string" | "array" | "object", RuleGroup> = { - number: {type: "number", rules: []}, - string: {type: "string", rules: []}, - array: {type: "array", rules: []}, - object: {type: "object", rules: []}, - } - return { - types: {...groups, integer: true, boolean: true, null: true}, - rules: [{rules: []}, groups.number, groups.string, groups.array, groups.object], - post: {rules: []}, - all: {}, - keywords: {}, - } -} diff --git a/node_modules/ajv/lib/compile/util.ts b/node_modules/ajv/lib/compile/util.ts deleted file mode 100644 index cefae51..0000000 --- a/node_modules/ajv/lib/compile/util.ts +++ /dev/null @@ -1,213 +0,0 @@ -import type {AnySchema, EvaluatedProperties, EvaluatedItems} from "../types" -import type {SchemaCxt, SchemaObjCxt} from "." -import {_, getProperty, Code, Name, CodeGen} from "./codegen" -import {_Code} from "./codegen/code" -import type {Rule, ValidationRules} from "./rules" - -// TODO refactor to use Set -export function toHash(arr: T[]): {[K in T]?: true} { - const hash: {[K in T]?: true} = {} - for (const item of arr) hash[item] = true - return hash -} - -export function alwaysValidSchema(it: SchemaCxt, schema: AnySchema): boolean | void { - if (typeof schema == "boolean") return schema - if (Object.keys(schema).length === 0) return true - checkUnknownRules(it, schema) - return !schemaHasRules(schema, it.self.RULES.all) -} - -export function checkUnknownRules(it: SchemaCxt, schema: AnySchema = it.schema): void { - const {opts, self} = it - if (!opts.strictSchema) return - if (typeof schema === "boolean") return - const rules = self.RULES.keywords - for (const key in schema) { - if (!rules[key]) checkStrictMode(it, `unknown keyword: "${key}"`) - } -} - -export function schemaHasRules( - schema: AnySchema, - rules: {[Key in string]?: boolean | Rule} -): boolean { - if (typeof schema == "boolean") return !schema - for (const key in schema) if (rules[key]) return true - return false -} - -export function schemaHasRulesButRef(schema: AnySchema, RULES: ValidationRules): boolean { - if (typeof schema == "boolean") return !schema - for (const key in schema) if (key !== "$ref" && RULES.all[key]) return true - return false -} - -export function schemaRefOrVal( - {topSchemaRef, schemaPath}: SchemaObjCxt, - schema: unknown, - keyword: string, - $data?: string | false -): Code | number | boolean { - if (!$data) { - if (typeof schema == "number" || typeof schema == "boolean") return schema - if (typeof schema == "string") return _`${schema}` - } - return _`${topSchemaRef}${schemaPath}${getProperty(keyword)}` -} - -export function unescapeFragment(str: string): string { - return unescapeJsonPointer(decodeURIComponent(str)) -} - -export function escapeFragment(str: string | number): string { - return encodeURIComponent(escapeJsonPointer(str)) -} - -export function escapeJsonPointer(str: string | number): string { - if (typeof str == "number") return `${str}` - return str.replace(/~/g, "~0").replace(/\//g, "~1") -} - -export function unescapeJsonPointer(str: string): string { - return str.replace(/~1/g, "/").replace(/~0/g, "~") -} - -export function eachItem(xs: T | T[], f: (x: T) => void): void { - if (Array.isArray(xs)) { - for (const x of xs) f(x) - } else { - f(xs) - } -} - -type SomeEvaluated = EvaluatedProperties | EvaluatedItems - -type MergeEvaluatedFunc = ( - gen: CodeGen, - from: Name | T, - to: Name | Exclude | undefined, - toName?: typeof Name -) => Name | T - -interface MakeMergeFuncArgs { - mergeNames: (gen: CodeGen, from: Name, to: Name) => void - mergeToName: (gen: CodeGen, from: T, to: Name) => void - mergeValues: (from: T, to: Exclude) => T - resultToName: (gen: CodeGen, res?: T) => Name -} - -function makeMergeEvaluated({ - mergeNames, - mergeToName, - mergeValues, - resultToName, -}: MakeMergeFuncArgs): MergeEvaluatedFunc { - return (gen, from, to, toName) => { - const res = - to === undefined - ? from - : to instanceof Name - ? (from instanceof Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) - : from instanceof Name - ? (mergeToName(gen, to, from), from) - : mergeValues(from, to) - return toName === Name && !(res instanceof Name) ? resultToName(gen, res) : res - } -} - -interface MergeEvaluated { - props: MergeEvaluatedFunc - items: MergeEvaluatedFunc -} - -export const mergeEvaluated: MergeEvaluated = { - props: makeMergeEvaluated({ - mergeNames: (gen, from, to) => - gen.if(_`${to} !== true && ${from} !== undefined`, () => { - gen.if( - _`${from} === true`, - () => gen.assign(to, true), - () => gen.assign(to, _`${to} || {}`).code(_`Object.assign(${to}, ${from})`) - ) - }), - mergeToName: (gen, from, to) => - gen.if(_`${to} !== true`, () => { - if (from === true) { - gen.assign(to, true) - } else { - gen.assign(to, _`${to} || {}`) - setEvaluated(gen, to, from) - } - }), - mergeValues: (from, to) => (from === true ? true : {...from, ...to}), - resultToName: evaluatedPropsToName, - }), - items: makeMergeEvaluated({ - mergeNames: (gen, from, to) => - gen.if(_`${to} !== true && ${from} !== undefined`, () => - gen.assign(to, _`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`) - ), - mergeToName: (gen, from, to) => - gen.if(_`${to} !== true`, () => - gen.assign(to, from === true ? true : _`${to} > ${from} ? ${to} : ${from}`) - ), - mergeValues: (from, to) => (from === true ? true : Math.max(from, to)), - resultToName: (gen, items) => gen.var("items", items), - }), -} - -export function evaluatedPropsToName(gen: CodeGen, ps?: EvaluatedProperties): Name { - if (ps === true) return gen.var("props", true) - const props = gen.var("props", _`{}`) - if (ps !== undefined) setEvaluated(gen, props, ps) - return props -} - -export function setEvaluated(gen: CodeGen, props: Name, ps: {[K in string]?: true}): void { - Object.keys(ps).forEach((p) => gen.assign(_`${props}${getProperty(p)}`, true)) -} - -const snippets: {[S in string]?: _Code} = {} - -export function useFunc(gen: CodeGen, f: {code: string}): Name { - return gen.scopeValue("func", { - ref: f, - code: snippets[f.code] || (snippets[f.code] = new _Code(f.code)), - }) -} - -export enum Type { - Num, - Str, -} - -export function getErrorPath( - dataProp: Name | string | number, - dataPropType?: Type, - jsPropertySyntax?: boolean -): Code | string { - // let path - if (dataProp instanceof Name) { - const isNumber = dataPropType === Type.Num - return jsPropertySyntax - ? isNumber - ? _`"[" + ${dataProp} + "]"` - : _`"['" + ${dataProp} + "']"` - : isNumber - ? _`"/" + ${dataProp}` - : _`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")` // TODO maybe use global escapePointer - } - return jsPropertySyntax ? getProperty(dataProp).toString() : "/" + escapeJsonPointer(dataProp) -} - -export function checkStrictMode( - it: SchemaCxt, - msg: string, - mode: boolean | "log" = it.opts.strictSchema -): void { - if (!mode) return - msg = `strict mode: ${msg}` - if (mode === true) throw new Error(msg) - it.self.logger.warn(msg) -} diff --git a/node_modules/ajv/lib/compile/validate/applicability.ts b/node_modules/ajv/lib/compile/validate/applicability.ts deleted file mode 100644 index 478b704..0000000 --- a/node_modules/ajv/lib/compile/validate/applicability.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type {AnySchemaObject} from "../../types" -import type {SchemaObjCxt} from ".." -import type {JSONType, RuleGroup, Rule} from "../rules" - -export function schemaHasRulesForType( - {schema, self}: SchemaObjCxt, - type: JSONType -): boolean | undefined { - const group = self.RULES.types[type] - return group && group !== true && shouldUseGroup(schema, group) -} - -export function shouldUseGroup(schema: AnySchemaObject, group: RuleGroup): boolean { - return group.rules.some((rule) => shouldUseRule(schema, rule)) -} - -export function shouldUseRule(schema: AnySchemaObject, rule: Rule): boolean | undefined { - return ( - schema[rule.keyword] !== undefined || - rule.definition.implements?.some((kwd) => schema[kwd] !== undefined) - ) -} diff --git a/node_modules/ajv/lib/compile/validate/boolSchema.ts b/node_modules/ajv/lib/compile/validate/boolSchema.ts deleted file mode 100644 index 1563550..0000000 --- a/node_modules/ajv/lib/compile/validate/boolSchema.ts +++ /dev/null @@ -1,47 +0,0 @@ -import type {KeywordErrorDefinition, KeywordErrorCxt} from "../../types" -import type {SchemaCxt} from ".." -import {reportError} from "../errors" -import {_, Name} from "../codegen" -import N from "../names" - -const boolError: KeywordErrorDefinition = { - message: "boolean schema is false", -} - -export function topBoolOrEmptySchema(it: SchemaCxt): void { - const {gen, schema, validateName} = it - if (schema === false) { - falseSchemaError(it, false) - } else if (typeof schema == "object" && schema.$async === true) { - gen.return(N.data) - } else { - gen.assign(_`${validateName}.errors`, null) - gen.return(true) - } -} - -export function boolOrEmptySchema(it: SchemaCxt, valid: Name): void { - const {gen, schema} = it - if (schema === false) { - gen.var(valid, false) // TODO var - falseSchemaError(it) - } else { - gen.var(valid, true) // TODO var - } -} - -function falseSchemaError(it: SchemaCxt, overrideAllErrors?: boolean): void { - const {gen, data} = it - // TODO maybe some other interface should be used for non-keyword validation errors... - const cxt: KeywordErrorCxt = { - gen, - keyword: "false schema", - data, - schema: false, - schemaCode: false, - schemaValue: false, - params: {}, - it, - } - reportError(cxt, boolError, undefined, overrideAllErrors) -} diff --git a/node_modules/ajv/lib/compile/validate/dataType.ts b/node_modules/ajv/lib/compile/validate/dataType.ts deleted file mode 100644 index d8142b3..0000000 --- a/node_modules/ajv/lib/compile/validate/dataType.ts +++ /dev/null @@ -1,230 +0,0 @@ -import type { - KeywordErrorDefinition, - KeywordErrorCxt, - ErrorObject, - AnySchemaObject, -} from "../../types" -import type {SchemaObjCxt} from ".." -import {isJSONType, JSONType} from "../rules" -import {schemaHasRulesForType} from "./applicability" -import {reportError} from "../errors" -import {_, nil, and, not, operators, Code, Name} from "../codegen" -import {toHash, schemaRefOrVal} from "../util" - -export enum DataType { - Correct, - Wrong, -} - -export function getSchemaTypes(schema: AnySchemaObject): JSONType[] { - const types = getJSONTypes(schema.type) - const hasNull = types.includes("null") - if (hasNull) { - if (schema.nullable === false) throw new Error("type: null contradicts nullable: false") - } else { - if (!types.length && schema.nullable !== undefined) { - throw new Error('"nullable" cannot be used without "type"') - } - if (schema.nullable === true) types.push("null") - } - return types -} - -// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents -export function getJSONTypes(ts: unknown | unknown[]): JSONType[] { - const types: unknown[] = Array.isArray(ts) ? ts : ts ? [ts] : [] - if (types.every(isJSONType)) return types - throw new Error("type must be JSONType or JSONType[]: " + types.join(",")) -} - -export function coerceAndCheckDataType(it: SchemaObjCxt, types: JSONType[]): boolean { - const {gen, data, opts} = it - const coerceTo = coerceToTypes(types, opts.coerceTypes) - const checkTypes = - types.length > 0 && - !(coerceTo.length === 0 && types.length === 1 && schemaHasRulesForType(it, types[0])) - if (checkTypes) { - const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong) - gen.if(wrongType, () => { - if (coerceTo.length) coerceData(it, types, coerceTo) - else reportTypeError(it) - }) - } - return checkTypes -} - -const COERCIBLE: Set = new Set(["string", "number", "integer", "boolean", "null"]) -function coerceToTypes(types: JSONType[], coerceTypes?: boolean | "array"): JSONType[] { - return coerceTypes - ? types.filter((t) => COERCIBLE.has(t) || (coerceTypes === "array" && t === "array")) - : [] -} - -function coerceData(it: SchemaObjCxt, types: JSONType[], coerceTo: JSONType[]): void { - const {gen, data, opts} = it - const dataType = gen.let("dataType", _`typeof ${data}`) - const coerced = gen.let("coerced", _`undefined`) - if (opts.coerceTypes === "array") { - gen.if(_`${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => - gen - .assign(data, _`${data}[0]`) - .assign(dataType, _`typeof ${data}`) - .if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data)) - ) - } - gen.if(_`${coerced} !== undefined`) - for (const t of coerceTo) { - if (COERCIBLE.has(t) || (t === "array" && opts.coerceTypes === "array")) { - coerceSpecificType(t) - } - } - gen.else() - reportTypeError(it) - gen.endIf() - - gen.if(_`${coerced} !== undefined`, () => { - gen.assign(data, coerced) - assignParentData(it, coerced) - }) - - function coerceSpecificType(t: string): void { - switch (t) { - case "string": - gen - .elseIf(_`${dataType} == "number" || ${dataType} == "boolean"`) - .assign(coerced, _`"" + ${data}`) - .elseIf(_`${data} === null`) - .assign(coerced, _`""`) - return - case "number": - gen - .elseIf( - _`${dataType} == "boolean" || ${data} === null - || (${dataType} == "string" && ${data} && ${data} == +${data})` - ) - .assign(coerced, _`+${data}`) - return - case "integer": - gen - .elseIf( - _`${dataType} === "boolean" || ${data} === null - || (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))` - ) - .assign(coerced, _`+${data}`) - return - case "boolean": - gen - .elseIf(_`${data} === "false" || ${data} === 0 || ${data} === null`) - .assign(coerced, false) - .elseIf(_`${data} === "true" || ${data} === 1`) - .assign(coerced, true) - return - case "null": - gen.elseIf(_`${data} === "" || ${data} === 0 || ${data} === false`) - gen.assign(coerced, null) - return - - case "array": - gen - .elseIf( - _`${dataType} === "string" || ${dataType} === "number" - || ${dataType} === "boolean" || ${data} === null` - ) - .assign(coerced, _`[${data}]`) - } - } -} - -function assignParentData({gen, parentData, parentDataProperty}: SchemaObjCxt, expr: Name): void { - // TODO use gen.property - gen.if(_`${parentData} !== undefined`, () => - gen.assign(_`${parentData}[${parentDataProperty}]`, expr) - ) -} - -export function checkDataType( - dataType: JSONType, - data: Name, - strictNums?: boolean | "log", - correct = DataType.Correct -): Code { - const EQ = correct === DataType.Correct ? operators.EQ : operators.NEQ - let cond: Code - switch (dataType) { - case "null": - return _`${data} ${EQ} null` - case "array": - cond = _`Array.isArray(${data})` - break - case "object": - cond = _`${data} && typeof ${data} == "object" && !Array.isArray(${data})` - break - case "integer": - cond = numCond(_`!(${data} % 1) && !isNaN(${data})`) - break - case "number": - cond = numCond() - break - default: - return _`typeof ${data} ${EQ} ${dataType}` - } - return correct === DataType.Correct ? cond : not(cond) - - function numCond(_cond: Code = nil): Code { - return and(_`typeof ${data} == "number"`, _cond, strictNums ? _`isFinite(${data})` : nil) - } -} - -export function checkDataTypes( - dataTypes: JSONType[], - data: Name, - strictNums?: boolean | "log", - correct?: DataType -): Code { - if (dataTypes.length === 1) { - return checkDataType(dataTypes[0], data, strictNums, correct) - } - let cond: Code - const types = toHash(dataTypes) - if (types.array && types.object) { - const notObj = _`typeof ${data} != "object"` - cond = types.null ? notObj : _`!${data} || ${notObj}` - delete types.null - delete types.array - delete types.object - } else { - cond = nil - } - if (types.number) delete types.integer - for (const t in types) cond = and(cond, checkDataType(t as JSONType, data, strictNums, correct)) - return cond -} - -export type TypeError = ErrorObject<"type", {type: string}> - -const typeError: KeywordErrorDefinition = { - message: ({schema}) => `must be ${schema}`, - params: ({schema, schemaValue}) => - typeof schema == "string" ? _`{type: ${schema}}` : _`{type: ${schemaValue}}`, -} - -export function reportTypeError(it: SchemaObjCxt): void { - const cxt = getTypeErrorContext(it) - reportError(cxt, typeError) -} - -function getTypeErrorContext(it: SchemaObjCxt): KeywordErrorCxt { - const {gen, data, schema} = it - const schemaCode = schemaRefOrVal(it, schema, "type") - return { - gen, - keyword: "type", - data, - schema: schema.type, - schemaCode, - schemaValue: schemaCode, - parentSchema: schema, - params: {}, - it, - } -} diff --git a/node_modules/ajv/lib/compile/validate/defaults.ts b/node_modules/ajv/lib/compile/validate/defaults.ts deleted file mode 100644 index 2ad3d4d..0000000 --- a/node_modules/ajv/lib/compile/validate/defaults.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type {SchemaObjCxt} from ".." -import {_, getProperty, stringify} from "../codegen" -import {checkStrictMode} from "../util" - -export function assignDefaults(it: SchemaObjCxt, ty?: string): void { - const {properties, items} = it.schema - if (ty === "object" && properties) { - for (const key in properties) { - assignDefault(it, key, properties[key].default) - } - } else if (ty === "array" && Array.isArray(items)) { - items.forEach((sch, i: number) => assignDefault(it, i, sch.default)) - } -} - -function assignDefault(it: SchemaObjCxt, prop: string | number, defaultValue: unknown): void { - const {gen, compositeRule, data, opts} = it - if (defaultValue === undefined) return - const childData = _`${data}${getProperty(prop)}` - if (compositeRule) { - checkStrictMode(it, `default is ignored for: ${childData}`) - return - } - - let condition = _`${childData} === undefined` - if (opts.useDefaults === "empty") { - condition = _`${condition} || ${childData} === null || ${childData} === ""` - } - // `${childData} === undefined` + - // (opts.useDefaults === "empty" ? ` || ${childData} === null || ${childData} === ""` : "") - gen.if(condition, _`${childData} = ${stringify(defaultValue)}`) -} diff --git a/node_modules/ajv/lib/compile/validate/index.ts b/node_modules/ajv/lib/compile/validate/index.ts deleted file mode 100644 index 15ecabd..0000000 --- a/node_modules/ajv/lib/compile/validate/index.ts +++ /dev/null @@ -1,582 +0,0 @@ -import type { - AddedKeywordDefinition, - AnySchema, - AnySchemaObject, - KeywordErrorCxt, - KeywordCxtParams, -} from "../../types" -import type {SchemaCxt, SchemaObjCxt} from ".." -import type {InstanceOptions} from "../../core" -import {boolOrEmptySchema, topBoolOrEmptySchema} from "./boolSchema" -import {coerceAndCheckDataType, getSchemaTypes} from "./dataType" -import {shouldUseGroup, shouldUseRule} from "./applicability" -import {checkDataType, checkDataTypes, reportTypeError, DataType} from "./dataType" -import {assignDefaults} from "./defaults" -import {funcKeywordCode, macroKeywordCode, validateKeywordUsage, validSchemaType} from "./keyword" -import {getSubschema, extendSubschemaData, SubschemaArgs, extendSubschemaMode} from "./subschema" -import {_, nil, str, or, not, getProperty, Block, Code, Name, CodeGen} from "../codegen" -import N from "../names" -import {resolveUrl} from "../resolve" -import { - schemaRefOrVal, - schemaHasRulesButRef, - checkUnknownRules, - checkStrictMode, - unescapeJsonPointer, - mergeEvaluated, -} from "../util" -import type {JSONType, Rule, RuleGroup} from "../rules" -import { - ErrorPaths, - reportError, - reportExtraError, - resetErrorsCount, - keyword$DataError, -} from "../errors" - -// schema compilation - generates validation function, subschemaCode (below) is used for subschemas -export function validateFunctionCode(it: SchemaCxt): void { - if (isSchemaObj(it)) { - checkKeywords(it) - if (schemaCxtHasRules(it)) { - topSchemaObjCode(it) - return - } - } - validateFunction(it, () => topBoolOrEmptySchema(it)) -} - -function validateFunction( - {gen, validateName, schema, schemaEnv, opts}: SchemaCxt, - body: Block -): void { - if (opts.code.es5) { - gen.func(validateName, _`${N.data}, ${N.valCxt}`, schemaEnv.$async, () => { - gen.code(_`"use strict"; ${funcSourceUrl(schema, opts)}`) - destructureValCxtES5(gen, opts) - gen.code(body) - }) - } else { - gen.func(validateName, _`${N.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => - gen.code(funcSourceUrl(schema, opts)).code(body) - ) - } -} - -function destructureValCxt(opts: InstanceOptions): Code { - return _`{${N.instancePath}="", ${N.parentData}, ${N.parentDataProperty}, ${N.rootData}=${ - N.data - }${opts.dynamicRef ? _`, ${N.dynamicAnchors}={}` : nil}}={}` -} - -function destructureValCxtES5(gen: CodeGen, opts: InstanceOptions): void { - gen.if( - N.valCxt, - () => { - gen.var(N.instancePath, _`${N.valCxt}.${N.instancePath}`) - gen.var(N.parentData, _`${N.valCxt}.${N.parentData}`) - gen.var(N.parentDataProperty, _`${N.valCxt}.${N.parentDataProperty}`) - gen.var(N.rootData, _`${N.valCxt}.${N.rootData}`) - if (opts.dynamicRef) gen.var(N.dynamicAnchors, _`${N.valCxt}.${N.dynamicAnchors}`) - }, - () => { - gen.var(N.instancePath, _`""`) - gen.var(N.parentData, _`undefined`) - gen.var(N.parentDataProperty, _`undefined`) - gen.var(N.rootData, N.data) - if (opts.dynamicRef) gen.var(N.dynamicAnchors, _`{}`) - } - ) -} - -function topSchemaObjCode(it: SchemaObjCxt): void { - const {schema, opts, gen} = it - validateFunction(it, () => { - if (opts.$comment && schema.$comment) commentKeyword(it) - checkNoDefault(it) - gen.let(N.vErrors, null) - gen.let(N.errors, 0) - if (opts.unevaluated) resetEvaluated(it) - typeAndKeywords(it) - returnResults(it) - }) - return -} - -function resetEvaluated(it: SchemaObjCxt): void { - // TODO maybe some hook to execute it in the end to check whether props/items are Name, as in assignEvaluated - const {gen, validateName} = it - it.evaluated = gen.const("evaluated", _`${validateName}.evaluated`) - gen.if(_`${it.evaluated}.dynamicProps`, () => gen.assign(_`${it.evaluated}.props`, _`undefined`)) - gen.if(_`${it.evaluated}.dynamicItems`, () => gen.assign(_`${it.evaluated}.items`, _`undefined`)) -} - -function funcSourceUrl(schema: AnySchema, opts: InstanceOptions): Code { - const schId = typeof schema == "object" && schema[opts.schemaId] - return schId && (opts.code.source || opts.code.process) ? _`/*# sourceURL=${schId} */` : nil -} - -// schema compilation - this function is used recursively to generate code for sub-schemas -function subschemaCode(it: SchemaCxt, valid: Name): void { - if (isSchemaObj(it)) { - checkKeywords(it) - if (schemaCxtHasRules(it)) { - subSchemaObjCode(it, valid) - return - } - } - boolOrEmptySchema(it, valid) -} - -function schemaCxtHasRules({schema, self}: SchemaCxt): boolean { - if (typeof schema == "boolean") return !schema - for (const key in schema) if (self.RULES.all[key]) return true - return false -} - -function isSchemaObj(it: SchemaCxt): it is SchemaObjCxt { - return typeof it.schema != "boolean" -} - -function subSchemaObjCode(it: SchemaObjCxt, valid: Name): void { - const {schema, gen, opts} = it - if (opts.$comment && schema.$comment) commentKeyword(it) - updateContext(it) - checkAsyncSchema(it) - const errsCount = gen.const("_errs", N.errors) - typeAndKeywords(it, errsCount) - // TODO var - gen.var(valid, _`${errsCount} === ${N.errors}`) -} - -function checkKeywords(it: SchemaObjCxt): void { - checkUnknownRules(it) - checkRefsAndKeywords(it) -} - -function typeAndKeywords(it: SchemaObjCxt, errsCount?: Name): void { - if (it.opts.jtd) return schemaKeywords(it, [], false, errsCount) - const types = getSchemaTypes(it.schema) - const checkedTypes = coerceAndCheckDataType(it, types) - schemaKeywords(it, types, !checkedTypes, errsCount) -} - -function checkRefsAndKeywords(it: SchemaObjCxt): void { - const {schema, errSchemaPath, opts, self} = it - if (schema.$ref && opts.ignoreKeywordsWithRef && schemaHasRulesButRef(schema, self.RULES)) { - self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`) - } -} - -function checkNoDefault(it: SchemaObjCxt): void { - const {schema, opts} = it - if (schema.default !== undefined && opts.useDefaults && opts.strictSchema) { - checkStrictMode(it, "default is ignored in the schema root") - } -} - -function updateContext(it: SchemaObjCxt): void { - const schId = it.schema[it.opts.schemaId] - if (schId) it.baseId = resolveUrl(it.opts.uriResolver, it.baseId, schId) -} - -function checkAsyncSchema(it: SchemaObjCxt): void { - if (it.schema.$async && !it.schemaEnv.$async) throw new Error("async schema in sync schema") -} - -function commentKeyword({gen, schemaEnv, schema, errSchemaPath, opts}: SchemaObjCxt): void { - const msg = schema.$comment - if (opts.$comment === true) { - gen.code(_`${N.self}.logger.log(${msg})`) - } else if (typeof opts.$comment == "function") { - const schemaPath = str`${errSchemaPath}/$comment` - const rootName = gen.scopeValue("root", {ref: schemaEnv.root}) - gen.code(_`${N.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`) - } -} - -function returnResults(it: SchemaCxt): void { - const {gen, schemaEnv, validateName, ValidationError, opts} = it - if (schemaEnv.$async) { - // TODO assign unevaluated - gen.if( - _`${N.errors} === 0`, - () => gen.return(N.data), - () => gen.throw(_`new ${ValidationError as Name}(${N.vErrors})`) - ) - } else { - gen.assign(_`${validateName}.errors`, N.vErrors) - if (opts.unevaluated) assignEvaluated(it) - gen.return(_`${N.errors} === 0`) - } -} - -function assignEvaluated({gen, evaluated, props, items}: SchemaCxt): void { - if (props instanceof Name) gen.assign(_`${evaluated}.props`, props) - if (items instanceof Name) gen.assign(_`${evaluated}.items`, items) -} - -function schemaKeywords( - it: SchemaObjCxt, - types: JSONType[], - typeErrors: boolean, - errsCount?: Name -): void { - const {gen, schema, data, allErrors, opts, self} = it - const {RULES} = self - if (schema.$ref && (opts.ignoreKeywordsWithRef || !schemaHasRulesButRef(schema, RULES))) { - gen.block(() => keywordCode(it, "$ref", (RULES.all.$ref as Rule).definition)) // TODO typecast - return - } - if (!opts.jtd) checkStrictTypes(it, types) - gen.block(() => { - for (const group of RULES.rules) groupKeywords(group) - groupKeywords(RULES.post) - }) - - function groupKeywords(group: RuleGroup): void { - if (!shouldUseGroup(schema, group)) return - if (group.type) { - gen.if(checkDataType(group.type, data, opts.strictNumbers)) - iterateKeywords(it, group) - if (types.length === 1 && types[0] === group.type && typeErrors) { - gen.else() - reportTypeError(it) - } - gen.endIf() - } else { - iterateKeywords(it, group) - } - // TODO make it "ok" call? - if (!allErrors) gen.if(_`${N.errors} === ${errsCount || 0}`) - } -} - -function iterateKeywords(it: SchemaObjCxt, group: RuleGroup): void { - const { - gen, - schema, - opts: {useDefaults}, - } = it - if (useDefaults) assignDefaults(it, group.type) - gen.block(() => { - for (const rule of group.rules) { - if (shouldUseRule(schema, rule)) { - keywordCode(it, rule.keyword, rule.definition, group.type) - } - } - }) -} - -function checkStrictTypes(it: SchemaObjCxt, types: JSONType[]): void { - if (it.schemaEnv.meta || !it.opts.strictTypes) return - checkContextTypes(it, types) - if (!it.opts.allowUnionTypes) checkMultipleTypes(it, types) - checkKeywordTypes(it, it.dataTypes) -} - -function checkContextTypes(it: SchemaObjCxt, types: JSONType[]): void { - if (!types.length) return - if (!it.dataTypes.length) { - it.dataTypes = types - return - } - types.forEach((t) => { - if (!includesType(it.dataTypes, t)) { - strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`) - } - }) - narrowSchemaTypes(it, types) -} - -function checkMultipleTypes(it: SchemaObjCxt, ts: JSONType[]): void { - if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) { - strictTypesError(it, "use allowUnionTypes to allow union type keyword") - } -} - -function checkKeywordTypes(it: SchemaObjCxt, ts: JSONType[]): void { - const rules = it.self.RULES.all - for (const keyword in rules) { - const rule = rules[keyword] - if (typeof rule == "object" && shouldUseRule(it.schema, rule)) { - const {type} = rule.definition - if (type.length && !type.some((t) => hasApplicableType(ts, t))) { - strictTypesError(it, `missing type "${type.join(",")}" for keyword "${keyword}"`) - } - } - } -} - -function hasApplicableType(schTs: JSONType[], kwdT: JSONType): boolean { - return schTs.includes(kwdT) || (kwdT === "number" && schTs.includes("integer")) -} - -function includesType(ts: JSONType[], t: JSONType): boolean { - return ts.includes(t) || (t === "integer" && ts.includes("number")) -} - -function narrowSchemaTypes(it: SchemaObjCxt, withTypes: JSONType[]): void { - const ts: JSONType[] = [] - for (const t of it.dataTypes) { - if (includesType(withTypes, t)) ts.push(t) - else if (withTypes.includes("integer") && t === "number") ts.push("integer") - } - it.dataTypes = ts -} - -function strictTypesError(it: SchemaObjCxt, msg: string): void { - const schemaPath = it.schemaEnv.baseId + it.errSchemaPath - msg += ` at "${schemaPath}" (strictTypes)` - checkStrictMode(it, msg, it.opts.strictTypes) -} - -export class KeywordCxt implements KeywordErrorCxt { - readonly gen: CodeGen - readonly allErrors?: boolean - readonly keyword: string - readonly data: Name // Name referencing the current level of the data instance - readonly $data?: string | false - schema: any // keyword value in the schema - readonly schemaValue: Code | number | boolean // Code reference to keyword schema value or primitive value - readonly schemaCode: Code | number | boolean // Code reference to resolved schema value (different if schema is $data) - readonly schemaType: JSONType[] // allowed type(s) of keyword value in the schema - readonly parentSchema: AnySchemaObject - readonly errsCount?: Name // Name reference to the number of validation errors collected before this keyword, - // requires option trackErrors in keyword definition - params: KeywordCxtParams // object to pass parameters to error messages from keyword code - readonly it: SchemaObjCxt // schema compilation context (schema is guaranteed to be an object, not boolean) - readonly def: AddedKeywordDefinition - - constructor(it: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string) { - validateKeywordUsage(it, def, keyword) - this.gen = it.gen - this.allErrors = it.allErrors - this.keyword = keyword - this.data = it.data - this.schema = it.schema[keyword] - this.$data = def.$data && it.opts.$data && this.schema && this.schema.$data - this.schemaValue = schemaRefOrVal(it, this.schema, keyword, this.$data) - this.schemaType = def.schemaType - this.parentSchema = it.schema - this.params = {} - this.it = it - this.def = def - - if (this.$data) { - this.schemaCode = it.gen.const("vSchema", getData(this.$data, it)) - } else { - this.schemaCode = this.schemaValue - if (!validSchemaType(this.schema, def.schemaType, def.allowUndefined)) { - throw new Error(`${keyword} value must be ${JSON.stringify(def.schemaType)}`) - } - } - - if ("code" in def ? def.trackErrors : def.errors !== false) { - this.errsCount = it.gen.const("_errs", N.errors) - } - } - - result(condition: Code, successAction?: () => void, failAction?: () => void): void { - this.failResult(not(condition), successAction, failAction) - } - - failResult(condition: Code, successAction?: () => void, failAction?: () => void): void { - this.gen.if(condition) - if (failAction) failAction() - else this.error() - if (successAction) { - this.gen.else() - successAction() - if (this.allErrors) this.gen.endIf() - } else { - if (this.allErrors) this.gen.endIf() - else this.gen.else() - } - } - - pass(condition: Code, failAction?: () => void): void { - this.failResult(not(condition), undefined, failAction) - } - - fail(condition?: Code): void { - if (condition === undefined) { - this.error() - if (!this.allErrors) this.gen.if(false) // this branch will be removed by gen.optimize - return - } - this.gen.if(condition) - this.error() - if (this.allErrors) this.gen.endIf() - else this.gen.else() - } - - fail$data(condition: Code): void { - if (!this.$data) return this.fail(condition) - const {schemaCode} = this - this.fail(_`${schemaCode} !== undefined && (${or(this.invalid$data(), condition)})`) - } - - error(append?: boolean, errorParams?: KeywordCxtParams, errorPaths?: ErrorPaths): void { - if (errorParams) { - this.setParams(errorParams) - this._error(append, errorPaths) - this.setParams({}) - return - } - this._error(append, errorPaths) - } - - private _error(append?: boolean, errorPaths?: ErrorPaths): void { - ;(append ? reportExtraError : reportError)(this, this.def.error, errorPaths) - } - - $dataError(): void { - reportError(this, this.def.$dataError || keyword$DataError) - } - - reset(): void { - if (this.errsCount === undefined) throw new Error('add "trackErrors" to keyword definition') - resetErrorsCount(this.gen, this.errsCount) - } - - ok(cond: Code | boolean): void { - if (!this.allErrors) this.gen.if(cond) - } - - setParams(obj: KeywordCxtParams, assign?: true): void { - if (assign) Object.assign(this.params, obj) - else this.params = obj - } - - block$data(valid: Name, codeBlock: () => void, $dataValid: Code = nil): void { - this.gen.block(() => { - this.check$data(valid, $dataValid) - codeBlock() - }) - } - - check$data(valid: Name = nil, $dataValid: Code = nil): void { - if (!this.$data) return - const {gen, schemaCode, schemaType, def} = this - gen.if(or(_`${schemaCode} === undefined`, $dataValid)) - if (valid !== nil) gen.assign(valid, true) - if (schemaType.length || def.validateSchema) { - gen.elseIf(this.invalid$data()) - this.$dataError() - if (valid !== nil) gen.assign(valid, false) - } - gen.else() - } - - invalid$data(): Code { - const {gen, schemaCode, schemaType, def, it} = this - return or(wrong$DataType(), invalid$DataSchema()) - - function wrong$DataType(): Code { - if (schemaType.length) { - /* istanbul ignore if */ - if (!(schemaCode instanceof Name)) throw new Error("ajv implementation error") - const st = Array.isArray(schemaType) ? schemaType : [schemaType] - return _`${checkDataTypes(st, schemaCode, it.opts.strictNumbers, DataType.Wrong)}` - } - return nil - } - - function invalid$DataSchema(): Code { - if (def.validateSchema) { - const validateSchemaRef = gen.scopeValue("validate$data", {ref: def.validateSchema}) // TODO value.code for standalone - return _`!${validateSchemaRef}(${schemaCode})` - } - return nil - } - } - - subschema(appl: SubschemaArgs, valid: Name): SchemaCxt { - const subschema = getSubschema(this.it, appl) - extendSubschemaData(subschema, this.it, appl) - extendSubschemaMode(subschema, appl) - const nextContext = {...this.it, ...subschema, items: undefined, props: undefined} - subschemaCode(nextContext, valid) - return nextContext - } - - mergeEvaluated(schemaCxt: SchemaCxt, toName?: typeof Name): void { - const {it, gen} = this - if (!it.opts.unevaluated) return - if (it.props !== true && schemaCxt.props !== undefined) { - it.props = mergeEvaluated.props(gen, schemaCxt.props, it.props, toName) - } - if (it.items !== true && schemaCxt.items !== undefined) { - it.items = mergeEvaluated.items(gen, schemaCxt.items, it.items, toName) - } - } - - mergeValidEvaluated(schemaCxt: SchemaCxt, valid: Name): boolean | void { - const {it, gen} = this - if (it.opts.unevaluated && (it.props !== true || it.items !== true)) { - gen.if(valid, () => this.mergeEvaluated(schemaCxt, Name)) - return true - } - } -} - -function keywordCode( - it: SchemaObjCxt, - keyword: string, - def: AddedKeywordDefinition, - ruleType?: JSONType -): void { - const cxt = new KeywordCxt(it, def, keyword) - if ("code" in def) { - def.code(cxt, ruleType) - } else if (cxt.$data && def.validate) { - funcKeywordCode(cxt, def) - } else if ("macro" in def) { - macroKeywordCode(cxt, def) - } else if (def.compile || def.validate) { - funcKeywordCode(cxt, def) - } -} - -const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/ -const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/ -export function getData( - $data: string, - {dataLevel, dataNames, dataPathArr}: SchemaCxt -): Code | number { - let jsonPointer - let data: Code - if ($data === "") return N.rootData - if ($data[0] === "/") { - if (!JSON_POINTER.test($data)) throw new Error(`Invalid JSON-pointer: ${$data}`) - jsonPointer = $data - data = N.rootData - } else { - const matches = RELATIVE_JSON_POINTER.exec($data) - if (!matches) throw new Error(`Invalid JSON-pointer: ${$data}`) - const up: number = +matches[1] - jsonPointer = matches[2] - if (jsonPointer === "#") { - if (up >= dataLevel) throw new Error(errorMsg("property/index", up)) - return dataPathArr[dataLevel - up] - } - if (up > dataLevel) throw new Error(errorMsg("data", up)) - data = dataNames[dataLevel - up] - if (!jsonPointer) return data - } - - let expr = data - const segments = jsonPointer.split("/") - for (const segment of segments) { - if (segment) { - data = _`${data}${getProperty(unescapeJsonPointer(segment))}` - expr = _`${expr} && ${data}` - } - } - return expr - - function errorMsg(pointerType: string, up: number): string { - return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}` - } -} diff --git a/node_modules/ajv/lib/compile/validate/keyword.ts b/node_modules/ajv/lib/compile/validate/keyword.ts deleted file mode 100644 index f854aa7..0000000 --- a/node_modules/ajv/lib/compile/validate/keyword.ts +++ /dev/null @@ -1,171 +0,0 @@ -import type {KeywordCxt} from "." -import type { - AnySchema, - SchemaValidateFunction, - AnyValidateFunction, - AddedKeywordDefinition, - MacroKeywordDefinition, - FuncKeywordDefinition, -} from "../../types" -import type {SchemaObjCxt} from ".." -import {_, nil, not, stringify, Code, Name, CodeGen} from "../codegen" -import N from "../names" -import type {JSONType} from "../rules" -import {callValidateCode} from "../../vocabularies/code" -import {extendErrors} from "../errors" - -type KeywordCompilationResult = AnySchema | SchemaValidateFunction | AnyValidateFunction - -export function macroKeywordCode(cxt: KeywordCxt, def: MacroKeywordDefinition): void { - const {gen, keyword, schema, parentSchema, it} = cxt - const macroSchema = def.macro.call(it.self, schema, parentSchema, it) - const schemaRef = useKeyword(gen, keyword, macroSchema) - if (it.opts.validateSchema !== false) it.self.validateSchema(macroSchema, true) - - const valid = gen.name("valid") - cxt.subschema( - { - schema: macroSchema, - schemaPath: nil, - errSchemaPath: `${it.errSchemaPath}/${keyword}`, - topSchemaRef: schemaRef, - compositeRule: true, - }, - valid - ) - cxt.pass(valid, () => cxt.error(true)) -} - -export function funcKeywordCode(cxt: KeywordCxt, def: FuncKeywordDefinition): void { - const {gen, keyword, schema, parentSchema, $data, it} = cxt - checkAsyncKeyword(it, def) - const validate = - !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate - const validateRef = useKeyword(gen, keyword, validate) - const valid = gen.let("valid") - cxt.block$data(valid, validateKeyword) - cxt.ok(def.valid ?? valid) - - function validateKeyword(): void { - if (def.errors === false) { - assignValid() - if (def.modifying) modifyData(cxt) - reportErrs(() => cxt.error()) - } else { - const ruleErrs = def.async ? validateAsync() : validateSync() - if (def.modifying) modifyData(cxt) - reportErrs(() => addErrs(cxt, ruleErrs)) - } - } - - function validateAsync(): Name { - const ruleErrs = gen.let("ruleErrs", null) - gen.try( - () => assignValid(_`await `), - (e) => - gen.assign(valid, false).if( - _`${e} instanceof ${it.ValidationError as Name}`, - () => gen.assign(ruleErrs, _`${e}.errors`), - () => gen.throw(e) - ) - ) - return ruleErrs - } - - function validateSync(): Code { - const validateErrs = _`${validateRef}.errors` - gen.assign(validateErrs, null) - assignValid(nil) - return validateErrs - } - - function assignValid(_await: Code = def.async ? _`await ` : nil): void { - const passCxt = it.opts.passContext ? N.this : N.self - const passSchema = !(("compile" in def && !$data) || def.schema === false) - gen.assign( - valid, - _`${_await}${callValidateCode(cxt, validateRef, passCxt, passSchema)}`, - def.modifying - ) - } - - function reportErrs(errors: () => void): void { - gen.if(not(def.valid ?? valid), errors) - } -} - -function modifyData(cxt: KeywordCxt): void { - const {gen, data, it} = cxt - gen.if(it.parentData, () => gen.assign(data, _`${it.parentData}[${it.parentDataProperty}]`)) -} - -function addErrs(cxt: KeywordCxt, errs: Code): void { - const {gen} = cxt - gen.if( - _`Array.isArray(${errs})`, - () => { - gen - .assign(N.vErrors, _`${N.vErrors} === null ? ${errs} : ${N.vErrors}.concat(${errs})`) - .assign(N.errors, _`${N.vErrors}.length`) - extendErrors(cxt) - }, - () => cxt.error() - ) -} - -function checkAsyncKeyword({schemaEnv}: SchemaObjCxt, def: FuncKeywordDefinition): void { - if (def.async && !schemaEnv.$async) throw new Error("async keyword in sync schema") -} - -function useKeyword(gen: CodeGen, keyword: string, result?: KeywordCompilationResult): Name { - if (result === undefined) throw new Error(`keyword "${keyword}" failed to compile`) - return gen.scopeValue( - "keyword", - typeof result == "function" ? {ref: result} : {ref: result, code: stringify(result)} - ) -} - -export function validSchemaType( - schema: unknown, - schemaType: JSONType[], - allowUndefined = false -): boolean { - // TODO add tests - return ( - !schemaType.length || - schemaType.some((st) => - st === "array" - ? Array.isArray(schema) - : st === "object" - ? schema && typeof schema == "object" && !Array.isArray(schema) - : typeof schema == st || (allowUndefined && typeof schema == "undefined") - ) - ) -} - -export function validateKeywordUsage( - {schema, opts, self, errSchemaPath}: SchemaObjCxt, - def: AddedKeywordDefinition, - keyword: string -): void { - /* istanbul ignore if */ - if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) { - throw new Error("ajv implementation error") - } - - const deps = def.dependencies - if (deps?.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) { - throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`) - } - - if (def.validateSchema) { - const valid = def.validateSchema(schema[keyword]) - if (!valid) { - const msg = - `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + - self.errorsText(def.validateSchema.errors) - if (opts.validateSchema === "log") self.logger.error(msg) - else throw new Error(msg) - } - } -} diff --git a/node_modules/ajv/lib/compile/validate/subschema.ts b/node_modules/ajv/lib/compile/validate/subschema.ts deleted file mode 100644 index 9072ed7..0000000 --- a/node_modules/ajv/lib/compile/validate/subschema.ts +++ /dev/null @@ -1,135 +0,0 @@ -import type {AnySchema} from "../../types" -import type {SchemaObjCxt} from ".." -import {_, str, getProperty, Code, Name} from "../codegen" -import {escapeFragment, getErrorPath, Type} from "../util" -import type {JSONType} from "../rules" - -export interface SubschemaContext { - // TODO use Optional? align with SchemCxt property types - schema: AnySchema - schemaPath: Code - errSchemaPath: string - topSchemaRef?: Code - errorPath?: Code - dataLevel?: number - dataTypes?: JSONType[] - data?: Name - parentData?: Name - parentDataProperty?: Code | number - dataNames?: Name[] - dataPathArr?: (Code | number)[] - propertyName?: Name - jtdDiscriminator?: string - jtdMetadata?: boolean - compositeRule?: true - createErrors?: boolean - allErrors?: boolean -} - -export type SubschemaArgs = Partial<{ - keyword: string - schemaProp: string | number - schema: AnySchema - schemaPath: Code - errSchemaPath: string - topSchemaRef: Code - data: Name | Code - dataProp: Code | string | number - dataTypes: JSONType[] - definedProperties: Set - propertyName: Name - dataPropType: Type - jtdDiscriminator: string - jtdMetadata: boolean - compositeRule: true - createErrors: boolean - allErrors: boolean -}> - -export function getSubschema( - it: SchemaObjCxt, - {keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef}: SubschemaArgs -): SubschemaContext { - if (keyword !== undefined && schema !== undefined) { - throw new Error('both "keyword" and "schema" passed, only one allowed') - } - - if (keyword !== undefined) { - const sch = it.schema[keyword] - return schemaProp === undefined - ? { - schema: sch, - schemaPath: _`${it.schemaPath}${getProperty(keyword)}`, - errSchemaPath: `${it.errSchemaPath}/${keyword}`, - } - : { - schema: sch[schemaProp], - schemaPath: _`${it.schemaPath}${getProperty(keyword)}${getProperty(schemaProp)}`, - errSchemaPath: `${it.errSchemaPath}/${keyword}/${escapeFragment(schemaProp)}`, - } - } - - if (schema !== undefined) { - if (schemaPath === undefined || errSchemaPath === undefined || topSchemaRef === undefined) { - throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"') - } - return { - schema, - schemaPath, - topSchemaRef, - errSchemaPath, - } - } - - throw new Error('either "keyword" or "schema" must be passed') -} - -export function extendSubschemaData( - subschema: SubschemaContext, - it: SchemaObjCxt, - {dataProp, dataPropType: dpType, data, dataTypes, propertyName}: SubschemaArgs -): void { - if (data !== undefined && dataProp !== undefined) { - throw new Error('both "data" and "dataProp" passed, only one allowed') - } - - const {gen} = it - - if (dataProp !== undefined) { - const {errorPath, dataPathArr, opts} = it - const nextData = gen.let("data", _`${it.data}${getProperty(dataProp)}`, true) - dataContextProps(nextData) - subschema.errorPath = str`${errorPath}${getErrorPath(dataProp, dpType, opts.jsPropertySyntax)}` - subschema.parentDataProperty = _`${dataProp}` - subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty] - } - - if (data !== undefined) { - const nextData = data instanceof Name ? data : gen.let("data", data, true) // replaceable if used once? - dataContextProps(nextData) - if (propertyName !== undefined) subschema.propertyName = propertyName - // TODO something is possibly wrong here with not changing parentDataProperty and not appending dataPathArr - } - - if (dataTypes) subschema.dataTypes = dataTypes - - function dataContextProps(_nextData: Name): void { - subschema.data = _nextData - subschema.dataLevel = it.dataLevel + 1 - subschema.dataTypes = [] - it.definedProperties = new Set() - subschema.parentData = it.data - subschema.dataNames = [...it.dataNames, _nextData] - } -} - -export function extendSubschemaMode( - subschema: SubschemaContext, - {jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors}: SubschemaArgs -): void { - if (compositeRule !== undefined) subschema.compositeRule = compositeRule - if (createErrors !== undefined) subschema.createErrors = createErrors - if (allErrors !== undefined) subschema.allErrors = allErrors - subschema.jtdDiscriminator = jtdDiscriminator // not inherited - subschema.jtdMetadata = jtdMetadata // not inherited -} diff --git a/node_modules/ajv/lib/core.ts b/node_modules/ajv/lib/core.ts deleted file mode 100644 index e41ca3e..0000000 --- a/node_modules/ajv/lib/core.ts +++ /dev/null @@ -1,891 +0,0 @@ -export { - Format, - FormatDefinition, - AsyncFormatDefinition, - KeywordDefinition, - KeywordErrorDefinition, - CodeKeywordDefinition, - MacroKeywordDefinition, - FuncKeywordDefinition, - Vocabulary, - Schema, - SchemaObject, - AnySchemaObject, - AsyncSchema, - AnySchema, - ValidateFunction, - AsyncValidateFunction, - AnyValidateFunction, - ErrorObject, - ErrorNoParams, -} from "./types" - -export {SchemaCxt, SchemaObjCxt} from "./compile" -export interface Plugin { - (ajv: Ajv, options?: Opts): Ajv - [prop: string]: any -} - -export {KeywordCxt} from "./compile/validate" -export {DefinedError} from "./vocabularies/errors" -export {JSONType} from "./compile/rules" -export {JSONSchemaType} from "./types/json-schema" -export {JTDSchemaType, SomeJTDSchemaType, JTDDataType} from "./types/jtd-schema" -export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" - -import type { - Schema, - AnySchema, - AnySchemaObject, - SchemaObject, - AsyncSchema, - Vocabulary, - KeywordDefinition, - AddedKeywordDefinition, - AnyValidateFunction, - ValidateFunction, - AsyncValidateFunction, - ErrorObject, - Format, - AddedFormat, - RegExpEngine, - UriResolver, -} from "./types" -import type {JSONSchemaType} from "./types/json-schema" -import type {JTDSchemaType, SomeJTDSchemaType, JTDDataType} from "./types/jtd-schema" -import ValidationError from "./runtime/validation_error" -import MissingRefError from "./compile/ref_error" -import {getRules, ValidationRules, Rule, RuleGroup, JSONType} from "./compile/rules" -import {SchemaEnv, compileSchema, resolveSchema} from "./compile" -import {Code, ValueScope} from "./compile/codegen" -import {normalizeId, getSchemaRefs} from "./compile/resolve" -import {getJSONTypes} from "./compile/validate/dataType" -import {eachItem} from "./compile/util" -import * as $dataRefSchema from "./refs/data.json" - -import DefaultUriResolver from "./runtime/uri" - -const defaultRegExp: RegExpEngine = (str, flags) => new RegExp(str, flags) -defaultRegExp.code = "new RegExp" - -const META_IGNORE_OPTIONS: (keyof Options)[] = ["removeAdditional", "useDefaults", "coerceTypes"] -const EXT_SCOPE_NAMES = new Set([ - "validate", - "serialize", - "parse", - "wrapper", - "root", - "schema", - "keyword", - "pattern", - "formats", - "validate$data", - "func", - "obj", - "Error", -]) - -export type Options = CurrentOptions & DeprecatedOptions - -export interface CurrentOptions { - // strict mode options (NEW) - strict?: boolean | "log" - strictSchema?: boolean | "log" - strictNumbers?: boolean | "log" - strictTypes?: boolean | "log" - strictTuples?: boolean | "log" - strictRequired?: boolean | "log" - allowMatchingProperties?: boolean // disables a strict mode restriction - allowUnionTypes?: boolean - validateFormats?: boolean - // validation and reporting options: - $data?: boolean - allErrors?: boolean - verbose?: boolean - discriminator?: boolean - unicodeRegExp?: boolean - timestamp?: "string" | "date" // JTD only - parseDate?: boolean // JTD only - allowDate?: boolean // JTD only - $comment?: - | true - | ((comment: string, schemaPath?: string, rootSchema?: AnySchemaObject) => unknown) - formats?: {[Name in string]?: Format} - keywords?: Vocabulary - schemas?: AnySchema[] | {[Key in string]?: AnySchema} - logger?: Logger | false - loadSchema?: (uri: string) => Promise - // options to modify validated data: - removeAdditional?: boolean | "all" | "failing" - useDefaults?: boolean | "empty" - coerceTypes?: boolean | "array" - // advanced options: - next?: boolean // NEW - unevaluated?: boolean // NEW - dynamicRef?: boolean // NEW - schemaId?: "id" | "$id" - jtd?: boolean // NEW - meta?: SchemaObject | boolean - defaultMeta?: string | AnySchemaObject - validateSchema?: boolean | "log" - addUsedSchema?: boolean - inlineRefs?: boolean | number - passContext?: boolean - loopRequired?: number - loopEnum?: number // NEW - ownProperties?: boolean - multipleOfPrecision?: number - int32range?: boolean // JTD only - messages?: boolean - code?: CodeOptions // NEW - uriResolver?: UriResolver -} - -export interface CodeOptions { - es5?: boolean - esm?: boolean - lines?: boolean - optimize?: boolean | number - formats?: Code // code to require (or construct) map of available formats - for standalone code - source?: boolean - process?: (code: string, schema?: SchemaEnv) => string - regExp?: RegExpEngine -} - -interface InstanceCodeOptions extends CodeOptions { - regExp: RegExpEngine - optimize: number -} - -interface DeprecatedOptions { - /** @deprecated */ - ignoreKeywordsWithRef?: boolean - /** @deprecated */ - jsPropertySyntax?: boolean // added instead of jsonPointers - /** @deprecated */ - unicode?: boolean -} - -interface RemovedOptions { - format?: boolean - errorDataPath?: "object" | "property" - nullable?: boolean // "nullable" keyword is supported by default - jsonPointers?: boolean - extendRefs?: true | "ignore" | "fail" - missingRefs?: true | "ignore" | "fail" - processCode?: (code: string, schema?: SchemaEnv) => string - sourceCode?: boolean - strictDefaults?: boolean - strictKeywords?: boolean - uniqueItems?: boolean - unknownFormats?: true | string[] | "ignore" - cache?: any - serialize?: (schema: AnySchema) => unknown - ajvErrors?: boolean -} - -type OptionsInfo = { - [K in keyof T]-?: string | undefined -} - -const removedOptions: OptionsInfo = { - errorDataPath: "", - format: "`validateFormats: false` can be used instead.", - nullable: '"nullable" keyword is supported by default.', - jsonPointers: "Deprecated jsPropertySyntax can be used instead.", - extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.", - missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.", - processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`", - sourceCode: "Use option `code: {source: true}`", - strictDefaults: "It is default now, see option `strict`.", - strictKeywords: "It is default now, see option `strict`.", - uniqueItems: '"uniqueItems" keyword is always validated.', - unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).", - cache: "Map is used as cache, schema object as key.", - serialize: "Map is used as cache, schema object as key.", - ajvErrors: "It is default now.", -} - -const deprecatedOptions: OptionsInfo = { - ignoreKeywordsWithRef: "", - jsPropertySyntax: "", - unicode: '"minLength"/"maxLength" account for unicode characters by default.', -} - -type RequiredInstanceOptions = { - [K in - | "strictSchema" - | "strictNumbers" - | "strictTypes" - | "strictTuples" - | "strictRequired" - | "inlineRefs" - | "loopRequired" - | "loopEnum" - | "meta" - | "messages" - | "schemaId" - | "addUsedSchema" - | "validateSchema" - | "validateFormats" - | "int32range" - | "unicodeRegExp" - | "uriResolver"]: NonNullable -} & {code: InstanceCodeOptions} - -export type InstanceOptions = Options & RequiredInstanceOptions - -const MAX_EXPRESSION = 200 - -// eslint-disable-next-line complexity -function requiredOptions(o: Options): RequiredInstanceOptions { - const s = o.strict - const _optz = o.code?.optimize - const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0 - const regExp = o.code?.regExp ?? defaultRegExp - const uriResolver = o.uriResolver ?? DefaultUriResolver - return { - strictSchema: o.strictSchema ?? s ?? true, - strictNumbers: o.strictNumbers ?? s ?? true, - strictTypes: o.strictTypes ?? s ?? "log", - strictTuples: o.strictTuples ?? s ?? "log", - strictRequired: o.strictRequired ?? s ?? false, - code: o.code ? {...o.code, optimize, regExp} : {optimize, regExp}, - loopRequired: o.loopRequired ?? MAX_EXPRESSION, - loopEnum: o.loopEnum ?? MAX_EXPRESSION, - meta: o.meta ?? true, - messages: o.messages ?? true, - inlineRefs: o.inlineRefs ?? true, - schemaId: o.schemaId ?? "$id", - addUsedSchema: o.addUsedSchema ?? true, - validateSchema: o.validateSchema ?? true, - validateFormats: o.validateFormats ?? true, - unicodeRegExp: o.unicodeRegExp ?? true, - int32range: o.int32range ?? true, - uriResolver: uriResolver, - } -} - -export interface Logger { - log(...args: unknown[]): unknown - warn(...args: unknown[]): unknown - error(...args: unknown[]): unknown -} - -export default class Ajv { - opts: InstanceOptions - errors?: ErrorObject[] | null // errors from the last validation - logger: Logger - // shared external scope values for compiled functions - readonly scope: ValueScope - readonly schemas: {[Key in string]?: SchemaEnv} = {} - readonly refs: {[Ref in string]?: SchemaEnv | string} = {} - readonly formats: {[Name in string]?: AddedFormat} = {} - readonly RULES: ValidationRules - readonly _compilations: Set = new Set() - private readonly _loading: {[Ref in string]?: Promise} = {} - private readonly _cache: Map = new Map() - private readonly _metaOpts: InstanceOptions - - static ValidationError = ValidationError - static MissingRefError = MissingRefError - - constructor(opts: Options = {}) { - opts = this.opts = {...opts, ...requiredOptions(opts)} - const {es5, lines} = this.opts.code - - this.scope = new ValueScope({scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines}) - this.logger = getLogger(opts.logger) - const formatOpt = opts.validateFormats - opts.validateFormats = false - - this.RULES = getRules() - checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED") - checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn") - this._metaOpts = getMetaSchemaOptions.call(this) - - if (opts.formats) addInitialFormats.call(this) - this._addVocabularies() - this._addDefaultMetaSchema() - if (opts.keywords) addInitialKeywords.call(this, opts.keywords) - if (typeof opts.meta == "object") this.addMetaSchema(opts.meta) - addInitialSchemas.call(this) - opts.validateFormats = formatOpt - } - - _addVocabularies(): void { - this.addKeyword("$async") - } - - _addDefaultMetaSchema(): void { - const {$data, meta, schemaId} = this.opts - let _dataRefSchema: SchemaObject = $dataRefSchema - if (schemaId === "id") { - _dataRefSchema = {...$dataRefSchema} - _dataRefSchema.id = _dataRefSchema.$id - delete _dataRefSchema.$id - } - if (meta && $data) this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false) - } - - defaultMeta(): string | AnySchemaObject | undefined { - const {meta, schemaId} = this.opts - return (this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : undefined) - } - - // Validate data using schema - // AnySchema will be compiled and cached using schema itself as a key for Map - validate(schema: Schema | string, data: unknown): boolean - validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise - validate(schema: Schema | JSONSchemaType | string, data: unknown): data is T - // Separated for type inference to work - // eslint-disable-next-line @typescript-eslint/unified-signatures - validate(schema: JTDSchemaType, data: unknown): data is T - // This overload is only intended for typescript inference, the first - // argument prevents manual type annotation from matching this overload - // eslint-disable-next-line @typescript-eslint/no-unused-vars - validate( - schema: T, - data: unknown - ): data is JTDDataType - // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents - validate(schema: AsyncSchema, data: unknown | T): Promise - validate(schemaKeyRef: AnySchema | string, data: unknown): data is T | Promise - validate( - schemaKeyRef: AnySchema | string, // key, ref or schema object - // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents - data: unknown | T // to be validated - ): boolean | Promise { - let v: AnyValidateFunction | undefined - if (typeof schemaKeyRef == "string") { - v = this.getSchema(schemaKeyRef) - if (!v) throw new Error(`no schema with key or ref "${schemaKeyRef}"`) - } else { - v = this.compile(schemaKeyRef) - } - - const valid = v(data) - if (!("$async" in v)) this.errors = v.errors - return valid - } - - // Create validation function for passed schema - // _meta: true if schema is a meta-schema. Used internally to compile meta schemas of user-defined keywords. - compile(schema: Schema | JSONSchemaType, _meta?: boolean): ValidateFunction - // Separated for type inference to work - // eslint-disable-next-line @typescript-eslint/unified-signatures - compile(schema: JTDSchemaType, _meta?: boolean): ValidateFunction - // This overload is only intended for typescript inference, the first - // argument prevents manual type annotation from matching this overload - // eslint-disable-next-line @typescript-eslint/no-unused-vars - compile( - schema: T, - _meta?: boolean - ): ValidateFunction> - compile(schema: AsyncSchema, _meta?: boolean): AsyncValidateFunction - compile(schema: AnySchema, _meta?: boolean): AnyValidateFunction - compile(schema: AnySchema, _meta?: boolean): AnyValidateFunction { - const sch = this._addSchema(schema, _meta) - return (sch.validate || this._compileSchemaEnv(sch)) as AnyValidateFunction - } - - // Creates validating function for passed schema with asynchronous loading of missing schemas. - // `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema. - // TODO allow passing schema URI - // meta - optional true to compile meta-schema - compileAsync( - schema: SchemaObject | JSONSchemaType, - _meta?: boolean - ): Promise> - // Separated for type inference to work - // eslint-disable-next-line @typescript-eslint/unified-signatures - compileAsync(schema: JTDSchemaType, _meta?: boolean): Promise> - compileAsync(schema: AsyncSchema, meta?: boolean): Promise> - // eslint-disable-next-line @typescript-eslint/unified-signatures - compileAsync( - schema: AnySchemaObject, - meta?: boolean - ): Promise> - compileAsync( - schema: AnySchemaObject, - meta?: boolean - ): Promise> { - if (typeof this.opts.loadSchema != "function") { - throw new Error("options.loadSchema should be a function") - } - const {loadSchema} = this.opts - return runCompileAsync.call(this, schema, meta) - - async function runCompileAsync( - this: Ajv, - _schema: AnySchemaObject, - _meta?: boolean - ): Promise { - await loadMetaSchema.call(this, _schema.$schema) - const sch = this._addSchema(_schema, _meta) - return sch.validate || _compileAsync.call(this, sch) - } - - async function loadMetaSchema(this: Ajv, $ref?: string): Promise { - if ($ref && !this.getSchema($ref)) { - await runCompileAsync.call(this, {$ref}, true) - } - } - - async function _compileAsync(this: Ajv, sch: SchemaEnv): Promise { - try { - return this._compileSchemaEnv(sch) - } catch (e) { - if (!(e instanceof MissingRefError)) throw e - checkLoaded.call(this, e) - await loadMissingSchema.call(this, e.missingSchema) - return _compileAsync.call(this, sch) - } - } - - function checkLoaded(this: Ajv, {missingSchema: ref, missingRef}: MissingRefError): void { - if (this.refs[ref]) { - throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`) - } - } - - async function loadMissingSchema(this: Ajv, ref: string): Promise { - const _schema = await _loadSchema.call(this, ref) - if (!this.refs[ref]) await loadMetaSchema.call(this, _schema.$schema) - if (!this.refs[ref]) this.addSchema(_schema, ref, meta) - } - - async function _loadSchema(this: Ajv, ref: string): Promise { - const p = this._loading[ref] - if (p) return p - try { - return await (this._loading[ref] = loadSchema(ref)) - } finally { - delete this._loading[ref] - } - } - } - - // Adds schema to the instance - addSchema( - schema: AnySchema | AnySchema[], // If array is passed, `key` will be ignored - key?: string, // Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. - _meta?: boolean, // true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. - _validateSchema = this.opts.validateSchema // false to skip schema validation. Used internally, option validateSchema should be used instead. - ): Ajv { - if (Array.isArray(schema)) { - for (const sch of schema) this.addSchema(sch, undefined, _meta, _validateSchema) - return this - } - let id: string | undefined - if (typeof schema === "object") { - const {schemaId} = this.opts - id = schema[schemaId] - if (id !== undefined && typeof id != "string") { - throw new Error(`schema ${schemaId} must be string`) - } - } - key = normalizeId(key || id) - this._checkUnique(key) - this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true) - return this - } - - // Add schema that will be used to validate other schemas - // options in META_IGNORE_OPTIONS are alway set to false - addMetaSchema( - schema: AnySchemaObject, - key?: string, // schema key - _validateSchema = this.opts.validateSchema // false to skip schema validation, can be used to override validateSchema option for meta-schema - ): Ajv { - this.addSchema(schema, key, true, _validateSchema) - return this - } - - // Validate schema against its meta-schema - validateSchema(schema: AnySchema, throwOrLogError?: boolean): boolean | Promise { - if (typeof schema == "boolean") return true - let $schema: string | AnySchemaObject | undefined - $schema = schema.$schema - if ($schema !== undefined && typeof $schema != "string") { - throw new Error("$schema must be a string") - } - $schema = $schema || this.opts.defaultMeta || this.defaultMeta() - if (!$schema) { - this.logger.warn("meta-schema not available") - this.errors = null - return true - } - const valid = this.validate($schema, schema) - if (!valid && throwOrLogError) { - const message = "schema is invalid: " + this.errorsText() - if (this.opts.validateSchema === "log") this.logger.error(message) - else throw new Error(message) - } - return valid - } - - // Get compiled schema by `key` or `ref`. - // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id) - getSchema(keyRef: string): AnyValidateFunction | undefined { - let sch - while (typeof (sch = getSchEnv.call(this, keyRef)) == "string") keyRef = sch - if (sch === undefined) { - const {schemaId} = this.opts - const root = new SchemaEnv({schema: {}, schemaId}) - sch = resolveSchema.call(this, root, keyRef) - if (!sch) return - this.refs[keyRef] = sch - } - return (sch.validate || this._compileSchemaEnv(sch)) as AnyValidateFunction | undefined - } - - // Remove cached schema(s). - // If no parameter is passed all schemas but meta-schemas are removed. - // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. - // Even if schema is referenced by other schemas it still can be removed as other schemas have local references. - removeSchema(schemaKeyRef?: AnySchema | string | RegExp): Ajv { - if (schemaKeyRef instanceof RegExp) { - this._removeAllSchemas(this.schemas, schemaKeyRef) - this._removeAllSchemas(this.refs, schemaKeyRef) - return this - } - switch (typeof schemaKeyRef) { - case "undefined": - this._removeAllSchemas(this.schemas) - this._removeAllSchemas(this.refs) - this._cache.clear() - return this - case "string": { - const sch = getSchEnv.call(this, schemaKeyRef) - if (typeof sch == "object") this._cache.delete(sch.schema) - delete this.schemas[schemaKeyRef] - delete this.refs[schemaKeyRef] - return this - } - case "object": { - const cacheKey = schemaKeyRef - this._cache.delete(cacheKey) - let id = schemaKeyRef[this.opts.schemaId] - if (id) { - id = normalizeId(id) - delete this.schemas[id] - delete this.refs[id] - } - return this - } - default: - throw new Error("ajv.removeSchema: invalid parameter") - } - } - - // add "vocabulary" - a collection of keywords - addVocabulary(definitions: Vocabulary): Ajv { - for (const def of definitions) this.addKeyword(def) - return this - } - - addKeyword( - kwdOrDef: string | KeywordDefinition, - def?: KeywordDefinition // deprecated - ): Ajv { - let keyword: string | string[] - if (typeof kwdOrDef == "string") { - keyword = kwdOrDef - if (typeof def == "object") { - this.logger.warn("these parameters are deprecated, see docs for addKeyword") - def.keyword = keyword - } - } else if (typeof kwdOrDef == "object" && def === undefined) { - def = kwdOrDef - keyword = def.keyword - if (Array.isArray(keyword) && !keyword.length) { - throw new Error("addKeywords: keyword must be string or non-empty array") - } - } else { - throw new Error("invalid addKeywords parameters") - } - - checkKeyword.call(this, keyword, def) - if (!def) { - eachItem(keyword, (kwd) => addRule.call(this, kwd)) - return this - } - keywordMetaschema.call(this, def) - const definition: AddedKeywordDefinition = { - ...def, - type: getJSONTypes(def.type), - schemaType: getJSONTypes(def.schemaType), - } - eachItem( - keyword, - definition.type.length === 0 - ? (k) => addRule.call(this, k, definition) - : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t)) - ) - return this - } - - getKeyword(keyword: string): AddedKeywordDefinition | boolean { - const rule = this.RULES.all[keyword] - return typeof rule == "object" ? rule.definition : !!rule - } - - // Remove keyword - removeKeyword(keyword: string): Ajv { - // TODO return type should be Ajv - const {RULES} = this - delete RULES.keywords[keyword] - delete RULES.all[keyword] - for (const group of RULES.rules) { - const i = group.rules.findIndex((rule) => rule.keyword === keyword) - if (i >= 0) group.rules.splice(i, 1) - } - return this - } - - // Add format - addFormat(name: string, format: Format): Ajv { - if (typeof format == "string") format = new RegExp(format) - this.formats[name] = format - return this - } - - errorsText( - errors: ErrorObject[] | null | undefined = this.errors, // optional array of validation errors - {separator = ", ", dataVar = "data"}: ErrorsTextOptions = {} // optional options with properties `separator` and `dataVar` - ): string { - if (!errors || errors.length === 0) return "No errors" - return errors - .map((e) => `${dataVar}${e.instancePath} ${e.message}`) - .reduce((text, msg) => text + separator + msg) - } - - $dataMetaSchema(metaSchema: AnySchemaObject, keywordsJsonPointers: string[]): AnySchemaObject { - const rules = this.RULES.all - metaSchema = JSON.parse(JSON.stringify(metaSchema)) - for (const jsonPointer of keywordsJsonPointers) { - const segments = jsonPointer.split("/").slice(1) // first segment is an empty string - let keywords = metaSchema - for (const seg of segments) keywords = keywords[seg] as AnySchemaObject - - for (const key in rules) { - const rule = rules[key] - if (typeof rule != "object") continue - const {$data} = rule.definition - const schema = keywords[key] as AnySchemaObject | undefined - if ($data && schema) keywords[key] = schemaOrData(schema) - } - } - - return metaSchema - } - - private _removeAllSchemas(schemas: {[Ref in string]?: SchemaEnv | string}, regex?: RegExp): void { - for (const keyRef in schemas) { - const sch = schemas[keyRef] - if (!regex || regex.test(keyRef)) { - if (typeof sch == "string") { - delete schemas[keyRef] - } else if (sch && !sch.meta) { - this._cache.delete(sch.schema) - delete schemas[keyRef] - } - } - } - } - - _addSchema( - schema: AnySchema, - meta?: boolean, - baseId?: string, - validateSchema = this.opts.validateSchema, - addSchema = this.opts.addUsedSchema - ): SchemaEnv { - let id: string | undefined - const {schemaId} = this.opts - if (typeof schema == "object") { - id = schema[schemaId] - } else { - if (this.opts.jtd) throw new Error("schema must be object") - else if (typeof schema != "boolean") throw new Error("schema must be object or boolean") - } - let sch = this._cache.get(schema) - if (sch !== undefined) return sch - - baseId = normalizeId(id || baseId) - const localRefs = getSchemaRefs.call(this, schema, baseId) - sch = new SchemaEnv({schema, schemaId, meta, baseId, localRefs}) - this._cache.set(sch.schema, sch) - if (addSchema && !baseId.startsWith("#")) { - // TODO atm it is allowed to overwrite schemas without id (instead of not adding them) - if (baseId) this._checkUnique(baseId) - this.refs[baseId] = sch - } - if (validateSchema) this.validateSchema(schema, true) - return sch - } - - private _checkUnique(id: string): void { - if (this.schemas[id] || this.refs[id]) { - throw new Error(`schema with key or id "${id}" already exists`) - } - } - - private _compileSchemaEnv(sch: SchemaEnv): AnyValidateFunction { - if (sch.meta) this._compileMetaSchema(sch) - else compileSchema.call(this, sch) - - /* istanbul ignore if */ - if (!sch.validate) throw new Error("ajv implementation error") - return sch.validate - } - - private _compileMetaSchema(sch: SchemaEnv): void { - const currentOpts = this.opts - this.opts = this._metaOpts - try { - compileSchema.call(this, sch) - } finally { - this.opts = currentOpts - } - } -} - -export interface ErrorsTextOptions { - separator?: string - dataVar?: string -} - -function checkOptions( - this: Ajv, - checkOpts: OptionsInfo, - options: Options & RemovedOptions, - msg: string, - log: "warn" | "error" = "error" -): void { - for (const key in checkOpts) { - const opt = key as keyof typeof checkOpts - if (opt in options) this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`) - } -} - -function getSchEnv(this: Ajv, keyRef: string): SchemaEnv | string | undefined { - keyRef = normalizeId(keyRef) // TODO tests fail without this line - return this.schemas[keyRef] || this.refs[keyRef] -} - -function addInitialSchemas(this: Ajv): void { - const optsSchemas = this.opts.schemas - if (!optsSchemas) return - if (Array.isArray(optsSchemas)) this.addSchema(optsSchemas) - else for (const key in optsSchemas) this.addSchema(optsSchemas[key] as AnySchema, key) -} - -function addInitialFormats(this: Ajv): void { - for (const name in this.opts.formats) { - const format = this.opts.formats[name] - if (format) this.addFormat(name, format) - } -} - -function addInitialKeywords( - this: Ajv, - defs: Vocabulary | {[K in string]?: KeywordDefinition} -): void { - if (Array.isArray(defs)) { - this.addVocabulary(defs) - return - } - this.logger.warn("keywords option as map is deprecated, pass array") - for (const keyword in defs) { - const def = defs[keyword] as KeywordDefinition - if (!def.keyword) def.keyword = keyword - this.addKeyword(def) - } -} - -function getMetaSchemaOptions(this: Ajv): InstanceOptions { - const metaOpts = {...this.opts} - for (const opt of META_IGNORE_OPTIONS) delete metaOpts[opt] - return metaOpts -} - -const noLogs = {log() {}, warn() {}, error() {}} - -function getLogger(logger?: Partial | false): Logger { - if (logger === false) return noLogs - if (logger === undefined) return console - if (logger.log && logger.warn && logger.error) return logger as Logger - throw new Error("logger must implement log, warn and error methods") -} - -const KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i - -function checkKeyword(this: Ajv, keyword: string | string[], def?: KeywordDefinition): void { - const {RULES} = this - eachItem(keyword, (kwd) => { - if (RULES.keywords[kwd]) throw new Error(`Keyword ${kwd} is already defined`) - if (!KEYWORD_NAME.test(kwd)) throw new Error(`Keyword ${kwd} has invalid name`) - }) - if (!def) return - if (def.$data && !("code" in def || "validate" in def)) { - throw new Error('$data keyword must have "code" or "validate" function') - } -} - -function addRule( - this: Ajv, - keyword: string, - definition?: AddedKeywordDefinition, - dataType?: JSONType -): void { - const post = definition?.post - if (dataType && post) throw new Error('keyword with "post" flag cannot have "type"') - const {RULES} = this - let ruleGroup = post ? RULES.post : RULES.rules.find(({type: t}) => t === dataType) - if (!ruleGroup) { - ruleGroup = {type: dataType, rules: []} - RULES.rules.push(ruleGroup) - } - RULES.keywords[keyword] = true - if (!definition) return - - const rule: Rule = { - keyword, - definition: { - ...definition, - type: getJSONTypes(definition.type), - schemaType: getJSONTypes(definition.schemaType), - }, - } - if (definition.before) addBeforeRule.call(this, ruleGroup, rule, definition.before) - else ruleGroup.rules.push(rule) - RULES.all[keyword] = rule - definition.implements?.forEach((kwd) => this.addKeyword(kwd)) -} - -function addBeforeRule(this: Ajv, ruleGroup: RuleGroup, rule: Rule, before: string): void { - const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before) - if (i >= 0) { - ruleGroup.rules.splice(i, 0, rule) - } else { - ruleGroup.rules.push(rule) - this.logger.warn(`rule ${before} is not defined`) - } -} - -function keywordMetaschema(this: Ajv, def: KeywordDefinition): void { - let {metaSchema} = def - if (metaSchema === undefined) return - if (def.$data && this.opts.$data) metaSchema = schemaOrData(metaSchema) - def.validateSchema = this.compile(metaSchema, true) -} - -const $dataRef = { - $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", -} - -function schemaOrData(schema: AnySchema): AnySchemaObject { - return {anyOf: [schema, $dataRef]} -} diff --git a/node_modules/ajv/lib/jtd.ts b/node_modules/ajv/lib/jtd.ts deleted file mode 100644 index a7e7bce..0000000 --- a/node_modules/ajv/lib/jtd.ts +++ /dev/null @@ -1,132 +0,0 @@ -import type {AnySchemaObject, SchemaObject, JTDParser} from "./types" -import type {JTDSchemaType, SomeJTDSchemaType, JTDDataType} from "./types/jtd-schema" -import AjvCore, {CurrentOptions} from "./core" -import jtdVocabulary from "./vocabularies/jtd" -import jtdMetaSchema from "./refs/jtd-schema" -import compileSerializer from "./compile/jtd/serialize" -import compileParser from "./compile/jtd/parse" -import {SchemaEnv} from "./compile" - -const META_SCHEMA_ID = "JTD-meta-schema" - -type JTDOptions = CurrentOptions & { - // strict mode options not supported with JTD: - strict?: never - allowMatchingProperties?: never - allowUnionTypes?: never - validateFormats?: never - // validation and reporting options not supported with JTD: - $data?: never - verbose?: boolean - $comment?: never - formats?: never - loadSchema?: never - // options to modify validated data: - useDefaults?: never - coerceTypes?: never - // advanced options: - next?: never - unevaluated?: never - dynamicRef?: never - meta?: boolean - defaultMeta?: never - inlineRefs?: boolean - loopRequired?: never - multipleOfPrecision?: never -} - -export class Ajv extends AjvCore { - constructor(opts: JTDOptions = {}) { - super({ - ...opts, - jtd: true, - }) - } - - _addVocabularies(): void { - super._addVocabularies() - this.addVocabulary(jtdVocabulary) - } - - _addDefaultMetaSchema(): void { - super._addDefaultMetaSchema() - if (!this.opts.meta) return - this.addMetaSchema(jtdMetaSchema, META_SCHEMA_ID, false) - } - - defaultMeta(): string | AnySchemaObject | undefined { - return (this.opts.defaultMeta = - super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)) - } - - compileSerializer(schema: SchemaObject): (data: T) => string - // Separated for type inference to work - // eslint-disable-next-line @typescript-eslint/unified-signatures - compileSerializer(schema: JTDSchemaType): (data: T) => string - compileSerializer(schema: SchemaObject): (data: T) => string { - const sch = this._addSchema(schema) - return sch.serialize || this._compileSerializer(sch) - } - - compileParser(schema: SchemaObject): JTDParser - // Separated for type inference to work - // eslint-disable-next-line @typescript-eslint/unified-signatures - compileParser(schema: JTDSchemaType): JTDParser - compileParser(schema: SchemaObject): JTDParser { - const sch = this._addSchema(schema) - return (sch.parse || this._compileParser(sch)) as JTDParser - } - - private _compileSerializer(sch: SchemaEnv): (data: T) => string { - compileSerializer.call(this, sch, (sch.schema as AnySchemaObject).definitions || {}) - /* istanbul ignore if */ - if (!sch.serialize) throw new Error("ajv implementation error") - return sch.serialize - } - - private _compileParser(sch: SchemaEnv): JTDParser { - compileParser.call(this, sch, (sch.schema as AnySchemaObject).definitions || {}) - /* istanbul ignore if */ - if (!sch.parse) throw new Error("ajv implementation error") - return sch.parse - } -} - -module.exports = exports = Ajv -module.exports.Ajv = Ajv -Object.defineProperty(exports, "__esModule", {value: true}) - -export default Ajv - -export { - Format, - FormatDefinition, - AsyncFormatDefinition, - KeywordDefinition, - KeywordErrorDefinition, - CodeKeywordDefinition, - MacroKeywordDefinition, - FuncKeywordDefinition, - Vocabulary, - Schema, - SchemaObject, - AnySchemaObject, - AsyncSchema, - AnySchema, - ValidateFunction, - AsyncValidateFunction, - ErrorObject, - ErrorNoParams, - JTDParser, -} from "./types" - -export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core" -export {SchemaCxt, SchemaObjCxt} from "./compile" -export {KeywordCxt} from "./compile/validate" -export {JTDErrorObject} from "./vocabularies/jtd" -export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" - -export {JTDSchemaType, SomeJTDSchemaType, JTDDataType} -export {JTDOptions} -export {default as ValidationError} from "./runtime/validation_error" -export {default as MissingRefError} from "./compile/ref_error" diff --git a/node_modules/ajv/lib/refs/data.json b/node_modules/ajv/lib/refs/data.json index 9ffc9f5..64aac5b 100644 --- a/node_modules/ajv/lib/refs/data.json +++ b/node_modules/ajv/lib/refs/data.json @@ -1,13 +1,17 @@ { - "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", - "description": "Meta-schema for $data reference (JSON AnySchema extension proposal)", - "type": "object", - "required": ["$data"], - "properties": { - "$data": { - "type": "string", - "anyOf": [{"format": "relative-json-pointer"}, {"format": "json-pointer"}] - } - }, - "additionalProperties": false + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", + "description": "Meta-schema for $data reference (JSON Schema extension proposal)", + "type": "object", + "required": [ "$data" ], + "properties": { + "$data": { + "type": "string", + "anyOf": [ + { "format": "relative-json-pointer" }, + { "format": "json-pointer" } + ] + } + }, + "additionalProperties": false } diff --git a/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts b/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts deleted file mode 100644 index b6ea719..0000000 --- a/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type Ajv from "../../core" -import type {AnySchemaObject} from "../../types" -import * as metaSchema from "./schema.json" -import * as applicator from "./meta/applicator.json" -import * as content from "./meta/content.json" -import * as core from "./meta/core.json" -import * as format from "./meta/format.json" -import * as metadata from "./meta/meta-data.json" -import * as validation from "./meta/validation.json" - -const META_SUPPORT_DATA = ["/properties"] - -export default function addMetaSchema2019(this: Ajv, $data?: boolean): Ajv { - ;[ - metaSchema, - applicator, - content, - core, - with$data(this, format), - metadata, - with$data(this, validation), - ].forEach((sch) => this.addMetaSchema(sch, undefined, false)) - return this - - function with$data(ajv: Ajv, sch: AnySchemaObject): AnySchemaObject { - return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch - } -} diff --git a/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json b/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json deleted file mode 100644 index c5e91cf..0000000 --- a/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "https://json-schema.org/draft/2019-09/meta/applicator", - "$vocabulary": { - "https://json-schema.org/draft/2019-09/vocab/applicator": true - }, - "$recursiveAnchor": true, - - "title": "Applicator vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "additionalItems": {"$recursiveRef": "#"}, - "unevaluatedItems": {"$recursiveRef": "#"}, - "items": { - "anyOf": [{"$recursiveRef": "#"}, {"$ref": "#/$defs/schemaArray"}] - }, - "contains": {"$recursiveRef": "#"}, - "additionalProperties": {"$recursiveRef": "#"}, - "unevaluatedProperties": {"$recursiveRef": "#"}, - "properties": { - "type": "object", - "additionalProperties": {"$recursiveRef": "#"}, - "default": {} - }, - "patternProperties": { - "type": "object", - "additionalProperties": {"$recursiveRef": "#"}, - "propertyNames": {"format": "regex"}, - "default": {} - }, - "dependentSchemas": { - "type": "object", - "additionalProperties": { - "$recursiveRef": "#" - } - }, - "propertyNames": {"$recursiveRef": "#"}, - "if": {"$recursiveRef": "#"}, - "then": {"$recursiveRef": "#"}, - "else": {"$recursiveRef": "#"}, - "allOf": {"$ref": "#/$defs/schemaArray"}, - "anyOf": {"$ref": "#/$defs/schemaArray"}, - "oneOf": {"$ref": "#/$defs/schemaArray"}, - "not": {"$recursiveRef": "#"} - }, - "$defs": { - "schemaArray": { - "type": "array", - "minItems": 1, - "items": {"$recursiveRef": "#"} - } - } -} diff --git a/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json b/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json deleted file mode 100644 index b8f6373..0000000 --- a/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "https://json-schema.org/draft/2019-09/meta/content", - "$vocabulary": { - "https://json-schema.org/draft/2019-09/vocab/content": true - }, - "$recursiveAnchor": true, - - "title": "Content vocabulary meta-schema", - - "type": ["object", "boolean"], - "properties": { - "contentMediaType": {"type": "string"}, - "contentEncoding": {"type": "string"}, - "contentSchema": {"$recursiveRef": "#"} - } -} diff --git a/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json b/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json deleted file mode 100644 index f71adbf..0000000 --- a/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "https://json-schema.org/draft/2019-09/meta/core", - "$vocabulary": { - "https://json-schema.org/draft/2019-09/vocab/core": true - }, - "$recursiveAnchor": true, - - "title": "Core vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "$id": { - "type": "string", - "format": "uri-reference", - "$comment": "Non-empty fragments not allowed.", - "pattern": "^[^#]*#?$" - }, - "$schema": { - "type": "string", - "format": "uri" - }, - "$anchor": { - "type": "string", - "pattern": "^[A-Za-z][-A-Za-z0-9.:_]*$" - }, - "$ref": { - "type": "string", - "format": "uri-reference" - }, - "$recursiveRef": { - "type": "string", - "format": "uri-reference" - }, - "$recursiveAnchor": { - "type": "boolean", - "default": false - }, - "$vocabulary": { - "type": "object", - "propertyNames": { - "type": "string", - "format": "uri" - }, - "additionalProperties": { - "type": "boolean" - } - }, - "$comment": { - "type": "string" - }, - "$defs": { - "type": "object", - "additionalProperties": {"$recursiveRef": "#"}, - "default": {} - } - } -} diff --git a/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json b/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json deleted file mode 100644 index 03ccfce..0000000 --- a/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "https://json-schema.org/draft/2019-09/meta/format", - "$vocabulary": { - "https://json-schema.org/draft/2019-09/vocab/format": true - }, - "$recursiveAnchor": true, - - "title": "Format vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "format": {"type": "string"} - } -} diff --git a/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json b/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json deleted file mode 100644 index 0e19432..0000000 --- a/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "https://json-schema.org/draft/2019-09/meta/meta-data", - "$vocabulary": { - "https://json-schema.org/draft/2019-09/vocab/meta-data": true - }, - "$recursiveAnchor": true, - - "title": "Meta-data vocabulary meta-schema", - - "type": ["object", "boolean"], - "properties": { - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "default": true, - "deprecated": { - "type": "boolean", - "default": false - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "writeOnly": { - "type": "boolean", - "default": false - }, - "examples": { - "type": "array", - "items": true - } - } -} diff --git a/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json b/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json deleted file mode 100644 index 7027a12..0000000 --- a/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "https://json-schema.org/draft/2019-09/meta/validation", - "$vocabulary": { - "https://json-schema.org/draft/2019-09/vocab/validation": true - }, - "$recursiveAnchor": true, - - "title": "Validation vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "multipleOf": { - "type": "number", - "exclusiveMinimum": 0 - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "number" - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "number" - }, - "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, - "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, - "pattern": { - "type": "string", - "format": "regex" - }, - "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, - "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, - "minContains": { - "$ref": "#/$defs/nonNegativeInteger", - "default": 1 - }, - "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, - "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, - "required": {"$ref": "#/$defs/stringArray"}, - "dependentRequired": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/stringArray" - } - }, - "const": true, - "enum": { - "type": "array", - "items": true - }, - "type": { - "anyOf": [ - {"$ref": "#/$defs/simpleTypes"}, - { - "type": "array", - "items": {"$ref": "#/$defs/simpleTypes"}, - "minItems": 1, - "uniqueItems": true - } - ] - } - }, - "$defs": { - "nonNegativeInteger": { - "type": "integer", - "minimum": 0 - }, - "nonNegativeIntegerDefault0": { - "$ref": "#/$defs/nonNegativeInteger", - "default": 0 - }, - "simpleTypes": { - "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] - }, - "stringArray": { - "type": "array", - "items": {"type": "string"}, - "uniqueItems": true, - "default": [] - } - } -} diff --git a/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json b/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json deleted file mode 100644 index 54eb715..0000000 --- a/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "https://json-schema.org/draft/2019-09/schema", - "$vocabulary": { - "https://json-schema.org/draft/2019-09/vocab/core": true, - "https://json-schema.org/draft/2019-09/vocab/applicator": true, - "https://json-schema.org/draft/2019-09/vocab/validation": true, - "https://json-schema.org/draft/2019-09/vocab/meta-data": true, - "https://json-schema.org/draft/2019-09/vocab/format": false, - "https://json-schema.org/draft/2019-09/vocab/content": true - }, - "$recursiveAnchor": true, - - "title": "Core and Validation specifications meta-schema", - "allOf": [ - {"$ref": "meta/core"}, - {"$ref": "meta/applicator"}, - {"$ref": "meta/validation"}, - {"$ref": "meta/meta-data"}, - {"$ref": "meta/format"}, - {"$ref": "meta/content"} - ], - "type": ["object", "boolean"], - "properties": { - "definitions": { - "$comment": "While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.", - "type": "object", - "additionalProperties": {"$recursiveRef": "#"}, - "default": {} - }, - "dependencies": { - "$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"dependentSchemas\" and \"dependentRequired\"", - "type": "object", - "additionalProperties": { - "anyOf": [{"$recursiveRef": "#"}, {"$ref": "meta/validation#/$defs/stringArray"}] - } - } - } -} diff --git a/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts b/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts deleted file mode 100644 index 8e850d0..0000000 --- a/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type Ajv from "../../core" -import type {AnySchemaObject} from "../../types" -import * as metaSchema from "./schema.json" -import * as applicator from "./meta/applicator.json" -import * as unevaluated from "./meta/unevaluated.json" -import * as content from "./meta/content.json" -import * as core from "./meta/core.json" -import * as format from "./meta/format-annotation.json" -import * as metadata from "./meta/meta-data.json" -import * as validation from "./meta/validation.json" - -const META_SUPPORT_DATA = ["/properties"] - -export default function addMetaSchema2020(this: Ajv, $data?: boolean): Ajv { - ;[ - metaSchema, - applicator, - unevaluated, - content, - core, - with$data(this, format), - metadata, - with$data(this, validation), - ].forEach((sch) => this.addMetaSchema(sch, undefined, false)) - return this - - function with$data(ajv: Ajv, sch: AnySchemaObject): AnySchemaObject { - return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch - } -} diff --git a/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json b/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json deleted file mode 100644 index 674c913..0000000 --- a/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://json-schema.org/draft/2020-12/meta/applicator", - "$vocabulary": { - "https://json-schema.org/draft/2020-12/vocab/applicator": true - }, - "$dynamicAnchor": "meta", - - "title": "Applicator vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "prefixItems": {"$ref": "#/$defs/schemaArray"}, - "items": {"$dynamicRef": "#meta"}, - "contains": {"$dynamicRef": "#meta"}, - "additionalProperties": {"$dynamicRef": "#meta"}, - "properties": { - "type": "object", - "additionalProperties": {"$dynamicRef": "#meta"}, - "default": {} - }, - "patternProperties": { - "type": "object", - "additionalProperties": {"$dynamicRef": "#meta"}, - "propertyNames": {"format": "regex"}, - "default": {} - }, - "dependentSchemas": { - "type": "object", - "additionalProperties": {"$dynamicRef": "#meta"}, - "default": {} - }, - "propertyNames": {"$dynamicRef": "#meta"}, - "if": {"$dynamicRef": "#meta"}, - "then": {"$dynamicRef": "#meta"}, - "else": {"$dynamicRef": "#meta"}, - "allOf": {"$ref": "#/$defs/schemaArray"}, - "anyOf": {"$ref": "#/$defs/schemaArray"}, - "oneOf": {"$ref": "#/$defs/schemaArray"}, - "not": {"$dynamicRef": "#meta"} - }, - "$defs": { - "schemaArray": { - "type": "array", - "minItems": 1, - "items": {"$dynamicRef": "#meta"} - } - } -} diff --git a/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json b/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json deleted file mode 100644 index 2ae23dd..0000000 --- a/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://json-schema.org/draft/2020-12/meta/content", - "$vocabulary": { - "https://json-schema.org/draft/2020-12/vocab/content": true - }, - "$dynamicAnchor": "meta", - - "title": "Content vocabulary meta-schema", - - "type": ["object", "boolean"], - "properties": { - "contentEncoding": {"type": "string"}, - "contentMediaType": {"type": "string"}, - "contentSchema": {"$dynamicRef": "#meta"} - } -} diff --git a/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json b/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json deleted file mode 100644 index 4c8e5cb..0000000 --- a/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://json-schema.org/draft/2020-12/meta/core", - "$vocabulary": { - "https://json-schema.org/draft/2020-12/vocab/core": true - }, - "$dynamicAnchor": "meta", - - "title": "Core vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "$id": { - "$ref": "#/$defs/uriReferenceString", - "$comment": "Non-empty fragments not allowed.", - "pattern": "^[^#]*#?$" - }, - "$schema": {"$ref": "#/$defs/uriString"}, - "$ref": {"$ref": "#/$defs/uriReferenceString"}, - "$anchor": {"$ref": "#/$defs/anchorString"}, - "$dynamicRef": {"$ref": "#/$defs/uriReferenceString"}, - "$dynamicAnchor": {"$ref": "#/$defs/anchorString"}, - "$vocabulary": { - "type": "object", - "propertyNames": {"$ref": "#/$defs/uriString"}, - "additionalProperties": { - "type": "boolean" - } - }, - "$comment": { - "type": "string" - }, - "$defs": { - "type": "object", - "additionalProperties": {"$dynamicRef": "#meta"} - } - }, - "$defs": { - "anchorString": { - "type": "string", - "pattern": "^[A-Za-z_][-A-Za-z0-9._]*$" - }, - "uriString": { - "type": "string", - "format": "uri" - }, - "uriReferenceString": { - "type": "string", - "format": "uri-reference" - } - } -} diff --git a/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json b/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json deleted file mode 100644 index 83c26e3..0000000 --- a/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://json-schema.org/draft/2020-12/meta/format-annotation", - "$vocabulary": { - "https://json-schema.org/draft/2020-12/vocab/format-annotation": true - }, - "$dynamicAnchor": "meta", - - "title": "Format vocabulary meta-schema for annotation results", - "type": ["object", "boolean"], - "properties": { - "format": {"type": "string"} - } -} diff --git a/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json b/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json deleted file mode 100644 index 11946fb..0000000 --- a/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://json-schema.org/draft/2020-12/meta/meta-data", - "$vocabulary": { - "https://json-schema.org/draft/2020-12/vocab/meta-data": true - }, - "$dynamicAnchor": "meta", - - "title": "Meta-data vocabulary meta-schema", - - "type": ["object", "boolean"], - "properties": { - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "default": true, - "deprecated": { - "type": "boolean", - "default": false - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "writeOnly": { - "type": "boolean", - "default": false - }, - "examples": { - "type": "array", - "items": true - } - } -} diff --git a/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json b/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json deleted file mode 100644 index 5e4b203..0000000 --- a/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://json-schema.org/draft/2020-12/meta/unevaluated", - "$vocabulary": { - "https://json-schema.org/draft/2020-12/vocab/unevaluated": true - }, - "$dynamicAnchor": "meta", - - "title": "Unevaluated applicator vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "unevaluatedItems": {"$dynamicRef": "#meta"}, - "unevaluatedProperties": {"$dynamicRef": "#meta"} - } -} diff --git a/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json b/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json deleted file mode 100644 index e0ae13d..0000000 --- a/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://json-schema.org/draft/2020-12/meta/validation", - "$vocabulary": { - "https://json-schema.org/draft/2020-12/vocab/validation": true - }, - "$dynamicAnchor": "meta", - - "title": "Validation vocabulary meta-schema", - "type": ["object", "boolean"], - "properties": { - "type": { - "anyOf": [ - {"$ref": "#/$defs/simpleTypes"}, - { - "type": "array", - "items": {"$ref": "#/$defs/simpleTypes"}, - "minItems": 1, - "uniqueItems": true - } - ] - }, - "const": true, - "enum": { - "type": "array", - "items": true - }, - "multipleOf": { - "type": "number", - "exclusiveMinimum": 0 - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "number" - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "number" - }, - "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, - "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, - "pattern": { - "type": "string", - "format": "regex" - }, - "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, - "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, - "minContains": { - "$ref": "#/$defs/nonNegativeInteger", - "default": 1 - }, - "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, - "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, - "required": {"$ref": "#/$defs/stringArray"}, - "dependentRequired": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/stringArray" - } - } - }, - "$defs": { - "nonNegativeInteger": { - "type": "integer", - "minimum": 0 - }, - "nonNegativeIntegerDefault0": { - "$ref": "#/$defs/nonNegativeInteger", - "default": 0 - }, - "simpleTypes": { - "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] - }, - "stringArray": { - "type": "array", - "items": {"type": "string"}, - "uniqueItems": true, - "default": [] - } - } -} diff --git a/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json b/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json deleted file mode 100644 index 1c68270..0000000 --- a/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://json-schema.org/draft/2020-12/schema", - "$vocabulary": { - "https://json-schema.org/draft/2020-12/vocab/core": true, - "https://json-schema.org/draft/2020-12/vocab/applicator": true, - "https://json-schema.org/draft/2020-12/vocab/unevaluated": true, - "https://json-schema.org/draft/2020-12/vocab/validation": true, - "https://json-schema.org/draft/2020-12/vocab/meta-data": true, - "https://json-schema.org/draft/2020-12/vocab/format-annotation": true, - "https://json-schema.org/draft/2020-12/vocab/content": true - }, - "$dynamicAnchor": "meta", - - "title": "Core and Validation specifications meta-schema", - "allOf": [ - {"$ref": "meta/core"}, - {"$ref": "meta/applicator"}, - {"$ref": "meta/unevaluated"}, - {"$ref": "meta/validation"}, - {"$ref": "meta/meta-data"}, - {"$ref": "meta/format-annotation"}, - {"$ref": "meta/content"} - ], - "type": ["object", "boolean"], - "$comment": "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.", - "properties": { - "definitions": { - "$comment": "\"definitions\" has been replaced by \"$defs\".", - "type": "object", - "additionalProperties": {"$dynamicRef": "#meta"}, - "deprecated": true, - "default": {} - }, - "dependencies": { - "$comment": "\"dependencies\" has been split and replaced by \"dependentSchemas\" and \"dependentRequired\" in order to serve their differing semantics.", - "type": "object", - "additionalProperties": { - "anyOf": [{"$dynamicRef": "#meta"}, {"$ref": "meta/validation#/$defs/stringArray"}] - }, - "deprecated": true, - "default": {} - }, - "$recursiveAnchor": { - "$comment": "\"$recursiveAnchor\" has been replaced by \"$dynamicAnchor\".", - "$ref": "meta/core#/$defs/anchorString", - "deprecated": true - }, - "$recursiveRef": { - "$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".", - "$ref": "meta/core#/$defs/uriReferenceString", - "deprecated": true - } - } -} diff --git a/node_modules/ajv/lib/refs/json-schema-draft-06.json b/node_modules/ajv/lib/refs/json-schema-draft-06.json index 5410064..5656240 100644 --- a/node_modules/ajv/lib/refs/json-schema-draft-06.json +++ b/node_modules/ajv/lib/refs/json-schema-draft-06.json @@ -1,137 +1,154 @@ { - "$schema": "http://json-schema.org/draft-06/schema#", - "$id": "http://json-schema.org/draft-06/schema#", - "title": "Core schema meta-schema", - "definitions": { - "schemaArray": { - "type": "array", - "minItems": 1, - "items": {"$ref": "#"} - }, - "nonNegativeInteger": { - "type": "integer", - "minimum": 0 - }, - "nonNegativeIntegerDefault0": { - "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] - }, - "simpleTypes": { - "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] - }, - "stringArray": { - "type": "array", - "items": {"type": "string"}, - "uniqueItems": true, - "default": [] - } - }, - "type": ["object", "boolean"], - "properties": { - "$id": { - "type": "string", - "format": "uri-reference" - }, - "$schema": { - "type": "string", - "format": "uri" - }, - "$ref": { - "type": "string", - "format": "uri-reference" - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "default": {}, - "examples": { - "type": "array", - "items": {} - }, - "multipleOf": { - "type": "number", - "exclusiveMinimum": 0 - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "number" - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "number" - }, - "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, - "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, - "pattern": { - "type": "string", - "format": "regex" - }, - "additionalItems": {"$ref": "#"}, - "items": { - "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], - "default": {} - }, - "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, - "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "contains": {"$ref": "#"}, - "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, - "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, - "required": {"$ref": "#/definitions/stringArray"}, - "additionalProperties": {"$ref": "#"}, + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "http://json-schema.org/draft-06/schema#", + "title": "Core schema meta-schema", "definitions": { - "type": "object", - "additionalProperties": {"$ref": "#"}, - "default": {} - }, - "properties": { - "type": "object", - "additionalProperties": {"$ref": "#"}, - "default": {} - }, - "patternProperties": { - "type": "object", - "additionalProperties": {"$ref": "#"}, - "default": {} - }, - "dependencies": { - "type": "object", - "additionalProperties": { - "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] - } - }, - "propertyNames": {"$ref": "#"}, - "const": {}, - "enum": { - "type": "array", - "minItems": 1, - "uniqueItems": true - }, - "type": { - "anyOf": [ - {"$ref": "#/definitions/simpleTypes"}, - { - "type": "array", - "items": {"$ref": "#/definitions/simpleTypes"}, - "minItems": 1, - "uniqueItems": true + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] } - ] }, - "format": {"type": "string"}, - "allOf": {"$ref": "#/definitions/schemaArray"}, - "anyOf": {"$ref": "#/definitions/schemaArray"}, - "oneOf": {"$ref": "#/definitions/schemaArray"}, - "not": {"$ref": "#"} - }, - "default": {} + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "examples": { + "type": "array", + "items": {} + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": {} + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": {}, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": {} } diff --git a/node_modules/ajv/lib/refs/json-schema-draft-07.json b/node_modules/ajv/lib/refs/json-schema-draft-07.json index 6a74851..5bee90e 100644 --- a/node_modules/ajv/lib/refs/json-schema-draft-07.json +++ b/node_modules/ajv/lib/refs/json-schema-draft-07.json @@ -1,151 +1,168 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://json-schema.org/draft-07/schema#", - "title": "Core schema meta-schema", - "definitions": { - "schemaArray": { - "type": "array", - "minItems": 1, - "items": {"$ref": "#"} - }, - "nonNegativeInteger": { - "type": "integer", - "minimum": 0 - }, - "nonNegativeIntegerDefault0": { - "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] - }, - "simpleTypes": { - "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] - }, - "stringArray": { - "type": "array", - "items": {"type": "string"}, - "uniqueItems": true, - "default": [] - } - }, - "type": ["object", "boolean"], - "properties": { - "$id": { - "type": "string", - "format": "uri-reference" - }, - "$schema": { - "type": "string", - "format": "uri" - }, - "$ref": { - "type": "string", - "format": "uri-reference" - }, - "$comment": { - "type": "string" - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "default": true, - "readOnly": { - "type": "boolean", - "default": false - }, - "examples": { - "type": "array", - "items": true - }, - "multipleOf": { - "type": "number", - "exclusiveMinimum": 0 - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "number" - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "number" - }, - "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, - "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, - "pattern": { - "type": "string", - "format": "regex" - }, - "additionalItems": {"$ref": "#"}, - "items": { - "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], - "default": true - }, - "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, - "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "contains": {"$ref": "#"}, - "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, - "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, - "required": {"$ref": "#/definitions/stringArray"}, - "additionalProperties": {"$ref": "#"}, + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", "definitions": { - "type": "object", - "additionalProperties": {"$ref": "#"}, - "default": {} - }, - "properties": { - "type": "object", - "additionalProperties": {"$ref": "#"}, - "default": {} - }, - "patternProperties": { - "type": "object", - "additionalProperties": {"$ref": "#"}, - "propertyNames": {"format": "regex"}, - "default": {} - }, - "dependencies": { - "type": "object", - "additionalProperties": { - "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] - } - }, - "propertyNames": {"$ref": "#"}, - "const": true, - "enum": { - "type": "array", - "items": true, - "minItems": 1, - "uniqueItems": true - }, - "type": { - "anyOf": [ - {"$ref": "#/definitions/simpleTypes"}, - { - "type": "array", - "items": {"$ref": "#/definitions/simpleTypes"}, - "minItems": 1, - "uniqueItems": true + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] } - ] }, - "format": {"type": "string"}, - "contentMediaType": {"type": "string"}, - "contentEncoding": {"type": "string"}, - "if": {"$ref": "#"}, - "then": {"$ref": "#"}, - "else": {"$ref": "#"}, - "allOf": {"$ref": "#/definitions/schemaArray"}, - "anyOf": {"$ref": "#/definitions/schemaArray"}, - "oneOf": {"$ref": "#/definitions/schemaArray"}, - "not": {"$ref": "#"} - }, - "default": true + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": true + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "propertyNames": { "format": "regex" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "contentMediaType": { "type": "string" }, + "contentEncoding": { "type": "string" }, + "if": {"$ref": "#"}, + "then": {"$ref": "#"}, + "else": {"$ref": "#"}, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": true } diff --git a/node_modules/ajv/lib/refs/json-schema-secure.json b/node_modules/ajv/lib/refs/json-schema-secure.json index 3968abd..0f7aad4 100644 --- a/node_modules/ajv/lib/refs/json-schema-secure.json +++ b/node_modules/ajv/lib/refs/json-schema-secure.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/json-schema-secure.json#", "title": "Meta-schema for the security assessment of JSON Schemas", - "description": "If a JSON AnySchema fails validation against this meta-schema, it may be unsafe to validate untrusted data", + "description": "If a JSON Schema fails validation against this meta-schema, it may be unsafe to validate untrusted data", "definitions": { "schemaArray": { "type": "array", @@ -60,11 +60,17 @@ "additionalProperties": {"$ref": "#"}, "dependencies": { "additionalProperties": { - "anyOf": [{"type": "array"}, {"$ref": "#"}] + "anyOf": [ + {"type": "array"}, + {"$ref": "#"} + ] } }, "items": { - "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}] + "anyOf": [ + {"$ref": "#"}, + {"$ref": "#/definitions/schemaArray"} + ] }, "definitions": { "additionalProperties": {"$ref": "#"} diff --git a/node_modules/ajv/lib/refs/jtd-schema.ts b/node_modules/ajv/lib/refs/jtd-schema.ts deleted file mode 100644 index c019812..0000000 --- a/node_modules/ajv/lib/refs/jtd-schema.ts +++ /dev/null @@ -1,130 +0,0 @@ -import {SchemaObject} from "../types" - -type MetaSchema = (root: boolean) => SchemaObject - -const shared: MetaSchema = (root) => { - const sch: SchemaObject = { - nullable: {type: "boolean"}, - metadata: { - optionalProperties: { - union: {elements: {ref: "schema"}}, - }, - additionalProperties: true, - }, - } - if (root) sch.definitions = {values: {ref: "schema"}} - return sch -} - -const emptyForm: MetaSchema = (root) => ({ - optionalProperties: shared(root), -}) - -const refForm: MetaSchema = (root) => ({ - properties: { - ref: {type: "string"}, - }, - optionalProperties: shared(root), -}) - -const typeForm: MetaSchema = (root) => ({ - properties: { - type: { - enum: [ - "boolean", - "timestamp", - "string", - "float32", - "float64", - "int8", - "uint8", - "int16", - "uint16", - "int32", - "uint32", - ], - }, - }, - optionalProperties: shared(root), -}) - -const enumForm: MetaSchema = (root) => ({ - properties: { - enum: {elements: {type: "string"}}, - }, - optionalProperties: shared(root), -}) - -const elementsForm: MetaSchema = (root) => ({ - properties: { - elements: {ref: "schema"}, - }, - optionalProperties: shared(root), -}) - -const propertiesForm: MetaSchema = (root) => ({ - properties: { - properties: {values: {ref: "schema"}}, - }, - optionalProperties: { - optionalProperties: {values: {ref: "schema"}}, - additionalProperties: {type: "boolean"}, - ...shared(root), - }, -}) - -const optionalPropertiesForm: MetaSchema = (root) => ({ - properties: { - optionalProperties: {values: {ref: "schema"}}, - }, - optionalProperties: { - additionalProperties: {type: "boolean"}, - ...shared(root), - }, -}) - -const discriminatorForm: MetaSchema = (root) => ({ - properties: { - discriminator: {type: "string"}, - mapping: { - values: { - metadata: { - union: [propertiesForm(false), optionalPropertiesForm(false)], - }, - }, - }, - }, - optionalProperties: shared(root), -}) - -const valuesForm: MetaSchema = (root) => ({ - properties: { - values: {ref: "schema"}, - }, - optionalProperties: shared(root), -}) - -const schema: MetaSchema = (root) => ({ - metadata: { - union: [ - emptyForm, - refForm, - typeForm, - enumForm, - elementsForm, - propertiesForm, - optionalPropertiesForm, - discriminatorForm, - valuesForm, - ].map((s) => s(root)), - }, -}) - -const jtdMetaSchema: SchemaObject = { - definitions: { - schema: schema(false), - }, - ...schema(true), -} - -export default jtdMetaSchema diff --git a/node_modules/ajv/lib/runtime/equal.ts b/node_modules/ajv/lib/runtime/equal.ts deleted file mode 100644 index 3cb0063..0000000 --- a/node_modules/ajv/lib/runtime/equal.ts +++ /dev/null @@ -1,7 +0,0 @@ -// https://github.com/ajv-validator/ajv/issues/889 -import * as equal from "fast-deep-equal" - -type Equal = typeof equal & {code: string} -;(equal as Equal).code = 'require("ajv/dist/runtime/equal").default' - -export default equal as Equal diff --git a/node_modules/ajv/lib/runtime/parseJson.ts b/node_modules/ajv/lib/runtime/parseJson.ts deleted file mode 100644 index 472e5e5..0000000 --- a/node_modules/ajv/lib/runtime/parseJson.ts +++ /dev/null @@ -1,177 +0,0 @@ -const rxParseJson = /position\s(\d+)(?: \(line \d+ column \d+\))?$/ - -export function parseJson(s: string, pos: number): unknown { - let endPos: number | undefined - parseJson.message = undefined - let matches: RegExpExecArray | null - if (pos) s = s.slice(pos) - try { - parseJson.position = pos + s.length - return JSON.parse(s) - } catch (e) { - matches = rxParseJson.exec((e as Error).message) - if (!matches) { - parseJson.message = "unexpected end" - return undefined - } - endPos = +matches[1] - const c = s[endPos] - s = s.slice(0, endPos) - parseJson.position = pos + endPos - try { - return JSON.parse(s) - } catch (e1) { - parseJson.message = `unexpected token ${c}` - return undefined - } - } -} - -parseJson.message = undefined as string | undefined -parseJson.position = 0 as number -parseJson.code = 'require("ajv/dist/runtime/parseJson").parseJson' - -export function parseJsonNumber(s: string, pos: number, maxDigits?: number): number | undefined { - let numStr = "" - let c: string - parseJsonNumber.message = undefined - if (s[pos] === "-") { - numStr += "-" - pos++ - } - if (s[pos] === "0") { - numStr += "0" - pos++ - } else { - if (!parseDigits(maxDigits)) { - errorMessage() - return undefined - } - } - if (maxDigits) { - parseJsonNumber.position = pos - return +numStr - } - if (s[pos] === ".") { - numStr += "." - pos++ - if (!parseDigits()) { - errorMessage() - return undefined - } - } - if (((c = s[pos]), c === "e" || c === "E")) { - numStr += "e" - pos++ - if (((c = s[pos]), c === "+" || c === "-")) { - numStr += c - pos++ - } - if (!parseDigits()) { - errorMessage() - return undefined - } - } - parseJsonNumber.position = pos - return +numStr - - function parseDigits(maxLen?: number): boolean { - let digit = false - while (((c = s[pos]), c >= "0" && c <= "9" && (maxLen === undefined || maxLen-- > 0))) { - digit = true - numStr += c - pos++ - } - return digit - } - - function errorMessage(): void { - parseJsonNumber.position = pos - parseJsonNumber.message = pos < s.length ? `unexpected token ${s[pos]}` : "unexpected end" - } -} - -parseJsonNumber.message = undefined as string | undefined -parseJsonNumber.position = 0 as number -parseJsonNumber.code = 'require("ajv/dist/runtime/parseJson").parseJsonNumber' - -const escapedChars: {[X in string]?: string} = { - b: "\b", - f: "\f", - n: "\n", - r: "\r", - t: "\t", - '"': '"', - "/": "/", - "\\": "\\", -} - -const CODE_A: number = "a".charCodeAt(0) -const CODE_0: number = "0".charCodeAt(0) - -export function parseJsonString(s: string, pos: number): string | undefined { - let str = "" - let c: string | undefined - parseJsonString.message = undefined - // eslint-disable-next-line no-constant-condition, @typescript-eslint/no-unnecessary-condition - while (true) { - c = s[pos++] - if (c === '"') break - if (c === "\\") { - c = s[pos] - if (c in escapedChars) { - str += escapedChars[c] - pos++ - } else if (c === "u") { - pos++ - let count = 4 - let code = 0 - while (count--) { - code <<= 4 - c = s[pos] - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (c === undefined) { - errorMessage("unexpected end") - return undefined - } - c = c.toLowerCase() - if (c >= "a" && c <= "f") { - code += c.charCodeAt(0) - CODE_A + 10 - } else if (c >= "0" && c <= "9") { - code += c.charCodeAt(0) - CODE_0 - } else { - errorMessage(`unexpected token ${c}`) - return undefined - } - pos++ - } - str += String.fromCharCode(code) - } else { - errorMessage(`unexpected token ${c}`) - return undefined - } - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - } else if (c === undefined) { - errorMessage("unexpected end") - return undefined - } else { - if (c.charCodeAt(0) >= 0x20) { - str += c - } else { - errorMessage(`unexpected token ${c}`) - return undefined - } - } - } - parseJsonString.position = pos - return str - - function errorMessage(msg: string): void { - parseJsonString.position = pos - parseJsonString.message = msg - } -} - -parseJsonString.message = undefined as string | undefined -parseJsonString.position = 0 as number -parseJsonString.code = 'require("ajv/dist/runtime/parseJson").parseJsonString' diff --git a/node_modules/ajv/lib/runtime/quote.ts b/node_modules/ajv/lib/runtime/quote.ts deleted file mode 100644 index 1160e6a..0000000 --- a/node_modules/ajv/lib/runtime/quote.ts +++ /dev/null @@ -1,31 +0,0 @@ -const rxEscapable = - // eslint-disable-next-line no-control-regex, no-misleading-character-class - /[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g - -const escaped: {[K in string]?: string} = { - "\b": "\\b", - "\t": "\\t", - "\n": "\\n", - "\f": "\\f", - "\r": "\\r", - '"': '\\"', - "\\": "\\\\", -} - -export default function quote(s: string): string { - rxEscapable.lastIndex = 0 - return ( - '"' + - (rxEscapable.test(s) - ? s.replace(rxEscapable, (a) => { - const c = escaped[a] - return typeof c === "string" - ? c - : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4) - }) - : s) + - '"' - ) -} - -quote.code = 'require("ajv/dist/runtime/quote").default' diff --git a/node_modules/ajv/lib/runtime/re2.ts b/node_modules/ajv/lib/runtime/re2.ts deleted file mode 100644 index 0c769bc..0000000 --- a/node_modules/ajv/lib/runtime/re2.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as re2 from "re2" - -type Re2 = typeof re2 & {code: string} -;(re2 as Re2).code = 'require("ajv/dist/runtime/re2").default' - -export default re2 as Re2 diff --git a/node_modules/ajv/lib/runtime/timestamp.ts b/node_modules/ajv/lib/runtime/timestamp.ts deleted file mode 100644 index 1625f9a..0000000 --- a/node_modules/ajv/lib/runtime/timestamp.ts +++ /dev/null @@ -1,46 +0,0 @@ -const DT_SEPARATOR = /t|\s/i -const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/ -const TIME = /^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:z|([+-]\d\d)(?::?(\d\d))?)$/i -const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] - -export default function validTimestamp(str: string, allowDate: boolean): boolean { - // http://tools.ietf.org/html/rfc3339#section-5.6 - const dt: string[] = str.split(DT_SEPARATOR) - return ( - (dt.length === 2 && validDate(dt[0]) && validTime(dt[1])) || - (allowDate && dt.length === 1 && validDate(dt[0])) - ) -} - -function validDate(str: string): boolean { - const matches: string[] | null = DATE.exec(str) - if (!matches) return false - const y: number = +matches[1] - const m: number = +matches[2] - const d: number = +matches[3] - return ( - m >= 1 && - m <= 12 && - d >= 1 && - (d <= DAYS[m] || - // leap year: https://tools.ietf.org/html/rfc3339#appendix-C - (m === 2 && d === 29 && (y % 100 === 0 ? y % 400 === 0 : y % 4 === 0))) - ) -} - -function validTime(str: string): boolean { - const matches: string[] | null = TIME.exec(str) - if (!matches) return false - const hr: number = +matches[1] - const min: number = +matches[2] - const sec: number = +matches[3] - const tzH: number = +(matches[4] || 0) - const tzM: number = +(matches[5] || 0) - return ( - (hr <= 23 && min <= 59 && sec <= 59) || - // leap second - (hr - tzH === 23 && min - tzM === 59 && sec === 60) - ) -} - -validTimestamp.code = 'require("ajv/dist/runtime/timestamp").default' diff --git a/node_modules/ajv/lib/runtime/ucs2length.ts b/node_modules/ajv/lib/runtime/ucs2length.ts deleted file mode 100644 index 47d8292..0000000 --- a/node_modules/ajv/lib/runtime/ucs2length.ts +++ /dev/null @@ -1,20 +0,0 @@ -// https://mathiasbynens.be/notes/javascript-encoding -// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode -export default function ucs2length(str: string): number { - const len = str.length - let length = 0 - let pos = 0 - let value: number - while (pos < len) { - length++ - value = str.charCodeAt(pos++) - if (value >= 0xd800 && value <= 0xdbff && pos < len) { - // high surrogate, and there is a next character - value = str.charCodeAt(pos) - if ((value & 0xfc00) === 0xdc00) pos++ // low surrogate - } - } - return length -} - -ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default' diff --git a/node_modules/ajv/lib/runtime/uri.ts b/node_modules/ajv/lib/runtime/uri.ts deleted file mode 100644 index 5450549..0000000 --- a/node_modules/ajv/lib/runtime/uri.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as uri from "fast-uri" - -type URI = typeof uri & {code: string} -;(uri as URI).code = 'require("ajv/dist/runtime/uri").default' - -export default uri as URI diff --git a/node_modules/ajv/lib/runtime/validation_error.ts b/node_modules/ajv/lib/runtime/validation_error.ts deleted file mode 100644 index 2d19a46..0000000 --- a/node_modules/ajv/lib/runtime/validation_error.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type {ErrorObject} from "../types" - -export default class ValidationError extends Error { - readonly errors: Partial[] - readonly ajv: true - readonly validation: true - - constructor(errors: Partial[]) { - super("validation failed") - this.errors = errors - this.ajv = this.validation = true - } -} diff --git a/node_modules/ajv/lib/standalone/index.ts b/node_modules/ajv/lib/standalone/index.ts deleted file mode 100644 index b6129ce..0000000 --- a/node_modules/ajv/lib/standalone/index.ts +++ /dev/null @@ -1,100 +0,0 @@ -import type AjvCore from "../core" -import type {AnyValidateFunction, SourceCode} from "../types" -import type {SchemaEnv} from "../compile" -import {UsedScopeValues, UsedValueState, ValueScopeName, varKinds} from "../compile/codegen/scope" -import {_, nil, _Code, Code, getProperty, getEsmExportName} from "../compile/codegen/code" - -function standaloneCode( - ajv: AjvCore, - refsOrFunc?: {[K in string]?: string} | AnyValidateFunction -): string { - if (!ajv.opts.code.source) { - throw new Error("moduleCode: ajv instance must have code.source option") - } - const {_n} = ajv.scope.opts - return typeof refsOrFunc == "function" - ? funcExportCode(refsOrFunc.source) - : refsOrFunc !== undefined - ? multiExportsCode(refsOrFunc, getValidate) - : multiExportsCode(ajv.schemas, (sch) => - sch.meta ? undefined : ajv.compile(sch.schema) - ) - - function getValidate(id: string): AnyValidateFunction { - const v = ajv.getSchema(id) - if (!v) throw new Error(`moduleCode: no schema with id ${id}`) - return v - } - - function funcExportCode(source?: SourceCode): string { - const usedValues: UsedScopeValues = {} - const n = source?.validateName - const vCode = validateCode(usedValues, source) - if (ajv.opts.code.esm) { - // Always do named export as `validate` rather than the variable `n` which is `validateXX` for known export value - return `"use strict";${_n}export const validate = ${n};${_n}export default ${n};${_n}${vCode}` - } - return `"use strict";${_n}module.exports = ${n};${_n}module.exports.default = ${n};${_n}${vCode}` - } - - function multiExportsCode( - schemas: {[K in string]?: T}, - getValidateFunc: (schOrId: T) => AnyValidateFunction | undefined - ): string { - const usedValues: UsedScopeValues = {} - let code = _`"use strict";` - for (const name in schemas) { - const v = getValidateFunc(schemas[name] as T) - if (v) { - const vCode = validateCode(usedValues, v.source) - const exportSyntax = ajv.opts.code.esm - ? _`export const ${getEsmExportName(name)}` - : _`exports${getProperty(name)}` - code = _`${code}${_n}${exportSyntax} = ${v.source?.validateName};${_n}${vCode}` - } - } - return `${code}` - } - - function validateCode(usedValues: UsedScopeValues, s?: SourceCode): Code { - if (!s) throw new Error('moduleCode: function does not have "source" property') - if (usedState(s.validateName) === UsedValueState.Completed) return nil - setUsedState(s.validateName, UsedValueState.Started) - - const scopeCode = ajv.scope.scopeCode(s.scopeValues, usedValues, refValidateCode) - const code = new _Code(`${scopeCode}${_n}${s.validateCode}`) - return s.evaluated ? _`${code}${s.validateName}.evaluated = ${s.evaluated};${_n}` : code - - function refValidateCode(n: ValueScopeName): Code | undefined { - const vRef = n.value?.ref - if (n.prefix === "validate" && typeof vRef == "function") { - const v = vRef as AnyValidateFunction - return validateCode(usedValues, v.source) - } else if ((n.prefix === "root" || n.prefix === "wrapper") && typeof vRef == "object") { - const {validate, validateName} = vRef as SchemaEnv - if (!validateName) throw new Error("ajv internal error") - const def = ajv.opts.code.es5 ? varKinds.var : varKinds.const - const wrapper = _`${def} ${n} = {validate: ${validateName}};` - if (usedState(validateName) === UsedValueState.Started) return wrapper - const vCode = validateCode(usedValues, validate?.source) - return _`${wrapper}${_n}${vCode}` - } - return undefined - } - - function usedState(name: ValueScopeName): UsedValueState | undefined { - return usedValues[name.prefix]?.get(name) - } - - function setUsedState(name: ValueScopeName, state: UsedValueState): void { - const {prefix} = name - const names = (usedValues[prefix] = usedValues[prefix] || new Map()) - names.set(name, state) - } - } -} - -module.exports = exports = standaloneCode -Object.defineProperty(exports, "__esModule", {value: true}) - -export default standaloneCode diff --git a/node_modules/ajv/lib/standalone/instance.ts b/node_modules/ajv/lib/standalone/instance.ts deleted file mode 100644 index c4b2c30..0000000 --- a/node_modules/ajv/lib/standalone/instance.ts +++ /dev/null @@ -1,36 +0,0 @@ -import Ajv, {AnySchema, AnyValidateFunction, ErrorObject} from "../core" -import standaloneCode from "." -import * as requireFromString from "require-from-string" - -export default class AjvPack { - errors?: ErrorObject[] | null // errors from the last validation - constructor(readonly ajv: Ajv) {} - - validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise { - return Ajv.prototype.validate.call(this, schemaKeyRef, data) - } - - compile(schema: AnySchema, meta?: boolean): AnyValidateFunction { - return this.getStandalone(this.ajv.compile(schema, meta)) - } - - getSchema(keyRef: string): AnyValidateFunction | undefined { - const v = this.ajv.getSchema(keyRef) - if (!v) return undefined - return this.getStandalone(v) - } - - private getStandalone(v: AnyValidateFunction): AnyValidateFunction { - return requireFromString(standaloneCode(this.ajv, v)) as AnyValidateFunction - } - - addSchema(...args: Parameters): AjvPack { - this.ajv.addSchema.call(this.ajv, ...args) - return this - } - - addKeyword(...args: Parameters): AjvPack { - this.ajv.addKeyword.call(this.ajv, ...args) - return this - } -} diff --git a/node_modules/ajv/lib/types/index.ts b/node_modules/ajv/lib/types/index.ts deleted file mode 100644 index 39bc51b..0000000 --- a/node_modules/ajv/lib/types/index.ts +++ /dev/null @@ -1,244 +0,0 @@ -import {URIComponent} from "fast-uri" -import type {CodeGen, Code, Name, ScopeValueSets, ValueScopeName} from "../compile/codegen" -import type {SchemaEnv, SchemaCxt, SchemaObjCxt} from "../compile" -import type {JSONType} from "../compile/rules" -import type {KeywordCxt} from "../compile/validate" -import type Ajv from "../core" - -interface _SchemaObject { - id?: string - $id?: string - $schema?: string - [x: string]: any // TODO -} - -export interface SchemaObject extends _SchemaObject { - id?: string - $id?: string - $schema?: string - $async?: false - [x: string]: any // TODO -} - -export interface AsyncSchema extends _SchemaObject { - $async: true -} - -export type AnySchemaObject = SchemaObject | AsyncSchema - -export type Schema = SchemaObject | boolean - -export type AnySchema = Schema | AsyncSchema - -export type SchemaMap = {[Key in string]?: AnySchema} - -export interface SourceCode { - validateName: ValueScopeName - validateCode: string - scopeValues: ScopeValueSets - evaluated?: Code -} - -export interface DataValidationCxt { - instancePath: string - parentData: {[K in T]: any} // object or array - parentDataProperty: T // string or number - rootData: Record | any[] - dynamicAnchors: {[Ref in string]?: ValidateFunction} -} - -export interface ValidateFunction { - // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents - (this: Ajv | any, data: any, dataCxt?: DataValidationCxt): data is T - errors?: null | ErrorObject[] - evaluated?: Evaluated - schema: AnySchema - schemaEnv: SchemaEnv - source?: SourceCode -} - -export interface JTDParser { - (json: string): T | undefined - message?: string - position?: number -} - -export type EvaluatedProperties = {[K in string]?: true} | true - -export type EvaluatedItems = number | true - -export interface Evaluated { - // determined at compile time if staticProps/Items is true - props?: EvaluatedProperties - items?: EvaluatedItems - // whether props/items determined at compile time - dynamicProps: boolean - dynamicItems: boolean -} - -export interface AsyncValidateFunction extends ValidateFunction { - (...args: Parameters>): Promise - $async: true -} - -export type AnyValidateFunction = ValidateFunction | AsyncValidateFunction - -export interface ErrorObject, S = unknown> { - keyword: K - instancePath: string - schemaPath: string - params: P - // Added to validation errors of "propertyNames" keyword schema - propertyName?: string - // Excluded if option `messages` set to false. - message?: string - // These are added with the `verbose` option. - schema?: S - parentSchema?: AnySchemaObject - data?: unknown -} - -export type ErrorNoParams = ErrorObject, S> - -interface _KeywordDef { - keyword: string | string[] - type?: JSONType | JSONType[] // data types that keyword applies to - schemaType?: JSONType | JSONType[] // allowed type(s) of keyword value in the schema - allowUndefined?: boolean // used for keywords that can be invoked by other keywords, not being present in the schema - $data?: boolean // keyword supports [$data reference](../../docs/guide/combining-schemas.md#data-reference) - implements?: string[] // other schema keywords that this keyword implements - before?: string // keyword should be executed before this keyword (should be applicable to the same type) - post?: boolean // keyword should be executed after other keywords without post flag - metaSchema?: AnySchemaObject // meta-schema for keyword schema value - it is better to use schemaType where applicable - validateSchema?: AnyValidateFunction // compiled keyword metaSchema - should not be passed - dependencies?: string[] // keywords that must be present in the same schema - error?: KeywordErrorDefinition - $dataError?: KeywordErrorDefinition -} - -export interface CodeKeywordDefinition extends _KeywordDef { - code: (cxt: KeywordCxt, ruleType?: string) => void - trackErrors?: boolean -} - -export type MacroKeywordFunc = ( - schema: any, - parentSchema: AnySchemaObject, - it: SchemaCxt -) => AnySchema - -export type CompileKeywordFunc = ( - schema: any, - parentSchema: AnySchemaObject, - it: SchemaObjCxt -) => DataValidateFunction - -export interface DataValidateFunction { - (...args: Parameters): boolean | Promise - errors?: Partial[] -} - -export interface SchemaValidateFunction { - ( - schema: any, - data: any, - parentSchema?: AnySchemaObject, - dataCxt?: DataValidationCxt - ): boolean | Promise - errors?: Partial[] -} - -export interface FuncKeywordDefinition extends _KeywordDef { - validate?: SchemaValidateFunction | DataValidateFunction - compile?: CompileKeywordFunc - // schema: false makes validate not to expect schema (DataValidateFunction) - schema?: boolean // requires "validate" - modifying?: boolean - async?: boolean - valid?: boolean - errors?: boolean | "full" -} - -export interface MacroKeywordDefinition extends FuncKeywordDefinition { - macro: MacroKeywordFunc -} - -export type KeywordDefinition = - | CodeKeywordDefinition - | FuncKeywordDefinition - | MacroKeywordDefinition - -export type AddedKeywordDefinition = KeywordDefinition & { - type: JSONType[] - schemaType: JSONType[] -} - -export interface KeywordErrorDefinition { - message: string | Code | ((cxt: KeywordErrorCxt) => string | Code) - params?: Code | ((cxt: KeywordErrorCxt) => Code) -} - -export type Vocabulary = (KeywordDefinition | string)[] - -export interface KeywordErrorCxt { - gen: CodeGen - keyword: string - data: Name - $data?: string | false - schema: any // TODO - parentSchema?: AnySchemaObject - schemaCode: Code | number | boolean - schemaValue: Code | number | boolean - schemaType?: JSONType[] - errsCount?: Name - params: KeywordCxtParams - it: SchemaCxt -} - -export type KeywordCxtParams = {[P in string]?: Code | string | number} - -export type FormatValidator = (data: T) => boolean - -export type FormatCompare = (data1: T, data2: T) => number | undefined - -export type AsyncFormatValidator = (data: T) => Promise - -export interface FormatDefinition { - type?: T extends string ? "string" | undefined : "number" - validate: FormatValidator | (T extends string ? string | RegExp : never) - async?: false | undefined - compare?: FormatCompare -} - -export interface AsyncFormatDefinition { - type?: T extends string ? "string" | undefined : "number" - validate: AsyncFormatValidator - async: true - compare?: FormatCompare -} - -export type AddedFormat = - | true - | RegExp - | FormatValidator - | FormatDefinition - | FormatDefinition - | AsyncFormatDefinition - | AsyncFormatDefinition - -export type Format = AddedFormat | string - -export interface RegExpEngine { - (pattern: string, u: string): RegExpLike - code: string -} - -export interface RegExpLike { - test: (s: string) => boolean -} - -export interface UriResolver { - parse(uri: string): URIComponent - resolve(base: string, path: string): string - serialize(component: URIComponent): string -} diff --git a/node_modules/ajv/lib/types/json-schema.ts b/node_modules/ajv/lib/types/json-schema.ts deleted file mode 100644 index 065c972..0000000 --- a/node_modules/ajv/lib/types/json-schema.ts +++ /dev/null @@ -1,187 +0,0 @@ -/* eslint-disable @typescript-eslint/no-empty-interface */ -type StrictNullChecksWrapper = undefined extends null - ? `strictNullChecks must be true in tsconfig to use ${Name}` - : Type - -type UnionToIntersection = (U extends any ? (_: U) => void : never) extends (_: infer I) => void - ? I - : never - -export type SomeJSONSchema = UncheckedJSONSchemaType - -type UncheckedPartialSchema = Partial> - -export type PartialSchema = StrictNullChecksWrapper<"PartialSchema", UncheckedPartialSchema> - -type JSONType = IsPartial extends true - ? T | undefined - : T - -interface NumberKeywords { - minimum?: number - maximum?: number - exclusiveMinimum?: number - exclusiveMaximum?: number - multipleOf?: number - format?: string -} - -interface StringKeywords { - minLength?: number - maxLength?: number - pattern?: string - format?: string -} - -type UncheckedJSONSchemaType = ( - | // these two unions allow arbitrary unions of types - { - anyOf: readonly UncheckedJSONSchemaType[] - } - | { - oneOf: readonly UncheckedJSONSchemaType[] - } - // this union allows for { type: (primitive)[] } style schemas - | ({ - type: readonly (T extends number - ? JSONType<"number" | "integer", IsPartial> - : T extends string - ? JSONType<"string", IsPartial> - : T extends boolean - ? JSONType<"boolean", IsPartial> - : never)[] - } & UnionToIntersection< - T extends number - ? NumberKeywords - : T extends string - ? StringKeywords - : T extends boolean - ? // eslint-disable-next-line @typescript-eslint/ban-types - {} - : never - >) - // this covers "normal" types; it's last so typescript looks to it first for errors - | ((T extends number - ? { - type: JSONType<"number" | "integer", IsPartial> - } & NumberKeywords - : T extends string - ? { - type: JSONType<"string", IsPartial> - } & StringKeywords - : T extends boolean - ? { - type: JSONType<"boolean", IsPartial> - } - : T extends readonly [any, ...any[]] - ? { - // JSON AnySchema for tuple - type: JSONType<"array", IsPartial> - items: { - readonly [K in keyof T]-?: UncheckedJSONSchemaType & Nullable - } & {length: T["length"]} - minItems: T["length"] - } & ({maxItems: T["length"]} | {additionalItems: false}) - : T extends readonly any[] - ? { - type: JSONType<"array", IsPartial> - items: UncheckedJSONSchemaType - contains?: UncheckedPartialSchema - minItems?: number - maxItems?: number - minContains?: number - maxContains?: number - uniqueItems?: true - additionalItems?: never - } - : T extends Record - ? { - // JSON AnySchema for records and dictionaries - // "required" is not optional because it is often forgotten - // "properties" are optional for more concise dictionary schemas - // "patternProperties" and can be only used with interfaces that have string index - type: JSONType<"object", IsPartial> - additionalProperties?: boolean | UncheckedJSONSchemaType - unevaluatedProperties?: boolean | UncheckedJSONSchemaType - properties?: IsPartial extends true - ? Partial> - : UncheckedPropertiesSchema - patternProperties?: Record> - propertyNames?: Omit, "type"> & {type?: "string"} - dependencies?: {[K in keyof T]?: readonly (keyof T)[] | UncheckedPartialSchema} - dependentRequired?: {[K in keyof T]?: readonly (keyof T)[]} - dependentSchemas?: {[K in keyof T]?: UncheckedPartialSchema} - minProperties?: number - maxProperties?: number - } & (IsPartial extends true // "required" is not necessary if it's a non-partial type with no required keys // are listed it only asserts that optional cannot be listed. // "required" type does not guarantee that all required properties - ? {required: readonly (keyof T)[]} - : [UncheckedRequiredMembers] extends [never] - ? {required?: readonly UncheckedRequiredMembers[]} - : {required: readonly UncheckedRequiredMembers[]}) - : T extends null - ? { - type: JSONType<"null", IsPartial> - nullable: true - } - : never) & { - allOf?: readonly UncheckedPartialSchema[] - anyOf?: readonly UncheckedPartialSchema[] - oneOf?: readonly UncheckedPartialSchema[] - if?: UncheckedPartialSchema - then?: UncheckedPartialSchema - else?: UncheckedPartialSchema - not?: UncheckedPartialSchema - }) -) & { - [keyword: string]: any - $id?: string - $ref?: string - $defs?: Record> - definitions?: Record> -} - -export type JSONSchemaType = StrictNullChecksWrapper< - "JSONSchemaType", - UncheckedJSONSchemaType -> - -type Known = - | {[key: string]: Known} - | [Known, ...Known[]] - | Known[] - | number - | string - | boolean - | null - -type UncheckedPropertiesSchema = { - [K in keyof T]-?: (UncheckedJSONSchemaType & Nullable) | {$ref: string} -} - -export type PropertiesSchema = StrictNullChecksWrapper< - "PropertiesSchema", - UncheckedPropertiesSchema -> - -type UncheckedRequiredMembers = { - [K in keyof T]-?: undefined extends T[K] ? never : K -}[keyof T] - -export type RequiredMembers = StrictNullChecksWrapper< - "RequiredMembers", - UncheckedRequiredMembers -> - -type Nullable = undefined extends T - ? { - nullable: true - const?: null // any non-null value would fail `const: null`, `null` would fail any other value in const - enum?: readonly (T | null)[] // `null` must be explicitly included in "enum" for `null` to pass - default?: T | null - } - : { - nullable?: false - const?: T - enum?: readonly T[] - default?: T - } diff --git a/node_modules/ajv/lib/types/jtd-schema.ts b/node_modules/ajv/lib/types/jtd-schema.ts deleted file mode 100644 index 61b2bde..0000000 --- a/node_modules/ajv/lib/types/jtd-schema.ts +++ /dev/null @@ -1,273 +0,0 @@ -/** numeric strings */ -type NumberType = "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32" - -/** string strings */ -type StringType = "string" | "timestamp" - -/** Generic JTD Schema without inference of the represented type */ -export type SomeJTDSchemaType = ( - | // ref - {ref: string} - // primitives - | {type: NumberType | StringType | "boolean"} - // enum - | {enum: string[]} - // elements - | {elements: SomeJTDSchemaType} - // values - | {values: SomeJTDSchemaType} - // properties - | { - properties: Record - optionalProperties?: Record - additionalProperties?: boolean - } - | { - properties?: Record - optionalProperties: Record - additionalProperties?: boolean - } - // discriminator - | {discriminator: string; mapping: Record} - // empty - // NOTE see the end of - // https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-675156492 - // eslint-disable-next-line @typescript-eslint/ban-types - | {} -) & { - nullable?: boolean - metadata?: Record - definitions?: Record -} - -/** required keys of an object, not undefined */ -type RequiredKeys = { - [K in keyof T]-?: undefined extends T[K] ? never : K -}[keyof T] - -/** optional or undifined-able keys of an object */ -type OptionalKeys = { - [K in keyof T]-?: undefined extends T[K] ? K : never -}[keyof T] - -/** type is true if T is a union type */ -type IsUnion_ = false extends ( - T extends unknown ? ([U] extends [T] ? false : true) : never -) - ? false - : true -type IsUnion = IsUnion_ - -/** type is true if T is identically E */ -type TypeEquality = [T] extends [E] ? ([E] extends [T] ? true : false) : false - -/** type is true if T or null is identically E or null*/ -type NullTypeEquality = TypeEquality - -/** gets only the string literals of a type or null if a type isn't a string literal */ -type EnumString = [T] extends [never] - ? null - : T extends string - ? string extends T - ? null - : T - : null - -/** true if type is a union of string literals */ -type IsEnum = null extends EnumString ? false : true - -/** true only if all types are array types (not tuples) */ -// NOTE relies on the fact that tuples don't have an index at 0.5, but arrays -// have an index at every number -type IsElements = false extends IsUnion - ? [T] extends [readonly unknown[]] - ? undefined extends T[0.5] - ? false - : true - : false - : false - -/** true if the the type is a values type */ -type IsValues = false extends IsUnion ? TypeEquality : false - -/** true if type is a properties type and Union is false, or type is a discriminator type and Union is true */ -type IsRecord = Union extends IsUnion - ? null extends EnumString - ? false - : true - : false - -/** true if type represents an empty record */ -type IsEmptyRecord = [T] extends [Record] - ? [T] extends [never] - ? false - : true - : false - -/** actual schema */ -export type JTDSchemaType = Record> = ( - | // refs - where null wasn't specified, must match exactly - (null extends EnumString - ? never - : - | ({[K in keyof D]: [T] extends [D[K]] ? {ref: K} : never}[keyof D] & {nullable?: false}) - // nulled refs - if ref is nullable and nullable is specified, then it can - // match either null or non-null definitions - | (null extends T - ? { - [K in keyof D]: [Exclude] extends [Exclude] - ? {ref: K} - : never - }[keyof D] & {nullable: true} - : never)) - // empty - empty schemas also treat nullable differently in that it's now fully ignored - | (unknown extends T ? {nullable?: boolean} : never) - // all other types // numbers - only accepts the type number - | ((true extends NullTypeEquality - ? {type: NumberType} - : // booleans - accepts the type boolean - true extends NullTypeEquality - ? {type: "boolean"} - : // strings - only accepts the type string - true extends NullTypeEquality - ? {type: StringType} - : // strings - only accepts the type Date - true extends NullTypeEquality - ? {type: "timestamp"} - : // enums - only accepts union of string literals - // TODO we can't actually check that everything in the union was specified - true extends IsEnum> - ? {enum: EnumString>[]} - : // arrays - only accepts arrays, could be array of unions to be resolved later - true extends IsElements> - ? T extends readonly (infer E)[] - ? { - elements: JTDSchemaType - } - : never - : // empty properties - true extends IsEmptyRecord> - ? - | {properties: Record; optionalProperties?: Record} - | {optionalProperties: Record} - : // values - true extends IsValues> - ? T extends Record - ? { - values: JTDSchemaType - } - : never - : // properties - true extends IsRecord, false> - ? ([RequiredKeys>] extends [never] - ? { - properties?: Record - } - : { - properties: {[K in RequiredKeys]: JTDSchemaType} - }) & - ([OptionalKeys>] extends [never] - ? { - optionalProperties?: Record - } - : { - optionalProperties: { - [K in OptionalKeys]: JTDSchemaType, D> - } - }) & { - additionalProperties?: boolean - } - : // discriminator - true extends IsRecord, true> - ? { - [K in keyof Exclude]-?: Exclude[K] extends string - ? { - discriminator: K - mapping: { - // TODO currently allows descriminator to be present in schema - [M in Exclude[K]]: JTDSchemaType< - Omit ? T : never, K>, - D - > - } - } - : never - }[keyof Exclude] - : never) & - (null extends T - ? { - nullable: true - } - : {nullable?: false})) -) & { - // extra properties - metadata?: Record - // TODO these should only be allowed at the top level - definitions?: {[K in keyof D]: JTDSchemaType} -} - -type JTDDataDef> = - | // ref - (S extends {ref: string} - ? D extends {[K in S["ref"]]: infer V} - ? JTDDataDef - : never - : // type - S extends {type: NumberType} - ? number - : S extends {type: "boolean"} - ? boolean - : S extends {type: "string"} - ? string - : S extends {type: "timestamp"} - ? string | Date - : // enum - S extends {enum: readonly (infer E)[]} - ? string extends E - ? never - : [E] extends [string] - ? E - : never - : // elements - S extends {elements: infer E} - ? JTDDataDef[] - : // properties - S extends { - properties: Record - optionalProperties?: Record - additionalProperties?: boolean - } - ? {-readonly [K in keyof S["properties"]]-?: JTDDataDef} & { - -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef< - S["optionalProperties"][K], - D - > - } & ([S["additionalProperties"]] extends [true] ? Record : unknown) - : S extends { - properties?: Record - optionalProperties: Record - additionalProperties?: boolean - } - ? {-readonly [K in keyof S["properties"]]-?: JTDDataDef} & { - -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef< - S["optionalProperties"][K], - D - > - } & ([S["additionalProperties"]] extends [true] ? Record : unknown) - : // values - S extends {values: infer V} - ? Record> - : // discriminator - S extends {discriminator: infer M; mapping: Record} - ? [M] extends [string] - ? { - [K in keyof S["mapping"]]: JTDDataDef & {[KM in M]: K} - }[keyof S["mapping"]] - : never - : // empty - unknown) - | (S extends {nullable: true} ? null : never) - -export type JTDDataType = S extends {definitions: Record} - ? JTDDataDef - : JTDDataDef> diff --git a/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts b/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts deleted file mode 100644 index 755e5b3..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts +++ /dev/null @@ -1,56 +0,0 @@ -import type { - CodeKeywordDefinition, - ErrorObject, - KeywordErrorDefinition, - AnySchema, -} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, str, not, Name} from "../../compile/codegen" -import {alwaysValidSchema, checkStrictMode, Type} from "../../compile/util" - -export type AdditionalItemsError = ErrorObject<"additionalItems", {limit: number}, AnySchema> - -const error: KeywordErrorDefinition = { - message: ({params: {len}}) => str`must NOT have more than ${len} items`, - params: ({params: {len}}) => _`{limit: ${len}}`, -} - -const def: CodeKeywordDefinition = { - keyword: "additionalItems" as const, - type: "array", - schemaType: ["boolean", "object"], - before: "uniqueItems", - error, - code(cxt: KeywordCxt) { - const {parentSchema, it} = cxt - const {items} = parentSchema - if (!Array.isArray(items)) { - checkStrictMode(it, '"additionalItems" is ignored when "items" is not an array of schemas') - return - } - validateAdditionalItems(cxt, items) - }, -} - -export function validateAdditionalItems(cxt: KeywordCxt, items: AnySchema[]): void { - const {gen, schema, data, keyword, it} = cxt - it.items = true - const len = gen.const("len", _`${data}.length`) - if (schema === false) { - cxt.setParams({len: items.length}) - cxt.pass(_`${len} <= ${items.length}`) - } else if (typeof schema == "object" && !alwaysValidSchema(it, schema)) { - const valid = gen.var("valid", _`${len} <= ${items.length}`) // TODO var - gen.if(not(valid), () => validateItems(valid)) - cxt.ok(valid) - } - - function validateItems(valid: Name): void { - gen.forRange("i", items.length, len, (i) => { - cxt.subschema({keyword, dataProp: i, dataPropType: Type.Num}, valid) - if (!it.allErrors) gen.if(not(valid), () => gen.break()) - }) - } -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts b/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts deleted file mode 100644 index bfb511c..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts +++ /dev/null @@ -1,118 +0,0 @@ -import type { - CodeKeywordDefinition, - AddedKeywordDefinition, - ErrorObject, - KeywordErrorDefinition, - AnySchema, -} from "../../types" -import {allSchemaProperties, usePattern, isOwnProperty} from "../code" -import {_, nil, or, not, Code, Name} from "../../compile/codegen" -import N from "../../compile/names" -import type {SubschemaArgs} from "../../compile/validate/subschema" -import {alwaysValidSchema, schemaRefOrVal, Type} from "../../compile/util" - -export type AdditionalPropertiesError = ErrorObject< - "additionalProperties", - {additionalProperty: string}, - AnySchema -> - -const error: KeywordErrorDefinition = { - message: "must NOT have additional properties", - params: ({params}) => _`{additionalProperty: ${params.additionalProperty}}`, -} - -const def: CodeKeywordDefinition & AddedKeywordDefinition = { - keyword: "additionalProperties", - type: ["object"], - schemaType: ["boolean", "object"], - allowUndefined: true, - trackErrors: true, - error, - code(cxt) { - const {gen, schema, parentSchema, data, errsCount, it} = cxt - /* istanbul ignore if */ - if (!errsCount) throw new Error("ajv implementation error") - const {allErrors, opts} = it - it.props = true - if (opts.removeAdditional !== "all" && alwaysValidSchema(it, schema)) return - const props = allSchemaProperties(parentSchema.properties) - const patProps = allSchemaProperties(parentSchema.patternProperties) - checkAdditionalProperties() - cxt.ok(_`${errsCount} === ${N.errors}`) - - function checkAdditionalProperties(): void { - gen.forIn("key", data, (key: Name) => { - if (!props.length && !patProps.length) additionalPropertyCode(key) - else gen.if(isAdditional(key), () => additionalPropertyCode(key)) - }) - } - - function isAdditional(key: Name): Code { - let definedProp: Code - if (props.length > 8) { - // TODO maybe an option instead of hard-coded 8? - const propsSchema = schemaRefOrVal(it, parentSchema.properties, "properties") - definedProp = isOwnProperty(gen, propsSchema as Code, key) - } else if (props.length) { - definedProp = or(...props.map((p) => _`${key} === ${p}`)) - } else { - definedProp = nil - } - if (patProps.length) { - definedProp = or(definedProp, ...patProps.map((p) => _`${usePattern(cxt, p)}.test(${key})`)) - } - return not(definedProp) - } - - function deleteAdditional(key: Name): void { - gen.code(_`delete ${data}[${key}]`) - } - - function additionalPropertyCode(key: Name): void { - if (opts.removeAdditional === "all" || (opts.removeAdditional && schema === false)) { - deleteAdditional(key) - return - } - - if (schema === false) { - cxt.setParams({additionalProperty: key}) - cxt.error() - if (!allErrors) gen.break() - return - } - - if (typeof schema == "object" && !alwaysValidSchema(it, schema)) { - const valid = gen.name("valid") - if (opts.removeAdditional === "failing") { - applyAdditionalSchema(key, valid, false) - gen.if(not(valid), () => { - cxt.reset() - deleteAdditional(key) - }) - } else { - applyAdditionalSchema(key, valid) - if (!allErrors) gen.if(not(valid), () => gen.break()) - } - } - } - - function applyAdditionalSchema(key: Name, valid: Name, errors?: false): void { - const subschema: SubschemaArgs = { - keyword: "additionalProperties", - dataProp: key, - dataPropType: Type.Str, - } - if (errors === false) { - Object.assign(subschema, { - compositeRule: true, - createErrors: false, - allErrors: false, - }) - } - cxt.subschema(subschema, valid) - } - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/applicator/allOf.ts b/node_modules/ajv/lib/vocabularies/applicator/allOf.ts deleted file mode 100644 index cdfa86f..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/allOf.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type {CodeKeywordDefinition, AnySchema} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {alwaysValidSchema} from "../../compile/util" - -const def: CodeKeywordDefinition = { - keyword: "allOf", - schemaType: "array", - code(cxt: KeywordCxt) { - const {gen, schema, it} = cxt - /* istanbul ignore if */ - if (!Array.isArray(schema)) throw new Error("ajv implementation error") - const valid = gen.name("valid") - schema.forEach((sch: AnySchema, i: number) => { - if (alwaysValidSchema(it, sch)) return - const schCxt = cxt.subschema({keyword: "allOf", schemaProp: i}, valid) - cxt.ok(valid) - cxt.mergeEvaluated(schCxt) - }) - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts b/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts deleted file mode 100644 index bd331b5..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type {CodeKeywordDefinition, ErrorNoParams, AnySchema} from "../../types" -import {validateUnion} from "../code" - -export type AnyOfError = ErrorNoParams<"anyOf", AnySchema[]> - -const def: CodeKeywordDefinition = { - keyword: "anyOf", - schemaType: "array", - trackErrors: true, - code: validateUnion, - error: {message: "must match a schema in anyOf"}, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/applicator/contains.ts b/node_modules/ajv/lib/vocabularies/applicator/contains.ts deleted file mode 100644 index d88675c..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/contains.ts +++ /dev/null @@ -1,109 +0,0 @@ -import type { - CodeKeywordDefinition, - KeywordErrorDefinition, - ErrorObject, - AnySchema, -} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, str, Name} from "../../compile/codegen" -import {alwaysValidSchema, checkStrictMode, Type} from "../../compile/util" - -export type ContainsError = ErrorObject< - "contains", - {minContains: number; maxContains?: number}, - AnySchema -> - -const error: KeywordErrorDefinition = { - message: ({params: {min, max}}) => - max === undefined - ? str`must contain at least ${min} valid item(s)` - : str`must contain at least ${min} and no more than ${max} valid item(s)`, - params: ({params: {min, max}}) => - max === undefined ? _`{minContains: ${min}}` : _`{minContains: ${min}, maxContains: ${max}}`, -} - -const def: CodeKeywordDefinition = { - keyword: "contains", - type: "array", - schemaType: ["object", "boolean"], - before: "uniqueItems", - trackErrors: true, - error, - code(cxt: KeywordCxt) { - const {gen, schema, parentSchema, data, it} = cxt - let min: number - let max: number | undefined - const {minContains, maxContains} = parentSchema - if (it.opts.next) { - min = minContains === undefined ? 1 : minContains - max = maxContains - } else { - min = 1 - } - const len = gen.const("len", _`${data}.length`) - cxt.setParams({min, max}) - if (max === undefined && min === 0) { - checkStrictMode(it, `"minContains" == 0 without "maxContains": "contains" keyword ignored`) - return - } - if (max !== undefined && min > max) { - checkStrictMode(it, `"minContains" > "maxContains" is always invalid`) - cxt.fail() - return - } - if (alwaysValidSchema(it, schema)) { - let cond = _`${len} >= ${min}` - if (max !== undefined) cond = _`${cond} && ${len} <= ${max}` - cxt.pass(cond) - return - } - - it.items = true - const valid = gen.name("valid") - if (max === undefined && min === 1) { - validateItems(valid, () => gen.if(valid, () => gen.break())) - } else if (min === 0) { - gen.let(valid, true) - if (max !== undefined) gen.if(_`${data}.length > 0`, validateItemsWithCount) - } else { - gen.let(valid, false) - validateItemsWithCount() - } - cxt.result(valid, () => cxt.reset()) - - function validateItemsWithCount(): void { - const schValid = gen.name("_valid") - const count = gen.let("count", 0) - validateItems(schValid, () => gen.if(schValid, () => checkLimits(count))) - } - - function validateItems(_valid: Name, block: () => void): void { - gen.forRange("i", 0, len, (i) => { - cxt.subschema( - { - keyword: "contains", - dataProp: i, - dataPropType: Type.Num, - compositeRule: true, - }, - _valid - ) - block() - }) - } - - function checkLimits(count: Name): void { - gen.code(_`${count}++`) - if (max === undefined) { - gen.if(_`${count} >= ${min}`, () => gen.assign(valid, true).break()) - } else { - gen.if(_`${count} > ${max}`, () => gen.assign(valid, false).break()) - if (min === 1) gen.assign(valid, true) - else gen.if(_`${count} >= ${min}`, () => gen.assign(valid, true)) - } - } - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts b/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts deleted file mode 100644 index f676112..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts +++ /dev/null @@ -1,112 +0,0 @@ -import type { - CodeKeywordDefinition, - ErrorObject, - KeywordErrorDefinition, - SchemaMap, - AnySchema, -} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, str} from "../../compile/codegen" -import {alwaysValidSchema} from "../../compile/util" -import {checkReportMissingProp, checkMissingProp, reportMissingProp, propertyInData} from "../code" - -export type PropertyDependencies = {[K in string]?: string[]} - -export interface DependenciesErrorParams { - property: string - missingProperty: string - depsCount: number - deps: string // TODO change to string[] -} - -type SchemaDependencies = SchemaMap - -export type DependenciesError = ErrorObject< - "dependencies", - DependenciesErrorParams, - {[K in string]?: string[] | AnySchema} -> - -export const error: KeywordErrorDefinition = { - message: ({params: {property, depsCount, deps}}) => { - const property_ies = depsCount === 1 ? "property" : "properties" - return str`must have ${property_ies} ${deps} when property ${property} is present` - }, - params: ({params: {property, depsCount, deps, missingProperty}}) => - _`{property: ${property}, - missingProperty: ${missingProperty}, - depsCount: ${depsCount}, - deps: ${deps}}`, // TODO change to reference -} - -const def: CodeKeywordDefinition = { - keyword: "dependencies", - type: "object", - schemaType: "object", - error, - code(cxt: KeywordCxt) { - const [propDeps, schDeps] = splitDependencies(cxt) - validatePropertyDeps(cxt, propDeps) - validateSchemaDeps(cxt, schDeps) - }, -} - -function splitDependencies({schema}: KeywordCxt): [PropertyDependencies, SchemaDependencies] { - const propertyDeps: PropertyDependencies = {} - const schemaDeps: SchemaDependencies = {} - for (const key in schema) { - if (key === "__proto__") continue - const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps - deps[key] = schema[key] - } - return [propertyDeps, schemaDeps] -} - -export function validatePropertyDeps( - cxt: KeywordCxt, - propertyDeps: {[K in string]?: string[]} = cxt.schema -): void { - const {gen, data, it} = cxt - if (Object.keys(propertyDeps).length === 0) return - const missing = gen.let("missing") - for (const prop in propertyDeps) { - const deps = propertyDeps[prop] as string[] - if (deps.length === 0) continue - const hasProperty = propertyInData(gen, data, prop, it.opts.ownProperties) - cxt.setParams({ - property: prop, - depsCount: deps.length, - deps: deps.join(", "), - }) - if (it.allErrors) { - gen.if(hasProperty, () => { - for (const depProp of deps) { - checkReportMissingProp(cxt, depProp) - } - }) - } else { - gen.if(_`${hasProperty} && (${checkMissingProp(cxt, deps, missing)})`) - reportMissingProp(cxt, missing) - gen.else() - } - } -} - -export function validateSchemaDeps(cxt: KeywordCxt, schemaDeps: SchemaMap = cxt.schema): void { - const {gen, data, keyword, it} = cxt - const valid = gen.name("valid") - for (const prop in schemaDeps) { - if (alwaysValidSchema(it, schemaDeps[prop] as AnySchema)) continue - gen.if( - propertyInData(gen, data, prop, it.opts.ownProperties), - () => { - const schCxt = cxt.subschema({keyword, schemaProp: prop}, valid) - cxt.mergeValidEvaluated(schCxt, valid) - }, - () => gen.var(valid, true) // TODO var - ) - cxt.ok(valid) - } -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts b/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts deleted file mode 100644 index dbd3ae4..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type {CodeKeywordDefinition} from "../../types" -import {validateSchemaDeps} from "./dependencies" - -const def: CodeKeywordDefinition = { - keyword: "dependentSchemas", - type: "object", - schemaType: "object", - code: (cxt) => validateSchemaDeps(cxt), -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/applicator/if.ts b/node_modules/ajv/lib/vocabularies/applicator/if.ts deleted file mode 100644 index 5a40d5e..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/if.ts +++ /dev/null @@ -1,80 +0,0 @@ -import type { - CodeKeywordDefinition, - ErrorObject, - KeywordErrorDefinition, - AnySchema, -} from "../../types" -import type {SchemaObjCxt} from "../../compile" -import type {KeywordCxt} from "../../compile/validate" -import {_, str, not, Name} from "../../compile/codegen" -import {alwaysValidSchema, checkStrictMode} from "../../compile/util" - -export type IfKeywordError = ErrorObject<"if", {failingKeyword: string}, AnySchema> - -const error: KeywordErrorDefinition = { - message: ({params}) => str`must match "${params.ifClause}" schema`, - params: ({params}) => _`{failingKeyword: ${params.ifClause}}`, -} - -const def: CodeKeywordDefinition = { - keyword: "if", - schemaType: ["object", "boolean"], - trackErrors: true, - error, - code(cxt: KeywordCxt) { - const {gen, parentSchema, it} = cxt - if (parentSchema.then === undefined && parentSchema.else === undefined) { - checkStrictMode(it, '"if" without "then" and "else" is ignored') - } - const hasThen = hasSchema(it, "then") - const hasElse = hasSchema(it, "else") - if (!hasThen && !hasElse) return - - const valid = gen.let("valid", true) - const schValid = gen.name("_valid") - validateIf() - cxt.reset() - - if (hasThen && hasElse) { - const ifClause = gen.let("ifClause") - cxt.setParams({ifClause}) - gen.if(schValid, validateClause("then", ifClause), validateClause("else", ifClause)) - } else if (hasThen) { - gen.if(schValid, validateClause("then")) - } else { - gen.if(not(schValid), validateClause("else")) - } - - cxt.pass(valid, () => cxt.error(true)) - - function validateIf(): void { - const schCxt = cxt.subschema( - { - keyword: "if", - compositeRule: true, - createErrors: false, - allErrors: false, - }, - schValid - ) - cxt.mergeEvaluated(schCxt) - } - - function validateClause(keyword: string, ifClause?: Name): () => void { - return () => { - const schCxt = cxt.subschema({keyword}, schValid) - gen.assign(valid, schValid) - cxt.mergeValidEvaluated(schCxt, valid) - if (ifClause) gen.assign(ifClause, _`${keyword}`) - else cxt.setParams({ifClause: keyword}) - } - } - }, -} - -function hasSchema(it: SchemaObjCxt, keyword: string): boolean { - const schema = it.schema[keyword] - return schema !== undefined && !alwaysValidSchema(it, schema) -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/applicator/index.ts b/node_modules/ajv/lib/vocabularies/applicator/index.ts deleted file mode 100644 index fc52716..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/index.ts +++ /dev/null @@ -1,53 +0,0 @@ -import type {ErrorNoParams, Vocabulary} from "../../types" -import additionalItems, {AdditionalItemsError} from "./additionalItems" -import prefixItems from "./prefixItems" -import items from "./items" -import items2020, {ItemsError} from "./items2020" -import contains, {ContainsError} from "./contains" -import dependencies, {DependenciesError} from "./dependencies" -import propertyNames, {PropertyNamesError} from "./propertyNames" -import additionalProperties, {AdditionalPropertiesError} from "./additionalProperties" -import properties from "./properties" -import patternProperties from "./patternProperties" -import notKeyword, {NotKeywordError} from "./not" -import anyOf, {AnyOfError} from "./anyOf" -import oneOf, {OneOfError} from "./oneOf" -import allOf from "./allOf" -import ifKeyword, {IfKeywordError} from "./if" -import thenElse from "./thenElse" - -export default function getApplicator(draft2020 = false): Vocabulary { - const applicator = [ - // any - notKeyword, - anyOf, - oneOf, - allOf, - ifKeyword, - thenElse, - // object - propertyNames, - additionalProperties, - dependencies, - properties, - patternProperties, - ] - // array - if (draft2020) applicator.push(prefixItems, items2020) - else applicator.push(additionalItems, items) - applicator.push(contains) - return applicator -} - -export type ApplicatorKeywordError = - | ErrorNoParams<"false schema"> - | AdditionalItemsError - | ItemsError - | ContainsError - | AdditionalPropertiesError - | DependenciesError - | IfKeywordError - | AnyOfError - | OneOfError - | NotKeywordError - | PropertyNamesError diff --git a/node_modules/ajv/lib/vocabularies/applicator/items.ts b/node_modules/ajv/lib/vocabularies/applicator/items.ts deleted file mode 100644 index 033cb39..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/items.ts +++ /dev/null @@ -1,59 +0,0 @@ -import type {CodeKeywordDefinition, AnySchema, AnySchemaObject} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_} from "../../compile/codegen" -import {alwaysValidSchema, mergeEvaluated, checkStrictMode} from "../../compile/util" -import {validateArray} from "../code" - -const def: CodeKeywordDefinition = { - keyword: "items", - type: "array", - schemaType: ["object", "array", "boolean"], - before: "uniqueItems", - code(cxt: KeywordCxt) { - const {schema, it} = cxt - if (Array.isArray(schema)) return validateTuple(cxt, "additionalItems", schema) - it.items = true - if (alwaysValidSchema(it, schema)) return - cxt.ok(validateArray(cxt)) - }, -} - -export function validateTuple( - cxt: KeywordCxt, - extraItems: string, - schArr: AnySchema[] = cxt.schema -): void { - const {gen, parentSchema, data, keyword, it} = cxt - checkStrictTuple(parentSchema) - if (it.opts.unevaluated && schArr.length && it.items !== true) { - it.items = mergeEvaluated.items(gen, schArr.length, it.items) - } - const valid = gen.name("valid") - const len = gen.const("len", _`${data}.length`) - schArr.forEach((sch: AnySchema, i: number) => { - if (alwaysValidSchema(it, sch)) return - gen.if(_`${len} > ${i}`, () => - cxt.subschema( - { - keyword, - schemaProp: i, - dataProp: i, - }, - valid - ) - ) - cxt.ok(valid) - }) - - function checkStrictTuple(sch: AnySchemaObject): void { - const {opts, errSchemaPath} = it - const l = schArr.length - const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false) - if (opts.strictTuples && !fullTuple) { - const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"` - checkStrictMode(it, msg, opts.strictTuples) - } - } -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/applicator/items2020.ts b/node_modules/ajv/lib/vocabularies/applicator/items2020.ts deleted file mode 100644 index 2a99b08..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/items2020.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { - CodeKeywordDefinition, - KeywordErrorDefinition, - ErrorObject, - AnySchema, -} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, str} from "../../compile/codegen" -import {alwaysValidSchema} from "../../compile/util" -import {validateArray} from "../code" -import {validateAdditionalItems} from "./additionalItems" - -export type ItemsError = ErrorObject<"items", {limit: number}, AnySchema> - -const error: KeywordErrorDefinition = { - message: ({params: {len}}) => str`must NOT have more than ${len} items`, - params: ({params: {len}}) => _`{limit: ${len}}`, -} - -const def: CodeKeywordDefinition = { - keyword: "items", - type: "array", - schemaType: ["object", "boolean"], - before: "uniqueItems", - error, - code(cxt: KeywordCxt) { - const {schema, parentSchema, it} = cxt - const {prefixItems} = parentSchema - it.items = true - if (alwaysValidSchema(it, schema)) return - if (prefixItems) validateAdditionalItems(cxt, prefixItems) - else cxt.ok(validateArray(cxt)) - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/applicator/not.ts b/node_modules/ajv/lib/vocabularies/applicator/not.ts deleted file mode 100644 index 8691db0..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/not.ts +++ /dev/null @@ -1,38 +0,0 @@ -import type {CodeKeywordDefinition, ErrorNoParams, AnySchema} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {alwaysValidSchema} from "../../compile/util" - -export type NotKeywordError = ErrorNoParams<"not", AnySchema> - -const def: CodeKeywordDefinition = { - keyword: "not", - schemaType: ["object", "boolean"], - trackErrors: true, - code(cxt: KeywordCxt) { - const {gen, schema, it} = cxt - if (alwaysValidSchema(it, schema)) { - cxt.fail() - return - } - - const valid = gen.name("valid") - cxt.subschema( - { - keyword: "not", - compositeRule: true, - createErrors: false, - allErrors: false, - }, - valid - ) - - cxt.failResult( - valid, - () => cxt.reset(), - () => cxt.error() - ) - }, - error: {message: "must NOT be valid"}, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts b/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts deleted file mode 100644 index c25353f..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts +++ /dev/null @@ -1,82 +0,0 @@ -import type { - CodeKeywordDefinition, - ErrorObject, - KeywordErrorDefinition, - AnySchema, -} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, Name} from "../../compile/codegen" -import {alwaysValidSchema} from "../../compile/util" -import {SchemaCxt} from "../../compile" - -export type OneOfError = ErrorObject< - "oneOf", - {passingSchemas: [number, number] | null}, - AnySchema[] -> - -const error: KeywordErrorDefinition = { - message: "must match exactly one schema in oneOf", - params: ({params}) => _`{passingSchemas: ${params.passing}}`, -} - -const def: CodeKeywordDefinition = { - keyword: "oneOf", - schemaType: "array", - trackErrors: true, - error, - code(cxt: KeywordCxt) { - const {gen, schema, parentSchema, it} = cxt - /* istanbul ignore if */ - if (!Array.isArray(schema)) throw new Error("ajv implementation error") - if (it.opts.discriminator && parentSchema.discriminator) return - const schArr: AnySchema[] = schema - const valid = gen.let("valid", false) - const passing = gen.let("passing", null) - const schValid = gen.name("_valid") - cxt.setParams({passing}) - // TODO possibly fail straight away (with warning or exception) if there are two empty always valid schemas - - gen.block(validateOneOf) - - cxt.result( - valid, - () => cxt.reset(), - () => cxt.error(true) - ) - - function validateOneOf(): void { - schArr.forEach((sch: AnySchema, i: number) => { - let schCxt: SchemaCxt | undefined - if (alwaysValidSchema(it, sch)) { - gen.var(schValid, true) - } else { - schCxt = cxt.subschema( - { - keyword: "oneOf", - schemaProp: i, - compositeRule: true, - }, - schValid - ) - } - - if (i > 0) { - gen - .if(_`${schValid} && ${valid}`) - .assign(valid, false) - .assign(passing, _`[${passing}, ${i}]`) - .else() - } - - gen.if(schValid, () => { - gen.assign(valid, true) - gen.assign(passing, i) - if (schCxt) cxt.mergeEvaluated(schCxt, Name) - }) - }) - } - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts b/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts deleted file mode 100644 index ea624e2..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts +++ /dev/null @@ -1,91 +0,0 @@ -import type {CodeKeywordDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {allSchemaProperties, usePattern} from "../code" -import {_, not, Name} from "../../compile/codegen" -import {alwaysValidSchema, checkStrictMode} from "../../compile/util" -import {evaluatedPropsToName, Type} from "../../compile/util" -import {AnySchema} from "../../types" - -const def: CodeKeywordDefinition = { - keyword: "patternProperties", - type: "object", - schemaType: "object", - code(cxt: KeywordCxt) { - const {gen, schema, data, parentSchema, it} = cxt - const {opts} = it - const patterns = allSchemaProperties(schema) - const alwaysValidPatterns = patterns.filter((p) => - alwaysValidSchema(it, schema[p] as AnySchema) - ) - - if ( - patterns.length === 0 || - (alwaysValidPatterns.length === patterns.length && - (!it.opts.unevaluated || it.props === true)) - ) { - return - } - - const checkProperties = - opts.strictSchema && !opts.allowMatchingProperties && parentSchema.properties - const valid = gen.name("valid") - if (it.props !== true && !(it.props instanceof Name)) { - it.props = evaluatedPropsToName(gen, it.props) - } - const {props} = it - validatePatternProperties() - - function validatePatternProperties(): void { - for (const pat of patterns) { - if (checkProperties) checkMatchingProperties(pat) - if (it.allErrors) { - validateProperties(pat) - } else { - gen.var(valid, true) // TODO var - validateProperties(pat) - gen.if(valid) - } - } - } - - function checkMatchingProperties(pat: string): void { - for (const prop in checkProperties) { - if (new RegExp(pat).test(prop)) { - checkStrictMode( - it, - `property ${prop} matches pattern ${pat} (use allowMatchingProperties)` - ) - } - } - } - - function validateProperties(pat: string): void { - gen.forIn("key", data, (key) => { - gen.if(_`${usePattern(cxt, pat)}.test(${key})`, () => { - const alwaysValid = alwaysValidPatterns.includes(pat) - if (!alwaysValid) { - cxt.subschema( - { - keyword: "patternProperties", - schemaProp: pat, - dataProp: key, - dataPropType: Type.Str, - }, - valid - ) - } - - if (it.opts.unevaluated && props !== true) { - gen.assign(_`${props}[${key}]`, true) - } else if (!alwaysValid && !it.allErrors) { - // can short-circuit if `unevaluatedProperties` is not supported (opts.next === false) - // or if all properties were evaluated (props === true) - gen.if(not(valid), () => gen.break()) - } - }) - }) - } - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts b/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts deleted file mode 100644 index 008fb2d..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type {CodeKeywordDefinition} from "../../types" -import {validateTuple} from "./items" - -const def: CodeKeywordDefinition = { - keyword: "prefixItems", - type: "array", - schemaType: ["array"], - before: "uniqueItems", - code: (cxt) => validateTuple(cxt, "items"), -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/applicator/properties.ts b/node_modules/ajv/lib/vocabularies/applicator/properties.ts deleted file mode 100644 index a55b19c..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/properties.ts +++ /dev/null @@ -1,57 +0,0 @@ -import type {CodeKeywordDefinition} from "../../types" -import {KeywordCxt} from "../../compile/validate" -import {propertyInData, allSchemaProperties} from "../code" -import {alwaysValidSchema, toHash, mergeEvaluated} from "../../compile/util" -import apDef from "./additionalProperties" - -const def: CodeKeywordDefinition = { - keyword: "properties", - type: "object", - schemaType: "object", - code(cxt: KeywordCxt) { - const {gen, schema, parentSchema, data, it} = cxt - if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === undefined) { - apDef.code(new KeywordCxt(it, apDef, "additionalProperties")) - } - const allProps = allSchemaProperties(schema) - for (const prop of allProps) { - it.definedProperties.add(prop) - } - if (it.opts.unevaluated && allProps.length && it.props !== true) { - it.props = mergeEvaluated.props(gen, toHash(allProps), it.props) - } - const properties = allProps.filter((p) => !alwaysValidSchema(it, schema[p])) - if (properties.length === 0) return - const valid = gen.name("valid") - - for (const prop of properties) { - if (hasDefault(prop)) { - applyPropertySchema(prop) - } else { - gen.if(propertyInData(gen, data, prop, it.opts.ownProperties)) - applyPropertySchema(prop) - if (!it.allErrors) gen.else().var(valid, true) - gen.endIf() - } - cxt.it.definedProperties.add(prop) - cxt.ok(valid) - } - - function hasDefault(prop: string): boolean | undefined { - return it.opts.useDefaults && !it.compositeRule && schema[prop].default !== undefined - } - - function applyPropertySchema(prop: string): void { - cxt.subschema( - { - keyword: "properties", - schemaProp: prop, - dataProp: prop, - }, - valid - ) - } - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts b/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts deleted file mode 100644 index 1c54d60..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts +++ /dev/null @@ -1,50 +0,0 @@ -import type { - CodeKeywordDefinition, - ErrorObject, - KeywordErrorDefinition, - AnySchema, -} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, not} from "../../compile/codegen" -import {alwaysValidSchema} from "../../compile/util" - -export type PropertyNamesError = ErrorObject<"propertyNames", {propertyName: string}, AnySchema> - -const error: KeywordErrorDefinition = { - message: "property name must be valid", - params: ({params}) => _`{propertyName: ${params.propertyName}}`, -} - -const def: CodeKeywordDefinition = { - keyword: "propertyNames", - type: "object", - schemaType: ["object", "boolean"], - error, - code(cxt: KeywordCxt) { - const {gen, schema, data, it} = cxt - if (alwaysValidSchema(it, schema)) return - const valid = gen.name("valid") - - gen.forIn("key", data, (key) => { - cxt.setParams({propertyName: key}) - cxt.subschema( - { - keyword: "propertyNames", - data: key, - dataTypes: ["string"], - propertyName: key, - compositeRule: true, - }, - valid - ) - gen.if(not(valid), () => { - cxt.error(true) - if (!it.allErrors) gen.break() - }) - }) - - cxt.ok(valid) - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts b/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts deleted file mode 100644 index 5055182..0000000 --- a/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type {CodeKeywordDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {checkStrictMode} from "../../compile/util" - -const def: CodeKeywordDefinition = { - keyword: ["then", "else"], - schemaType: ["object", "boolean"], - code({keyword, parentSchema, it}: KeywordCxt) { - if (parentSchema.if === undefined) checkStrictMode(it, `"${keyword}" without "if" is ignored`) - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/code.ts b/node_modules/ajv/lib/vocabularies/code.ts deleted file mode 100644 index 92cdd5b..0000000 --- a/node_modules/ajv/lib/vocabularies/code.ts +++ /dev/null @@ -1,168 +0,0 @@ -import type {AnySchema, SchemaMap} from "../types" -import type {SchemaCxt} from "../compile" -import type {KeywordCxt} from "../compile/validate" -import {CodeGen, _, and, or, not, nil, strConcat, getProperty, Code, Name} from "../compile/codegen" -import {alwaysValidSchema, Type} from "../compile/util" -import N from "../compile/names" -import {useFunc} from "../compile/util" -export function checkReportMissingProp(cxt: KeywordCxt, prop: string): void { - const {gen, data, it} = cxt - gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => { - cxt.setParams({missingProperty: _`${prop}`}, true) - cxt.error() - }) -} - -export function checkMissingProp( - {gen, data, it: {opts}}: KeywordCxt, - properties: string[], - missing: Name -): Code { - return or( - ...properties.map((prop) => - and(noPropertyInData(gen, data, prop, opts.ownProperties), _`${missing} = ${prop}`) - ) - ) -} - -export function reportMissingProp(cxt: KeywordCxt, missing: Name): void { - cxt.setParams({missingProperty: missing}, true) - cxt.error() -} - -export function hasPropFunc(gen: CodeGen): Name { - return gen.scopeValue("func", { - // eslint-disable-next-line @typescript-eslint/unbound-method - ref: Object.prototype.hasOwnProperty, - code: _`Object.prototype.hasOwnProperty`, - }) -} - -export function isOwnProperty(gen: CodeGen, data: Name, property: Name | string): Code { - return _`${hasPropFunc(gen)}.call(${data}, ${property})` -} - -export function propertyInData( - gen: CodeGen, - data: Name, - property: Name | string, - ownProperties?: boolean -): Code { - const cond = _`${data}${getProperty(property)} !== undefined` - return ownProperties ? _`${cond} && ${isOwnProperty(gen, data, property)}` : cond -} - -export function noPropertyInData( - gen: CodeGen, - data: Name, - property: Name | string, - ownProperties?: boolean -): Code { - const cond = _`${data}${getProperty(property)} === undefined` - return ownProperties ? or(cond, not(isOwnProperty(gen, data, property))) : cond -} - -export function allSchemaProperties(schemaMap?: SchemaMap): string[] { - return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : [] -} - -export function schemaProperties(it: SchemaCxt, schemaMap: SchemaMap): string[] { - return allSchemaProperties(schemaMap).filter( - (p) => !alwaysValidSchema(it, schemaMap[p] as AnySchema) - ) -} - -export function callValidateCode( - {schemaCode, data, it: {gen, topSchemaRef, schemaPath, errorPath}, it}: KeywordCxt, - func: Code, - context: Code, - passSchema?: boolean -): Code { - const dataAndSchema = passSchema ? _`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data - const valCxt: [Name, Code | number][] = [ - [N.instancePath, strConcat(N.instancePath, errorPath)], - [N.parentData, it.parentData], - [N.parentDataProperty, it.parentDataProperty], - [N.rootData, N.rootData], - ] - if (it.opts.dynamicRef) valCxt.push([N.dynamicAnchors, N.dynamicAnchors]) - const args = _`${dataAndSchema}, ${gen.object(...valCxt)}` - return context !== nil ? _`${func}.call(${context}, ${args})` : _`${func}(${args})` -} - -const newRegExp = _`new RegExp` - -export function usePattern({gen, it: {opts}}: KeywordCxt, pattern: string): Name { - const u = opts.unicodeRegExp ? "u" : "" - const {regExp} = opts.code - const rx = regExp(pattern, u) - - return gen.scopeValue("pattern", { - key: rx.toString(), - ref: rx, - code: _`${regExp.code === "new RegExp" ? newRegExp : useFunc(gen, regExp)}(${pattern}, ${u})`, - }) -} - -export function validateArray(cxt: KeywordCxt): Name { - const {gen, data, keyword, it} = cxt - const valid = gen.name("valid") - if (it.allErrors) { - const validArr = gen.let("valid", true) - validateItems(() => gen.assign(validArr, false)) - return validArr - } - gen.var(valid, true) - validateItems(() => gen.break()) - return valid - - function validateItems(notValid: () => void): void { - const len = gen.const("len", _`${data}.length`) - gen.forRange("i", 0, len, (i) => { - cxt.subschema( - { - keyword, - dataProp: i, - dataPropType: Type.Num, - }, - valid - ) - gen.if(not(valid), notValid) - }) - } -} - -export function validateUnion(cxt: KeywordCxt): void { - const {gen, schema, keyword, it} = cxt - /* istanbul ignore if */ - if (!Array.isArray(schema)) throw new Error("ajv implementation error") - const alwaysValid = schema.some((sch: AnySchema) => alwaysValidSchema(it, sch)) - if (alwaysValid && !it.opts.unevaluated) return - - const valid = gen.let("valid", false) - const schValid = gen.name("_valid") - - gen.block(() => - schema.forEach((_sch: AnySchema, i: number) => { - const schCxt = cxt.subschema( - { - keyword, - schemaProp: i, - compositeRule: true, - }, - schValid - ) - gen.assign(valid, _`${valid} || ${schValid}`) - const merged = cxt.mergeValidEvaluated(schCxt, schValid) - // can short-circuit if `unevaluatedProperties/Items` not supported (opts.unevaluated !== true) - // or if all properties and items were evaluated (it.props === true && it.items === true) - if (!merged) gen.if(not(valid)) - }) - ) - - cxt.result( - valid, - () => cxt.reset(), - () => cxt.error(true) - ) -} diff --git a/node_modules/ajv/lib/vocabularies/core/id.ts b/node_modules/ajv/lib/vocabularies/core/id.ts deleted file mode 100644 index aa36c4b..0000000 --- a/node_modules/ajv/lib/vocabularies/core/id.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type {CodeKeywordDefinition} from "../../types" - -const def: CodeKeywordDefinition = { - keyword: "id", - code() { - throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID') - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/core/index.ts b/node_modules/ajv/lib/vocabularies/core/index.ts deleted file mode 100644 index e63e289..0000000 --- a/node_modules/ajv/lib/vocabularies/core/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type {Vocabulary} from "../../types" -import idKeyword from "./id" -import refKeyword from "./ref" - -const core: Vocabulary = [ - "$schema", - "$id", - "$defs", - "$vocabulary", - {keyword: "$comment"}, - "definitions", - idKeyword, - refKeyword, -] - -export default core diff --git a/node_modules/ajv/lib/vocabularies/core/ref.ts b/node_modules/ajv/lib/vocabularies/core/ref.ts deleted file mode 100644 index 5d59fbc..0000000 --- a/node_modules/ajv/lib/vocabularies/core/ref.ts +++ /dev/null @@ -1,129 +0,0 @@ -import type {CodeKeywordDefinition, AnySchema} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import MissingRefError from "../../compile/ref_error" -import {callValidateCode} from "../code" -import {_, nil, stringify, Code, Name} from "../../compile/codegen" -import N from "../../compile/names" -import {SchemaEnv, resolveRef} from "../../compile" -import {mergeEvaluated} from "../../compile/util" - -const def: CodeKeywordDefinition = { - keyword: "$ref", - schemaType: "string", - code(cxt: KeywordCxt): void { - const {gen, schema: $ref, it} = cxt - const {baseId, schemaEnv: env, validateName, opts, self} = it - const {root} = env - if (($ref === "#" || $ref === "#/") && baseId === root.baseId) return callRootRef() - const schOrEnv = resolveRef.call(self, root, baseId, $ref) - if (schOrEnv === undefined) throw new MissingRefError(it.opts.uriResolver, baseId, $ref) - if (schOrEnv instanceof SchemaEnv) return callValidate(schOrEnv) - return inlineRefSchema(schOrEnv) - - function callRootRef(): void { - if (env === root) return callRef(cxt, validateName, env, env.$async) - const rootName = gen.scopeValue("root", {ref: root}) - return callRef(cxt, _`${rootName}.validate`, root, root.$async) - } - - function callValidate(sch: SchemaEnv): void { - const v = getValidate(cxt, sch) - callRef(cxt, v, sch, sch.$async) - } - - function inlineRefSchema(sch: AnySchema): void { - const schName = gen.scopeValue( - "schema", - opts.code.source === true ? {ref: sch, code: stringify(sch)} : {ref: sch} - ) - const valid = gen.name("valid") - const schCxt = cxt.subschema( - { - schema: sch, - dataTypes: [], - schemaPath: nil, - topSchemaRef: schName, - errSchemaPath: $ref, - }, - valid - ) - cxt.mergeEvaluated(schCxt) - cxt.ok(valid) - } - }, -} - -export function getValidate(cxt: KeywordCxt, sch: SchemaEnv): Code { - const {gen} = cxt - return sch.validate - ? gen.scopeValue("validate", {ref: sch.validate}) - : _`${gen.scopeValue("wrapper", {ref: sch})}.validate` -} - -export function callRef(cxt: KeywordCxt, v: Code, sch?: SchemaEnv, $async?: boolean): void { - const {gen, it} = cxt - const {allErrors, schemaEnv: env, opts} = it - const passCxt = opts.passContext ? N.this : nil - if ($async) callAsyncRef() - else callSyncRef() - - function callAsyncRef(): void { - if (!env.$async) throw new Error("async schema referenced by sync schema") - const valid = gen.let("valid") - gen.try( - () => { - gen.code(_`await ${callValidateCode(cxt, v, passCxt)}`) - addEvaluatedFrom(v) // TODO will not work with async, it has to be returned with the result - if (!allErrors) gen.assign(valid, true) - }, - (e) => { - gen.if(_`!(${e} instanceof ${it.ValidationError as Name})`, () => gen.throw(e)) - addErrorsFrom(e) - if (!allErrors) gen.assign(valid, false) - } - ) - cxt.ok(valid) - } - - function callSyncRef(): void { - cxt.result( - callValidateCode(cxt, v, passCxt), - () => addEvaluatedFrom(v), - () => addErrorsFrom(v) - ) - } - - function addErrorsFrom(source: Code): void { - const errs = _`${source}.errors` - gen.assign(N.vErrors, _`${N.vErrors} === null ? ${errs} : ${N.vErrors}.concat(${errs})`) // TODO tagged - gen.assign(N.errors, _`${N.vErrors}.length`) - } - - function addEvaluatedFrom(source: Code): void { - if (!it.opts.unevaluated) return - const schEvaluated = sch?.validate?.evaluated - // TODO refactor - if (it.props !== true) { - if (schEvaluated && !schEvaluated.dynamicProps) { - if (schEvaluated.props !== undefined) { - it.props = mergeEvaluated.props(gen, schEvaluated.props, it.props) - } - } else { - const props = gen.var("props", _`${source}.evaluated.props`) - it.props = mergeEvaluated.props(gen, props, it.props, Name) - } - } - if (it.items !== true) { - if (schEvaluated && !schEvaluated.dynamicItems) { - if (schEvaluated.items !== undefined) { - it.items = mergeEvaluated.items(gen, schEvaluated.items, it.items) - } - } else { - const items = gen.var("items", _`${source}.evaluated.items`) - it.items = mergeEvaluated.items(gen, items, it.items, Name) - } - } - } -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/discriminator/index.ts b/node_modules/ajv/lib/vocabularies/discriminator/index.ts deleted file mode 100644 index 19ae604..0000000 --- a/node_modules/ajv/lib/vocabularies/discriminator/index.ts +++ /dev/null @@ -1,113 +0,0 @@ -import type {CodeKeywordDefinition, AnySchemaObject, KeywordErrorDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, getProperty, Name} from "../../compile/codegen" -import {DiscrError, DiscrErrorObj} from "../discriminator/types" -import {resolveRef, SchemaEnv} from "../../compile" -import MissingRefError from "../../compile/ref_error" -import {schemaHasRulesButRef} from "../../compile/util" - -export type DiscriminatorError = DiscrErrorObj | DiscrErrorObj - -const error: KeywordErrorDefinition = { - message: ({params: {discrError, tagName}}) => - discrError === DiscrError.Tag - ? `tag "${tagName}" must be string` - : `value of tag "${tagName}" must be in oneOf`, - params: ({params: {discrError, tag, tagName}}) => - _`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`, -} - -const def: CodeKeywordDefinition = { - keyword: "discriminator", - type: "object", - schemaType: "object", - error, - code(cxt: KeywordCxt) { - const {gen, data, schema, parentSchema, it} = cxt - const {oneOf} = parentSchema - if (!it.opts.discriminator) { - throw new Error("discriminator: requires discriminator option") - } - const tagName = schema.propertyName - if (typeof tagName != "string") throw new Error("discriminator: requires propertyName") - if (schema.mapping) throw new Error("discriminator: mapping is not supported") - if (!oneOf) throw new Error("discriminator: requires oneOf keyword") - const valid = gen.let("valid", false) - const tag = gen.const("tag", _`${data}${getProperty(tagName)}`) - gen.if( - _`typeof ${tag} == "string"`, - () => validateMapping(), - () => cxt.error(false, {discrError: DiscrError.Tag, tag, tagName}) - ) - cxt.ok(valid) - - function validateMapping(): void { - const mapping = getMapping() - gen.if(false) - for (const tagValue in mapping) { - gen.elseIf(_`${tag} === ${tagValue}`) - gen.assign(valid, applyTagSchema(mapping[tagValue])) - } - gen.else() - cxt.error(false, {discrError: DiscrError.Mapping, tag, tagName}) - gen.endIf() - } - - function applyTagSchema(schemaProp?: number): Name { - const _valid = gen.name("valid") - const schCxt = cxt.subschema({keyword: "oneOf", schemaProp}, _valid) - cxt.mergeEvaluated(schCxt, Name) - return _valid - } - - function getMapping(): {[T in string]?: number} { - const oneOfMapping: {[T in string]?: number} = {} - const topRequired = hasRequired(parentSchema) - let tagRequired = true - for (let i = 0; i < oneOf.length; i++) { - let sch = oneOf[i] - if (sch?.$ref && !schemaHasRulesButRef(sch, it.self.RULES)) { - const ref = sch.$ref - sch = resolveRef.call(it.self, it.schemaEnv.root, it.baseId, ref) - if (sch instanceof SchemaEnv) sch = sch.schema - if (sch === undefined) throw new MissingRefError(it.opts.uriResolver, it.baseId, ref) - } - const propSch = sch?.properties?.[tagName] - if (typeof propSch != "object") { - throw new Error( - `discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"` - ) - } - tagRequired = tagRequired && (topRequired || hasRequired(sch)) - addMappings(propSch, i) - } - if (!tagRequired) throw new Error(`discriminator: "${tagName}" must be required`) - return oneOfMapping - - function hasRequired({required}: AnySchemaObject): boolean { - return Array.isArray(required) && required.includes(tagName) - } - - function addMappings(sch: AnySchemaObject, i: number): void { - if (sch.const) { - addMapping(sch.const, i) - } else if (sch.enum) { - for (const tagValue of sch.enum) { - addMapping(tagValue, i) - } - } else { - throw new Error(`discriminator: "properties/${tagName}" must have "const" or "enum"`) - } - } - - function addMapping(tagValue: unknown, i: number): void { - if (typeof tagValue != "string" || tagValue in oneOfMapping) { - throw new Error(`discriminator: "${tagName}" values must be unique strings`) - } - oneOfMapping[tagValue] = i - } - } - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/discriminator/types.ts b/node_modules/ajv/lib/vocabularies/discriminator/types.ts deleted file mode 100644 index bee5a27..0000000 --- a/node_modules/ajv/lib/vocabularies/discriminator/types.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type {ErrorObject} from "../../types" - -export enum DiscrError { - Tag = "tag", - Mapping = "mapping", -} - -export type DiscrErrorObj = ErrorObject< - "discriminator", - {error: E; tag: string; tagValue: unknown}, - string -> diff --git a/node_modules/ajv/lib/vocabularies/draft2020.ts b/node_modules/ajv/lib/vocabularies/draft2020.ts deleted file mode 100644 index 47fbf0e..0000000 --- a/node_modules/ajv/lib/vocabularies/draft2020.ts +++ /dev/null @@ -1,23 +0,0 @@ -import type {Vocabulary} from "../types" -import coreVocabulary from "./core" -import validationVocabulary from "./validation" -import getApplicatorVocabulary from "./applicator" -import dynamicVocabulary from "./dynamic" -import nextVocabulary from "./next" -import unevaluatedVocabulary from "./unevaluated" -import formatVocabulary from "./format" -import {metadataVocabulary, contentVocabulary} from "./metadata" - -const draft2020Vocabularies: Vocabulary[] = [ - dynamicVocabulary, - coreVocabulary, - validationVocabulary, - getApplicatorVocabulary(true), - formatVocabulary, - metadataVocabulary, - contentVocabulary, - nextVocabulary, - unevaluatedVocabulary, -] - -export default draft2020Vocabularies diff --git a/node_modules/ajv/lib/vocabularies/draft7.ts b/node_modules/ajv/lib/vocabularies/draft7.ts deleted file mode 100644 index 226a644..0000000 --- a/node_modules/ajv/lib/vocabularies/draft7.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type {Vocabulary} from "../types" -import coreVocabulary from "./core" -import validationVocabulary from "./validation" -import getApplicatorVocabulary from "./applicator" -import formatVocabulary from "./format" -import {metadataVocabulary, contentVocabulary} from "./metadata" - -const draft7Vocabularies: Vocabulary[] = [ - coreVocabulary, - validationVocabulary, - getApplicatorVocabulary(), - formatVocabulary, - metadataVocabulary, - contentVocabulary, -] - -export default draft7Vocabularies diff --git a/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts b/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts deleted file mode 100644 index ca1adb9..0000000 --- a/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts +++ /dev/null @@ -1,31 +0,0 @@ -import type {CodeKeywordDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, getProperty, Code} from "../../compile/codegen" -import N from "../../compile/names" -import {SchemaEnv, compileSchema} from "../../compile" -import {getValidate} from "../core/ref" - -const def: CodeKeywordDefinition = { - keyword: "$dynamicAnchor", - schemaType: "string", - code: (cxt) => dynamicAnchor(cxt, cxt.schema), -} - -export function dynamicAnchor(cxt: KeywordCxt, anchor: string): void { - const {gen, it} = cxt - it.schemaEnv.root.dynamicAnchors[anchor] = true - const v = _`${N.dynamicAnchors}${getProperty(anchor)}` - const validate = it.errSchemaPath === "#" ? it.validateName : _getValidate(cxt) - gen.if(_`!${v}`, () => gen.assign(v, validate)) -} - -function _getValidate(cxt: KeywordCxt): Code { - const {schemaEnv, schema, self} = cxt.it - const {root, baseId, localRefs, meta} = schemaEnv.root - const {schemaId} = self.opts - const sch = new SchemaEnv({schema, schemaId, root, baseId, localRefs, meta}) - compileSchema.call(self, sch) - return getValidate(cxt, sch) -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts b/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts deleted file mode 100644 index 6a573f3..0000000 --- a/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts +++ /dev/null @@ -1,51 +0,0 @@ -import type {CodeKeywordDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, getProperty, Code, Name} from "../../compile/codegen" -import N from "../../compile/names" -import {callRef} from "../core/ref" - -const def: CodeKeywordDefinition = { - keyword: "$dynamicRef", - schemaType: "string", - code: (cxt) => dynamicRef(cxt, cxt.schema), -} - -export function dynamicRef(cxt: KeywordCxt, ref: string): void { - const {gen, keyword, it} = cxt - if (ref[0] !== "#") throw new Error(`"${keyword}" only supports hash fragment reference`) - const anchor = ref.slice(1) - if (it.allErrors) { - _dynamicRef() - } else { - const valid = gen.let("valid", false) - _dynamicRef(valid) - cxt.ok(valid) - } - - function _dynamicRef(valid?: Name): void { - // TODO the assumption here is that `recursiveRef: #` always points to the root - // of the schema object, which is not correct, because there may be $id that - // makes # point to it, and the target schema may not contain dynamic/recursiveAnchor. - // Because of that 2 tests in recursiveRef.json fail. - // This is a similar problem to #815 (`$id` doesn't alter resolution scope for `{ "$ref": "#" }`). - // (This problem is not tested in JSON-Schema-Test-Suite) - if (it.schemaEnv.root.dynamicAnchors[anchor]) { - const v = gen.let("_v", _`${N.dynamicAnchors}${getProperty(anchor)}`) - gen.if(v, _callRef(v, valid), _callRef(it.validateName, valid)) - } else { - _callRef(it.validateName, valid)() - } - } - - function _callRef(validate: Code, valid?: Name): () => void { - return valid - ? () => - gen.block(() => { - callRef(cxt, validate) - gen.let(valid, true) - }) - : () => callRef(cxt, validate) - } -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/dynamic/index.ts b/node_modules/ajv/lib/vocabularies/dynamic/index.ts deleted file mode 100644 index 6d521db..0000000 --- a/node_modules/ajv/lib/vocabularies/dynamic/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type {Vocabulary} from "../../types" -import dynamicAnchor from "./dynamicAnchor" -import dynamicRef from "./dynamicRef" -import recursiveAnchor from "./recursiveAnchor" -import recursiveRef from "./recursiveRef" - -const dynamic: Vocabulary = [dynamicAnchor, dynamicRef, recursiveAnchor, recursiveRef] - -export default dynamic diff --git a/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts b/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts deleted file mode 100644 index 25f3db9..0000000 --- a/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type {CodeKeywordDefinition} from "../../types" -import {dynamicAnchor} from "./dynamicAnchor" -import {checkStrictMode} from "../../compile/util" - -const def: CodeKeywordDefinition = { - keyword: "$recursiveAnchor", - schemaType: "boolean", - code(cxt) { - if (cxt.schema) dynamicAnchor(cxt, "") - else checkStrictMode(cxt.it, "$recursiveAnchor: false is ignored") - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts b/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts deleted file mode 100644 index c84af0f..0000000 --- a/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type {CodeKeywordDefinition} from "../../types" -import {dynamicRef} from "./dynamicRef" - -const def: CodeKeywordDefinition = { - keyword: "$recursiveRef", - schemaType: "string", - code: (cxt) => dynamicRef(cxt, cxt.schema), -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/errors.ts b/node_modules/ajv/lib/vocabularies/errors.ts deleted file mode 100644 index c9ca3f0..0000000 --- a/node_modules/ajv/lib/vocabularies/errors.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type {TypeError} from "../compile/validate/dataType" -import type {ApplicatorKeywordError} from "./applicator" -import type {ValidationKeywordError} from "./validation" -import type {FormatError} from "./format/format" -import type {UnevaluatedPropertiesError} from "./unevaluated/unevaluatedProperties" -import type {UnevaluatedItemsError} from "./unevaluated/unevaluatedItems" -import type {DependentRequiredError} from "./validation/dependentRequired" -import type {DiscriminatorError} from "./discriminator" - -export type DefinedError = - | TypeError - | ApplicatorKeywordError - | ValidationKeywordError - | FormatError - | UnevaluatedPropertiesError - | UnevaluatedItemsError - | DependentRequiredError - | DiscriminatorError diff --git a/node_modules/ajv/lib/vocabularies/format/format.ts b/node_modules/ajv/lib/vocabularies/format/format.ts deleted file mode 100644 index 4b1c13e..0000000 --- a/node_modules/ajv/lib/vocabularies/format/format.ts +++ /dev/null @@ -1,120 +0,0 @@ -import type { - AddedFormat, - FormatValidator, - AsyncFormatValidator, - CodeKeywordDefinition, - KeywordErrorDefinition, - ErrorObject, -} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, str, nil, or, Code, getProperty, regexpCode} from "../../compile/codegen" - -type FormatValidate = - | FormatValidator - | FormatValidator - | AsyncFormatValidator - | AsyncFormatValidator - | RegExp - | string - | true - -export type FormatError = ErrorObject<"format", {format: string}, string | {$data: string}> - -const error: KeywordErrorDefinition = { - message: ({schemaCode}) => str`must match format "${schemaCode}"`, - params: ({schemaCode}) => _`{format: ${schemaCode}}`, -} - -const def: CodeKeywordDefinition = { - keyword: "format", - type: ["number", "string"], - schemaType: "string", - $data: true, - error, - code(cxt: KeywordCxt, ruleType?: string) { - const {gen, data, $data, schema, schemaCode, it} = cxt - const {opts, errSchemaPath, schemaEnv, self} = it - if (!opts.validateFormats) return - - if ($data) validate$DataFormat() - else validateFormat() - - function validate$DataFormat(): void { - const fmts = gen.scopeValue("formats", { - ref: self.formats, - code: opts.code.formats, - }) - const fDef = gen.const("fDef", _`${fmts}[${schemaCode}]`) - const fType = gen.let("fType") - const format = gen.let("format") - // TODO simplify - gen.if( - _`typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, - () => gen.assign(fType, _`${fDef}.type || "string"`).assign(format, _`${fDef}.validate`), - () => gen.assign(fType, _`"string"`).assign(format, fDef) - ) - cxt.fail$data(or(unknownFmt(), invalidFmt())) - - function unknownFmt(): Code { - if (opts.strictSchema === false) return nil - return _`${schemaCode} && !${format}` - } - - function invalidFmt(): Code { - const callFormat = schemaEnv.$async - ? _`(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))` - : _`${format}(${data})` - const validData = _`(typeof ${format} == "function" ? ${callFormat} : ${format}.test(${data}))` - return _`${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}` - } - } - - function validateFormat(): void { - const formatDef: AddedFormat | undefined = self.formats[schema] - if (!formatDef) { - unknownFormat() - return - } - if (formatDef === true) return - const [fmtType, format, fmtRef] = getFormat(formatDef) - if (fmtType === ruleType) cxt.pass(validCondition()) - - function unknownFormat(): void { - if (opts.strictSchema === false) { - self.logger.warn(unknownMsg()) - return - } - throw new Error(unknownMsg()) - - function unknownMsg(): string { - return `unknown format "${schema as string}" ignored in schema at path "${errSchemaPath}"` - } - } - - function getFormat(fmtDef: AddedFormat): [string, FormatValidate, Code] { - const code = - fmtDef instanceof RegExp - ? regexpCode(fmtDef) - : opts.code.formats - ? _`${opts.code.formats}${getProperty(schema)}` - : undefined - const fmt = gen.scopeValue("formats", {key: schema, ref: fmtDef, code}) - if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) { - return [fmtDef.type || "string", fmtDef.validate, _`${fmt}.validate`] - } - - return ["string", fmtDef, fmt] - } - - function validCondition(): Code { - if (typeof formatDef == "object" && !(formatDef instanceof RegExp) && formatDef.async) { - if (!schemaEnv.$async) throw new Error("async format in sync schema") - return _`await ${fmtRef}(${data})` - } - return typeof format == "function" ? _`${fmtRef}(${data})` : _`${fmtRef}.test(${data})` - } - } - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/format/index.ts b/node_modules/ajv/lib/vocabularies/format/index.ts deleted file mode 100644 index bca2f5b..0000000 --- a/node_modules/ajv/lib/vocabularies/format/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type {Vocabulary} from "../../types" -import formatKeyword from "./format" - -const format: Vocabulary = [formatKeyword] - -export default format diff --git a/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts b/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts deleted file mode 100644 index f487c97..0000000 --- a/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts +++ /dev/null @@ -1,89 +0,0 @@ -import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, not, getProperty, Name} from "../../compile/codegen" -import {checkMetadata} from "./metadata" -import {checkNullableObject} from "./nullable" -import {typeErrorMessage, typeErrorParams, _JTDTypeError} from "./error" -import {DiscrError, DiscrErrorObj} from "../discriminator/types" - -export type JTDDiscriminatorError = - | _JTDTypeError<"discriminator", "object", string> - | DiscrErrorObj - | DiscrErrorObj - -const error: KeywordErrorDefinition = { - message: (cxt) => { - const {schema, params} = cxt - return params.discrError - ? params.discrError === DiscrError.Tag - ? `tag "${schema}" must be string` - : `value of tag "${schema}" must be in mapping` - : typeErrorMessage(cxt, "object") - }, - params: (cxt) => { - const {schema, params} = cxt - return params.discrError - ? _`{error: ${params.discrError}, tag: ${schema}, tagValue: ${params.tag}}` - : typeErrorParams(cxt, "object") - }, -} - -const def: CodeKeywordDefinition = { - keyword: "discriminator", - schemaType: "string", - implements: ["mapping"], - error, - code(cxt: KeywordCxt) { - checkMetadata(cxt) - const {gen, data, schema, parentSchema} = cxt - const [valid, cond] = checkNullableObject(cxt, data) - - gen.if(cond) - validateDiscriminator() - gen.elseIf(not(valid)) - cxt.error() - gen.endIf() - cxt.ok(valid) - - function validateDiscriminator(): void { - const tag = gen.const("tag", _`${data}${getProperty(schema)}`) - gen.if(_`${tag} === undefined`) - cxt.error(false, {discrError: DiscrError.Tag, tag}) - gen.elseIf(_`typeof ${tag} == "string"`) - validateMapping(tag) - gen.else() - cxt.error(false, {discrError: DiscrError.Tag, tag}, {instancePath: schema}) - gen.endIf() - } - - function validateMapping(tag: Name): void { - gen.if(false) - for (const tagValue in parentSchema.mapping) { - gen.elseIf(_`${tag} === ${tagValue}`) - gen.assign(valid, applyTagSchema(tagValue)) - } - gen.else() - cxt.error( - false, - {discrError: DiscrError.Mapping, tag}, - {instancePath: schema, schemaPath: "mapping", parentSchema: true} - ) - gen.endIf() - } - - function applyTagSchema(schemaProp: string): Name { - const _valid = gen.name("valid") - cxt.subschema( - { - keyword: "mapping", - schemaProp, - jtdDiscriminator: schema, - }, - _valid - ) - return _valid - } - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/jtd/elements.ts b/node_modules/ajv/lib/vocabularies/jtd/elements.ts deleted file mode 100644 index 983af7c..0000000 --- a/node_modules/ajv/lib/vocabularies/jtd/elements.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type {CodeKeywordDefinition, SchemaObject} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {alwaysValidSchema} from "../../compile/util" -import {validateArray} from "../code" -import {_, not} from "../../compile/codegen" -import {checkMetadata} from "./metadata" -import {checkNullable} from "./nullable" -import {typeError, _JTDTypeError} from "./error" - -export type JTDElementsError = _JTDTypeError<"elements", "array", SchemaObject> - -const def: CodeKeywordDefinition = { - keyword: "elements", - schemaType: "object", - error: typeError("array"), - code(cxt: KeywordCxt) { - checkMetadata(cxt) - const {gen, data, schema, it} = cxt - if (alwaysValidSchema(it, schema)) return - const [valid] = checkNullable(cxt) - gen.if(not(valid), () => - gen.if( - _`Array.isArray(${data})`, - () => gen.assign(valid, validateArray(cxt)), - () => cxt.error() - ) - ) - cxt.ok(valid) - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/jtd/enum.ts b/node_modules/ajv/lib/vocabularies/jtd/enum.ts deleted file mode 100644 index 75464ff..0000000 --- a/node_modules/ajv/lib/vocabularies/jtd/enum.ts +++ /dev/null @@ -1,45 +0,0 @@ -import type {CodeKeywordDefinition, KeywordErrorDefinition, ErrorObject} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, or, and, Code} from "../../compile/codegen" -import {checkMetadata} from "./metadata" -import {checkNullable} from "./nullable" - -export type JTDEnumError = ErrorObject<"enum", {allowedValues: string[]}, string[]> - -const error: KeywordErrorDefinition = { - message: "must be equal to one of the allowed values", - params: ({schemaCode}) => _`{allowedValues: ${schemaCode}}`, -} - -const def: CodeKeywordDefinition = { - keyword: "enum", - schemaType: "array", - error, - code(cxt: KeywordCxt) { - checkMetadata(cxt) - const {gen, data, schema, schemaValue, parentSchema, it} = cxt - if (schema.length === 0) throw new Error("enum must have non-empty array") - if (schema.length !== new Set(schema).size) throw new Error("enum items must be unique") - let valid: Code - const isString = _`typeof ${data} == "string"` - if (schema.length >= it.opts.loopEnum) { - let cond: Code - ;[valid, cond] = checkNullable(cxt, isString) - gen.if(cond, loopEnum) - } else { - /* istanbul ignore if */ - if (!Array.isArray(schema)) throw new Error("ajv implementation error") - valid = and(isString, or(...schema.map((value: string) => _`${data} === ${value}`))) - if (parentSchema.nullable) valid = or(_`${data} === null`, valid) - } - cxt.pass(valid) - - function loopEnum(): void { - gen.forOf("v", schemaValue as Code, (v) => - gen.if(_`${valid} = ${data} === ${v}`, () => gen.break()) - ) - } - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/jtd/error.ts b/node_modules/ajv/lib/vocabularies/jtd/error.ts deleted file mode 100644 index 5069322..0000000 --- a/node_modules/ajv/lib/vocabularies/jtd/error.ts +++ /dev/null @@ -1,23 +0,0 @@ -import type {KeywordErrorDefinition, KeywordErrorCxt, ErrorObject} from "../../types" -import {_, Code} from "../../compile/codegen" - -export type _JTDTypeError = ErrorObject< - K, - {type: T; nullable: boolean}, - S -> - -export function typeError(t: string): KeywordErrorDefinition { - return { - message: (cxt) => typeErrorMessage(cxt, t), - params: (cxt) => typeErrorParams(cxt, t), - } -} - -export function typeErrorMessage({parentSchema}: KeywordErrorCxt, t: string): string { - return parentSchema?.nullable ? `must be ${t} or null` : `must be ${t}` -} - -export function typeErrorParams({parentSchema}: KeywordErrorCxt, t: string): Code { - return _`{type: ${t}, nullable: ${!!parentSchema?.nullable}}` -} diff --git a/node_modules/ajv/lib/vocabularies/jtd/index.ts b/node_modules/ajv/lib/vocabularies/jtd/index.ts deleted file mode 100644 index f7baebc..0000000 --- a/node_modules/ajv/lib/vocabularies/jtd/index.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type {Vocabulary} from "../../types" -import refKeyword from "./ref" -import typeKeyword, {JTDTypeError} from "./type" -import enumKeyword, {JTDEnumError} from "./enum" -import elements, {JTDElementsError} from "./elements" -import properties, {JTDPropertiesError} from "./properties" -import optionalProperties from "./optionalProperties" -import discriminator, {JTDDiscriminatorError} from "./discriminator" -import values, {JTDValuesError} from "./values" -import union from "./union" -import metadata from "./metadata" - -const jtdVocabulary: Vocabulary = [ - "definitions", - refKeyword, - typeKeyword, - enumKeyword, - elements, - properties, - optionalProperties, - discriminator, - values, - union, - metadata, - {keyword: "additionalProperties", schemaType: "boolean"}, - {keyword: "nullable", schemaType: "boolean"}, -] - -export default jtdVocabulary - -export type JTDErrorObject = - | JTDTypeError - | JTDEnumError - | JTDElementsError - | JTDPropertiesError - | JTDDiscriminatorError - | JTDValuesError diff --git a/node_modules/ajv/lib/vocabularies/jtd/metadata.ts b/node_modules/ajv/lib/vocabularies/jtd/metadata.ts deleted file mode 100644 index 19eeb8c..0000000 --- a/node_modules/ajv/lib/vocabularies/jtd/metadata.ts +++ /dev/null @@ -1,24 +0,0 @@ -import {KeywordCxt} from "../../ajv" -import type {CodeKeywordDefinition} from "../../types" -import {alwaysValidSchema} from "../../compile/util" - -const def: CodeKeywordDefinition = { - keyword: "metadata", - schemaType: "object", - code(cxt: KeywordCxt) { - checkMetadata(cxt) - const {gen, schema, it} = cxt - if (alwaysValidSchema(it, schema)) return - const valid = gen.name("valid") - cxt.subschema({keyword: "metadata", jtdMetadata: true}, valid) - cxt.ok(valid) - }, -} - -export function checkMetadata({it, keyword}: KeywordCxt, metadata?: boolean): void { - if (it.jtdMetadata !== metadata) { - throw new Error(`JTD: "${keyword}" cannot be used in this schema location`) - } -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/jtd/nullable.ts b/node_modules/ajv/lib/vocabularies/jtd/nullable.ts deleted file mode 100644 index c74b05d..0000000 --- a/node_modules/ajv/lib/vocabularies/jtd/nullable.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type {KeywordCxt} from "../../compile/validate" -import {_, not, nil, Code, Name} from "../../compile/codegen" - -export function checkNullable( - {gen, data, parentSchema}: KeywordCxt, - cond: Code = nil -): [Name, Code] { - const valid = gen.name("valid") - if (parentSchema.nullable) { - gen.let(valid, _`${data} === null`) - cond = not(valid) - } else { - gen.let(valid, false) - } - return [valid, cond] -} - -export function checkNullableObject(cxt: KeywordCxt, cond: Code): [Name, Code] { - const [valid, cond_] = checkNullable(cxt, cond) - return [valid, _`${cond_} && typeof ${cxt.data} == "object" && !Array.isArray(${cxt.data})`] -} diff --git a/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts b/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts deleted file mode 100644 index 8e91c8d..0000000 --- a/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type {CodeKeywordDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {validateProperties, error} from "./properties" - -const def: CodeKeywordDefinition = { - keyword: "optionalProperties", - schemaType: "object", - error, - code(cxt: KeywordCxt) { - if (cxt.parentSchema.properties) return - validateProperties(cxt) - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/jtd/properties.ts b/node_modules/ajv/lib/vocabularies/jtd/properties.ts deleted file mode 100644 index 9dd24c5..0000000 --- a/node_modules/ajv/lib/vocabularies/jtd/properties.ts +++ /dev/null @@ -1,184 +0,0 @@ -import type { - CodeKeywordDefinition, - ErrorObject, - KeywordErrorDefinition, - SchemaObject, -} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {propertyInData, allSchemaProperties, isOwnProperty} from "../code" -import {alwaysValidSchema, schemaRefOrVal} from "../../compile/util" -import {_, and, not, Code, Name} from "../../compile/codegen" -import {checkMetadata} from "./metadata" -import {checkNullableObject} from "./nullable" -import {typeErrorMessage, typeErrorParams, _JTDTypeError} from "./error" - -enum PropError { - Additional = "additional", - Missing = "missing", -} - -type PropKeyword = "properties" | "optionalProperties" - -type PropSchema = {[P in string]?: SchemaObject} - -export type JTDPropertiesError = - | _JTDTypeError - | ErrorObject - | ErrorObject - -export const error: KeywordErrorDefinition = { - message: (cxt) => { - const {params} = cxt - return params.propError - ? params.propError === PropError.Additional - ? "must NOT have additional properties" - : `must have property '${params.missingProperty}'` - : typeErrorMessage(cxt, "object") - }, - params: (cxt) => { - const {params} = cxt - return params.propError - ? params.propError === PropError.Additional - ? _`{error: ${params.propError}, additionalProperty: ${params.additionalProperty}}` - : _`{error: ${params.propError}, missingProperty: ${params.missingProperty}}` - : typeErrorParams(cxt, "object") - }, -} - -const def: CodeKeywordDefinition = { - keyword: "properties", - schemaType: "object", - error, - code: validateProperties, -} - -// const error: KeywordErrorDefinition = { -// message: "should NOT have additional properties", -// params: ({params}) => _`{additionalProperty: ${params.additionalProperty}}`, -// } - -export function validateProperties(cxt: KeywordCxt): void { - checkMetadata(cxt) - const {gen, data, parentSchema, it} = cxt - const {additionalProperties, nullable} = parentSchema - if (it.jtdDiscriminator && nullable) throw new Error("JTD: nullable inside discriminator mapping") - if (commonProperties()) { - throw new Error("JTD: properties and optionalProperties have common members") - } - const [allProps, properties] = schemaProperties("properties") - const [allOptProps, optProperties] = schemaProperties("optionalProperties") - if (properties.length === 0 && optProperties.length === 0 && additionalProperties) { - return - } - - const [valid, cond] = - it.jtdDiscriminator === undefined - ? checkNullableObject(cxt, data) - : [gen.let("valid", false), true] - gen.if(cond, () => - gen.assign(valid, true).block(() => { - validateProps(properties, "properties", true) - validateProps(optProperties, "optionalProperties") - if (!additionalProperties) validateAdditional() - }) - ) - cxt.pass(valid) - - function commonProperties(): boolean { - const props = parentSchema.properties as Record | undefined - const optProps = parentSchema.optionalProperties as Record | undefined - if (!(props && optProps)) return false - for (const p in props) { - if (Object.prototype.hasOwnProperty.call(optProps, p)) return true - } - return false - } - - function schemaProperties(keyword: string): [string[], string[]] { - const schema = parentSchema[keyword] - const allPs = schema ? allSchemaProperties(schema) : [] - if (it.jtdDiscriminator && allPs.some((p) => p === it.jtdDiscriminator)) { - throw new Error(`JTD: discriminator tag used in ${keyword}`) - } - const ps = allPs.filter((p) => !alwaysValidSchema(it, schema[p])) - return [allPs, ps] - } - - function validateProps(props: string[], keyword: string, required?: boolean): void { - const _valid = gen.var("valid") - for (const prop of props) { - gen.if( - propertyInData(gen, data, prop, it.opts.ownProperties), - () => applyPropertySchema(prop, keyword, _valid), - () => missingProperty(prop) - ) - cxt.ok(_valid) - } - - function missingProperty(prop: string): void { - if (required) { - gen.assign(_valid, false) - cxt.error(false, {propError: PropError.Missing, missingProperty: prop}, {schemaPath: prop}) - } else { - gen.assign(_valid, true) - } - } - } - - function applyPropertySchema(prop: string, keyword: string, _valid: Name): void { - cxt.subschema( - { - keyword, - schemaProp: prop, - dataProp: prop, - }, - _valid - ) - } - - function validateAdditional(): void { - gen.forIn("key", data, (key: Name) => { - const addProp = isAdditional(key, allProps, "properties", it.jtdDiscriminator) - const addOptProp = isAdditional(key, allOptProps, "optionalProperties") - const extra = - addProp === true ? addOptProp : addOptProp === true ? addProp : and(addProp, addOptProp) - gen.if(extra, () => { - if (it.opts.removeAdditional) { - gen.code(_`delete ${data}[${key}]`) - } else { - cxt.error( - false, - {propError: PropError.Additional, additionalProperty: key}, - {instancePath: key, parentSchema: true} - ) - if (!it.opts.allErrors) gen.break() - } - }) - }) - } - - function isAdditional( - key: Name, - props: string[], - keyword: string, - jtdDiscriminator?: string - ): Code | true { - let additional: Code | boolean - if (props.length > 8) { - // TODO maybe an option instead of hard-coded 8? - const propsSchema = schemaRefOrVal(it, parentSchema[keyword], keyword) - additional = not(isOwnProperty(gen, propsSchema as Code, key)) - if (jtdDiscriminator !== undefined) { - additional = and(additional, _`${key} !== ${jtdDiscriminator}`) - } - } else if (props.length || jtdDiscriminator !== undefined) { - const ps = jtdDiscriminator === undefined ? props : [jtdDiscriminator].concat(props) - additional = and(...ps.map((p) => _`${key} !== ${p}`)) - } else { - additional = true - } - return additional - } -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/jtd/ref.ts b/node_modules/ajv/lib/vocabularies/jtd/ref.ts deleted file mode 100644 index 97646ee..0000000 --- a/node_modules/ajv/lib/vocabularies/jtd/ref.ts +++ /dev/null @@ -1,76 +0,0 @@ -import type {CodeKeywordDefinition, AnySchemaObject} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {compileSchema, SchemaEnv} from "../../compile" -import {_, not, nil, stringify} from "../../compile/codegen" -import MissingRefError from "../../compile/ref_error" -import N from "../../compile/names" -import {getValidate, callRef} from "../core/ref" -import {checkMetadata} from "./metadata" - -const def: CodeKeywordDefinition = { - keyword: "ref", - schemaType: "string", - code(cxt: KeywordCxt) { - checkMetadata(cxt) - const {gen, data, schema: ref, parentSchema, it} = cxt - const { - schemaEnv: {root}, - } = it - const valid = gen.name("valid") - if (parentSchema.nullable) { - gen.var(valid, _`${data} === null`) - gen.if(not(valid), validateJtdRef) - } else { - gen.var(valid, false) - validateJtdRef() - } - cxt.ok(valid) - - function validateJtdRef(): void { - const refSchema = (root.schema as AnySchemaObject).definitions?.[ref] - if (!refSchema) { - throw new MissingRefError(it.opts.uriResolver, "", ref, `No definition ${ref}`) - } - if (hasRef(refSchema) || !it.opts.inlineRefs) callValidate(refSchema) - else inlineRefSchema(refSchema) - } - - function callValidate(schema: AnySchemaObject): void { - const sch = compileSchema.call( - it.self, - new SchemaEnv({schema, root, schemaPath: `/definitions/${ref}`}) - ) - const v = getValidate(cxt, sch) - const errsCount = gen.const("_errs", N.errors) - callRef(cxt, v, sch, sch.$async) - gen.assign(valid, _`${errsCount} === ${N.errors}`) - } - - function inlineRefSchema(schema: AnySchemaObject): void { - const schName = gen.scopeValue( - "schema", - it.opts.code.source === true ? {ref: schema, code: stringify(schema)} : {ref: schema} - ) - cxt.subschema( - { - schema, - dataTypes: [], - schemaPath: nil, - topSchemaRef: schName, - errSchemaPath: `/definitions/${ref}`, - }, - valid - ) - } - }, -} - -export function hasRef(schema: AnySchemaObject): boolean { - for (const key in schema) { - let sch: AnySchemaObject - if (key === "ref" || (typeof (sch = schema[key]) == "object" && hasRef(sch))) return true - } - return false -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/jtd/type.ts b/node_modules/ajv/lib/vocabularies/jtd/type.ts deleted file mode 100644 index 1727430..0000000 --- a/node_modules/ajv/lib/vocabularies/jtd/type.ts +++ /dev/null @@ -1,75 +0,0 @@ -import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, nil, or, Code} from "../../compile/codegen" -import validTimestamp from "../../runtime/timestamp" -import {useFunc} from "../../compile/util" -import {checkMetadata} from "./metadata" -import {typeErrorMessage, typeErrorParams, _JTDTypeError} from "./error" - -export type JTDTypeError = _JTDTypeError<"type", JTDType, JTDType> - -export type IntType = "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32" - -export const intRange: {[T in IntType]: [number, number, number]} = { - int8: [-128, 127, 3], - uint8: [0, 255, 3], - int16: [-32768, 32767, 5], - uint16: [0, 65535, 5], - int32: [-2147483648, 2147483647, 10], - uint32: [0, 4294967295, 10], -} - -export type JTDType = "boolean" | "string" | "timestamp" | "float32" | "float64" | IntType - -const error: KeywordErrorDefinition = { - message: (cxt) => typeErrorMessage(cxt, cxt.schema), - params: (cxt) => typeErrorParams(cxt, cxt.schema), -} - -function timestampCode(cxt: KeywordCxt): Code { - const {gen, data, it} = cxt - const {timestamp, allowDate} = it.opts - if (timestamp === "date") return _`${data} instanceof Date ` - const vts = useFunc(gen, validTimestamp) - const allowDateArg = allowDate ? _`, true` : nil - const validString = _`typeof ${data} == "string" && ${vts}(${data}${allowDateArg})` - return timestamp === "string" ? validString : or(_`${data} instanceof Date`, validString) -} - -const def: CodeKeywordDefinition = { - keyword: "type", - schemaType: "string", - error, - code(cxt: KeywordCxt) { - checkMetadata(cxt) - const {data, schema, parentSchema, it} = cxt - let cond: Code - switch (schema) { - case "boolean": - case "string": - cond = _`typeof ${data} == ${schema}` - break - case "timestamp": { - cond = timestampCode(cxt) - break - } - case "float32": - case "float64": - cond = _`typeof ${data} == "number"` - break - default: { - const sch = schema as IntType - cond = _`typeof ${data} == "number" && isFinite(${data}) && !(${data} % 1)` - if (!it.opts.int32range && (sch === "int32" || sch === "uint32")) { - if (sch === "uint32") cond = _`${cond} && ${data} >= 0` - } else { - const [min, max] = intRange[sch] - cond = _`${cond} && ${data} >= ${min} && ${data} <= ${max}` - } - } - } - cxt.pass(parentSchema.nullable ? or(_`${data} === null`, cond) : cond) - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/jtd/union.ts b/node_modules/ajv/lib/vocabularies/jtd/union.ts deleted file mode 100644 index 588f07a..0000000 --- a/node_modules/ajv/lib/vocabularies/jtd/union.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type {CodeKeywordDefinition} from "../../types" -import {validateUnion} from "../code" - -const def: CodeKeywordDefinition = { - keyword: "union", - schemaType: "array", - trackErrors: true, - code: validateUnion, - error: {message: "must match a schema in union"}, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/jtd/values.ts b/node_modules/ajv/lib/vocabularies/jtd/values.ts deleted file mode 100644 index e649450..0000000 --- a/node_modules/ajv/lib/vocabularies/jtd/values.ts +++ /dev/null @@ -1,58 +0,0 @@ -import type {CodeKeywordDefinition, SchemaObject} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {alwaysValidSchema, Type} from "../../compile/util" -import {not, or, Name} from "../../compile/codegen" -import {checkMetadata} from "./metadata" -import {checkNullableObject} from "./nullable" -import {typeError, _JTDTypeError} from "./error" - -export type JTDValuesError = _JTDTypeError<"values", "object", SchemaObject> - -const def: CodeKeywordDefinition = { - keyword: "values", - schemaType: "object", - error: typeError("object"), - code(cxt: KeywordCxt) { - checkMetadata(cxt) - const {gen, data, schema, it} = cxt - const [valid, cond] = checkNullableObject(cxt, data) - if (alwaysValidSchema(it, schema)) { - gen.if(not(or(cond, valid)), () => cxt.error()) - } else { - gen.if(cond) - gen.assign(valid, validateMap()) - gen.elseIf(not(valid)) - cxt.error() - gen.endIf() - } - cxt.ok(valid) - - function validateMap(): Name | boolean { - const _valid = gen.name("valid") - if (it.allErrors) { - const validMap = gen.let("valid", true) - validateValues(() => gen.assign(validMap, false)) - return validMap - } - gen.var(_valid, true) - validateValues(() => gen.break()) - return _valid - - function validateValues(notValid: () => void): void { - gen.forIn("key", data, (key) => { - cxt.subschema( - { - keyword: "values", - dataProp: key, - dataPropType: Type.Str, - }, - _valid - ) - gen.if(not(_valid), notValid) - }) - } - } - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/metadata.ts b/node_modules/ajv/lib/vocabularies/metadata.ts deleted file mode 100644 index b9d5af8..0000000 --- a/node_modules/ajv/lib/vocabularies/metadata.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type {Vocabulary} from "../types" - -export const metadataVocabulary: Vocabulary = [ - "title", - "description", - "default", - "deprecated", - "readOnly", - "writeOnly", - "examples", -] - -export const contentVocabulary: Vocabulary = [ - "contentMediaType", - "contentEncoding", - "contentSchema", -] diff --git a/node_modules/ajv/lib/vocabularies/next.ts b/node_modules/ajv/lib/vocabularies/next.ts deleted file mode 100644 index 1e987ad..0000000 --- a/node_modules/ajv/lib/vocabularies/next.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type {Vocabulary} from "../types" -import dependentRequired from "./validation/dependentRequired" -import dependentSchemas from "./applicator/dependentSchemas" -import limitContains from "./validation/limitContains" - -const next: Vocabulary = [dependentRequired, dependentSchemas, limitContains] - -export default next diff --git a/node_modules/ajv/lib/vocabularies/unevaluated/index.ts b/node_modules/ajv/lib/vocabularies/unevaluated/index.ts deleted file mode 100644 index f7f0815..0000000 --- a/node_modules/ajv/lib/vocabularies/unevaluated/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {Vocabulary} from "../../types" -import unevaluatedProperties from "./unevaluatedProperties" -import unevaluatedItems from "./unevaluatedItems" - -const unevaluated: Vocabulary = [unevaluatedProperties, unevaluatedItems] - -export default unevaluated diff --git a/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts b/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts deleted file mode 100644 index 50bf0e7..0000000 --- a/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts +++ /dev/null @@ -1,47 +0,0 @@ -import type { - CodeKeywordDefinition, - ErrorObject, - KeywordErrorDefinition, - AnySchema, -} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, str, not, Name} from "../../compile/codegen" -import {alwaysValidSchema, Type} from "../../compile/util" - -export type UnevaluatedItemsError = ErrorObject<"unevaluatedItems", {limit: number}, AnySchema> - -const error: KeywordErrorDefinition = { - message: ({params: {len}}) => str`must NOT have more than ${len} items`, - params: ({params: {len}}) => _`{limit: ${len}}`, -} - -const def: CodeKeywordDefinition = { - keyword: "unevaluatedItems", - type: "array", - schemaType: ["boolean", "object"], - error, - code(cxt: KeywordCxt) { - const {gen, schema, data, it} = cxt - const items = it.items || 0 - if (items === true) return - const len = gen.const("len", _`${data}.length`) - if (schema === false) { - cxt.setParams({len: items}) - cxt.fail(_`${len} > ${items}`) - } else if (typeof schema == "object" && !alwaysValidSchema(it, schema)) { - const valid = gen.var("valid", _`${len} <= ${items}`) - gen.if(not(valid), () => validateItems(valid, items)) - cxt.ok(valid) - } - it.items = true - - function validateItems(valid: Name, from: Name | number): void { - gen.forRange("i", from, len, (i) => { - cxt.subschema({keyword: "unevaluatedItems", dataProp: i, dataPropType: Type.Num}, valid) - if (!it.allErrors) gen.if(not(valid), () => gen.break()) - }) - } - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts b/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts deleted file mode 100644 index 0e6868f..0000000 --- a/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts +++ /dev/null @@ -1,85 +0,0 @@ -import type { - CodeKeywordDefinition, - KeywordErrorDefinition, - ErrorObject, - AnySchema, -} from "../../types" -import {_, not, and, Name, Code} from "../../compile/codegen" -import {alwaysValidSchema, Type} from "../../compile/util" -import N from "../../compile/names" - -export type UnevaluatedPropertiesError = ErrorObject< - "unevaluatedProperties", - {unevaluatedProperty: string}, - AnySchema -> - -const error: KeywordErrorDefinition = { - message: "must NOT have unevaluated properties", - params: ({params}) => _`{unevaluatedProperty: ${params.unevaluatedProperty}}`, -} - -const def: CodeKeywordDefinition = { - keyword: "unevaluatedProperties", - type: "object", - schemaType: ["boolean", "object"], - trackErrors: true, - error, - code(cxt) { - const {gen, schema, data, errsCount, it} = cxt - /* istanbul ignore if */ - if (!errsCount) throw new Error("ajv implementation error") - const {allErrors, props} = it - if (props instanceof Name) { - gen.if(_`${props} !== true`, () => - gen.forIn("key", data, (key: Name) => - gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key)) - ) - ) - } else if (props !== true) { - gen.forIn("key", data, (key: Name) => - props === undefined - ? unevaluatedPropCode(key) - : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key)) - ) - } - it.props = true - cxt.ok(_`${errsCount} === ${N.errors}`) - - function unevaluatedPropCode(key: Name): void { - if (schema === false) { - cxt.setParams({unevaluatedProperty: key}) - cxt.error() - if (!allErrors) gen.break() - return - } - - if (!alwaysValidSchema(it, schema)) { - const valid = gen.name("valid") - cxt.subschema( - { - keyword: "unevaluatedProperties", - dataProp: key, - dataPropType: Type.Str, - }, - valid - ) - if (!allErrors) gen.if(not(valid), () => gen.break()) - } - } - - function unevaluatedDynamic(evaluatedProps: Name, key: Name): Code { - return _`!${evaluatedProps} || !${evaluatedProps}[${key}]` - } - - function unevaluatedStatic(evaluatedProps: {[K in string]?: true}, key: Name): Code { - const ps: Code[] = [] - for (const p in evaluatedProps) { - if (evaluatedProps[p] === true) ps.push(_`${key} !== ${p}`) - } - return and(...ps) - } - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/validation/const.ts b/node_modules/ajv/lib/vocabularies/validation/const.ts deleted file mode 100644 index a3b94a5..0000000 --- a/node_modules/ajv/lib/vocabularies/validation/const.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_} from "../../compile/codegen" -import {useFunc} from "../../compile/util" -import equal from "../../runtime/equal" - -export type ConstError = ErrorObject<"const", {allowedValue: any}> - -const error: KeywordErrorDefinition = { - message: "must be equal to constant", - params: ({schemaCode}) => _`{allowedValue: ${schemaCode}}`, -} - -const def: CodeKeywordDefinition = { - keyword: "const", - $data: true, - error, - code(cxt: KeywordCxt) { - const {gen, data, $data, schemaCode, schema} = cxt - if ($data || (schema && typeof schema == "object")) { - cxt.fail$data(_`!${useFunc(gen, equal)}(${data}, ${schemaCode})`) - } else { - cxt.fail(_`${schema} !== ${data}`) - } - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts b/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts deleted file mode 100644 index 4c616cf..0000000 --- a/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts +++ /dev/null @@ -1,23 +0,0 @@ -import type {CodeKeywordDefinition, ErrorObject} from "../../types" -import { - validatePropertyDeps, - error, - DependenciesErrorParams, - PropertyDependencies, -} from "../applicator/dependencies" - -export type DependentRequiredError = ErrorObject< - "dependentRequired", - DependenciesErrorParams, - PropertyDependencies -> - -const def: CodeKeywordDefinition = { - keyword: "dependentRequired", - type: "object", - schemaType: "object", - error, - code: (cxt) => validatePropertyDeps(cxt), -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/validation/enum.ts b/node_modules/ajv/lib/vocabularies/validation/enum.ts deleted file mode 100644 index 76377fb..0000000 --- a/node_modules/ajv/lib/vocabularies/validation/enum.ts +++ /dev/null @@ -1,54 +0,0 @@ -import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, or, Name, Code} from "../../compile/codegen" -import {useFunc} from "../../compile/util" -import equal from "../../runtime/equal" - -export type EnumError = ErrorObject<"enum", {allowedValues: any[]}, any[] | {$data: string}> - -const error: KeywordErrorDefinition = { - message: "must be equal to one of the allowed values", - params: ({schemaCode}) => _`{allowedValues: ${schemaCode}}`, -} - -const def: CodeKeywordDefinition = { - keyword: "enum", - schemaType: "array", - $data: true, - error, - code(cxt: KeywordCxt) { - const {gen, data, $data, schema, schemaCode, it} = cxt - if (!$data && schema.length === 0) throw new Error("enum must have non-empty array") - const useLoop = schema.length >= it.opts.loopEnum - let eql: Name | undefined - const getEql = (): Name => (eql ??= useFunc(gen, equal)) - - let valid: Code - if (useLoop || $data) { - valid = gen.let("valid") - cxt.block$data(valid, loopEnum) - } else { - /* istanbul ignore if */ - if (!Array.isArray(schema)) throw new Error("ajv implementation error") - const vSchema = gen.const("vSchema", schemaCode) - valid = or(...schema.map((_x: unknown, i: number) => equalCode(vSchema, i))) - } - cxt.pass(valid) - - function loopEnum(): void { - gen.assign(valid, false) - gen.forOf("v", schemaCode as Code, (v) => - gen.if(_`${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break()) - ) - } - - function equalCode(vSchema: Name, i: number): Code { - const sch = schema[i] - return typeof sch === "object" && sch !== null - ? _`${getEql()}(${data}, ${vSchema}[${i}])` - : _`${data} === ${sch}` - } - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/validation/index.ts b/node_modules/ajv/lib/vocabularies/validation/index.ts deleted file mode 100644 index 3531b19..0000000 --- a/node_modules/ajv/lib/vocabularies/validation/index.ts +++ /dev/null @@ -1,49 +0,0 @@ -import type {ErrorObject, Vocabulary} from "../../types" -import limitNumber, {LimitNumberError} from "./limitNumber" -import multipleOf, {MultipleOfError} from "./multipleOf" -import limitLength from "./limitLength" -import pattern, {PatternError} from "./pattern" -import limitProperties from "./limitProperties" -import required, {RequiredError} from "./required" -import limitItems from "./limitItems" -import uniqueItems, {UniqueItemsError} from "./uniqueItems" -import constKeyword, {ConstError} from "./const" -import enumKeyword, {EnumError} from "./enum" - -const validation: Vocabulary = [ - // number - limitNumber, - multipleOf, - // string - limitLength, - pattern, - // object - limitProperties, - required, - // array - limitItems, - uniqueItems, - // any - {keyword: "type", schemaType: ["string", "array"]}, - {keyword: "nullable", schemaType: "boolean"}, - constKeyword, - enumKeyword, -] - -export default validation - -type LimitError = ErrorObject< - "maxItems" | "minItems" | "minProperties" | "maxProperties" | "minLength" | "maxLength", - {limit: number}, - number | {$data: string} -> - -export type ValidationKeywordError = - | LimitError - | LimitNumberError - | MultipleOfError - | PatternError - | RequiredError - | UniqueItemsError - | ConstError - | EnumError diff --git a/node_modules/ajv/lib/vocabularies/validation/limitContains.ts b/node_modules/ajv/lib/vocabularies/validation/limitContains.ts deleted file mode 100644 index 8bb43c1..0000000 --- a/node_modules/ajv/lib/vocabularies/validation/limitContains.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type {CodeKeywordDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {checkStrictMode} from "../../compile/util" - -const def: CodeKeywordDefinition = { - keyword: ["maxContains", "minContains"], - type: "array", - schemaType: "number", - code({keyword, parentSchema, it}: KeywordCxt) { - if (parentSchema.contains === undefined) { - checkStrictMode(it, `"${keyword}" without "contains" is ignored`) - } - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/validation/limitItems.ts b/node_modules/ajv/lib/vocabularies/validation/limitItems.ts deleted file mode 100644 index 566de85..0000000 --- a/node_modules/ajv/lib/vocabularies/validation/limitItems.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, str, operators} from "../../compile/codegen" - -const error: KeywordErrorDefinition = { - message({keyword, schemaCode}) { - const comp = keyword === "maxItems" ? "more" : "fewer" - return str`must NOT have ${comp} than ${schemaCode} items` - }, - params: ({schemaCode}) => _`{limit: ${schemaCode}}`, -} - -const def: CodeKeywordDefinition = { - keyword: ["maxItems", "minItems"], - type: "array", - schemaType: "number", - $data: true, - error, - code(cxt: KeywordCxt) { - const {keyword, data, schemaCode} = cxt - const op = keyword === "maxItems" ? operators.GT : operators.LT - cxt.fail$data(_`${data}.length ${op} ${schemaCode}`) - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/validation/limitLength.ts b/node_modules/ajv/lib/vocabularies/validation/limitLength.ts deleted file mode 100644 index f4f9472..0000000 --- a/node_modules/ajv/lib/vocabularies/validation/limitLength.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, str, operators} from "../../compile/codegen" -import {useFunc} from "../../compile/util" -import ucs2length from "../../runtime/ucs2length" - -const error: KeywordErrorDefinition = { - message({keyword, schemaCode}) { - const comp = keyword === "maxLength" ? "more" : "fewer" - return str`must NOT have ${comp} than ${schemaCode} characters` - }, - params: ({schemaCode}) => _`{limit: ${schemaCode}}`, -} - -const def: CodeKeywordDefinition = { - keyword: ["maxLength", "minLength"], - type: "string", - schemaType: "number", - $data: true, - error, - code(cxt: KeywordCxt) { - const {keyword, data, schemaCode, it} = cxt - const op = keyword === "maxLength" ? operators.GT : operators.LT - const len = - it.opts.unicode === false ? _`${data}.length` : _`${useFunc(cxt.gen, ucs2length)}(${data})` - cxt.fail$data(_`${len} ${op} ${schemaCode}`) - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts b/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts deleted file mode 100644 index 5499202..0000000 --- a/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts +++ /dev/null @@ -1,42 +0,0 @@ -import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, str, operators, Code} from "../../compile/codegen" - -const ops = operators - -type Kwd = "maximum" | "minimum" | "exclusiveMaximum" | "exclusiveMinimum" - -type Comparison = "<=" | ">=" | "<" | ">" - -const KWDs: {[K in Kwd]: {okStr: Comparison; ok: Code; fail: Code}} = { - maximum: {okStr: "<=", ok: ops.LTE, fail: ops.GT}, - minimum: {okStr: ">=", ok: ops.GTE, fail: ops.LT}, - exclusiveMaximum: {okStr: "<", ok: ops.LT, fail: ops.GTE}, - exclusiveMinimum: {okStr: ">", ok: ops.GT, fail: ops.LTE}, -} - -export type LimitNumberError = ErrorObject< - Kwd, - {limit: number; comparison: Comparison}, - number | {$data: string} -> - -const error: KeywordErrorDefinition = { - message: ({keyword, schemaCode}) => str`must be ${KWDs[keyword as Kwd].okStr} ${schemaCode}`, - params: ({keyword, schemaCode}) => - _`{comparison: ${KWDs[keyword as Kwd].okStr}, limit: ${schemaCode}}`, -} - -const def: CodeKeywordDefinition = { - keyword: Object.keys(KWDs), - type: "number", - schemaType: "number", - $data: true, - error, - code(cxt: KeywordCxt) { - const {keyword, data, schemaCode} = cxt - cxt.fail$data(_`${data} ${KWDs[keyword as Kwd].fail} ${schemaCode} || isNaN(${data})`) - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts b/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts deleted file mode 100644 index 07fffa8..0000000 --- a/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, str, operators} from "../../compile/codegen" - -const error: KeywordErrorDefinition = { - message({keyword, schemaCode}) { - const comp = keyword === "maxProperties" ? "more" : "fewer" - return str`must NOT have ${comp} than ${schemaCode} properties` - }, - params: ({schemaCode}) => _`{limit: ${schemaCode}}`, -} - -const def: CodeKeywordDefinition = { - keyword: ["maxProperties", "minProperties"], - type: "object", - schemaType: "number", - $data: true, - error, - code(cxt: KeywordCxt) { - const {keyword, data, schemaCode} = cxt - const op = keyword === "maxProperties" ? operators.GT : operators.LT - cxt.fail$data(_`Object.keys(${data}).length ${op} ${schemaCode}`) - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts b/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts deleted file mode 100644 index 1fd79ab..0000000 --- a/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {_, str} from "../../compile/codegen" - -export type MultipleOfError = ErrorObject< - "multipleOf", - {multipleOf: number}, - number | {$data: string} -> - -const error: KeywordErrorDefinition = { - message: ({schemaCode}) => str`must be multiple of ${schemaCode}`, - params: ({schemaCode}) => _`{multipleOf: ${schemaCode}}`, -} - -const def: CodeKeywordDefinition = { - keyword: "multipleOf", - type: "number", - schemaType: "number", - $data: true, - error, - code(cxt: KeywordCxt) { - const {gen, data, schemaCode, it} = cxt - // const bdt = bad$DataType(schemaCode, def.schemaType, $data) - const prec = it.opts.multipleOfPrecision - const res = gen.let("res") - const invalid = prec - ? _`Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` - : _`${res} !== parseInt(${res})` - cxt.fail$data(_`(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid}))`) - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/validation/pattern.ts b/node_modules/ajv/lib/vocabularies/validation/pattern.ts deleted file mode 100644 index 7b27b7d..0000000 --- a/node_modules/ajv/lib/vocabularies/validation/pattern.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {usePattern} from "../code" -import {_, str} from "../../compile/codegen" - -export type PatternError = ErrorObject<"pattern", {pattern: string}, string | {$data: string}> - -const error: KeywordErrorDefinition = { - message: ({schemaCode}) => str`must match pattern "${schemaCode}"`, - params: ({schemaCode}) => _`{pattern: ${schemaCode}}`, -} - -const def: CodeKeywordDefinition = { - keyword: "pattern", - type: "string", - schemaType: "string", - $data: true, - error, - code(cxt: KeywordCxt) { - const {data, $data, schema, schemaCode, it} = cxt - // TODO regexp should be wrapped in try/catchs - const u = it.opts.unicodeRegExp ? "u" : "" - const regExp = $data ? _`(new RegExp(${schemaCode}, ${u}))` : usePattern(cxt, schema) - cxt.fail$data(_`!${regExp}.test(${data})`) - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/validation/required.ts b/node_modules/ajv/lib/vocabularies/validation/required.ts deleted file mode 100644 index fea7367..0000000 --- a/node_modules/ajv/lib/vocabularies/validation/required.ts +++ /dev/null @@ -1,98 +0,0 @@ -import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import { - checkReportMissingProp, - checkMissingProp, - reportMissingProp, - propertyInData, - noPropertyInData, -} from "../code" -import {_, str, nil, not, Name, Code} from "../../compile/codegen" -import {checkStrictMode} from "../../compile/util" - -export type RequiredError = ErrorObject< - "required", - {missingProperty: string}, - string[] | {$data: string} -> - -const error: KeywordErrorDefinition = { - message: ({params: {missingProperty}}) => str`must have required property '${missingProperty}'`, - params: ({params: {missingProperty}}) => _`{missingProperty: ${missingProperty}}`, -} - -const def: CodeKeywordDefinition = { - keyword: "required", - type: "object", - schemaType: "array", - $data: true, - error, - code(cxt: KeywordCxt) { - const {gen, schema, schemaCode, data, $data, it} = cxt - const {opts} = it - if (!$data && schema.length === 0) return - const useLoop = schema.length >= opts.loopRequired - if (it.allErrors) allErrorsMode() - else exitOnErrorMode() - - if (opts.strictRequired) { - const props = cxt.parentSchema.properties - const {definedProperties} = cxt.it - for (const requiredKey of schema) { - if (props?.[requiredKey] === undefined && !definedProperties.has(requiredKey)) { - const schemaPath = it.schemaEnv.baseId + it.errSchemaPath - const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)` - checkStrictMode(it, msg, it.opts.strictRequired) - } - } - } - - function allErrorsMode(): void { - if (useLoop || $data) { - cxt.block$data(nil, loopAllRequired) - } else { - for (const prop of schema) { - checkReportMissingProp(cxt, prop) - } - } - } - - function exitOnErrorMode(): void { - const missing = gen.let("missing") - if (useLoop || $data) { - const valid = gen.let("valid", true) - cxt.block$data(valid, () => loopUntilMissing(missing, valid)) - cxt.ok(valid) - } else { - gen.if(checkMissingProp(cxt, schema, missing)) - reportMissingProp(cxt, missing) - gen.else() - } - } - - function loopAllRequired(): void { - gen.forOf("prop", schemaCode as Code, (prop) => { - cxt.setParams({missingProperty: prop}) - gen.if(noPropertyInData(gen, data, prop, opts.ownProperties), () => cxt.error()) - }) - } - - function loopUntilMissing(missing: Name, valid: Name): void { - cxt.setParams({missingProperty: missing}) - gen.forOf( - missing, - schemaCode as Code, - () => { - gen.assign(valid, propertyInData(gen, data, missing, opts.ownProperties)) - gen.if(not(valid), () => { - cxt.error() - gen.break() - }) - }, - nil - ) - } - }, -} - -export default def diff --git a/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts b/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts deleted file mode 100644 index 765c4d0..0000000 --- a/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts +++ /dev/null @@ -1,79 +0,0 @@ -import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" -import type {KeywordCxt} from "../../compile/validate" -import {checkDataTypes, getSchemaTypes, DataType} from "../../compile/validate/dataType" -import {_, str, Name} from "../../compile/codegen" -import {useFunc} from "../../compile/util" -import equal from "../../runtime/equal" - -export type UniqueItemsError = ErrorObject< - "uniqueItems", - {i: number; j: number}, - boolean | {$data: string} -> - -const error: KeywordErrorDefinition = { - message: ({params: {i, j}}) => - str`must NOT have duplicate items (items ## ${j} and ${i} are identical)`, - params: ({params: {i, j}}) => _`{i: ${i}, j: ${j}}`, -} - -const def: CodeKeywordDefinition = { - keyword: "uniqueItems", - type: "array", - schemaType: "boolean", - $data: true, - error, - code(cxt: KeywordCxt) { - const {gen, data, $data, schema, parentSchema, schemaCode, it} = cxt - if (!$data && !schema) return - const valid = gen.let("valid") - const itemTypes = parentSchema.items ? getSchemaTypes(parentSchema.items) : [] - cxt.block$data(valid, validateUniqueItems, _`${schemaCode} === false`) - cxt.ok(valid) - - function validateUniqueItems(): void { - const i = gen.let("i", _`${data}.length`) - const j = gen.let("j") - cxt.setParams({i, j}) - gen.assign(valid, true) - gen.if(_`${i} > 1`, () => (canOptimize() ? loopN : loopN2)(i, j)) - } - - function canOptimize(): boolean { - return itemTypes.length > 0 && !itemTypes.some((t) => t === "object" || t === "array") - } - - function loopN(i: Name, j: Name): void { - const item = gen.name("item") - const wrongType = checkDataTypes(itemTypes, item, it.opts.strictNumbers, DataType.Wrong) - const indices = gen.const("indices", _`{}`) - gen.for(_`;${i}--;`, () => { - gen.let(item, _`${data}[${i}]`) - gen.if(wrongType, _`continue`) - if (itemTypes.length > 1) gen.if(_`typeof ${item} == "string"`, _`${item} += "_"`) - gen - .if(_`typeof ${indices}[${item}] == "number"`, () => { - gen.assign(j, _`${indices}[${item}]`) - cxt.error() - gen.assign(valid, false).break() - }) - .code(_`${indices}[${item}] = ${i}`) - }) - } - - function loopN2(i: Name, j: Name): void { - const eql = useFunc(gen, equal) - const outer = gen.name("outer") - gen.label(outer).for(_`;${i}--;`, () => - gen.for(_`${j} = ${i}; ${j}--;`, () => - gen.if(_`${eql}(${data}[${i}], ${data}[${j}])`, () => { - cxt.error() - gen.assign(valid, false).break(outer) - }) - ) - ) - } - }, -} - -export default def diff --git a/node_modules/ajv/package.json b/node_modules/ajv/package.json index 17df7b1..559a933 100644 --- a/node_modules/ajv/package.json +++ b/node_modules/ajv/package.json @@ -1,35 +1,34 @@ { "name": "ajv", - "version": "8.17.1", + "version": "6.12.6", "description": "Another JSON Schema Validator", - "main": "dist/ajv.js", - "types": "dist/ajv.d.ts", + "main": "lib/ajv.js", + "typings": "lib/ajv.d.ts", "files": [ "lib/", "dist/", - ".runkit_example.js" + "scripts/", + "LICENSE", + ".tonic_example.js" ], "scripts": { - "eslint": "eslint \"lib/**/*.ts\" \"spec/**/*.*s\" --ignore-pattern spec/JSON-Schema-Test-Suite", - "prettier:write": "prettier --write \"./**/*.{json,yaml,js,ts}\"", - "prettier:check": "prettier --list-different \"./**/*.{json,yaml,js,ts}\"", - "test-spec": "cross-env TS_NODE_PROJECT=spec/tsconfig.json mocha -r ts-node/register \"spec/**/*.spec.{ts,js}\" -R dot", - "test-codegen": "nyc cross-env TS_NODE_PROJECT=spec/tsconfig.json mocha -r ts-node/register 'spec/codegen.spec.ts' -R spec", + "eslint": "eslint lib/{compile/,}*.js spec/{**/,}*.js scripts --ignore-pattern spec/JSON-Schema-Test-Suite", + "jshint": "jshint lib/{compile/,}*.js", + "lint": "npm run jshint && npm run eslint", + "test-spec": "mocha spec/{**/,}*.spec.js -R spec", + "test-fast": "AJV_FAST_TEST=true npm run test-spec", "test-debug": "npm run test-spec -- --inspect-brk", "test-cov": "nyc npm run test-spec", - "rollup": "rm -rf bundle && rollup -c", - "bundle": "rm -rf bundle && node ./scripts/bundle.js ajv ajv7 ajv7 && node ./scripts/bundle.js 2019 ajv2019 ajv2019 && node ./scripts/bundle.js 2020 ajv2020 ajv2020 && node ./scripts/bundle.js jtd ajvJTD ajvJTD", - "build": "rm -rf dist && tsc && cp -r lib/refs dist && rm dist/refs/json-schema-2019-09/index.ts && rm dist/refs/json-schema-2020-12/index.ts && rm dist/refs/jtd-schema.ts", - "json-tests": "rm -rf spec/_json/*.js && node scripts/jsontests", + "test-ts": "tsc --target ES5 --noImplicitAny --noEmit spec/typescript/index.ts", + "bundle": "del-cli dist && node ./scripts/bundle.js . Ajv pure_getters", + "bundle-beautify": "node ./scripts/bundle.js js-beautify", + "build": "del-cli lib/dotjs/*.js \"!lib/dotjs/index.js\" && node scripts/compile-dots.js", "test-karma": "karma start", - "test-browser": "rm -rf .browser && npm run bundle && scripts/prepare-tests && karma start", - "test-all": "npm run test-cov && if-node-version 12 npm run test-browser", - "test": "npm run json-tests && npm run prettier:check && npm run eslint && npm link && npm link --legacy-peer-deps ajv && npm run test-cov", - "test-ci": "AJV_FULL_TEST=true npm test", - "prepublish": "npm run build", - "benchmark": "npm i && npm run build && npm link && cd ./benchmark && npm link --legacy-peer-deps ajv && npm i && node ./jtd", - "docs:dev": "./scripts/prepare-site && vuepress dev docs", - "docs:build": "./scripts/prepare-site && vuepress build docs" + "test-browser": "del-cli .browser && npm run bundle && scripts/prepare-tests && npm run test-karma", + "test-all": "npm run test-cov && if-node-version 10 npm run test-browser", + "test": "npm run lint && npm run build && npm run test-all", + "prepublish": "npm run build && npm run bundle", + "watch": "watch \"npm run build\" ./lib/dot" }, "nyc": { "exclude": [ @@ -41,7 +40,10 @@ "text-summary" ] }, - "repository": "ajv-validator/ajv", + "repository": { + "type": "git", + "url": "https://github.com/ajv-validator/ajv.git" + }, "keywords": [ "JSON", "schema", @@ -54,57 +56,44 @@ ], "author": "Evgeny Poberezkin", "license": "MIT", - "bugs": "https://github.com/ajv-validator/ajv/issues", - "homepage": "https://ajv.js.org", - "runkitExampleFilename": ".runkit_example.js", + "bugs": { + "url": "https://github.com/ajv-validator/ajv/issues" + }, + "homepage": "https://github.com/ajv-validator/ajv", + "tonicExampleFilename": ".tonic_example.js", "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" }, "devDependencies": { - "@ajv-validator/config": "^0.5.0", - "@rollup/plugin-commonjs": "^25.0.7", - "@rollup/plugin-json": "^6.1.0", - "@rollup/plugin-node-resolve": "^15.2.3", - "@rollup/plugin-typescript": "^11.1.6", - "@types/chai": "^4.3.11", - "@types/mocha": "^10.0.6", - "@types/node": "^20.11.30", - "@types/require-from-string": "^1.2.3", - "@typescript-eslint/eslint-plugin": "^7.3.1", - "@typescript-eslint/parser": "^7.3.1", - "ajv-formats": "^3.0.1", - "browserify": "^17.0.0", - "chai": "^4.4.1", - "cross-env": "^7.0.3", - "dayjs": "^1.11.10", - "dayjs-plugin-utc": "^0.1.2", - "eslint": "^8.57.0", - "eslint-config-prettier": "^9.1.0", - "glob": "^10.3.10", - "husky": "^9.0.11", - "if-node-version": "^1.1.1", - "jimp": "^0.22.10", - "js-beautify": "^1.15.1", + "ajv-async": "^1.0.0", + "bluebird": "^3.5.3", + "brfs": "^2.0.0", + "browserify": "^16.2.0", + "chai": "^4.0.1", + "coveralls": "^3.0.1", + "del-cli": "^3.0.0", + "dot": "^1.0.3", + "eslint": "^7.3.1", + "gh-pages-generator": "^0.2.3", + "glob": "^7.0.0", + "if-node-version": "^1.0.0", + "js-beautify": "^1.7.3", + "jshint": "^2.10.2", "json-schema-test": "^2.0.0", - "karma": "^6.4.2", - "karma-chrome-launcher": "^3.2.0", - "karma-mocha": "^2.0.1", - "lint-staged": "^15.2.2", - "mocha": "^10.3.0", - "module-from-string": "^3.3.0", - "node-fetch": "^3.3.2", - "nyc": "^15.1.0", - "prettier": "3.0.3", - "re2": "^1.20.9", - "rollup": "^2.79.1", - "rollup-plugin-terser": "^7.0.2", - "ts-node": "^10.9.2", - "tsify": "^5.0.4", - "typescript": "5.3.3", - "uri-js": "^4.4.1" + "karma": "^5.0.0", + "karma-chrome-launcher": "^3.0.0", + "karma-mocha": "^2.0.0", + "karma-sauce-launcher": "^4.1.3", + "mocha": "^8.0.1", + "nyc": "^15.0.0", + "pre-commit": "^1.1.1", + "require-globify": "^1.3.0", + "typescript": "^3.9.5", + "uglify-js": "^3.6.9", + "watch": "^1.0.0" }, "collective": { "type": "opencollective", @@ -113,14 +102,5 @@ "funding": { "type": "github", "url": "https://github.com/sponsors/epoberezkin" - }, - "prettier": "@ajv-validator/config/prettierrc.json", - "husky": { - "hooks": { - "pre-commit": "lint-staged && npm test" - } - }, - "lint-staged": { - "*.{json,yaml,js,ts}": "prettier --write" } } diff --git a/node_modules/babel-loader/README.md b/node_modules/babel-loader/README.md index 051792c..890ffd4 100644 --- a/node_modules/babel-loader/README.md +++ b/node_modules/babel-loader/README.md @@ -82,11 +82,17 @@ module: { } ``` +The `options` passed here will be [merged](https://babeljs.io/docs/configuration#how-babel-merges-config-items) with Babel config files, e.g. `babel.config.js` or `.babelrc`. + This loader also supports the following loader-specific option: * `cacheDirectory`: Default `false`. When set, the given directory will be used to cache the results of the loader. Future webpack builds will attempt to read from the cache to avoid needing to run the potentially expensive Babel recompilation process on each run. If the value is set to `true` in options (`{cacheDirectory: true}`), the loader will use the default cache directory in `node_modules/.cache/babel-loader` or fallback to the default OS temporary file directory if no `node_modules` folder could be found in any root directory. -* `cacheIdentifier`: Default is a string composed by the `@babel/core`'s version, the `babel-loader`'s version, the contents of `.babelrc` file if it exists, and the value of the environment variable `BABEL_ENV` with a fallback to the `NODE_ENV` environment variable. This can be set to a custom value to force cache busting if the identifier changes. +* `cacheIdentifier`: Default is a string composed by + - the `@babel/core`'s version and the `babel-loader`'s version + - the [merged](https://babeljs.io/docs/configuration#how-babel-merges-config-items) [Babel config](https://babeljs.io/docs/config-files), including options passed to `babel-loader` and the contents of `babel.config.js` or `.babelrc` file if they exist + - the value of the environment variable `BABEL_ENV` with a fallback to the `NODE_ENV` environment variable. + This can be set to a custom value to force cache busting if the identifier changes. * `cacheCompression`: Default `true`. When set, each Babel transform output will be compressed with Gzip. If you want to opt-out of cache compression, set it to `false` -- your project may benefit from this if it transpiles thousands of files. diff --git a/node_modules/babel-loader/lib/cache.js b/node_modules/babel-loader/lib/cache.js index 1d1a839..c23319b 100644 --- a/node_modules/babel-loader/lib/cache.js +++ b/node_modules/babel-loader/lib/cache.js @@ -27,7 +27,7 @@ let hashType = "sha256"; // use md5 hashing if sha256 is not available try { crypto.createHash(hashType); -} catch (err) { +} catch { hashType = "md5"; } const gunzip = promisify(zlib.gunzip); @@ -91,19 +91,25 @@ const handleCache = async function (directory, params) { options = {}, cacheIdentifier, cacheDirectory, - cacheCompression + cacheCompression, + logger } = params; const file = path.join(directory, filename(source, cacheIdentifier, options)); try { // No errors mean that the file was previously cached // we just need to return it + logger.debug(`reading cache file '${file}'`); return await read(file, cacheCompression); - } catch (err) {} + } catch { + // conitnue if cache can't be read + logger.debug(`discarded cache as it can not be read`); + } const fallback = typeof cacheDirectory !== "string" && directory !== os.tmpdir(); // Make sure the directory exists. try { // overwrite directory if exists + logger.debug(`creating cache folder '${directory}'`); await mkdir(directory, { recursive: true }); @@ -116,12 +122,14 @@ const handleCache = async function (directory, params) { // Otherwise just transform the file // return it to the user asap and write it in cache + logger.debug(`applying Babel transform`); const result = await transform(source, options); // Do not cache if there are external dependencies, // since they might change and we cannot control it. if (!result.externalDependencies.length) { try { + logger.debug(`writing result to cache file '${file}'`); await write(file, cacheCompression, result); } catch (err) { if (fallback) { diff --git a/node_modules/babel-loader/lib/index.js b/node_modules/babel-loader/lib/index.js index 6032a71..bbeb42b 100644 --- a/node_modules/babel-loader/lib/index.js +++ b/node_modules/babel-loader/lib/index.js @@ -41,6 +41,9 @@ function makeLoader(callback) { } async function loader(source, inputSourceMap, overrides) { const filename = this.resourcePath; + const logger = typeof this.getLogger === "function" ? this.getLogger("babel-loader") : { + debug: () => {} + }; let loaderOptions = this.getOptions(); validateOptions(schema, loaderOptions, { name: "Babel loader" @@ -55,15 +58,18 @@ async function loader(source, inputSourceMap, overrides) { if (overrides) { throw new Error("babel-loader's 'customize' option is not available when already " + "using a customized babel-loader wrapper."); } + logger.debug(`loading customize override: '${loaderOptions.customize}'`); let override = require(loaderOptions.customize); if (override.__esModule) override = override.default; if (typeof override !== "function") { throw new Error("Custom overrides must be functions."); } + logger.debug("applying customize override to @babel/core"); overrides = override(babel); } let customOptions; if (overrides && overrides.customOptions) { + logger.debug("applying overrides customOptions() to loader options"); const result = await overrides.customOptions.call(this, loaderOptions, { source, map: inputSourceMap @@ -79,7 +85,7 @@ async function loader(source, inputSourceMap, overrides) { if (typeof loaderOptions.babelrc === "string") { console.warn("The option `babelrc` should not be set to a string anymore in the babel-loader config. " + "Please update your configuration and set `babelrc` to true or false.\n" + "If you want to specify a specific babel config file to inherit config from " + "please use the `extends` option.\nFor more information about this options see " + "https://babeljs.io/docs/core-packages/#options"); } - + logger.debug("normalizing loader options"); // Standardize on 'sourceMaps' as the key passed through to Webpack, so that // users may safely use either one alongside our default use of // 'this.sourceMap' below without getting error about conflicting aliases. @@ -106,10 +112,12 @@ async function loader(source, inputSourceMap, overrides) { delete programmaticOptions.cacheIdentifier; delete programmaticOptions.cacheCompression; delete programmaticOptions.metadataSubscribers; + logger.debug("resolving Babel configs"); const config = await babel.loadPartialConfigAsync(injectCaller(programmaticOptions, this.target)); if (config) { let options = config.options; if (overrides && overrides.config) { + logger.debug("applying overrides config() to Babel config"); options = await overrides.config.call(this, config, { source, map: inputSourceMap, @@ -137,20 +145,27 @@ async function loader(source, inputSourceMap, overrides) { } = loaderOptions; let result; if (cacheDirectory) { + logger.debug("cache is enabled"); result = await cache({ source, options, transform, cacheDirectory, cacheIdentifier, - cacheCompression + cacheCompression, + logger }); } else { + logger.debug("cache is disabled, applying Babel transform"); result = await transform(source, options); } - config.files.forEach(configFile => this.addDependency(configFile)); + config.files.forEach(configFile => { + this.addDependency(configFile); + logger.debug(`added '${configFile}' to webpack dependencies`); + }); if (result) { if (overrides && overrides.result) { + logger.debug("applying overrides result() to Babel transform results"); result = await overrides.result.call(this, result, { source, map: inputSourceMap, @@ -165,9 +180,13 @@ async function loader(source, inputSourceMap, overrides) { metadata, externalDependencies } = result; - externalDependencies == null ? void 0 : externalDependencies.forEach(dep => this.addDependency(dep)); + externalDependencies?.forEach(dep => { + this.addDependency(dep); + logger.debug(`added '${dep}' to webpack dependencies`); + }); metadataSubscribers.forEach(subscriber => { subscribe(subscriber, metadata, this); + logger.debug(`invoked metadata subscriber '${String(subscriber)}'`); }); return [code, map]; } diff --git a/node_modules/babel-loader/lib/injectCaller.js b/node_modules/babel-loader/lib/injectCaller.js index 6f55c51..6a64989 100644 --- a/node_modules/babel-loader/lib/injectCaller.js +++ b/node_modules/babel-loader/lib/injectCaller.js @@ -1,6 +1,4 @@ -const babel = require("@babel/core"); module.exports = function injectCaller(opts, target) { - if (!supportsCallerOption()) return opts; return Object.assign({}, opts, { caller: Object.assign({ name: "babel-loader", @@ -16,26 +14,4 @@ module.exports = function injectCaller(opts, target) { supportsTopLevelAwait: true }, opts.caller) }); -}; - -// TODO: We can remove this eventually, I'm just adding it so that people have -// a little time to migrate to the newer RCs of @babel/core without getting -// hard-to-diagnose errors about unknown 'caller' options. -let supportsCallerOptionFlag = undefined; -function supportsCallerOption() { - if (supportsCallerOptionFlag === undefined) { - try { - // Rather than try to match the Babel version, we just see if it throws - // when passed a 'caller' flag, and use that to decide if it is supported. - babel.loadPartialConfig({ - caller: undefined, - babelrc: false, - configFile: false - }); - supportsCallerOptionFlag = true; - } catch (err) { - supportsCallerOptionFlag = false; - } - } - return supportsCallerOptionFlag; -} \ No newline at end of file +}; \ No newline at end of file diff --git a/node_modules/babel-loader/package.json b/node_modules/babel-loader/package.json index d928b9c..94da663 100644 --- a/node_modules/babel-loader/package.json +++ b/node_modules/babel-loader/package.json @@ -1,6 +1,6 @@ { "name": "babel-loader", - "version": "9.1.3", + "version": "9.2.1", "description": "babel module loader for webpack", "files": [ "lib" @@ -19,41 +19,34 @@ }, "devDependencies": { "@ava/babel": "^1.0.1", - "@babel/cli": "^7.19.3", - "@babel/core": "^7.19.6", - "@babel/preset-env": "^7.19.4", + "@babel/cli": "^7.23.0", + "@babel/core": "^7.23.3", + "@babel/eslint-parser": "^7.23.3", + "@babel/preset-env": "^7.23.3", "ava": "^3.13.0", - "babel-eslint": "^10.1.0", - "babel-plugin-istanbul": "^6.1.1", - "babel-plugin-react-intl": "^8.2.25", - "cross-env": "^7.0.2", - "eslint": "^7.13.0", - "eslint-config-babel": "^9.0.0", - "eslint-config-prettier": "^6.3.0", - "eslint-plugin-flowtype": "^5.2.0", - "eslint-plugin-prettier": "^3.0.0", - "husky": "^4.3.0", - "lint-staged": "^10.5.1", - "nyc": "^15.1.0", - "pnp-webpack-plugin": "^1.6.4", - "prettier": "^2.1.2", - "react": "^17.0.1", - "react-intl": "^5.9.4", - "react-intl-webpack-plugin": "^0.3.0", - "rimraf": "^3.0.0", - "semver": "7.5.2", - "webpack": "^5.74.0" + "c8": "^8.0.0", + "eslint": "^9.6.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.1.3", + "globals": "^15.8.0", + "husky": "^8.0.3", + "lint-staged": "^13.2.3", + "prettier": "^3.0.0", + "webpack": "^5.89.0" }, "scripts": { - "clean": "rimraf lib/", + "clean": "node ./scripts/rimraf.mjs lib", "build": "babel src/ --out-dir lib/ --copy-files", "format": "prettier --write --trailing-comma all 'src/**/*.js' 'test/**/*.test.js' 'test/helpers/*.js' && prettier --write --trailing-comma es5 'scripts/*.js'", "lint": "eslint src test", "precommit": "lint-staged", "prepublish": "yarn run clean && yarn run build", "preversion": "yarn run test", - "test": "yarn run lint && cross-env BABEL_ENV=test yarn run build && yarn run test-only", - "test-only": "nyc ava" + "test": "yarn run lint && yarn run build --source-maps && c8 yarn run test-only", + "test-only": "ava" + }, + "resolutions": { + "minipass": "6.0.2" }, "repository": { "type": "git", @@ -119,7 +112,5 @@ "git add yarn.lock" ] }, - "resolutions": { - "nyc/node-preload": "0.2.0" - } + "packageManager": "yarn@3.6.4" } \ No newline at end of file diff --git a/node_modules/cannon-es/dist/cannon-es.cjs.js b/node_modules/cannon-es/dist/cannon-es.cjs.js index 36301d9..9bd6c2a 100644 --- a/node_modules/cannon-es/dist/cannon-es.cjs.js +++ b/node_modules/cannon-es/dist/cannon-es.cjs.js @@ -14,7 +14,6 @@ class ObjectCollisionMatrix { * @todo Remove useless constructor */ constructor() { - this.matrix = void 0; this.matrix = {}; } /** @@ -36,7 +35,7 @@ class ObjectCollisionMatrix { i = temp; } - return i + "-" + j in this.matrix; + return `${i}-${j}` in this.matrix; } /** * set @@ -58,9 +57,9 @@ class ObjectCollisionMatrix { } if (value) { - this.matrix[i + "-" + j] = true; + this.matrix[`${i}-${j}`] = true; } else { - delete this.matrix[i + "-" + j]; + delete this.matrix[`${i}-${j}`]; } } /** @@ -92,8 +91,11 @@ class Mat3 { /** * @param elements A vector of length 9, containing all matrix elements. */ - constructor(elements = [0, 0, 0, 0, 0, 0, 0, 0, 0]) { - this.elements = void 0; + constructor(elements) { + if (elements === void 0) { + elements = [0, 0, 0, 0, 0, 0, 0, 0, 0]; + } + this.elements = elements; } /** @@ -148,7 +150,11 @@ class Mat3 { */ - getTrace(target = new Vec3()) { + getTrace(target) { + if (target === void 0) { + target = new Vec3(); + } + const e = this.elements; target.x = e[0]; target.y = e[4]; @@ -162,7 +168,11 @@ class Mat3 { */ - vmult(v, target = new Vec3()) { + vmult(v, target) { + if (target === void 0) { + target = new Vec3(); + } + const e = this.elements; const x = v.x; const y = v.y; @@ -188,7 +198,11 @@ class Mat3 { */ - mmult(matrix, target = new Mat3()) { + mmult(matrix, target) { + if (target === void 0) { + target = new Mat3(); + } + const A = this.elements; const B = matrix.elements; const T = target.elements; @@ -226,7 +240,11 @@ class Mat3 { */ - scale(vector, target = new Mat3()) { + scale(vector, target) { + if (target === void 0) { + target = new Mat3(); + } + const e = this.elements; const t = target.elements; @@ -247,7 +265,11 @@ class Mat3 { */ - solve(b, target = new Vec3()) { + solve(b, target) { + if (target === void 0) { + target = new Vec3(); + } + // Construct equations const nr = 3; // num rows @@ -318,7 +340,7 @@ class Mat3 { target.x = (eqns[0 * nc + 3] - eqns[0 * nc + 2] * target.z - eqns[0 * nc + 1] * target.y) / eqns[0 * nc + 0]; if (isNaN(target.x) || isNaN(target.y) || isNaN(target.z) || target.x === Infinity || target.y === Infinity || target.z === Infinity) { - throw "Could not solve equation! Got x=[" + target.toString() + "], b=[" + b.toString() + "], A=[" + this.toString() + "]"; + throw `Could not solve equation! Got x=[${target.toString()}], b=[${b.toString()}], A=[${this.toString()}]`; } return target; @@ -371,7 +393,11 @@ class Mat3 { */ - reverse(target = new Mat3()) { + reverse(target) { + if (target === void 0) { + target = new Mat3(); + } + // Construct equations const nr = 3; // num rows @@ -477,7 +503,7 @@ class Mat3 { p = eqns[nr + j + nc * i]; if (isNaN(p) || p === Infinity) { - throw "Could not reverse! A=[" + this.toString() + "]"; + throw `Could not reverse! A=[${this.toString()}]`; } target.e(i, j, p); @@ -527,7 +553,11 @@ class Mat3 { */ - transpose(target = new Mat3()) { + transpose(target) { + if (target === void 0) { + target = new Mat3(); + } + const M = this.elements; const T = target.elements; let tmp; //Set diagonals @@ -558,10 +588,19 @@ const reverse_eqns = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; */ class Vec3 { - constructor(x = 0.0, y = 0.0, z = 0.0) { - this.x = void 0; - this.y = void 0; - this.z = void 0; + constructor(x, y, z) { + if (x === void 0) { + x = 0.0; + } + + if (y === void 0) { + y = 0.0; + } + + if (z === void 0) { + z = 0.0; + } + this.x = x; this.y = y; this.z = z; @@ -572,7 +611,11 @@ class Vec3 { */ - cross(vector, target = new Vec3()) { + cross(vector, target) { + if (target === void 0) { + target = new Vec3(); + } + const vx = vector.x; const vy = vector.y; const vz = vector.z; @@ -675,7 +718,11 @@ class Vec3 { */ - unit(target = new Vec3()) { + unit(target) { + if (target === void 0) { + target = new Vec3(); + } + const x = this.x; const y = this.y; const z = this.z; @@ -747,7 +794,11 @@ class Vec3 { */ - scale(scalar, target = new Vec3()) { + scale(scalar, target) { + if (target === void 0) { + target = new Vec3(); + } + const x = this.x; const y = this.y; const z = this.z; @@ -762,7 +813,11 @@ class Vec3 { */ - vmul(vector, target = new Vec3()) { + vmul(vector, target) { + if (target === void 0) { + target = new Vec3(); + } + target.x = vector.x * this.x; target.y = vector.y * this.y; target.z = vector.z * this.z; @@ -774,7 +829,11 @@ class Vec3 { */ - addScaledVector(scalar, vector, target = new Vec3()) { + addScaledVector(scalar, vector, target) { + if (target === void 0) { + target = new Vec3(); + } + target.x = this.x + scalar * vector.x; target.y = this.y + scalar * vector.y; target.z = this.z + scalar * vector.z; @@ -799,7 +858,11 @@ class Vec3 { */ - negate(target = new Vec3()) { + negate(target) { + if (target === void 0) { + target = new Vec3(); + } + target.x = -this.x; target.y = -this.y; target.z = -this.z; @@ -842,7 +905,7 @@ class Vec3 { toString() { - return this.x + "," + this.y + "," + this.z; + return `${this.x},${this.y},${this.z}`; } /** * Converts to an array @@ -882,7 +945,11 @@ class Vec3 { */ - almostEquals(vector, precision = 1e-6) { + almostEquals(vector, precision) { + if (precision === void 0) { + precision = 1e-6; + } + if (Math.abs(this.x - vector.x) > precision || Math.abs(this.y - vector.y) > precision || Math.abs(this.z - vector.z) > precision) { return false; } @@ -894,7 +961,11 @@ class Vec3 { */ - almostZero(precision = 1e-6) { + almostZero(precision) { + if (precision === void 0) { + precision = 1e-6; + } + if (Math.abs(this.x) > precision || Math.abs(this.y) > precision || Math.abs(this.z) > precision) { return false; } @@ -921,10 +992,6 @@ class Vec3 { } } -Vec3.ZERO = void 0; -Vec3.UNIT_X = void 0; -Vec3.UNIT_Y = void 0; -Vec3.UNIT_Z = void 0; Vec3.ZERO = new Vec3(0, 0, 0); Vec3.UNIT_X = new Vec3(1, 0, 0); Vec3.UNIT_Y = new Vec3(0, 1, 0); @@ -944,9 +1011,11 @@ class AABB { /** * The upper bound of the bounding box */ - constructor(options = {}) { - this.lowerBound = void 0; - this.upperBound = void 0; + constructor(options) { + if (options === void 0) { + options = {}; + } + this.lowerBound = new Vec3(); this.upperBound = new Vec3(); @@ -1222,7 +1291,6 @@ class ArrayCollisionMatrix { * The matrix storage. */ constructor() { - this.matrix = void 0; this.matrix = []; } /** @@ -1292,10 +1360,6 @@ class ArrayCollisionMatrix { * Base class for objects that dispatches events. */ class EventTarget { - constructor() { - this._listeners = void 0; - } - /** * Add an event listener * @return The self object, for chainability. @@ -1410,11 +1474,23 @@ class EventTarget { */ class Quaternion { - constructor(x = 0, y = 0, z = 0, w = 1) { - this.x = void 0; - this.y = void 0; - this.z = void 0; - this.w = void 0; + constructor(x, y, z, w) { + if (x === void 0) { + x = 0; + } + + if (y === void 0) { + y = 0; + } + + if (z === void 0) { + z = 0; + } + + if (w === void 0) { + w = 1; + } + this.x = x; this.y = y; this.z = z; @@ -1439,7 +1515,7 @@ class Quaternion { toString() { - return this.x + "," + this.y + "," + this.z + "," + this.w; + return `${this.x},${this.y},${this.z},${this.w}`; } /** * Convert to an Array @@ -1470,7 +1546,11 @@ class Quaternion { */ - toAxisAngle(targetAxis = new Vec3()) { + toAxisAngle(targetAxis) { + if (targetAxis === void 0) { + targetAxis = new Vec3(); + } + this.normalize(); // if w>1 acos and sqrt will produce errors, this cant happen if quaternion is normalised const angle = 2 * Math.acos(this.w); @@ -1519,7 +1599,11 @@ class Quaternion { */ - mult(quat, target = new Quaternion()) { + mult(quat, target) { + if (target === void 0) { + target = new Quaternion(); + } + const ax = this.x; const ay = this.y; const az = this.z; @@ -1539,7 +1623,11 @@ class Quaternion { */ - inverse(target = new Quaternion()) { + inverse(target) { + if (target === void 0) { + target = new Quaternion(); + } + const x = this.x; const y = this.y; const z = this.z; @@ -1557,7 +1645,11 @@ class Quaternion { */ - conjugate(target = new Quaternion()) { + conjugate(target) { + if (target === void 0) { + target = new Quaternion(); + } + target.x = -this.x; target.y = -this.y; target.z = -this.z; @@ -1615,7 +1707,11 @@ class Quaternion { */ - vmult(v, target = new Vec3()) { + vmult(v, target) { + if (target === void 0) { + target = new Vec3(); + } + const x = v.x; const y = v.y; const z = v.z; @@ -1652,7 +1748,11 @@ class Quaternion { */ - toEuler(target, order = 'YZX') { + toEuler(target, order) { + if (order === void 0) { + order = 'YZX'; + } + let heading; let attitude; let bank; @@ -1693,7 +1793,7 @@ class Quaternion { break; default: - throw new Error("Euler order " + order + " not supported yet."); + throw new Error(`Euler order ${order} not supported yet.`); } target.y = heading; @@ -1701,13 +1801,19 @@ class Quaternion { target.x = bank; } /** + * Set the quaternion components given Euler angle representation. + * * @param order The order to apply angles: 'XYZ' or 'YXZ' or any other combination. * * See {@link https://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors MathWorks} reference */ - setFromEuler(x, y, z, order = 'XYZ') { + setFromEuler(x, y, z, order) { + if (order === void 0) { + order = 'XYZ'; + } + const c1 = Math.cos(x / 2); const c2 = Math.cos(y / 2); const c3 = Math.cos(z / 2); @@ -1763,7 +1869,11 @@ class Quaternion { */ - slerp(toQuat, t, target = new Quaternion()) { + slerp(toQuat, t, target) { + if (target === void 0) { + target = new Quaternion(); + } + const ax = this.x; const ay = this.y; const az = this.z; @@ -1814,7 +1924,11 @@ class Quaternion { */ - integrate(angularVelocity, dt, angularFactor, target = new Quaternion()) { + integrate(angularVelocity, dt, angularFactor, target) { + if (target === void 0) { + target = new Quaternion(); + } + const ax = angularVelocity.x * angularFactor.x, ay = angularVelocity.y * angularFactor.y, az = angularVelocity.z * angularFactor.z, @@ -1909,15 +2023,11 @@ class Shape { /** * All the Shape types. */ - constructor(options = {}) { - this.id = void 0; - this.type = void 0; - this.boundingSphereRadius = void 0; - this.collisionResponse = void 0; - this.collisionFilterGroup = void 0; - this.collisionFilterMask = void 0; - this.material = void 0; - this.body = void 0; + constructor(options) { + if (options === void 0) { + options = {}; + } + this.id = Shape.idCounter++; this.type = options.type || 0; this.boundingSphereRadius = 0; @@ -1934,7 +2044,7 @@ class Shape { updateBoundingSphereRadius() { - throw "computeBoundingSphereRadius() not implemented for shape type " + this.type; + throw `computeBoundingSphereRadius() not implemented for shape type ${this.type}`; } /** * Get the volume of this shape @@ -1942,7 +2052,7 @@ class Shape { volume() { - throw "volume() not implemented for shape type " + this.type; + throw `volume() not implemented for shape type ${this.type}`; } /** * Calculates the inertia in the local frame for this shape. @@ -1951,7 +2061,7 @@ class Shape { calculateLocalInertia(mass, target) { - throw "calculateLocalInertia() not implemented for shape type " + this.type; + throw `calculateLocalInertia() not implemented for shape type ${this.type}`; } /** * @todo use abstract for these kind of methods @@ -1959,7 +2069,7 @@ class Shape { calculateWorldAABB(pos, quat, min, max) { - throw "calculateWorldAABB() not implemented for shape type " + this.type; + throw `calculateWorldAABB() not implemented for shape type ${this.type}`; } } @@ -1977,9 +2087,11 @@ class Transform { /** * quaternion */ - constructor(options = {}) { - this.position = void 0; - this.quaternion = void 0; + constructor(options) { + if (options === void 0) { + options = {}; + } + this.position = new Vec3(); this.quaternion = new Quaternion(); @@ -2012,7 +2124,11 @@ class Transform { */ - vectorToWorldFrame(localVector, result = new Vec3()) { + vectorToWorldFrame(localVector, result) { + if (result === void 0) { + result = new Vec3(); + } + this.quaternion.vmult(localVector, result); return result; } @@ -2021,7 +2137,11 @@ class Transform { */ - static pointToLocalFrame(position, quaternion, worldPoint, result = new Vec3()) { + static pointToLocalFrame(position, quaternion, worldPoint, result) { + if (result === void 0) { + result = new Vec3(); + } + worldPoint.vsub(position, result); quaternion.conjugate(tmpQuat$1); tmpQuat$1.vmult(result, result); @@ -2032,7 +2152,11 @@ class Transform { */ - static pointToWorldFrame(position, quaternion, localPoint, result = new Vec3()) { + static pointToWorldFrame(position, quaternion, localPoint, result) { + if (result === void 0) { + result = new Vec3(); + } + quaternion.vmult(localPoint, result); result.vadd(position, result); return result; @@ -2042,7 +2166,11 @@ class Transform { */ - static vectorToWorldFrame(quaternion, localVector, result = new Vec3()) { + static vectorToWorldFrame(quaternion, localVector, result) { + if (result === void 0) { + result = new Vec3(); + } + quaternion.vmult(localVector, result); return result; } @@ -2051,7 +2179,11 @@ class Transform { */ - static vectorToLocalFrame(position, quaternion, worldVector, result = new Vec3()) { + static vectorToLocalFrame(position, quaternion, worldVector, result) { + if (result === void 0) { + result = new Vec3(); + } + quaternion.w *= -1; quaternion.vmult(worldVector, result); quaternion.w *= -1; @@ -2105,7 +2237,11 @@ class ConvexPolyhedron extends Shape { * @param vertices An array of Vec3's * @param faces Array of integer arrays, describing which vertices that is included in each face. */ - constructor(props = {}) { + constructor(props) { + if (props === void 0) { + props = {}; + } + const { vertices = [], faces = [], @@ -2116,15 +2252,6 @@ class ConvexPolyhedron extends Shape { super({ type: Shape.types.CONVEXPOLYHEDRON }); - this.vertices = void 0; - this.faces = void 0; - this.faceNormals = void 0; - this.worldVertices = void 0; - this.worldVerticesNeedsUpdate = void 0; - this.worldFaceNormals = void 0; - this.worldFaceNormalsNeedsUpdate = void 0; - this.uniqueAxes = void 0; - this.uniqueEdges = void 0; this.vertices = vertices; this.faces = faces; this.faceNormals = normals; @@ -2197,7 +2324,7 @@ class ConvexPolyhedron extends Shape { // Check so all vertices exists for this face for (let j = 0; j < this.faces[i].length; j++) { if (!this.vertices[this.faces[i][j]]) { - throw new Error("Vertex " + this.faces[i][j] + " not found!"); + throw new Error(`Vertex ${this.faces[i][j]} not found!`); } } @@ -2208,10 +2335,10 @@ class ConvexPolyhedron extends Shape { const vertex = this.vertices[this.faces[i][0]]; if (n.dot(vertex) < 0) { - console.error(".faceNormals[" + i + "] = Vec3(" + n.toString() + ") looks like it points into the shape? The vertices follow. Make sure they are ordered CCW around the normal, using the right hand rule."); + console.error(`.faceNormals[${i}] = Vec3(${n.toString()}) looks like it points into the shape? The vertices follow. Make sure they are ordered CCW around the normal, using the right hand rule.`); for (let j = 0; j < this.faces[i].length; j++) { - console.warn(".vertices[" + this.faces[i][j] + "] = Vec3(" + this.vertices[this.faces[i][j]].toString() + ")"); + console.warn(`.vertices[${this.faces[i][j]}] = Vec3(${this.vertices[this.faces[i][j]].toString()})`); } } } @@ -2564,7 +2691,7 @@ class ConvexPolyhedron extends Shape { let depth = planeNormalWS.dot(pVtxIn[i]) + planeEqWS; // ??? if (depth <= minDist) { - console.log("clamped: depth=" + depth + " to minDist=" + minDist); + console.log(`clamped: depth=${depth} to minDist=${minDist}`); depth = minDist; } @@ -2784,7 +2911,11 @@ class ConvexPolyhedron extends Shape { */ - getAveragePointLocal(target = new Vec3()) { + getAveragePointLocal(target) { + if (target === void 0) { + target = new Vec3(); + } + const verts = this.vertices; for (let i = 0; i < verts.length; i++) { @@ -2844,6 +2975,7 @@ class ConvexPolyhedron extends Shape { const verts = this.vertices; const faces = this.faces; const normals = this.faceNormals; + const positiveResult = null; const pointInside = new Vec3(); this.getAveragePointLocal(pointInside); @@ -2865,7 +2997,7 @@ class ConvexPolyhedron extends Shape { } // If we got here, all dot products were of the same sign. - return -1; + return positiveResult ? 1 : -1; } /** * Get max and min dot product of a convex hull at position (pos,quat) projected onto an axis. @@ -2876,6 +3008,7 @@ class ConvexPolyhedron extends Shape { static project(shape, axis, pos, quat, result) { const n = shape.vertices.length; + project_worldVertex; const localAxis = project_localAxis; let max = 0; let min = 0; @@ -2918,6 +3051,7 @@ class ConvexPolyhedron extends Shape { } const maxminA = []; const maxminB = []; +const project_worldVertex = new Vec3(); const project_localAxis = new Vec3(); const project_localOrigin = new Vec3(); @@ -2942,8 +3076,6 @@ class Box extends Shape { super({ type: Shape.types.BOX }); - this.halfExtents = void 0; - this.convexPolyhedronRepresentation = void 0; this.halfExtents = halfExtents; this.convexPolyhedronRepresentation = null; this.updateConvexPolyhedronRepresentation(); @@ -2981,7 +3113,11 @@ class Box extends Shape { */ - calculateLocalInertia(mass, target = new Vec3()) { + calculateLocalInertia(mass, target) { + if (target === void 0) { + target = new Vec3(); + } + Box.calculateInertia(this.halfExtents, mass, target); return target; } @@ -3222,238 +3358,15 @@ class Body extends EventTarget { * Dispatched after a body has fallen asleep. * @event sleep */ + constructor(options) { + if (options === void 0) { + options = {}; + } - /** - * Identifier of the body. - */ - - /** - * Position of body in World.bodies. Updated by World and used in ArrayCollisionMatrix. - */ - - /** - * Reference to the world the body is living in. - */ - - /** - * Callback function that is used BEFORE stepping the system. Use it to apply forces, for example. Inside the function, "this" will refer to this Body object. Deprecated - use World events instead. - * @deprecated Use World events instead - */ - - /** - * Callback function that is used AFTER stepping the system. Inside the function, "this" will refer to this Body object. Deprecated - use World events instead. - * @deprecated Use World events instead - */ - - /** - * The collision group the body belongs to. - * @default 1 - */ - - /** - * The collision group the body can collide with. - * @default -1 - */ - - /** - * Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled - i.e. "collide" events will be raised, but forces will not be altered. - */ - - /** - * World space position of the body. - */ - - /** - * Interpolated position of the body. - */ - - /** - * Initial position of the body. - */ - - /** - * World space velocity of the body. - */ - - /** - * Initial velocity of the body. - */ - - /** - * Linear force on the body in world space. - */ - - /** - * The mass of the body. - * @default 0 - */ - - /** - * The physics material of the body. It defines the body interaction with other bodies. - */ - - /** - * How much to damp the body velocity each step. It can go from 0 to 1. - * @default 0.01 - */ - - /** - * One of: `Body.DYNAMIC`, `Body.STATIC` and `Body.KINEMATIC`. - */ - - /** - * If true, the body will automatically fall to sleep. - * @default true - */ - - /** - * Current sleep state. - */ - - /** - * If the speed (the norm of the velocity) is smaller than this value, the body is considered sleepy. - * @default 0.1 - */ - - /** - * If the body has been sleepy for this sleepTimeLimit seconds, it is considered sleeping. - * @default 1 - */ - - /** - * World space rotational force on the body, around center of mass. - */ - - /** - * World space orientation of the body. - */ - - /** - * Initial quaternion of the body. - */ - - /** - * Interpolated orientation of the body. - */ - - /** - * Angular velocity of the body, in world space. Think of the angular velocity as a vector, which the body rotates around. The length of this vector determines how fast (in radians per second) the body rotates. - */ - - /** - * Initial angular velocity of the body. - */ - - /** - * List of Shapes that have been added to the body. - */ - - /** - * Position of each Shape in the body, given in local Body space. - */ - - /** - * Orientation of each Shape, given in local Body space. - */ - - /** - * The inertia of the body. - */ - - /** - * Set to true if you don't want the body to rotate. Make sure to run .updateMassProperties() if you change this after the body creation. - * @default false - */ - - /** - * How much to damp the body angular velocity each step. It can go from 0 to 1. - * @default 0.01 - */ - - /** - * Use this property to limit the motion along any world axis. (1,1,1) will allow motion along all axes while (0,0,0) allows none. - */ - - /** - * Use this property to limit the rotational motion along any world axis. (1,1,1) will allow rotation along all axes while (0,0,0) allows none. - */ - - /** - * World space bounding box of the body and its shapes. - */ - - /** - * Indicates if the AABB needs to be updated before use. - */ - - /** - * Total bounding radius of the Body including its shapes, relative to body.position. - */ - - /** - * When true the body behaves like a trigger. It does not collide - * with other bodies but collision events are still triggered. - * @default false - */ - constructor(options = {}) { super(); - this.id = void 0; - this.index = void 0; - this.world = void 0; - this.preStep = void 0; - this.postStep = void 0; - this.vlambda = void 0; - this.collisionFilterGroup = void 0; - this.collisionFilterMask = void 0; - this.collisionResponse = void 0; - this.position = void 0; - this.previousPosition = void 0; - this.interpolatedPosition = void 0; - this.initPosition = void 0; - this.velocity = void 0; - this.initVelocity = void 0; - this.force = void 0; - this.mass = void 0; - this.invMass = void 0; - this.material = void 0; - this.linearDamping = void 0; - this.type = void 0; - this.allowSleep = void 0; - this.sleepState = void 0; - this.sleepSpeedLimit = void 0; - this.sleepTimeLimit = void 0; - this.timeLastSleepy = void 0; - this.wakeUpAfterNarrowphase = void 0; - this.torque = void 0; - this.quaternion = void 0; - this.initQuaternion = void 0; - this.previousQuaternion = void 0; - this.interpolatedQuaternion = void 0; - this.angularVelocity = void 0; - this.initAngularVelocity = void 0; - this.shapes = void 0; - this.shapeOffsets = void 0; - this.shapeOrientations = void 0; - this.inertia = void 0; - this.invInertia = void 0; - this.invInertiaWorld = void 0; - this.invMassSolve = void 0; - this.invInertiaSolve = void 0; - this.invInertiaWorldSolve = void 0; - this.fixedRotation = void 0; - this.angularDamping = void 0; - this.linearFactor = void 0; - this.angularFactor = void 0; - this.aabb = void 0; - this.aabbNeedsUpdate = void 0; - this.boundingRadius = void 0; - this.wlambda = void 0; - this.isTrigger = void 0; this.id = Body.idCounter++; this.index = -1; this.world = null; - this.preStep = null; - this.postStep = null; this.vlambda = new Vec3(); this.collisionFilterGroup = typeof options.collisionFilterGroup === 'number' ? options.collisionFilterGroup : 1; this.collisionFilterMask = typeof options.collisionFilterMask === 'number' ? options.collisionFilterMask : -1; @@ -3622,7 +3535,11 @@ class Body extends EventTarget { */ - pointToLocalFrame(worldPoint, result = new Vec3()) { + pointToLocalFrame(worldPoint, result) { + if (result === void 0) { + result = new Vec3(); + } + worldPoint.vsub(this.position, result); this.quaternion.conjugate().vmult(result, result); return result; @@ -3632,7 +3549,11 @@ class Body extends EventTarget { */ - vectorToLocalFrame(worldVector, result = new Vec3()) { + vectorToLocalFrame(worldVector, result) { + if (result === void 0) { + result = new Vec3(); + } + this.quaternion.conjugate().vmult(worldVector, result); return result; } @@ -3641,7 +3562,11 @@ class Body extends EventTarget { */ - pointToWorldFrame(localPoint, result = new Vec3()) { + pointToWorldFrame(localPoint, result) { + if (result === void 0) { + result = new Vec3(); + } + this.quaternion.vmult(localPoint, result); result.vadd(this.position, result); return result; @@ -3651,7 +3576,11 @@ class Body extends EventTarget { */ - vectorToWorldFrame(localVector, result = new Vec3()) { + vectorToWorldFrame(localVector, result) { + if (result === void 0) { + result = new Vec3(); + } + this.quaternion.vmult(localVector, result); return result; } @@ -3775,6 +3704,7 @@ class Body extends EventTarget { if (I.x === I.y && I.y === I.z && !force) ; else { const m1 = uiw_m1; const m2 = uiw_m2; + uiw_m3; m1.setRotationFromQuaternion(this.quaternion); m1.transpose(m2); m1.scale(I, m1); @@ -3789,7 +3719,11 @@ class Body extends EventTarget { */ - applyForce(force, relativePoint = new Vec3()) { + applyForce(force, relativePoint) { + if (relativePoint === void 0) { + relativePoint = new Vec3(); + } + // Needed? if (this.type !== Body.DYNAMIC) { return; @@ -3814,7 +3748,11 @@ class Body extends EventTarget { */ - applyLocalForce(localForce, localPoint = new Vec3()) { + applyLocalForce(localForce, localPoint) { + if (localPoint === void 0) { + localPoint = new Vec3(); + } + if (this.type !== Body.DYNAMIC) { return; } @@ -3853,7 +3791,11 @@ class Body extends EventTarget { */ - applyImpulse(impulse, relativePoint = new Vec3()) { + applyImpulse(impulse, relativePoint) { + if (relativePoint === void 0) { + relativePoint = new Vec3(); + } + if (this.type !== Body.DYNAMIC) { return; } @@ -3890,7 +3832,11 @@ class Body extends EventTarget { */ - applyLocalImpulse(localImpulse, localPoint = new Vec3()) { + applyLocalImpulse(localImpulse, localPoint) { + if (localPoint === void 0) { + localPoint = new Vec3(); + } + if (this.type !== Body.DYNAMIC) { return; } @@ -4015,6 +3961,7 @@ const tmpQuat = new Quaternion(); const updateAABB_shapeAABB = new AABB(); const uiw_m1 = new Mat3(); const uiw_m2 = new Mat3(); +const uiw_m3 = new Mat3(); const Body_applyForce_rotForce = new Vec3(); const Body_applyLocalForce_worldForce = new Vec3(); const Body_applyLocalForce_relativePointWorld = new Vec3(); @@ -4041,9 +3988,6 @@ class Broadphase { * Set to true if the objects in the world moved. */ constructor() { - this.world = void 0; - this.useBoundingBoxes = void 0; - this.dirty = void 0; this.world = null; this.useBoundingBoxes = false; this.dirty = true; @@ -4150,7 +4094,7 @@ class Broadphase { for (let i = 0; i !== N; i++) { const id1 = p1[i].id; const id2 = p2[i].id; - const key = id1 < id2 ? id1 + "," + id2 : id2 + "," + id1; + const key = id1 < id2 ? `${id1},${id2}` : `${id2},${id1}`; t[key] = i; t.keys.push(key); } @@ -4195,11 +4139,15 @@ class Broadphase { } // Temp objects const Broadphase_collisionPairs_r = new Vec3(); +new Vec3(); +new Quaternion(); +new Vec3(); const Broadphase_makePairsUnique_temp = { keys: [] }; const Broadphase_makePairsUnique_p1 = []; const Broadphase_makePairsUnique_p2 = []; +new Vec3(); /** * Axis aligned uniform grid broadphase. @@ -4239,15 +4187,28 @@ class GridBroadphase extends Broadphase { * @param ny Number of boxes along y. * @param nz Number of boxes along z. */ - constructor(aabbMin = new Vec3(100, 100, 100), aabbMax = new Vec3(-100, -100, -100), nx = 10, ny = 10, nz = 10) { + constructor(aabbMin, aabbMax, nx, ny, nz) { + if (aabbMin === void 0) { + aabbMin = new Vec3(100, 100, 100); + } + + if (aabbMax === void 0) { + aabbMax = new Vec3(-100, -100, -100); + } + + if (nx === void 0) { + nx = 10; + } + + if (ny === void 0) { + ny = 10; + } + + if (nz === void 0) { + nz = 10; + } + super(); - this.nx = void 0; - this.ny = void 0; - this.nz = void 0; - this.aabbMin = void 0; - this.aabbMax = void 0; - this.bins = void 0; - this.binLengths = void 0; this.nx = nx; this.ny = ny; this.nz = nz; @@ -4276,7 +4237,7 @@ class GridBroadphase extends Broadphase { collisionPairs(world, pairs1, pairs2) { - const N = world.numObjects(); + const N = world.bodies.length; const bodies = world.bodies; const max = this.aabbMax; const min = this.aabbMin; @@ -4475,6 +4436,7 @@ class GridBroadphase extends Broadphase { } const GridBroadphase_collisionPairs_d = new Vec3(); +new Vec3(); /** * Naive broadphase implementation, used in lack of better ones. @@ -4518,7 +4480,11 @@ class NaiveBroadphase extends Broadphase { */ - aabbQuery(world, aabb, result = []) { + aabbQuery(world, aabb, result) { + if (result === void 0) { + result = []; + } + for (let i = 0; i < world.bodies.length; i++) { const b = world.bodies[i]; @@ -4581,16 +4547,6 @@ class RaycastResult { * If the ray should stop traversing the bodies */ constructor() { - this.rayFromWorld = void 0; - this.rayToWorld = void 0; - this.hitNormalWorld = void 0; - this.hitPointWorld = void 0; - this.hasHit = void 0; - this.shape = void 0; - this.body = void 0; - this.hitFaceIndex = void 0; - this.distance = void 0; - this.shouldStop = void 0; this.rayFromWorld = new Vec3(); this.rayToWorld = new Vec3(); this.hitNormalWorld = new Vec3(); @@ -4768,19 +4724,15 @@ class Ray { return this._intersectTrimesh; } - constructor(from = new Vec3(), to = new Vec3()) { - this.from = void 0; - this.to = void 0; - this.direction = void 0; - this.precision = void 0; - this.checkCollisionResponse = void 0; - this.skipBackfaces = void 0; - this.collisionFilterMask = void 0; - this.collisionFilterGroup = void 0; - this.mode = void 0; - this.result = void 0; - this.hasHit = void 0; - this.callback = void 0; + constructor(from, to) { + if (from === void 0) { + from = new Vec3(); + } + + if (to === void 0) { + to = new Vec3(); + } + this.from = from.clone(); this.to = to.clone(); this.direction = new Vec3(); @@ -5081,8 +5033,10 @@ class Ray { } _intersectConvex(shape, quat, position, body, reportedShape, options) { + intersectConvex_minDistNormal; const normal = intersectConvex_normal; const vector = intersectConvex_vector; + intersectConvex_minDistIntersect; const faceList = options && options.faceList || null; // Checking faces const faces = shape.faces; @@ -5313,6 +5267,8 @@ const intersectPoint = new Vec3(); const a = new Vec3(); const b = new Vec3(); const c = new Vec3(); +new Vec3(); +new RaycastResult(); const intersectConvexOptions = { faceList: [0] }; @@ -5322,6 +5278,8 @@ const intersectHeightfield_index = []; const Ray_intersectSphere_intersectionPoint = new Vec3(); const Ray_intersectSphere_normal = new Vec3(); const intersectConvex_normal = new Vec3(); +const intersectConvex_minDistNormal = new Vec3(); +const intersectConvex_minDistIntersect = new Vec3(); const intersectConvex_vector = new Vec3(); const intersectTrimesh_normal = new Vec3(); const intersectTrimesh_localDirection = new Vec3(); @@ -5461,11 +5419,6 @@ class SAPBroadphase extends Broadphase { constructor(world) { super(); - this.axisList = void 0; - this.world = void 0; - this.axisIndex = void 0; - this._addBodyHandler = void 0; - this._removeBodyHandler = void 0; this.axisList = []; this.world = null; this.axisIndex = 0; @@ -5620,7 +5573,11 @@ class SAPBroadphase extends Broadphase { */ - aabbQuery(world, aabb, result = []) { + aabbQuery(world, aabb, result) { + if (result === void 0) { + result = []; + } + if (this.dirty) { this.sortList(); this.dirty = false; @@ -5665,7 +5622,11 @@ class Utils { * @param defaults An object containing default values. * @return The modified options object. */ - static defaults(options = {}, defaults) { + static defaults(options, defaults) { + if (options === void 0) { + options = {}; + } + for (let key in defaults) { if (!(key in options)) { options[key] = defaults[key]; @@ -5696,12 +5657,11 @@ class Constraint { /** * Set to false if you don't want the bodies to collide when they are connected. */ - constructor(bodyA, bodyB, options = {}) { - this.equations = void 0; - this.bodyA = void 0; - this.bodyB = void 0; - this.id = void 0; - this.collideConnected = void 0; + constructor(bodyA, bodyB, options) { + if (options === void 0) { + options = {}; + } + options = Utils.defaults(options, { collideConnected: true, wakeUpBodies: true @@ -5771,8 +5731,6 @@ class JacobianElement { * rotational */ constructor() { - this.spatial = void 0; - this.rotational = void 0; this.spatial = new Vec3(); this.rotational = new Vec3(); } @@ -5824,21 +5782,15 @@ class Equation { /** * A number, proportional to the force added to the bodies. */ - constructor(bi, bj, minForce = -1e6, maxForce = 1e6) { - this.id = void 0; - this.minForce = void 0; - this.maxForce = void 0; - this.bi = void 0; - this.bj = void 0; - this.si = void 0; - this.sj = void 0; - this.a = void 0; - this.b = void 0; - this.eps = void 0; - this.jacobianElementA = void 0; - this.jacobianElementB = void 0; - this.enabled = void 0; - this.multiplier = void 0; + constructor(bi, bj, minForce, maxForce) { + if (minForce === void 0) { + minForce = -1e6; + } + + if (maxForce === void 0) { + maxForce = 1e6; + } + this.id = Equation.idCounter++; this.minForce = minForce; this.maxForce = maxForce; @@ -6032,12 +5984,12 @@ class ContactEquation extends Equation { /** * Contact normal, pointing out of body i. */ - constructor(bodyA, bodyB, maxForce = 1e6) { + constructor(bodyA, bodyB, maxForce) { + if (maxForce === void 0) { + maxForce = 1e6; + } + super(bodyA, bodyB, 0, maxForce); - this.restitution = void 0; - this.ri = void 0; - this.rj = void 0; - this.ni = void 0; this.restitution = 0.0; this.ri = new Vec3(); this.rj = new Vec3(); @@ -6148,13 +6100,20 @@ class PointToPointConstraint extends Constraint { * @param pivotB The point relative to the center of mass of bodyB which bodyB is constrained to. * @param maxForce The maximum force that should be applied to constrain the bodies. */ - constructor(bodyA, pivotA = new Vec3(), bodyB, pivotB = new Vec3(), maxForce = 1e6) { + constructor(bodyA, pivotA, bodyB, pivotB, maxForce) { + if (pivotA === void 0) { + pivotA = new Vec3(); + } + + if (pivotB === void 0) { + pivotB = new Vec3(); + } + + if (maxForce === void 0) { + maxForce = 1e6; + } + super(bodyA, bodyB); - this.pivotA = void 0; - this.pivotB = void 0; - this.equationX = void 0; - this.equationY = void 0; - this.equationZ = void 0; this.pivotA = pivotA.clone(); this.pivotB = pivotB.clone(); const x = this.equationX = new ContactEquation(bodyA, bodyB); @@ -6202,12 +6161,13 @@ class ConeEquation extends Equation { /** * The "cone angle" to keep */ - constructor(bodyA, bodyB, options = {}) { + constructor(bodyA, bodyB, options) { + if (options === void 0) { + options = {}; + } + const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6; super(bodyA, bodyB, -maxForce, maxForce); - this.axisA = void 0; - this.axisB = void 0; - this.angle = void 0; this.axisA = options.axisA ? options.axisA.clone() : new Vec3(1, 0, 0); this.axisB = options.axisB ? options.axisB.clone() : new Vec3(0, 1, 0); this.angle = typeof options.angle !== 'undefined' ? options.angle : 0; @@ -6259,12 +6219,13 @@ class RotationalEquation extends Equation { /** * maxAngle */ - constructor(bodyA, bodyB, options = {}) { + constructor(bodyA, bodyB, options) { + if (options === void 0) { + options = {}; + } + const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6; super(bodyA, bodyB, -maxForce, maxForce); - this.axisA = void 0; - this.axisB = void 0; - this.maxAngle = void 0; this.axisA = options.axisA ? options.axisA.clone() : new Vec3(1, 0, 0); this.axisB = options.axisB ? options.axisB.clone() : new Vec3(0, 1, 0); this.maxAngle = Math.PI / 2; @@ -6318,18 +6279,16 @@ class ConeTwistConstraint extends PointToPointConstraint { /** * The twist angle of the joint. */ - constructor(bodyA, bodyB, options = {}) { + constructor(bodyA, bodyB, options) { + if (options === void 0) { + options = {}; + } + const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6; // Set pivot point in between const pivotA = options.pivotA ? options.pivotA.clone() : new Vec3(); const pivotB = options.pivotB ? options.pivotB.clone() : new Vec3(); super(bodyA, pivotA, bodyB, pivotB, maxForce); - this.axisA = void 0; - this.axisB = void 0; - this.angle = void 0; - this.twistAngle = void 0; - this.coneEquation = void 0; - this.twistEquation = void 0; this.axisA = options.axisA ? options.axisA.clone() : new Vec3(); this.axisB = options.axisB ? options.axisB.clone() : new Vec3(); this.collideConnected = !!options.collideConnected; @@ -6365,6 +6324,8 @@ class ConeTwistConstraint extends PointToPointConstraint { } } +new Vec3(); +new Vec3(); /** * Constrains two bodies to be at a constant distance from each others center of mass. @@ -6378,10 +6339,12 @@ class DistanceConstraint extends Constraint { * @param distance The distance to keep. If undefined, it will be set to the current distance between bodyA and bodyB. * @param maxForce The maximum force that should be applied to constrain the bodies. */ - constructor(bodyA, bodyB, distance, maxForce = 1e6) { + constructor(bodyA, bodyB, distance, maxForce) { + if (maxForce === void 0) { + maxForce = 1e6; + } + super(bodyA, bodyB); - this.distance = void 0; - this.distanceEquation = void 0; if (typeof distance === 'undefined') { distance = bodyA.position.distanceTo(bodyB.position); @@ -6417,7 +6380,11 @@ class DistanceConstraint extends Constraint { * Lock constraint. Will remove all degrees of freedom between the bodies. */ class LockConstraint extends PointToPointConstraint { - constructor(bodyA, bodyB, options = {}) { + constructor(bodyA, bodyB, options) { + if (options === void 0) { + options = {}; + } + const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6; // Set pivot point in between const pivotA = new Vec3(); @@ -6430,16 +6397,6 @@ class LockConstraint extends PointToPointConstraint { super(bodyA, pivotA, bodyB, pivotB, maxForce); // Store initial rotation of the bodies as unit vectors in the local body spaces - this.xA = void 0; - this.xB = void 0; - this.yA = void 0; - this.yB = void 0; - this.zA = void 0; - this.zB = void 0; - this.rotationalEquation1 = void 0; - this.rotationalEquation2 = void 0; - this.rotationalEquation3 = void 0; - this.motorEquation = void 0; this.xA = bodyA.vectorToLocalFrame(Vec3.UNIT_X); this.xB = bodyB.vectorToLocalFrame(Vec3.UNIT_X); this.yA = bodyA.vectorToLocalFrame(Vec3.UNIT_Y); @@ -6464,6 +6421,8 @@ class LockConstraint extends PointToPointConstraint { const r1 = this.rotationalEquation1; const r2 = this.rotationalEquation2; const r3 = this.rotationalEquation3; + LockConstraint_update_tmpVec1; + LockConstraint_update_tmpVec2; super.update(); // These vector pairs must be orthogonal bodyA.vectorToWorldFrame(this.xA, r1.axisA); @@ -6475,6 +6434,8 @@ class LockConstraint extends PointToPointConstraint { } } +const LockConstraint_update_tmpVec1 = new Vec3(); +const LockConstraint_update_tmpVec2 = new Vec3(); /** * Rotational motor constraint. Tries to keep the relative angular velocity of the bodies to a given value. @@ -6491,11 +6452,12 @@ class RotationalMotorEquation extends Equation { /** * Motor velocity. */ - constructor(bodyA, bodyB, maxForce = 1e6) { + constructor(bodyA, bodyB, maxForce) { + if (maxForce === void 0) { + maxForce = 1e6; + } + super(bodyA, bodyB, -maxForce, maxForce); - this.axisA = void 0; - this.axisB = void 0; - this.targetVelocity = void 0; this.axisA = new Vec3(); this.axisB = new Vec3(); this.targetVelocity = 0; @@ -6536,16 +6498,15 @@ class HingeConstraint extends PointToPointConstraint { /** * Rotation axis, defined locally in bodyB. */ - constructor(bodyA, bodyB, options = {}) { + constructor(bodyA, bodyB, options) { + if (options === void 0) { + options = {}; + } + const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6; const pivotA = options.pivotA ? options.pivotA.clone() : new Vec3(); const pivotB = options.pivotB ? options.pivotB.clone() : new Vec3(); super(bodyA, pivotA, bodyB, pivotB, maxForce); - this.axisA = void 0; - this.axisB = void 0; - this.rotationalEquation1 = void 0; - this.rotationalEquation2 = void 0; - this.motorEquation = void 0; const axisA = this.axisA = options.axisA ? options.axisA.clone() : new Vec3(1, 0, 0); axisA.normalize(); const axisB = this.axisB = options.axisB ? options.axisB.clone() : new Vec3(1, 0, 0); @@ -6636,9 +6597,6 @@ class FrictionEquation extends Equation { */ constructor(bodyA, bodyB, slipForce) { super(bodyA, bodyB, -slipForce, slipForce); - this.ri = void 0; - this.rj = void 0; - this.t = void 0; this.ri = new Vec3(); this.rj = new Vec3(); this.t = new Vec3(); @@ -6718,14 +6676,6 @@ class ContactMaterial { * @default 3 */ constructor(m1, m2, options) { - this.id = void 0; - this.materials = void 0; - this.friction = void 0; - this.restitution = void 0; - this.contactEquationStiffness = void 0; - this.contactEquationRelaxation = void 0; - this.frictionEquationStiffness = void 0; - this.frictionEquationRelaxation = void 0; options = Utils.defaults(options, { friction: 0.3, restitution: 0.3, @@ -6768,11 +6718,11 @@ class Material { * Restitution for this material. * If non-negative, it will be used instead of the restitution given by ContactMaterials. If there's no matching ContactMaterial, the value from `defaultContactMaterial` in the World will be used. */ - constructor(options = {}) { - this.name = void 0; - this.id = void 0; - this.friction = void 0; - this.restitution = void 0; + constructor(options) { + if (options === void 0) { + options = {}; + } + let name = ''; // Backwards compatibility fix if (typeof options === 'string') { @@ -6839,14 +6789,11 @@ class Spring { * Where to hook the spring to body B, in local body coordinates. * @default new Vec3() */ - constructor(bodyA, bodyB, options = {}) { - this.restLength = void 0; - this.stiffness = void 0; - this.damping = void 0; - this.bodyA = void 0; - this.bodyB = void 0; - this.localAnchorA = void 0; - this.localAnchorB = void 0; + constructor(bodyA, bodyB, options) { + if (options === void 0) { + options = {}; + } + this.restLength = typeof options.restLength === 'number' ? options.restLength : 1; this.stiffness = options.stiffness || 100; this.damping = options.damping || 1; @@ -7141,45 +7088,11 @@ class WheelInfo { /** * isInContact */ - constructor(options = {}) { - this.maxSuspensionTravel = void 0; - this.customSlidingRotationalSpeed = void 0; - this.useCustomSlidingRotationalSpeed = void 0; - this.sliding = void 0; - this.chassisConnectionPointLocal = void 0; - this.chassisConnectionPointWorld = void 0; - this.directionLocal = void 0; - this.directionWorld = void 0; - this.axleLocal = void 0; - this.axleWorld = void 0; - this.suspensionRestLength = void 0; - this.suspensionMaxLength = void 0; - this.radius = void 0; - this.suspensionStiffness = void 0; - this.dampingCompression = void 0; - this.dampingRelaxation = void 0; - this.frictionSlip = void 0; - this.forwardAcceleration = void 0; - this.sideAcceleration = void 0; - this.steering = void 0; - this.rotation = void 0; - this.deltaRotation = void 0; - this.rollInfluence = void 0; - this.maxSuspensionForce = void 0; - this.engineForce = void 0; - this.brake = void 0; - this.isFrontWheel = void 0; - this.clippedInvContactDotSuspension = void 0; - this.suspensionRelativeVelocity = void 0; - this.suspensionForce = void 0; - this.slipInfo = void 0; - this.skidInfo = void 0; - this.suspensionLength = void 0; - this.sideImpulse = void 0; - this.forwardImpulse = void 0; - this.raycastResult = void 0; - this.worldTransform = void 0; - this.isInContact = void 0; + constructor(options) { + if (options === void 0) { + options = {}; + } + options = Utils.defaults(options, { chassisConnectionPointLocal: new Vec3(), chassisConnectionPointWorld: new Vec3(), @@ -7304,17 +7217,6 @@ class RaycastVehicle { /** Number of wheels on the ground. */ constructor(options) { - this.chassisBody = void 0; - this.wheelInfos = void 0; - this.sliding = void 0; - this.world = void 0; - this.indexRightAxis = void 0; - this.indexForwardAxis = void 0; - this.indexUpAxis = void 0; - this.constraints = void 0; - this.preStepCallback = void 0; - this.currentVehicleSpeedKmHour = void 0; - this.numWheelsOnGround = void 0; this.chassisBody = options.chassisBody; this.wheelInfos = []; this.sliding = false; @@ -7334,7 +7236,11 @@ class RaycastVehicle { */ - addWheel(options = {}) { + addWheel(options) { + if (options === void 0) { + options = {}; + } + const info = new WheelInfo(options); const index = this.wheelInfos.length; this.wheelInfos.push(info); @@ -7784,10 +7690,14 @@ class RaycastVehicle { } } +new Vec3(); +new Vec3(); +new Vec3(); const tmpVec4 = new Vec3(); const tmpVec5 = new Vec3(); const tmpVec6 = new Vec3(); new Ray(); +new Vec3(); const castRay_rayvector = new Vec3(); const castRay_target = new Vec3(); const directions = [new Vec3(1, 0, 0), new Vec3(0, 1, 0), new Vec3(0, 0, 1)]; @@ -7897,7 +7807,6 @@ class Sphere extends Shape { super({ type: Shape.types.SPHERE }); - this.radius = void 0; this.radius = radius !== undefined ? radius : 1.0; if (this.radius < 0) { @@ -7909,7 +7818,11 @@ class Sphere extends Shape { /** calculateLocalInertia */ - calculateLocalInertia(mass, target = new Vec3()) { + calculateLocalInertia(mass, target) { + if (target === void 0) { + target = new Vec3(); + } + const I = 2.0 * mass * this.radius * this.radius / 5.0; target.x = I; target.y = I; @@ -7963,13 +7876,11 @@ class RigidVehicle { /** * The wheel forces. */ - constructor(options = {}) { - this.wheelBodies = void 0; - this.coordinateSystem = void 0; - this.chassisBody = void 0; - this.constraints = void 0; - this.wheelAxes = void 0; - this.wheelForces = void 0; + constructor(options) { + if (options === void 0) { + options = {}; + } + this.wheelBodies = []; this.coordinateSystem = typeof options.coordinateSystem !== 'undefined' ? options.coordinateSystem.clone() : new Vec3(1, 2, 3); @@ -7992,7 +7903,11 @@ class RigidVehicle { */ - addWheel(options = {}) { + addWheel(options) { + if (options === void 0) { + options = {}; + } + let wheelBody; if (options.body) { @@ -8175,15 +8090,6 @@ class SPHSystem { * @default 0.000001 */ constructor() { - this.particles = void 0; - this.density = void 0; - this.smoothingRadius = void 0; - this.speedOfSound = void 0; - this.viscosity = void 0; - this.eps = void 0; - this.pressures = void 0; - this.densities = void 0; - this.neighbors = void 0; this.particles = []; this.density = 1; this.smoothingRadius = 1; @@ -8384,7 +8290,23 @@ class Cylinder extends ConvexPolyhedron { * @param height The height of the Cylinder. * @param numSegments The number of segments to build the cylinder out of. */ - constructor(radiusTop = 1, radiusBottom = 1, height = 1, numSegments = 8) { + constructor(radiusTop, radiusBottom, height, numSegments) { + if (radiusTop === void 0) { + radiusTop = 1; + } + + if (radiusBottom === void 0) { + radiusBottom = 1; + } + + if (height === void 0) { + height = 1; + } + + if (numSegments === void 0) { + numSegments = 8; + } + if (radiusTop < 0) { throw new Error('The cylinder radiusTop cannot be negative.'); } @@ -8446,10 +8368,6 @@ class Cylinder extends ConvexPolyhedron { faces, axes }); - this.radiusTop = void 0; - this.radiusBottom = void 0; - this.height = void 0; - this.numSegments = void 0; this.type = Shape.types.CYLINDER; this.radiusTop = radiusTop; this.radiusBottom = radiusBottom; @@ -8477,7 +8395,11 @@ class Particle extends Shape { */ - calculateLocalInertia(mass, target = new Vec3()) { + calculateLocalInertia(mass, target) { + if (target === void 0) { + target = new Vec3(); + } + target.set(0, 0, 0); return target; } @@ -8515,9 +8437,6 @@ class Plane extends Shape { type: Shape.types.PLANE }); // World oriented normal - this.worldNormal = void 0; - this.worldNormalNeedsUpdate = void 0; - this.boundingSphereRadius = void 0; this.worldNormal = new Vec3(); this.worldNormalNeedsUpdate = true; this.boundingSphereRadius = Number.MAX_VALUE; @@ -8532,7 +8451,11 @@ class Plane extends Shape { this.worldNormalNeedsUpdate = false; } - calculateLocalInertia(mass, target = new Vec3()) { + calculateLocalInertia(mass, target) { + if (target === void 0) { + target = new Vec3(); + } + return target; } @@ -8624,7 +8547,11 @@ class Heightfield extends Shape { /** * @param data An array of numbers, or height values, that are spread out along the x axis. */ - constructor(data, options = {}) { + constructor(data, options) { + if (options === void 0) { + options = {}; + } + options = Utils.defaults(options, { maxValue: null, minValue: null, @@ -8633,14 +8560,6 @@ class Heightfield extends Shape { super({ type: Shape.types.HEIGHTFIELD }); - this.data = void 0; - this.maxValue = void 0; - this.minValue = void 0; - this.elementSize = void 0; - this.cacheEnabled = void 0; - this.pillarConvex = void 0; - this.pillarOffset = void 0; - this._cachedPillars = void 0; this.data = data; this.maxValue = options.maxValue; this.minValue = options.minValue; @@ -8745,7 +8664,11 @@ class Heightfield extends Shape { */ - getRectMinMax(iMinX, iMinY, iMaxX, iMaxY, result = []) { + getRectMinMax(iMinX, iMinY, iMaxX, iMaxY, result) { + if (result === void 0) { + result = []; + } + // Get max and min of the data const data = this.data; // Set first value @@ -8847,10 +8770,11 @@ class Heightfield extends Shape { */ - getAabbAtIndex(xi, yi, { - lowerBound, - upperBound - }) { + getAabbAtIndex(xi, yi, _ref) { + let { + lowerBound, + upperBound + } = _ref; const data = this.data; const elementSize = this.elementSize; lowerBound.set(xi * elementSize, yi * elementSize, data[xi][yi]); @@ -8890,7 +8814,7 @@ class Heightfield extends Shape { } getCacheConvexTrianglePillarKey(xi, yi, getUpperTriangle) { - return xi + "_" + yi + "_" + (getUpperTriangle ? 1 : 0); + return `${xi}_${yi}_${getUpperTriangle ? 1 : 0}`; } getCachedConvexTrianglePillar(xi, yi, getUpperTriangle) { @@ -9056,7 +8980,11 @@ class Heightfield extends Shape { this.setCachedConvexTrianglePillar(xi, yi, getUpperTriangle, result, offsetResult); } - calculateLocalInertia(mass, target = new Vec3()) { + calculateLocalInertia(mass, target) { + if (target === void 0) { + target = new Vec3(); + } + target.set(0, 0, 0); return target; } @@ -9157,11 +9085,11 @@ class OctreeNode { /** Contained data at the current node level */ /** Children to this node */ - constructor(options = {}) { - this.root = void 0; - this.aabb = void 0; - this.data = void 0; - this.children = void 0; + constructor(options) { + if (options === void 0) { + options = {}; + } + this.root = options.root || null; this.aabb = options.aabb ? options.aabb.clone() : new AABB(); this.data = []; @@ -9181,7 +9109,11 @@ class OctreeNode { */ - insert(aabb, elementData, level = 0) { + insert(aabb, elementData, level) { + if (level === void 0) { + level = 0; + } + const nodeData = this.data; // Ignore objects that do not belong in this node if (!this.aabb.contains(aabb)) { @@ -9357,12 +9289,15 @@ class Octree extends OctreeNode { /** * @param aabb The total AABB of the tree */ - constructor(aabb, options = {}) { + constructor(aabb, options) { + if (options === void 0) { + options = {}; + } + super({ root: null, aabb }); - this.maxDepth = void 0; this.maxDepth = typeof options.maxDepth !== 'undefined' ? options.maxDepth : 8; } @@ -9416,13 +9351,6 @@ class Trimesh extends Shape { super({ type: Shape.types.TRIMESH }); - this.vertices = void 0; - this.indices = void 0; - this.normals = void 0; - this.aabb = void 0; - this.edges = void 0; - this.scale = void 0; - this.tree = void 0; this.vertices = new Float32Array(vertices); this.indices = new Int16Array(indices); this.normals = new Float32Array(indices.length); @@ -9551,7 +9479,7 @@ class Trimesh extends Shape { const edges = {}; const add = (a, b) => { - const key = a < b ? a + "_" + b : b + "_" + a; + const key = a < b ? `${a}_${b}` : `${b}_${a}`; edges[key] = true; }; @@ -9807,7 +9735,27 @@ class Trimesh extends Shape { */ - static createTorus(radius = 1, tube = 0.5, radialSegments = 8, tubularSegments = 6, arc = Math.PI * 2) { + static createTorus(radius, tube, radialSegments, tubularSegments, arc) { + if (radius === void 0) { + radius = 1; + } + + if (tube === void 0) { + tube = 0.5; + } + + if (radialSegments === void 0) { + radialSegments = 8; + } + + if (tubularSegments === void 0) { + tubularSegments = 6; + } + + if (arc === void 0) { + arc = Math.PI * 2; + } + const vertices = []; const indices = []; @@ -9863,7 +9811,6 @@ class Solver { * @todo remove useless constructor */ constructor() { - this.equations = void 0; this.equations = []; } /** @@ -9932,8 +9879,6 @@ class GSSolver extends Solver { */ constructor() { super(); - this.iterations = void 0; - this.tolerance = void 0; this.iterations = 10; this.tolerance = 1e-7; } @@ -10066,11 +10011,6 @@ class SplitSolver extends Solver { /** subsolver */ constructor(subsolver) { super(); - this.iterations = void 0; - this.tolerance = void 0; - this.subsolver = void 0; - this.nodes = void 0; - this.nodePool = void 0; this.iterations = 10; this.tolerance = 1e-7; this.subsolver = subsolver; @@ -10241,11 +10181,11 @@ class Pool { /** * Release an object after use */ - release(...args) { - const Nargs = args.length; + release() { + const Nargs = arguments.length; for (let i = 0; i !== Nargs; i++) { - this.objects.push(args[i]); + this.objects.push(i < 0 || arguments.length <= i ? undefined : arguments[i]); } return this; @@ -10296,8 +10236,8 @@ class Pool { */ class Vec3Pool extends Pool { - constructor(...args) { - super(...args); + constructor() { + super(...arguments); this.type = Vec3; } @@ -10310,7 +10250,6 @@ class Vec3Pool extends Pool { } -let _COLLISION_TYPES$sphe, _COLLISION_TYPES$sphe2, _COLLISION_TYPES$boxB, _COLLISION_TYPES$sphe3, _COLLISION_TYPES$plan, _COLLISION_TYPES$conv, _COLLISION_TYPES$sphe4, _COLLISION_TYPES$plan2, _COLLISION_TYPES$boxC, _COLLISION_TYPES$sphe5, _COLLISION_TYPES$boxH, _COLLISION_TYPES$conv2, _COLLISION_TYPES$sphe6, _COLLISION_TYPES$plan3, _COLLISION_TYPES$boxP, _COLLISION_TYPES$conv3, _COLLISION_TYPES$cyli, _COLLISION_TYPES$sphe7, _COLLISION_TYPES$plan4, _COLLISION_TYPES$boxC2, _COLLISION_TYPES$conv4, _COLLISION_TYPES$heig, _COLLISION_TYPES$part, _COLLISION_TYPES$sphe8, _COLLISION_TYPES$plan5; // Naming rule: based of the order in SHAPE_TYPES, // the first part of the method is formed by the // shape type that comes before, in the second part @@ -10342,31 +10281,6 @@ const COLLISION_TYPES = { sphereTrimesh: Shape.types.SPHERE | Shape.types.TRIMESH, planeTrimesh: Shape.types.PLANE | Shape.types.TRIMESH }; -_COLLISION_TYPES$sphe = COLLISION_TYPES.sphereSphere; -_COLLISION_TYPES$sphe2 = COLLISION_TYPES.spherePlane; -_COLLISION_TYPES$boxB = COLLISION_TYPES.boxBox; -_COLLISION_TYPES$sphe3 = COLLISION_TYPES.sphereBox; -_COLLISION_TYPES$plan = COLLISION_TYPES.planeBox; -_COLLISION_TYPES$conv = COLLISION_TYPES.convexConvex; -_COLLISION_TYPES$sphe4 = COLLISION_TYPES.sphereConvex; -_COLLISION_TYPES$plan2 = COLLISION_TYPES.planeConvex; -_COLLISION_TYPES$boxC = COLLISION_TYPES.boxConvex; -_COLLISION_TYPES$sphe5 = COLLISION_TYPES.sphereHeightfield; -_COLLISION_TYPES$boxH = COLLISION_TYPES.boxHeightfield; -_COLLISION_TYPES$conv2 = COLLISION_TYPES.convexHeightfield; -_COLLISION_TYPES$sphe6 = COLLISION_TYPES.sphereParticle; -_COLLISION_TYPES$plan3 = COLLISION_TYPES.planeParticle; -_COLLISION_TYPES$boxP = COLLISION_TYPES.boxParticle; -_COLLISION_TYPES$conv3 = COLLISION_TYPES.convexParticle; -_COLLISION_TYPES$cyli = COLLISION_TYPES.cylinderCylinder; -_COLLISION_TYPES$sphe7 = COLLISION_TYPES.sphereCylinder; -_COLLISION_TYPES$plan4 = COLLISION_TYPES.planeCylinder; -_COLLISION_TYPES$boxC2 = COLLISION_TYPES.boxCylinder; -_COLLISION_TYPES$conv4 = COLLISION_TYPES.convexCylinder; -_COLLISION_TYPES$heig = COLLISION_TYPES.heightfieldCylinder; -_COLLISION_TYPES$part = COLLISION_TYPES.particleCylinder; -_COLLISION_TYPES$sphe8 = COLLISION_TYPES.sphereTrimesh; -_COLLISION_TYPES$plan5 = COLLISION_TYPES.planeTrimesh; /** * Helper class for the World. Generates ContactEquations. @@ -10382,103 +10296,103 @@ class Narrowphase { /** * Pooled vectors. */ - get [_COLLISION_TYPES$sphe]() { + get [COLLISION_TYPES.sphereSphere]() { return this.sphereSphere; } - get [_COLLISION_TYPES$sphe2]() { + get [COLLISION_TYPES.spherePlane]() { return this.spherePlane; } - get [_COLLISION_TYPES$boxB]() { + get [COLLISION_TYPES.boxBox]() { return this.boxBox; } - get [_COLLISION_TYPES$sphe3]() { + get [COLLISION_TYPES.sphereBox]() { return this.sphereBox; } - get [_COLLISION_TYPES$plan]() { + get [COLLISION_TYPES.planeBox]() { return this.planeBox; } - get [_COLLISION_TYPES$conv]() { + get [COLLISION_TYPES.convexConvex]() { return this.convexConvex; } - get [_COLLISION_TYPES$sphe4]() { + get [COLLISION_TYPES.sphereConvex]() { return this.sphereConvex; } - get [_COLLISION_TYPES$plan2]() { + get [COLLISION_TYPES.planeConvex]() { return this.planeConvex; } - get [_COLLISION_TYPES$boxC]() { + get [COLLISION_TYPES.boxConvex]() { return this.boxConvex; } - get [_COLLISION_TYPES$sphe5]() { + get [COLLISION_TYPES.sphereHeightfield]() { return this.sphereHeightfield; } - get [_COLLISION_TYPES$boxH]() { + get [COLLISION_TYPES.boxHeightfield]() { return this.boxHeightfield; } - get [_COLLISION_TYPES$conv2]() { + get [COLLISION_TYPES.convexHeightfield]() { return this.convexHeightfield; } - get [_COLLISION_TYPES$sphe6]() { + get [COLLISION_TYPES.sphereParticle]() { return this.sphereParticle; } - get [_COLLISION_TYPES$plan3]() { + get [COLLISION_TYPES.planeParticle]() { return this.planeParticle; } - get [_COLLISION_TYPES$boxP]() { + get [COLLISION_TYPES.boxParticle]() { return this.boxParticle; } - get [_COLLISION_TYPES$conv3]() { + get [COLLISION_TYPES.convexParticle]() { return this.convexParticle; } - get [_COLLISION_TYPES$cyli]() { + get [COLLISION_TYPES.cylinderCylinder]() { return this.convexConvex; } - get [_COLLISION_TYPES$sphe7]() { + get [COLLISION_TYPES.sphereCylinder]() { return this.sphereConvex; } - get [_COLLISION_TYPES$plan4]() { + get [COLLISION_TYPES.planeCylinder]() { return this.planeConvex; } - get [_COLLISION_TYPES$boxC2]() { + get [COLLISION_TYPES.boxCylinder]() { return this.boxConvex; } - get [_COLLISION_TYPES$conv4]() { + get [COLLISION_TYPES.convexCylinder]() { return this.convexConvex; } - get [_COLLISION_TYPES$heig]() { + get [COLLISION_TYPES.heightfieldCylinder]() { return this.heightfieldCylinder; } - get [_COLLISION_TYPES$part]() { + get [COLLISION_TYPES.particleCylinder]() { return this.particleCylinder; } - get [_COLLISION_TYPES$sphe8]() { + get [COLLISION_TYPES.sphereTrimesh]() { return this.sphereTrimesh; } - get [_COLLISION_TYPES$plan5]() { + get [COLLISION_TYPES.planeTrimesh]() { return this.planeTrimesh; } // get [COLLISION_TYPES.convexTrimesh]() { // return this.convexTrimesh @@ -10486,14 +10400,6 @@ class Narrowphase { constructor(world) { - this.contactPointPool = void 0; - this.frictionEquationPool = void 0; - this.result = void 0; - this.frictionResult = void 0; - this.v3pool = void 0; - this.world = void 0; - this.currentContactMaterial = void 0; - this.enableFrictionReduction = void 0; this.contactPointPool = []; this.frictionEquationPool = []; this.result = []; @@ -10553,7 +10459,8 @@ class Narrowphase { if (friction > 0) { // Create 2 tangent equations - const mug = friction * world.gravity.length(); + // Users may provide a force different from global gravity to use when computing contact friction. + const mug = friction * (world.frictionGravity || world.gravity).length(); let reducedMass = bodyA.invMass + bodyB.invMass; if (reducedMass > 0) { @@ -11901,6 +11808,7 @@ const planeTrimesh_relpos = new Vec3(); const planeTrimesh_projected = new Vec3(); const sphereTrimesh_normal = new Vec3(); const sphereTrimesh_relpos = new Vec3(); +new Vec3(); const sphereTrimesh_v = new Vec3(); const sphereTrimesh_v2 = new Vec3(); const sphereTrimesh_edgeVertexA = new Vec3(); @@ -11974,6 +11882,8 @@ const sphereConvex_worldPoint = new Vec3(); const sphereConvex_worldSpherePointClosestToPlane = new Vec3(); const sphereConvex_penetrationVec = new Vec3(); const sphereConvex_sphereToWorldPoint = new Vec3(); +new Vec3(); +new Vec3(); const planeConvex_v = new Vec3(); const planeConvex_normal = new Vec3(); const planeConvex_relpos = new Vec3(); @@ -11987,6 +11897,7 @@ const particleSphere_normal = new Vec3(); // WIP const cqj = new Quaternion(); const convexParticle_local = new Vec3(); +new Vec3(); const convexParticle_penetratedFaceNormal = new Vec3(); const convexParticle_vertexToParticle = new Vec3(); const convexParticle_worldPenetrationVec = new Vec3(); @@ -12001,8 +11912,6 @@ class OverlapKeeper { * @todo Remove useless constructor */ constructor() { - this.current = void 0; - this.previous = void 0; this.current = []; this.previous = []; } @@ -12107,9 +12016,12 @@ function unpackAndPush(array, key) { array.push((key & 0xffff0000) >> 16, key & 0x0000ffff); } +const getKey = (i, j) => i < j ? `${i}-${j}` : `${j}-${i}`; /** * TupleDictionary */ + + class TupleDictionary { constructor() { this.data = { @@ -12119,26 +12031,14 @@ class TupleDictionary { /** get */ get(i, j) { - if (i > j) { - // swap - const temp = j; - j = i; - i = temp; - } - - return this.data[i + "-" + j]; + const key = getKey(i, j); + return this.data[key]; } /** set */ set(i, j, value) { - if (i > j) { - const temp = j; - j = i; - i = temp; - } - - const key = i + "-" + j; // Check if key already exists + const key = getKey(i, j); // Check if key already exists if (!this.get(i, j)) { this.data.keys.push(key); @@ -12146,6 +12046,19 @@ class TupleDictionary { this.data[key] = value; } + /** delete */ + + + delete(i, j) { + const key = getKey(i, j); + const index = this.data.keys.indexOf(key); + + if (index !== -1) { + this.data.keys.splice(index, 1); + } + + delete this.data[key]; + } /** reset */ @@ -12205,6 +12118,12 @@ class World extends EventTarget { * The gravity of the world. */ + /** + * Gravity to use when approximating the friction max force (mu*mass*gravity). + * If undefined, global gravity will be used. + * Use to enable friction in a World with a null gravity vector (no gravity). + */ + /** * The broadphase algorithm to use. * @default NaiveBroadphase @@ -12231,12 +12150,6 @@ class World extends EventTarget { * CollisionMatrix from the previous step. */ - /** - * All added materials. - * @deprecated - * @todo Remove - */ - /** * All added contactmaterials. */ @@ -12265,41 +12178,12 @@ class World extends EventTarget { /** * Dispatched after a body has been removed from the world. */ - constructor(options = {}) { + constructor(options) { + if (options === void 0) { + options = {}; + } + super(); - this.dt = void 0; - this.allowSleep = void 0; - this.contacts = void 0; - this.frictionEquations = void 0; - this.quatNormalizeSkip = void 0; - this.quatNormalizeFast = void 0; - this.time = void 0; - this.stepnumber = void 0; - this.default_dt = void 0; - this.nextId = void 0; - this.gravity = void 0; - this.broadphase = void 0; - this.bodies = void 0; - this.hasActiveBodies = void 0; - this.solver = void 0; - this.constraints = void 0; - this.narrowphase = void 0; - this.collisionMatrix = void 0; - this.collisionMatrixPrevious = void 0; - this.bodyOverlapKeeper = void 0; - this.shapeOverlapKeeper = void 0; - this.materials = void 0; - this.contactmaterials = void 0; - this.contactMaterialTable = void 0; - this.defaultMaterial = void 0; - this.defaultContactMaterial = void 0; - this.doProfiling = void 0; - this.profile = void 0; - this.accumulator = void 0; - this.subsystems = void 0; - this.addBodyEvent = void 0; - this.removeBodyEvent = void 0; - this.idToBodyMap = void 0; this.dt = -1; this.allowSleep = !!options.allowSleep; this.contacts = []; @@ -12316,6 +12200,11 @@ class World extends EventTarget { this.gravity.copy(options.gravity); } + if (options.frictionGravity) { + this.frictionGravity = new Vec3(); + this.frictionGravity.copy(options.frictionGravity); + } + this.broadphase = options.broadphase !== undefined ? options.broadphase : new NaiveBroadphase(); this.bodies = []; this.hasActiveBodies = false; @@ -12326,7 +12215,6 @@ class World extends EventTarget { this.collisionMatrixPrevious = new ArrayCollisionMatrix(); this.bodyOverlapKeeper = new OverlapKeeper(); this.shapeOverlapKeeper = new OverlapKeeper(); - this.materials = []; this.contactmaterials = []; this.contactMaterialTable = new TupleDictionary(); this.defaultMaterial = new Material('default'); @@ -12364,15 +12252,6 @@ class World extends EventTarget { getContactMaterial(m1, m2) { return this.contactMaterialTable.get(m1.id, m2.id); } - /** - * Get number of objects in the world. - * @deprecated - */ - - - numObjects() { - return this.bodies.length; - } /** * Store old collision state info */ @@ -12431,7 +12310,11 @@ class World extends EventTarget { */ - raycastAll(from, to, options = {}, callback) { + raycastAll(from, to, options, callback) { + if (options === void 0) { + options = {}; + } + options.mode = Ray.ALL; options.from = from; options.to = to; @@ -12444,7 +12327,11 @@ class World extends EventTarget { */ - raycastAny(from, to, options = {}, result) { + raycastAny(from, to, options, result) { + if (options === void 0) { + options = {}; + } + options.mode = Ray.ANY; options.from = from; options.to = to; @@ -12457,7 +12344,11 @@ class World extends EventTarget { */ - raycastClosest(from, to, options = {}, result) { + raycastClosest(from, to, options, result) { + if (options === void 0) { + options = {}; + } + options.mode = Ray.CLOSEST; options.from = from; options.to = to; @@ -12544,16 +12435,6 @@ class World extends EventTarget { return null; } - /** - * Adds a material to the World. - * @deprecated - * @todo Remove - */ - - - addMaterial(m) { - this.materials.push(m); - } /** * Adds a contact material to the World */ @@ -12565,6 +12446,54 @@ class World extends EventTarget { this.contactMaterialTable.set(cmat.materials[0].id, cmat.materials[1].id, cmat); } + /** + * Removes a contact material from the World. + */ + + + removeContactMaterial(cmat) { + const idx = this.contactmaterials.indexOf(cmat); + + if (idx === -1) { + return; + } + + this.contactmaterials.splice(idx, 1); + this.contactMaterialTable.delete(cmat.materials[0].id, cmat.materials[1].id); + } + /** + * Step the simulation forward keeping track of last called time + * to be able to step the world at a fixed rate, independently of framerate. + * + * @param dt The fixed time step size to use (default: 1 / 60). + * @param maxSubSteps Maximum number of fixed steps to take per function call (default: 10). + * @see https://gafferongames.com/post/fix_your_timestep/ + * @example + * // Run the simulation independently of framerate every 1 / 60 ms + * world.fixedStep() + */ + + + fixedStep(dt, maxSubSteps) { + if (dt === void 0) { + dt = 1 / 60; + } + + if (maxSubSteps === void 0) { + maxSubSteps = 10; + } + + const time = performance.now() / 1000; // seconds + + if (!this.lastCallTime) { + this.step(dt, undefined, maxSubSteps); + } else { + const timeSinceLastCalled = time - this.lastCallTime; + this.step(dt, timeSinceLastCalled, maxSubSteps); + } + + this.lastCallTime = time; + } /** * Step the physics world forward in time. * @@ -12572,7 +12501,7 @@ class World extends EventTarget { * * @param dt The fixed time step size to use. * @param timeSinceLastCalled The time elapsed since the function was last called. - * @param maxSubSteps Maximum number of fixed steps to take per function call. + * @param maxSubSteps Maximum number of fixed steps to take per function call (default: 10). * @see https://web.archive.org/web/20180426154531/http://bulletphysics.org/mediawiki-1.5.8/index.php/Stepping_The_World#What_do_the_parameters_to_btDynamicsWorld::stepSimulation_mean.3F * @example * // fixed timestepping without interpolation @@ -12580,7 +12509,11 @@ class World extends EventTarget { */ - step(dt, timeSinceLastCalled, maxSubSteps = 10) { + step(dt, timeSinceLastCalled, maxSubSteps) { + if (maxSubSteps === void 0) { + maxSubSteps = 10; + } + if (timeSinceLastCalled === undefined) { // Fixed, simple stepping this.internalStep(dt); // Increment time @@ -12626,7 +12559,7 @@ class World extends EventTarget { const contacts = this.contacts; const p1 = World_step_p1; const p2 = World_step_p2; - const N = this.numObjects(); + const N = this.bodies.length; const bodies = this.bodies; const solver = this.solver; const gravity = this.gravity; @@ -12898,19 +12831,10 @@ class World extends EventTarget { } } - this.dispatchEvent(World_step_preStepEvent); // Invoke pre-step callbacks - - for (i = 0; i !== N; i++) { - const bi = bodies[i]; - - if (bi.preStep) { - bi.preStep.call(bi); - } - } // Leap frog + this.dispatchEvent(World_step_preStepEvent); // Leap frog // vnew = v + h*f/m // xnew = x + h*vnew - if (doProfiling) { profilingStart = performance.now(); } @@ -12932,17 +12856,7 @@ class World extends EventTarget { this.stepnumber += 1; - this.dispatchEvent(World_step_postStepEvent); // Invoke post-step callbacks - - for (i = 0; i !== N; i++) { - const bi = bodies[i]; - const postStep = bi.postStep; - - if (postStep) { - postStep.call(bi); - } - } // Sleeping update - + this.dispatchEvent(World_step_postStepEvent); // Sleeping update let hasActiveBodies = true; @@ -13049,7 +12963,7 @@ class World extends EventTarget { new AABB(); const tmpRay = new Ray(); // performance.now() fallback on Date.now() -const performance = require('perf_hooks').performance || {}; +const performance = require('perf_hooks') && require('perf_hooks').performance || {}; if (!performance.now) { let nowOffset = Date.now(); @@ -13060,6 +12974,8 @@ if (!performance.now) { performance.now = () => Date.now() - nowOffset; } + +new Vec3(); // Dispatched after the world has stepped forward in time. // Reusable event objects to save memory. const World_step_postStepEvent = { diff --git a/node_modules/cannon-es/dist/cannon-es.d.ts b/node_modules/cannon-es/dist/cannon-es.d.ts index c41c574..840b16d 100644 --- a/node_modules/cannon-es/dist/cannon-es.d.ts +++ b/node_modules/cannon-es/dist/cannon-es.d.ts @@ -744,6 +744,7 @@ declare module "utils/TupleDictionary" { }; get(i: number, j: number): any; set(i: number, j: number, value: any): void; + delete(i: number, j: number): void; reset(): void; } } @@ -798,6 +799,7 @@ declare module "world/World" { default_dt: number; nextId: number; gravity: Vec3; + frictionGravity?: Vec3; broadphase: Broadphase; bodies: Body[]; hasActiveBodies: boolean; @@ -808,7 +810,6 @@ declare module "world/World" { collisionMatrixPrevious: ArrayCollisionMatrix; bodyOverlapKeeper: OverlapKeeper; shapeOverlapKeeper: OverlapKeeper; - materials: Material[]; contactmaterials: ContactMaterial[]; contactMaterialTable: TupleDictionary; defaultMaterial: Material; @@ -834,8 +835,10 @@ declare module "world/World" { idToBodyMap: { [id: number]: Body; }; + lastCallTime?: number; constructor(options?: { gravity?: Vec3; + frictionGravity?: Vec3; allowSleep?: boolean; broadphase?: Broadphase; solver?: Solver; @@ -843,7 +846,6 @@ declare module "world/World" { quatNormalizeSkip?: number; }); getContactMaterial(m1: Material, m2: Material): ContactMaterial; - numObjects(): number; collisionMatrixTick(): void; addConstraint(c: Constraint): void; removeConstraint(c: Constraint): void; @@ -855,8 +857,9 @@ declare module "world/World" { removeBody(body: Body): void; getBodyById(id: number): Body; getShapeById(id: number): Shape | null; - addMaterial(m: Material): void; addContactMaterial(cmat: ContactMaterial): void; + removeContactMaterial(cmat: ContactMaterial): void; + fixedStep(dt?: number, maxSubSteps?: number): void; step(dt: number, timeSinceLastCalled?: number, maxSubSteps?: number): void; internalStep(dt: number): void; emitContactEvents(): void; @@ -1013,8 +1016,6 @@ declare module "objects/Body" { id: number; index: number; world: World | null; - preStep: (() => void) | null; - postStep: (() => void) | null; vlambda: Vec3; collisionFilterGroup: number; collisionFilterMask: number; diff --git a/node_modules/cannon-es/dist/cannon-es.js b/node_modules/cannon-es/dist/cannon-es.js index c9435c5..d075cb9 100644 --- a/node_modules/cannon-es/dist/cannon-es.js +++ b/node_modules/cannon-es/dist/cannon-es.js @@ -10,7 +10,6 @@ class ObjectCollisionMatrix { * @todo Remove useless constructor */ constructor() { - this.matrix = void 0; this.matrix = {}; } /** @@ -32,7 +31,7 @@ class ObjectCollisionMatrix { i = temp; } - return i + "-" + j in this.matrix; + return `${i}-${j}` in this.matrix; } /** * set @@ -54,9 +53,9 @@ class ObjectCollisionMatrix { } if (value) { - this.matrix[i + "-" + j] = true; + this.matrix[`${i}-${j}`] = true; } else { - delete this.matrix[i + "-" + j]; + delete this.matrix[`${i}-${j}`]; } } /** @@ -88,8 +87,11 @@ class Mat3 { /** * @param elements A vector of length 9, containing all matrix elements. */ - constructor(elements = [0, 0, 0, 0, 0, 0, 0, 0, 0]) { - this.elements = void 0; + constructor(elements) { + if (elements === void 0) { + elements = [0, 0, 0, 0, 0, 0, 0, 0, 0]; + } + this.elements = elements; } /** @@ -144,7 +146,11 @@ class Mat3 { */ - getTrace(target = new Vec3()) { + getTrace(target) { + if (target === void 0) { + target = new Vec3(); + } + const e = this.elements; target.x = e[0]; target.y = e[4]; @@ -158,7 +164,11 @@ class Mat3 { */ - vmult(v, target = new Vec3()) { + vmult(v, target) { + if (target === void 0) { + target = new Vec3(); + } + const e = this.elements; const x = v.x; const y = v.y; @@ -184,7 +194,11 @@ class Mat3 { */ - mmult(matrix, target = new Mat3()) { + mmult(matrix, target) { + if (target === void 0) { + target = new Mat3(); + } + const A = this.elements; const B = matrix.elements; const T = target.elements; @@ -222,7 +236,11 @@ class Mat3 { */ - scale(vector, target = new Mat3()) { + scale(vector, target) { + if (target === void 0) { + target = new Mat3(); + } + const e = this.elements; const t = target.elements; @@ -243,7 +261,11 @@ class Mat3 { */ - solve(b, target = new Vec3()) { + solve(b, target) { + if (target === void 0) { + target = new Vec3(); + } + // Construct equations const nr = 3; // num rows @@ -314,7 +336,7 @@ class Mat3 { target.x = (eqns[0 * nc + 3] - eqns[0 * nc + 2] * target.z - eqns[0 * nc + 1] * target.y) / eqns[0 * nc + 0]; if (isNaN(target.x) || isNaN(target.y) || isNaN(target.z) || target.x === Infinity || target.y === Infinity || target.z === Infinity) { - throw "Could not solve equation! Got x=[" + target.toString() + "], b=[" + b.toString() + "], A=[" + this.toString() + "]"; + throw `Could not solve equation! Got x=[${target.toString()}], b=[${b.toString()}], A=[${this.toString()}]`; } return target; @@ -367,7 +389,11 @@ class Mat3 { */ - reverse(target = new Mat3()) { + reverse(target) { + if (target === void 0) { + target = new Mat3(); + } + // Construct equations const nr = 3; // num rows @@ -473,7 +499,7 @@ class Mat3 { p = eqns[nr + j + nc * i]; if (isNaN(p) || p === Infinity) { - throw "Could not reverse! A=[" + this.toString() + "]"; + throw `Could not reverse! A=[${this.toString()}]`; } target.e(i, j, p); @@ -523,7 +549,11 @@ class Mat3 { */ - transpose(target = new Mat3()) { + transpose(target) { + if (target === void 0) { + target = new Mat3(); + } + const M = this.elements; const T = target.elements; let tmp; //Set diagonals @@ -554,10 +584,19 @@ const reverse_eqns = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; */ class Vec3 { - constructor(x = 0.0, y = 0.0, z = 0.0) { - this.x = void 0; - this.y = void 0; - this.z = void 0; + constructor(x, y, z) { + if (x === void 0) { + x = 0.0; + } + + if (y === void 0) { + y = 0.0; + } + + if (z === void 0) { + z = 0.0; + } + this.x = x; this.y = y; this.z = z; @@ -568,7 +607,11 @@ class Vec3 { */ - cross(vector, target = new Vec3()) { + cross(vector, target) { + if (target === void 0) { + target = new Vec3(); + } + const vx = vector.x; const vy = vector.y; const vz = vector.z; @@ -671,7 +714,11 @@ class Vec3 { */ - unit(target = new Vec3()) { + unit(target) { + if (target === void 0) { + target = new Vec3(); + } + const x = this.x; const y = this.y; const z = this.z; @@ -743,7 +790,11 @@ class Vec3 { */ - scale(scalar, target = new Vec3()) { + scale(scalar, target) { + if (target === void 0) { + target = new Vec3(); + } + const x = this.x; const y = this.y; const z = this.z; @@ -758,7 +809,11 @@ class Vec3 { */ - vmul(vector, target = new Vec3()) { + vmul(vector, target) { + if (target === void 0) { + target = new Vec3(); + } + target.x = vector.x * this.x; target.y = vector.y * this.y; target.z = vector.z * this.z; @@ -770,7 +825,11 @@ class Vec3 { */ - addScaledVector(scalar, vector, target = new Vec3()) { + addScaledVector(scalar, vector, target) { + if (target === void 0) { + target = new Vec3(); + } + target.x = this.x + scalar * vector.x; target.y = this.y + scalar * vector.y; target.z = this.z + scalar * vector.z; @@ -795,7 +854,11 @@ class Vec3 { */ - negate(target = new Vec3()) { + negate(target) { + if (target === void 0) { + target = new Vec3(); + } + target.x = -this.x; target.y = -this.y; target.z = -this.z; @@ -838,7 +901,7 @@ class Vec3 { toString() { - return this.x + "," + this.y + "," + this.z; + return `${this.x},${this.y},${this.z}`; } /** * Converts to an array @@ -878,7 +941,11 @@ class Vec3 { */ - almostEquals(vector, precision = 1e-6) { + almostEquals(vector, precision) { + if (precision === void 0) { + precision = 1e-6; + } + if (Math.abs(this.x - vector.x) > precision || Math.abs(this.y - vector.y) > precision || Math.abs(this.z - vector.z) > precision) { return false; } @@ -890,7 +957,11 @@ class Vec3 { */ - almostZero(precision = 1e-6) { + almostZero(precision) { + if (precision === void 0) { + precision = 1e-6; + } + if (Math.abs(this.x) > precision || Math.abs(this.y) > precision || Math.abs(this.z) > precision) { return false; } @@ -917,10 +988,6 @@ class Vec3 { } } -Vec3.ZERO = void 0; -Vec3.UNIT_X = void 0; -Vec3.UNIT_Y = void 0; -Vec3.UNIT_Z = void 0; Vec3.ZERO = new Vec3(0, 0, 0); Vec3.UNIT_X = new Vec3(1, 0, 0); Vec3.UNIT_Y = new Vec3(0, 1, 0); @@ -940,9 +1007,11 @@ class AABB { /** * The upper bound of the bounding box */ - constructor(options = {}) { - this.lowerBound = void 0; - this.upperBound = void 0; + constructor(options) { + if (options === void 0) { + options = {}; + } + this.lowerBound = new Vec3(); this.upperBound = new Vec3(); @@ -1218,7 +1287,6 @@ class ArrayCollisionMatrix { * The matrix storage. */ constructor() { - this.matrix = void 0; this.matrix = []; } /** @@ -1288,10 +1356,6 @@ class ArrayCollisionMatrix { * Base class for objects that dispatches events. */ class EventTarget { - constructor() { - this._listeners = void 0; - } - /** * Add an event listener * @return The self object, for chainability. @@ -1406,11 +1470,23 @@ class EventTarget { */ class Quaternion { - constructor(x = 0, y = 0, z = 0, w = 1) { - this.x = void 0; - this.y = void 0; - this.z = void 0; - this.w = void 0; + constructor(x, y, z, w) { + if (x === void 0) { + x = 0; + } + + if (y === void 0) { + y = 0; + } + + if (z === void 0) { + z = 0; + } + + if (w === void 0) { + w = 1; + } + this.x = x; this.y = y; this.z = z; @@ -1435,7 +1511,7 @@ class Quaternion { toString() { - return this.x + "," + this.y + "," + this.z + "," + this.w; + return `${this.x},${this.y},${this.z},${this.w}`; } /** * Convert to an Array @@ -1466,7 +1542,11 @@ class Quaternion { */ - toAxisAngle(targetAxis = new Vec3()) { + toAxisAngle(targetAxis) { + if (targetAxis === void 0) { + targetAxis = new Vec3(); + } + this.normalize(); // if w>1 acos and sqrt will produce errors, this cant happen if quaternion is normalised const angle = 2 * Math.acos(this.w); @@ -1515,7 +1595,11 @@ class Quaternion { */ - mult(quat, target = new Quaternion()) { + mult(quat, target) { + if (target === void 0) { + target = new Quaternion(); + } + const ax = this.x; const ay = this.y; const az = this.z; @@ -1535,7 +1619,11 @@ class Quaternion { */ - inverse(target = new Quaternion()) { + inverse(target) { + if (target === void 0) { + target = new Quaternion(); + } + const x = this.x; const y = this.y; const z = this.z; @@ -1553,7 +1641,11 @@ class Quaternion { */ - conjugate(target = new Quaternion()) { + conjugate(target) { + if (target === void 0) { + target = new Quaternion(); + } + target.x = -this.x; target.y = -this.y; target.z = -this.z; @@ -1611,7 +1703,11 @@ class Quaternion { */ - vmult(v, target = new Vec3()) { + vmult(v, target) { + if (target === void 0) { + target = new Vec3(); + } + const x = v.x; const y = v.y; const z = v.z; @@ -1648,7 +1744,11 @@ class Quaternion { */ - toEuler(target, order = 'YZX') { + toEuler(target, order) { + if (order === void 0) { + order = 'YZX'; + } + let heading; let attitude; let bank; @@ -1689,7 +1789,7 @@ class Quaternion { break; default: - throw new Error("Euler order " + order + " not supported yet."); + throw new Error(`Euler order ${order} not supported yet.`); } target.y = heading; @@ -1697,13 +1797,19 @@ class Quaternion { target.x = bank; } /** + * Set the quaternion components given Euler angle representation. + * * @param order The order to apply angles: 'XYZ' or 'YXZ' or any other combination. * * See {@link https://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors MathWorks} reference */ - setFromEuler(x, y, z, order = 'XYZ') { + setFromEuler(x, y, z, order) { + if (order === void 0) { + order = 'XYZ'; + } + const c1 = Math.cos(x / 2); const c2 = Math.cos(y / 2); const c3 = Math.cos(z / 2); @@ -1759,7 +1865,11 @@ class Quaternion { */ - slerp(toQuat, t, target = new Quaternion()) { + slerp(toQuat, t, target) { + if (target === void 0) { + target = new Quaternion(); + } + const ax = this.x; const ay = this.y; const az = this.z; @@ -1810,7 +1920,11 @@ class Quaternion { */ - integrate(angularVelocity, dt, angularFactor, target = new Quaternion()) { + integrate(angularVelocity, dt, angularFactor, target) { + if (target === void 0) { + target = new Quaternion(); + } + const ax = angularVelocity.x * angularFactor.x, ay = angularVelocity.y * angularFactor.y, az = angularVelocity.z * angularFactor.z, @@ -1905,15 +2019,11 @@ class Shape { /** * All the Shape types. */ - constructor(options = {}) { - this.id = void 0; - this.type = void 0; - this.boundingSphereRadius = void 0; - this.collisionResponse = void 0; - this.collisionFilterGroup = void 0; - this.collisionFilterMask = void 0; - this.material = void 0; - this.body = void 0; + constructor(options) { + if (options === void 0) { + options = {}; + } + this.id = Shape.idCounter++; this.type = options.type || 0; this.boundingSphereRadius = 0; @@ -1930,7 +2040,7 @@ class Shape { updateBoundingSphereRadius() { - throw "computeBoundingSphereRadius() not implemented for shape type " + this.type; + throw `computeBoundingSphereRadius() not implemented for shape type ${this.type}`; } /** * Get the volume of this shape @@ -1938,7 +2048,7 @@ class Shape { volume() { - throw "volume() not implemented for shape type " + this.type; + throw `volume() not implemented for shape type ${this.type}`; } /** * Calculates the inertia in the local frame for this shape. @@ -1947,7 +2057,7 @@ class Shape { calculateLocalInertia(mass, target) { - throw "calculateLocalInertia() not implemented for shape type " + this.type; + throw `calculateLocalInertia() not implemented for shape type ${this.type}`; } /** * @todo use abstract for these kind of methods @@ -1955,7 +2065,7 @@ class Shape { calculateWorldAABB(pos, quat, min, max) { - throw "calculateWorldAABB() not implemented for shape type " + this.type; + throw `calculateWorldAABB() not implemented for shape type ${this.type}`; } } @@ -1973,9 +2083,11 @@ class Transform { /** * quaternion */ - constructor(options = {}) { - this.position = void 0; - this.quaternion = void 0; + constructor(options) { + if (options === void 0) { + options = {}; + } + this.position = new Vec3(); this.quaternion = new Quaternion(); @@ -2008,7 +2120,11 @@ class Transform { */ - vectorToWorldFrame(localVector, result = new Vec3()) { + vectorToWorldFrame(localVector, result) { + if (result === void 0) { + result = new Vec3(); + } + this.quaternion.vmult(localVector, result); return result; } @@ -2017,7 +2133,11 @@ class Transform { */ - static pointToLocalFrame(position, quaternion, worldPoint, result = new Vec3()) { + static pointToLocalFrame(position, quaternion, worldPoint, result) { + if (result === void 0) { + result = new Vec3(); + } + worldPoint.vsub(position, result); quaternion.conjugate(tmpQuat$1); tmpQuat$1.vmult(result, result); @@ -2028,7 +2148,11 @@ class Transform { */ - static pointToWorldFrame(position, quaternion, localPoint, result = new Vec3()) { + static pointToWorldFrame(position, quaternion, localPoint, result) { + if (result === void 0) { + result = new Vec3(); + } + quaternion.vmult(localPoint, result); result.vadd(position, result); return result; @@ -2038,7 +2162,11 @@ class Transform { */ - static vectorToWorldFrame(quaternion, localVector, result = new Vec3()) { + static vectorToWorldFrame(quaternion, localVector, result) { + if (result === void 0) { + result = new Vec3(); + } + quaternion.vmult(localVector, result); return result; } @@ -2047,7 +2175,11 @@ class Transform { */ - static vectorToLocalFrame(position, quaternion, worldVector, result = new Vec3()) { + static vectorToLocalFrame(position, quaternion, worldVector, result) { + if (result === void 0) { + result = new Vec3(); + } + quaternion.w *= -1; quaternion.vmult(worldVector, result); quaternion.w *= -1; @@ -2101,7 +2233,11 @@ class ConvexPolyhedron extends Shape { * @param vertices An array of Vec3's * @param faces Array of integer arrays, describing which vertices that is included in each face. */ - constructor(props = {}) { + constructor(props) { + if (props === void 0) { + props = {}; + } + const { vertices = [], faces = [], @@ -2112,15 +2248,6 @@ class ConvexPolyhedron extends Shape { super({ type: Shape.types.CONVEXPOLYHEDRON }); - this.vertices = void 0; - this.faces = void 0; - this.faceNormals = void 0; - this.worldVertices = void 0; - this.worldVerticesNeedsUpdate = void 0; - this.worldFaceNormals = void 0; - this.worldFaceNormalsNeedsUpdate = void 0; - this.uniqueAxes = void 0; - this.uniqueEdges = void 0; this.vertices = vertices; this.faces = faces; this.faceNormals = normals; @@ -2193,7 +2320,7 @@ class ConvexPolyhedron extends Shape { // Check so all vertices exists for this face for (let j = 0; j < this.faces[i].length; j++) { if (!this.vertices[this.faces[i][j]]) { - throw new Error("Vertex " + this.faces[i][j] + " not found!"); + throw new Error(`Vertex ${this.faces[i][j]} not found!`); } } @@ -2204,10 +2331,10 @@ class ConvexPolyhedron extends Shape { const vertex = this.vertices[this.faces[i][0]]; if (n.dot(vertex) < 0) { - console.error(".faceNormals[" + i + "] = Vec3(" + n.toString() + ") looks like it points into the shape? The vertices follow. Make sure they are ordered CCW around the normal, using the right hand rule."); + console.error(`.faceNormals[${i}] = Vec3(${n.toString()}) looks like it points into the shape? The vertices follow. Make sure they are ordered CCW around the normal, using the right hand rule.`); for (let j = 0; j < this.faces[i].length; j++) { - console.warn(".vertices[" + this.faces[i][j] + "] = Vec3(" + this.vertices[this.faces[i][j]].toString() + ")"); + console.warn(`.vertices[${this.faces[i][j]}] = Vec3(${this.vertices[this.faces[i][j]].toString()})`); } } } @@ -2560,7 +2687,7 @@ class ConvexPolyhedron extends Shape { let depth = planeNormalWS.dot(pVtxIn[i]) + planeEqWS; // ??? if (depth <= minDist) { - console.log("clamped: depth=" + depth + " to minDist=" + minDist); + console.log(`clamped: depth=${depth} to minDist=${minDist}`); depth = minDist; } @@ -2780,7 +2907,11 @@ class ConvexPolyhedron extends Shape { */ - getAveragePointLocal(target = new Vec3()) { + getAveragePointLocal(target) { + if (target === void 0) { + target = new Vec3(); + } + const verts = this.vertices; for (let i = 0; i < verts.length; i++) { @@ -2840,6 +2971,7 @@ class ConvexPolyhedron extends Shape { const verts = this.vertices; const faces = this.faces; const normals = this.faceNormals; + const positiveResult = null; const pointInside = new Vec3(); this.getAveragePointLocal(pointInside); @@ -2861,7 +2993,7 @@ class ConvexPolyhedron extends Shape { } // If we got here, all dot products were of the same sign. - return -1; + return positiveResult ? 1 : -1; } /** * Get max and min dot product of a convex hull at position (pos,quat) projected onto an axis. @@ -2872,6 +3004,7 @@ class ConvexPolyhedron extends Shape { static project(shape, axis, pos, quat, result) { const n = shape.vertices.length; + project_worldVertex; const localAxis = project_localAxis; let max = 0; let min = 0; @@ -2914,6 +3047,7 @@ class ConvexPolyhedron extends Shape { } const maxminA = []; const maxminB = []; +const project_worldVertex = new Vec3(); const project_localAxis = new Vec3(); const project_localOrigin = new Vec3(); @@ -2938,8 +3072,6 @@ class Box extends Shape { super({ type: Shape.types.BOX }); - this.halfExtents = void 0; - this.convexPolyhedronRepresentation = void 0; this.halfExtents = halfExtents; this.convexPolyhedronRepresentation = null; this.updateConvexPolyhedronRepresentation(); @@ -2977,7 +3109,11 @@ class Box extends Shape { */ - calculateLocalInertia(mass, target = new Vec3()) { + calculateLocalInertia(mass, target) { + if (target === void 0) { + target = new Vec3(); + } + Box.calculateInertia(this.halfExtents, mass, target); return target; } @@ -3218,238 +3354,15 @@ class Body extends EventTarget { * Dispatched after a body has fallen asleep. * @event sleep */ + constructor(options) { + if (options === void 0) { + options = {}; + } - /** - * Identifier of the body. - */ - - /** - * Position of body in World.bodies. Updated by World and used in ArrayCollisionMatrix. - */ - - /** - * Reference to the world the body is living in. - */ - - /** - * Callback function that is used BEFORE stepping the system. Use it to apply forces, for example. Inside the function, "this" will refer to this Body object. Deprecated - use World events instead. - * @deprecated Use World events instead - */ - - /** - * Callback function that is used AFTER stepping the system. Inside the function, "this" will refer to this Body object. Deprecated - use World events instead. - * @deprecated Use World events instead - */ - - /** - * The collision group the body belongs to. - * @default 1 - */ - - /** - * The collision group the body can collide with. - * @default -1 - */ - - /** - * Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled - i.e. "collide" events will be raised, but forces will not be altered. - */ - - /** - * World space position of the body. - */ - - /** - * Interpolated position of the body. - */ - - /** - * Initial position of the body. - */ - - /** - * World space velocity of the body. - */ - - /** - * Initial velocity of the body. - */ - - /** - * Linear force on the body in world space. - */ - - /** - * The mass of the body. - * @default 0 - */ - - /** - * The physics material of the body. It defines the body interaction with other bodies. - */ - - /** - * How much to damp the body velocity each step. It can go from 0 to 1. - * @default 0.01 - */ - - /** - * One of: `Body.DYNAMIC`, `Body.STATIC` and `Body.KINEMATIC`. - */ - - /** - * If true, the body will automatically fall to sleep. - * @default true - */ - - /** - * Current sleep state. - */ - - /** - * If the speed (the norm of the velocity) is smaller than this value, the body is considered sleepy. - * @default 0.1 - */ - - /** - * If the body has been sleepy for this sleepTimeLimit seconds, it is considered sleeping. - * @default 1 - */ - - /** - * World space rotational force on the body, around center of mass. - */ - - /** - * World space orientation of the body. - */ - - /** - * Initial quaternion of the body. - */ - - /** - * Interpolated orientation of the body. - */ - - /** - * Angular velocity of the body, in world space. Think of the angular velocity as a vector, which the body rotates around. The length of this vector determines how fast (in radians per second) the body rotates. - */ - - /** - * Initial angular velocity of the body. - */ - - /** - * List of Shapes that have been added to the body. - */ - - /** - * Position of each Shape in the body, given in local Body space. - */ - - /** - * Orientation of each Shape, given in local Body space. - */ - - /** - * The inertia of the body. - */ - - /** - * Set to true if you don't want the body to rotate. Make sure to run .updateMassProperties() if you change this after the body creation. - * @default false - */ - - /** - * How much to damp the body angular velocity each step. It can go from 0 to 1. - * @default 0.01 - */ - - /** - * Use this property to limit the motion along any world axis. (1,1,1) will allow motion along all axes while (0,0,0) allows none. - */ - - /** - * Use this property to limit the rotational motion along any world axis. (1,1,1) will allow rotation along all axes while (0,0,0) allows none. - */ - - /** - * World space bounding box of the body and its shapes. - */ - - /** - * Indicates if the AABB needs to be updated before use. - */ - - /** - * Total bounding radius of the Body including its shapes, relative to body.position. - */ - - /** - * When true the body behaves like a trigger. It does not collide - * with other bodies but collision events are still triggered. - * @default false - */ - constructor(options = {}) { super(); - this.id = void 0; - this.index = void 0; - this.world = void 0; - this.preStep = void 0; - this.postStep = void 0; - this.vlambda = void 0; - this.collisionFilterGroup = void 0; - this.collisionFilterMask = void 0; - this.collisionResponse = void 0; - this.position = void 0; - this.previousPosition = void 0; - this.interpolatedPosition = void 0; - this.initPosition = void 0; - this.velocity = void 0; - this.initVelocity = void 0; - this.force = void 0; - this.mass = void 0; - this.invMass = void 0; - this.material = void 0; - this.linearDamping = void 0; - this.type = void 0; - this.allowSleep = void 0; - this.sleepState = void 0; - this.sleepSpeedLimit = void 0; - this.sleepTimeLimit = void 0; - this.timeLastSleepy = void 0; - this.wakeUpAfterNarrowphase = void 0; - this.torque = void 0; - this.quaternion = void 0; - this.initQuaternion = void 0; - this.previousQuaternion = void 0; - this.interpolatedQuaternion = void 0; - this.angularVelocity = void 0; - this.initAngularVelocity = void 0; - this.shapes = void 0; - this.shapeOffsets = void 0; - this.shapeOrientations = void 0; - this.inertia = void 0; - this.invInertia = void 0; - this.invInertiaWorld = void 0; - this.invMassSolve = void 0; - this.invInertiaSolve = void 0; - this.invInertiaWorldSolve = void 0; - this.fixedRotation = void 0; - this.angularDamping = void 0; - this.linearFactor = void 0; - this.angularFactor = void 0; - this.aabb = void 0; - this.aabbNeedsUpdate = void 0; - this.boundingRadius = void 0; - this.wlambda = void 0; - this.isTrigger = void 0; this.id = Body.idCounter++; this.index = -1; this.world = null; - this.preStep = null; - this.postStep = null; this.vlambda = new Vec3(); this.collisionFilterGroup = typeof options.collisionFilterGroup === 'number' ? options.collisionFilterGroup : 1; this.collisionFilterMask = typeof options.collisionFilterMask === 'number' ? options.collisionFilterMask : -1; @@ -3618,7 +3531,11 @@ class Body extends EventTarget { */ - pointToLocalFrame(worldPoint, result = new Vec3()) { + pointToLocalFrame(worldPoint, result) { + if (result === void 0) { + result = new Vec3(); + } + worldPoint.vsub(this.position, result); this.quaternion.conjugate().vmult(result, result); return result; @@ -3628,7 +3545,11 @@ class Body extends EventTarget { */ - vectorToLocalFrame(worldVector, result = new Vec3()) { + vectorToLocalFrame(worldVector, result) { + if (result === void 0) { + result = new Vec3(); + } + this.quaternion.conjugate().vmult(worldVector, result); return result; } @@ -3637,7 +3558,11 @@ class Body extends EventTarget { */ - pointToWorldFrame(localPoint, result = new Vec3()) { + pointToWorldFrame(localPoint, result) { + if (result === void 0) { + result = new Vec3(); + } + this.quaternion.vmult(localPoint, result); result.vadd(this.position, result); return result; @@ -3647,7 +3572,11 @@ class Body extends EventTarget { */ - vectorToWorldFrame(localVector, result = new Vec3()) { + vectorToWorldFrame(localVector, result) { + if (result === void 0) { + result = new Vec3(); + } + this.quaternion.vmult(localVector, result); return result; } @@ -3771,6 +3700,7 @@ class Body extends EventTarget { if (I.x === I.y && I.y === I.z && !force) ; else { const m1 = uiw_m1; const m2 = uiw_m2; + uiw_m3; m1.setRotationFromQuaternion(this.quaternion); m1.transpose(m2); m1.scale(I, m1); @@ -3785,7 +3715,11 @@ class Body extends EventTarget { */ - applyForce(force, relativePoint = new Vec3()) { + applyForce(force, relativePoint) { + if (relativePoint === void 0) { + relativePoint = new Vec3(); + } + // Needed? if (this.type !== Body.DYNAMIC) { return; @@ -3810,7 +3744,11 @@ class Body extends EventTarget { */ - applyLocalForce(localForce, localPoint = new Vec3()) { + applyLocalForce(localForce, localPoint) { + if (localPoint === void 0) { + localPoint = new Vec3(); + } + if (this.type !== Body.DYNAMIC) { return; } @@ -3849,7 +3787,11 @@ class Body extends EventTarget { */ - applyImpulse(impulse, relativePoint = new Vec3()) { + applyImpulse(impulse, relativePoint) { + if (relativePoint === void 0) { + relativePoint = new Vec3(); + } + if (this.type !== Body.DYNAMIC) { return; } @@ -3886,7 +3828,11 @@ class Body extends EventTarget { */ - applyLocalImpulse(localImpulse, localPoint = new Vec3()) { + applyLocalImpulse(localImpulse, localPoint) { + if (localPoint === void 0) { + localPoint = new Vec3(); + } + if (this.type !== Body.DYNAMIC) { return; } @@ -4011,6 +3957,7 @@ const tmpQuat = new Quaternion(); const updateAABB_shapeAABB = new AABB(); const uiw_m1 = new Mat3(); const uiw_m2 = new Mat3(); +const uiw_m3 = new Mat3(); const Body_applyForce_rotForce = new Vec3(); const Body_applyLocalForce_worldForce = new Vec3(); const Body_applyLocalForce_relativePointWorld = new Vec3(); @@ -4037,9 +3984,6 @@ class Broadphase { * Set to true if the objects in the world moved. */ constructor() { - this.world = void 0; - this.useBoundingBoxes = void 0; - this.dirty = void 0; this.world = null; this.useBoundingBoxes = false; this.dirty = true; @@ -4146,7 +4090,7 @@ class Broadphase { for (let i = 0; i !== N; i++) { const id1 = p1[i].id; const id2 = p2[i].id; - const key = id1 < id2 ? id1 + "," + id2 : id2 + "," + id1; + const key = id1 < id2 ? `${id1},${id2}` : `${id2},${id1}`; t[key] = i; t.keys.push(key); } @@ -4191,11 +4135,15 @@ class Broadphase { } // Temp objects const Broadphase_collisionPairs_r = new Vec3(); +new Vec3(); +new Quaternion(); +new Vec3(); const Broadphase_makePairsUnique_temp = { keys: [] }; const Broadphase_makePairsUnique_p1 = []; const Broadphase_makePairsUnique_p2 = []; +new Vec3(); /** * Axis aligned uniform grid broadphase. @@ -4235,15 +4183,28 @@ class GridBroadphase extends Broadphase { * @param ny Number of boxes along y. * @param nz Number of boxes along z. */ - constructor(aabbMin = new Vec3(100, 100, 100), aabbMax = new Vec3(-100, -100, -100), nx = 10, ny = 10, nz = 10) { + constructor(aabbMin, aabbMax, nx, ny, nz) { + if (aabbMin === void 0) { + aabbMin = new Vec3(100, 100, 100); + } + + if (aabbMax === void 0) { + aabbMax = new Vec3(-100, -100, -100); + } + + if (nx === void 0) { + nx = 10; + } + + if (ny === void 0) { + ny = 10; + } + + if (nz === void 0) { + nz = 10; + } + super(); - this.nx = void 0; - this.ny = void 0; - this.nz = void 0; - this.aabbMin = void 0; - this.aabbMax = void 0; - this.bins = void 0; - this.binLengths = void 0; this.nx = nx; this.ny = ny; this.nz = nz; @@ -4272,7 +4233,7 @@ class GridBroadphase extends Broadphase { collisionPairs(world, pairs1, pairs2) { - const N = world.numObjects(); + const N = world.bodies.length; const bodies = world.bodies; const max = this.aabbMax; const min = this.aabbMin; @@ -4471,6 +4432,7 @@ class GridBroadphase extends Broadphase { } const GridBroadphase_collisionPairs_d = new Vec3(); +new Vec3(); /** * Naive broadphase implementation, used in lack of better ones. @@ -4514,7 +4476,11 @@ class NaiveBroadphase extends Broadphase { */ - aabbQuery(world, aabb, result = []) { + aabbQuery(world, aabb, result) { + if (result === void 0) { + result = []; + } + for (let i = 0; i < world.bodies.length; i++) { const b = world.bodies[i]; @@ -4577,16 +4543,6 @@ class RaycastResult { * If the ray should stop traversing the bodies */ constructor() { - this.rayFromWorld = void 0; - this.rayToWorld = void 0; - this.hitNormalWorld = void 0; - this.hitPointWorld = void 0; - this.hasHit = void 0; - this.shape = void 0; - this.body = void 0; - this.hitFaceIndex = void 0; - this.distance = void 0; - this.shouldStop = void 0; this.rayFromWorld = new Vec3(); this.rayToWorld = new Vec3(); this.hitNormalWorld = new Vec3(); @@ -4764,19 +4720,15 @@ class Ray { return this._intersectTrimesh; } - constructor(from = new Vec3(), to = new Vec3()) { - this.from = void 0; - this.to = void 0; - this.direction = void 0; - this.precision = void 0; - this.checkCollisionResponse = void 0; - this.skipBackfaces = void 0; - this.collisionFilterMask = void 0; - this.collisionFilterGroup = void 0; - this.mode = void 0; - this.result = void 0; - this.hasHit = void 0; - this.callback = void 0; + constructor(from, to) { + if (from === void 0) { + from = new Vec3(); + } + + if (to === void 0) { + to = new Vec3(); + } + this.from = from.clone(); this.to = to.clone(); this.direction = new Vec3(); @@ -5077,8 +5029,10 @@ class Ray { } _intersectConvex(shape, quat, position, body, reportedShape, options) { + intersectConvex_minDistNormal; const normal = intersectConvex_normal; const vector = intersectConvex_vector; + intersectConvex_minDistIntersect; const faceList = options && options.faceList || null; // Checking faces const faces = shape.faces; @@ -5309,6 +5263,8 @@ const intersectPoint = new Vec3(); const a = new Vec3(); const b = new Vec3(); const c = new Vec3(); +new Vec3(); +new RaycastResult(); const intersectConvexOptions = { faceList: [0] }; @@ -5318,6 +5274,8 @@ const intersectHeightfield_index = []; const Ray_intersectSphere_intersectionPoint = new Vec3(); const Ray_intersectSphere_normal = new Vec3(); const intersectConvex_normal = new Vec3(); +const intersectConvex_minDistNormal = new Vec3(); +const intersectConvex_minDistIntersect = new Vec3(); const intersectConvex_vector = new Vec3(); const intersectTrimesh_normal = new Vec3(); const intersectTrimesh_localDirection = new Vec3(); @@ -5457,11 +5415,6 @@ class SAPBroadphase extends Broadphase { constructor(world) { super(); - this.axisList = void 0; - this.world = void 0; - this.axisIndex = void 0; - this._addBodyHandler = void 0; - this._removeBodyHandler = void 0; this.axisList = []; this.world = null; this.axisIndex = 0; @@ -5616,7 +5569,11 @@ class SAPBroadphase extends Broadphase { */ - aabbQuery(world, aabb, result = []) { + aabbQuery(world, aabb, result) { + if (result === void 0) { + result = []; + } + if (this.dirty) { this.sortList(); this.dirty = false; @@ -5661,7 +5618,11 @@ class Utils { * @param defaults An object containing default values. * @return The modified options object. */ - static defaults(options = {}, defaults) { + static defaults(options, defaults) { + if (options === void 0) { + options = {}; + } + for (let key in defaults) { if (!(key in options)) { options[key] = defaults[key]; @@ -5692,12 +5653,11 @@ class Constraint { /** * Set to false if you don't want the bodies to collide when they are connected. */ - constructor(bodyA, bodyB, options = {}) { - this.equations = void 0; - this.bodyA = void 0; - this.bodyB = void 0; - this.id = void 0; - this.collideConnected = void 0; + constructor(bodyA, bodyB, options) { + if (options === void 0) { + options = {}; + } + options = Utils.defaults(options, { collideConnected: true, wakeUpBodies: true @@ -5767,8 +5727,6 @@ class JacobianElement { * rotational */ constructor() { - this.spatial = void 0; - this.rotational = void 0; this.spatial = new Vec3(); this.rotational = new Vec3(); } @@ -5820,21 +5778,15 @@ class Equation { /** * A number, proportional to the force added to the bodies. */ - constructor(bi, bj, minForce = -1e6, maxForce = 1e6) { - this.id = void 0; - this.minForce = void 0; - this.maxForce = void 0; - this.bi = void 0; - this.bj = void 0; - this.si = void 0; - this.sj = void 0; - this.a = void 0; - this.b = void 0; - this.eps = void 0; - this.jacobianElementA = void 0; - this.jacobianElementB = void 0; - this.enabled = void 0; - this.multiplier = void 0; + constructor(bi, bj, minForce, maxForce) { + if (minForce === void 0) { + minForce = -1e6; + } + + if (maxForce === void 0) { + maxForce = 1e6; + } + this.id = Equation.idCounter++; this.minForce = minForce; this.maxForce = maxForce; @@ -6028,12 +5980,12 @@ class ContactEquation extends Equation { /** * Contact normal, pointing out of body i. */ - constructor(bodyA, bodyB, maxForce = 1e6) { + constructor(bodyA, bodyB, maxForce) { + if (maxForce === void 0) { + maxForce = 1e6; + } + super(bodyA, bodyB, 0, maxForce); - this.restitution = void 0; - this.ri = void 0; - this.rj = void 0; - this.ni = void 0; this.restitution = 0.0; this.ri = new Vec3(); this.rj = new Vec3(); @@ -6144,13 +6096,20 @@ class PointToPointConstraint extends Constraint { * @param pivotB The point relative to the center of mass of bodyB which bodyB is constrained to. * @param maxForce The maximum force that should be applied to constrain the bodies. */ - constructor(bodyA, pivotA = new Vec3(), bodyB, pivotB = new Vec3(), maxForce = 1e6) { + constructor(bodyA, pivotA, bodyB, pivotB, maxForce) { + if (pivotA === void 0) { + pivotA = new Vec3(); + } + + if (pivotB === void 0) { + pivotB = new Vec3(); + } + + if (maxForce === void 0) { + maxForce = 1e6; + } + super(bodyA, bodyB); - this.pivotA = void 0; - this.pivotB = void 0; - this.equationX = void 0; - this.equationY = void 0; - this.equationZ = void 0; this.pivotA = pivotA.clone(); this.pivotB = pivotB.clone(); const x = this.equationX = new ContactEquation(bodyA, bodyB); @@ -6198,12 +6157,13 @@ class ConeEquation extends Equation { /** * The "cone angle" to keep */ - constructor(bodyA, bodyB, options = {}) { + constructor(bodyA, bodyB, options) { + if (options === void 0) { + options = {}; + } + const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6; super(bodyA, bodyB, -maxForce, maxForce); - this.axisA = void 0; - this.axisB = void 0; - this.angle = void 0; this.axisA = options.axisA ? options.axisA.clone() : new Vec3(1, 0, 0); this.axisB = options.axisB ? options.axisB.clone() : new Vec3(0, 1, 0); this.angle = typeof options.angle !== 'undefined' ? options.angle : 0; @@ -6255,12 +6215,13 @@ class RotationalEquation extends Equation { /** * maxAngle */ - constructor(bodyA, bodyB, options = {}) { + constructor(bodyA, bodyB, options) { + if (options === void 0) { + options = {}; + } + const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6; super(bodyA, bodyB, -maxForce, maxForce); - this.axisA = void 0; - this.axisB = void 0; - this.maxAngle = void 0; this.axisA = options.axisA ? options.axisA.clone() : new Vec3(1, 0, 0); this.axisB = options.axisB ? options.axisB.clone() : new Vec3(0, 1, 0); this.maxAngle = Math.PI / 2; @@ -6314,18 +6275,16 @@ class ConeTwistConstraint extends PointToPointConstraint { /** * The twist angle of the joint. */ - constructor(bodyA, bodyB, options = {}) { + constructor(bodyA, bodyB, options) { + if (options === void 0) { + options = {}; + } + const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6; // Set pivot point in between const pivotA = options.pivotA ? options.pivotA.clone() : new Vec3(); const pivotB = options.pivotB ? options.pivotB.clone() : new Vec3(); super(bodyA, pivotA, bodyB, pivotB, maxForce); - this.axisA = void 0; - this.axisB = void 0; - this.angle = void 0; - this.twistAngle = void 0; - this.coneEquation = void 0; - this.twistEquation = void 0; this.axisA = options.axisA ? options.axisA.clone() : new Vec3(); this.axisB = options.axisB ? options.axisB.clone() : new Vec3(); this.collideConnected = !!options.collideConnected; @@ -6361,6 +6320,8 @@ class ConeTwistConstraint extends PointToPointConstraint { } } +new Vec3(); +new Vec3(); /** * Constrains two bodies to be at a constant distance from each others center of mass. @@ -6374,10 +6335,12 @@ class DistanceConstraint extends Constraint { * @param distance The distance to keep. If undefined, it will be set to the current distance between bodyA and bodyB. * @param maxForce The maximum force that should be applied to constrain the bodies. */ - constructor(bodyA, bodyB, distance, maxForce = 1e6) { + constructor(bodyA, bodyB, distance, maxForce) { + if (maxForce === void 0) { + maxForce = 1e6; + } + super(bodyA, bodyB); - this.distance = void 0; - this.distanceEquation = void 0; if (typeof distance === 'undefined') { distance = bodyA.position.distanceTo(bodyB.position); @@ -6413,7 +6376,11 @@ class DistanceConstraint extends Constraint { * Lock constraint. Will remove all degrees of freedom between the bodies. */ class LockConstraint extends PointToPointConstraint { - constructor(bodyA, bodyB, options = {}) { + constructor(bodyA, bodyB, options) { + if (options === void 0) { + options = {}; + } + const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6; // Set pivot point in between const pivotA = new Vec3(); @@ -6426,16 +6393,6 @@ class LockConstraint extends PointToPointConstraint { super(bodyA, pivotA, bodyB, pivotB, maxForce); // Store initial rotation of the bodies as unit vectors in the local body spaces - this.xA = void 0; - this.xB = void 0; - this.yA = void 0; - this.yB = void 0; - this.zA = void 0; - this.zB = void 0; - this.rotationalEquation1 = void 0; - this.rotationalEquation2 = void 0; - this.rotationalEquation3 = void 0; - this.motorEquation = void 0; this.xA = bodyA.vectorToLocalFrame(Vec3.UNIT_X); this.xB = bodyB.vectorToLocalFrame(Vec3.UNIT_X); this.yA = bodyA.vectorToLocalFrame(Vec3.UNIT_Y); @@ -6460,6 +6417,8 @@ class LockConstraint extends PointToPointConstraint { const r1 = this.rotationalEquation1; const r2 = this.rotationalEquation2; const r3 = this.rotationalEquation3; + LockConstraint_update_tmpVec1; + LockConstraint_update_tmpVec2; super.update(); // These vector pairs must be orthogonal bodyA.vectorToWorldFrame(this.xA, r1.axisA); @@ -6471,6 +6430,8 @@ class LockConstraint extends PointToPointConstraint { } } +const LockConstraint_update_tmpVec1 = new Vec3(); +const LockConstraint_update_tmpVec2 = new Vec3(); /** * Rotational motor constraint. Tries to keep the relative angular velocity of the bodies to a given value. @@ -6487,11 +6448,12 @@ class RotationalMotorEquation extends Equation { /** * Motor velocity. */ - constructor(bodyA, bodyB, maxForce = 1e6) { + constructor(bodyA, bodyB, maxForce) { + if (maxForce === void 0) { + maxForce = 1e6; + } + super(bodyA, bodyB, -maxForce, maxForce); - this.axisA = void 0; - this.axisB = void 0; - this.targetVelocity = void 0; this.axisA = new Vec3(); this.axisB = new Vec3(); this.targetVelocity = 0; @@ -6532,16 +6494,15 @@ class HingeConstraint extends PointToPointConstraint { /** * Rotation axis, defined locally in bodyB. */ - constructor(bodyA, bodyB, options = {}) { + constructor(bodyA, bodyB, options) { + if (options === void 0) { + options = {}; + } + const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6; const pivotA = options.pivotA ? options.pivotA.clone() : new Vec3(); const pivotB = options.pivotB ? options.pivotB.clone() : new Vec3(); super(bodyA, pivotA, bodyB, pivotB, maxForce); - this.axisA = void 0; - this.axisB = void 0; - this.rotationalEquation1 = void 0; - this.rotationalEquation2 = void 0; - this.motorEquation = void 0; const axisA = this.axisA = options.axisA ? options.axisA.clone() : new Vec3(1, 0, 0); axisA.normalize(); const axisB = this.axisB = options.axisB ? options.axisB.clone() : new Vec3(1, 0, 0); @@ -6632,9 +6593,6 @@ class FrictionEquation extends Equation { */ constructor(bodyA, bodyB, slipForce) { super(bodyA, bodyB, -slipForce, slipForce); - this.ri = void 0; - this.rj = void 0; - this.t = void 0; this.ri = new Vec3(); this.rj = new Vec3(); this.t = new Vec3(); @@ -6714,14 +6672,6 @@ class ContactMaterial { * @default 3 */ constructor(m1, m2, options) { - this.id = void 0; - this.materials = void 0; - this.friction = void 0; - this.restitution = void 0; - this.contactEquationStiffness = void 0; - this.contactEquationRelaxation = void 0; - this.frictionEquationStiffness = void 0; - this.frictionEquationRelaxation = void 0; options = Utils.defaults(options, { friction: 0.3, restitution: 0.3, @@ -6764,11 +6714,11 @@ class Material { * Restitution for this material. * If non-negative, it will be used instead of the restitution given by ContactMaterials. If there's no matching ContactMaterial, the value from `defaultContactMaterial` in the World will be used. */ - constructor(options = {}) { - this.name = void 0; - this.id = void 0; - this.friction = void 0; - this.restitution = void 0; + constructor(options) { + if (options === void 0) { + options = {}; + } + let name = ''; // Backwards compatibility fix if (typeof options === 'string') { @@ -6835,14 +6785,11 @@ class Spring { * Where to hook the spring to body B, in local body coordinates. * @default new Vec3() */ - constructor(bodyA, bodyB, options = {}) { - this.restLength = void 0; - this.stiffness = void 0; - this.damping = void 0; - this.bodyA = void 0; - this.bodyB = void 0; - this.localAnchorA = void 0; - this.localAnchorB = void 0; + constructor(bodyA, bodyB, options) { + if (options === void 0) { + options = {}; + } + this.restLength = typeof options.restLength === 'number' ? options.restLength : 1; this.stiffness = options.stiffness || 100; this.damping = options.damping || 1; @@ -7137,45 +7084,11 @@ class WheelInfo { /** * isInContact */ - constructor(options = {}) { - this.maxSuspensionTravel = void 0; - this.customSlidingRotationalSpeed = void 0; - this.useCustomSlidingRotationalSpeed = void 0; - this.sliding = void 0; - this.chassisConnectionPointLocal = void 0; - this.chassisConnectionPointWorld = void 0; - this.directionLocal = void 0; - this.directionWorld = void 0; - this.axleLocal = void 0; - this.axleWorld = void 0; - this.suspensionRestLength = void 0; - this.suspensionMaxLength = void 0; - this.radius = void 0; - this.suspensionStiffness = void 0; - this.dampingCompression = void 0; - this.dampingRelaxation = void 0; - this.frictionSlip = void 0; - this.forwardAcceleration = void 0; - this.sideAcceleration = void 0; - this.steering = void 0; - this.rotation = void 0; - this.deltaRotation = void 0; - this.rollInfluence = void 0; - this.maxSuspensionForce = void 0; - this.engineForce = void 0; - this.brake = void 0; - this.isFrontWheel = void 0; - this.clippedInvContactDotSuspension = void 0; - this.suspensionRelativeVelocity = void 0; - this.suspensionForce = void 0; - this.slipInfo = void 0; - this.skidInfo = void 0; - this.suspensionLength = void 0; - this.sideImpulse = void 0; - this.forwardImpulse = void 0; - this.raycastResult = void 0; - this.worldTransform = void 0; - this.isInContact = void 0; + constructor(options) { + if (options === void 0) { + options = {}; + } + options = Utils.defaults(options, { chassisConnectionPointLocal: new Vec3(), chassisConnectionPointWorld: new Vec3(), @@ -7300,17 +7213,6 @@ class RaycastVehicle { /** Number of wheels on the ground. */ constructor(options) { - this.chassisBody = void 0; - this.wheelInfos = void 0; - this.sliding = void 0; - this.world = void 0; - this.indexRightAxis = void 0; - this.indexForwardAxis = void 0; - this.indexUpAxis = void 0; - this.constraints = void 0; - this.preStepCallback = void 0; - this.currentVehicleSpeedKmHour = void 0; - this.numWheelsOnGround = void 0; this.chassisBody = options.chassisBody; this.wheelInfos = []; this.sliding = false; @@ -7330,7 +7232,11 @@ class RaycastVehicle { */ - addWheel(options = {}) { + addWheel(options) { + if (options === void 0) { + options = {}; + } + const info = new WheelInfo(options); const index = this.wheelInfos.length; this.wheelInfos.push(info); @@ -7780,10 +7686,14 @@ class RaycastVehicle { } } +new Vec3(); +new Vec3(); +new Vec3(); const tmpVec4 = new Vec3(); const tmpVec5 = new Vec3(); const tmpVec6 = new Vec3(); new Ray(); +new Vec3(); const castRay_rayvector = new Vec3(); const castRay_target = new Vec3(); const directions = [new Vec3(1, 0, 0), new Vec3(0, 1, 0), new Vec3(0, 0, 1)]; @@ -7893,7 +7803,6 @@ class Sphere extends Shape { super({ type: Shape.types.SPHERE }); - this.radius = void 0; this.radius = radius !== undefined ? radius : 1.0; if (this.radius < 0) { @@ -7905,7 +7814,11 @@ class Sphere extends Shape { /** calculateLocalInertia */ - calculateLocalInertia(mass, target = new Vec3()) { + calculateLocalInertia(mass, target) { + if (target === void 0) { + target = new Vec3(); + } + const I = 2.0 * mass * this.radius * this.radius / 5.0; target.x = I; target.y = I; @@ -7959,13 +7872,11 @@ class RigidVehicle { /** * The wheel forces. */ - constructor(options = {}) { - this.wheelBodies = void 0; - this.coordinateSystem = void 0; - this.chassisBody = void 0; - this.constraints = void 0; - this.wheelAxes = void 0; - this.wheelForces = void 0; + constructor(options) { + if (options === void 0) { + options = {}; + } + this.wheelBodies = []; this.coordinateSystem = typeof options.coordinateSystem !== 'undefined' ? options.coordinateSystem.clone() : new Vec3(1, 2, 3); @@ -7988,7 +7899,11 @@ class RigidVehicle { */ - addWheel(options = {}) { + addWheel(options) { + if (options === void 0) { + options = {}; + } + let wheelBody; if (options.body) { @@ -8171,15 +8086,6 @@ class SPHSystem { * @default 0.000001 */ constructor() { - this.particles = void 0; - this.density = void 0; - this.smoothingRadius = void 0; - this.speedOfSound = void 0; - this.viscosity = void 0; - this.eps = void 0; - this.pressures = void 0; - this.densities = void 0; - this.neighbors = void 0; this.particles = []; this.density = 1; this.smoothingRadius = 1; @@ -8380,7 +8286,23 @@ class Cylinder extends ConvexPolyhedron { * @param height The height of the Cylinder. * @param numSegments The number of segments to build the cylinder out of. */ - constructor(radiusTop = 1, radiusBottom = 1, height = 1, numSegments = 8) { + constructor(radiusTop, radiusBottom, height, numSegments) { + if (radiusTop === void 0) { + radiusTop = 1; + } + + if (radiusBottom === void 0) { + radiusBottom = 1; + } + + if (height === void 0) { + height = 1; + } + + if (numSegments === void 0) { + numSegments = 8; + } + if (radiusTop < 0) { throw new Error('The cylinder radiusTop cannot be negative.'); } @@ -8442,10 +8364,6 @@ class Cylinder extends ConvexPolyhedron { faces, axes }); - this.radiusTop = void 0; - this.radiusBottom = void 0; - this.height = void 0; - this.numSegments = void 0; this.type = Shape.types.CYLINDER; this.radiusTop = radiusTop; this.radiusBottom = radiusBottom; @@ -8473,7 +8391,11 @@ class Particle extends Shape { */ - calculateLocalInertia(mass, target = new Vec3()) { + calculateLocalInertia(mass, target) { + if (target === void 0) { + target = new Vec3(); + } + target.set(0, 0, 0); return target; } @@ -8511,9 +8433,6 @@ class Plane extends Shape { type: Shape.types.PLANE }); // World oriented normal - this.worldNormal = void 0; - this.worldNormalNeedsUpdate = void 0; - this.boundingSphereRadius = void 0; this.worldNormal = new Vec3(); this.worldNormalNeedsUpdate = true; this.boundingSphereRadius = Number.MAX_VALUE; @@ -8528,7 +8447,11 @@ class Plane extends Shape { this.worldNormalNeedsUpdate = false; } - calculateLocalInertia(mass, target = new Vec3()) { + calculateLocalInertia(mass, target) { + if (target === void 0) { + target = new Vec3(); + } + return target; } @@ -8620,7 +8543,11 @@ class Heightfield extends Shape { /** * @param data An array of numbers, or height values, that are spread out along the x axis. */ - constructor(data, options = {}) { + constructor(data, options) { + if (options === void 0) { + options = {}; + } + options = Utils.defaults(options, { maxValue: null, minValue: null, @@ -8629,14 +8556,6 @@ class Heightfield extends Shape { super({ type: Shape.types.HEIGHTFIELD }); - this.data = void 0; - this.maxValue = void 0; - this.minValue = void 0; - this.elementSize = void 0; - this.cacheEnabled = void 0; - this.pillarConvex = void 0; - this.pillarOffset = void 0; - this._cachedPillars = void 0; this.data = data; this.maxValue = options.maxValue; this.minValue = options.minValue; @@ -8741,7 +8660,11 @@ class Heightfield extends Shape { */ - getRectMinMax(iMinX, iMinY, iMaxX, iMaxY, result = []) { + getRectMinMax(iMinX, iMinY, iMaxX, iMaxY, result) { + if (result === void 0) { + result = []; + } + // Get max and min of the data const data = this.data; // Set first value @@ -8843,10 +8766,11 @@ class Heightfield extends Shape { */ - getAabbAtIndex(xi, yi, { - lowerBound, - upperBound - }) { + getAabbAtIndex(xi, yi, _ref) { + let { + lowerBound, + upperBound + } = _ref; const data = this.data; const elementSize = this.elementSize; lowerBound.set(xi * elementSize, yi * elementSize, data[xi][yi]); @@ -8886,7 +8810,7 @@ class Heightfield extends Shape { } getCacheConvexTrianglePillarKey(xi, yi, getUpperTriangle) { - return xi + "_" + yi + "_" + (getUpperTriangle ? 1 : 0); + return `${xi}_${yi}_${getUpperTriangle ? 1 : 0}`; } getCachedConvexTrianglePillar(xi, yi, getUpperTriangle) { @@ -9052,7 +8976,11 @@ class Heightfield extends Shape { this.setCachedConvexTrianglePillar(xi, yi, getUpperTriangle, result, offsetResult); } - calculateLocalInertia(mass, target = new Vec3()) { + calculateLocalInertia(mass, target) { + if (target === void 0) { + target = new Vec3(); + } + target.set(0, 0, 0); return target; } @@ -9153,11 +9081,11 @@ class OctreeNode { /** Contained data at the current node level */ /** Children to this node */ - constructor(options = {}) { - this.root = void 0; - this.aabb = void 0; - this.data = void 0; - this.children = void 0; + constructor(options) { + if (options === void 0) { + options = {}; + } + this.root = options.root || null; this.aabb = options.aabb ? options.aabb.clone() : new AABB(); this.data = []; @@ -9177,7 +9105,11 @@ class OctreeNode { */ - insert(aabb, elementData, level = 0) { + insert(aabb, elementData, level) { + if (level === void 0) { + level = 0; + } + const nodeData = this.data; // Ignore objects that do not belong in this node if (!this.aabb.contains(aabb)) { @@ -9353,12 +9285,15 @@ class Octree extends OctreeNode { /** * @param aabb The total AABB of the tree */ - constructor(aabb, options = {}) { + constructor(aabb, options) { + if (options === void 0) { + options = {}; + } + super({ root: null, aabb }); - this.maxDepth = void 0; this.maxDepth = typeof options.maxDepth !== 'undefined' ? options.maxDepth : 8; } @@ -9412,13 +9347,6 @@ class Trimesh extends Shape { super({ type: Shape.types.TRIMESH }); - this.vertices = void 0; - this.indices = void 0; - this.normals = void 0; - this.aabb = void 0; - this.edges = void 0; - this.scale = void 0; - this.tree = void 0; this.vertices = new Float32Array(vertices); this.indices = new Int16Array(indices); this.normals = new Float32Array(indices.length); @@ -9547,7 +9475,7 @@ class Trimesh extends Shape { const edges = {}; const add = (a, b) => { - const key = a < b ? a + "_" + b : b + "_" + a; + const key = a < b ? `${a}_${b}` : `${b}_${a}`; edges[key] = true; }; @@ -9803,7 +9731,27 @@ class Trimesh extends Shape { */ - static createTorus(radius = 1, tube = 0.5, radialSegments = 8, tubularSegments = 6, arc = Math.PI * 2) { + static createTorus(radius, tube, radialSegments, tubularSegments, arc) { + if (radius === void 0) { + radius = 1; + } + + if (tube === void 0) { + tube = 0.5; + } + + if (radialSegments === void 0) { + radialSegments = 8; + } + + if (tubularSegments === void 0) { + tubularSegments = 6; + } + + if (arc === void 0) { + arc = Math.PI * 2; + } + const vertices = []; const indices = []; @@ -9859,7 +9807,6 @@ class Solver { * @todo remove useless constructor */ constructor() { - this.equations = void 0; this.equations = []; } /** @@ -9928,8 +9875,6 @@ class GSSolver extends Solver { */ constructor() { super(); - this.iterations = void 0; - this.tolerance = void 0; this.iterations = 10; this.tolerance = 1e-7; } @@ -10062,11 +10007,6 @@ class SplitSolver extends Solver { /** subsolver */ constructor(subsolver) { super(); - this.iterations = void 0; - this.tolerance = void 0; - this.subsolver = void 0; - this.nodes = void 0; - this.nodePool = void 0; this.iterations = 10; this.tolerance = 1e-7; this.subsolver = subsolver; @@ -10237,11 +10177,11 @@ class Pool { /** * Release an object after use */ - release(...args) { - const Nargs = args.length; + release() { + const Nargs = arguments.length; for (let i = 0; i !== Nargs; i++) { - this.objects.push(args[i]); + this.objects.push(i < 0 || arguments.length <= i ? undefined : arguments[i]); } return this; @@ -10292,8 +10232,8 @@ class Pool { */ class Vec3Pool extends Pool { - constructor(...args) { - super(...args); + constructor() { + super(...arguments); this.type = Vec3; } @@ -10306,7 +10246,6 @@ class Vec3Pool extends Pool { } -let _COLLISION_TYPES$sphe, _COLLISION_TYPES$sphe2, _COLLISION_TYPES$boxB, _COLLISION_TYPES$sphe3, _COLLISION_TYPES$plan, _COLLISION_TYPES$conv, _COLLISION_TYPES$sphe4, _COLLISION_TYPES$plan2, _COLLISION_TYPES$boxC, _COLLISION_TYPES$sphe5, _COLLISION_TYPES$boxH, _COLLISION_TYPES$conv2, _COLLISION_TYPES$sphe6, _COLLISION_TYPES$plan3, _COLLISION_TYPES$boxP, _COLLISION_TYPES$conv3, _COLLISION_TYPES$cyli, _COLLISION_TYPES$sphe7, _COLLISION_TYPES$plan4, _COLLISION_TYPES$boxC2, _COLLISION_TYPES$conv4, _COLLISION_TYPES$heig, _COLLISION_TYPES$part, _COLLISION_TYPES$sphe8, _COLLISION_TYPES$plan5; // Naming rule: based of the order in SHAPE_TYPES, // the first part of the method is formed by the // shape type that comes before, in the second part @@ -10338,31 +10277,6 @@ const COLLISION_TYPES = { sphereTrimesh: Shape.types.SPHERE | Shape.types.TRIMESH, planeTrimesh: Shape.types.PLANE | Shape.types.TRIMESH }; -_COLLISION_TYPES$sphe = COLLISION_TYPES.sphereSphere; -_COLLISION_TYPES$sphe2 = COLLISION_TYPES.spherePlane; -_COLLISION_TYPES$boxB = COLLISION_TYPES.boxBox; -_COLLISION_TYPES$sphe3 = COLLISION_TYPES.sphereBox; -_COLLISION_TYPES$plan = COLLISION_TYPES.planeBox; -_COLLISION_TYPES$conv = COLLISION_TYPES.convexConvex; -_COLLISION_TYPES$sphe4 = COLLISION_TYPES.sphereConvex; -_COLLISION_TYPES$plan2 = COLLISION_TYPES.planeConvex; -_COLLISION_TYPES$boxC = COLLISION_TYPES.boxConvex; -_COLLISION_TYPES$sphe5 = COLLISION_TYPES.sphereHeightfield; -_COLLISION_TYPES$boxH = COLLISION_TYPES.boxHeightfield; -_COLLISION_TYPES$conv2 = COLLISION_TYPES.convexHeightfield; -_COLLISION_TYPES$sphe6 = COLLISION_TYPES.sphereParticle; -_COLLISION_TYPES$plan3 = COLLISION_TYPES.planeParticle; -_COLLISION_TYPES$boxP = COLLISION_TYPES.boxParticle; -_COLLISION_TYPES$conv3 = COLLISION_TYPES.convexParticle; -_COLLISION_TYPES$cyli = COLLISION_TYPES.cylinderCylinder; -_COLLISION_TYPES$sphe7 = COLLISION_TYPES.sphereCylinder; -_COLLISION_TYPES$plan4 = COLLISION_TYPES.planeCylinder; -_COLLISION_TYPES$boxC2 = COLLISION_TYPES.boxCylinder; -_COLLISION_TYPES$conv4 = COLLISION_TYPES.convexCylinder; -_COLLISION_TYPES$heig = COLLISION_TYPES.heightfieldCylinder; -_COLLISION_TYPES$part = COLLISION_TYPES.particleCylinder; -_COLLISION_TYPES$sphe8 = COLLISION_TYPES.sphereTrimesh; -_COLLISION_TYPES$plan5 = COLLISION_TYPES.planeTrimesh; /** * Helper class for the World. Generates ContactEquations. @@ -10378,103 +10292,103 @@ class Narrowphase { /** * Pooled vectors. */ - get [_COLLISION_TYPES$sphe]() { + get [COLLISION_TYPES.sphereSphere]() { return this.sphereSphere; } - get [_COLLISION_TYPES$sphe2]() { + get [COLLISION_TYPES.spherePlane]() { return this.spherePlane; } - get [_COLLISION_TYPES$boxB]() { + get [COLLISION_TYPES.boxBox]() { return this.boxBox; } - get [_COLLISION_TYPES$sphe3]() { + get [COLLISION_TYPES.sphereBox]() { return this.sphereBox; } - get [_COLLISION_TYPES$plan]() { + get [COLLISION_TYPES.planeBox]() { return this.planeBox; } - get [_COLLISION_TYPES$conv]() { + get [COLLISION_TYPES.convexConvex]() { return this.convexConvex; } - get [_COLLISION_TYPES$sphe4]() { + get [COLLISION_TYPES.sphereConvex]() { return this.sphereConvex; } - get [_COLLISION_TYPES$plan2]() { + get [COLLISION_TYPES.planeConvex]() { return this.planeConvex; } - get [_COLLISION_TYPES$boxC]() { + get [COLLISION_TYPES.boxConvex]() { return this.boxConvex; } - get [_COLLISION_TYPES$sphe5]() { + get [COLLISION_TYPES.sphereHeightfield]() { return this.sphereHeightfield; } - get [_COLLISION_TYPES$boxH]() { + get [COLLISION_TYPES.boxHeightfield]() { return this.boxHeightfield; } - get [_COLLISION_TYPES$conv2]() { + get [COLLISION_TYPES.convexHeightfield]() { return this.convexHeightfield; } - get [_COLLISION_TYPES$sphe6]() { + get [COLLISION_TYPES.sphereParticle]() { return this.sphereParticle; } - get [_COLLISION_TYPES$plan3]() { + get [COLLISION_TYPES.planeParticle]() { return this.planeParticle; } - get [_COLLISION_TYPES$boxP]() { + get [COLLISION_TYPES.boxParticle]() { return this.boxParticle; } - get [_COLLISION_TYPES$conv3]() { + get [COLLISION_TYPES.convexParticle]() { return this.convexParticle; } - get [_COLLISION_TYPES$cyli]() { + get [COLLISION_TYPES.cylinderCylinder]() { return this.convexConvex; } - get [_COLLISION_TYPES$sphe7]() { + get [COLLISION_TYPES.sphereCylinder]() { return this.sphereConvex; } - get [_COLLISION_TYPES$plan4]() { + get [COLLISION_TYPES.planeCylinder]() { return this.planeConvex; } - get [_COLLISION_TYPES$boxC2]() { + get [COLLISION_TYPES.boxCylinder]() { return this.boxConvex; } - get [_COLLISION_TYPES$conv4]() { + get [COLLISION_TYPES.convexCylinder]() { return this.convexConvex; } - get [_COLLISION_TYPES$heig]() { + get [COLLISION_TYPES.heightfieldCylinder]() { return this.heightfieldCylinder; } - get [_COLLISION_TYPES$part]() { + get [COLLISION_TYPES.particleCylinder]() { return this.particleCylinder; } - get [_COLLISION_TYPES$sphe8]() { + get [COLLISION_TYPES.sphereTrimesh]() { return this.sphereTrimesh; } - get [_COLLISION_TYPES$plan5]() { + get [COLLISION_TYPES.planeTrimesh]() { return this.planeTrimesh; } // get [COLLISION_TYPES.convexTrimesh]() { // return this.convexTrimesh @@ -10482,14 +10396,6 @@ class Narrowphase { constructor(world) { - this.contactPointPool = void 0; - this.frictionEquationPool = void 0; - this.result = void 0; - this.frictionResult = void 0; - this.v3pool = void 0; - this.world = void 0; - this.currentContactMaterial = void 0; - this.enableFrictionReduction = void 0; this.contactPointPool = []; this.frictionEquationPool = []; this.result = []; @@ -10549,7 +10455,8 @@ class Narrowphase { if (friction > 0) { // Create 2 tangent equations - const mug = friction * world.gravity.length(); + // Users may provide a force different from global gravity to use when computing contact friction. + const mug = friction * (world.frictionGravity || world.gravity).length(); let reducedMass = bodyA.invMass + bodyB.invMass; if (reducedMass > 0) { @@ -11897,6 +11804,7 @@ const planeTrimesh_relpos = new Vec3(); const planeTrimesh_projected = new Vec3(); const sphereTrimesh_normal = new Vec3(); const sphereTrimesh_relpos = new Vec3(); +new Vec3(); const sphereTrimesh_v = new Vec3(); const sphereTrimesh_v2 = new Vec3(); const sphereTrimesh_edgeVertexA = new Vec3(); @@ -11970,6 +11878,8 @@ const sphereConvex_worldPoint = new Vec3(); const sphereConvex_worldSpherePointClosestToPlane = new Vec3(); const sphereConvex_penetrationVec = new Vec3(); const sphereConvex_sphereToWorldPoint = new Vec3(); +new Vec3(); +new Vec3(); const planeConvex_v = new Vec3(); const planeConvex_normal = new Vec3(); const planeConvex_relpos = new Vec3(); @@ -11983,6 +11893,7 @@ const particleSphere_normal = new Vec3(); // WIP const cqj = new Quaternion(); const convexParticle_local = new Vec3(); +new Vec3(); const convexParticle_penetratedFaceNormal = new Vec3(); const convexParticle_vertexToParticle = new Vec3(); const convexParticle_worldPenetrationVec = new Vec3(); @@ -11997,8 +11908,6 @@ class OverlapKeeper { * @todo Remove useless constructor */ constructor() { - this.current = void 0; - this.previous = void 0; this.current = []; this.previous = []; } @@ -12103,9 +12012,12 @@ function unpackAndPush(array, key) { array.push((key & 0xffff0000) >> 16, key & 0x0000ffff); } +const getKey = (i, j) => i < j ? `${i}-${j}` : `${j}-${i}`; /** * TupleDictionary */ + + class TupleDictionary { constructor() { this.data = { @@ -12115,26 +12027,14 @@ class TupleDictionary { /** get */ get(i, j) { - if (i > j) { - // swap - const temp = j; - j = i; - i = temp; - } - - return this.data[i + "-" + j]; + const key = getKey(i, j); + return this.data[key]; } /** set */ set(i, j, value) { - if (i > j) { - const temp = j; - j = i; - i = temp; - } - - const key = i + "-" + j; // Check if key already exists + const key = getKey(i, j); // Check if key already exists if (!this.get(i, j)) { this.data.keys.push(key); @@ -12142,6 +12042,19 @@ class TupleDictionary { this.data[key] = value; } + /** delete */ + + + delete(i, j) { + const key = getKey(i, j); + const index = this.data.keys.indexOf(key); + + if (index !== -1) { + this.data.keys.splice(index, 1); + } + + delete this.data[key]; + } /** reset */ @@ -12201,6 +12114,12 @@ class World extends EventTarget { * The gravity of the world. */ + /** + * Gravity to use when approximating the friction max force (mu*mass*gravity). + * If undefined, global gravity will be used. + * Use to enable friction in a World with a null gravity vector (no gravity). + */ + /** * The broadphase algorithm to use. * @default NaiveBroadphase @@ -12227,12 +12146,6 @@ class World extends EventTarget { * CollisionMatrix from the previous step. */ - /** - * All added materials. - * @deprecated - * @todo Remove - */ - /** * All added contactmaterials. */ @@ -12261,41 +12174,12 @@ class World extends EventTarget { /** * Dispatched after a body has been removed from the world. */ - constructor(options = {}) { + constructor(options) { + if (options === void 0) { + options = {}; + } + super(); - this.dt = void 0; - this.allowSleep = void 0; - this.contacts = void 0; - this.frictionEquations = void 0; - this.quatNormalizeSkip = void 0; - this.quatNormalizeFast = void 0; - this.time = void 0; - this.stepnumber = void 0; - this.default_dt = void 0; - this.nextId = void 0; - this.gravity = void 0; - this.broadphase = void 0; - this.bodies = void 0; - this.hasActiveBodies = void 0; - this.solver = void 0; - this.constraints = void 0; - this.narrowphase = void 0; - this.collisionMatrix = void 0; - this.collisionMatrixPrevious = void 0; - this.bodyOverlapKeeper = void 0; - this.shapeOverlapKeeper = void 0; - this.materials = void 0; - this.contactmaterials = void 0; - this.contactMaterialTable = void 0; - this.defaultMaterial = void 0; - this.defaultContactMaterial = void 0; - this.doProfiling = void 0; - this.profile = void 0; - this.accumulator = void 0; - this.subsystems = void 0; - this.addBodyEvent = void 0; - this.removeBodyEvent = void 0; - this.idToBodyMap = void 0; this.dt = -1; this.allowSleep = !!options.allowSleep; this.contacts = []; @@ -12312,6 +12196,11 @@ class World extends EventTarget { this.gravity.copy(options.gravity); } + if (options.frictionGravity) { + this.frictionGravity = new Vec3(); + this.frictionGravity.copy(options.frictionGravity); + } + this.broadphase = options.broadphase !== undefined ? options.broadphase : new NaiveBroadphase(); this.bodies = []; this.hasActiveBodies = false; @@ -12322,7 +12211,6 @@ class World extends EventTarget { this.collisionMatrixPrevious = new ArrayCollisionMatrix(); this.bodyOverlapKeeper = new OverlapKeeper(); this.shapeOverlapKeeper = new OverlapKeeper(); - this.materials = []; this.contactmaterials = []; this.contactMaterialTable = new TupleDictionary(); this.defaultMaterial = new Material('default'); @@ -12360,15 +12248,6 @@ class World extends EventTarget { getContactMaterial(m1, m2) { return this.contactMaterialTable.get(m1.id, m2.id); } - /** - * Get number of objects in the world. - * @deprecated - */ - - - numObjects() { - return this.bodies.length; - } /** * Store old collision state info */ @@ -12427,7 +12306,11 @@ class World extends EventTarget { */ - raycastAll(from, to, options = {}, callback) { + raycastAll(from, to, options, callback) { + if (options === void 0) { + options = {}; + } + options.mode = Ray.ALL; options.from = from; options.to = to; @@ -12440,7 +12323,11 @@ class World extends EventTarget { */ - raycastAny(from, to, options = {}, result) { + raycastAny(from, to, options, result) { + if (options === void 0) { + options = {}; + } + options.mode = Ray.ANY; options.from = from; options.to = to; @@ -12453,7 +12340,11 @@ class World extends EventTarget { */ - raycastClosest(from, to, options = {}, result) { + raycastClosest(from, to, options, result) { + if (options === void 0) { + options = {}; + } + options.mode = Ray.CLOSEST; options.from = from; options.to = to; @@ -12540,16 +12431,6 @@ class World extends EventTarget { return null; } - /** - * Adds a material to the World. - * @deprecated - * @todo Remove - */ - - - addMaterial(m) { - this.materials.push(m); - } /** * Adds a contact material to the World */ @@ -12561,6 +12442,54 @@ class World extends EventTarget { this.contactMaterialTable.set(cmat.materials[0].id, cmat.materials[1].id, cmat); } + /** + * Removes a contact material from the World. + */ + + + removeContactMaterial(cmat) { + const idx = this.contactmaterials.indexOf(cmat); + + if (idx === -1) { + return; + } + + this.contactmaterials.splice(idx, 1); + this.contactMaterialTable.delete(cmat.materials[0].id, cmat.materials[1].id); + } + /** + * Step the simulation forward keeping track of last called time + * to be able to step the world at a fixed rate, independently of framerate. + * + * @param dt The fixed time step size to use (default: 1 / 60). + * @param maxSubSteps Maximum number of fixed steps to take per function call (default: 10). + * @see https://gafferongames.com/post/fix_your_timestep/ + * @example + * // Run the simulation independently of framerate every 1 / 60 ms + * world.fixedStep() + */ + + + fixedStep(dt, maxSubSteps) { + if (dt === void 0) { + dt = 1 / 60; + } + + if (maxSubSteps === void 0) { + maxSubSteps = 10; + } + + const time = performance.now() / 1000; // seconds + + if (!this.lastCallTime) { + this.step(dt, undefined, maxSubSteps); + } else { + const timeSinceLastCalled = time - this.lastCallTime; + this.step(dt, timeSinceLastCalled, maxSubSteps); + } + + this.lastCallTime = time; + } /** * Step the physics world forward in time. * @@ -12568,7 +12497,7 @@ class World extends EventTarget { * * @param dt The fixed time step size to use. * @param timeSinceLastCalled The time elapsed since the function was last called. - * @param maxSubSteps Maximum number of fixed steps to take per function call. + * @param maxSubSteps Maximum number of fixed steps to take per function call (default: 10). * @see https://web.archive.org/web/20180426154531/http://bulletphysics.org/mediawiki-1.5.8/index.php/Stepping_The_World#What_do_the_parameters_to_btDynamicsWorld::stepSimulation_mean.3F * @example * // fixed timestepping without interpolation @@ -12576,7 +12505,11 @@ class World extends EventTarget { */ - step(dt, timeSinceLastCalled, maxSubSteps = 10) { + step(dt, timeSinceLastCalled, maxSubSteps) { + if (maxSubSteps === void 0) { + maxSubSteps = 10; + } + if (timeSinceLastCalled === undefined) { // Fixed, simple stepping this.internalStep(dt); // Increment time @@ -12622,7 +12555,7 @@ class World extends EventTarget { const contacts = this.contacts; const p1 = World_step_p1; const p2 = World_step_p2; - const N = this.numObjects(); + const N = this.bodies.length; const bodies = this.bodies; const solver = this.solver; const gravity = this.gravity; @@ -12894,19 +12827,10 @@ class World extends EventTarget { } } - this.dispatchEvent(World_step_preStepEvent); // Invoke pre-step callbacks - - for (i = 0; i !== N; i++) { - const bi = bodies[i]; - - if (bi.preStep) { - bi.preStep.call(bi); - } - } // Leap frog + this.dispatchEvent(World_step_preStepEvent); // Leap frog // vnew = v + h*f/m // xnew = x + h*vnew - if (doProfiling) { profilingStart = performance.now(); } @@ -12928,17 +12852,7 @@ class World extends EventTarget { this.stepnumber += 1; - this.dispatchEvent(World_step_postStepEvent); // Invoke post-step callbacks - - for (i = 0; i !== N; i++) { - const bi = bodies[i]; - const postStep = bi.postStep; - - if (postStep) { - postStep.call(bi); - } - } // Sleeping update - + this.dispatchEvent(World_step_postStepEvent); // Sleeping update let hasActiveBodies = true; @@ -13056,6 +12970,8 @@ if (!performance.now) { performance.now = () => Date.now() - nowOffset; } + +new Vec3(); // Dispatched after the world has stepped forward in time. // Reusable event objects to save memory. const World_step_postStepEvent = { diff --git a/node_modules/cannon-es/package.json b/node_modules/cannon-es/package.json index 70c3cf6..6d51921 100644 --- a/node_modules/cannon-es/package.json +++ b/node_modules/cannon-es/package.json @@ -1,6 +1,6 @@ { "name": "cannon-es", - "version": "0.18.0", + "version": "0.20.0", "license": "MIT", "description": "A lightweight 3D physics engine written in JavaScript.", "homepage": "https://github.com/schteppe/cannon.js", @@ -21,49 +21,50 @@ "react-native": "./dist/cannon-es.js", "types": "./dist/cannon-es.d.ts", "sideEffects": false, + "files": [ + "dist/" + ], "scripts": { + "prepare": "husky install", "start": "npx serve", "prebuild": "rimraf dist", "build": "npm run typegen && rollup -c", "prepublishOnly": "npm run build && npm run test", "typecheck": "tsc --noEmit --emitDeclarationOnly false --strict", "typegen": "tsc --outFile dist/cannon-es.d.ts", - "generate-docs": "typedoc && node ./scripts/inject-css-in-docs.mjs", + "generate-docs": "typedoc", "test": "jest" }, - "husky": { - "hooks": { - "pre-commit": "pretty-quick" - } - }, "repository": { "type": "git", "url": "https://github.com/pmndrs/cannon-es.git" }, "bugs": { - "url": "https://github.com/schteppe/cannon.js/issues" + "url": "https://github.com/pmndrs/cannon-es/issues" }, "devDependencies": { - "@babel/core": "^7.13.15", - "@babel/plugin-proposal-class-properties": "^7.13.0", - "@babel/preset-env": "^7.13.15", - "@babel/preset-typescript": "^7.13.0", + "@babel/core": "^7.16.5", + "@babel/preset-env": "^7.16.5", + "@babel/preset-typescript": "^7.16.5", "@rollup/plugin-babel": "^5.3.0", "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^11.2.1", - "@rollup/plugin-replace": "^2.4.2", - "@types/jest": "^26.0.22", - "fs-extra": "^9.1.0", - "husky": "4.3.8", - "jest": "^26.6.0", - "prettier": "^2.2.1", - "pretty-quick": "^3.1.0", - "readdirp": "^3.6.0", + "@rollup/plugin-node-resolve": "^13.1.1", + "@rollup/plugin-replace": "^3.0.0", + "@types/jest": "^27.0.3", + "@types/node": "^17.0.4", + "husky": "^7.0.4", + "jest": "^27.4.5", + "lint-staged": "^12.1.4", + "prettier": "^2.5.1", "rimraf": "^3.0.2", - "rollup": "^2.44.0", + "rollup": "^2.62.0", "rollup-plugin-filesize": "^9.1.1", - "ts-jest": "^26.5.4", - "typedoc": "0.20.30", - "typescript": "^4.2.4" + "ts-jest": "^27.1.2", + "ts-node": "^10.4.0", + "typedoc": "^0.22.10", + "typescript": "^4.5.4" + }, + "lint-staged": { + "*.{js,json,jsx,ts,tsx,md,yaml,yml}": "prettier --write" } } diff --git a/node_modules/cannon-es/readme.md b/node_modules/cannon-es/readme.md index ea55c6c..658c2d6 100644 --- a/node_modules/cannon-es/readme.md +++ b/node_modules/cannon-es/readme.md @@ -16,6 +16,7 @@ These minor changes and improvements were also made: - Add support for [Trigger bodies](https://pmndrs.github.io/cannon-es/examples/trigger). [#83](https://github.com/pmndrs/cannon-es/pull/83) - Deprecated properties and methods have been removed. - The [original cannon.js debugger](https://github.com/schteppe/cannon.js/blob/master/tools/threejs/CannonDebugRenderer.js), which shows the wireframes of each body, has been moved to its own repo [cannon-es-debugger](https://github.com/pmndrs/cannon-es-debugger). +- Added optional property `World.frictionGravity: Vec3` which can be set to customize the force used when computing the friction between two colliding bodies. If `undefined`, `World.gravity` will be used. This property is useful to enable friction in zero gravity. This addresses issue [#224](https://github.com/schteppe/cannon.js/issues/224) and follows the [pattern established for p2.js](https://github.com/schteppe/p2.js/blob/master/src/world/World.js#L88-L92). If instead you're using three.js in a **React** environment with [react-three-fiber](https://github.com/pmndrs/react-three-fiber), check out [use-cannon](https://github.com/pmndrs/use-cannon)! It's a wrapper around cannon-es. diff --git a/node_modules/envinfo/dist/cli.js b/node_modules/envinfo/dist/cli.js index abdb9a9..f1ffe2e 100644 --- a/node_modules/envinfo/dist/cli.js +++ b/node_modules/envinfo/dist/cli.js @@ -1,2 +1,2 @@ #!/usr/bin/env node -(()=>{var n={9076:n=>{function e(n){return"number"==typeof n||!!/^0x[0-9a-f]+$/i.test(n)||/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(n)}n.exports=function(n,o){o||(o={});var t={bools:{},strings:{},unknownFn:null};"function"==typeof o.unknown&&(t.unknownFn=o.unknown),"boolean"==typeof o.boolean&&o.boolean?t.allBools=!0:[].concat(o.boolean).filter(Boolean).forEach((function(n){t.bools[n]=!0}));var r={};Object.keys(o.alias||{}).forEach((function(n){r[n]=[].concat(o.alias[n]),r[n].forEach((function(e){r[e]=[n].concat(r[n].filter((function(n){return e!==n})))}))})),[].concat(o.string).filter(Boolean).forEach((function(n){t.strings[n]=!0,r[n]&&(t.strings[r[n]]=!0)}));var s=o.default||{},i={_:[]};Object.keys(t.bools).forEach((function(n){l(n,void 0!==s[n]&&s[n])}));var a=[];function l(n,o,s){if(!s||!t.unknownFn||function(n,e){return t.allBools&&/^--[^=]+$/.test(e)||t.strings[n]||t.bools[n]||r[n]}(n,s)||!1!==t.unknownFn(s)){var a=!t.strings[n]&&e(o)?Number(o):o;c(i,n.split("."),a),(r[n]||[]).forEach((function(n){c(i,n.split("."),a)}))}}function c(n,e,o){for(var r=n,s=0;s{"use strict";n.exports=require("./envinfo")}},e={};function o(t){var r=e[t];if(void 0!==r)return r.exports;var s=e[t]={exports:{}};return n[t](s,s.exports,o),s.exports}(()=>{"use strict";var n=o(9076)(process.argv.slice(2)),e="7.13.0";n.console=!0,n.help||n._.indexOf("help")>-1?console.log(`\n ,,', ,, ,,,,,, ,',,\n ,,, ,,, ,,,\n ,, ,,,,, ,,,,,, ,,, ,, ,, .,,,,,, ,,,,,,, ,,,,, ,,\n ,, ,, ,, ,,, ,,, ,, ,,, ,, ,,, ,,, ,, ,,, ,,, ,,\n ,,, ,, .,, ,,, ,, ,,, ,, ,, ,,, ,, ,, ,, ,, ,,,\n ,, ,,,,,,,,,, ,,, ,, ,, ,, ,, ,,, ,, ,, ,, ,, ,,\n ,, ,,, ,,, ,, ,,,,, ,, ,,, ,, ,, ,,, ,,, ,,\n ,, ,,,,,,, ,,, ,, ,,, ,, ,,, ,, ,, ,,,,,,, ,,\n ,,, ,,,\n ,,,' ',,,\n\n VERSION: ${e}\n\n USAGE:\n\n \`envinfo\` || \`npx envinfo\`\n\n OPTIONS:\n\n --system Print general system info such as OS, CPU, Memory and Shell\n --browsers Get version numbers of installed web browsers\n --SDKs Get platforms, build tools and SDKs of iOS and Android\n --IDEs Get version numbers of installed IDEs\n --languages Get version numbers of installed languages such as Java, Python, PHP, etc\n --managers Get version numbers of installed package/dependency managers\n --monorepos Get monorepo tools\n --binaries Get version numbers of node, npm, watchman, etc\n --npmPackages Get version numbers of locally installed npm packages - glob, string, or comma delimited list\n --npmGlobalPackages Get version numbers of globally installed npm packages\n\n --duplicates Mark duplicate npm packages inside parentheses eg. (2.1.4)\n --fullTree Traverse entire node_modules dependency tree, not just top level\n\n --markdown Print output in markdown format\n --json Print output in JSON format\n --console Print to console (defaults to on for CLI usage, off for programmatic usage)\n --showNotFound Don't filter out values marked 'Not Found'\n --title Give your report a top level title ie 'Environment Report'\n\n --clipboard *Removed - use clipboardy or clipboard-cli directly*\n `):n.version||n.v||n._.indexOf("version")>-1?console.log(e):o(2328).cli(n)})(),module.exports={}})(); \ No newline at end of file +(()=>{var n={9076:n=>{function e(n){return"number"==typeof n||!!/^0x[0-9a-f]+$/i.test(n)||/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(n)}n.exports=function(n,o){o||(o={});var t={bools:{},strings:{},unknownFn:null};"function"==typeof o.unknown&&(t.unknownFn=o.unknown),"boolean"==typeof o.boolean&&o.boolean?t.allBools=!0:[].concat(o.boolean).filter(Boolean).forEach((function(n){t.bools[n]=!0}));var r={};Object.keys(o.alias||{}).forEach((function(n){r[n]=[].concat(o.alias[n]),r[n].forEach((function(e){r[e]=[n].concat(r[n].filter((function(n){return e!==n})))}))})),[].concat(o.string).filter(Boolean).forEach((function(n){t.strings[n]=!0,r[n]&&(t.strings[r[n]]=!0)}));var s=o.default||{},i={_:[]};Object.keys(t.bools).forEach((function(n){l(n,void 0!==s[n]&&s[n])}));var a=[];function l(n,o,s){if(!s||!t.unknownFn||function(n,e){return t.allBools&&/^--[^=]+$/.test(e)||t.strings[n]||t.bools[n]||r[n]}(n,s)||!1!==t.unknownFn(s)){var a=!t.strings[n]&&e(o)?Number(o):o;c(i,n.split("."),a),(r[n]||[]).forEach((function(n){c(i,n.split("."),a)}))}}function c(n,e,o){for(var r=n,s=0;s{"use strict";n.exports=require("./envinfo")}},e={};function o(t){var r=e[t];if(void 0!==r)return r.exports;var s=e[t]={exports:{}};return n[t](s,s.exports,o),s.exports}(()=>{"use strict";var n=o(9076)(process.argv.slice(2)),e="7.14.0";n.console=!0,n.help||n._.indexOf("help")>-1?console.log(`\n ,,', ,, ,,,,,, ,',,\n ,,, ,,, ,,,\n ,, ,,,,, ,,,,,, ,,, ,, ,, .,,,,,, ,,,,,,, ,,,,, ,,\n ,, ,, ,, ,,, ,,, ,, ,,, ,, ,,, ,,, ,, ,,, ,,, ,,\n ,,, ,, .,, ,,, ,, ,,, ,, ,, ,,, ,, ,, ,, ,, ,,,\n ,, ,,,,,,,,,, ,,, ,, ,, ,, ,, ,,, ,, ,, ,, ,, ,,\n ,, ,,, ,,, ,, ,,,,, ,, ,,, ,, ,, ,,, ,,, ,,\n ,, ,,,,,,, ,,, ,, ,,, ,, ,,, ,, ,, ,,,,,,, ,,\n ,,, ,,,\n ,,,' ',,,\n\n VERSION: ${e}\n\n USAGE:\n\n \`envinfo\` || \`npx envinfo\`\n\n OPTIONS:\n\n --system Print general system info such as OS, CPU, Memory and Shell\n --browsers Get version numbers of installed web browsers\n --SDKs Get platforms, build tools and SDKs of iOS and Android\n --IDEs Get version numbers of installed IDEs\n --languages Get version numbers of installed languages such as Java, Python, PHP, etc\n --managers Get version numbers of installed package/dependency managers\n --monorepos Get monorepo tools\n --binaries Get version numbers of node, npm, watchman, etc\n --npmPackages Get version numbers of locally installed npm packages - glob, string, or comma delimited list\n --npmGlobalPackages Get version numbers of globally installed npm packages\n\n --duplicates Mark duplicate npm packages inside parentheses eg. (2.1.4)\n --fullTree Traverse entire node_modules dependency tree, not just top level\n\n --markdown Print output in markdown format\n --json Print output in JSON format\n --console Print to console (defaults to on for CLI usage, off for programmatic usage)\n --showNotFound Don't filter out values marked 'Not Found'\n --title Give your report a top level title ie 'Environment Report'\n\n --clipboard *Removed - use clipboardy or clipboard-cli directly*\n `):n.version||n.v||n._.indexOf("version")>-1?console.log(e):o(2328).cli(n)})(),module.exports={}})(); \ No newline at end of file diff --git a/node_modules/envinfo/dist/envinfo.js b/node_modules/envinfo/dist/envinfo.js index 6392ddb..6baa62b 100644 --- a/node_modules/envinfo/dist/envinfo.js +++ b/node_modules/envinfo/dist/envinfo.js @@ -1 +1 @@ -(()=>{var e={2980:(e,t,r)=>{"use strict";r(7360),r(5888),r(8412),r(3852),r(5584);var n=r(9892),o=r(5008),i=r(5088),s=r(224);function a(e,t){(t=t||{}).clipboard&&console.log("\n*** Clipboard option removed - use clipboardy or clipboard-cli directly ***\n");var r=Object.keys(e).length>0?e:i.defaults,s=Object.entries(r).reduce((function(e,r){var o=r[0],i=r[1],s=n[`get${o}`];return s?(i&&e.push(s(i,t)),e):e=e.concat((i||[]).map((function(e){var t=n[`get${e.replace(/\s/g,"")}Info`];return t?t():Promise.resolve(["Unknown"])})))}),[]);return Promise.all(s).then((function(e){var r=e.reduce((function(e,t){return t&&t[0]&&Object.assign(e,{[t[0]]:t}),e}),{});return function(e,t){var r=t.json?o.json:t.markdown?o.markdown:o.yaml;if(t.console){var n=!1;process.stdout.isTTY&&(n=!0),console.log(r(e,Object.assign({},t,{console:n})))}return r(e,Object.assign({},t,{console:!1}))}(Object.entries(i.defaults).reduce((function(e,t){var n=t[0],o=t[1];return r[n]?Object.assign(e,{[n]:r[n][1]}):Object.assign(e,{[n]:(o||[]).reduce((function(e,t){return r[t]?(r[t].shift(),1===r[t].length?Object.assign(e,{[t]:r[t][0]}):Object.assign(e,{[t]:{version:r[t][0],path:r[t][1]}})):e}),{})})}),{}),t)}))}e.exports={cli:function(e){if(e.all)return a(Object.assign({},i.defaults,{npmPackages:!0,npmGlobalPackages:!0}),e);if(e.raw)return a(JSON.parse(e.raw),e);if(e.helper){var t=n[`get${e.helper}`]||n[`get${e.helper}Info`]||n[e.helper];return t?t().then(console.log):console.error("Not Found")}var r=function(e,t){return e.toLowerCase().includes(t.toLowerCase())},o=Object.keys(e).filter((function(e){return Object.keys(i.defaults).some((function(t){return r(t,e)}))})),c=Object.entries(i.defaults).reduce((function(t,n){return o.some((function(e){return r(e,n[0])}))?Object.assign(t,{[n[0]]:n[1]||e[n[0]]}):t}),{});return e.preset?i[e.preset]?a(Object.assign({},s.omit(i[e.preset],["options"]),c),Object.assign({},i[e.preset].options,s.pick(e,["duplicates","fullTree","json","markdown","console"]))):console.error(`\nNo "${e.preset}" preset found.`):a(c,e)},helpers:n,main:a,run:function(e,t){return"string"==typeof e.preset?a(i[e.preset],t):a(e,t)}}},5008:(e,t,r)=>{"use strict";r(223),r(3852),r(4880),r(3708),r(5584),r(5308);var n=r(6232),o=r(224);function i(e,t){return o.log("trace","clean",e),Object.keys(e).reduce((function(r,n){return!t.showNotFound&&"Not Found"===e[n]||"N/A"===e[n]||void 0===e[n]||0===Object.keys(e[n]).length?r:o.isObject(e[n])?Object.values(e[n]).every((function(e){return"N/A"===e||!t.showNotFound&&"Not Found"===e}))?r:Object.assign(r,{[n]:i(e[n],t)}):Object.assign(r,{[n]:e[n]})}),{})}function s(e,t){o.log("trace","formatHeaders"),t||(t={type:"underline"});var r={underline:["",""]};return e.slice().split("\n").map((function(e){if(":"===e.slice("-1")){var n=e.match(/^[\s]*/g)[0];return`${n}${r[t.type][0]}${e.slice(n.length)}${r[t.type][1]}`}return e})).join("\n")}function a(e){return o.log("trace","formatPackages"),e.npmPackages?Object.assign(e,{npmPackages:Object.entries(e.npmPackages||{}).reduce((function(e,t){var r=t[0],n=t[1];if("Not Found"===n)return Object.assign(e,{[r]:n});var o=n.wanted?`${n.wanted} =>`:"",i=Array.isArray(n.installed)?n.installed.join(", "):n.installed,s=n.duplicates?`(${n.duplicates.join(", ")})`:"";return Object.assign(e,{[r]:`${o} ${i} ${s}`})}),{})}):e}function c(e,t,r){return r||(r={emptyMessage:"None"}),Array.isArray(t)&&(t=t.length>0?t.join(", "):r.emptyMessage),{[e]:t}}function u(e,t){return Object.entries(e).reduce((function(e,r){var n=r[0],i=r[1];return o.isObject(i)?Object.assign(e,{[n]:u(i,t)}):Object.assign(e,t(n,i))}),{})}function l(e){return o.log("trace","serializeArrays"),u(e,c)}function f(e){return o.log("trace","serializeVersionsAndPaths"),Object.entries(e).reduce((function(e,t){return Object.assign(e,{[t[0]]:Object.entries(t[1]).reduce((function(e,t){var r=t[0],n=t[1];return n.version?Object.assign(e,{[r]:[n.version,n.path].filter(Boolean).join(" - ")}):Object.assign(e,{[r]:[n][0]})}),{})},{})}),{})}function p(e){return n(e,{indent:" ",prefix:"\n",postfix:"\n"})}function h(e){return e.slice().split("\n").map((function(e){if(""!==e){var t=":"===e.slice("-1"),r=e.search(/\S|$/);return t?`${"#".repeat(r/2+1)} `+e.slice(r):" - "+e.slice(r)}return""})).join("\n")}function d(e,t){return t||(t={indent:" "}),JSON.stringify(e,null,t.indent)}e.exports={json:function(e,t){return o.log("trace","formatToJson"),t||(t={}),e=o.pipe([function(){return i(e,t)},t.title?function(e){return{[t.title]:e}}:o.noop,d])(e),e=t.console?`\n${e}\n`:e},markdown:function(e,t){return o.log("trace","formatToMarkdown"),o.pipe([function(){return i(e,t)},a,l,f,p,h,t.title?function(e){return`\n# ${t.title}${e}`}:o.noop])(e,t)},yaml:function(e,t){return o.log("trace","formatToYaml",t),o.pipe([function(){return i(e,t)},a,l,f,t.title?function(e){return{[t.title]:e}}:o.noop,p,t.console?s:o.noop])(e,t)}}},6732:(e,t,r)=>{"use strict";r(5888);var n=r(224);e.exports={getNodeInfo:function(){return n.log("trace","getNodeInfo"),Promise.all([n.isWindows?n.run("node -v").then(n.findVersion):n.which("node").then((function(e){return e?n.run(e+" -v"):Promise.resolve("")})).then(n.findVersion),n.which("node").then(n.condensePath)]).then((function(e){return n.determineFound("Node",e[0],e[1])}))},getnpmInfo:function(){return n.log("trace","getnpmInfo"),Promise.all([n.run("npm -v"),n.which("npm").then(n.condensePath)]).then((function(e){return n.determineFound("npm",e[0],e[1])}))},getWatchmanInfo:function(){return n.log("trace","getWatchmanInfo"),Promise.all([n.which("watchman").then((function(e){return e?n.run(e+" -v"):void 0})),n.which("watchman")]).then((function(e){return n.determineFound("Watchman",e[0],e[1])}))},getYarnInfo:function(){return n.log("trace","getYarnInfo"),Promise.all([n.run("yarn -v"),n.which("yarn").then(n.condensePath)]).then((function(e){return n.determineFound("Yarn",e[0],e[1])}))},getpnpmInfo:function(){return n.log("trace","getpnpmInfo"),Promise.all([n.run("pnpm -v"),n.which("pnpm").then(n.condensePath)]).then((function(e){return n.determineFound("pnpm",e[0],e[1])}))},getbunInfo:function(){return n.log("trace","getbunInfo"),Promise.all([n.run("bun -v"),n.which("bun").then(n.condensePath)]).then((function(e){return n.determineFound("bun",e[0],e[1])}))}}},2524:(e,t,r)=>{"use strict";r(3708),r(5888),r(8412);var n=r(2058),o=r(8558),i=r(224),s=r(7072);function a(e,t){var r;return(i.isLinux?i.run("firefox --version").then((function(e){return e.replace(/^.* ([^ ]*)/g,"$1")})):i.isMacOS&&"string"==typeof e&&e?i.getDarwinApplicationVersion(e):i.isWindows&&"string"==typeof t&&t?i.windowsExeExists(t).then((function(e){return r=e,e?i.run(`powershell ". '${e}' -v | Write-Output"`).then((function(e){return i.findVersion(e)})):i.NA})):Promise.resolve(i.NA)).then((function(e){return i.determineFound("Firefox",e,r||i.NA)}))}e.exports={getBraveBrowserInfo:function(){return i.log("trace","getBraveBrowser"),(i.isLinux?i.run("brave --version || brave-browser --version").then((function(e){return e.replace(/^.* ([^ ]*)/g,"$1")})):i.isMacOS?i.getDarwinApplicationVersion(i.browserBundleIdentifiers["Brave Browser"]).then(i.findVersion):Promise.resolve("N/A")).then((function(e){return i.determineFound("Brave Browser",e,"N/A")}))},getChromeInfo:function(){var e;if(i.log("trace","getChromeInfo"),i.isLinux)e=i.run("google-chrome --version").then((function(e){return e.replace(" dev","").replace(/^.* ([^ ]*)/g,"$1")}));else if(i.isMacOS)e=i.getDarwinApplicationVersion(i.browserBundleIdentifiers.Chrome).then(i.findVersion);else if(i.isWindows){var t;try{t=i.findVersion(n.readdirSync(s.join(process.env["ProgramFiles(x86)"],"Google/Chrome/Application")).join("\n"))}catch(e){t=i.NotFound}e=Promise.resolve(t)}else e=Promise.resolve("N/A");return e.then((function(e){return i.determineFound("Chrome",e,"N/A")}))},getChromeCanaryInfo:function(){return i.log("trace","getChromeCanaryInfo"),i.getDarwinApplicationVersion(i.browserBundleIdentifiers["Chrome Canary"]).then((function(e){return i.determineFound("Chrome Canary",e,"N/A")}))},getChromiumInfo:function(){return i.log("trace","getChromiumInfo"),(i.isLinux?i.run("chromium --version").then(i.findVersion):Promise.resolve("N/A")).then((function(e){return i.determineFound("Chromium",e,"N/A")}))},getEdgeInfo:function(){var e;if(i.log("trace","getEdgeInfo"),i.isWindows&&"10"===o.release().split(".")[0]){var t={Spartan:"Microsoft.MicrosoftEdge",Chromium:"Microsoft.MicrosoftEdge.Stable",ChromiumDev:"Microsoft.MicrosoftEdge.Dev"};e=Promise.all(Object.keys(t).map((function(e){return function(e,t){return i.run(`powershell get-appxpackage ${e}`).then((function(e){if(""!==i.findVersion(e))return`${t} (${i.findVersion(e)})`}))}(t[e],e)})).filter((function(e){return void 0!==e})))}else{if(!i.isMacOS)return Promise.resolve("N/A");e=i.getDarwinApplicationVersion(i.browserBundleIdentifiers["Microsoft Edge"])}return e.then((function(e){return i.determineFound("Edge",Array.isArray(e)?e.filter((function(e){return void 0!==e})):e,i.NA)}))},getFirefoxInfo:function(){i.log("trace","getFirefoxInfo"),a(i.browserBundleIdentifiers.Firefox,"Mozilla Firefox/firefox.exe")},getFirefoxDeveloperEditionInfo:function(){i.log("trace","getFirefoxDeveloperEditionInfo"),a(i.browserBundleIdentifiers["Firefox Developer Edition"],"Firefox Developer Edition/firefox.exe")},getFirefoxNightlyInfo:function(){return i.log("trace","getFirefoxNightlyInfo"),(i.isLinux?i.run("firefox-trunk --version").then((function(e){return e.replace(/^.* ([^ ]*)/g,"$1")})):i.isMacOS?i.getDarwinApplicationVersion(i.browserBundleIdentifiers["Firefox Nightly"]):Promise.resolve("N/A")).then((function(e){return i.determineFound("Firefox Nightly",e,"N/A")}))},getInternetExplorerInfo:function(){var e;if(i.log("trace","getInternetExplorerInfo"),i.isWindows){var t=[process.env.SYSTEMDRIVE||"C:","Program Files","Internet Explorer","iexplore.exe"].join("\\\\");e=i.run(`wmic datafile where "name='${t}'" get Version`).then(i.findVersion)}else e=Promise.resolve("N/A");return e.then((function(e){return i.determineFound("Internet Explorer",e,"N/A")}))},getSafariTechnologyPreviewInfo:function(){return i.log("trace","getSafariTechnologyPreviewInfo"),i.getDarwinApplicationVersion(i.browserBundleIdentifiers["Safari Technology Preview"]).then((function(e){return i.determineFound("Safari Technology Preview",e,"N/A")}))},getSafariInfo:function(){return i.log("trace","getSafariInfo"),i.getDarwinApplicationVersion(i.browserBundleIdentifiers.Safari).then((function(e){return i.determineFound("Safari",e,"N/A")}))}}},6620:(e,t,r)=>{"use strict";r(7360),r(5888);var n=r(224);e.exports={getMongoDBInfo:function(){return n.log("trace","getMongoDBInfo"),Promise.all([n.run("mongo --version").then(n.findVersion),n.which("mongo")]).then((function(e){return n.determineFound("MongoDB",e[0],e[1])}))},getMySQLInfo:function(){return n.log("trace","getMySQLInfo"),Promise.all([n.run("mysql --version").then((function(e){return`${n.findVersion(e,null,1)}${e.includes("MariaDB")?" (MariaDB)":""}`})),n.which("mysql")]).then((function(e){return n.determineFound("MySQL",e[0],e[1])}))},getPostgreSQLInfo:function(){return n.log("trace","getPostgreSQLInfo"),Promise.all([n.run("postgres --version").then(n.findVersion),n.which("postgres")]).then((function(e){return n.determineFound("PostgreSQL",e[0],e[1])}))},getSQLiteInfo:function(){return n.log("trace","getSQLiteInfo"),Promise.all([n.run("sqlite3 --version").then(n.findVersion),n.which("sqlite3")]).then((function(e){return n.determineFound("SQLite",e[0],e[1])}))}}},3224:(e,t,r)=>{"use strict";r(3708),r(8412),r(5888);var n=r(7072),o=r(224);e.exports={getAndroidStudioInfo:function(){var e=Promise.resolve("N/A");if(o.isMacOS){var t=[n.join("/","Applications","Android Studio.app","Contents","Info.plist"),n.join(process.env.HOME,"Applications","Android Studio.app","Contents","Info.plist"),n.join("/","Applications","JetBrains Toolbox","Android Studio.app","Contents","Info.plist"),n.join(process.env.HOME,"Applications","JetBrains Toolbox","Android Studio.app","Contents","Info.plist")];e=Promise.all(t.map((function(e){return o.fileExists(e).then((function(t){if(!t)return null;var r=o.generatePlistBuddyCommand(e.replace(/ /g,"\\ "),["CFBundleShortVersionString","CFBundleVersion"]);return o.run(r).then((function(e){return e.split("\n").join(" ")}))}))}))).then((function(e){return e.find((function(e){return null!==e}))||o.NotFound}))}else o.isLinux?e=Promise.all([o.run('cat /opt/android-studio/bin/studio.sh | grep "$Home/.AndroidStudio" | head -1').then(o.findVersion),o.run("cat /opt/android-studio/build.txt")]).then((function(e){return`${e[0]} ${e[1]}`.trim()||o.NotFound})):o.isWindows&&(e=Promise.all([o.run('wmic datafile where name="C:\\\\Program Files\\\\Android\\\\Android Studio\\\\bin\\\\studio.exe" get Version').then((function(e){return e.replace(/(\r\n|\n|\r)/gm,"")})),o.run('type "C:\\\\Program Files\\\\Android\\\\Android Studio\\\\build.txt"').then((function(e){return e.replace(/(\r\n|\n|\r)/gm,"")}))]).then((function(e){return`${e[0]} ${e[1]}`.trim()||o.NotFound})));return e.then((function(e){return o.determineFound("Android Studio",e)}))},getAtomInfo:function(){return o.log("trace","getAtomInfo"),Promise.all([o.getDarwinApplicationVersion(o.ideBundleIdentifiers.Atom),"N/A"]).then((function(e){return o.determineFound("Atom",e[0],e[1])}))},getEmacsInfo:function(){return o.log("trace","getEmacsInfo"),o.isMacOS||o.isLinux?Promise.all([o.run("emacs --version").then(o.findVersion),o.run("which emacs")]).then((function(e){return o.determineFound("Emacs",e[0],e[1])})):Promise.resolve(["Emacs","N/A"])},getIntelliJInfo:function(){return o.log("trace","getIntelliJInfo"),o.getDarwinApplicationVersion(o.ideBundleIdentifiers.IntelliJ).then((function(e){return o.determineFound("IntelliJ",e)}))},getNanoInfo:function(){return o.log("trace","getNanoInfo"),o.isLinux?Promise.all([o.run("nano --version").then(o.findVersion),o.run("which nano")]).then((function(e){return o.determineFound("Nano",e[0],e[1])})):Promise.resolve(["Nano","N/A"])},getNvimInfo:function(){return o.log("trace","getNvimInfo"),o.isMacOS||o.isLinux?Promise.all([o.run("nvim --version").then(o.findVersion),o.run("which nvim")]).then((function(e){return o.determineFound("Nvim",e[0],e[1])})):Promise.resolve(["Vim","N/A"])},getPhpStormInfo:function(){return o.log("trace","getPhpStormInfo"),o.getDarwinApplicationVersion(o.ideBundleIdentifiers.PhpStorm).then((function(e){return o.determineFound("PhpStorm",e)}))},getSublimeTextInfo:function(){return o.log("trace","getSublimeTextInfo"),Promise.all([o.run("subl --version").then((function(e){return o.findVersion(e,/\d+/)})),o.which("subl")]).then((function(e){return""===e[0]&&o.isMacOS?(o.log("trace","getSublimeTextInfo using plist"),Promise.all([o.getDarwinApplicationVersion(o.ideBundleIdentifiers["Sublime Text"]),"N/A"])):e})).then((function(e){return o.determineFound("Sublime Text",e[0],e[1])}))},getVimInfo:function(){return o.log("trace","getVimInfo"),o.isMacOS||o.isLinux?Promise.all([o.run("vim --version").then(o.findVersion),o.run("which vim")]).then((function(e){return o.determineFound("Vim",e[0],e[1])})):Promise.resolve(["Vim","N/A"])},getVSCodeInfo:function(){return o.log("trace","getVSCodeInfo"),Promise.all([o.run("code --version").then(o.findVersion),o.which("code")]).then((function(e){return o.determineFound("VSCode",e[0],e[1])}))},getVisualStudioInfo:function(){return o.log("trace","getVisualStudioInfo"),o.isWindows?o.run(`"${process.env["ProgramFiles(x86)"]}/Microsoft Visual Studio/Installer/vswhere.exe" -format json -prerelease`).then((function(e){var t=JSON.parse(e).map((function(e){return{Version:e.installationVersion,DisplayName:e.displayName}}));return o.determineFound("Visual Studio",t.map((function(e){return`${e.Version} (${e.DisplayName})`})))})).catch((function(){return Promise.resolve(["Visual Studio",o.NotFound])})):Promise.resolve(["Visual Studio",o.NA])},getWebStormInfo:function(){return o.log("trace","getWebStormInfo"),o.getDarwinApplicationVersion(o.ideBundleIdentifiers.WebStorm).then((function(e){return o.determineFound("WebStorm",e)}))},getXcodeInfo:function(){return o.log("trace","getXcodeInfo"),o.isMacOS?Promise.all([o.which("xcodebuild").then((function(e){return o.run(e+" -version")})).then((function(e){return`${o.findVersion(e)}/${e.split("Build version ")[1]}`})),o.which("xcodebuild")]).then((function(e){return o.determineFound("Xcode",e[0],e[1])})):Promise.resolve(["Xcode","N/A"])}}},9892:(e,t,r)=>{"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r(5584);var o=r(6304),i=r(224),s=r(6732),a=r(2524),c=r(6620),u=r(3224),l=r(6436),f=r(760),p=r(2060),h=r(7508),d=r(9284),m=r(8144),g=r(5882),v=r(9676);e.exports=Object.assign({},i,o,function(e){for(var t=1;t{"use strict";r(5888);var n=r(224);e.exports={getBashInfo:function(){return n.log("trace","getBashInfo"),Promise.all([n.run("bash --version").then(n.findVersion),n.which("bash")]).then((function(e){return n.determineFound("Bash",e[0],e[1])}))},getElixirInfo:function(){return n.log("trace","getElixirInfo"),Promise.all([n.run("elixir --version").then((function(e){return n.findVersion(e,/[Elixir]+\s([\d+.[\d+|.]+)/,1)})),n.which("elixir")]).then((function(e){return Promise.resolve(n.determineFound("Elixir",e[0],e[1]))}))},getErlangInfo:function(){return n.log("trace","getErlangInfo"),Promise.all([n.run("erl -eval \"{ok, Version} = file:read_file(filename:join([code:root_dir(), 'releases', erlang:system_info(otp_release), 'OTP_VERSION'])), io:fwrite(Version), halt().\" -noshell").then(n.findVersion),n.which("erl")]).then((function(e){return Promise.resolve(n.determineFound("Erlang",e[0],e[1]))}))},getGoInfo:function(){return n.log("trace","getGoInfo"),Promise.all([n.run("go version").then(n.findVersion),n.which("go")]).then((function(e){return n.determineFound("Go",e[0],e[1])}))},getJavaInfo:function(){return n.log("trace","getJavaInfo"),Promise.all([n.run("javac -version",{unify:!0}).then((function(e){return n.findVersion(e,/\d+\.[\w+|.|_|-]+/)})),n.run("which javac")]).then((function(e){return n.determineFound("Java",e[0],e[1])}))},getPerlInfo:function(){return n.log("trace","getPerlInfo"),Promise.all([n.run("perl -v").then(n.findVersion),n.which("perl")]).then((function(e){return n.determineFound("Perl",e[0],e[1])}))},getPHPInfo:function(){return n.log("trace","getPHPInfo"),Promise.all([n.run("php -v").then(n.findVersion),n.which("php")]).then((function(e){return n.determineFound("PHP",e[0],e[1])}))},getProtocInfo:function(){return n.log("trace","getProtocInfo"),Promise.all([n.run("protoc --version").then(n.findVersion),n.run("which protoc")]).then((function(e){return n.determineFound("Protoc",e[0],e[1])}))},getPythonInfo:function(){return n.log("trace","getPythonInfo"),Promise.all([n.run("python -V 2>&1").then(n.findVersion),n.run("which python")]).then((function(e){return n.determineFound("Python",e[0],e[1])}))},getPython3Info:function(){return n.log("trace","getPython3Info"),Promise.all([n.run("python3 -V 2>&1").then(n.findVersion),n.run("which python3")]).then((function(e){return n.determineFound("Python3",e[0],e[1])}))},getRInfo:function(){return n.log("trace","getRInfo"),Promise.all([n.run("R --version",{unify:!0}).then(n.findVersion),n.which("R")]).then((function(e){return n.determineFound("R",e[0],e[1])}))},getRubyInfo:function(){return n.log("trace","getRubyInfo"),Promise.all([n.run("ruby -v").then(n.findVersion),n.which("ruby")]).then((function(e){return n.determineFound("Ruby",e[0],e[1])}))},getRustInfo:function(){return n.log("trace","getRustInfo"),Promise.all([n.run("rustc --version").then(n.findVersion),n.run("which rustc")]).then((function(e){return n.determineFound("Rust",e[0],e[1])}))},getScalaInfo:function(){return n.log("trace","getScalaInfo"),n.isMacOS||n.isLinux?Promise.all([n.run("scalac -version").then(n.findVersion),n.run("which scalac")]).then((function(e){return n.determineFound("Scala",e[0],e[1])})):Promise.resolve(["Scala","N/A"])}}},760:(e,t,r)=>{"use strict";r(5888);var n=r(224);e.exports={getAptInfo:function(){return n.log("trace","getAptInfo"),n.isLinux?Promise.all([n.run("apt --version").then(n.findVersion),n.which("apt")]).then((function(e){return n.determineFound("Apt",e[0],e[1])})):Promise.all(["Apt","N/A"])},getCargoInfo:function(){return n.log("trace","getCargoInfo"),Promise.all([n.run("cargo --version").then(n.findVersion),n.which("cargo").then(n.condensePath)]).then((function(e){return n.determineFound("Cargo",e[0],e[1])}))},getCocoaPodsInfo:function(){return n.log("trace","getCocoaPodsInfo"),n.isMacOS?Promise.all([n.run("pod --version").then(n.findVersion),n.which("pod")]).then((function(e){return n.determineFound("CocoaPods",e[0],e[1])})):Promise.all(["CocoaPods","N/A"])},getComposerInfo:function(){return n.log("trace","getComposerInfo"),Promise.all([n.run("composer --version").then(n.findVersion),n.which("composer").then(n.condensePath)]).then((function(e){return n.determineFound("Composer",e[0],e[1])}))},getGradleInfo:function(){return n.log("trace","getGradleInfo"),Promise.all([n.run("gradle --version").then(n.findVersion),n.which("gradle").then(n.condensePath)]).then((function(e){return n.determineFound("Gradle",e[0],e[1])}))},getHomebrewInfo:function(){return n.log("trace","getHomebrewInfo"),n.isMacOS||n.isLinux?Promise.all([n.run("brew --version").then(n.findVersion),n.which("brew")]).then((function(e){return n.determineFound("Homebrew",e[0],e[1])})):Promise.all(["Homebrew","N/A"])},getMavenInfo:function(){return n.log("trace","getMavenInfo"),Promise.all([n.run("mvn --version").then(n.findVersion),n.which("mvn").then(n.condensePath)]).then((function(e){return n.determineFound("Maven",e[0],e[1])}))},getpip2Info:function(){return n.log("trace","getpip2Info"),Promise.all([n.run("pip2 --version").then(n.findVersion),n.which("pip2").then(n.condensePath)]).then((function(e){return n.determineFound("pip2",e[0],e[1])}))},getpip3Info:function(){return n.log("trace","getpip3Info"),Promise.all([n.run("pip3 --version").then(n.findVersion),n.which("pip3").then(n.condensePath)]).then((function(e){return n.determineFound("pip3",e[0],e[1])}))},getRubyGemsInfo:function(){return n.log("trace","getRubyGemsInfo"),Promise.all([n.run("gem --version").then(n.findVersion),n.which("gem")]).then((function(e){return n.determineFound("RubyGems",e[0],e[1])}))},getYumInfo:function(){return n.log("trace","getYumInfo"),n.isLinux?Promise.all([n.run("yum --version").then(n.findVersion),n.which("yum")]).then((function(e){return n.determineFound("Yum",e[0],e[1])})):Promise.all(["Yum","N/A"])}}},2060:(e,t,r)=>{"use strict";r(5888);var n=r(224),o=r(7072);e.exports={getYarnWorkspacesInfo:function(){return n.log("trace","getYarnWorkspacesInfo"),Promise.all([n.run("yarn -v"),n.getPackageJsonByPath("package.json").then((function(e){return e&&"workspaces"in e}))]).then((function(e){var t="Yarn Workspaces";return e[0]&&e[1]?Promise.resolve([t,e[0]]):Promise.resolve([t,"Not Found"])}))},getLernaInfo:function(){return n.log("trace","getLernaInfo"),Promise.all([n.getPackageJsonByName("lerna").then((function(e){return e&&e.version})),n.fileExists(o.join(process.cwd(),"lerna.json"))]).then((function(e){var t="Lerna";return e[0]&&e[1]?Promise.resolve([t,e[0]]):Promise.resolve([t,"Not Found"])}))}}},7508:(e,t,r)=>{"use strict";r(4880),r(5888),r(3708);var n=r(2058),o=r(7072),i=r(224);e.exports={getAndroidSDKInfo:function(){return i.run("sdkmanager --list").then((function(e){return!e&&process.env.ANDROID_HOME?i.run(`${process.env.ANDROID_HOME}/tools/bin/sdkmanager --list`):e})).then((function(e){return!e&&process.env.ANDROID_HOME?i.run(`${process.env.ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --list`):e})).then((function(e){return!e&&i.isMacOS?i.run("~/Library/Android/sdk/tools/bin/sdkmanager --list"):e})).then((function(e){var t=i.parseSDKManagerOutput(e),r=function(e){var t,r=o.join(e,"source.properties");try{t=n.readFileSync(r,"utf8")}catch(e){if("ENOENT"===e.code)return;throw e}for(var i=t.split("\n"),s=0;s{"use strict";r(5888);var n=r(224);e.exports={getApacheInfo:function(){return n.log("trace","getApacheInfo"),n.isMacOS||n.isLinux?Promise.all([n.run("apachectl -v").then(n.findVersion),n.run("which apachectl")]).then((function(e){return n.determineFound("Apache",e[0],e[1])})):Promise.resolve(["Apache","N/A"])},getNginxInfo:function(){return n.log("trace","getNginxInfo"),n.isMacOS||n.isLinux?Promise.all([n.run("nginx -v 2>&1").then(n.findVersion),n.run("which nginx")]).then((function(e){return n.determineFound("Nginx",e[0],e[1])})):Promise.resolve(["Nginx","N/A"])}}},8144:(e,t,r)=>{"use strict";r(3708),r(4880),r(5888);var n=r(2288),o=r(224),i=r(8558);e.exports={getContainerInfo:function(){return o.log("trace","getContainerInfo"),o.isLinux?Promise.all([o.fileExists("/.dockerenv"),o.readFile("/proc/self/cgroup")]).then((function(e){return o.log("trace","getContainerInfoThen",e),Promise.resolve(["Container",e[0]||e[1]?"Yes":"N/A"])})).catch((function(e){return o.log("trace","getContainerInfoCatch",e)})):Promise.resolve(["Container","N/A"])},getCPUInfo:function(){var e;o.log("trace","getCPUInfo");try{var t=i.cpus();e="("+t.length+") "+i.arch()+" "+t[0].model}catch(t){e="Unknown"}return Promise.all(["CPU",e])},getMemoryInfo:function(){return o.log("trace","getMemoryInfo"),Promise.all(["Memory",`${o.toReadableBytes(i.freemem())} / ${o.toReadableBytes(i.totalmem())}`])},getOSInfo:function(){var e,t;if(o.log("trace","getOSInfo"),o.isMacOS)e=o.run("sw_vers -productVersion ");else if(o.isLinux)e=o.run("cat /etc/os-release").then((function(e){var t=(e||"").match(/NAME="(.+)"/)||"",r=(e||"").match(/VERSION="(.+)"/)||["",""],n=null!==r?r[1]:"";return`${t[1]} ${n}`.trim()||""}));else if(o.isWindows){e=Promise.resolve(i.release());var r=i.release().split(".");"10"===r[0]&&"0"===r[1]&&r[2]>=22e3&&(t="Windows 11")}else e=Promise.resolve();return e.then((function(e){return t=t||n(i.platform(),i.release()),e&&(t+=` ${e}`),["OS",t]}))},getShellInfo:function(){if(o.log("trace","getShellInfo",process.env),o.isMacOS||o.isLinux){var e=process.env.SHELL||o.runSync("getent passwd $LOGNAME | cut -d: -f7 | head -1"),t=`${e} --version 2>&1`;return e.match("/bin/ash")&&(t=`${e} --help 2>&1`),Promise.all([o.run(t).then(o.findVersion),o.which(e)]).then((function(e){return o.determineFound("Shell",e[0]||"Unknown",e[1])}))}return Promise.resolve(["Shell","N/A"])},getGLibcInfo:function(){return o.log("trace","getGLibc"),o.isLinux?Promise.all([o.run("ldd --version").then(o.findVersion)]).then((function(e){return o.determineFound("GLibc",e[0]||"Unknown")})):Promise.resolve(["GLibc","N/A"])}}},5882:(e,t,r)=>{"use strict";r(5888);var n=r(224);e.exports={getBazelInfo:function(){return n.log("trace","getBazelInfo"),Promise.all([n.run("bazel --version").then(n.findVersion),n.run("which bazel")]).then((function(e){return n.determineFound("Bazel",e[0],e[1])}))},getCMakeInfo:function(){return n.log("trace","getCMakeInfo"),Promise.all([n.run("cmake --version").then(n.findVersion),n.run("which cmake")]).then((function(e){return n.determineFound("CMake",e[0],e[1])}))},getGCCInfo:function(){return n.log("trace","getGCCInfo"),n.isMacOS||n.isLinux?Promise.all([n.run("gcc -v 2>&1").then(n.findVersion),n.run("which gcc")]).then((function(e){return n.determineFound("GCC",e[0],e[1])})):Promise.resolve(["GCC","N/A"])},getClangInfo:function(){return n.log("trace","getClangInfo"),Promise.all([n.run("clang --version").then(n.findVersion),n.which("clang")]).then((function(e){return n.determineFound("Clang",e[0],e[1])}))},getGitInfo:function(){return n.log("trace","getGitInfo"),Promise.all([n.run("git --version").then(n.findVersion),n.run("which git")]).then((function(e){return n.determineFound("Git",e[0],e[1])}))},getMakeInfo:function(){return n.log("trace","getMakeInfo"),n.isMacOS||n.isLinux?Promise.all([n.run("make --version").then(n.findVersion),n.run("which make")]).then((function(e){return n.determineFound("Make",e[0],e[1])})):Promise.resolve(["Make","N/A"])},getNinjaInfo:function(){return n.log("trace","getNinjaInfo"),Promise.all([n.run("ninja --version").then(n.findVersion),n.run("which ninja")]).then((function(e){return n.determineFound("Ninja",e[0],e[1])}))},getMercurialInfo:function(){return n.log("trace","getMercurialInfo"),n.isMacOS||n.isLinux?Promise.all([n.run("hg --version").then(n.findVersion),n.run("which hg")]).then((function(e){return n.determineFound("Mercurial",e[0],e[1])})):Promise.resolve(["Mercurial","N/A"])},getSubversionInfo:function(){return n.log("trace","getSubversionInfo"),n.isMacOS||n.isLinux?Promise.all([n.run("svn --version").then(n.findVersion),n.run("which svn")]).then((function(e){return n.determineFound("Subversion",e[0],e[1])})):Promise.resolve(["Subversion","N/A"])},getFFmpegInfo:function(){return n.log("trace","getFFmpegInfo"),Promise.all([n.run("ffmpeg -version").then(n.findVersion),n.which("ffmpeg")]).then((function(e){return n.determineFound("FFmpeg",e[0],e[1])}))},getCurlInfo:function(){return n.log("trace","getCurlInfo"),Promise.all([n.run("curl --version").then(n.findVersion),n.which("curl")]).then((function(e){return n.determineFound("Curl",e[0],e[1])}))},getOpenSSLInfo:function(){return n.log("trace","getOpenSSLInfo"),Promise.all([n.run("openssl version").then(n.findVersion),n.which("openssl")]).then((function(e){return n.determineFound("OpenSSL",e[0],e[1])}))}}},9676:(e,t,r)=>{"use strict";r(5888);var n=r(224);e.exports={getDockerInfo:function(){return n.log("trace","getDockerInfo"),Promise.all([n.run("docker --version").then(n.findVersion),n.which("docker")]).then((function(e){return n.determineFound("Docker",e[0],e[1])}))},getDockerComposeInfo:function(){return n.log("trace","getDockerComposeInfo"),Promise.all([n.run("docker-compose --version").then(n.findVersion),n.which("docker-compose")]).then((function(e){return n.determineFound("Docker Compose",e[0],e[1])}))},getParallelsInfo:function(){return n.log("trace","getParallelsInfo"),Promise.all([n.run("prlctl --version").then(n.findVersion),n.which("prlctl")]).then((function(e){return n.determineFound("Parallels",e[0],e[1])}))},getPodmanInfo:function(){return n.log("trace","getPodmanInfo"),Promise.all([n.run("podman --version").then(n.findVersion),n.which("podman")]).then((function(e){return n.determineFound("Podman",e[0],e[1])}))},getVirtualBoxInfo:function(){return n.log("trace","getVirtualBoxInfo"),Promise.all([n.run("vboxmanage --version").then(n.findVersion),n.which("vboxmanage")]).then((function(e){return n.determineFound("VirtualBox",e[0],e[1])}))},getVMwareFusionInfo:function(){return n.log("trace","getVMwareFusionInfo"),n.getDarwinApplicationVersion("com.vmware.fusion").then((function(e){return n.determineFound("VMWare Fusion",e,"N/A")}))}}},6032:e=>{"use strict";e.exports={androidSystemImages:/system-images;([\S \t]+)/g,androidAPILevels:/platforms;android-(\d+)[\S\s]/g,androidBuildTools:/build-tools;([\d|.]+)[\S\s]/g}},6304:(e,t,r)=>{"use strict";r(4880),r(5584),r(5888),r(7360),r(3708);var n=r(808),o=r(7072),i=r(224),s=function(e){var t=e.split("node_modules"+o.sep),r=t[t.length-1];return"@"===r.charAt(0)?[r.split(o.sep)[0],r.split(o.sep)[1]].join("/"):r.split(o.sep)[0]};e.exports={getnpmPackages:function(e,t){i.log("trace","getnpmPackages"),t||(t={});var r=null,n=null;return"string"==typeof e&&(e.includes("*")||e.includes("?")||e.includes("+")||e.includes("!")?r=e:e=e.split(",")),Promise.all(["npmPackages",i.getPackageJsonByPath("package.json").then((function(e){return Object.assign({},(e||{}).devDependencies||{},(e||{}).dependencies||{})})).then((function(e){return n=e,t.fullTree||t.duplicates||r?i.getAllPackageJsonPaths(r):Promise.resolve(Object.keys(e||[]).map((function(e){return o.join("node_modules",e,"package.json")})))})).then((function(o){return!r&&"boolean"!=typeof e||t.fullTree?Array.isArray(e)?Promise.resolve((o||[]).filter((function(t){return e.includes(s(t))}))):Promise.resolve(o):Promise.resolve((o||[]).filter((function(e){return Object.keys(n||[]).includes(s(e))})))})).then((function(e){return Promise.all([e,Promise.all(e.map((function(e){return i.getPackageJsonByPath(e)})))])})).then((function(e){var r=e[0],o=e[1].reduce((function(e,n,o){return n&&n.name?(e[n.name]||(e[n.name]={}),t.duplicates&&(e[n.name].duplicates=i.uniq((e[n.name].duplicates||[]).concat(n.version))),1===(r[o].match(/node_modules/g)||[]).length&&(e[n.name].installed=n.version),e):e}),{});return Object.keys(o).forEach((function(e){o[e].duplicates&&o[e].installed&&(o[e].duplicates=o[e].duplicates.filter((function(t){return t!==o[e].installed}))),n[e]&&(o[e].wanted=n[e])})),o})).then((function(r){return t.showNotFound&&Array.isArray(e)&&e.forEach((function(e){r[e]||(r[e]="Not Found")})),r})).then((function(e){return i.sortObject(e)}))])},getnpmGlobalPackages:function(e,t){i.log("trace","getnpmGlobalPackages",e);var r=null;return"string"==typeof e?e.includes("*")||e.includes("?")||e.includes("+")||e.includes("!")?r=e:e=e.split(","):Array.isArray(e)||(e=!0),Promise.all(["npmGlobalPackages",i.run("npm get prefix --global").then((function(e){return new Promise((function(t,s){return n(o.join(e,i.isWindows?"":"lib","node_modules",r||"{*,@*/*}","package.json"),(function(e,r){e||t(r),s(e)}))}))})).then((function(t){return Promise.all(t.filter((function(t){return"boolean"==typeof e||null!==r||e.includes(s(t))})).map((function(e){return i.getPackageJsonByFullPath(e)})))})).then((function(e){return e.reduce((function(e,t){return t?Object.assign(e,{[t.name]:t.version}):e}),{})})).then((function(r){return t.showNotFound&&Array.isArray(e)&&e.forEach((function(e){r[e]||(r[e]="Not Found")})),r}))])}}},5088:e=>{"use strict";e.exports={defaults:{System:["OS","CPU","Memory","Container","Shell"],Binaries:["Node","Yarn","npm","pnpm","bun","Watchman"],Managers:["Apt","Cargo","CocoaPods","Composer","Gradle","Homebrew","Maven","pip2","pip3","RubyGems","Yum"],Utilities:["Bazel","CMake","Make","GCC","Git","Clang","Ninja","Mercurial","Subversion","FFmpeg","Curl","OpenSSL"],Servers:["Apache","Nginx"],Virtualization:["Docker","Docker Compose","Parallels","VirtualBox","VMware Fusion"],SDKs:["iOS SDK","Android SDK","Windows SDK"],IDEs:["Android Studio","Atom","Emacs","IntelliJ","NVim","Nano","PhpStorm","Sublime Text","VSCode","Visual Studio","Vim","WebStorm","Xcode"],Languages:["Bash","Go","Elixir","Erlang","Java","Perl","PHP","Protoc","Python","Python3","R","Ruby","Rust","Scala"],Databases:["MongoDB","MySQL","PostgreSQL","SQLite"],Browsers:["Brave Browser","Chrome","Chrome Canary","Chromium","Edge","Firefox","Firefox Developer Edition","Firefox Nightly","Internet Explorer","Safari","Safari Technology Preview"],Monorepos:["Yarn Workspaces","Lerna"],npmPackages:null,npmGlobalPackages:null},jest:{System:["OS","CPU"],Binaries:["Node","Yarn","npm","pnpm","bun"],npmPackages:["jest"]},"react-native":{System:["OS","CPU"],Binaries:["Node","Yarn","npm","pnpm","bun","Watchman"],SDKs:["iOS SDK","Android SDK","Windows SDK"],IDEs:["Android Studio","Xcode","Visual Studio"],npmPackages:["react","react-native"],npmGlobalPackages:["react-native-cli"]},nyc:{System:["OS","CPU","Memory"],Binaries:["Node","Yarn","npm","pnpm","bun"],npmPackages:"/**/{*babel*,@babel/*/,*istanbul*,nyc,source-map-support,typescript,ts-node}"},webpack:{System:["OS","CPU"],Binaries:["Node","Yarn","npm","pnpm","bun"],npmPackages:"*webpack*",npmGlobalPackages:["webpack","webpack-cli"]},"styled-components":{System:["OS","CPU"],Binaries:["Node","Yarn","npm","pnpm","bun"],Browsers:["Chrome","Firefox","Safari"],npmPackages:"*styled-components*"},"create-react-app":{System:["OS","CPU"],Binaries:["Node","npm","Yarn","pnpm","bun"],Browsers:["Chrome","Edge","Internet Explorer","Firefox","Safari"],npmPackages:["react","react-dom","react-scripts"],npmGlobalPackages:["create-react-app"],options:{duplicates:!0,showNotFound:!0}},apollo:{System:["OS"],Binaries:["Node","npm","Yarn","pnpm","bun"],Browsers:["Chrome","Edge","Firefox","Safari"],npmPackages:"{*apollo*,@apollo/*}",npmGlobalPackages:"{*apollo*,@apollo/*}"},"react-native-web":{System:["OS","CPU"],Binaries:["Node","npm","Yarn","pnpm","bun"],Browsers:["Chrome","Edge","Internet Explorer","Firefox","Safari"],npmPackages:["react","react-native-web"],options:{showNotFound:!0}},babel:{System:["OS"],Binaries:["Node","npm","Yarn","pnpm","bun"],Monorepos:["Yarn Workspaces","Lerna"],npmPackages:"{*babel*,@babel/*,eslint,webpack,create-react-app,react-native,lerna,jest}"},playwright:{System:["OS","CPU","Memory","Container"],Binaries:["Node","Yarn","npm","pnpm","bun"],Languages:["Bash"],IDEs:["VSCode"],npmPackages:"{playwright*,@playwright/*}"}}},224:(e,t,r)=>{"use strict";r(4880),r(4260),r(5584),r(7276),r(4228),r(3708),r(8412),r(5308),r(6568),r(5888);var n=r(7072),o=r(2058),i=r(8558),s=r(4368),a=r(8460),c=r(808),u=r(6032),l=function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).unify,r=void 0!==t&&t;return new Promise((function(t){s.exec(e,{stdio:[0,"pipe","ignore"]},(function(e,n,o){var i;i=r?n.toString()+o.toString():n.toString(),t((e?"":i).trim())}))}))},f=function(e){var t=Object.values(Array.prototype.slice.call(arguments).slice(1));(process.env.ENVINFO_DEBUG||"").toLowerCase()===e&&console.log(e,JSON.stringify(t))},p=function(e){return new Promise((function(t){o.readFile(e,"utf8",(function(e,r){return t(r||null)}))}))},h=function(e){return p(e).then((function(e){return e?JSON.parse(e):null}))},d=/\d+\.[\d+|.]+/g,m=function(e){f("trace","findDarwinApplication",e);var t=`mdfind "kMDItemCFBundleIdentifier=='${e}'"`;return f("trace",t),l(t).then((function(e){return e.replace(/(\s)/g,"\\ ")}))},g=function(e,t){var r=(t||["CFBundleShortVersionString"]).map((function(e){return"-c Print:"+e}));return["/usr/libexec/PlistBuddy"].concat(r).concat([e]).join(" ")},v=function(e,t){for(var r=[],n=null;null!==(n=e.exec(t));)r.push(n);return r};e.exports={run:l,log:f,fileExists:function(e){return new Promise((function(t){o.stat(e,(function(r){return t(r?null:e)}))}))},windowsExeExists:function(e){return new Promise((function(t){var r;o.access(r=n.join(process.env.ProgramFiles,`${e}`),o.constants.R_OK,(function(i){i?o.access(r=n.join(process.env["ProgramFiles(x86)"],`${e}`),o.constants.X_OK,(function(e){t(e?null:r)})):t(r)}))}))},readFile:p,requireJson:h,versionRegex:d,findDarwinApplication:m,generatePlistBuddyCommand:g,matchAll:v,parseSDKManagerOutput:function(e){var t=e.split("Available")[0];return{apiLevels:v(u.androidAPILevels,t).map((function(e){return e[1]})),buildTools:v(u.androidBuildTools,t).map((function(e){return e[1]})),systemImages:v(u.androidSystemImages,t).map((function(e){return e[1].split("|").map((function(e){return e.trim()}))})).map((function(e){return e[0].split(";")[0]+" | "+e[2].split(" System Image")[0]}))}},isLinux:"linux"===process.platform,isMacOS:"darwin"===process.platform,NA:"N/A",NotFound:"Not Found",isWindows:process.platform.startsWith("win"),isObject:function(e){return"object"==typeof e&&!Array.isArray(e)},noop:function(e){return e},pipe:function(e){return function(t){return e.reduce((function(e,t){return t(e)}),t)}},browserBundleIdentifiers:{"Brave Browser":"com.brave.Browser",Chrome:"com.google.Chrome","Chrome Canary":"com.google.Chrome.canary",Firefox:"org.mozilla.firefox","Firefox Developer Edition":"org.mozilla.firefoxdeveloperedition","Firefox Nightly":"org.mozilla.nightly","Microsoft Edge":"com.microsoft.edgemac",Safari:"com.apple.Safari","Safari Technology Preview":"com.apple.SafariTechnologyPreview"},ideBundleIdentifiers:{Atom:"com.github.atom",IntelliJ:"com.jetbrains.intellij",PhpStorm:"com.jetbrains.PhpStorm","Sublime Text":"com.sublimetext.3",WebStorm:"com.jetbrains.WebStorm"},runSync:function(e){return(s.execSync(e,{stdio:[0,"pipe","ignore"]}).toString()||"").trim()},which:function(e){return new Promise((function(t){return a(e,(function(e,r){return t(r)}))}))},getDarwinApplicationVersion:function(e){var t;return f("trace","getDarwinApplicationVersion",e),t="darwin"!==process.platform?"N/A":m(e).then((function(e){return l(g(n.join(e,"Contents","Info.plist"),["CFBundleShortVersionString"]))})),Promise.resolve(t)},uniq:function(e){return Array.from(new Set(e))},toReadableBytes:function(e){var t=Math.floor(Math.log(e)/Math.log(1024));return e?(e/Math.pow(1024,t)).toFixed(2)+" "+["B","KB","MB","GB","TB","PB"][t]:"0 Bytes"},omit:function(e,t){return Object.keys(e).filter((function(e){return t.indexOf(e)<0})).reduce((function(t,r){return Object.assign(t,{[r]:e[r]})}),{})},pick:function(e,t){return Object.keys(e).filter((function(e){return t.indexOf(e)>=0})).reduce((function(t,r){return Object.assign(t,{[r]:e[r]})}),{})},getPackageJsonByName:function(e){return h(n.join(process.cwd(),"node_modules",e,"package.json"))},getPackageJsonByPath:function(e){return h(n.join(process.cwd(),e))},getPackageJsonByFullPath:function(e){return f("trace","getPackageJsonByFullPath",e),h(e)},getAllPackageJsonPaths:function(e){return f("trace","getAllPackageJsonPaths",e),new Promise((function(t){return c(e?n.join("node_modules",e,"package.json"):n.join("node_modules","**","package.json"),(function(e,r){return t(r.map(n.normalize)||[])}))}))},sortObject:function(e){return Object.keys(e).sort().reduce((function(t,r){return t[r]=e[r],t}),{})},findVersion:function(e,t,r){f("trace","findVersion",e,t,r);var n=r||0,o=t||d,i=e.match(o);return i?i[n]:e},condensePath:function(e){return(e||"").replace(i.homedir(),"~")},determineFound:function(e,t,r){return f("trace","determineFound",e,t,r),"N/A"===t?Promise.resolve([e,"N/A"]):t&&0!==Object.keys(t).length?r?Promise.resolve([e,t,r]):Promise.resolve([e,t]):Promise.resolve([e,"Not Found"])}}},9016:e=>{"use strict";function t(e,t,o){e instanceof RegExp&&(e=r(e,o)),t instanceof RegExp&&(t=r(t,o));var i=n(e,t,o);return i&&{start:i[0],end:i[1],pre:o.slice(0,i[0]),body:o.slice(i[0]+e.length,i[1]),post:o.slice(i[1]+t.length)}}function r(e,t){var r=t.match(e);return r?r[0]:null}function n(e,t,r){var n,o,i,s,a,c=r.indexOf(e),u=r.indexOf(t,c+1),l=c;if(c>=0&&u>0){for(n=[],i=r.length;l>=0&&!a;)l==c?(n.push(l),c=r.indexOf(e,l+1)):1==n.length?a=[n.pop(),u]:((o=n.pop())=0?c:u;n.length&&(a=[i,s])}return a}e.exports=t,t.range=n},1620:(e,t,r)=>{var n=r(6596),o=r(9016);e.exports=function(e){return e?("{}"===e.substr(0,2)&&(e="\\{\\}"+e.substr(2)),v(function(e){return e.split("\\\\").join(i).split("\\{").join(s).split("\\}").join(a).split("\\,").join(c).split("\\.").join(u)}(e),!0).map(f)):[]};var i="\0SLASH"+Math.random()+"\0",s="\0OPEN"+Math.random()+"\0",a="\0CLOSE"+Math.random()+"\0",c="\0COMMA"+Math.random()+"\0",u="\0PERIOD"+Math.random()+"\0";function l(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function f(e){return e.split(i).join("\\").split(s).join("{").split(a).join("}").split(c).join(",").split(u).join(".")}function p(e){if(!e)return[""];var t=[],r=o("{","}",e);if(!r)return e.split(",");var n=r.pre,i=r.body,s=r.post,a=n.split(",");a[a.length-1]+="{"+i+"}";var c=p(s);return s.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),t.push.apply(t,a),t}function h(e){return"{"+e+"}"}function d(e){return/^-?0\d/.test(e)}function m(e,t){return e<=t}function g(e,t){return e>=t}function v(e,t){var r=[],i=o("{","}",e);if(!i||/\$$/.test(i.pre))return[e];var s,c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),f=c||u,y=i.body.indexOf(",")>=0;if(!f&&!y)return i.post.match(/,.*\}/)?v(e=i.pre+"{"+i.body+a+i.post):[e];if(f)s=i.body.split(/\.\./);else if(1===(s=p(i.body)).length&&1===(s=v(s[0],!1).map(h)).length)return(x=i.post.length?v(i.post,!1):[""]).map((function(e){return i.pre+s[0]+e}));var b,w=i.pre,x=i.post.length?v(i.post,!1):[""];if(f){var S=l(s[0]),P=l(s[1]),O=Math.max(s[0].length,s[1].length),I=3==s.length?Math.abs(l(s[2])):1,E=m;P0){var N=new Array(k+1).join("0");A=_<0?"-"+N+A.slice(1):N+A}}b.push(A)}}else b=n(s,(function(e){return v(e,!1)}));for(var F=0;F{e.exports=function(e,r){for(var n=[],o=0;o{e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},7384:(e,t,r)=>{var n=r(7096)("unscopables"),o=Array.prototype;null==o[n]&&r(2336)(o,n,{}),e.exports=function(e){o[n][e]=!0}},2388:e=>{e.exports=function(e,t,r,n){if(!(e instanceof t)||void 0!==n&&n in e)throw TypeError(r+": incorrect invocation!");return e}},3504:(e,t,r)=>{var n=r(3888);e.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},7504:(e,t,r)=>{var n=r(2780),o=r(3528),i=r(8508);e.exports=function(e){return function(t,r,s){var a,c=n(t),u=o(c.length),l=i(s,u);if(e&&r!=r){for(;u>l;)if((a=c[l++])!=a)return!0}else for(;u>l;l++)if((e||l in c)&&c[l]===r)return e||l||0;return!e&&-1}}},5848:(e,t,r)=>{var n=r(6924),o=r(7096)("toStringTag"),i="Arguments"==n(function(){return arguments}());e.exports=function(e){var t,r,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),o))?r:i?n(t):"Object"==(s=n(t))&&"function"==typeof t.callee?"Arguments":s}},6924:e=>{var t={}.toString;e.exports=function(e){return t.call(e).slice(8,-1)}},148:(e,t,r)=>{"use strict";var n=r(8520).f,o=r(3472),i=r(7704),s=r(800),a=r(2388),c=r(7228),u=r(6952),l=r(172),f=r(3384),p=r(1668),h=r(2020).fastKey,d=r(2772),m=p?"_s":"size",g=function(e,t){var r,n=h(t);if("F"!==n)return e._i[n];for(r=e._f;r;r=r.n)if(r.k==t)return r};e.exports={getConstructor:function(e,t,r,u){var l=e((function(e,n){a(e,l,t,"_i"),e._t=t,e._i=o(null),e._f=void 0,e._l=void 0,e[m]=0,null!=n&&c(n,r,e[u],e)}));return i(l.prototype,{clear:function(){for(var e=d(this,t),r=e._i,n=e._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete r[n.i];e._f=e._l=void 0,e[m]=0},delete:function(e){var r=d(this,t),n=g(r,e);if(n){var o=n.n,i=n.p;delete r._i[n.i],n.r=!0,i&&(i.n=o),o&&(o.p=i),r._f==n&&(r._f=o),r._l==n&&(r._l=i),r[m]--}return!!n},forEach:function(e){d(this,t);for(var r,n=s(e,arguments.length>1?arguments[1]:void 0,3);r=r?r.n:this._f;)for(n(r.v,r.k,this);r&&r.r;)r=r.p},has:function(e){return!!g(d(this,t),e)}}),p&&n(l.prototype,"size",{get:function(){return d(this,t)[m]}}),l},def:function(e,t,r){var n,o,i=g(e,t);return i?i.v=r:(e._l=i={i:o=h(t,!0),k:t,v:r,p:n=e._l,n:void 0,r:!1},e._f||(e._f=i),n&&(n.n=i),e[m]++,"F"!==o&&(e._i[o]=i)),e},getEntry:g,setStrong:function(e,t,r){u(e,t,(function(e,r){this._t=d(e,t),this._k=r,this._l=void 0}),(function(){for(var e=this,t=e._k,r=e._l;r&&r.r;)r=r.p;return e._t&&(e._l=r=r?r.n:e._t._f)?l(0,"keys"==t?r.k:"values"==t?r.v:[r.k,r.v]):(e._t=void 0,l(1))}),r?"entries":"values",!r,!0),f(t)}}},9412:(e,t,r)=>{"use strict";var n=r(2804),o=r(7076),i=r(8868),s=r(7704),a=r(2020),c=r(7228),u=r(2388),l=r(3888),f=r(9316),p=r(8380),h=r(6256),d=r(2672);e.exports=function(e,t,r,m,g,v){var y=n[e],b=y,w=g?"set":"add",x=b&&b.prototype,S={},P=function(e){var t=x[e];i(x,e,"delete"==e||"has"==e?function(e){return!(v&&!l(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return v&&!l(e)?void 0:t.call(this,0===e?0:e)}:"add"==e?function(e){return t.call(this,0===e?0:e),this}:function(e,r){return t.call(this,0===e?0:e,r),this})};if("function"==typeof b&&(v||x.forEach&&!f((function(){(new b).entries().next()})))){var O=new b,I=O[w](v?{}:-0,1)!=O,E=f((function(){O.has(1)})),j=p((function(e){new b(e)})),_=!v&&f((function(){for(var e=new b,t=5;t--;)e[w](t,t);return!e.has(-0)}));j||((b=t((function(t,r){u(t,b,e);var n=d(new y,t,b);return null!=r&&c(r,g,n[w],n),n}))).prototype=x,x.constructor=b),(E||_)&&(P("delete"),P("has"),g&&P("get")),(_||I)&&P(w),v&&x.clear&&delete x.clear}else b=m.getConstructor(t,e,g,w),s(b.prototype,r),a.NEED=!0;return h(b,e),S[e]=b,o(o.G+o.W+o.F*(b!=y),S),v||m.setStrong(b,e,g),b}},8432:e=>{var t=e.exports={version:"2.5.7"};"number"==typeof __e&&(__e=t)},2340:(e,t,r)=>{"use strict";var n=r(8520),o=r(8164);e.exports=function(e,t,r){t in e?n.f(e,t,o(0,r)):e[t]=r}},800:(e,t,r)=>{var n=r(2016);e.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,o){return e.call(t,r,n,o)}}return function(){return e.apply(t,arguments)}}},24:e=>{e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},1668:(e,t,r)=>{e.exports=!r(9316)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},1300:(e,t,r)=>{var n=r(3888),o=r(2804).document,i=n(o)&&n(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},444:e=>{e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},7076:(e,t,r)=>{var n=r(2804),o=r(8432),i=r(2336),s=r(8868),a=r(800),c="prototype",u=function(e,t,r){var l,f,p,h,d=e&u.F,m=e&u.G,g=e&u.S,v=e&u.P,y=e&u.B,b=m?n:g?n[t]||(n[t]={}):(n[t]||{})[c],w=m?o:o[t]||(o[t]={}),x=w[c]||(w[c]={});for(l in m&&(r=t),r)p=((f=!d&&b&&void 0!==b[l])?b:r)[l],h=y&&f?a(p,n):v&&"function"==typeof p?a(Function.call,p):p,b&&s(b,l,p,e&u.U),w[l]!=p&&i(w,l,h),v&&x[l]!=p&&(x[l]=p)};n.core=o,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u},9316:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},4448:(e,t,r)=>{"use strict";var n=r(2336),o=r(8868),i=r(9316),s=r(24),a=r(7096);e.exports=function(e,t,r){var c=a(e),u=r(s,c,""[e]),l=u[0],f=u[1];i((function(){var t={};return t[c]=function(){return 7},7!=""[e](t)}))&&(o(String.prototype,e,l),n(RegExp.prototype,c,2==t?function(e,t){return f.call(e,this,t)}:function(e){return f.call(e,this)}))}},8068:(e,t,r)=>{"use strict";var n=r(3504);e.exports=function(){var e=n(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},7228:(e,t,r)=>{var n=r(800),o=r(2372),i=r(3164),s=r(3504),a=r(3528),c=r(2800),u={},l={},f=e.exports=function(e,t,r,f,p){var h,d,m,g,v=p?function(){return e}:c(e),y=n(r,f,t?2:1),b=0;if("function"!=typeof v)throw TypeError(e+" is not iterable!");if(i(v)){for(h=a(e.length);h>b;b++)if((g=t?y(s(d=e[b])[0],d[1]):y(e[b]))===u||g===l)return g}else for(m=v.call(e);!(d=m.next()).done;)if((g=o(m,y,d.value,t))===u||g===l)return g};f.BREAK=u,f.RETURN=l},2804:e=>{var t=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)},9080:e=>{var t={}.hasOwnProperty;e.exports=function(e,r){return t.call(e,r)}},2336:(e,t,r)=>{var n=r(8520),o=r(8164);e.exports=r(1668)?function(e,t,r){return n.f(e,t,o(1,r))}:function(e,t,r){return e[t]=r,e}},4016:(e,t,r)=>{var n=r(2804).document;e.exports=n&&n.documentElement},5516:(e,t,r)=>{e.exports=!r(1668)&&!r(9316)((function(){return 7!=Object.defineProperty(r(1300)("div"),"a",{get:function(){return 7}}).a}))},2672:(e,t,r)=>{var n=r(3888),o=r(5076).set;e.exports=function(e,t,r){var i,s=t.constructor;return s!==r&&"function"==typeof s&&(i=s.prototype)!==r.prototype&&n(i)&&o&&o(e,i),e}},5628:e=>{e.exports=function(e,t,r){var n=void 0===r;switch(t.length){case 0:return n?e():e.call(r);case 1:return n?e(t[0]):e.call(r,t[0]);case 2:return n?e(t[0],t[1]):e.call(r,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(r,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(r,t[0],t[1],t[2],t[3])}return e.apply(r,t)}},2936:(e,t,r)=>{var n=r(6924);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==n(e)?e.split(""):Object(e)}},3164:(e,t,r)=>{var n=r(2488),o=r(7096)("iterator"),i=Array.prototype;e.exports=function(e){return void 0!==e&&(n.Array===e||i[o]===e)}},3888:e=>{e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},7760:(e,t,r)=>{var n=r(3888),o=r(6924),i=r(7096)("match");e.exports=function(e){var t;return n(e)&&(void 0!==(t=e[i])?!!t:"RegExp"==o(e))}},2372:(e,t,r)=>{var n=r(3504);e.exports=function(e,t,r,o){try{return o?t(n(r)[0],r[1]):t(r)}catch(t){var i=e.return;throw void 0!==i&&n(i.call(e)),t}}},128:(e,t,r)=>{"use strict";var n=r(3472),o=r(8164),i=r(6256),s={};r(2336)(s,r(7096)("iterator"),(function(){return this})),e.exports=function(e,t,r){e.prototype=n(s,{next:o(1,r)}),i(e,t+" Iterator")}},6952:(e,t,r)=>{"use strict";var n=r(4440),o=r(7076),i=r(8868),s=r(2336),a=r(2488),c=r(128),u=r(6256),l=r(9556),f=r(7096)("iterator"),p=!([].keys&&"next"in[].keys()),h="keys",d="values",m=function(){return this};e.exports=function(e,t,r,g,v,y,b){c(r,t,g);var w,x,S,P=function(e){if(!p&&e in j)return j[e];switch(e){case h:case d:return function(){return new r(this,e)}}return function(){return new r(this,e)}},O=t+" Iterator",I=v==d,E=!1,j=e.prototype,_=j[f]||j["@@iterator"]||v&&j[v],A=_||P(v),k=v?I?P("entries"):A:void 0,N="Array"==t&&j.entries||_;if(N&&(S=l(N.call(new e)))!==Object.prototype&&S.next&&(u(S,O,!0),n||"function"==typeof S[f]||s(S,f,m)),I&&_&&_.name!==d&&(E=!0,A=function(){return _.call(this)}),n&&!b||!p&&!E&&j[f]||s(j,f,A),a[t]=A,a[O]=m,v)if(w={values:I?A:P(d),keys:y?A:P(h),entries:k},b)for(x in w)x in j||i(j,x,w[x]);else o(o.P+o.F*(p||E),t,w);return w}},8380:(e,t,r)=>{var n=r(7096)("iterator"),o=!1;try{var i=[7][n]();i.return=function(){o=!0},Array.from(i,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var r=!1;try{var i=[7],s=i[n]();s.next=function(){return{done:r=!0}},i[n]=function(){return s},e(i)}catch(e){}return r}},172:e=>{e.exports=function(e,t){return{value:t,done:!!e}}},2488:e=>{e.exports={}},4440:e=>{e.exports=!1},2020:(e,t,r)=>{var n=r(9664)("meta"),o=r(3888),i=r(9080),s=r(8520).f,a=0,c=Object.isExtensible||function(){return!0},u=!r(9316)((function(){return c(Object.preventExtensions({}))})),l=function(e){s(e,n,{value:{i:"O"+ ++a,w:{}}})},f=e.exports={KEY:n,NEED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,n)){if(!c(e))return"F";if(!t)return"E";l(e)}return e[n].i},getWeak:function(e,t){if(!i(e,n)){if(!c(e))return!0;if(!t)return!1;l(e)}return e[n].w},onFreeze:function(e){return u&&f.NEED&&c(e)&&!i(e,n)&&l(e),e}}},448:(e,t,r)=>{var n=r(2804),o=r(2280).set,i=n.MutationObserver||n.WebKitMutationObserver,s=n.process,a=n.Promise,c="process"==r(6924)(s);e.exports=function(){var e,t,r,u=function(){var n,o;for(c&&(n=s.domain)&&n.exit();e;){o=e.fn,e=e.next;try{o()}catch(n){throw e?r():t=void 0,n}}t=void 0,n&&n.enter()};if(c)r=function(){s.nextTick(u)};else if(!i||n.navigator&&n.navigator.standalone)if(a&&a.resolve){var l=a.resolve(void 0);r=function(){l.then(u)}}else r=function(){o.call(n,u)};else{var f=!0,p=document.createTextNode("");new i(u).observe(p,{characterData:!0}),r=function(){p.data=f=!f}}return function(n){var o={fn:n,next:void 0};t&&(t.next=o),e||(e=o,r()),t=o}}},8024:(e,t,r)=>{"use strict";var n=r(2016);function o(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n})),this.resolve=n(t),this.reject=n(r)}e.exports.f=function(e){return new o(e)}},6472:(e,t,r)=>{"use strict";var n=r(5444),o=r(5364),i=r(3875),s=r(1164),a=r(2936),c=Object.assign;e.exports=!c||r(9316)((function(){var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=c({},e)[r]||Object.keys(c({},t)).join("")!=n}))?function(e,t){for(var r=s(e),c=arguments.length,u=1,l=o.f,f=i.f;c>u;)for(var p,h=a(arguments[u++]),d=l?n(h).concat(l(h)):n(h),m=d.length,g=0;m>g;)f.call(h,p=d[g++])&&(r[p]=h[p]);return r}:c},3472:(e,t,r)=>{var n=r(3504),o=r(1176),i=r(444),s=r(4588)("IE_PROTO"),a=function(){},c="prototype",u=function(){var e,t=r(1300)("iframe"),n=i.length;for(t.style.display="none",r(4016).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write(" -``` - -This bundle can be used with different module systems; it creates global `Ajv` if no module system is found. - -The browser bundle is available on [cdnjs](https://cdnjs.com/libraries/ajv). - -Ajv is tested with these browsers: - -[![Sauce Test Status](https://saucelabs.com/browser-matrix/epoberezkin.svg)](https://saucelabs.com/u/epoberezkin) - -__Please note__: some frameworks, e.g. Dojo, may redefine global require in such way that is not compatible with CommonJS module format. In such case Ajv bundle has to be loaded before the framework and then you can use global Ajv (see issue [#234](https://github.com/ajv-validator/ajv/issues/234)). - - -### Ajv and Content Security Policies (CSP) - -If you're using Ajv to compile a schema (the typical use) in a browser document that is loaded with a Content Security Policy (CSP), that policy will require a `script-src` directive that includes the value `'unsafe-eval'`. -:warning: NOTE, however, that `unsafe-eval` is NOT recommended in a secure CSP[[1]](https://developer.chrome.com/extensions/contentSecurityPolicy#relaxing-eval), as it has the potential to open the document to cross-site scripting (XSS) attacks. - -In order to make use of Ajv without easing your CSP, you can [pre-compile a schema using the CLI](https://github.com/ajv-validator/ajv-cli#compile-schemas). This will transpile the schema JSON into a JavaScript file that exports a `validate` function that works simlarly to a schema compiled at runtime. - -Note that pre-compilation of schemas is performed using [ajv-pack](https://github.com/ajv-validator/ajv-pack) and there are [some limitations to the schema features it can compile](https://github.com/ajv-validator/ajv-pack#limitations). A successfully pre-compiled schema is equivalent to the same schema compiled at runtime. - - -## Command line interface - -CLI is available as a separate npm package [ajv-cli](https://github.com/ajv-validator/ajv-cli). It supports: - -- compiling JSON Schemas to test their validity -- BETA: generating standalone module exporting a validation function to be used without Ajv (using [ajv-pack](https://github.com/ajv-validator/ajv-pack)) -- migrate schemas to draft-07 (using [json-schema-migrate](https://github.com/epoberezkin/json-schema-migrate)) -- validating data file(s) against JSON Schema -- testing expected validity of data against JSON Schema -- referenced schemas -- custom meta-schemas -- files in JSON, JSON5, YAML, and JavaScript format -- all Ajv options -- reporting changes in data after validation in [JSON-patch](https://tools.ietf.org/html/rfc6902) format - - -## Validation keywords - -Ajv supports all validation keywords from draft-07 of JSON Schema standard: - -- [type](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#type) -- [for numbers](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-numbers) - maximum, minimum, exclusiveMaximum, exclusiveMinimum, multipleOf -- [for strings](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-strings) - maxLength, minLength, pattern, format -- [for arrays](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-arrays) - maxItems, minItems, uniqueItems, items, additionalItems, [contains](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#contains) -- [for objects](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-objects) - maxProperties, minProperties, required, properties, patternProperties, additionalProperties, dependencies, [propertyNames](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#propertynames) -- [for all types](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-all-types) - enum, [const](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#const) -- [compound keywords](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#compound-keywords) - not, oneOf, anyOf, allOf, [if/then/else](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#ifthenelse) - -With [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package Ajv also supports validation keywords from [JSON Schema extension proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals) for JSON Schema standard: - -- [patternRequired](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#patternrequired-proposed) - like `required` but with patterns that some property should match. -- [formatMaximum, formatMinimum, formatExclusiveMaximum, formatExclusiveMinimum](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#formatmaximum--formatminimum-and-exclusiveformatmaximum--exclusiveformatminimum-proposed) - setting limits for date, time, etc. - -See [JSON Schema validation keywords](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md) for more details. - - -## Annotation keywords - -JSON Schema specification defines several annotation keywords that describe schema itself but do not perform any validation. - -- `title` and `description`: information about the data represented by that schema -- `$comment` (NEW in draft-07): information for developers. With option `$comment` Ajv logs or passes the comment string to the user-supplied function. See [Options](#options). -- `default`: a default value of the data instance, see [Assigning defaults](#assigning-defaults). -- `examples` (NEW in draft-06): an array of data instances. Ajv does not check the validity of these instances against the schema. -- `readOnly` and `writeOnly` (NEW in draft-07): marks data-instance as read-only or write-only in relation to the source of the data (database, api, etc.). -- `contentEncoding`: [RFC 2045](https://tools.ietf.org/html/rfc2045#section-6.1 ), e.g., "base64". -- `contentMediaType`: [RFC 2046](https://tools.ietf.org/html/rfc2046), e.g., "image/png". - -__Please note__: Ajv does not implement validation of the keywords `examples`, `contentEncoding` and `contentMediaType` but it reserves them. If you want to create a plugin that implements some of them, it should remove these keywords from the instance. - - -## Formats - -Ajv implements formats defined by JSON Schema specification and several other formats. It is recommended NOT to use "format" keyword implementations with untrusted data, as they use potentially unsafe regular expressions - see [ReDoS attack](#redos-attack). - -__Please note__: if you need to use "format" keyword to validate untrusted data, you MUST assess their suitability and safety for your validation scenarios. - -The following formats are implemented for string validation with "format" keyword: - -- _date_: full-date according to [RFC3339](http://tools.ietf.org/html/rfc3339#section-5.6). -- _time_: time with optional time-zone. -- _date-time_: date-time from the same source (time-zone is mandatory). `date`, `time` and `date-time` validate ranges in `full` mode and only regexp in `fast` mode (see [options](#options)). -- _uri_: full URI. -- _uri-reference_: URI reference, including full and relative URIs. -- _uri-template_: URI template according to [RFC6570](https://tools.ietf.org/html/rfc6570) -- _url_ (deprecated): [URL record](https://url.spec.whatwg.org/#concept-url). -- _email_: email address. -- _hostname_: host name according to [RFC1034](http://tools.ietf.org/html/rfc1034#section-3.5). -- _ipv4_: IP address v4. -- _ipv6_: IP address v6. -- _regex_: tests whether a string is a valid regular expression by passing it to RegExp constructor. -- _uuid_: Universally Unique IDentifier according to [RFC4122](http://tools.ietf.org/html/rfc4122). -- _json-pointer_: JSON-pointer according to [RFC6901](https://tools.ietf.org/html/rfc6901). -- _relative-json-pointer_: relative JSON-pointer according to [this draft](http://tools.ietf.org/html/draft-luff-relative-json-pointer-00). - -__Please note__: JSON Schema draft-07 also defines formats `iri`, `iri-reference`, `idn-hostname` and `idn-email` for URLs, hostnames and emails with international characters. Ajv does not implement these formats. If you create Ajv plugin that implements them please make a PR to mention this plugin here. - -There are two modes of format validation: `fast` and `full`. This mode affects formats `date`, `time`, `date-time`, `uri`, `uri-reference`, and `email`. See [Options](#options) for details. - -You can add additional formats and replace any of the formats above using [addFormat](#api-addformat) method. - -The option `unknownFormats` allows changing the default behaviour when an unknown format is encountered. In this case Ajv can either fail schema compilation (default) or ignore it (default in versions before 5.0.0). You also can allow specific format(s) that will be ignored. See [Options](#options) for details. - -You can find regular expressions used for format validation and the sources that were used in [formats.js](https://github.com/ajv-validator/ajv/blob/master/lib/compile/formats.js). - - -## Combining schemas with $ref - -You can structure your validation logic across multiple schema files and have schemas reference each other using `$ref` keyword. - -Example: - -```javascript -var schema = { - "$id": "http://example.com/schemas/schema.json", - "type": "object", - "properties": { - "foo": { "$ref": "defs.json#/definitions/int" }, - "bar": { "$ref": "defs.json#/definitions/str" } - } -}; - -var defsSchema = { - "$id": "http://example.com/schemas/defs.json", - "definitions": { - "int": { "type": "integer" }, - "str": { "type": "string" } - } -}; -``` - -Now to compile your schema you can either pass all schemas to Ajv instance: - -```javascript -var ajv = new Ajv({schemas: [schema, defsSchema]}); -var validate = ajv.getSchema('http://example.com/schemas/schema.json'); -``` - -or use `addSchema` method: - -```javascript -var ajv = new Ajv; -var validate = ajv.addSchema(defsSchema) - .compile(schema); -``` - -See [Options](#options) and [addSchema](#api) method. - -__Please note__: -- `$ref` is resolved as the uri-reference using schema $id as the base URI (see the example). -- References can be recursive (and mutually recursive) to implement the schemas for different data structures (such as linked lists, trees, graphs, etc.). -- You don't have to host your schema files at the URIs that you use as schema $id. These URIs are only used to identify the schemas, and according to JSON Schema specification validators should not expect to be able to download the schemas from these URIs. -- The actual location of the schema file in the file system is not used. -- You can pass the identifier of the schema as the second parameter of `addSchema` method or as a property name in `schemas` option. This identifier can be used instead of (or in addition to) schema $id. -- You cannot have the same $id (or the schema identifier) used for more than one schema - the exception will be thrown. -- You can implement dynamic resolution of the referenced schemas using `compileAsync` method. In this way you can store schemas in any system (files, web, database, etc.) and reference them without explicitly adding to Ajv instance. See [Asynchronous schema compilation](#asynchronous-schema-compilation). - - -## $data reference - -With `$data` option you can use values from the validated data as the values for the schema keywords. See [proposal](https://github.com/json-schema-org/json-schema-spec/issues/51) for more information about how it works. - -`$data` reference is supported in the keywords: const, enum, format, maximum/minimum, exclusiveMaximum / exclusiveMinimum, maxLength / minLength, maxItems / minItems, maxProperties / minProperties, formatMaximum / formatMinimum, formatExclusiveMaximum / formatExclusiveMinimum, multipleOf, pattern, required, uniqueItems. - -The value of "$data" should be a [JSON-pointer](https://tools.ietf.org/html/rfc6901) to the data (the root is always the top level data object, even if the $data reference is inside a referenced subschema) or a [relative JSON-pointer](http://tools.ietf.org/html/draft-luff-relative-json-pointer-00) (it is relative to the current point in data; if the $data reference is inside a referenced subschema it cannot point to the data outside of the root level for this subschema). - -Examples. - -This schema requires that the value in property `smaller` is less or equal than the value in the property larger: - -```javascript -var ajv = new Ajv({$data: true}); - -var schema = { - "properties": { - "smaller": { - "type": "number", - "maximum": { "$data": "1/larger" } - }, - "larger": { "type": "number" } - } -}; - -var validData = { - smaller: 5, - larger: 7 -}; - -ajv.validate(schema, validData); // true -``` - -This schema requires that the properties have the same format as their field names: - -```javascript -var schema = { - "additionalProperties": { - "type": "string", - "format": { "$data": "0#" } - } -}; - -var validData = { - 'date-time': '1963-06-19T08:30:06.283185Z', - email: 'joe.bloggs@example.com' -} -``` - -`$data` reference is resolved safely - it won't throw even if some property is undefined. If `$data` resolves to `undefined` the validation succeeds (with the exclusion of `const` keyword). If `$data` resolves to incorrect type (e.g. not "number" for maximum keyword) the validation fails. - - -## $merge and $patch keywords - -With the package [ajv-merge-patch](https://github.com/ajv-validator/ajv-merge-patch) you can use the keywords `$merge` and `$patch` that allow extending JSON Schemas with patches using formats [JSON Merge Patch (RFC 7396)](https://tools.ietf.org/html/rfc7396) and [JSON Patch (RFC 6902)](https://tools.ietf.org/html/rfc6902). - -To add keywords `$merge` and `$patch` to Ajv instance use this code: - -```javascript -require('ajv-merge-patch')(ajv); -``` - -Examples. - -Using `$merge`: - -```json -{ - "$merge": { - "source": { - "type": "object", - "properties": { "p": { "type": "string" } }, - "additionalProperties": false - }, - "with": { - "properties": { "q": { "type": "number" } } - } - } -} -``` - -Using `$patch`: - -```json -{ - "$patch": { - "source": { - "type": "object", - "properties": { "p": { "type": "string" } }, - "additionalProperties": false - }, - "with": [ - { "op": "add", "path": "/properties/q", "value": { "type": "number" } } - ] - } -} -``` - -The schemas above are equivalent to this schema: - -```json -{ - "type": "object", - "properties": { - "p": { "type": "string" }, - "q": { "type": "number" } - }, - "additionalProperties": false -} -``` - -The properties `source` and `with` in the keywords `$merge` and `$patch` can use absolute or relative `$ref` to point to other schemas previously added to the Ajv instance or to the fragments of the current schema. - -See the package [ajv-merge-patch](https://github.com/ajv-validator/ajv-merge-patch) for more information. - - -## Defining custom keywords - -The advantages of using custom keywords are: - -- allow creating validation scenarios that cannot be expressed using JSON Schema -- simplify your schemas -- help bringing a bigger part of the validation logic to your schemas -- make your schemas more expressive, less verbose and closer to your application domain -- implement custom data processors that modify your data (`modifying` option MUST be used in keyword definition) and/or create side effects while the data is being validated - -If a keyword is used only for side-effects and its validation result is pre-defined, use option `valid: true/false` in keyword definition to simplify both generated code (no error handling in case of `valid: true`) and your keyword functions (no need to return any validation result). - -The concerns you have to be aware of when extending JSON Schema standard with custom keywords are the portability and understanding of your schemas. You will have to support these custom keywords on other platforms and to properly document these keywords so that everybody can understand them in your schemas. - -You can define custom keywords with [addKeyword](#api-addkeyword) method. Keywords are defined on the `ajv` instance level - new instances will not have previously defined keywords. - -Ajv allows defining keywords with: -- validation function -- compilation function -- macro function -- inline compilation function that should return code (as string) that will be inlined in the currently compiled schema. - -Example. `range` and `exclusiveRange` keywords using compiled schema: - -```javascript -ajv.addKeyword('range', { - type: 'number', - compile: function (sch, parentSchema) { - var min = sch[0]; - var max = sch[1]; - - return parentSchema.exclusiveRange === true - ? function (data) { return data > min && data < max; } - : function (data) { return data >= min && data <= max; } - } -}); - -var schema = { "range": [2, 4], "exclusiveRange": true }; -var validate = ajv.compile(schema); -console.log(validate(2.01)); // true -console.log(validate(3.99)); // true -console.log(validate(2)); // false -console.log(validate(4)); // false -``` - -Several custom keywords (typeof, instanceof, range and propertyNames) are defined in [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package - they can be used for your schemas and as a starting point for your own custom keywords. - -See [Defining custom keywords](https://github.com/ajv-validator/ajv/blob/master/CUSTOM.md) for more details. - - -## Asynchronous schema compilation - -During asynchronous compilation remote references are loaded using supplied function. See `compileAsync` [method](#api-compileAsync) and `loadSchema` [option](#options). - -Example: - -```javascript -var ajv = new Ajv({ loadSchema: loadSchema }); - -ajv.compileAsync(schema).then(function (validate) { - var valid = validate(data); - // ... -}); - -function loadSchema(uri) { - return request.json(uri).then(function (res) { - if (res.statusCode >= 400) - throw new Error('Loading error: ' + res.statusCode); - return res.body; - }); -} -``` - -__Please note__: [Option](#options) `missingRefs` should NOT be set to `"ignore"` or `"fail"` for asynchronous compilation to work. - - -## Asynchronous validation - -Example in Node.js REPL: https://tonicdev.com/esp/ajv-asynchronous-validation - -You can define custom formats and keywords that perform validation asynchronously by accessing database or some other service. You should add `async: true` in the keyword or format definition (see [addFormat](#api-addformat), [addKeyword](#api-addkeyword) and [Defining custom keywords](#defining-custom-keywords)). - -If your schema uses asynchronous formats/keywords or refers to some schema that contains them it should have `"$async": true` keyword so that Ajv can compile it correctly. If asynchronous format/keyword or reference to asynchronous schema is used in the schema without `$async` keyword Ajv will throw an exception during schema compilation. - -__Please note__: all asynchronous subschemas that are referenced from the current or other schemas should have `"$async": true` keyword as well, otherwise the schema compilation will fail. - -Validation function for an asynchronous custom format/keyword should return a promise that resolves with `true` or `false` (or rejects with `new Ajv.ValidationError(errors)` if you want to return custom errors from the keyword function). - -Ajv compiles asynchronous schemas to [es7 async functions](http://tc39.github.io/ecmascript-asyncawait/) that can optionally be transpiled with [nodent](https://github.com/MatAtBread/nodent). Async functions are supported in Node.js 7+ and all modern browsers. You can also supply any other transpiler as a function via `processCode` option. See [Options](#options). - -The compiled validation function has `$async: true` property (if the schema is asynchronous), so you can differentiate these functions if you are using both synchronous and asynchronous schemas. - -Validation result will be a promise that resolves with validated data or rejects with an exception `Ajv.ValidationError` that contains the array of validation errors in `errors` property. - - -Example: - -```javascript -var ajv = new Ajv; -// require('ajv-async')(ajv); - -ajv.addKeyword('idExists', { - async: true, - type: 'number', - validate: checkIdExists -}); - - -function checkIdExists(schema, data) { - return knex(schema.table) - .select('id') - .where('id', data) - .then(function (rows) { - return !!rows.length; // true if record is found - }); -} - -var schema = { - "$async": true, - "properties": { - "userId": { - "type": "integer", - "idExists": { "table": "users" } - }, - "postId": { - "type": "integer", - "idExists": { "table": "posts" } - } - } -}; - -var validate = ajv.compile(schema); - -validate({ userId: 1, postId: 19 }) -.then(function (data) { - console.log('Data is valid', data); // { userId: 1, postId: 19 } -}) -.catch(function (err) { - if (!(err instanceof Ajv.ValidationError)) throw err; - // data is invalid - console.log('Validation errors:', err.errors); -}); -``` - -### Using transpilers with asynchronous validation functions. - -[ajv-async](https://github.com/ajv-validator/ajv-async) uses [nodent](https://github.com/MatAtBread/nodent) to transpile async functions. To use another transpiler you should separately install it (or load its bundle in the browser). - - -#### Using nodent - -```javascript -var ajv = new Ajv; -require('ajv-async')(ajv); -// in the browser if you want to load ajv-async bundle separately you can: -// window.ajvAsync(ajv); -var validate = ajv.compile(schema); // transpiled es7 async function -validate(data).then(successFunc).catch(errorFunc); -``` - - -#### Using other transpilers - -```javascript -var ajv = new Ajv({ processCode: transpileFunc }); -var validate = ajv.compile(schema); // transpiled es7 async function -validate(data).then(successFunc).catch(errorFunc); -``` - -See [Options](#options). - - -## Security considerations - -JSON Schema, if properly used, can replace data sanitisation. It doesn't replace other API security considerations. It also introduces additional security aspects to consider. - - -##### Security contact - -To report a security vulnerability, please use the -[Tidelift security contact](https://tidelift.com/security). -Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerabilities via GitHub issues. - - -##### Untrusted schemas - -Ajv treats JSON schemas as trusted as your application code. This security model is based on the most common use case, when the schemas are static and bundled together with the application. - -If your schemas are received from untrusted sources (or generated from untrusted data) there are several scenarios you need to prevent: -- compiling schemas can cause stack overflow (if they are too deep) -- compiling schemas can be slow (e.g. [#557](https://github.com/ajv-validator/ajv/issues/557)) -- validating certain data can be slow - -It is difficult to predict all the scenarios, but at the very least it may help to limit the size of untrusted schemas (e.g. limit JSON string length) and also the maximum schema object depth (that can be high for relatively small JSON strings). You also may want to mitigate slow regular expressions in `pattern` and `patternProperties` keywords. - -Regardless the measures you take, using untrusted schemas increases security risks. - - -##### Circular references in JavaScript objects - -Ajv does not support schemas and validated data that have circular references in objects. See [issue #802](https://github.com/ajv-validator/ajv/issues/802). - -An attempt to compile such schemas or validate such data would cause stack overflow (or will not complete in case of asynchronous validation). Depending on the parser you use, untrusted data can lead to circular references. - - -##### Security risks of trusted schemas - -Some keywords in JSON Schemas can lead to very slow validation for certain data. These keywords include (but may be not limited to): - -- `pattern` and `format` for large strings - in some cases using `maxLength` can help mitigate it, but certain regular expressions can lead to exponential validation time even with relatively short strings (see [ReDoS attack](#redos-attack)). -- `patternProperties` for large property names - use `propertyNames` to mitigate, but some regular expressions can have exponential evaluation time as well. -- `uniqueItems` for large non-scalar arrays - use `maxItems` to mitigate - -__Please note__: The suggestions above to prevent slow validation would only work if you do NOT use `allErrors: true` in production code (using it would continue validation after validation errors). - -You can validate your JSON schemas against [this meta-schema](https://github.com/ajv-validator/ajv/blob/master/lib/refs/json-schema-secure.json) to check that these recommendations are followed: - -```javascript -const isSchemaSecure = ajv.compile(require('ajv/lib/refs/json-schema-secure.json')); - -const schema1 = {format: 'email'}; -isSchemaSecure(schema1); // false - -const schema2 = {format: 'email', maxLength: MAX_LENGTH}; -isSchemaSecure(schema2); // true -``` - -__Please note__: following all these recommendation is not a guarantee that validation of untrusted data is safe - it can still lead to some undesirable results. - - -##### Content Security Policies (CSP) -See [Ajv and Content Security Policies (CSP)](#ajv-and-content-security-policies-csp) - - -## ReDoS attack - -Certain regular expressions can lead to the exponential evaluation time even with relatively short strings. - -Please assess the regular expressions you use in the schemas on their vulnerability to this attack - see [safe-regex](https://github.com/substack/safe-regex), for example. - -__Please note__: some formats that Ajv implements use [regular expressions](https://github.com/ajv-validator/ajv/blob/master/lib/compile/formats.js) that can be vulnerable to ReDoS attack, so if you use Ajv to validate data from untrusted sources __it is strongly recommended__ to consider the following: - -- making assessment of "format" implementations in Ajv. -- using `format: 'fast'` option that simplifies some of the regular expressions (although it does not guarantee that they are safe). -- replacing format implementations provided by Ajv with your own implementations of "format" keyword that either uses different regular expressions or another approach to format validation. Please see [addFormat](#api-addformat) method. -- disabling format validation by ignoring "format" keyword with option `format: false` - -Whatever mitigation you choose, please assume all formats provided by Ajv as potentially unsafe and make your own assessment of their suitability for your validation scenarios. - - -## Filtering data - -With [option `removeAdditional`](#options) (added by [andyscott](https://github.com/andyscott)) you can filter data during the validation. - -This option modifies original data. - -Example: - -```javascript -var ajv = new Ajv({ removeAdditional: true }); -var schema = { - "additionalProperties": false, - "properties": { - "foo": { "type": "number" }, - "bar": { - "additionalProperties": { "type": "number" }, - "properties": { - "baz": { "type": "string" } - } - } - } -} - -var data = { - "foo": 0, - "additional1": 1, // will be removed; `additionalProperties` == false - "bar": { - "baz": "abc", - "additional2": 2 // will NOT be removed; `additionalProperties` != false - }, -} - -var validate = ajv.compile(schema); - -console.log(validate(data)); // true -console.log(data); // { "foo": 0, "bar": { "baz": "abc", "additional2": 2 } -``` - -If `removeAdditional` option in the example above were `"all"` then both `additional1` and `additional2` properties would have been removed. - -If the option were `"failing"` then property `additional1` would have been removed regardless of its value and property `additional2` would have been removed only if its value were failing the schema in the inner `additionalProperties` (so in the example above it would have stayed because it passes the schema, but any non-number would have been removed). - -__Please note__: If you use `removeAdditional` option with `additionalProperties` keyword inside `anyOf`/`oneOf` keywords your validation can fail with this schema, for example: - -```json -{ - "type": "object", - "oneOf": [ - { - "properties": { - "foo": { "type": "string" } - }, - "required": [ "foo" ], - "additionalProperties": false - }, - { - "properties": { - "bar": { "type": "integer" } - }, - "required": [ "bar" ], - "additionalProperties": false - } - ] -} -``` - -The intention of the schema above is to allow objects with either the string property "foo" or the integer property "bar", but not with both and not with any other properties. - -With the option `removeAdditional: true` the validation will pass for the object `{ "foo": "abc"}` but will fail for the object `{"bar": 1}`. It happens because while the first subschema in `oneOf` is validated, the property `bar` is removed because it is an additional property according to the standard (because it is not included in `properties` keyword in the same schema). - -While this behaviour is unexpected (issues [#129](https://github.com/ajv-validator/ajv/issues/129), [#134](https://github.com/ajv-validator/ajv/issues/134)), it is correct. To have the expected behaviour (both objects are allowed and additional properties are removed) the schema has to be refactored in this way: - -```json -{ - "type": "object", - "properties": { - "foo": { "type": "string" }, - "bar": { "type": "integer" } - }, - "additionalProperties": false, - "oneOf": [ - { "required": [ "foo" ] }, - { "required": [ "bar" ] } - ] -} -``` - -The schema above is also more efficient - it will compile into a faster function. - - -## Assigning defaults - -With [option `useDefaults`](#options) Ajv will assign values from `default` keyword in the schemas of `properties` and `items` (when it is the array of schemas) to the missing properties and items. - -With the option value `"empty"` properties and items equal to `null` or `""` (empty string) will be considered missing and assigned defaults. - -This option modifies original data. - -__Please note__: the default value is inserted in the generated validation code as a literal, so the value inserted in the data will be the deep clone of the default in the schema. - - -Example 1 (`default` in `properties`): - -```javascript -var ajv = new Ajv({ useDefaults: true }); -var schema = { - "type": "object", - "properties": { - "foo": { "type": "number" }, - "bar": { "type": "string", "default": "baz" } - }, - "required": [ "foo", "bar" ] -}; - -var data = { "foo": 1 }; - -var validate = ajv.compile(schema); - -console.log(validate(data)); // true -console.log(data); // { "foo": 1, "bar": "baz" } -``` - -Example 2 (`default` in `items`): - -```javascript -var schema = { - "type": "array", - "items": [ - { "type": "number" }, - { "type": "string", "default": "foo" } - ] -} - -var data = [ 1 ]; - -var validate = ajv.compile(schema); - -console.log(validate(data)); // true -console.log(data); // [ 1, "foo" ] -``` - -`default` keywords in other cases are ignored: - -- not in `properties` or `items` subschemas -- in schemas inside `anyOf`, `oneOf` and `not` (see [#42](https://github.com/ajv-validator/ajv/issues/42)) -- in `if` subschema of `switch` keyword -- in schemas generated by custom macro keywords - -The [`strictDefaults` option](#options) customizes Ajv's behavior for the defaults that Ajv ignores (`true` raises an error, and `"log"` outputs a warning). - - -## Coercing data types - -When you are validating user inputs all your data properties are usually strings. The option `coerceTypes` allows you to have your data types coerced to the types specified in your schema `type` keywords, both to pass the validation and to use the correctly typed data afterwards. - -This option modifies original data. - -__Please note__: if you pass a scalar value to the validating function its type will be coerced and it will pass the validation, but the value of the variable you pass won't be updated because scalars are passed by value. - - -Example 1: - -```javascript -var ajv = new Ajv({ coerceTypes: true }); -var schema = { - "type": "object", - "properties": { - "foo": { "type": "number" }, - "bar": { "type": "boolean" } - }, - "required": [ "foo", "bar" ] -}; - -var data = { "foo": "1", "bar": "false" }; - -var validate = ajv.compile(schema); - -console.log(validate(data)); // true -console.log(data); // { "foo": 1, "bar": false } -``` - -Example 2 (array coercions): - -```javascript -var ajv = new Ajv({ coerceTypes: 'array' }); -var schema = { - "properties": { - "foo": { "type": "array", "items": { "type": "number" } }, - "bar": { "type": "boolean" } - } -}; - -var data = { "foo": "1", "bar": ["false"] }; - -var validate = ajv.compile(schema); - -console.log(validate(data)); // true -console.log(data); // { "foo": [1], "bar": false } -``` - -The coercion rules, as you can see from the example, are different from JavaScript both to validate user input as expected and to have the coercion reversible (to correctly validate cases where different types are defined in subschemas of "anyOf" and other compound keywords). - -See [Coercion rules](https://github.com/ajv-validator/ajv/blob/master/COERCION.md) for details. - - -## API - -##### new Ajv(Object options) -> Object - -Create Ajv instance. - - -##### .compile(Object schema) -> Function<Object data> - -Generate validating function and cache the compiled schema for future use. - -Validating function returns a boolean value. This function has properties `errors` and `schema`. Errors encountered during the last validation are assigned to `errors` property (it is assigned `null` if there was no errors). `schema` property contains the reference to the original schema. - -The schema passed to this method will be validated against meta-schema unless `validateSchema` option is false. If schema is invalid, an error will be thrown. See [options](#options). - - -##### .compileAsync(Object schema [, Boolean meta] [, Function callback]) -> Promise - -Asynchronous version of `compile` method that loads missing remote schemas using asynchronous function in `options.loadSchema`. This function returns a Promise that resolves to a validation function. An optional callback passed to `compileAsync` will be called with 2 parameters: error (or null) and validating function. The returned promise will reject (and the callback will be called with an error) when: - -- missing schema can't be loaded (`loadSchema` returns a Promise that rejects). -- a schema containing a missing reference is loaded, but the reference cannot be resolved. -- schema (or some loaded/referenced schema) is invalid. - -The function compiles schema and loads the first missing schema (or meta-schema) until all missing schemas are loaded. - -You can asynchronously compile meta-schema by passing `true` as the second parameter. - -See example in [Asynchronous compilation](#asynchronous-schema-compilation). - - -##### .validate(Object schema|String key|String ref, data) -> Boolean - -Validate data using passed schema (it will be compiled and cached). - -Instead of the schema you can use the key that was previously passed to `addSchema`, the schema id if it was present in the schema or any previously resolved reference. - -Validation errors will be available in the `errors` property of Ajv instance (`null` if there were no errors). - -__Please note__: every time this method is called the errors are overwritten so you need to copy them to another variable if you want to use them later. - -If the schema is asynchronous (has `$async` keyword on the top level) this method returns a Promise. See [Asynchronous validation](#asynchronous-validation). - - -##### .addSchema(Array<Object>|Object schema [, String key]) -> Ajv - -Add schema(s) to validator instance. This method does not compile schemas (but it still validates them). Because of that dependencies can be added in any order and circular dependencies are supported. It also prevents unnecessary compilation of schemas that are containers for other schemas but not used as a whole. - -Array of schemas can be passed (schemas should have ids), the second parameter will be ignored. - -Key can be passed that can be used to reference the schema and will be used as the schema id if there is no id inside the schema. If the key is not passed, the schema id will be used as the key. - - -Once the schema is added, it (and all the references inside it) can be referenced in other schemas and used to validate data. - -Although `addSchema` does not compile schemas, explicit compilation is not required - the schema will be compiled when it is used first time. - -By default the schema is validated against meta-schema before it is added, and if the schema does not pass validation the exception is thrown. This behaviour is controlled by `validateSchema` option. - -__Please note__: Ajv uses the [method chaining syntax](https://en.wikipedia.org/wiki/Method_chaining) for all methods with the prefix `add*` and `remove*`. -This allows you to do nice things like the following. - -```javascript -var validate = new Ajv().addSchema(schema).addFormat(name, regex).getSchema(uri); -``` - -##### .addMetaSchema(Array<Object>|Object schema [, String key]) -> Ajv - -Adds meta schema(s) that can be used to validate other schemas. That function should be used instead of `addSchema` because there may be instance options that would compile a meta schema incorrectly (at the moment it is `removeAdditional` option). - -There is no need to explicitly add draft-07 meta schema (http://json-schema.org/draft-07/schema) - it is added by default, unless option `meta` is set to `false`. You only need to use it if you have a changed meta-schema that you want to use to validate your schemas. See `validateSchema`. - - -##### .validateSchema(Object schema) -> Boolean - -Validates schema. This method should be used to validate schemas rather than `validate` due to the inconsistency of `uri` format in JSON Schema standard. - -By default this method is called automatically when the schema is added, so you rarely need to use it directly. - -If schema doesn't have `$schema` property, it is validated against draft 6 meta-schema (option `meta` should not be false). - -If schema has `$schema` property, then the schema with this id (that should be previously added) is used to validate passed schema. - -Errors will be available at `ajv.errors`. - - -##### .getSchema(String key) -> Function<Object data> - -Retrieve compiled schema previously added with `addSchema` by the key passed to `addSchema` or by its full reference (id). The returned validating function has `schema` property with the reference to the original schema. - - -##### .removeSchema([Object schema|String key|String ref|RegExp pattern]) -> Ajv - -Remove added/cached schema. Even if schema is referenced by other schemas it can be safely removed as dependent schemas have local references. - -Schema can be removed using: -- key passed to `addSchema` -- it's full reference (id) -- RegExp that should match schema id or key (meta-schemas won't be removed) -- actual schema object that will be stable-stringified to remove schema from cache - -If no parameter is passed all schemas but meta-schemas will be removed and the cache will be cleared. - - -##### .addFormat(String name, String|RegExp|Function|Object format) -> Ajv - -Add custom format to validate strings or numbers. It can also be used to replace pre-defined formats for Ajv instance. - -Strings are converted to RegExp. - -Function should return validation result as `true` or `false`. - -If object is passed it should have properties `validate`, `compare` and `async`: - -- _validate_: a string, RegExp or a function as described above. -- _compare_: an optional comparison function that accepts two strings and compares them according to the format meaning. This function is used with keywords `formatMaximum`/`formatMinimum` (defined in [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package). It should return `1` if the first value is bigger than the second value, `-1` if it is smaller and `0` if it is equal. -- _async_: an optional `true` value if `validate` is an asynchronous function; in this case it should return a promise that resolves with a value `true` or `false`. -- _type_: an optional type of data that the format applies to. It can be `"string"` (default) or `"number"` (see https://github.com/ajv-validator/ajv/issues/291#issuecomment-259923858). If the type of data is different, the validation will pass. - -Custom formats can be also added via `formats` option. - - -##### .addKeyword(String keyword, Object definition) -> Ajv - -Add custom validation keyword to Ajv instance. - -Keyword should be different from all standard JSON Schema keywords and different from previously defined keywords. There is no way to redefine keywords or to remove keyword definition from the instance. - -Keyword must start with a letter, `_` or `$`, and may continue with letters, numbers, `_`, `$`, or `-`. -It is recommended to use an application-specific prefix for keywords to avoid current and future name collisions. - -Example Keywords: -- `"xyz-example"`: valid, and uses prefix for the xyz project to avoid name collisions. -- `"example"`: valid, but not recommended as it could collide with future versions of JSON Schema etc. -- `"3-example"`: invalid as numbers are not allowed to be the first character in a keyword - -Keyword definition is an object with the following properties: - -- _type_: optional string or array of strings with data type(s) that the keyword applies to. If not present, the keyword will apply to all types. -- _validate_: validating function -- _compile_: compiling function -- _macro_: macro function -- _inline_: compiling function that returns code (as string) -- _schema_: an optional `false` value used with "validate" keyword to not pass schema -- _metaSchema_: an optional meta-schema for keyword schema -- _dependencies_: an optional list of properties that must be present in the parent schema - it will be checked during schema compilation -- _modifying_: `true` MUST be passed if keyword modifies data -- _statements_: `true` can be passed in case inline keyword generates statements (as opposed to expression) -- _valid_: pass `true`/`false` to pre-define validation result, the result returned from validation function will be ignored. This option cannot be used with macro keywords. -- _$data_: an optional `true` value to support [$data reference](#data-reference) as the value of custom keyword. The reference will be resolved at validation time. If the keyword has meta-schema it would be extended to allow $data and it will be used to validate the resolved value. Supporting $data reference requires that keyword has validating function (as the only option or in addition to compile, macro or inline function). -- _async_: an optional `true` value if the validation function is asynchronous (whether it is compiled or passed in _validate_ property); in this case it should return a promise that resolves with a value `true` or `false`. This option is ignored in case of "macro" and "inline" keywords. -- _errors_: an optional boolean or string `"full"` indicating whether keyword returns errors. If this property is not set Ajv will determine if the errors were set in case of failed validation. - -_compile_, _macro_ and _inline_ are mutually exclusive, only one should be used at a time. _validate_ can be used separately or in addition to them to support $data reference. - -__Please note__: If the keyword is validating data type that is different from the type(s) in its definition, the validation function will not be called (and expanded macro will not be used), so there is no need to check for data type inside validation function or inside schema returned by macro function (unless you want to enforce a specific type and for some reason do not want to use a separate `type` keyword for that). In the same way as standard keywords work, if the keyword does not apply to the data type being validated, the validation of this keyword will succeed. - -See [Defining custom keywords](#defining-custom-keywords) for more details. - - -##### .getKeyword(String keyword) -> Object|Boolean - -Returns custom keyword definition, `true` for pre-defined keywords and `false` if the keyword is unknown. - - -##### .removeKeyword(String keyword) -> Ajv - -Removes custom or pre-defined keyword so you can redefine them. - -While this method can be used to extend pre-defined keywords, it can also be used to completely change their meaning - it may lead to unexpected results. - -__Please note__: schemas compiled before the keyword is removed will continue to work without changes. To recompile schemas use `removeSchema` method and compile them again. - - -##### .errorsText([Array<Object> errors [, Object options]]) -> String - -Returns the text with all errors in a String. - -Options can have properties `separator` (string used to separate errors, ", " by default) and `dataVar` (the variable name that dataPaths are prefixed with, "data" by default). - - -## Options - -Defaults: - -```javascript -{ - // validation and reporting options: - $data: false, - allErrors: false, - verbose: false, - $comment: false, // NEW in Ajv version 6.0 - jsonPointers: false, - uniqueItems: true, - unicode: true, - nullable: false, - format: 'fast', - formats: {}, - unknownFormats: true, - schemas: {}, - logger: undefined, - // referenced schema options: - schemaId: '$id', - missingRefs: true, - extendRefs: 'ignore', // recommended 'fail' - loadSchema: undefined, // function(uri: string): Promise {} - // options to modify validated data: - removeAdditional: false, - useDefaults: false, - coerceTypes: false, - // strict mode options - strictDefaults: false, - strictKeywords: false, - strictNumbers: false, - // asynchronous validation options: - transpile: undefined, // requires ajv-async package - // advanced options: - meta: true, - validateSchema: true, - addUsedSchema: true, - inlineRefs: true, - passContext: false, - loopRequired: Infinity, - ownProperties: false, - multipleOfPrecision: false, - errorDataPath: 'object', // deprecated - messages: true, - sourceCode: false, - processCode: undefined, // function (str: string, schema: object): string {} - cache: new Cache, - serialize: undefined -} -``` - -##### Validation and reporting options - -- _$data_: support [$data references](#data-reference). Draft 6 meta-schema that is added by default will be extended to allow them. If you want to use another meta-schema you need to use $dataMetaSchema method to add support for $data reference. See [API](#api). -- _allErrors_: check all rules collecting all errors. Default is to return after the first error. -- _verbose_: include the reference to the part of the schema (`schema` and `parentSchema`) and validated data in errors (false by default). -- _$comment_ (NEW in Ajv version 6.0): log or pass the value of `$comment` keyword to a function. Option values: - - `false` (default): ignore $comment keyword. - - `true`: log the keyword value to console. - - function: pass the keyword value, its schema path and root schema to the specified function -- _jsonPointers_: set `dataPath` property of errors using [JSON Pointers](https://tools.ietf.org/html/rfc6901) instead of JavaScript property access notation. -- _uniqueItems_: validate `uniqueItems` keyword (true by default). -- _unicode_: calculate correct length of strings with unicode pairs (true by default). Pass `false` to use `.length` of strings that is faster, but gives "incorrect" lengths of strings with unicode pairs - each unicode pair is counted as two characters. -- _nullable_: support keyword "nullable" from [Open API 3 specification](https://swagger.io/docs/specification/data-models/data-types/). -- _format_: formats validation mode. Option values: - - `"fast"` (default) - simplified and fast validation (see [Formats](#formats) for details of which formats are available and affected by this option). - - `"full"` - more restrictive and slow validation. E.g., 25:00:00 and 2015/14/33 will be invalid time and date in 'full' mode but it will be valid in 'fast' mode. - - `false` - ignore all format keywords. -- _formats_: an object with custom formats. Keys and values will be passed to `addFormat` method. -- _keywords_: an object with custom keywords. Keys and values will be passed to `addKeyword` method. -- _unknownFormats_: handling of unknown formats. Option values: - - `true` (default) - if an unknown format is encountered the exception is thrown during schema compilation. If `format` keyword value is [$data reference](#data-reference) and it is unknown the validation will fail. - - `[String]` - an array of unknown format names that will be ignored. This option can be used to allow usage of third party schemas with format(s) for which you don't have definitions, but still fail if another unknown format is used. If `format` keyword value is [$data reference](#data-reference) and it is not in this array the validation will fail. - - `"ignore"` - to log warning during schema compilation and always pass validation (the default behaviour in versions before 5.0.0). This option is not recommended, as it allows to mistype format name and it won't be validated without any error message. This behaviour is required by JSON Schema specification. -- _schemas_: an array or object of schemas that will be added to the instance. In case you pass the array the schemas must have IDs in them. When the object is passed the method `addSchema(value, key)` will be called for each schema in this object. -- _logger_: sets the logging method. Default is the global `console` object that should have methods `log`, `warn` and `error`. See [Error logging](#error-logging). Option values: - - custom logger - it should have methods `log`, `warn` and `error`. If any of these methods is missing an exception will be thrown. - - `false` - logging is disabled. - - -##### Referenced schema options - -- _schemaId_: this option defines which keywords are used as schema URI. Option value: - - `"$id"` (default) - only use `$id` keyword as schema URI (as specified in JSON Schema draft-06/07), ignore `id` keyword (if it is present a warning will be logged). - - `"id"` - only use `id` keyword as schema URI (as specified in JSON Schema draft-04), ignore `$id` keyword (if it is present a warning will be logged). - - `"auto"` - use both `$id` and `id` keywords as schema URI. If both are present (in the same schema object) and different the exception will be thrown during schema compilation. -- _missingRefs_: handling of missing referenced schemas. Option values: - - `true` (default) - if the reference cannot be resolved during compilation the exception is thrown. The thrown error has properties `missingRef` (with hash fragment) and `missingSchema` (without it). Both properties are resolved relative to the current base id (usually schema id, unless it was substituted). - - `"ignore"` - to log error during compilation and always pass validation. - - `"fail"` - to log error and successfully compile schema but fail validation if this rule is checked. -- _extendRefs_: validation of other keywords when `$ref` is present in the schema. Option values: - - `"ignore"` (default) - when `$ref` is used other keywords are ignored (as per [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03#section-3) standard). A warning will be logged during the schema compilation. - - `"fail"` (recommended) - if other validation keywords are used together with `$ref` the exception will be thrown when the schema is compiled. This option is recommended to make sure schema has no keywords that are ignored, which can be confusing. - - `true` - validate all keywords in the schemas with `$ref` (the default behaviour in versions before 5.0.0). -- _loadSchema_: asynchronous function that will be used to load remote schemas when `compileAsync` [method](#api-compileAsync) is used and some reference is missing (option `missingRefs` should NOT be 'fail' or 'ignore'). This function should accept remote schema uri as a parameter and return a Promise that resolves to a schema. See example in [Asynchronous compilation](#asynchronous-schema-compilation). - - -##### Options to modify validated data - -- _removeAdditional_: remove additional properties - see example in [Filtering data](#filtering-data). This option is not used if schema is added with `addMetaSchema` method. Option values: - - `false` (default) - not to remove additional properties - - `"all"` - all additional properties are removed, regardless of `additionalProperties` keyword in schema (and no validation is made for them). - - `true` - only additional properties with `additionalProperties` keyword equal to `false` are removed. - - `"failing"` - additional properties that fail schema validation will be removed (where `additionalProperties` keyword is `false` or schema). -- _useDefaults_: replace missing or undefined properties and items with the values from corresponding `default` keywords. Default behaviour is to ignore `default` keywords. This option is not used if schema is added with `addMetaSchema` method. See examples in [Assigning defaults](#assigning-defaults). Option values: - - `false` (default) - do not use defaults - - `true` - insert defaults by value (object literal is used). - - `"empty"` - in addition to missing or undefined, use defaults for properties and items that are equal to `null` or `""` (an empty string). - - `"shared"` (deprecated) - insert defaults by reference. If the default is an object, it will be shared by all instances of validated data. If you modify the inserted default in the validated data, it will be modified in the schema as well. -- _coerceTypes_: change data type of data to match `type` keyword. See the example in [Coercing data types](#coercing-data-types) and [coercion rules](https://github.com/ajv-validator/ajv/blob/master/COERCION.md). Option values: - - `false` (default) - no type coercion. - - `true` - coerce scalar data types. - - `"array"` - in addition to coercions between scalar types, coerce scalar data to an array with one element and vice versa (as required by the schema). - - -##### Strict mode options - -- _strictDefaults_: report ignored `default` keywords in schemas. Option values: - - `false` (default) - ignored defaults are not reported - - `true` - if an ignored default is present, throw an error - - `"log"` - if an ignored default is present, log warning -- _strictKeywords_: report unknown keywords in schemas. Option values: - - `false` (default) - unknown keywords are not reported - - `true` - if an unknown keyword is present, throw an error - - `"log"` - if an unknown keyword is present, log warning -- _strictNumbers_: validate numbers strictly, failing validation for NaN and Infinity. Option values: - - `false` (default) - NaN or Infinity will pass validation for numeric types - - `true` - NaN or Infinity will not pass validation for numeric types - -##### Asynchronous validation options - -- _transpile_: Requires [ajv-async](https://github.com/ajv-validator/ajv-async) package. It determines whether Ajv transpiles compiled asynchronous validation function. Option values: - - `undefined` (default) - transpile with [nodent](https://github.com/MatAtBread/nodent) if async functions are not supported. - - `true` - always transpile with nodent. - - `false` - do not transpile; if async functions are not supported an exception will be thrown. - - -##### Advanced options - -- _meta_: add [meta-schema](http://json-schema.org/documentation.html) so it can be used by other schemas (true by default). If an object is passed, it will be used as the default meta-schema for schemas that have no `$schema` keyword. This default meta-schema MUST have `$schema` keyword. -- _validateSchema_: validate added/compiled schemas against meta-schema (true by default). `$schema` property in the schema can be http://json-schema.org/draft-07/schema or absent (draft-07 meta-schema will be used) or can be a reference to the schema previously added with `addMetaSchema` method. Option values: - - `true` (default) - if the validation fails, throw the exception. - - `"log"` - if the validation fails, log error. - - `false` - skip schema validation. -- _addUsedSchema_: by default methods `compile` and `validate` add schemas to the instance if they have `$id` (or `id`) property that doesn't start with "#". If `$id` is present and it is not unique the exception will be thrown. Set this option to `false` to skip adding schemas to the instance and the `$id` uniqueness check when these methods are used. This option does not affect `addSchema` method. -- _inlineRefs_: Affects compilation of referenced schemas. Option values: - - `true` (default) - the referenced schemas that don't have refs in them are inlined, regardless of their size - that substantially improves performance at the cost of the bigger size of compiled schema functions. - - `false` - to not inline referenced schemas (they will be compiled as separate functions). - - integer number - to limit the maximum number of keywords of the schema that will be inlined. -- _passContext_: pass validation context to custom keyword functions. If this option is `true` and you pass some context to the compiled validation function with `validate.call(context, data)`, the `context` will be available as `this` in your custom keywords. By default `this` is Ajv instance. -- _loopRequired_: by default `required` keyword is compiled into a single expression (or a sequence of statements in `allErrors` mode). In case of a very large number of properties in this keyword it may result in a very big validation function. Pass integer to set the number of properties above which `required` keyword will be validated in a loop - smaller validation function size but also worse performance. -- _ownProperties_: by default Ajv iterates over all enumerable object properties; when this option is `true` only own enumerable object properties (i.e. found directly on the object rather than on its prototype) are iterated. Contributed by @mbroadst. -- _multipleOfPrecision_: by default `multipleOf` keyword is validated by comparing the result of division with parseInt() of that result. It works for dividers that are bigger than 1. For small dividers such as 0.01 the result of the division is usually not integer (even when it should be integer, see issue [#84](https://github.com/ajv-validator/ajv/issues/84)). If you need to use fractional dividers set this option to some positive integer N to have `multipleOf` validated using this formula: `Math.abs(Math.round(division) - division) < 1e-N` (it is slower but allows for float arithmetics deviations). -- _errorDataPath_ (deprecated): set `dataPath` to point to 'object' (default) or to 'property' when validating keywords `required`, `additionalProperties` and `dependencies`. -- _messages_: Include human-readable messages in errors. `true` by default. `false` can be passed when custom messages are used (e.g. with [ajv-i18n](https://github.com/ajv-validator/ajv-i18n)). -- _sourceCode_: add `sourceCode` property to validating function (for debugging; this code can be different from the result of toString call). -- _processCode_: an optional function to process generated code before it is passed to Function constructor. It can be used to either beautify (the validating function is generated without line-breaks) or to transpile code. Starting from version 5.0.0 this option replaced options: - - `beautify` that formatted the generated function using [js-beautify](https://github.com/beautify-web/js-beautify). If you want to beautify the generated code pass a function calling `require('js-beautify').js_beautify` as `processCode: code => js_beautify(code)`. - - `transpile` that transpiled asynchronous validation function. You can still use `transpile` option with [ajv-async](https://github.com/ajv-validator/ajv-async) package. See [Asynchronous validation](#asynchronous-validation) for more information. -- _cache_: an optional instance of cache to store compiled schemas using stable-stringified schema as a key. For example, set-associative cache [sacjs](https://github.com/epoberezkin/sacjs) can be used. If not passed then a simple hash is used which is good enough for the common use case (a limited number of statically defined schemas). Cache should have methods `put(key, value)`, `get(key)`, `del(key)` and `clear()`. -- _serialize_: an optional function to serialize schema to cache key. Pass `false` to use schema itself as a key (e.g., if WeakMap used as a cache). By default [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used. - - -## Validation errors - -In case of validation failure, Ajv assigns the array of errors to `errors` property of validation function (or to `errors` property of Ajv instance when `validate` or `validateSchema` methods were called). In case of [asynchronous validation](#asynchronous-validation), the returned promise is rejected with exception `Ajv.ValidationError` that has `errors` property. - - -### Error objects - -Each error is an object with the following properties: - -- _keyword_: validation keyword. -- _dataPath_: the path to the part of the data that was validated. By default `dataPath` uses JavaScript property access notation (e.g., `".prop[1].subProp"`). When the option `jsonPointers` is true (see [Options](#options)) `dataPath` will be set using JSON pointer standard (e.g., `"/prop/1/subProp"`). -- _schemaPath_: the path (JSON-pointer as a URI fragment) to the schema of the keyword that failed validation. -- _params_: the object with the additional information about error that can be used to create custom error messages (e.g., using [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) package). See below for parameters set by all keywords. -- _message_: the standard error message (can be excluded with option `messages` set to false). -- _schema_: the schema of the keyword (added with `verbose` option). -- _parentSchema_: the schema containing the keyword (added with `verbose` option) -- _data_: the data validated by the keyword (added with `verbose` option). - -__Please note__: `propertyNames` keyword schema validation errors have an additional property `propertyName`, `dataPath` points to the object. After schema validation for each property name, if it is invalid an additional error is added with the property `keyword` equal to `"propertyNames"`. - - -### Error parameters - -Properties of `params` object in errors depend on the keyword that failed validation. - -- `maxItems`, `minItems`, `maxLength`, `minLength`, `maxProperties`, `minProperties` - property `limit` (number, the schema of the keyword). -- `additionalItems` - property `limit` (the maximum number of allowed items in case when `items` keyword is an array of schemas and `additionalItems` is false). -- `additionalProperties` - property `additionalProperty` (the property not used in `properties` and `patternProperties` keywords). -- `dependencies` - properties: - - `property` (dependent property), - - `missingProperty` (required missing dependency - only the first one is reported currently) - - `deps` (required dependencies, comma separated list as a string), - - `depsCount` (the number of required dependencies). -- `format` - property `format` (the schema of the keyword). -- `maximum`, `minimum` - properties: - - `limit` (number, the schema of the keyword), - - `exclusive` (boolean, the schema of `exclusiveMaximum` or `exclusiveMinimum`), - - `comparison` (string, comparison operation to compare the data to the limit, with the data on the left and the limit on the right; can be "<", "<=", ">", ">=") -- `multipleOf` - property `multipleOf` (the schema of the keyword) -- `pattern` - property `pattern` (the schema of the keyword) -- `required` - property `missingProperty` (required property that is missing). -- `propertyNames` - property `propertyName` (an invalid property name). -- `patternRequired` (in ajv-keywords) - property `missingPattern` (required pattern that did not match any property). -- `type` - property `type` (required type(s), a string, can be a comma-separated list) -- `uniqueItems` - properties `i` and `j` (indices of duplicate items). -- `const` - property `allowedValue` pointing to the value (the schema of the keyword). -- `enum` - property `allowedValues` pointing to the array of values (the schema of the keyword). -- `$ref` - property `ref` with the referenced schema URI. -- `oneOf` - property `passingSchemas` (array of indices of passing schemas, null if no schema passes). -- custom keywords (in case keyword definition doesn't create errors) - property `keyword` (the keyword name). - - -### Error logging - -Using the `logger` option when initiallizing Ajv will allow you to define custom logging. Here you can build upon the exisiting logging. The use of other logging packages is supported as long as the package or its associated wrapper exposes the required methods. If any of the required methods are missing an exception will be thrown. -- **Required Methods**: `log`, `warn`, `error` - -```javascript -var otherLogger = new OtherLogger(); -var ajv = new Ajv({ - logger: { - log: console.log.bind(console), - warn: function warn() { - otherLogger.logWarn.apply(otherLogger, arguments); - }, - error: function error() { - otherLogger.logError.apply(otherLogger, arguments); - console.error.apply(console, arguments); - } - } -}); -``` - - -## Plugins - -Ajv can be extended with plugins that add custom keywords, formats or functions to process generated code. When such plugin is published as npm package it is recommended that it follows these conventions: - -- it exports a function -- this function accepts ajv instance as the first parameter and returns the same instance to allow chaining -- this function can accept an optional configuration as the second parameter - -If you have published a useful plugin please submit a PR to add it to the next section. - - -## Related packages - -- [ajv-async](https://github.com/ajv-validator/ajv-async) - plugin to configure async validation mode -- [ajv-bsontype](https://github.com/BoLaMN/ajv-bsontype) - plugin to validate mongodb's bsonType formats -- [ajv-cli](https://github.com/jessedc/ajv-cli) - command line interface -- [ajv-errors](https://github.com/ajv-validator/ajv-errors) - plugin for custom error messages -- [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) - internationalised error messages -- [ajv-istanbul](https://github.com/ajv-validator/ajv-istanbul) - plugin to instrument generated validation code to measure test coverage of your schemas -- [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) - plugin with custom validation keywords (select, typeof, etc.) -- [ajv-merge-patch](https://github.com/ajv-validator/ajv-merge-patch) - plugin with keywords $merge and $patch -- [ajv-pack](https://github.com/ajv-validator/ajv-pack) - produces a compact module exporting validation functions -- [ajv-formats-draft2019](https://github.com/luzlab/ajv-formats-draft2019) - format validators for draft2019 that aren't already included in ajv (ie. `idn-hostname`, `idn-email`, `iri`, `iri-reference` and `duration`). - -## Some packages using Ajv - -- [webpack](https://github.com/webpack/webpack) - a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser -- [jsonscript-js](https://github.com/JSONScript/jsonscript-js) - the interpreter for [JSONScript](http://www.jsonscript.org) - scripted processing of existing endpoints and services -- [osprey-method-handler](https://github.com/mulesoft-labs/osprey-method-handler) - Express middleware for validating requests and responses based on a RAML method object, used in [osprey](https://github.com/mulesoft/osprey) - validating API proxy generated from a RAML definition -- [har-validator](https://github.com/ahmadnassri/har-validator) - HTTP Archive (HAR) validator -- [jsoneditor](https://github.com/josdejong/jsoneditor) - a web-based tool to view, edit, format, and validate JSON http://jsoneditoronline.org -- [JSON Schema Lint](https://github.com/nickcmaynard/jsonschemalint) - a web tool to validate JSON/YAML document against a single JSON Schema http://jsonschemalint.com -- [objection](https://github.com/vincit/objection.js) - SQL-friendly ORM for Node.js -- [table](https://github.com/gajus/table) - formats data into a string table -- [ripple-lib](https://github.com/ripple/ripple-lib) - a JavaScript API for interacting with [Ripple](https://ripple.com) in Node.js and the browser -- [restbase](https://github.com/wikimedia/restbase) - distributed storage with REST API & dispatcher for backend services built to provide a low-latency & high-throughput API for Wikipedia / Wikimedia content -- [hippie-swagger](https://github.com/CacheControl/hippie-swagger) - [Hippie](https://github.com/vesln/hippie) wrapper that provides end to end API testing with swagger validation -- [react-form-controlled](https://github.com/seeden/react-form-controlled) - React controlled form components with validation -- [rabbitmq-schema](https://github.com/tjmehta/rabbitmq-schema) - a schema definition module for RabbitMQ graphs and messages -- [@query/schema](https://www.npmjs.com/package/@query/schema) - stream filtering with a URI-safe query syntax parsing to JSON Schema -- [chai-ajv-json-schema](https://github.com/peon374/chai-ajv-json-schema) - chai plugin to us JSON Schema with expect in mocha tests -- [grunt-jsonschema-ajv](https://github.com/SignpostMarv/grunt-jsonschema-ajv) - Grunt plugin for validating files against JSON Schema -- [extract-text-webpack-plugin](https://github.com/webpack-contrib/extract-text-webpack-plugin) - extract text from bundle into a file -- [electron-builder](https://github.com/electron-userland/electron-builder) - a solution to package and build a ready for distribution Electron app -- [addons-linter](https://github.com/mozilla/addons-linter) - Mozilla Add-ons Linter -- [gh-pages-generator](https://github.com/epoberezkin/gh-pages-generator) - multi-page site generator converting markdown files to GitHub pages -- [ESLint](https://github.com/eslint/eslint) - the pluggable linting utility for JavaScript and JSX - - -## Tests - -``` -npm install -git submodule update --init -npm test -``` - -## Contributing - -All validation functions are generated using doT templates in [dot](https://github.com/ajv-validator/ajv/tree/master/lib/dot) folder. Templates are precompiled so doT is not a run-time dependency. - -`npm run build` - compiles templates to [dotjs](https://github.com/ajv-validator/ajv/tree/master/lib/dotjs) folder. - -`npm run watch` - automatically compiles templates when files in dot folder change - -Please see [Contributing guidelines](https://github.com/ajv-validator/ajv/blob/master/CONTRIBUTING.md) - - -## Changes history - -See https://github.com/ajv-validator/ajv/releases - -__Please note__: [Changes in version 7.0.0-beta](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0-beta.0) - -[Version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0). - -## Code of conduct - -Please review and follow the [Code of conduct](https://github.com/ajv-validator/ajv/blob/master/CODE_OF_CONDUCT.md). - -Please report any unacceptable behaviour to ajv.validator@gmail.com - it will be reviewed by the project team. - - -## Open-source software support - -Ajv is a part of [Tidelift subscription](https://tidelift.com/subscription/pkg/npm-ajv?utm_source=npm-ajv&utm_medium=referral&utm_campaign=readme) - it provides a centralised support to open-source software users, in addition to the support provided by software maintainers. - - -## License - -[MIT](https://github.com/ajv-validator/ajv/blob/master/LICENSE) diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/dist/ajv.bundle.js b/node_modules/terser-webpack-plugin/node_modules/ajv/dist/ajv.bundle.js deleted file mode 100644 index e4d9d15..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/dist/ajv.bundle.js +++ /dev/null @@ -1,7189 +0,0 @@ -(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.Ajv = 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%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i; -// For the source: https://gist.github.com/dperini/729294 -// For test cases: https://mathiasbynens.be/demo/url-regex -// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983. -// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu; -var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i; -var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i; -var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/; -var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i; -var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/; - - -module.exports = formats; - -function formats(mode) { - mode = mode == 'full' ? 'full' : 'fast'; - return util.copy(formats[mode]); -} - - -formats.fast = { - // date: http://tools.ietf.org/html/rfc3339#section-5.6 - date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/, - // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 - time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, - 'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, - // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js - uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i, - 'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i, - 'uri-template': URITEMPLATE, - url: URL, - // email (sources from jsen validator): - // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363 - // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation') - email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i, - hostname: HOSTNAME, - // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html - ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, - // optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses - ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, - regex: regex, - // uuid: http://tools.ietf.org/html/rfc4122 - uuid: UUID, - // JSON-pointer: https://tools.ietf.org/html/rfc6901 - // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A - 'json-pointer': JSON_POINTER, - 'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT, - // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00 - 'relative-json-pointer': RELATIVE_JSON_POINTER -}; - - -formats.full = { - date: date, - time: time, - 'date-time': date_time, - uri: uri, - 'uri-reference': URIREF, - 'uri-template': URITEMPLATE, - url: URL, - email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, - hostname: HOSTNAME, - ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, - ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, - regex: regex, - uuid: UUID, - 'json-pointer': JSON_POINTER, - 'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT, - 'relative-json-pointer': RELATIVE_JSON_POINTER -}; - - -function isLeapYear(year) { - // https://tools.ietf.org/html/rfc3339#appendix-C - return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); -} - - -function date(str) { - // full-date from http://tools.ietf.org/html/rfc3339#section-5.6 - var matches = str.match(DATE); - if (!matches) return false; - - var year = +matches[1]; - var month = +matches[2]; - var day = +matches[3]; - - return month >= 1 && month <= 12 && day >= 1 && - day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]); -} - - -function time(str, full) { - var matches = str.match(TIME); - if (!matches) return false; - - var hour = matches[1]; - var minute = matches[2]; - var second = matches[3]; - var timeZone = matches[5]; - return ((hour <= 23 && minute <= 59 && second <= 59) || - (hour == 23 && minute == 59 && second == 60)) && - (!full || timeZone); -} - - -var DATE_TIME_SEPARATOR = /t|\s/i; -function date_time(str) { - // http://tools.ietf.org/html/rfc3339#section-5.6 - var dateTime = str.split(DATE_TIME_SEPARATOR); - return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true); -} - - -var NOT_URI_FRAGMENT = /\/|:/; -function uri(str) { - // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "." - return NOT_URI_FRAGMENT.test(str) && URI.test(str); -} - - -var Z_ANCHOR = /[^\\]\\Z/; -function regex(str) { - if (Z_ANCHOR.test(str)) return false; - try { - new RegExp(str); - return true; - } catch(e) { - return false; - } -} - -},{"./util":10}],5:[function(require,module,exports){ -'use strict'; - -var resolve = require('./resolve') - , util = require('./util') - , errorClasses = require('./error_classes') - , stableStringify = require('fast-json-stable-stringify'); - -var validateGenerator = require('../dotjs/validate'); - -/** - * Functions below are used inside compiled validations function - */ - -var ucs2length = util.ucs2length; -var equal = require('fast-deep-equal'); - -// this error is thrown by async schemas to return validation errors via exception -var ValidationError = errorClasses.Validation; - -module.exports = compile; - - -/** - * Compiles schema to validation function - * @this Ajv - * @param {Object} schema schema object - * @param {Object} root object with information about the root schema for this schema - * @param {Object} localRefs the hash of local references inside the schema (created by resolve.id), used for inline resolution - * @param {String} baseId base ID for IDs in the schema - * @return {Function} validation function - */ -function compile(schema, root, localRefs, baseId) { - /* jshint validthis: true, evil: true */ - /* eslint no-shadow: 0 */ - var self = this - , opts = this._opts - , refVal = [ undefined ] - , refs = {} - , patterns = [] - , patternsHash = {} - , defaults = [] - , defaultsHash = {} - , customRules = []; - - root = root || { schema: schema, refVal: refVal, refs: refs }; - - var c = checkCompiling.call(this, schema, root, baseId); - var compilation = this._compilations[c.index]; - if (c.compiling) return (compilation.callValidate = callValidate); - - var formats = this._formats; - var RULES = this.RULES; - - try { - var v = localCompile(schema, root, localRefs, baseId); - compilation.validate = v; - var cv = compilation.callValidate; - if (cv) { - cv.schema = v.schema; - cv.errors = null; - cv.refs = v.refs; - cv.refVal = v.refVal; - cv.root = v.root; - cv.$async = v.$async; - if (opts.sourceCode) cv.source = v.source; - } - return v; - } finally { - endCompiling.call(this, schema, root, baseId); - } - - /* @this {*} - custom context, see passContext option */ - function callValidate() { - /* jshint validthis: true */ - var validate = compilation.validate; - var result = validate.apply(this, arguments); - callValidate.errors = validate.errors; - return result; - } - - function localCompile(_schema, _root, localRefs, baseId) { - var isRoot = !_root || (_root && _root.schema == _schema); - if (_root.schema != root.schema) - return compile.call(self, _schema, _root, localRefs, baseId); - - var $async = _schema.$async === true; - - var sourceCode = validateGenerator({ - isTop: true, - schema: _schema, - isRoot: isRoot, - baseId: baseId, - root: _root, - schemaPath: '', - errSchemaPath: '#', - errorPath: '""', - MissingRefError: errorClasses.MissingRef, - RULES: RULES, - validate: validateGenerator, - util: util, - resolve: resolve, - resolveRef: resolveRef, - usePattern: usePattern, - useDefault: useDefault, - useCustomRule: useCustomRule, - opts: opts, - formats: formats, - logger: self.logger, - self: self - }); - - sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode) - + vars(defaults, defaultCode) + vars(customRules, customRuleCode) - + sourceCode; - - if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema); - // console.log('\n\n\n *** \n', JSON.stringify(sourceCode)); - var validate; - try { - var makeValidate = new Function( - 'self', - 'RULES', - 'formats', - 'root', - 'refVal', - 'defaults', - 'customRules', - 'equal', - 'ucs2length', - 'ValidationError', - sourceCode - ); - - validate = makeValidate( - self, - RULES, - formats, - root, - refVal, - defaults, - customRules, - equal, - ucs2length, - ValidationError - ); - - refVal[0] = validate; - } catch(e) { - self.logger.error('Error compiling schema, function code:', sourceCode); - throw e; - } - - validate.schema = _schema; - validate.errors = null; - validate.refs = refs; - validate.refVal = refVal; - validate.root = isRoot ? validate : _root; - if ($async) validate.$async = true; - if (opts.sourceCode === true) { - validate.source = { - code: sourceCode, - patterns: patterns, - defaults: defaults - }; - } - - return validate; - } - - function resolveRef(baseId, ref, isRoot) { - ref = resolve.url(baseId, ref); - var refIndex = refs[ref]; - var _refVal, refCode; - if (refIndex !== undefined) { - _refVal = refVal[refIndex]; - refCode = 'refVal[' + refIndex + ']'; - return resolvedRef(_refVal, refCode); - } - if (!isRoot && root.refs) { - var rootRefId = root.refs[ref]; - if (rootRefId !== undefined) { - _refVal = root.refVal[rootRefId]; - refCode = addLocalRef(ref, _refVal); - return resolvedRef(_refVal, refCode); - } - } - - refCode = addLocalRef(ref); - var v = resolve.call(self, localCompile, root, ref); - if (v === undefined) { - var localSchema = localRefs && localRefs[ref]; - if (localSchema) { - v = resolve.inlineRef(localSchema, opts.inlineRefs) - ? localSchema - : compile.call(self, localSchema, root, localRefs, baseId); - } - } - - if (v === undefined) { - removeLocalRef(ref); - } else { - replaceLocalRef(ref, v); - return resolvedRef(v, refCode); - } - } - - function addLocalRef(ref, v) { - var refId = refVal.length; - refVal[refId] = v; - refs[ref] = refId; - return 'refVal' + refId; - } - - function removeLocalRef(ref) { - delete refs[ref]; - } - - function replaceLocalRef(ref, v) { - var refId = refs[ref]; - refVal[refId] = v; - } - - function resolvedRef(refVal, code) { - return typeof refVal == 'object' || typeof refVal == 'boolean' - ? { code: code, schema: refVal, inline: true } - : { code: code, $async: refVal && !!refVal.$async }; - } - - function usePattern(regexStr) { - var index = patternsHash[regexStr]; - if (index === undefined) { - index = patternsHash[regexStr] = patterns.length; - patterns[index] = regexStr; - } - return 'pattern' + index; - } - - function useDefault(value) { - switch (typeof value) { - case 'boolean': - case 'number': - return '' + value; - case 'string': - return util.toQuotedString(value); - case 'object': - if (value === null) return 'null'; - var valueStr = stableStringify(value); - var index = defaultsHash[valueStr]; - if (index === undefined) { - index = defaultsHash[valueStr] = defaults.length; - defaults[index] = value; - } - return 'default' + index; - } - } - - function useCustomRule(rule, schema, parentSchema, it) { - if (self._opts.validateSchema !== false) { - var deps = rule.definition.dependencies; - if (deps && !deps.every(function(keyword) { - return Object.prototype.hasOwnProperty.call(parentSchema, keyword); - })) - throw new Error('parent schema must have all required keywords: ' + deps.join(',')); - - var validateSchema = rule.definition.validateSchema; - if (validateSchema) { - var valid = validateSchema(schema); - if (!valid) { - var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors); - if (self._opts.validateSchema == 'log') self.logger.error(message); - else throw new Error(message); - } - } - } - - var compile = rule.definition.compile - , inline = rule.definition.inline - , macro = rule.definition.macro; - - var validate; - if (compile) { - validate = compile.call(self, schema, parentSchema, it); - } else if (macro) { - validate = macro.call(self, schema, parentSchema, it); - if (opts.validateSchema !== false) self.validateSchema(validate, true); - } else if (inline) { - validate = inline.call(self, it, rule.keyword, schema, parentSchema); - } else { - validate = rule.definition.validate; - if (!validate) return; - } - - if (validate === undefined) - throw new Error('custom keyword "' + rule.keyword + '"failed to compile'); - - var index = customRules.length; - customRules[index] = validate; - - return { - code: 'customRule' + index, - validate: validate - }; - } -} - - -/** - * Checks if the schema is currently compiled - * @this Ajv - * @param {Object} schema schema to compile - * @param {Object} root root object - * @param {String} baseId base schema ID - * @return {Object} object with properties "index" (compilation index) and "compiling" (boolean) - */ -function checkCompiling(schema, root, baseId) { - /* jshint validthis: true */ - var index = compIndex.call(this, schema, root, baseId); - if (index >= 0) return { index: index, compiling: true }; - index = this._compilations.length; - this._compilations[index] = { - schema: schema, - root: root, - baseId: baseId - }; - return { index: index, compiling: false }; -} - - -/** - * Removes the schema from the currently compiled list - * @this Ajv - * @param {Object} schema schema to compile - * @param {Object} root root object - * @param {String} baseId base schema ID - */ -function endCompiling(schema, root, baseId) { - /* jshint validthis: true */ - var i = compIndex.call(this, schema, root, baseId); - if (i >= 0) this._compilations.splice(i, 1); -} - - -/** - * Index of schema compilation in the currently compiled list - * @this Ajv - * @param {Object} schema schema to compile - * @param {Object} root root object - * @param {String} baseId base schema ID - * @return {Integer} compilation index - */ -function compIndex(schema, root, baseId) { - /* jshint validthis: true */ - for (var i=0; i= 0xD800 && value <= 0xDBFF && pos < len) { - // high surrogate, and there is a next character - value = str.charCodeAt(pos); - if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate - } - } - return length; -}; - -},{}],10:[function(require,module,exports){ -'use strict'; - - -module.exports = { - copy: copy, - checkDataType: checkDataType, - checkDataTypes: checkDataTypes, - coerceToTypes: coerceToTypes, - toHash: toHash, - getProperty: getProperty, - escapeQuotes: escapeQuotes, - equal: require('fast-deep-equal'), - ucs2length: require('./ucs2length'), - varOccurences: varOccurences, - varReplace: varReplace, - schemaHasRules: schemaHasRules, - schemaHasRulesExcept: schemaHasRulesExcept, - schemaUnknownRules: schemaUnknownRules, - toQuotedString: toQuotedString, - getPathExpr: getPathExpr, - getPath: getPath, - getData: getData, - unescapeFragment: unescapeFragment, - unescapeJsonPointer: unescapeJsonPointer, - escapeFragment: escapeFragment, - escapeJsonPointer: escapeJsonPointer -}; - - -function copy(o, to) { - to = to || {}; - for (var key in o) to[key] = o[key]; - return to; -} - - -function checkDataType(dataType, data, strictNumbers, negate) { - var EQUAL = negate ? ' !== ' : ' === ' - , AND = negate ? ' || ' : ' && ' - , OK = negate ? '!' : '' - , NOT = negate ? '' : '!'; - switch (dataType) { - case 'null': return data + EQUAL + 'null'; - case 'array': return OK + 'Array.isArray(' + data + ')'; - case 'object': return '(' + OK + data + AND + - 'typeof ' + data + EQUAL + '"object"' + AND + - NOT + 'Array.isArray(' + data + '))'; - case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND + - NOT + '(' + data + ' % 1)' + - AND + data + EQUAL + data + - (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')'; - case 'number': return '(typeof ' + data + EQUAL + '"' + dataType + '"' + - (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')'; - default: return 'typeof ' + data + EQUAL + '"' + dataType + '"'; - } -} - - -function checkDataTypes(dataTypes, data, strictNumbers) { - switch (dataTypes.length) { - case 1: return checkDataType(dataTypes[0], data, strictNumbers, true); - default: - var code = ''; - var types = toHash(dataTypes); - if (types.array && types.object) { - code = types.null ? '(': '(!' + data + ' || '; - code += 'typeof ' + data + ' !== "object")'; - delete types.null; - delete types.array; - delete types.object; - } - if (types.number) delete types.integer; - for (var t in types) - code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true); - - return code; - } -} - - -var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]); -function coerceToTypes(optionCoerceTypes, dataTypes) { - if (Array.isArray(dataTypes)) { - var types = []; - for (var i=0; i= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl); - return paths[lvl - up]; - } - - if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl); - data = 'data' + ((lvl - up) || ''); - if (!jsonPointer) return data; - } - - var expr = data; - var segments = jsonPointer.split('/'); - for (var i=0; i', - $notOp = $isMax ? '>' : '<', - $errorKeyword = undefined; - if (!($isData || typeof $schema == 'number' || $schema === undefined)) { - throw new Error($keyword + ' must be number'); - } - if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) { - throw new Error($exclusiveKeyword + ' must be number or boolean'); - } - if ($isDataExcl) { - var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr), - $exclusive = 'exclusive' + $lvl, - $exclType = 'exclType' + $lvl, - $exclIsNumber = 'exclIsNumber' + $lvl, - $opExpr = 'op' + $lvl, - $opStr = '\' + ' + $opExpr + ' + \''; - out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; '; - $schemaValueExcl = 'schemaExcl' + $lvl; - out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \'boolean\' && ' + ($exclType) + ' != \'undefined\' && ' + ($exclType) + ' != \'number\') { '; - var $errorKeyword = $exclusiveKeyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ' + ($exclType) + ' == \'number\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\'; '; - if ($schema === undefined) { - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $schemaValue = $schemaValueExcl; - $isData = $isDataExcl; - } - } else { - var $exclIsNumber = typeof $schemaExcl == 'number', - $opStr = $op; - if ($exclIsNumber && $isData) { - var $opExpr = '\'' + $opStr + '\''; - out += ' if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { '; - } else { - if ($exclIsNumber && $schema === undefined) { - $exclusive = true; - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $schemaValue = $schemaExcl; - $notOp += '='; - } else { - if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema); - if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) { - $exclusive = true; - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $notOp += '='; - } else { - $exclusive = false; - $opStr += '='; - } - } - var $opExpr = '\'' + $opStr + '\''; - out += ' if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { '; - } - } - $errorKeyword = $errorKeyword || $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be ' + ($opStr) + ' '; - if ($isData) { - out += '\' + ' + ($schemaValue); - } else { - out += '' + ($schemaValue) + '\''; - } - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],14:[function(require,module,exports){ -'use strict'; -module.exports = function generate__limitItems(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!($isData || typeof $schema == 'number')) { - throw new Error($keyword + ' must be number'); - } - var $op = $keyword == 'maxItems' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have '; - if ($keyword == 'maxItems') { - out += 'more'; - } else { - out += 'fewer'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' items\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],15:[function(require,module,exports){ -'use strict'; -module.exports = function generate__limitLength(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!($isData || typeof $schema == 'number')) { - throw new Error($keyword + ' must be number'); - } - var $op = $keyword == 'maxLength' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - if (it.opts.unicode === false) { - out += ' ' + ($data) + '.length '; - } else { - out += ' ucs2length(' + ($data) + ') '; - } - out += ' ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT be '; - if ($keyword == 'maxLength') { - out += 'longer'; - } else { - out += 'shorter'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' characters\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],16:[function(require,module,exports){ -'use strict'; -module.exports = function generate__limitProperties(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!($isData || typeof $schema == 'number')) { - throw new Error($keyword + ' must be number'); - } - var $op = $keyword == 'maxProperties' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have '; - if ($keyword == 'maxProperties') { - out += 'more'; - } else { - out += 'fewer'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' properties\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],17:[function(require,module,exports){ -'use strict'; -module.exports = function generate_allOf(it, $keyword, $ruleType) { - var out = ' '; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $currentBaseId = $it.baseId, - $allSchemasEmpty = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - $allSchemasEmpty = false; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if ($breakOnError) { - if ($allSchemasEmpty) { - out += ' if (true) { '; - } else { - out += ' ' + ($closingBraces.slice(0, -1)) + ' '; - } - } - return out; -} - -},{}],18:[function(require,module,exports){ -'use strict'; -module.exports = function generate_anyOf(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $noEmptySchema = $schema.every(function($sch) { - return (it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)); - }); - if ($noEmptySchema) { - var $currentBaseId = $it.baseId; - out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { '; - $closingBraces += '}'; - } - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should match some schema in anyOf\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; return false; '; - } - } - out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - if (it.opts.allErrors) { - out += ' } '; - } - } else { - if ($breakOnError) { - out += ' if (true) { '; - } - } - return out; -} - -},{}],19:[function(require,module,exports){ -'use strict'; -module.exports = function generate_comment(it, $keyword, $ruleType) { - var out = ' '; - var $schema = it.schema[$keyword]; - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $comment = it.util.toQuotedString($schema); - if (it.opts.$comment === true) { - out += ' console.log(' + ($comment) + ');'; - } else if (typeof it.opts.$comment == 'function') { - out += ' self._opts.$comment(' + ($comment) + ', ' + (it.util.toQuotedString($errSchemaPath)) + ', validate.root.schema);'; - } - return out; -} - -},{}],20:[function(require,module,exports){ -'use strict'; -module.exports = function generate_const(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!$isData) { - out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';'; - } - out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('const') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValue: schema' + ($lvl) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be equal to constant\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' }'; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],21:[function(require,module,exports){ -'use strict'; -module.exports = function generate_contains(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $idx = 'i' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $currentBaseId = it.baseId, - $nonEmptySchema = (it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all)); - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if ($nonEmptySchema) { - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' var ' + ($nextValid) + ' = false; for (var ' + ($idx) + ' = 0; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - out += ' if (' + ($nextValid) + ') break; } '; - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($closingBraces) + ' if (!' + ($nextValid) + ') {'; - } else { - out += ' if (' + ($data) + '.length == 0) {'; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('contains') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should contain a valid item\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - if ($nonEmptySchema) { - out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - } - if (it.opts.allErrors) { - out += ' } '; - } - return out; -} - -},{}],22:[function(require,module,exports){ -'use strict'; -module.exports = function generate_custom(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $rule = this, - $definition = 'definition' + $lvl, - $rDef = $rule.definition, - $closingBraces = ''; - var $compile, $inline, $macro, $ruleValidate, $validateCode; - if ($isData && $rDef.$data) { - $validateCode = 'keywordValidate' + $lvl; - var $validateSchema = $rDef.validateSchema; - out += ' var ' + ($definition) + ' = RULES.custom[\'' + ($keyword) + '\'].definition; var ' + ($validateCode) + ' = ' + ($definition) + '.validate;'; - } else { - $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it); - if (!$ruleValidate) return; - $schemaValue = 'validate.schema' + $schemaPath; - $validateCode = $ruleValidate.code; - $compile = $rDef.compile; - $inline = $rDef.inline; - $macro = $rDef.macro; - } - var $ruleErrs = $validateCode + '.errors', - $i = 'i' + $lvl, - $ruleErr = 'ruleErr' + $lvl, - $asyncKeyword = $rDef.async; - if ($asyncKeyword && !it.async) throw new Error('async keyword in sync schema'); - if (!($inline || $macro)) { - out += '' + ($ruleErrs) + ' = null;'; - } - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if ($isData && $rDef.$data) { - $closingBraces += '}'; - out += ' if (' + ($schemaValue) + ' === undefined) { ' + ($valid) + ' = true; } else { '; - if ($validateSchema) { - $closingBraces += '}'; - out += ' ' + ($valid) + ' = ' + ($definition) + '.validateSchema(' + ($schemaValue) + '); if (' + ($valid) + ') { '; - } - } - if ($inline) { - if ($rDef.statements) { - out += ' ' + ($ruleValidate.validate) + ' '; - } else { - out += ' ' + ($valid) + ' = ' + ($ruleValidate.validate) + '; '; - } - } else if ($macro) { - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - $it.schema = $ruleValidate.validate; - $it.schemaPath = ''; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($code); - } else { - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; - out += ' ' + ($validateCode) + '.call( '; - if (it.opts.passContext) { - out += 'this'; - } else { - out += 'self'; - } - if ($compile || $rDef.schema === false) { - out += ' , ' + ($data) + ' '; - } else { - out += ' , ' + ($schemaValue) + ' , ' + ($data) + ' , validate.schema' + (it.schemaPath) + ' '; - } - out += ' , (dataPath || \'\')'; - if (it.errorPath != '""') { - out += ' + ' + (it.errorPath); - } - var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', - $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; - out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ' , rootData ) '; - var def_callRuleValidate = out; - out = $$outStack.pop(); - if ($rDef.errors === false) { - out += ' ' + ($valid) + ' = '; - if ($asyncKeyword) { - out += 'await '; - } - out += '' + (def_callRuleValidate) + '; '; - } else { - if ($asyncKeyword) { - $ruleErrs = 'customErrors' + $lvl; - out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = await ' + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } '; - } else { - out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; '; - } - } - } - if ($rDef.modifying) { - out += ' if (' + ($parentData) + ') ' + ($data) + ' = ' + ($parentData) + '[' + ($parentDataProperty) + '];'; - } - out += '' + ($closingBraces); - if ($rDef.valid) { - if ($breakOnError) { - out += ' if (true) { '; - } - } else { - out += ' if ( '; - if ($rDef.valid === undefined) { - out += ' !'; - if ($macro) { - out += '' + ($nextValid); - } else { - out += '' + ($valid); - } - } else { - out += ' ' + (!$rDef.valid) + ' '; - } - out += ') { '; - $errorKeyword = $rule.keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - var def_customError = out; - out = $$outStack.pop(); - if ($inline) { - if ($rDef.errors) { - if ($rDef.errors != 'full') { - out += ' for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + ' 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') '; - } - out += ') { '; - $it.schema = $sch; - $it.schemaPath = $schemaPath + it.util.getProperty($property); - $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property); - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; - } - return out; -} - -},{}],24:[function(require,module,exports){ -'use strict'; -module.exports = function generate_enum(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $i = 'i' + $lvl, - $vSchema = 'schema' + $lvl; - if (!$isData) { - out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + ';'; - } - out += 'var ' + ($valid) + ';'; - if ($isData) { - out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {'; - } - out += '' + ($valid) + ' = false;for (var ' + ($i) + '=0; ' + ($i) + '<' + ($vSchema) + '.length; ' + ($i) + '++) if (equal(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + '])) { ' + ($valid) + ' = true; break; }'; - if ($isData) { - out += ' } '; - } - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('enum') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValues: schema' + ($lvl) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be equal to one of the allowed values\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' }'; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],25:[function(require,module,exports){ -'use strict'; -module.exports = function generate_format(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - if (it.opts.format === false) { - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $unknownFormats = it.opts.unknownFormats, - $allowUnknown = Array.isArray($unknownFormats); - if ($isData) { - var $format = 'format' + $lvl, - $isObject = 'isObject' + $lvl, - $formatType = 'formatType' + $lvl; - out += ' var ' + ($format) + ' = formats[' + ($schemaValue) + ']; var ' + ($isObject) + ' = typeof ' + ($format) + ' == \'object\' && !(' + ($format) + ' instanceof RegExp) && ' + ($format) + '.validate; var ' + ($formatType) + ' = ' + ($isObject) + ' && ' + ($format) + '.type || \'string\'; if (' + ($isObject) + ') { '; - if (it.async) { - out += ' var async' + ($lvl) + ' = ' + ($format) + '.async; '; - } - out += ' ' + ($format) + ' = ' + ($format) + '.validate; } if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || '; - } - out += ' ('; - if ($unknownFormats != 'ignore') { - out += ' (' + ($schemaValue) + ' && !' + ($format) + ' '; - if ($allowUnknown) { - out += ' && self._opts.unknownFormats.indexOf(' + ($schemaValue) + ') == -1 '; - } - out += ') || '; - } - out += ' (' + ($format) + ' && ' + ($formatType) + ' == \'' + ($ruleType) + '\' && !(typeof ' + ($format) + ' == \'function\' ? '; - if (it.async) { - out += ' (async' + ($lvl) + ' ? await ' + ($format) + '(' + ($data) + ') : ' + ($format) + '(' + ($data) + ')) '; - } else { - out += ' ' + ($format) + '(' + ($data) + ') '; - } - out += ' : ' + ($format) + '.test(' + ($data) + '))))) {'; - } else { - var $format = it.formats[$schema]; - if (!$format) { - if ($unknownFormats == 'ignore') { - it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } else if ($allowUnknown && $unknownFormats.indexOf($schema) >= 0) { - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } else { - throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"'); - } - } - var $isObject = typeof $format == 'object' && !($format instanceof RegExp) && $format.validate; - var $formatType = $isObject && $format.type || 'string'; - if ($isObject) { - var $async = $format.async === true; - $format = $format.validate; - } - if ($formatType != $ruleType) { - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } - if ($async) { - if (!it.async) throw new Error('async format in sync schema'); - var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate'; - out += ' if (!(await ' + ($formatRef) + '(' + ($data) + '))) { '; - } else { - out += ' if (! '; - var $formatRef = 'formats' + it.util.getProperty($schema); - if ($isObject) $formatRef += '.validate'; - if (typeof $format == 'function') { - out += ' ' + ($formatRef) + '(' + ($data) + ') '; - } else { - out += ' ' + ($formatRef) + '.test(' + ($data) + ') '; - } - out += ') { '; - } - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('format') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: '; - if ($isData) { - out += '' + ($schemaValue); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match format "'; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + (it.util.escapeQuotes($schema)); - } - out += '"\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],26:[function(require,module,exports){ -'use strict'; -module.exports = function generate_if(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - $it.level++; - var $nextValid = 'valid' + $it.level; - var $thenSch = it.schema['then'], - $elseSch = it.schema['else'], - $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)), - $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)), - $currentBaseId = $it.baseId; - if ($thenPresent || $elsePresent) { - var $ifClause; - $it.createErrors = false; - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = true; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - $it.createErrors = true; - out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - it.compositeRule = $it.compositeRule = $wasComposite; - if ($thenPresent) { - out += ' if (' + ($nextValid) + ') { '; - $it.schema = it.schema['then']; - $it.schemaPath = it.schemaPath + '.then'; - $it.errSchemaPath = it.errSchemaPath + '/then'; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' ' + ($valid) + ' = ' + ($nextValid) + '; '; - if ($thenPresent && $elsePresent) { - $ifClause = 'ifClause' + $lvl; - out += ' var ' + ($ifClause) + ' = \'then\'; '; - } else { - $ifClause = '\'then\''; - } - out += ' } '; - if ($elsePresent) { - out += ' else { '; - } - } else { - out += ' if (!' + ($nextValid) + ') { '; - } - if ($elsePresent) { - $it.schema = it.schema['else']; - $it.schemaPath = it.schemaPath + '.else'; - $it.errSchemaPath = it.errSchemaPath + '/else'; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' ' + ($valid) + ' = ' + ($nextValid) + '; '; - if ($thenPresent && $elsePresent) { - $ifClause = 'ifClause' + $lvl; - out += ' var ' + ($ifClause) + ' = \'else\'; '; - } else { - $ifClause = '\'else\''; - } - out += ' } '; - } - out += ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('if') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { failingKeyword: ' + ($ifClause) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match "\' + ' + ($ifClause) + ' + \'" schema\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; return false; '; - } - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - } else { - if ($breakOnError) { - out += ' if (true) { '; - } - } - return out; -} - -},{}],27:[function(require,module,exports){ -'use strict'; - -//all requires must be explicit because browserify won't work with dynamic requires -module.exports = { - '$ref': require('./ref'), - allOf: require('./allOf'), - anyOf: require('./anyOf'), - '$comment': require('./comment'), - const: require('./const'), - contains: require('./contains'), - dependencies: require('./dependencies'), - 'enum': require('./enum'), - format: require('./format'), - 'if': require('./if'), - items: require('./items'), - maximum: require('./_limit'), - minimum: require('./_limit'), - maxItems: require('./_limitItems'), - minItems: require('./_limitItems'), - maxLength: require('./_limitLength'), - minLength: require('./_limitLength'), - maxProperties: require('./_limitProperties'), - minProperties: require('./_limitProperties'), - multipleOf: require('./multipleOf'), - not: require('./not'), - oneOf: require('./oneOf'), - pattern: require('./pattern'), - properties: require('./properties'), - propertyNames: require('./propertyNames'), - required: require('./required'), - uniqueItems: require('./uniqueItems'), - validate: require('./validate') -}; - -},{"./_limit":13,"./_limitItems":14,"./_limitLength":15,"./_limitProperties":16,"./allOf":17,"./anyOf":18,"./comment":19,"./const":20,"./contains":21,"./dependencies":23,"./enum":24,"./format":25,"./if":26,"./items":28,"./multipleOf":29,"./not":30,"./oneOf":31,"./pattern":32,"./properties":33,"./propertyNames":34,"./ref":35,"./required":36,"./uniqueItems":37,"./validate":38}],28:[function(require,module,exports){ -'use strict'; -module.exports = function generate_items(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $idx = 'i' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $currentBaseId = it.baseId; - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if (Array.isArray($schema)) { - var $additionalItems = it.schema.additionalItems; - if ($additionalItems === false) { - out += ' ' + ($valid) + ' = ' + ($data) + '.length <= ' + ($schema.length) + '; '; - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + '/additionalItems'; - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('additionalItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schema.length) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have more than ' + ($schema.length) + ' items\' '; - } - if (it.opts.verbose) { - out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - $errSchemaPath = $currErrSchemaPath; - if ($breakOnError) { - $closingBraces += '}'; - out += ' else { '; - } - } - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { '; - var $passData = $data + '[' + $i + ']'; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true); - $it.dataPathArr[$dataNxt] = $i; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? (typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0) || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) { - $it.schema = $additionalItems; - $it.schemaPath = it.schemaPath + '.additionalItems'; - $it.errSchemaPath = it.errSchemaPath + '/additionalItems'; - out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($schema.length) + ') { for (var ' + ($idx) + ' = ' + ($schema.length) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' } } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } else if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' for (var ' + ($idx) + ' = ' + (0) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' }'; - } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; - } - return out; -} - -},{}],29:[function(require,module,exports){ -'use strict'; -module.exports = function generate_multipleOf(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!($isData || typeof $schema == 'number')) { - throw new Error($keyword + ' must be number'); - } - out += 'var division' + ($lvl) + ';if ('; - if ($isData) { - out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || '; - } - out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', '; - if (it.opts.multipleOfPrecision) { - out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' '; - } else { - out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') '; - } - out += ' ) '; - if ($isData) { - out += ' ) '; - } - out += ' ) { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('multipleOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be multiple of '; - if ($isData) { - out += '\' + ' + ($schemaValue); - } else { - out += '' + ($schemaValue) + '\''; - } - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],30:[function(require,module,exports){ -'use strict'; -module.exports = function generate_not(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - $it.level++; - var $nextValid = 'valid' + $it.level; - if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' var ' + ($errs) + ' = errors; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.createErrors = false; - var $allErrorsOption; - if ($it.opts.allErrors) { - $allErrorsOption = $it.opts.allErrors; - $it.opts.allErrors = false; - } - out += ' ' + (it.validate($it)) + ' '; - $it.createErrors = true; - if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption; - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' if (' + ($nextValid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT be valid\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - if (it.opts.allErrors) { - out += ' } '; - } - } else { - out += ' var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT be valid\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if ($breakOnError) { - out += ' if (false) { '; - } - } - return out; -} - -},{}],31:[function(require,module,exports){ -'use strict'; -module.exports = function generate_oneOf(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $currentBaseId = $it.baseId, - $prevValid = 'prevValid' + $lvl, - $passingSchemas = 'passingSchemas' + $lvl; - out += 'var ' + ($errs) + ' = errors , ' + ($prevValid) + ' = false , ' + ($valid) + ' = false , ' + ($passingSchemas) + ' = null; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - } else { - out += ' var ' + ($nextValid) + ' = true; '; - } - if ($i) { - out += ' if (' + ($nextValid) + ' && ' + ($prevValid) + ') { ' + ($valid) + ' = false; ' + ($passingSchemas) + ' = [' + ($passingSchemas) + ', ' + ($i) + ']; } else { '; - $closingBraces += '}'; - } - out += ' if (' + ($nextValid) + ') { ' + ($valid) + ' = ' + ($prevValid) + ' = true; ' + ($passingSchemas) + ' = ' + ($i) + '; }'; - } - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { passingSchemas: ' + ($passingSchemas) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match exactly one schema in oneOf\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; return false; '; - } - } - out += '} else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; }'; - if (it.opts.allErrors) { - out += ' } '; - } - return out; -} - -},{}],32:[function(require,module,exports){ -'use strict'; -module.exports = function generate_pattern(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema); - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || '; - } - out += ' !' + ($regexp) + '.test(' + ($data) + ') ) { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('pattern') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern: '; - if ($isData) { - out += '' + ($schemaValue); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match pattern "'; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + (it.util.escapeQuotes($schema)); - } - out += '"\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],33:[function(require,module,exports){ -'use strict'; -module.exports = function generate_properties(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $key = 'key' + $lvl, - $idx = 'idx' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $dataProperties = 'dataProperties' + $lvl; - var $schemaKeys = Object.keys($schema || {}).filter(notProto), - $pProperties = it.schema.patternProperties || {}, - $pPropertyKeys = Object.keys($pProperties).filter(notProto), - $aProperties = it.schema.additionalProperties, - $someProperties = $schemaKeys.length || $pPropertyKeys.length, - $noAdditional = $aProperties === false, - $additionalIsSchema = typeof $aProperties == 'object' && Object.keys($aProperties).length, - $removeAdditional = it.opts.removeAdditional, - $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional, - $ownProperties = it.opts.ownProperties, - $currentBaseId = it.baseId; - var $required = it.schema.required; - if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) { - var $requiredHash = it.util.toHash($required); - } - - function notProto(p) { - return p !== '__proto__'; - } - out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;'; - if ($ownProperties) { - out += ' var ' + ($dataProperties) + ' = undefined;'; - } - if ($checkAdditional) { - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - if ($someProperties) { - out += ' var isAdditional' + ($lvl) + ' = !(false '; - if ($schemaKeys.length) { - if ($schemaKeys.length > 8) { - out += ' || validate.schema' + ($schemaPath) + '.hasOwnProperty(' + ($key) + ') '; - } else { - var arr1 = $schemaKeys; - if (arr1) { - var $propertyKey, i1 = -1, - l1 = arr1.length - 1; - while (i1 < l1) { - $propertyKey = arr1[i1 += 1]; - out += ' || ' + ($key) + ' == ' + (it.util.toQuotedString($propertyKey)) + ' '; - } - } - } - } - if ($pPropertyKeys.length) { - var arr2 = $pPropertyKeys; - if (arr2) { - var $pProperty, $i = -1, - l2 = arr2.length - 1; - while ($i < l2) { - $pProperty = arr2[$i += 1]; - out += ' || ' + (it.usePattern($pProperty)) + '.test(' + ($key) + ') '; - } - } - } - out += ' ); if (isAdditional' + ($lvl) + ') { '; - } - if ($removeAdditional == 'all') { - out += ' delete ' + ($data) + '[' + ($key) + ']; '; - } else { - var $currentErrorPath = it.errorPath; - var $additionalProperty = '\' + ' + $key + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - } - if ($noAdditional) { - if ($removeAdditional) { - out += ' delete ' + ($data) + '[' + ($key) + ']; '; - } else { - out += ' ' + ($nextValid) + ' = false; '; - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + '/additionalProperties'; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('additionalProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \'' + ($additionalProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is an invalid additional property'; - } else { - out += 'should NOT have additional properties'; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - $errSchemaPath = $currErrSchemaPath; - if ($breakOnError) { - out += ' break; '; - } - } - } else if ($additionalIsSchema) { - if ($removeAdditional == 'failing') { - out += ' var ' + ($errs) + ' = errors; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.schema = $aProperties; - $it.schemaPath = it.schemaPath + '.additionalProperties'; - $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; - $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - out += ' if (!' + ($nextValid) + ') { errors = ' + ($errs) + '; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete ' + ($data) + '[' + ($key) + ']; } '; - it.compositeRule = $it.compositeRule = $wasComposite; - } else { - $it.schema = $aProperties; - $it.schemaPath = it.schemaPath + '.additionalProperties'; - $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; - $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - } - } - it.errorPath = $currentErrorPath; - } - if ($someProperties) { - out += ' } '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - var $useDefaults = it.opts.useDefaults && !it.compositeRule; - if ($schemaKeys.length) { - var arr3 = $schemaKeys; - if (arr3) { - var $propertyKey, i3 = -1, - l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $sch = $schema[$propertyKey]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - var $prop = it.util.getProperty($propertyKey), - $passData = $data + $prop, - $hasDefault = $useDefaults && $sch.default !== undefined; - $it.schema = $sch; - $it.schemaPath = $schemaPath + $prop; - $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey); - $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers); - $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey); - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - $code = it.util.varReplace($code, $nextData, $passData); - var $useData = $passData; - } else { - var $useData = $nextData; - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; '; - } - if ($hasDefault) { - out += ' ' + ($code) + ' '; - } else { - if ($requiredHash && $requiredHash[$propertyKey]) { - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { ' + ($nextValid) + ' = false; '; - var $currentErrorPath = it.errorPath, - $currErrSchemaPath = $errSchemaPath, - $missingProperty = it.util.escapeQuotes($propertyKey); - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - $errSchemaPath = it.errSchemaPath + '/required'; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - $errSchemaPath = $currErrSchemaPath; - it.errorPath = $currentErrorPath; - out += ' } else { '; - } else { - if ($breakOnError) { - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { ' + ($nextValid) + ' = true; } else { '; - } else { - out += ' if (' + ($useData) + ' !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ' ) { '; - } - } - out += ' ' + ($code) + ' } '; - } - } - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if ($pPropertyKeys.length) { - var arr4 = $pPropertyKeys; - if (arr4) { - var $pProperty, i4 = -1, - l4 = arr4.length - 1; - while (i4 < l4) { - $pProperty = arr4[i4 += 1]; - var $sch = $pProperties[$pProperty]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - $it.schema = $sch; - $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty); - $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty); - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - out += ' if (' + (it.usePattern($pProperty)) + '.test(' + ($key) + ')) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else ' + ($nextValid) + ' = true; '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; - } - return out; -} - -},{}],34:[function(require,module,exports){ -'use strict'; -module.exports = function generate_propertyNames(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - out += 'var ' + ($errs) + ' = errors;'; - if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - var $key = 'key' + $lvl, - $idx = 'idx' + $lvl, - $i = 'i' + $lvl, - $invalidName = '\' + ' + $key + ' + \'', - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $dataProperties = 'dataProperties' + $lvl, - $ownProperties = it.opts.ownProperties, - $currentBaseId = it.baseId; - if ($ownProperties) { - out += ' var ' + ($dataProperties) + ' = undefined; '; - } - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - out += ' var startErrs' + ($lvl) + ' = errors; '; - var $passData = $key; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' if (!' + ($nextValid) + ') { for (var ' + ($i) + '=startErrs' + ($lvl) + '; ' + ($i) + ' 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) { - $required[$required.length] = $property; - } - } - } - } else { - var $required = $schema; - } - } - if ($isData || $required.length) { - var $currentErrorPath = it.errorPath, - $loopRequired = $isData || $required.length >= it.opts.loopRequired, - $ownProperties = it.opts.ownProperties; - if ($breakOnError) { - out += ' var missing' + ($lvl) + '; '; - if ($loopRequired) { - if (!$isData) { - out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; - } - var $i = 'i' + $lvl, - $propertyPath = 'schema' + $lvl + '[' + $i + ']', - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); - } - out += ' var ' + ($valid) + ' = true; '; - if ($isData) { - out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {'; - } - out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) '; - } - out += '; if (!' + ($valid) + ') break; } '; - if ($isData) { - out += ' } '; - } - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - } else { - out += ' if ( '; - var arr2 = $required; - if (arr2) { - var $propertyKey, $i = -1, - l2 = arr2.length - 1; - while ($i < l2) { - $propertyKey = arr2[$i += 1]; - if ($i) { - out += ' || '; - } - var $prop = it.util.getProperty($propertyKey), - $useData = $data + $prop; - out += ' ( ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) '; - } - } - out += ') { '; - var $propertyPath = 'missing' + $lvl, - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - } - } else { - if ($loopRequired) { - if (!$isData) { - out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; - } - var $i = 'i' + $lvl, - $propertyPath = 'schema' + $lvl + '[' + $i + ']', - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); - } - if ($isData) { - out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { '; - } - out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) '; - } - out += ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } '; - if ($isData) { - out += ' } '; - } - } else { - var arr3 = $required; - if (arr3) { - var $propertyKey, i3 = -1, - l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $prop = it.util.getProperty($propertyKey), - $missingProperty = it.util.escapeQuotes($propertyKey), - $useData = $data + $prop; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } '; - } - } - } - } - it.errorPath = $currentErrorPath; - } else if ($breakOnError) { - out += ' if (true) {'; - } - return out; -} - -},{}],37:[function(require,module,exports){ -'use strict'; -module.exports = function generate_uniqueItems(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (($schema || $isData) && it.opts.uniqueItems !== false) { - if ($isData) { - out += ' var ' + ($valid) + '; if (' + ($schemaValue) + ' === false || ' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'boolean\') ' + ($valid) + ' = false; else { '; - } - out += ' var i = ' + ($data) + '.length , ' + ($valid) + ' = true , j; if (i > 1) { '; - var $itemType = it.schema.items && it.schema.items.type, - $typeIsArray = Array.isArray($itemType); - if (!$itemType || $itemType == 'object' || $itemType == 'array' || ($typeIsArray && ($itemType.indexOf('object') >= 0 || $itemType.indexOf('array') >= 0))) { - out += ' outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } '; - } else { - out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; '; - var $method = 'checkDataType' + ($typeIsArray ? 's' : ''); - out += ' if (' + (it.util[$method]($itemType, 'item', it.opts.strictNumbers, true)) + ') continue; '; - if ($typeIsArray) { - out += ' if (typeof item == \'string\') item = \'"\' + item; '; - } - out += ' if (typeof itemIndices[item] == \'number\') { ' + ($valid) + ' = false; j = itemIndices[item]; break; } itemIndices[item] = i; } '; - } - out += ' } '; - if ($isData) { - out += ' } '; - } - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('uniqueItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { i: i, j: j } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have duplicate items (items ## \' + j + \' and \' + i + \' are identical)\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - } else { - if ($breakOnError) { - out += ' if (true) { '; - } - } - return out; -} - -},{}],38:[function(require,module,exports){ -'use strict'; -module.exports = function generate_validate(it, $keyword, $ruleType) { - var out = ''; - var $async = it.schema.$async === true, - $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref'), - $id = it.self._getId(it.schema); - if (it.opts.strictKeywords) { - var $unknownKwd = it.util.schemaUnknownRules(it.schema, it.RULES.keywords); - if ($unknownKwd) { - var $keywordsMsg = 'unknown keyword: ' + $unknownKwd; - if (it.opts.strictKeywords === 'log') it.logger.warn($keywordsMsg); - else throw new Error($keywordsMsg); - } - } - if (it.isTop) { - out += ' var validate = '; - if ($async) { - it.async = true; - out += 'async '; - } - out += 'function(data, dataPath, parentData, parentDataProperty, rootData) { \'use strict\'; '; - if ($id && (it.opts.sourceCode || it.opts.processCode)) { - out += ' ' + ('/\*# sourceURL=' + $id + ' */') + ' '; - } - } - if (typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref)) { - var $keyword = 'false schema'; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - if (it.schema === false) { - if (it.isTop) { - $breakOnError = true; - } else { - out += ' var ' + ($valid) + ' = false; '; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'false schema') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'boolean schema is false\' '; - } - if (it.opts.verbose) { - out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - } else { - if (it.isTop) { - if ($async) { - out += ' return data; '; - } else { - out += ' validate.errors = null; return true; '; - } - } else { - out += ' var ' + ($valid) + ' = true; '; - } - } - if (it.isTop) { - out += ' }; return validate; '; - } - return out; - } - if (it.isTop) { - var $top = it.isTop, - $lvl = it.level = 0, - $dataLvl = it.dataLevel = 0, - $data = 'data'; - it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema)); - it.baseId = it.baseId || it.rootId; - delete it.isTop; - it.dataPathArr = [""]; - if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) { - var $defaultMsg = 'default is ignored in the schema root'; - if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); - else throw new Error($defaultMsg); - } - out += ' var vErrors = null; '; - out += ' var errors = 0; '; - out += ' if (rootData === undefined) rootData = data; '; - } else { - var $lvl = it.level, - $dataLvl = it.dataLevel, - $data = 'data' + ($dataLvl || ''); - if ($id) it.baseId = it.resolve.url(it.baseId, $id); - if ($async && !it.async) throw new Error('async schema in sync schema'); - out += ' var errs_' + ($lvl) + ' = errors;'; - } - var $valid = 'valid' + $lvl, - $breakOnError = !it.opts.allErrors, - $closingBraces1 = '', - $closingBraces2 = ''; - var $errorKeyword; - var $typeSchema = it.schema.type, - $typeIsArray = Array.isArray($typeSchema); - if ($typeSchema && it.opts.nullable && it.schema.nullable === true) { - if ($typeIsArray) { - if ($typeSchema.indexOf('null') == -1) $typeSchema = $typeSchema.concat('null'); - } else if ($typeSchema != 'null') { - $typeSchema = [$typeSchema, 'null']; - $typeIsArray = true; - } - } - if ($typeIsArray && $typeSchema.length == 1) { - $typeSchema = $typeSchema[0]; - $typeIsArray = false; - } - if (it.schema.$ref && $refKeywords) { - if (it.opts.extendRefs == 'fail') { - throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); - } else if (it.opts.extendRefs !== true) { - $refKeywords = false; - it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"'); - } - } - if (it.schema.$comment && it.opts.$comment) { - out += ' ' + (it.RULES.all.$comment.code(it, '$comment')); - } - if ($typeSchema) { - if (it.opts.coerceTypes) { - var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); - } - var $rulesGroup = it.RULES.types[$typeSchema]; - if ($coerceToTypes || $typeIsArray || $rulesGroup === true || ($rulesGroup && !$shouldUseGroup($rulesGroup))) { - var $schemaPath = it.schemaPath + '.type', - $errSchemaPath = it.errSchemaPath + '/type'; - var $schemaPath = it.schemaPath + '.type', - $errSchemaPath = it.errSchemaPath + '/type', - $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType'; - out += ' if (' + (it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true)) + ') { '; - if ($coerceToTypes) { - var $dataType = 'dataType' + $lvl, - $coerced = 'coerced' + $lvl; - out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; var ' + ($coerced) + ' = undefined; '; - if (it.opts.coerceTypes == 'array') { - out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ') && ' + ($data) + '.length == 1) { ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; if (' + (it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)) + ') ' + ($coerced) + ' = ' + ($data) + '; } '; - } - out += ' if (' + ($coerced) + ' !== undefined) ; '; - var arr1 = $coerceToTypes; - if (arr1) { - var $type, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $type = arr1[$i += 1]; - if ($type == 'string') { - out += ' else if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; '; - } else if ($type == 'number' || $type == 'integer') { - out += ' else if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' '; - if ($type == 'integer') { - out += ' && !(' + ($data) + ' % 1)'; - } - out += ')) ' + ($coerced) + ' = +' + ($data) + '; '; - } else if ($type == 'boolean') { - out += ' else if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; '; - } else if ($type == 'null') { - out += ' else if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; '; - } else if (it.opts.coerceTypes == 'array' && $type == 'array') { - out += ' else if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; '; - } - } - } - out += ' else { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be '; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } if (' + ($coerced) + ' !== undefined) { '; - var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', - $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; - out += ' ' + ($data) + ' = ' + ($coerced) + '; '; - if (!$dataLvl) { - out += 'if (' + ($parentData) + ' !== undefined)'; - } - out += ' ' + ($parentData) + '[' + ($parentDataProperty) + '] = ' + ($coerced) + '; } '; - } else { - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be '; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - } - out += ' } '; - } - } - if (it.schema.$ref && !$refKeywords) { - out += ' ' + (it.RULES.all.$ref.code(it, '$ref')) + ' '; - if ($breakOnError) { - out += ' } if (errors === '; - if ($top) { - out += '0'; - } else { - out += 'errs_' + ($lvl); - } - out += ') { '; - $closingBraces2 += '}'; - } - } else { - var arr2 = it.RULES; - if (arr2) { - var $rulesGroup, i2 = -1, - l2 = arr2.length - 1; - while (i2 < l2) { - $rulesGroup = arr2[i2 += 1]; - if ($shouldUseGroup($rulesGroup)) { - if ($rulesGroup.type) { - out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers)) + ') { '; - } - if (it.opts.useDefaults) { - if ($rulesGroup.type == 'object' && it.schema.properties) { - var $schema = it.schema.properties, - $schemaKeys = Object.keys($schema); - var arr3 = $schemaKeys; - if (arr3) { - var $propertyKey, i3 = -1, - l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $sch = $schema[$propertyKey]; - if ($sch.default !== undefined) { - var $passData = $data + it.util.getProperty($propertyKey); - if (it.compositeRule) { - if (it.opts.strictDefaults) { - var $defaultMsg = 'default is ignored for: ' + $passData; - if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); - else throw new Error($defaultMsg); - } - } else { - out += ' if (' + ($passData) + ' === undefined '; - if (it.opts.useDefaults == 'empty') { - out += ' || ' + ($passData) + ' === null || ' + ($passData) + ' === \'\' '; - } - out += ' ) ' + ($passData) + ' = '; - if (it.opts.useDefaults == 'shared') { - out += ' ' + (it.useDefault($sch.default)) + ' '; - } else { - out += ' ' + (JSON.stringify($sch.default)) + ' '; - } - out += '; '; - } - } - } - } - } else if ($rulesGroup.type == 'array' && Array.isArray(it.schema.items)) { - var arr4 = it.schema.items; - if (arr4) { - var $sch, $i = -1, - l4 = arr4.length - 1; - while ($i < l4) { - $sch = arr4[$i += 1]; - if ($sch.default !== undefined) { - var $passData = $data + '[' + $i + ']'; - if (it.compositeRule) { - if (it.opts.strictDefaults) { - var $defaultMsg = 'default is ignored for: ' + $passData; - if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); - else throw new Error($defaultMsg); - } - } else { - out += ' if (' + ($passData) + ' === undefined '; - if (it.opts.useDefaults == 'empty') { - out += ' || ' + ($passData) + ' === null || ' + ($passData) + ' === \'\' '; - } - out += ' ) ' + ($passData) + ' = '; - if (it.opts.useDefaults == 'shared') { - out += ' ' + (it.useDefault($sch.default)) + ' '; - } else { - out += ' ' + (JSON.stringify($sch.default)) + ' '; - } - out += '; '; - } - } - } - } - } - } - var arr5 = $rulesGroup.rules; - if (arr5) { - var $rule, i5 = -1, - l5 = arr5.length - 1; - while (i5 < l5) { - $rule = arr5[i5 += 1]; - if ($shouldUseRule($rule)) { - var $code = $rule.code(it, $rule.keyword, $rulesGroup.type); - if ($code) { - out += ' ' + ($code) + ' '; - if ($breakOnError) { - $closingBraces1 += '}'; - } - } - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces1) + ' '; - $closingBraces1 = ''; - } - if ($rulesGroup.type) { - out += ' } '; - if ($typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes) { - out += ' else { '; - var $schemaPath = it.schemaPath + '.type', - $errSchemaPath = it.errSchemaPath + '/type'; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be '; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - } - } - if ($breakOnError) { - out += ' if (errors === '; - if ($top) { - out += '0'; - } else { - out += 'errs_' + ($lvl); - } - out += ') { '; - $closingBraces2 += '}'; - } - } - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces2) + ' '; - } - if ($top) { - if ($async) { - out += ' if (errors === 0) return data; '; - out += ' else throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; '; - out += ' return errors === 0; '; - } - out += ' }; return validate;'; - } else { - out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';'; - } - - function $shouldUseGroup($rulesGroup) { - var rules = $rulesGroup.rules; - for (var i = 0; i < rules.length; i++) - if ($shouldUseRule(rules[i])) return true; - } - - function $shouldUseRule($rule) { - return it.schema[$rule.keyword] !== undefined || ($rule.implements && $ruleImplementsSomeKeyword($rule)); - } - - function $ruleImplementsSomeKeyword($rule) { - var impl = $rule.implements; - for (var i = 0; i < impl.length; i++) - if (it.schema[impl[i]] !== undefined) return true; - } - return out; -} - -},{}],39:[function(require,module,exports){ -'use strict'; - -var IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i; -var customRuleCode = require('./dotjs/custom'); -var definitionSchema = require('./definition_schema'); - -module.exports = { - add: addKeyword, - get: getKeyword, - remove: removeKeyword, - validate: validateKeyword -}; - - -/** - * Define custom keyword - * @this Ajv - * @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords). - * @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`. - * @return {Ajv} this for method chaining - */ -function addKeyword(keyword, definition) { - /* jshint validthis: true */ - /* eslint no-shadow: 0 */ - var RULES = this.RULES; - if (RULES.keywords[keyword]) - throw new Error('Keyword ' + keyword + ' is already defined'); - - if (!IDENTIFIER.test(keyword)) - throw new Error('Keyword ' + keyword + ' is not a valid identifier'); - - if (definition) { - this.validateKeyword(definition, true); - - var dataType = definition.type; - if (Array.isArray(dataType)) { - for (var i=0; i 1) { - sets[0] = sets[0].slice(0, -1); - var xl = sets.length - 1; - for (var x = 1; x < xl; ++x) { - sets[x] = sets[x].slice(1, -1); - } - sets[xl] = sets[xl].slice(1); - return sets.join(''); - } else { - return sets[0]; - } -} -function subexp(str) { - return "(?:" + str + ")"; -} -function typeOf(o) { - return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase(); -} -function toUpperCase(str) { - return str.toUpperCase(); -} -function toArray(obj) { - return obj !== undefined && obj !== null ? obj instanceof Array ? obj : typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj) : []; -} -function assign(target, source) { - var obj = target; - if (source) { - for (var key in source) { - obj[key] = source[key]; - } - } - return obj; -} - -function buildExps(isIRI) { - var ALPHA$$ = "[A-Za-z]", - CR$ = "[\\x0D]", - DIGIT$$ = "[0-9]", - DQUOTE$$ = "[\\x22]", - HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"), - //case-insensitive - LF$$ = "[\\x0A]", - SP$$ = "[\\x20]", - PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)), - //expanded - GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]", - SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", - RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$), - UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", - //subset, excludes bidi control characters - IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]", - //subset - UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$), - SCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*"), - USERINFO$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*"), - DEC_OCTET$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("[1-9]" + DIGIT$$) + "|" + DIGIT$$), - DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$), - //relaxed parsing rules - IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$), - H16$ = subexp(HEXDIG$$ + "{1,4}"), - LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$), - IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$), - // 6( h16 ":" ) ls32 - IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$), - // "::" 5( h16 ":" ) ls32 - IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$), - //[ h16 ] "::" 4( h16 ":" ) ls32 - IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$), - //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 - IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$), - //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 - IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$), - //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 - IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$), - //[ *4( h16 ":" ) h16 ] "::" ls32 - IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$), - //[ *5( h16 ":" ) h16 ] "::" h16 - IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"), - //[ *6( h16 ":" ) h16 ] "::" - IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")), - ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+"), - //RFC 6874 - IPV6ADDRZ$ = subexp(IPV6ADDRESS$ + "\\%25" + ZONEID$), - //RFC 6874 - IPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + ZONEID$), - //RFC 6874, with relaxed parsing rules - IPVFUTURE$ = subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+"), - IP_LITERAL$ = subexp("\\[" + subexp(IPV6ADDRZ_RELAXED$ + "|" + IPV6ADDRESS$ + "|" + IPVFUTURE$) + "\\]"), - //RFC 6874 - REG_NAME$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*"), - HOST$ = subexp(IP_LITERAL$ + "|" + IPV4ADDRESS$ + "(?!" + REG_NAME$ + ")" + "|" + REG_NAME$), - PORT$ = subexp(DIGIT$$ + "*"), - AUTHORITY$ = subexp(subexp(USERINFO$ + "@") + "?" + HOST$ + subexp("\\:" + PORT$) + "?"), - PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]")), - SEGMENT$ = subexp(PCHAR$ + "*"), - SEGMENT_NZ$ = subexp(PCHAR$ + "+"), - SEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+"), - PATH_ABEMPTY$ = subexp(subexp("\\/" + SEGMENT$) + "*"), - PATH_ABSOLUTE$ = subexp("\\/" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + "?"), - //simplified - PATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$), - //simplified - PATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$), - //simplified - PATH_EMPTY$ = "(?!" + PCHAR$ + ")", - PATH$ = subexp(PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), - QUERY$ = subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*"), - FRAGMENT$ = subexp(subexp(PCHAR$ + "|[\\/\\?]") + "*"), - HIER_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), - URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), - RELATIVE_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$), - RELATIVE$ = subexp(RELATIVE_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), - URI_REFERENCE$ = subexp(URI$ + "|" + RELATIVE$), - ABSOLUTE_URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?"), - GENERIC_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", - RELATIVE_REF$ = "^(){0}" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", - ABSOLUTE_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?$", - SAMEDOC_REF$ = "^" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", - AUTHORITY_REF$ = "^" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?$"; - return { - NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"), - NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"), - NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"), - NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"), - NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"), - NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"), - NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"), - ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"), - UNRESERVED: new RegExp(UNRESERVED$$, "g"), - OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"), - PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"), - IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"), - IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules - }; -} -var URI_PROTOCOL = buildExps(false); - -var IRI_PROTOCOL = buildExps(true); - -var slicedToArray = function () { - function sliceIterator(arr, i) { - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; - - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"]) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; - } - - return function (arr, i) { - if (Array.isArray(arr)) { - return arr; - } else if (Symbol.iterator in Object(arr)) { - return sliceIterator(arr, i); - } else { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); - } - }; -}(); - - - - - - - - - - - - - -var toConsumableArray = function (arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - - return arr2; - } else { - return Array.from(arr); - } -}; - -/** Highest positive signed 32-bit float value */ - -var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 - -/** Bootstring parameters */ -var base = 36; -var tMin = 1; -var tMax = 26; -var skew = 38; -var damp = 700; -var initialBias = 72; -var initialN = 128; // 0x80 -var delimiter = '-'; // '\x2D' - -/** Regular expressions */ -var regexPunycode = /^xn--/; -var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars -var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators - -/** Error messages */ -var 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 */ -var baseMinusTMin = base - tMin; -var floor = Math.floor; -var stringFromCharCode = String.fromCharCode; - -/*--------------------------------------------------------------------------*/ - -/** - * A generic error utility function. - * @private - * @param {String} type The error type. - * @returns {Error} Throws a `RangeError` with the applicable error message. - */ -function error$1(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 result = []; - var length = array.length; - 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 = []; - var counter = 0; - var length = string.length; - while (counter < length) { - var value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // It's a high surrogate, and there is a next character. - var extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { - // Low surrogate. - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // It's an 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). - */ -var ucs2encode = function ucs2encode(array) { - return String.fromCodePoint.apply(String, toConsumableArray(array)); -}; - -/** - * 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. - */ -var basicToDigit = function basicToDigit(codePoint) { - if (codePoint - 0x30 < 0x0A) { - return codePoint - 0x16; - } - if (codePoint - 0x41 < 0x1A) { - return codePoint - 0x41; - } - if (codePoint - 0x61 < 0x1A) { - return codePoint - 0x61; - } - 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. - */ -var digitToBasic = 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 - */ -var adapt = 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. - */ -var decode = function decode(input) { - // Don't use UCS-2. - var output = []; - var inputLength = input.length; - var i = 0; - var n = initialN; - var bias = initialBias; - - // 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. - - var basic = input.lastIndexOf(delimiter); - if (basic < 0) { - basic = 0; - } - - for (var j = 0; j < basic; ++j) { - // if it's not a basic code point - if (input.charCodeAt(j) >= 0x80) { - error$1('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 (var 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`. - var oldi = i; - for (var w = 1, k = base;; /* no condition */k += base) { - - if (index >= inputLength) { - error$1('invalid-input'); - } - - var digit = basicToDigit(input.charCodeAt(index++)); - - if (digit >= base || digit > floor((maxInt - i) / w)) { - error$1('overflow'); - } - - i += digit * w; - var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; - - if (digit < t) { - break; - } - - var baseMinusT = base - t; - if (w > floor(maxInt / baseMinusT)) { - error$1('overflow'); - } - - w *= baseMinusT; - } - - var 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$1('overflow'); - } - - n += floor(i / out); - i %= out; - - // Insert `n` at position `i` of the output. - output.splice(i++, 0, n); - } - - return String.fromCodePoint.apply(String, 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. - */ -var encode = function encode(input) { - var output = []; - - // Convert the input in UCS-2 to an array of Unicode code points. - input = ucs2decode(input); - - // Cache the length. - var inputLength = input.length; - - // Initialize the state. - var n = initialN; - var delta = 0; - var bias = initialBias; - - // Handle the basic code points. - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var _currentValue2 = _step.value; - - if (_currentValue2 < 0x80) { - output.push(stringFromCharCode(_currentValue2)); - } - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - var basicLength = output.length; - var handledCPCount = basicLength; - - // `handledCPCount` is the number of code points that have been handled; - // `basicLength` is the number of basic code points. - - // Finish the basic string with a delimiter unless it's empty. - 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: - var m = maxInt; - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; - - try { - for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var currentValue = _step2.value; - - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } - - // Increase `delta` enough to advance the decoder's state to , - // but guard against overflow. - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } - - var handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - error$1('overflow'); - } - - delta += (m - n) * handledCPCountPlusOne; - n = m; - - var _iteratorNormalCompletion3 = true; - var _didIteratorError3 = false; - var _iteratorError3 = undefined; - - try { - for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { - var _currentValue = _step3.value; - - if (_currentValue < n && ++delta > maxInt) { - error$1('overflow'); - } - if (_currentValue == n) { - // Represent delta as a generalized variable-length integer. - var q = delta; - for (var k = base;; /* no condition */k += base) { - var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; - if (q < t) { - break; - } - var qMinusT = q - t; - var 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; - } - } - } catch (err) { - _didIteratorError3 = true; - _iteratorError3 = err; - } finally { - try { - if (!_iteratorNormalCompletion3 && _iterator3.return) { - _iterator3.return(); - } - } finally { - if (_didIteratorError3) { - throw _iteratorError3; - } - } - } - - ++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. - */ -var toUnicode = 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. - */ -var toASCII = function toASCII(input) { - return mapDomain(input, function (string) { - return regexNonASCII.test(string) ? 'xn--' + encode(string) : string; - }); -}; - -/*--------------------------------------------------------------------------*/ - -/** Define the public API */ -var punycode = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - 'version': '2.1.0', - /** - * 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 -}; - -/** - * URI.js - * - * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript. - * @author Gary Court - * @see http://github.com/garycourt/uri-js - */ -/** - * Copyright 2011 Gary Court. 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. - * - * THIS SOFTWARE IS PROVIDED BY GARY COURT ``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 GARY COURT 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. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of Gary Court. - */ -var SCHEMES = {}; -function pctEncChar(chr) { - var c = chr.charCodeAt(0); - var e = void 0; - if (c < 16) e = "%0" + c.toString(16).toUpperCase();else if (c < 128) e = "%" + c.toString(16).toUpperCase();else if (c < 2048) e = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();else e = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase(); - return e; -} -function pctDecChars(str) { - var newStr = ""; - var i = 0; - var il = str.length; - while (i < il) { - var c = parseInt(str.substr(i + 1, 2), 16); - if (c < 128) { - newStr += String.fromCharCode(c); - i += 3; - } else if (c >= 194 && c < 224) { - if (il - i >= 6) { - var c2 = parseInt(str.substr(i + 4, 2), 16); - newStr += String.fromCharCode((c & 31) << 6 | c2 & 63); - } else { - newStr += str.substr(i, 6); - } - i += 6; - } else if (c >= 224) { - if (il - i >= 9) { - var _c = parseInt(str.substr(i + 4, 2), 16); - var c3 = parseInt(str.substr(i + 7, 2), 16); - newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63); - } else { - newStr += str.substr(i, 9); - } - i += 9; - } else { - newStr += str.substr(i, 3); - i += 3; - } - } - return newStr; -} -function _normalizeComponentEncoding(components, protocol) { - function decodeUnreserved(str) { - var decStr = pctDecChars(str); - return !decStr.match(protocol.UNRESERVED) ? str : decStr; - } - if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, ""); - if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - if (components.host !== undefined) components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - if (components.path !== undefined) components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - return components; -} - -function _stripLeadingZeros(str) { - return str.replace(/^0*(.*)/, "$1") || "0"; -} -function _normalizeIPv4(host, protocol) { - var matches = host.match(protocol.IPV4ADDRESS) || []; - - var _matches = slicedToArray(matches, 2), - address = _matches[1]; - - if (address) { - return address.split(".").map(_stripLeadingZeros).join("."); - } else { - return host; - } -} -function _normalizeIPv6(host, protocol) { - var matches = host.match(protocol.IPV6ADDRESS) || []; - - var _matches2 = slicedToArray(matches, 3), - address = _matches2[1], - zone = _matches2[2]; - - if (address) { - var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(), - _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2), - last = _address$toLowerCase$2[0], - first = _address$toLowerCase$2[1]; - - var firstFields = first ? first.split(":").map(_stripLeadingZeros) : []; - var lastFields = last.split(":").map(_stripLeadingZeros); - var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]); - var fieldCount = isLastFieldIPv4Address ? 7 : 8; - var lastFieldsStart = lastFields.length - fieldCount; - var fields = Array(fieldCount); - for (var x = 0; x < fieldCount; ++x) { - fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || ''; - } - if (isLastFieldIPv4Address) { - fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol); - } - var allZeroFields = fields.reduce(function (acc, field, index) { - if (!field || field === "0") { - var lastLongest = acc[acc.length - 1]; - if (lastLongest && lastLongest.index + lastLongest.length === index) { - lastLongest.length++; - } else { - acc.push({ index: index, length: 1 }); - } - } - return acc; - }, []); - var longestZeroFields = allZeroFields.sort(function (a, b) { - return b.length - a.length; - })[0]; - var newHost = void 0; - if (longestZeroFields && longestZeroFields.length > 1) { - var newFirst = fields.slice(0, longestZeroFields.index); - var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length); - newHost = newFirst.join(":") + "::" + newLast.join(":"); - } else { - newHost = fields.join(":"); - } - if (zone) { - newHost += "%" + zone; - } - return newHost; - } else { - return host; - } -} -var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i; -var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined; -function parse(uriString) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var components = {}; - var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL; - if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString; - var matches = uriString.match(URI_PARSE); - if (matches) { - if (NO_MATCH_IS_UNDEFINED) { - //store each component - components.scheme = matches[1]; - components.userinfo = matches[3]; - components.host = matches[4]; - components.port = parseInt(matches[5], 10); - components.path = matches[6] || ""; - components.query = matches[7]; - components.fragment = matches[8]; - //fix port number - if (isNaN(components.port)) { - components.port = matches[5]; - } - } else { - //IE FIX for improper RegExp matching - //store each component - components.scheme = matches[1] || undefined; - components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined; - components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined; - components.port = parseInt(matches[5], 10); - components.path = matches[6] || ""; - components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined; - components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined; - //fix port number - if (isNaN(components.port)) { - components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined; - } - } - if (components.host) { - //normalize IP hosts - components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol); - } - //determine reference type - if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) { - components.reference = "same-document"; - } else if (components.scheme === undefined) { - components.reference = "relative"; - } else if (components.fragment === undefined) { - components.reference = "absolute"; - } else { - components.reference = "uri"; - } - //check for reference errors - if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) { - components.error = components.error || "URI is not a " + options.reference + " reference."; - } - //find scheme handler - var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()]; - //check if scheme can't handle IRIs - if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) { - //if host component is a domain name - if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) { - //convert Unicode IDN -> ASCII IDN - try { - components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()); - } catch (e) { - components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e; - } - } - //convert IRI -> URI - _normalizeComponentEncoding(components, URI_PROTOCOL); - } else { - //normalize encodings - _normalizeComponentEncoding(components, protocol); - } - //perform scheme specific parsing - if (schemeHandler && schemeHandler.parse) { - schemeHandler.parse(components, options); - } - } else { - components.error = components.error || "URI can not be parsed."; - } - return components; -} - -function _recomposeAuthority(components, options) { - var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL; - var uriTokens = []; - if (components.userinfo !== undefined) { - uriTokens.push(components.userinfo); - uriTokens.push("@"); - } - if (components.host !== undefined) { - //normalize IP hosts, add brackets and escape zone separator for IPv6 - uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) { - return "[" + $1 + ($2 ? "%25" + $2 : "") + "]"; - })); - } - if (typeof components.port === "number" || typeof components.port === "string") { - uriTokens.push(":"); - uriTokens.push(String(components.port)); - } - return uriTokens.length ? uriTokens.join("") : undefined; -} - -var RDS1 = /^\.\.?\//; -var RDS2 = /^\/\.(\/|$)/; -var RDS3 = /^\/\.\.(\/|$)/; -var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/; -function removeDotSegments(input) { - var output = []; - while (input.length) { - if (input.match(RDS1)) { - input = input.replace(RDS1, ""); - } else if (input.match(RDS2)) { - input = input.replace(RDS2, "/"); - } else if (input.match(RDS3)) { - input = input.replace(RDS3, "/"); - output.pop(); - } else if (input === "." || input === "..") { - input = ""; - } else { - var im = input.match(RDS5); - if (im) { - var s = im[0]; - input = input.slice(s.length); - output.push(s); - } else { - throw new Error("Unexpected dot segment condition"); - } - } - } - return output.join(""); -} - -function serialize(components) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL; - var uriTokens = []; - //find scheme handler - var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()]; - //perform scheme specific serialization - if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options); - if (components.host) { - //if host component is an IPv6 address - if (protocol.IPV6ADDRESS.test(components.host)) {} - //TODO: normalize IPv6 address as per RFC 5952 - - //if host component is a domain name - else if (options.domainHost || schemeHandler && schemeHandler.domainHost) { - //convert IDN via punycode - try { - components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host); - } catch (e) { - components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e; - } - } - } - //normalize encoding - _normalizeComponentEncoding(components, protocol); - if (options.reference !== "suffix" && components.scheme) { - uriTokens.push(components.scheme); - uriTokens.push(":"); - } - var authority = _recomposeAuthority(components, options); - if (authority !== undefined) { - if (options.reference !== "suffix") { - uriTokens.push("//"); - } - uriTokens.push(authority); - if (components.path && components.path.charAt(0) !== "/") { - uriTokens.push("/"); - } - } - if (components.path !== undefined) { - var s = components.path; - if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) { - s = removeDotSegments(s); - } - if (authority === undefined) { - s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//" - } - uriTokens.push(s); - } - if (components.query !== undefined) { - uriTokens.push("?"); - uriTokens.push(components.query); - } - if (components.fragment !== undefined) { - uriTokens.push("#"); - uriTokens.push(components.fragment); - } - return uriTokens.join(""); //merge tokens into a string -} - -function resolveComponents(base, relative) { - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - var skipNormalization = arguments[3]; - - var target = {}; - if (!skipNormalization) { - base = parse(serialize(base, options), options); //normalize base components - relative = parse(serialize(relative, options), options); //normalize relative components - } - options = options || {}; - if (!options.tolerant && relative.scheme) { - target.scheme = relative.scheme; - //target.authority = relative.authority; - target.userinfo = relative.userinfo; - target.host = relative.host; - target.port = relative.port; - target.path = removeDotSegments(relative.path || ""); - target.query = relative.query; - } else { - if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) { - //target.authority = relative.authority; - target.userinfo = relative.userinfo; - target.host = relative.host; - target.port = relative.port; - target.path = removeDotSegments(relative.path || ""); - target.query = relative.query; - } else { - if (!relative.path) { - target.path = base.path; - if (relative.query !== undefined) { - target.query = relative.query; - } else { - target.query = base.query; - } - } else { - if (relative.path.charAt(0) === "/") { - target.path = removeDotSegments(relative.path); - } else { - if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) { - target.path = "/" + relative.path; - } else if (!base.path) { - target.path = relative.path; - } else { - target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path; - } - target.path = removeDotSegments(target.path); - } - target.query = relative.query; - } - //target.authority = base.authority; - target.userinfo = base.userinfo; - target.host = base.host; - target.port = base.port; - } - target.scheme = base.scheme; - } - target.fragment = relative.fragment; - return target; -} - -function resolve(baseURI, relativeURI, options) { - var schemelessOptions = assign({ scheme: 'null' }, options); - return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions); -} - -function normalize(uri, options) { - if (typeof uri === "string") { - uri = serialize(parse(uri, options), options); - } else if (typeOf(uri) === "object") { - uri = parse(serialize(uri, options), options); - } - return uri; -} - -function equal(uriA, uriB, options) { - if (typeof uriA === "string") { - uriA = serialize(parse(uriA, options), options); - } else if (typeOf(uriA) === "object") { - uriA = serialize(uriA, options); - } - if (typeof uriB === "string") { - uriB = serialize(parse(uriB, options), options); - } else if (typeOf(uriB) === "object") { - uriB = serialize(uriB, options); - } - return uriA === uriB; -} - -function escapeComponent(str, options) { - return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar); -} - -function unescapeComponent(str, options) { - return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars); -} - -var handler = { - scheme: "http", - domainHost: true, - parse: function parse(components, options) { - //report missing host - if (!components.host) { - components.error = components.error || "HTTP URIs must have a host."; - } - return components; - }, - serialize: function serialize(components, options) { - var secure = String(components.scheme).toLowerCase() === "https"; - //normalize the default port - if (components.port === (secure ? 443 : 80) || components.port === "") { - components.port = undefined; - } - //normalize the empty path - if (!components.path) { - components.path = "/"; - } - //NOTE: We do not parse query strings for HTTP URIs - //as WWW Form Url Encoded query strings are part of the HTML4+ spec, - //and not the HTTP spec. - return components; - } -}; - -var handler$1 = { - scheme: "https", - domainHost: handler.domainHost, - parse: handler.parse, - serialize: handler.serialize -}; - -function isSecure(wsComponents) { - return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss"; -} -//RFC 6455 -var handler$2 = { - scheme: "ws", - domainHost: true, - parse: function parse(components, options) { - var wsComponents = components; - //indicate if the secure flag is set - wsComponents.secure = isSecure(wsComponents); - //construct resouce name - wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : ''); - wsComponents.path = undefined; - wsComponents.query = undefined; - return wsComponents; - }, - serialize: function serialize(wsComponents, options) { - //normalize the default port - if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") { - wsComponents.port = undefined; - } - //ensure scheme matches secure flag - if (typeof wsComponents.secure === 'boolean') { - wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws'; - wsComponents.secure = undefined; - } - //reconstruct path from resource name - if (wsComponents.resourceName) { - var _wsComponents$resourc = wsComponents.resourceName.split('?'), - _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2), - path = _wsComponents$resourc2[0], - query = _wsComponents$resourc2[1]; - - wsComponents.path = path && path !== '/' ? path : undefined; - wsComponents.query = query; - wsComponents.resourceName = undefined; - } - //forbid fragment component - wsComponents.fragment = undefined; - return wsComponents; - } -}; - -var handler$3 = { - scheme: "wss", - domainHost: handler$2.domainHost, - parse: handler$2.parse, - serialize: handler$2.serialize -}; - -var O = {}; -var isIRI = true; -//RFC 3986 -var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + (isIRI ? "\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" : "") + "]"; -var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive -var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded -//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; = -//const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]"; -//const WSP$$ = "[\\x20\\x09]"; -//const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127) -//const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext -//const VCHAR$$ = "[\\x21-\\x7E]"; -//const WSP$$ = "[\\x20\\x09]"; -//const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext -//const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+"); -//const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$); -//const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"'); -var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]"; -var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]"; -var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]"); -var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"; -var UNRESERVED = new RegExp(UNRESERVED$$, "g"); -var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g"); -var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g"); -var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g"); -var NOT_HFVALUE = NOT_HFNAME; -function decodeUnreserved(str) { - var decStr = pctDecChars(str); - return !decStr.match(UNRESERVED) ? str : decStr; -} -var handler$4 = { - scheme: "mailto", - parse: function parse$$1(components, options) { - var mailtoComponents = components; - var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : []; - mailtoComponents.path = undefined; - if (mailtoComponents.query) { - var unknownHeaders = false; - var headers = {}; - var hfields = mailtoComponents.query.split("&"); - for (var x = 0, xl = hfields.length; x < xl; ++x) { - var hfield = hfields[x].split("="); - switch (hfield[0]) { - case "to": - var toAddrs = hfield[1].split(","); - for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) { - to.push(toAddrs[_x]); - } - break; - case "subject": - mailtoComponents.subject = unescapeComponent(hfield[1], options); - break; - case "body": - mailtoComponents.body = unescapeComponent(hfield[1], options); - break; - default: - unknownHeaders = true; - headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options); - break; - } - } - if (unknownHeaders) mailtoComponents.headers = headers; - } - mailtoComponents.query = undefined; - for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) { - var addr = to[_x2].split("@"); - addr[0] = unescapeComponent(addr[0]); - if (!options.unicodeSupport) { - //convert Unicode IDN -> ASCII IDN - try { - addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase()); - } catch (e) { - mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e; - } - } else { - addr[1] = unescapeComponent(addr[1], options).toLowerCase(); - } - to[_x2] = addr.join("@"); - } - return mailtoComponents; - }, - serialize: function serialize$$1(mailtoComponents, options) { - var components = mailtoComponents; - var to = toArray(mailtoComponents.to); - if (to) { - for (var x = 0, xl = to.length; x < xl; ++x) { - var toAddr = String(to[x]); - var atIdx = toAddr.lastIndexOf("@"); - var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar); - var domain = toAddr.slice(atIdx + 1); - //convert IDN via punycode - try { - domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain); - } catch (e) { - components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e; - } - to[x] = localPart + "@" + domain; - } - components.path = to.join(","); - } - var headers = mailtoComponents.headers = mailtoComponents.headers || {}; - if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject; - if (mailtoComponents.body) headers["body"] = mailtoComponents.body; - var fields = []; - for (var name in headers) { - if (headers[name] !== O[name]) { - fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) + "=" + headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar)); - } - } - if (fields.length) { - components.query = fields.join("&"); - } - return components; - } -}; - -var URN_PARSE = /^([^\:]+)\:(.*)/; -//RFC 2141 -var handler$5 = { - scheme: "urn", - parse: function parse$$1(components, options) { - var matches = components.path && components.path.match(URN_PARSE); - var urnComponents = components; - if (matches) { - var scheme = options.scheme || urnComponents.scheme || "urn"; - var nid = matches[1].toLowerCase(); - var nss = matches[2]; - var urnScheme = scheme + ":" + (options.nid || nid); - var schemeHandler = SCHEMES[urnScheme]; - urnComponents.nid = nid; - urnComponents.nss = nss; - urnComponents.path = undefined; - if (schemeHandler) { - urnComponents = schemeHandler.parse(urnComponents, options); - } - } else { - urnComponents.error = urnComponents.error || "URN can not be parsed."; - } - return urnComponents; - }, - serialize: function serialize$$1(urnComponents, options) { - var scheme = options.scheme || urnComponents.scheme || "urn"; - var nid = urnComponents.nid; - var urnScheme = scheme + ":" + (options.nid || nid); - var schemeHandler = SCHEMES[urnScheme]; - if (schemeHandler) { - urnComponents = schemeHandler.serialize(urnComponents, options); - } - var uriComponents = urnComponents; - var nss = urnComponents.nss; - uriComponents.path = (nid || options.nid) + ":" + nss; - return uriComponents; - } -}; - -var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/; -//RFC 4122 -var handler$6 = { - scheme: "urn:uuid", - parse: function parse(urnComponents, options) { - var uuidComponents = urnComponents; - uuidComponents.uuid = uuidComponents.nss; - uuidComponents.nss = undefined; - if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) { - uuidComponents.error = uuidComponents.error || "UUID is not valid."; - } - return uuidComponents; - }, - serialize: function serialize(uuidComponents, options) { - var urnComponents = uuidComponents; - //normalize UUID - urnComponents.nss = (uuidComponents.uuid || "").toLowerCase(); - return urnComponents; - } -}; - -SCHEMES[handler.scheme] = handler; -SCHEMES[handler$1.scheme] = handler$1; -SCHEMES[handler$2.scheme] = handler$2; -SCHEMES[handler$3.scheme] = handler$3; -SCHEMES[handler$4.scheme] = handler$4; -SCHEMES[handler$5.scheme] = handler$5; -SCHEMES[handler$6.scheme] = handler$6; - -exports.SCHEMES = SCHEMES; -exports.pctEncChar = pctEncChar; -exports.pctDecChars = pctDecChars; -exports.parse = parse; -exports.removeDotSegments = removeDotSegments; -exports.serialize = serialize; -exports.resolveComponents = resolveComponents; -exports.resolve = resolve; -exports.normalize = normalize; -exports.equal = equal; -exports.escapeComponent = escapeComponent; -exports.unescapeComponent = unescapeComponent; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); - - -},{}],"ajv":[function(require,module,exports){ -'use strict'; - -var compileSchema = require('./compile') - , resolve = require('./compile/resolve') - , Cache = require('./cache') - , SchemaObject = require('./compile/schema_obj') - , stableStringify = require('fast-json-stable-stringify') - , formats = require('./compile/formats') - , rules = require('./compile/rules') - , $dataMetaSchema = require('./data') - , util = require('./compile/util'); - -module.exports = Ajv; - -Ajv.prototype.validate = validate; -Ajv.prototype.compile = compile; -Ajv.prototype.addSchema = addSchema; -Ajv.prototype.addMetaSchema = addMetaSchema; -Ajv.prototype.validateSchema = validateSchema; -Ajv.prototype.getSchema = getSchema; -Ajv.prototype.removeSchema = removeSchema; -Ajv.prototype.addFormat = addFormat; -Ajv.prototype.errorsText = errorsText; - -Ajv.prototype._addSchema = _addSchema; -Ajv.prototype._compile = _compile; - -Ajv.prototype.compileAsync = require('./compile/async'); -var customKeyword = require('./keyword'); -Ajv.prototype.addKeyword = customKeyword.add; -Ajv.prototype.getKeyword = customKeyword.get; -Ajv.prototype.removeKeyword = customKeyword.remove; -Ajv.prototype.validateKeyword = customKeyword.validate; - -var errorClasses = require('./compile/error_classes'); -Ajv.ValidationError = errorClasses.Validation; -Ajv.MissingRefError = errorClasses.MissingRef; -Ajv.$dataMetaSchema = $dataMetaSchema; - -var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema'; - -var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes', 'strictDefaults' ]; -var META_SUPPORT_DATA = ['/properties']; - -/** - * Creates validator instance. - * Usage: `Ajv(opts)` - * @param {Object} opts optional options - * @return {Object} ajv instance - */ -function Ajv(opts) { - if (!(this instanceof Ajv)) return new Ajv(opts); - opts = this._opts = util.copy(opts) || {}; - setLogger(this); - this._schemas = {}; - this._refs = {}; - this._fragments = {}; - this._formats = formats(opts.format); - - this._cache = opts.cache || new Cache; - this._loadingSchemas = {}; - this._compilations = []; - this.RULES = rules(); - this._getId = chooseGetId(opts); - - opts.loopRequired = opts.loopRequired || Infinity; - if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true; - if (opts.serialize === undefined) opts.serialize = stableStringify; - this._metaOpts = getMetaSchemaOptions(this); - - if (opts.formats) addInitialFormats(this); - if (opts.keywords) addInitialKeywords(this); - addDefaultMetaSchema(this); - if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta); - if (opts.nullable) this.addKeyword('nullable', {metaSchema: {type: 'boolean'}}); - addInitialSchemas(this); -} - - - -/** - * Validate data using schema - * Schema will be compiled and cached (using serialized JSON as key. [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize. - * @this Ajv - * @param {String|Object} schemaKeyRef key, ref or schema object - * @param {Any} data to be validated - * @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`). - */ -function validate(schemaKeyRef, data) { - var v; - if (typeof schemaKeyRef == 'string') { - v = this.getSchema(schemaKeyRef); - if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"'); - } else { - var schemaObj = this._addSchema(schemaKeyRef); - v = schemaObj.validate || this._compile(schemaObj); - } - - var valid = v(data); - if (v.$async !== true) this.errors = v.errors; - return valid; -} - - -/** - * Create validating function for passed schema. - * @this Ajv - * @param {Object} schema schema object - * @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords. - * @return {Function} validating function - */ -function compile(schema, _meta) { - var schemaObj = this._addSchema(schema, undefined, _meta); - return schemaObj.validate || this._compile(schemaObj); -} - - -/** - * Adds schema to the instance. - * @this Ajv - * @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored. - * @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. - * @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead. - * @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. - * @return {Ajv} this for method chaining - */ -function addSchema(schema, key, _skipValidation, _meta) { - if (Array.isArray(schema)){ - for (var i=0; i} errors optional array of validation errors, if not passed errors from the instance are used. - * @param {Object} options optional options with properties `separator` and `dataVar`. - * @return {String} human readable string with all errors descriptions - */ -function errorsText(errors, options) { - errors = errors || this.errors; - if (!errors) return 'No errors'; - options = options || {}; - var separator = options.separator === undefined ? ', ' : options.separator; - var dataVar = options.dataVar === undefined ? 'data' : options.dataVar; - - var text = ''; - for (var i=0; i%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,u=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,h=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,d=/^(?:\/(?:[^~/]|~0|~1)*)*$/,p=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,f=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function m(e){return a.copy(m[e="full"==e?"full":"fast"])}function v(e){var r=e.match(o);if(!r)return!1;var t,a=+r[2],s=+r[3];return 1<=a&&a<=12&&1<=s&&s<=(2!=a||((t=+r[1])%4!=0||t%100==0&&t%400!=0)?i[a]:29)}function y(e,r){var t=e.match(n);if(!t)return!1;var a=t[1],s=t[2],o=t[3];return(a<=23&&s<=59&&o<=59||23==a&&59==s&&60==o)&&(!r||t[5])}(r.exports=m).fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":c,url:u,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:s,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:w,uuid:h,"json-pointer":d,"json-pointer-uri-fragment":p,"relative-json-pointer":f},m.full={date:v,time:y,"date-time":function(e){var r=e.split(g);return 2==r.length&&v(r[0])&&y(r[1],!0)},uri:function(e){return P.test(e)&&l.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":c,url:u,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:s,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:w,uuid:h,"json-pointer":d,"json-pointer-uri-fragment":p,"relative-json-pointer":f};var g=/t|\s/i;var P=/\/|:/;var E=/[^\\]\\Z/;function w(e){if(E.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}}},{"./util":10}],5:[function(e,r,t){"use strict";var R=e("./resolve"),$=e("./util"),j=e("./error_classes"),D=e("fast-json-stable-stringify"),O=e("../dotjs/validate"),I=$.ucs2length,A=e("fast-deep-equal"),k=j.Validation;function C(e,c,u,r){var d=this,p=this._opts,h=[void 0],f={},l=[],t={},m=[],a={},v=[],s=function(e,r,t){var a=L.call(this,e,r,t);return 0<=a?{index:a,compiling:!0}:{index:a=this._compilations.length,compiling:!(this._compilations[a]={schema:e,root:r,baseId:t})}}.call(this,e,c=c||{schema:e,refVal:h,refs:f},r),o=this._compilations[s.index];if(s.compiling)return o.callValidate=P;var y=this._formats,g=this.RULES;try{var i=E(e,c,u,r);o.validate=i;var n=o.callValidate;return n&&(n.schema=i.schema,n.errors=null,n.refs=i.refs,n.refVal=i.refVal,n.root=i.root,n.$async=i.$async,p.sourceCode&&(n.source=i.source)),i}finally{(function(e,r,t){var a=L.call(this,e,r,t);0<=a&&this._compilations.splice(a,1)}).call(this,e,c,r)}function P(){var e=o.validate,r=e.apply(this,arguments);return P.errors=e.errors,r}function E(e,r,t,a){var s=!r||r&&r.schema==e;if(r.schema!=c.schema)return C.call(d,e,r,t,a);var o=!0===e.$async,i=O({isTop:!0,schema:e,isRoot:s,baseId:a,root:r,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:j.MissingRef,RULES:g,validate:O,util:$,resolve:R,resolveRef:w,usePattern:_,useDefault:F,useCustomRule:x,opts:p,formats:y,logger:d.logger,self:d}),i=Q(h,z)+Q(l,N)+Q(m,q)+Q(v,T)+i;p.processCode&&(i=p.processCode(i,e));try{var n=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",i)(d,g,y,c,h,m,v,A,I,k);h[0]=n}catch(e){throw d.logger.error("Error compiling schema, function code:",i),e}return n.schema=e,n.errors=null,n.refs=f,n.refVal=h,n.root=s?n:r,o&&(n.$async=!0),!0===p.sourceCode&&(n.source={code:i,patterns:l,defaults:m}),n}function w(e,r,t){r=R.url(e,r);var a,s,o=f[r];if(void 0!==o)return S(a=h[o],s="refVal["+o+"]");if(!t&&c.refs){var i=c.refs[r];if(void 0!==i)return S(a=c.refVal[i],s=b(r,a))}s=b(r);var n,l=R.call(d,E,c,r);if(void 0!==l||(n=u&&u[r])&&(l=R.inlineRef(n,p.inlineRefs)?n:C.call(d,n,c,u,e)),void 0!==l)return S(h[f[r]]=l,s);delete f[r]}function b(e,r){var t=h.length;return h[t]=r,"refVal"+(f[e]=t)}function S(e,r){return"object"==typeof e||"boolean"==typeof e?{code:r,schema:e,inline:!0}:{code:r,$async:e&&!!e.$async}}function _(e){var r=t[e];return void 0===r&&(r=t[e]=l.length,l[r]=e),"pattern"+r}function F(e){switch(typeof e){case"boolean":case"number":return""+e;case"string":return $.toQuotedString(e);case"object":if(null===e)return"null";var r=D(e),t=a[r];return void 0===t&&(t=a[r]=m.length,m[t]=e),"default"+t}}function x(e,r,t,a){if(!1!==d._opts.validateSchema){var s=e.definition.dependencies;if(s&&!s.every(function(e){return Object.prototype.hasOwnProperty.call(t,e)}))throw new Error("parent schema must have all required keywords: "+s.join(","));var o=e.definition.validateSchema;if(o)if(!o(r)){var i="keyword schema is invalid: "+d.errorsText(o.errors);if("log"!=d._opts.validateSchema)throw new Error(i);d.logger.error(i)}}var n,l=e.definition.compile,c=e.definition.inline,u=e.definition.macro;if(l)n=l.call(d,r,t,a);else if(u)n=u.call(d,r,t,a),!1!==p.validateSchema&&d.validateSchema(n,!0);else if(c)n=c.call(d,a,e.keyword,r,t);else if(!(n=e.definition.validate))return;if(void 0===n)throw new Error('custom keyword "'+e.keyword+'"failed to compile');var h=v.length;return{code:"customRule"+h,validate:v[h]=n}}}function L(e,r,t){for(var a=0;a",_=P?">":"<",F=void 0;if(!y&&"number"!=typeof d&&void 0!==d)throw new Error(r+" must be number");if(!b&&void 0!==w&&"number"!=typeof w&&"boolean"!=typeof w)throw new Error(E+" must be number or boolean");b?(o="exclIsNumber"+u,i="' + "+(n="op"+u)+" + '",c+=" var schemaExcl"+u+" = "+(t=e.util.getData(w.$data,h,e.dataPathArr))+"; ",F=E,(l=l||[]).push(c+=" var "+(a="exclusive"+u)+"; var "+(s="exclType"+u)+" = typeof "+(t="schemaExcl"+u)+"; if ("+s+" != 'boolean' && "+s+" != 'undefined' && "+s+" != 'number') { "),c="",!1!==e.createErrors?(c+=" { keyword: '"+(F||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",!1!==e.opts.messages&&(c+=" , message: '"+E+" should be boolean' "),e.opts.verbose&&(c+=" , schema: validate.schema"+p+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),c+=" } "):c+=" {} ",x=c,c=l.pop(),c+=!e.compositeRule&&m?e.async?" throw new ValidationError(["+x+"]); ":" validate.errors = ["+x+"]; return false; ":" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c+=" } else if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" "+s+" == 'number' ? ( ("+a+" = "+g+" === undefined || "+t+" "+S+"= "+g+") ? "+v+" "+_+"= "+t+" : "+v+" "+_+" "+g+" ) : ( ("+a+" = "+t+" === true) ? "+v+" "+_+"= "+g+" : "+v+" "+_+" "+g+" ) || "+v+" !== "+v+") { var op"+u+" = "+a+" ? '"+S+"' : '"+S+"='; ",void 0===d&&(f=e.errSchemaPath+"/"+(F=E),g=t,y=b)):(i=S,(o="number"==typeof w)&&y?(n="'"+i+"'",c+=" if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" ( "+g+" === undefined || "+w+" "+S+"= "+g+" ? "+v+" "+_+"= "+w+" : "+v+" "+_+" "+g+" ) || "+v+" !== "+v+") { "):(o&&void 0===d?(a=!0,f=e.errSchemaPath+"/"+(F=E),g=w,_+="="):(o&&(g=Math[P?"min":"max"](w,d)),w===(!o||g)?(a=!0,f=e.errSchemaPath+"/"+(F=E),_+="="):(a=!1,i+="=")),n="'"+i+"'",c+=" if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" "+v+" "+_+" "+g+" || "+v+" !== "+v+") { ")),F=F||r,(l=l||[]).push(c),c="",!1!==e.createErrors?(c+=" { keyword: '"+(F||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { comparison: "+n+", limit: "+g+", exclusive: "+a+" } ",!1!==e.opts.messages&&(c+=" , message: 'should be "+i+" ",c+=y?"' + "+g:g+"'"),e.opts.verbose&&(c+=" , schema: ",c+=y?"validate.schema"+p:""+d,c+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),c+=" } "):c+=" {} ";var x=c;return c=l.pop(),c+=!e.compositeRule&&m?e.async?" throw new ValidationError(["+x+"]); ":" validate.errors = ["+x+"]; return false; ":" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c+=" } ",m&&(c+=" else { "),c}},{}],14:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ");var d=r,p=p||[];p.push(t+=" "+c+".length "+("maxItems"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT have ",t+="maxItems"==r?"more":"fewer",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" items' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],15:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),t+=!1===e.opts.unicode?" "+c+".length ":" ucs2length("+c+") ";var d=r,p=p||[];p.push(t+=" "+("maxLength"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT be ",t+="maxLength"==r?"longer":"shorter",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" characters' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],16:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ");var d=r,p=p||[];p.push(t+=" Object.keys("+c+").length "+("maxProperties"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT have ",t+="maxProperties"==r?"more":"fewer",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" properties' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],17:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.schema[r],s=e.schemaPath+e.util.getProperty(r),o=e.errSchemaPath+"/"+r,i=!e.opts.allErrors,n=e.util.copy(e),l="";n.level++;var c="valid"+n.level,u=n.baseId,h=!0,d=a;if(d)for(var p,f=-1,m=d.length-1;f "+_+") { ",x=c+"["+_+"]",d.schema=$,d.schemaPath=i+"["+_+"]",d.errSchemaPath=n+"/"+_,d.errorPath=e.util.getPathExpr(e.errorPath,_,e.opts.jsonPointers,!0),d.dataPathArr[v]=_,R=e.validate(d),d.baseId=g,e.util.varOccurences(R,y)<2?t+=" "+e.util.varReplace(R,y,x)+" ":t+=" var "+y+" = "+x+"; "+R+" ",t+=" } ",l&&(t+=" if ("+f+") { ",p+="}"))}"object"==typeof b&&(e.opts.strictKeywords?"object"==typeof b&&0 "+o.length+") { for (var "+m+" = "+o.length+"; "+m+" < "+c+".length; "+m+"++) { ",d.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers,!0),x=c+"["+m+"]",d.dataPathArr[v]=m,R=e.validate(d),d.baseId=g,e.util.varOccurences(R,y)<2?t+=" "+e.util.varReplace(R,y,x)+" ":t+=" var "+y+" = "+x+"; "+R+" ",l&&(t+=" if (!"+f+") break; "),t+=" } } ",l&&(t+=" if ("+f+") { ",p+="}"))}else{(e.opts.strictKeywords?"object"==typeof o&&0 1e-"+e.opts.multipleOfPrecision+" ":" division"+a+" !== parseInt(division"+a+") ",t+=" ) ",u&&(t+=" ) ");var d=d||[];d.push(t+=" ) { "),t="",!1!==e.createErrors?(t+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { multipleOf: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should be multiple of ",t+=u?"' + "+h:h+"'"),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var p=t,t=d.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],30:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u="errs__"+a,h=e.util.copy(e);h.level++;var d,p,f,m,v="valid"+h.level;return(e.opts.strictKeywords?"object"==typeof o&&0 1) { ",t=e.schema.items&&e.schema.items.type,a=Array.isArray(t),!t||"object"==t||"array"==t||a&&(0<=t.indexOf("object")||0<=t.indexOf("array"))?i+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+f+" = false; break outer; } } } ":(i+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ",i+=" if ("+e.util["checkDataType"+(a?"s":"")](t,"item",e.opts.strictNumbers,!0)+") continue; ",a&&(i+=" if (typeof item == 'string') item = '\"' + item; "),i+=" if (typeof itemIndices[item] == 'number') { "+f+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "),i+=" } ",m&&(i+=" } "),(s=s||[]).push(i+=" if (!"+f+") { "),i="",!1!==e.createErrors?(i+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(i+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(i+=" , schema: ",i+=m?"validate.schema"+u:""+c,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ",o=i,i=s.pop(),i+=!e.compositeRule&&d?e.async?" throw new ValidationError(["+o+"]); ":" validate.errors = ["+o+"]; return false; ":" var err = "+o+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",d&&(i+=" else { ")):d&&(i+=" if (true) { "),i}},{}],38:[function(e,r,t){"use strict";r.exports=function(a,e){var r="",t=!0===a.schema.$async,s=a.util.schemaHasRulesExcept(a.schema,a.RULES.all,"$ref"),o=a.self._getId(a.schema);if(a.opts.strictKeywords){var i=a.util.schemaUnknownRules(a.schema,a.RULES.keywords);if(i){var n="unknown keyword: "+i;if("log"!==a.opts.strictKeywords)throw new Error(n);a.logger.warn(n)}}if(a.isTop&&(r+=" var validate = ",t&&(a.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(a.opts.sourceCode||a.opts.processCode)&&(r+=" /*# sourceURL="+o+" */ ")),"boolean"==typeof a.schema||!s&&!a.schema.$ref){var l=a.level,c=a.dataLevel,u=a.schema[e="false schema"],h=a.schemaPath+a.util.getProperty(e),d=a.errSchemaPath+"/"+e,p=!a.opts.allErrors,f="data"+(c||""),m="valid"+l;return!1===a.schema?(a.isTop?p=!0:r+=" var "+m+" = false; ",(U=U||[]).push(r),r="",!1!==a.createErrors?(r+=" { keyword: 'false schema' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(d)+" , params: {} ",!1!==a.opts.messages&&(r+=" , message: 'boolean schema is false' "),a.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+a.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",D=r,r=U.pop(),r+=!a.compositeRule&&p?a.async?" throw new ValidationError(["+D+"]); ":" validate.errors = ["+D+"]; return false; ":" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "):r+=a.isTop?t?" return data; ":" validate.errors = null; return true; ":" var "+m+" = true; ",a.isTop&&(r+=" }; return validate; "),r}if(a.isTop){var v=a.isTop,l=a.level=0,c=a.dataLevel=0,f="data";if(a.rootId=a.resolve.fullPath(a.self._getId(a.root.schema)),a.baseId=a.baseId||a.rootId,delete a.isTop,a.dataPathArr=[""],void 0!==a.schema.default&&a.opts.useDefaults&&a.opts.strictDefaults){var y="default is ignored in the schema root";if("log"!==a.opts.strictDefaults)throw new Error(y);a.logger.warn(y)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{l=a.level,f="data"+((c=a.dataLevel)||"");if(o&&(a.baseId=a.resolve.url(a.baseId,o)),t&&!a.async)throw new Error("async schema in sync schema");r+=" var errs_"+l+" = errors;"}var g,m="valid"+l,p=!a.opts.allErrors,P="",E="",w=a.schema.type,b=Array.isArray(w);if(w&&a.opts.nullable&&!0===a.schema.nullable&&(b?-1==w.indexOf("null")&&(w=w.concat("null")):"null"!=w&&(w=[w,"null"],b=!0)),b&&1==w.length&&(w=w[0],b=!1),a.schema.$ref&&s){if("fail"==a.opts.extendRefs)throw new Error('$ref: validation keywords used in schema at path "'+a.errSchemaPath+'" (see option extendRefs)');!0!==a.opts.extendRefs&&(s=!1,a.logger.warn('$ref: keywords ignored in schema at path "'+a.errSchemaPath+'"'))}if(a.schema.$comment&&a.opts.$comment&&(r+=" "+a.RULES.all.$comment.code(a,"$comment")),w){a.opts.coerceTypes&&(g=a.util.coerceToTypes(a.opts.coerceTypes,w));var S=a.RULES.types[w];if(g||b||!0===S||S&&!Z(S)){h=a.schemaPath+".type",d=a.errSchemaPath+"/type",h=a.schemaPath+".type",d=a.errSchemaPath+"/type";if(r+=" if ("+a.util[b?"checkDataTypes":"checkDataType"](w,f,a.opts.strictNumbers,!0)+") { ",g){var _="dataType"+l,F="coerced"+l;r+=" var "+_+" = typeof "+f+"; var "+F+" = undefined; ","array"==a.opts.coerceTypes&&(r+=" if ("+_+" == 'object' && Array.isArray("+f+") && "+f+".length == 1) { "+f+" = "+f+"[0]; "+_+" = typeof "+f+"; if ("+a.util.checkDataType(a.schema.type,f,a.opts.strictNumbers)+") "+F+" = "+f+"; } "),r+=" if ("+F+" !== undefined) ; ";var x=g;if(x)for(var R,$=-1,j=x.length-1;$= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=Math.floor,C=String.fromCharCode;function L(e){throw new RangeError(i[e])}function n(e,r){var t=e.split("@"),a="";return 1>1,e+=k(e/r);455k((A-a)/h))&&L("overflow"),a+=p*h;var f=d<=o?1:o+26<=d?26:d-o;if(pk(A/m)&&L("overflow"),h*=m}var v=r.length+1,o=z(a-u,v,0==u);k(a/v)>A-s&&L("overflow"),s+=k(a/v),a%=v,r.splice(a++,0,s)}return String.fromCodePoint.apply(String,r)}function c(e){var r=[],t=(e=N(e)).length,a=128,s=0,o=72,i=!0,n=!1,l=void 0;try{for(var c,u=e[Symbol.iterator]();!(i=(c=u.next()).done);i=!0){var h=c.value;h<128&&r.push(C(h))}}catch(e){n=!0,l=e}finally{try{!i&&u.return&&u.return()}finally{if(n)throw l}}var d=r.length,p=d;for(d&&r.push("-");pk((A-s)/w)&&L("overflow"),s+=(f-a)*w,a=f;var b=!0,S=!1,_=void 0;try{for(var F,x=e[Symbol.iterator]();!(b=(F=x.next()).done);b=!0){var R=F.value;if(RA&&L("overflow"),R==a){for(var $=s,j=36;;j+=36){var D=j<=o?1:o+26<=j?26:j-o;if($>6|192).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase():"%"+(r>>12|224).toString(16).toUpperCase()+"%"+(r>>6&63|128).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase()}function p(e){for(var r="",t=0,a=e.length;tA-Z\\x5E-\\x7E]",'[\\"\\\\]')),Y=new RegExp(K,"g"),W=new RegExp("(?:(?:%[EFef][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f])|(?:%[89A-Fa-f][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f])|(?:%[0-9A-Fa-f][0-9A-Fa-f]))","g"),X=new RegExp(J("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',G),"g"),ee=new RegExp(J("[^]",K,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),re=ee;function te(e){var r=p(e);return r.match(Y)?r:e}var ae={scheme:"mailto",parse:function(e,r){var t=e,a=t.to=t.path?t.path.split(","):[];if(t.path=void 0,t.query){for(var s=!1,o={},i=t.query.split("&"),n=0,l=i.length;n); - - message: string; - errors: Array; - ajv: true; - validation: true; - } - - class MissingRefError extends Error { - constructor(baseId: string, ref: string, message?: string); - static message: (baseId: string, ref: string) => string; - - message: string; - missingRef: string; - missingSchema: string; - } -} - -declare namespace ajv { - type ValidationError = AjvErrors.ValidationError; - - type MissingRefError = AjvErrors.MissingRefError; - - interface Ajv { - /** - * Validate data using schema - * Schema will be compiled and cached (using serialized JSON as key, [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize by default). - * @param {string|object|Boolean} schemaKeyRef key, ref or schema object - * @param {Any} data to be validated - * @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`). - */ - validate(schemaKeyRef: object | string | boolean, data: any): boolean | PromiseLike; - /** - * Create validating function for passed schema. - * @param {object|Boolean} schema schema object - * @return {Function} validating function - */ - compile(schema: object | boolean): ValidateFunction; - /** - * Creates validating function for passed schema with asynchronous loading of missing schemas. - * `loadSchema` option should be a function that accepts schema uri and node-style callback. - * @this Ajv - * @param {object|Boolean} schema schema object - * @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped - * @param {Function} callback optional node-style callback, it is always called with 2 parameters: error (or null) and validating function. - * @return {PromiseLike} validating function - */ - compileAsync(schema: object | boolean, meta?: Boolean, callback?: (err: Error, validate: ValidateFunction) => any): PromiseLike; - /** - * Adds schema to the instance. - * @param {object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored. - * @param {string} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. - * @return {Ajv} this for method chaining - */ - addSchema(schema: Array | object, key?: string): Ajv; - /** - * Add schema that will be used to validate other schemas - * options in META_IGNORE_OPTIONS are alway set to false - * @param {object} schema schema object - * @param {string} key optional schema key - * @return {Ajv} this for method chaining - */ - addMetaSchema(schema: object, key?: string): Ajv; - /** - * Validate schema - * @param {object|Boolean} schema schema to validate - * @return {Boolean} true if schema is valid - */ - validateSchema(schema: object | boolean): boolean; - /** - * Get compiled schema from the instance by `key` or `ref`. - * @param {string} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id). - * @return {Function} schema validating function (with property `schema`). Returns undefined if keyRef can't be resolved to an existing schema. - */ - getSchema(keyRef: string): ValidateFunction | undefined; - /** - * Remove cached schema(s). - * If no parameter is passed all schemas but meta-schemas are removed. - * If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. - * Even if schema is referenced by other schemas it still can be removed as other schemas have local references. - * @param {string|object|RegExp|Boolean} schemaKeyRef key, ref, pattern to match key/ref or schema object - * @return {Ajv} this for method chaining - */ - removeSchema(schemaKeyRef?: object | string | RegExp | boolean): Ajv; - /** - * Add custom format - * @param {string} name format name - * @param {string|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid) - * @return {Ajv} this for method chaining - */ - addFormat(name: string, format: FormatValidator | FormatDefinition): Ajv; - /** - * Define custom keyword - * @this Ajv - * @param {string} keyword custom keyword, should be a valid identifier, should be different from all standard, custom and macro keywords. - * @param {object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`. - * @return {Ajv} this for method chaining - */ - addKeyword(keyword: string, definition: KeywordDefinition): Ajv; - /** - * Get keyword definition - * @this Ajv - * @param {string} keyword pre-defined or custom keyword. - * @return {object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise. - */ - getKeyword(keyword: string): object | boolean; - /** - * Remove keyword - * @this Ajv - * @param {string} keyword pre-defined or custom keyword. - * @return {Ajv} this for method chaining - */ - removeKeyword(keyword: string): Ajv; - /** - * Validate keyword - * @this Ajv - * @param {object} definition keyword definition object - * @param {boolean} throwError true to throw exception if definition is invalid - * @return {boolean} validation result - */ - validateKeyword(definition: KeywordDefinition, throwError: boolean): boolean; - /** - * Convert array of error message objects to string - * @param {Array} errors optional array of validation errors, if not passed errors from the instance are used. - * @param {object} options optional options with properties `separator` and `dataVar`. - * @return {string} human readable string with all errors descriptions - */ - errorsText(errors?: Array | null, options?: ErrorsTextOptions): string; - errors?: Array | null; - _opts: Options; - } - - interface CustomLogger { - log(...args: any[]): any; - warn(...args: any[]): any; - error(...args: any[]): any; - } - - interface ValidateFunction { - ( - data: any, - dataPath?: string, - parentData?: object | Array, - parentDataProperty?: string | number, - rootData?: object | Array - ): boolean | PromiseLike; - schema?: object | boolean; - errors?: null | Array; - refs?: object; - refVal?: Array; - root?: ValidateFunction | object; - $async?: true; - source?: object; - } - - interface Options { - $data?: boolean; - allErrors?: boolean; - verbose?: boolean; - jsonPointers?: boolean; - uniqueItems?: boolean; - unicode?: boolean; - format?: false | string; - formats?: object; - keywords?: object; - unknownFormats?: true | string[] | 'ignore'; - schemas?: Array | object; - schemaId?: '$id' | 'id' | 'auto'; - missingRefs?: true | 'ignore' | 'fail'; - extendRefs?: true | 'ignore' | 'fail'; - loadSchema?: (uri: string, cb?: (err: Error, schema: object) => void) => PromiseLike; - removeAdditional?: boolean | 'all' | 'failing'; - useDefaults?: boolean | 'empty' | 'shared'; - coerceTypes?: boolean | 'array'; - strictDefaults?: boolean | 'log'; - strictKeywords?: boolean | 'log'; - strictNumbers?: boolean; - async?: boolean | string; - transpile?: string | ((code: string) => string); - meta?: boolean | object; - validateSchema?: boolean | 'log'; - addUsedSchema?: boolean; - inlineRefs?: boolean | number; - passContext?: boolean; - loopRequired?: number; - ownProperties?: boolean; - multipleOfPrecision?: boolean | number; - errorDataPath?: string, - messages?: boolean; - sourceCode?: boolean; - processCode?: (code: string, schema: object) => string; - cache?: object; - logger?: CustomLogger | false; - nullable?: boolean; - serialize?: ((schema: object | boolean) => any) | false; - } - - type FormatValidator = string | RegExp | ((data: string) => boolean | PromiseLike); - type NumberFormatValidator = ((data: number) => boolean | PromiseLike); - - interface NumberFormatDefinition { - type: "number", - validate: NumberFormatValidator; - compare?: (data1: number, data2: number) => number; - async?: boolean; - } - - interface StringFormatDefinition { - type?: "string", - validate: FormatValidator; - compare?: (data1: string, data2: string) => number; - async?: boolean; - } - - type FormatDefinition = NumberFormatDefinition | StringFormatDefinition; - - interface KeywordDefinition { - type?: string | Array; - async?: boolean; - $data?: boolean; - errors?: boolean | string; - metaSchema?: object; - // schema: false makes validate not to expect schema (ValidateFunction) - schema?: boolean; - statements?: boolean; - dependencies?: Array; - modifying?: boolean; - valid?: boolean; - // one and only one of the following properties should be present - validate?: SchemaValidateFunction | ValidateFunction; - compile?: (schema: any, parentSchema: object, it: CompilationContext) => ValidateFunction; - macro?: (schema: any, parentSchema: object, it: CompilationContext) => object | boolean; - inline?: (it: CompilationContext, keyword: string, schema: any, parentSchema: object) => string; - } - - interface CompilationContext { - level: number; - dataLevel: number; - dataPathArr: string[]; - schema: any; - schemaPath: string; - baseId: string; - async: boolean; - opts: Options; - formats: { - [index: string]: FormatDefinition | undefined; - }; - keywords: { - [index: string]: KeywordDefinition | undefined; - }; - compositeRule: boolean; - validate: (schema: object) => boolean; - util: { - copy(obj: any, target?: any): any; - toHash(source: string[]): { [index: string]: true | undefined }; - equal(obj: any, target: any): boolean; - getProperty(str: string): string; - schemaHasRules(schema: object, rules: any): string; - escapeQuotes(str: string): string; - toQuotedString(str: string): string; - getData(jsonPointer: string, dataLevel: number, paths: string[]): string; - escapeJsonPointer(str: string): string; - unescapeJsonPointer(str: string): string; - escapeFragment(str: string): string; - unescapeFragment(str: string): string; - }; - self: Ajv; - } - - interface SchemaValidateFunction { - ( - schema: any, - data: any, - parentSchema?: object, - dataPath?: string, - parentData?: object | Array, - parentDataProperty?: string | number, - rootData?: object | Array - ): boolean | PromiseLike; - errors?: Array; - } - - interface ErrorsTextOptions { - separator?: string; - dataVar?: string; - } - - interface ErrorObject { - keyword: string; - dataPath: string; - schemaPath: string; - params: ErrorParameters; - // Added to validation errors of propertyNames keyword schema - propertyName?: string; - // Excluded if messages set to false. - message?: string; - // These are added with the `verbose` option. - schema?: any; - parentSchema?: object; - data?: any; - } - - type ErrorParameters = RefParams | LimitParams | AdditionalPropertiesParams | - DependenciesParams | FormatParams | ComparisonParams | - MultipleOfParams | PatternParams | RequiredParams | - TypeParams | UniqueItemsParams | CustomParams | - PatternRequiredParams | PropertyNamesParams | - IfParams | SwitchParams | NoParams | EnumParams; - - interface RefParams { - ref: string; - } - - interface LimitParams { - limit: number; - } - - interface AdditionalPropertiesParams { - additionalProperty: string; - } - - interface DependenciesParams { - property: string; - missingProperty: string; - depsCount: number; - deps: string; - } - - interface FormatParams { - format: string - } - - interface ComparisonParams { - comparison: string; - limit: number | string; - exclusive: boolean; - } - - interface MultipleOfParams { - multipleOf: number; - } - - interface PatternParams { - pattern: string; - } - - interface RequiredParams { - missingProperty: string; - } - - interface TypeParams { - type: string; - } - - interface UniqueItemsParams { - i: number; - j: number; - } - - interface CustomParams { - keyword: string; - } - - interface PatternRequiredParams { - missingPattern: string; - } - - interface PropertyNamesParams { - propertyName: string; - } - - interface IfParams { - failingKeyword: string; - } - - interface SwitchParams { - caseIndex: number; - } - - interface NoParams { } - - interface EnumParams { - allowedValues: Array; - } -} - -export = ajv; diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/ajv.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/ajv.js deleted file mode 100644 index 06a45b6..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/ajv.js +++ /dev/null @@ -1,506 +0,0 @@ -'use strict'; - -var compileSchema = require('./compile') - , resolve = require('./compile/resolve') - , Cache = require('./cache') - , SchemaObject = require('./compile/schema_obj') - , stableStringify = require('fast-json-stable-stringify') - , formats = require('./compile/formats') - , rules = require('./compile/rules') - , $dataMetaSchema = require('./data') - , util = require('./compile/util'); - -module.exports = Ajv; - -Ajv.prototype.validate = validate; -Ajv.prototype.compile = compile; -Ajv.prototype.addSchema = addSchema; -Ajv.prototype.addMetaSchema = addMetaSchema; -Ajv.prototype.validateSchema = validateSchema; -Ajv.prototype.getSchema = getSchema; -Ajv.prototype.removeSchema = removeSchema; -Ajv.prototype.addFormat = addFormat; -Ajv.prototype.errorsText = errorsText; - -Ajv.prototype._addSchema = _addSchema; -Ajv.prototype._compile = _compile; - -Ajv.prototype.compileAsync = require('./compile/async'); -var customKeyword = require('./keyword'); -Ajv.prototype.addKeyword = customKeyword.add; -Ajv.prototype.getKeyword = customKeyword.get; -Ajv.prototype.removeKeyword = customKeyword.remove; -Ajv.prototype.validateKeyword = customKeyword.validate; - -var errorClasses = require('./compile/error_classes'); -Ajv.ValidationError = errorClasses.Validation; -Ajv.MissingRefError = errorClasses.MissingRef; -Ajv.$dataMetaSchema = $dataMetaSchema; - -var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema'; - -var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes', 'strictDefaults' ]; -var META_SUPPORT_DATA = ['/properties']; - -/** - * Creates validator instance. - * Usage: `Ajv(opts)` - * @param {Object} opts optional options - * @return {Object} ajv instance - */ -function Ajv(opts) { - if (!(this instanceof Ajv)) return new Ajv(opts); - opts = this._opts = util.copy(opts) || {}; - setLogger(this); - this._schemas = {}; - this._refs = {}; - this._fragments = {}; - this._formats = formats(opts.format); - - this._cache = opts.cache || new Cache; - this._loadingSchemas = {}; - this._compilations = []; - this.RULES = rules(); - this._getId = chooseGetId(opts); - - opts.loopRequired = opts.loopRequired || Infinity; - if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true; - if (opts.serialize === undefined) opts.serialize = stableStringify; - this._metaOpts = getMetaSchemaOptions(this); - - if (opts.formats) addInitialFormats(this); - if (opts.keywords) addInitialKeywords(this); - addDefaultMetaSchema(this); - if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta); - if (opts.nullable) this.addKeyword('nullable', {metaSchema: {type: 'boolean'}}); - addInitialSchemas(this); -} - - - -/** - * Validate data using schema - * Schema will be compiled and cached (using serialized JSON as key. [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize. - * @this Ajv - * @param {String|Object} schemaKeyRef key, ref or schema object - * @param {Any} data to be validated - * @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`). - */ -function validate(schemaKeyRef, data) { - var v; - if (typeof schemaKeyRef == 'string') { - v = this.getSchema(schemaKeyRef); - if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"'); - } else { - var schemaObj = this._addSchema(schemaKeyRef); - v = schemaObj.validate || this._compile(schemaObj); - } - - var valid = v(data); - if (v.$async !== true) this.errors = v.errors; - return valid; -} - - -/** - * Create validating function for passed schema. - * @this Ajv - * @param {Object} schema schema object - * @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords. - * @return {Function} validating function - */ -function compile(schema, _meta) { - var schemaObj = this._addSchema(schema, undefined, _meta); - return schemaObj.validate || this._compile(schemaObj); -} - - -/** - * Adds schema to the instance. - * @this Ajv - * @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored. - * @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. - * @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead. - * @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. - * @return {Ajv} this for method chaining - */ -function addSchema(schema, key, _skipValidation, _meta) { - if (Array.isArray(schema)){ - for (var i=0; i} errors optional array of validation errors, if not passed errors from the instance are used. - * @param {Object} options optional options with properties `separator` and `dataVar`. - * @return {String} human readable string with all errors descriptions - */ -function errorsText(errors, options) { - errors = errors || this.errors; - if (!errors) return 'No errors'; - options = options || {}; - var separator = options.separator === undefined ? ', ' : options.separator; - var dataVar = options.dataVar === undefined ? 'data' : options.dataVar; - - var text = ''; - for (var i=0; i%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i; -// For the source: https://gist.github.com/dperini/729294 -// For test cases: https://mathiasbynens.be/demo/url-regex -// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983. -// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu; -var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i; -var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i; -var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/; -var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i; -var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/; - - -module.exports = formats; - -function formats(mode) { - mode = mode == 'full' ? 'full' : 'fast'; - return util.copy(formats[mode]); -} - - -formats.fast = { - // date: http://tools.ietf.org/html/rfc3339#section-5.6 - date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/, - // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 - time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, - 'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, - // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js - uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i, - 'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i, - 'uri-template': URITEMPLATE, - url: URL, - // email (sources from jsen validator): - // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363 - // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation') - email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i, - hostname: HOSTNAME, - // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html - ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, - // optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses - ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, - regex: regex, - // uuid: http://tools.ietf.org/html/rfc4122 - uuid: UUID, - // JSON-pointer: https://tools.ietf.org/html/rfc6901 - // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A - 'json-pointer': JSON_POINTER, - 'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT, - // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00 - 'relative-json-pointer': RELATIVE_JSON_POINTER -}; - - -formats.full = { - date: date, - time: time, - 'date-time': date_time, - uri: uri, - 'uri-reference': URIREF, - 'uri-template': URITEMPLATE, - url: URL, - email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, - hostname: HOSTNAME, - ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, - ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, - regex: regex, - uuid: UUID, - 'json-pointer': JSON_POINTER, - 'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT, - 'relative-json-pointer': RELATIVE_JSON_POINTER -}; - - -function isLeapYear(year) { - // https://tools.ietf.org/html/rfc3339#appendix-C - return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); -} - - -function date(str) { - // full-date from http://tools.ietf.org/html/rfc3339#section-5.6 - var matches = str.match(DATE); - if (!matches) return false; - - var year = +matches[1]; - var month = +matches[2]; - var day = +matches[3]; - - return month >= 1 && month <= 12 && day >= 1 && - day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]); -} - - -function time(str, full) { - var matches = str.match(TIME); - if (!matches) return false; - - var hour = matches[1]; - var minute = matches[2]; - var second = matches[3]; - var timeZone = matches[5]; - return ((hour <= 23 && minute <= 59 && second <= 59) || - (hour == 23 && minute == 59 && second == 60)) && - (!full || timeZone); -} - - -var DATE_TIME_SEPARATOR = /t|\s/i; -function date_time(str) { - // http://tools.ietf.org/html/rfc3339#section-5.6 - var dateTime = str.split(DATE_TIME_SEPARATOR); - return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true); -} - - -var NOT_URI_FRAGMENT = /\/|:/; -function uri(str) { - // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "." - return NOT_URI_FRAGMENT.test(str) && URI.test(str); -} - - -var Z_ANCHOR = /[^\\]\\Z/; -function regex(str) { - if (Z_ANCHOR.test(str)) return false; - try { - new RegExp(str); - return true; - } catch(e) { - return false; - } -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/compile/index.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/compile/index.js deleted file mode 100644 index 97518c4..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/compile/index.js +++ /dev/null @@ -1,387 +0,0 @@ -'use strict'; - -var resolve = require('./resolve') - , util = require('./util') - , errorClasses = require('./error_classes') - , stableStringify = require('fast-json-stable-stringify'); - -var validateGenerator = require('../dotjs/validate'); - -/** - * Functions below are used inside compiled validations function - */ - -var ucs2length = util.ucs2length; -var equal = require('fast-deep-equal'); - -// this error is thrown by async schemas to return validation errors via exception -var ValidationError = errorClasses.Validation; - -module.exports = compile; - - -/** - * Compiles schema to validation function - * @this Ajv - * @param {Object} schema schema object - * @param {Object} root object with information about the root schema for this schema - * @param {Object} localRefs the hash of local references inside the schema (created by resolve.id), used for inline resolution - * @param {String} baseId base ID for IDs in the schema - * @return {Function} validation function - */ -function compile(schema, root, localRefs, baseId) { - /* jshint validthis: true, evil: true */ - /* eslint no-shadow: 0 */ - var self = this - , opts = this._opts - , refVal = [ undefined ] - , refs = {} - , patterns = [] - , patternsHash = {} - , defaults = [] - , defaultsHash = {} - , customRules = []; - - root = root || { schema: schema, refVal: refVal, refs: refs }; - - var c = checkCompiling.call(this, schema, root, baseId); - var compilation = this._compilations[c.index]; - if (c.compiling) return (compilation.callValidate = callValidate); - - var formats = this._formats; - var RULES = this.RULES; - - try { - var v = localCompile(schema, root, localRefs, baseId); - compilation.validate = v; - var cv = compilation.callValidate; - if (cv) { - cv.schema = v.schema; - cv.errors = null; - cv.refs = v.refs; - cv.refVal = v.refVal; - cv.root = v.root; - cv.$async = v.$async; - if (opts.sourceCode) cv.source = v.source; - } - return v; - } finally { - endCompiling.call(this, schema, root, baseId); - } - - /* @this {*} - custom context, see passContext option */ - function callValidate() { - /* jshint validthis: true */ - var validate = compilation.validate; - var result = validate.apply(this, arguments); - callValidate.errors = validate.errors; - return result; - } - - function localCompile(_schema, _root, localRefs, baseId) { - var isRoot = !_root || (_root && _root.schema == _schema); - if (_root.schema != root.schema) - return compile.call(self, _schema, _root, localRefs, baseId); - - var $async = _schema.$async === true; - - var sourceCode = validateGenerator({ - isTop: true, - schema: _schema, - isRoot: isRoot, - baseId: baseId, - root: _root, - schemaPath: '', - errSchemaPath: '#', - errorPath: '""', - MissingRefError: errorClasses.MissingRef, - RULES: RULES, - validate: validateGenerator, - util: util, - resolve: resolve, - resolveRef: resolveRef, - usePattern: usePattern, - useDefault: useDefault, - useCustomRule: useCustomRule, - opts: opts, - formats: formats, - logger: self.logger, - self: self - }); - - sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode) - + vars(defaults, defaultCode) + vars(customRules, customRuleCode) - + sourceCode; - - if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema); - // console.log('\n\n\n *** \n', JSON.stringify(sourceCode)); - var validate; - try { - var makeValidate = new Function( - 'self', - 'RULES', - 'formats', - 'root', - 'refVal', - 'defaults', - 'customRules', - 'equal', - 'ucs2length', - 'ValidationError', - sourceCode - ); - - validate = makeValidate( - self, - RULES, - formats, - root, - refVal, - defaults, - customRules, - equal, - ucs2length, - ValidationError - ); - - refVal[0] = validate; - } catch(e) { - self.logger.error('Error compiling schema, function code:', sourceCode); - throw e; - } - - validate.schema = _schema; - validate.errors = null; - validate.refs = refs; - validate.refVal = refVal; - validate.root = isRoot ? validate : _root; - if ($async) validate.$async = true; - if (opts.sourceCode === true) { - validate.source = { - code: sourceCode, - patterns: patterns, - defaults: defaults - }; - } - - return validate; - } - - function resolveRef(baseId, ref, isRoot) { - ref = resolve.url(baseId, ref); - var refIndex = refs[ref]; - var _refVal, refCode; - if (refIndex !== undefined) { - _refVal = refVal[refIndex]; - refCode = 'refVal[' + refIndex + ']'; - return resolvedRef(_refVal, refCode); - } - if (!isRoot && root.refs) { - var rootRefId = root.refs[ref]; - if (rootRefId !== undefined) { - _refVal = root.refVal[rootRefId]; - refCode = addLocalRef(ref, _refVal); - return resolvedRef(_refVal, refCode); - } - } - - refCode = addLocalRef(ref); - var v = resolve.call(self, localCompile, root, ref); - if (v === undefined) { - var localSchema = localRefs && localRefs[ref]; - if (localSchema) { - v = resolve.inlineRef(localSchema, opts.inlineRefs) - ? localSchema - : compile.call(self, localSchema, root, localRefs, baseId); - } - } - - if (v === undefined) { - removeLocalRef(ref); - } else { - replaceLocalRef(ref, v); - return resolvedRef(v, refCode); - } - } - - function addLocalRef(ref, v) { - var refId = refVal.length; - refVal[refId] = v; - refs[ref] = refId; - return 'refVal' + refId; - } - - function removeLocalRef(ref) { - delete refs[ref]; - } - - function replaceLocalRef(ref, v) { - var refId = refs[ref]; - refVal[refId] = v; - } - - function resolvedRef(refVal, code) { - return typeof refVal == 'object' || typeof refVal == 'boolean' - ? { code: code, schema: refVal, inline: true } - : { code: code, $async: refVal && !!refVal.$async }; - } - - function usePattern(regexStr) { - var index = patternsHash[regexStr]; - if (index === undefined) { - index = patternsHash[regexStr] = patterns.length; - patterns[index] = regexStr; - } - return 'pattern' + index; - } - - function useDefault(value) { - switch (typeof value) { - case 'boolean': - case 'number': - return '' + value; - case 'string': - return util.toQuotedString(value); - case 'object': - if (value === null) return 'null'; - var valueStr = stableStringify(value); - var index = defaultsHash[valueStr]; - if (index === undefined) { - index = defaultsHash[valueStr] = defaults.length; - defaults[index] = value; - } - return 'default' + index; - } - } - - function useCustomRule(rule, schema, parentSchema, it) { - if (self._opts.validateSchema !== false) { - var deps = rule.definition.dependencies; - if (deps && !deps.every(function(keyword) { - return Object.prototype.hasOwnProperty.call(parentSchema, keyword); - })) - throw new Error('parent schema must have all required keywords: ' + deps.join(',')); - - var validateSchema = rule.definition.validateSchema; - if (validateSchema) { - var valid = validateSchema(schema); - if (!valid) { - var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors); - if (self._opts.validateSchema == 'log') self.logger.error(message); - else throw new Error(message); - } - } - } - - var compile = rule.definition.compile - , inline = rule.definition.inline - , macro = rule.definition.macro; - - var validate; - if (compile) { - validate = compile.call(self, schema, parentSchema, it); - } else if (macro) { - validate = macro.call(self, schema, parentSchema, it); - if (opts.validateSchema !== false) self.validateSchema(validate, true); - } else if (inline) { - validate = inline.call(self, it, rule.keyword, schema, parentSchema); - } else { - validate = rule.definition.validate; - if (!validate) return; - } - - if (validate === undefined) - throw new Error('custom keyword "' + rule.keyword + '"failed to compile'); - - var index = customRules.length; - customRules[index] = validate; - - return { - code: 'customRule' + index, - validate: validate - }; - } -} - - -/** - * Checks if the schema is currently compiled - * @this Ajv - * @param {Object} schema schema to compile - * @param {Object} root root object - * @param {String} baseId base schema ID - * @return {Object} object with properties "index" (compilation index) and "compiling" (boolean) - */ -function checkCompiling(schema, root, baseId) { - /* jshint validthis: true */ - var index = compIndex.call(this, schema, root, baseId); - if (index >= 0) return { index: index, compiling: true }; - index = this._compilations.length; - this._compilations[index] = { - schema: schema, - root: root, - baseId: baseId - }; - return { index: index, compiling: false }; -} - - -/** - * Removes the schema from the currently compiled list - * @this Ajv - * @param {Object} schema schema to compile - * @param {Object} root root object - * @param {String} baseId base schema ID - */ -function endCompiling(schema, root, baseId) { - /* jshint validthis: true */ - var i = compIndex.call(this, schema, root, baseId); - if (i >= 0) this._compilations.splice(i, 1); -} - - -/** - * Index of schema compilation in the currently compiled list - * @this Ajv - * @param {Object} schema schema to compile - * @param {Object} root root object - * @param {String} baseId base schema ID - * @return {Integer} compilation index - */ -function compIndex(schema, root, baseId) { - /* jshint validthis: true */ - for (var i=0; i= 0xD800 && value <= 0xDBFF && pos < len) { - // high surrogate, and there is a next character - value = str.charCodeAt(pos); - if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate - } - } - return length; -}; diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/compile/util.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/compile/util.js deleted file mode 100644 index ef07b8c..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/compile/util.js +++ /dev/null @@ -1,239 +0,0 @@ -'use strict'; - - -module.exports = { - copy: copy, - checkDataType: checkDataType, - checkDataTypes: checkDataTypes, - coerceToTypes: coerceToTypes, - toHash: toHash, - getProperty: getProperty, - escapeQuotes: escapeQuotes, - equal: require('fast-deep-equal'), - ucs2length: require('./ucs2length'), - varOccurences: varOccurences, - varReplace: varReplace, - schemaHasRules: schemaHasRules, - schemaHasRulesExcept: schemaHasRulesExcept, - schemaUnknownRules: schemaUnknownRules, - toQuotedString: toQuotedString, - getPathExpr: getPathExpr, - getPath: getPath, - getData: getData, - unescapeFragment: unescapeFragment, - unescapeJsonPointer: unescapeJsonPointer, - escapeFragment: escapeFragment, - escapeJsonPointer: escapeJsonPointer -}; - - -function copy(o, to) { - to = to || {}; - for (var key in o) to[key] = o[key]; - return to; -} - - -function checkDataType(dataType, data, strictNumbers, negate) { - var EQUAL = negate ? ' !== ' : ' === ' - , AND = negate ? ' || ' : ' && ' - , OK = negate ? '!' : '' - , NOT = negate ? '' : '!'; - switch (dataType) { - case 'null': return data + EQUAL + 'null'; - case 'array': return OK + 'Array.isArray(' + data + ')'; - case 'object': return '(' + OK + data + AND + - 'typeof ' + data + EQUAL + '"object"' + AND + - NOT + 'Array.isArray(' + data + '))'; - case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND + - NOT + '(' + data + ' % 1)' + - AND + data + EQUAL + data + - (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')'; - case 'number': return '(typeof ' + data + EQUAL + '"' + dataType + '"' + - (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')'; - default: return 'typeof ' + data + EQUAL + '"' + dataType + '"'; - } -} - - -function checkDataTypes(dataTypes, data, strictNumbers) { - switch (dataTypes.length) { - case 1: return checkDataType(dataTypes[0], data, strictNumbers, true); - default: - var code = ''; - var types = toHash(dataTypes); - if (types.array && types.object) { - code = types.null ? '(': '(!' + data + ' || '; - code += 'typeof ' + data + ' !== "object")'; - delete types.null; - delete types.array; - delete types.object; - } - if (types.number) delete types.integer; - for (var t in types) - code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true); - - return code; - } -} - - -var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]); -function coerceToTypes(optionCoerceTypes, dataTypes) { - if (Array.isArray(dataTypes)) { - var types = []; - for (var i=0; i= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl); - return paths[lvl - up]; - } - - if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl); - data = 'data' + ((lvl - up) || ''); - if (!jsonPointer) return data; - } - - var expr = data; - var segments = jsonPointer.split('/'); - for (var i=0; i' - , $notOp = $isMax ? '>' : '<' - , $errorKeyword = undefined; - - if (!($isData || typeof $schema == 'number' || $schema === undefined)) { - throw new Error($keyword + ' must be number'); - } - if (!($isDataExcl || $schemaExcl === undefined - || typeof $schemaExcl == 'number' - || typeof $schemaExcl == 'boolean')) { - throw new Error($exclusiveKeyword + ' must be number or boolean'); - } -}} - -{{? $isDataExcl }} - {{ - var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr) - , $exclusive = 'exclusive' + $lvl - , $exclType = 'exclType' + $lvl - , $exclIsNumber = 'exclIsNumber' + $lvl - , $opExpr = 'op' + $lvl - , $opStr = '\' + ' + $opExpr + ' + \''; - }} - var schemaExcl{{=$lvl}} = {{=$schemaValueExcl}}; - {{ $schemaValueExcl = 'schemaExcl' + $lvl; }} - - var {{=$exclusive}}; - var {{=$exclType}} = typeof {{=$schemaValueExcl}}; - if ({{=$exclType}} != 'boolean' && {{=$exclType}} != 'undefined' && {{=$exclType}} != 'number') { - {{ var $errorKeyword = $exclusiveKeyword; }} - {{# def.error:'_exclusiveLimit' }} - } else if ({{# def.$dataNotType:'number' }} - {{=$exclType}} == 'number' - ? ( - ({{=$exclusive}} = {{=$schemaValue}} === undefined || {{=$schemaValueExcl}} {{=$op}}= {{=$schemaValue}}) - ? {{=$data}} {{=$notOp}}= {{=$schemaValueExcl}} - : {{=$data}} {{=$notOp}} {{=$schemaValue}} - ) - : ( - ({{=$exclusive}} = {{=$schemaValueExcl}} === true) - ? {{=$data}} {{=$notOp}}= {{=$schemaValue}} - : {{=$data}} {{=$notOp}} {{=$schemaValue}} - ) - || {{=$data}} !== {{=$data}}) { - var op{{=$lvl}} = {{=$exclusive}} ? '{{=$op}}' : '{{=$op}}='; - {{ - if ($schema === undefined) { - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $schemaValue = $schemaValueExcl; - $isData = $isDataExcl; - } - }} -{{??}} - {{ - var $exclIsNumber = typeof $schemaExcl == 'number' - , $opStr = $op; /*used in error*/ - }} - - {{? $exclIsNumber && $isData }} - {{ var $opExpr = '\'' + $opStr + '\''; /*used in error*/ }} - if ({{# def.$dataNotType:'number' }} - ( {{=$schemaValue}} === undefined - || {{=$schemaExcl}} {{=$op}}= {{=$schemaValue}} - ? {{=$data}} {{=$notOp}}= {{=$schemaExcl}} - : {{=$data}} {{=$notOp}} {{=$schemaValue}} ) - || {{=$data}} !== {{=$data}}) { - {{??}} - {{ - if ($exclIsNumber && $schema === undefined) { - {{# def.setExclusiveLimit }} - $schemaValue = $schemaExcl; - $notOp += '='; - } else { - if ($exclIsNumber) - $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema); - - if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) { - {{# def.setExclusiveLimit }} - $notOp += '='; - } else { - $exclusive = false; - $opStr += '='; - } - } - - var $opExpr = '\'' + $opStr + '\''; /*used in error*/ - }} - - if ({{# def.$dataNotType:'number' }} - {{=$data}} {{=$notOp}} {{=$schemaValue}} - || {{=$data}} !== {{=$data}}) { - {{?}} -{{?}} - {{ $errorKeyword = $errorKeyword || $keyword; }} - {{# def.error:'_limit' }} - } {{? $breakOnError }} else { {{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/_limitItems.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/_limitItems.jst deleted file mode 100644 index 741329e..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/_limitItems.jst +++ /dev/null @@ -1,12 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - -{{# def.numberKeyword }} - -{{ var $op = $keyword == 'maxItems' ? '>' : '<'; }} -if ({{# def.$dataNotType:'number' }} {{=$data}}.length {{=$op}} {{=$schemaValue}}) { - {{ var $errorKeyword = $keyword; }} - {{# def.error:'_limitItems' }} -} {{? $breakOnError }} else { {{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/_limitLength.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/_limitLength.jst deleted file mode 100644 index 285c66b..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/_limitLength.jst +++ /dev/null @@ -1,12 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - -{{# def.numberKeyword }} - -{{ var $op = $keyword == 'maxLength' ? '>' : '<'; }} -if ({{# def.$dataNotType:'number' }} {{# def.strLength }} {{=$op}} {{=$schemaValue}}) { - {{ var $errorKeyword = $keyword; }} - {{# def.error:'_limitLength' }} -} {{? $breakOnError }} else { {{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/_limitProperties.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/_limitProperties.jst deleted file mode 100644 index c4c2155..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/_limitProperties.jst +++ /dev/null @@ -1,12 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - -{{# def.numberKeyword }} - -{{ var $op = $keyword == 'maxProperties' ? '>' : '<'; }} -if ({{# def.$dataNotType:'number' }} Object.keys({{=$data}}).length {{=$op}} {{=$schemaValue}}) { - {{ var $errorKeyword = $keyword; }} - {{# def.error:'_limitProperties' }} -} {{? $breakOnError }} else { {{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/allOf.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/allOf.jst deleted file mode 100644 index 0e782fe..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/allOf.jst +++ /dev/null @@ -1,32 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - -{{ - var $currentBaseId = $it.baseId - , $allSchemasEmpty = true; -}} - -{{~ $schema:$sch:$i }} - {{? {{# def.nonEmptySchema:$sch }} }} - {{ - $allSchemasEmpty = false; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - }} - - {{# def.insertSubschemaCode }} - - {{# def.ifResultValid }} - {{?}} -{{~}} - -{{? $breakOnError }} - {{? $allSchemasEmpty }} - if (true) { - {{??}} - {{= $closingBraces.slice(0,-1) }} - {{?}} -{{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/anyOf.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/anyOf.jst deleted file mode 100644 index ea909ee..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/anyOf.jst +++ /dev/null @@ -1,46 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - -{{ - var $noEmptySchema = $schema.every(function($sch) { - return {{# def.nonEmptySchema:$sch }}; - }); -}} -{{? $noEmptySchema }} - {{ var $currentBaseId = $it.baseId; }} - var {{=$errs}} = errors; - var {{=$valid}} = false; - - {{# def.setCompositeRule }} - - {{~ $schema:$sch:$i }} - {{ - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - }} - - {{# def.insertSubschemaCode }} - - {{=$valid}} = {{=$valid}} || {{=$nextValid}}; - - if (!{{=$valid}}) { - {{ $closingBraces += '}'; }} - {{~}} - - {{# def.resetCompositeRule }} - - {{= $closingBraces }} - - if (!{{=$valid}}) { - {{# def.extraError:'anyOf' }} - } else { - {{# def.resetErrors }} - {{? it.opts.allErrors }} } {{?}} -{{??}} - {{? $breakOnError }} - if (true) { - {{?}} -{{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/coerce.def b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/coerce.def deleted file mode 100644 index c947ed6..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/coerce.def +++ /dev/null @@ -1,51 +0,0 @@ -{{## def.coerceType: - {{ - var $dataType = 'dataType' + $lvl - , $coerced = 'coerced' + $lvl; - }} - var {{=$dataType}} = typeof {{=$data}}; - var {{=$coerced}} = undefined; - - {{? it.opts.coerceTypes == 'array' }} - if ({{=$dataType}} == 'object' && Array.isArray({{=$data}}) && {{=$data}}.length == 1) { - {{=$data}} = {{=$data}}[0]; - {{=$dataType}} = typeof {{=$data}}; - if ({{=it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)}}) {{=$coerced}} = {{=$data}}; - } - {{?}} - - if ({{=$coerced}} !== undefined) ; - {{~ $coerceToTypes:$type:$i }} - {{? $type == 'string' }} - else if ({{=$dataType}} == 'number' || {{=$dataType}} == 'boolean') - {{=$coerced}} = '' + {{=$data}}; - else if ({{=$data}} === null) {{=$coerced}} = ''; - {{?? $type == 'number' || $type == 'integer' }} - else if ({{=$dataType}} == 'boolean' || {{=$data}} === null - || ({{=$dataType}} == 'string' && {{=$data}} && {{=$data}} == +{{=$data}} - {{? $type == 'integer' }} && !({{=$data}} % 1){{?}})) - {{=$coerced}} = +{{=$data}}; - {{?? $type == 'boolean' }} - else if ({{=$data}} === 'false' || {{=$data}} === 0 || {{=$data}} === null) - {{=$coerced}} = false; - else if ({{=$data}} === 'true' || {{=$data}} === 1) - {{=$coerced}} = true; - {{?? $type == 'null' }} - else if ({{=$data}} === '' || {{=$data}} === 0 || {{=$data}} === false) - {{=$coerced}} = null; - {{?? it.opts.coerceTypes == 'array' && $type == 'array' }} - else if ({{=$dataType}} == 'string' || {{=$dataType}} == 'number' || {{=$dataType}} == 'boolean' || {{=$data}} == null) - {{=$coerced}} = [{{=$data}}]; - {{?}} - {{~}} - else { - {{# def.error:'type' }} - } - - if ({{=$coerced}} !== undefined) { - {{# def.setParentData }} - {{=$data}} = {{=$coerced}}; - {{? !$dataLvl }}if ({{=$parentData}} !== undefined){{?}} - {{=$parentData}}[{{=$parentDataProperty}}] = {{=$coerced}}; - } -#}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/comment.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/comment.jst deleted file mode 100644 index f959150..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/comment.jst +++ /dev/null @@ -1,9 +0,0 @@ -{{# def.definitions }} -{{# def.setupKeyword }} - -{{ var $comment = it.util.toQuotedString($schema); }} -{{? it.opts.$comment === true }} - console.log({{=$comment}}); -{{?? typeof it.opts.$comment == 'function' }} - self._opts.$comment({{=$comment}}, {{=it.util.toQuotedString($errSchemaPath)}}, validate.root.schema); -{{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/const.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/const.jst deleted file mode 100644 index 2aa2298..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/const.jst +++ /dev/null @@ -1,11 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - -{{? !$isData }} - var schema{{=$lvl}} = validate.schema{{=$schemaPath}}; -{{?}} -var {{=$valid}} = equal({{=$data}}, schema{{=$lvl}}); -{{# def.checkError:'const' }} -{{? $breakOnError }} else { {{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/contains.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/contains.jst deleted file mode 100644 index 4dc9967..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/contains.jst +++ /dev/null @@ -1,55 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - - -{{ - var $idx = 'i' + $lvl - , $dataNxt = $it.dataLevel = it.dataLevel + 1 - , $nextData = 'data' + $dataNxt - , $currentBaseId = it.baseId - , $nonEmptySchema = {{# def.nonEmptySchema:$schema }}; -}} - -var {{=$errs}} = errors; -var {{=$valid}}; - -{{? $nonEmptySchema }} - {{# def.setCompositeRule }} - - {{ - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - }} - - var {{=$nextValid}} = false; - - for (var {{=$idx}} = 0; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) { - {{ - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - }} - - {{# def.generateSubschemaCode }} - {{# def.optimizeValidate }} - - if ({{=$nextValid}}) break; - } - - {{# def.resetCompositeRule }} - {{= $closingBraces }} - - if (!{{=$nextValid}}) { -{{??}} - if ({{=$data}}.length == 0) { -{{?}} - - {{# def.error:'contains' }} - } else { - {{? $nonEmptySchema }} - {{# def.resetErrors }} - {{?}} - {{? it.opts.allErrors }} } {{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/custom.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/custom.jst deleted file mode 100644 index d30588f..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/custom.jst +++ /dev/null @@ -1,191 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - -{{ - var $rule = this - , $definition = 'definition' + $lvl - , $rDef = $rule.definition - , $closingBraces = ''; - var $validate = $rDef.validate; - var $compile, $inline, $macro, $ruleValidate, $validateCode; -}} - -{{? $isData && $rDef.$data }} - {{ - $validateCode = 'keywordValidate' + $lvl; - var $validateSchema = $rDef.validateSchema; - }} - var {{=$definition}} = RULES.custom['{{=$keyword}}'].definition; - var {{=$validateCode}} = {{=$definition}}.validate; -{{??}} - {{ - $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it); - if (!$ruleValidate) return; - $schemaValue = 'validate.schema' + $schemaPath; - $validateCode = $ruleValidate.code; - $compile = $rDef.compile; - $inline = $rDef.inline; - $macro = $rDef.macro; - }} -{{?}} - -{{ - var $ruleErrs = $validateCode + '.errors' - , $i = 'i' + $lvl - , $ruleErr = 'ruleErr' + $lvl - , $asyncKeyword = $rDef.async; - - if ($asyncKeyword && !it.async) - throw new Error('async keyword in sync schema'); -}} - - -{{? !($inline || $macro) }}{{=$ruleErrs}} = null;{{?}} -var {{=$errs}} = errors; -var {{=$valid}}; - -{{## def.callRuleValidate: - {{=$validateCode}}.call( - {{? it.opts.passContext }}this{{??}}self{{?}} - {{? $compile || $rDef.schema === false }} - , {{=$data}} - {{??}} - , {{=$schemaValue}} - , {{=$data}} - , validate.schema{{=it.schemaPath}} - {{?}} - , {{# def.dataPath }} - {{# def.passParentData }} - , rootData - ) -#}} - -{{## def.extendErrors:_inline: - for (var {{=$i}}={{=$errs}}; {{=$i}} 0) - || _schema === false - : it.util.schemaHasRules(_schema, it.RULES.all)) -#}} - - -{{## def.strLength: - {{? it.opts.unicode === false }} - {{=$data}}.length - {{??}} - ucs2length({{=$data}}) - {{?}} -#}} - - -{{## def.willOptimize: - it.util.varOccurences($code, $nextData) < 2 -#}} - - -{{## def.generateSubschemaCode: - {{ - var $code = it.validate($it); - $it.baseId = $currentBaseId; - }} -#}} - - -{{## def.insertSubschemaCode: - {{= it.validate($it) }} - {{ $it.baseId = $currentBaseId; }} -#}} - - -{{## def._optimizeValidate: - it.util.varReplace($code, $nextData, $passData) -#}} - - -{{## def.optimizeValidate: - {{? {{# def.willOptimize}} }} - {{= {{# def._optimizeValidate }} }} - {{??}} - var {{=$nextData}} = {{=$passData}}; - {{= $code }} - {{?}} -#}} - - -{{## def.$data: - {{ - var $isData = it.opts.$data && $schema && $schema.$data - , $schemaValue; - }} - {{? $isData }} - var schema{{=$lvl}} = {{= it.util.getData($schema.$data, $dataLvl, it.dataPathArr) }}; - {{ $schemaValue = 'schema' + $lvl; }} - {{??}} - {{ $schemaValue = $schema; }} - {{?}} -#}} - - -{{## def.$dataNotType:_type: - {{?$isData}} ({{=$schemaValue}} !== undefined && typeof {{=$schemaValue}} != _type) || {{?}} -#}} - - -{{## def.check$dataIsArray: - if (schema{{=$lvl}} === undefined) {{=$valid}} = true; - else if (!Array.isArray(schema{{=$lvl}})) {{=$valid}} = false; - else { -#}} - - -{{## def.numberKeyword: - {{? !($isData || typeof $schema == 'number') }} - {{ throw new Error($keyword + ' must be number'); }} - {{?}} -#}} - - -{{## def.beginDefOut: - {{ - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; - }} -#}} - - -{{## def.storeDefOut:_variable: - {{ - var _variable = out; - out = $$outStack.pop(); - }} -#}} - - -{{## def.dataPath:(dataPath || ''){{? it.errorPath != '""'}} + {{= it.errorPath }}{{?}}#}} - -{{## def.setParentData: - {{ - var $parentData = $dataLvl ? 'data' + (($dataLvl-1)||'') : 'parentData' - , $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; - }} -#}} - -{{## def.passParentData: - {{# def.setParentData }} - , {{= $parentData }} - , {{= $parentDataProperty }} -#}} - - -{{## def.iterateProperties: - {{? $ownProperties }} - {{=$dataProperties}} = {{=$dataProperties}} || Object.keys({{=$data}}); - for (var {{=$idx}}=0; {{=$idx}}<{{=$dataProperties}}.length; {{=$idx}}++) { - var {{=$key}} = {{=$dataProperties}}[{{=$idx}}]; - {{??}} - for (var {{=$key}} in {{=$data}}) { - {{?}} -#}} - - -{{## def.noPropertyInData: - {{=$useData}} === undefined - {{? $ownProperties }} - || !{{# def.isOwnProperty }} - {{?}} -#}} - - -{{## def.isOwnProperty: - Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($propertyKey)}}') -#}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/dependencies.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/dependencies.jst deleted file mode 100644 index e4bddde..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/dependencies.jst +++ /dev/null @@ -1,79 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.missing }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - - -{{## def.propertyInData: - {{=$data}}{{= it.util.getProperty($property) }} !== undefined - {{? $ownProperties }} - && Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($property)}}') - {{?}} -#}} - - -{{ - var $schemaDeps = {} - , $propertyDeps = {} - , $ownProperties = it.opts.ownProperties; - - for ($property in $schema) { - if ($property == '__proto__') continue; - var $sch = $schema[$property]; - var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps; - $deps[$property] = $sch; - } -}} - -var {{=$errs}} = errors; - -{{ var $currentErrorPath = it.errorPath; }} - -var missing{{=$lvl}}; -{{ for (var $property in $propertyDeps) { }} - {{ $deps = $propertyDeps[$property]; }} - {{? $deps.length }} - if ({{# def.propertyInData }} - {{? $breakOnError }} - && ({{# def.checkMissingProperty:$deps }})) { - {{# def.errorMissingProperty:'dependencies' }} - {{??}} - ) { - {{~ $deps:$propertyKey }} - {{# def.allErrorsMissingProperty:'dependencies' }} - {{~}} - {{?}} - } {{# def.elseIfValid }} - {{?}} -{{ } }} - -{{ - it.errorPath = $currentErrorPath; - var $currentBaseId = $it.baseId; -}} - - -{{ for (var $property in $schemaDeps) { }} - {{ var $sch = $schemaDeps[$property]; }} - {{? {{# def.nonEmptySchema:$sch }} }} - {{=$nextValid}} = true; - - if ({{# def.propertyInData }}) { - {{ - $it.schema = $sch; - $it.schemaPath = $schemaPath + it.util.getProperty($property); - $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property); - }} - - {{# def.insertSubschemaCode }} - } - - {{# def.ifResultValid }} - {{?}} -{{ } }} - -{{? $breakOnError }} - {{= $closingBraces }} - if ({{=$errs}} == errors) { -{{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/enum.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/enum.jst deleted file mode 100644 index 357c2e8..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/enum.jst +++ /dev/null @@ -1,30 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - -{{ - var $i = 'i' + $lvl - , $vSchema = 'schema' + $lvl; -}} - -{{? !$isData }} - var {{=$vSchema}} = validate.schema{{=$schemaPath}}; -{{?}} -var {{=$valid}}; - -{{?$isData}}{{# def.check$dataIsArray }}{{?}} - -{{=$valid}} = false; - -for (var {{=$i}}=0; {{=$i}}<{{=$vSchema}}.length; {{=$i}}++) - if (equal({{=$data}}, {{=$vSchema}}[{{=$i}}])) { - {{=$valid}} = true; - break; - } - -{{? $isData }} } {{?}} - -{{# def.checkError:'enum' }} - -{{? $breakOnError }} else { {{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/errors.def b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/errors.def deleted file mode 100644 index 5c5752c..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/errors.def +++ /dev/null @@ -1,194 +0,0 @@ -{{# def.definitions }} - -{{## def._error:_rule: - {{ 'istanbul ignore else'; }} - {{? it.createErrors !== false }} - { - keyword: '{{= $errorKeyword || _rule }}' - , dataPath: (dataPath || '') + {{= it.errorPath }} - , schemaPath: {{=it.util.toQuotedString($errSchemaPath)}} - , params: {{# def._errorParams[_rule] }} - {{? it.opts.messages !== false }} - , message: {{# def._errorMessages[_rule] }} - {{?}} - {{? it.opts.verbose }} - , schema: {{# def._errorSchemas[_rule] }} - , parentSchema: validate.schema{{=it.schemaPath}} - , data: {{=$data}} - {{?}} - } - {{??}} - {} - {{?}} -#}} - - -{{## def._addError:_rule: - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; -#}} - - -{{## def.addError:_rule: - var err = {{# def._error:_rule }}; - {{# def._addError:_rule }} -#}} - - -{{## def.error:_rule: - {{# def.beginDefOut}} - {{# def._error:_rule }} - {{# def.storeDefOut:__err }} - - {{? !it.compositeRule && $breakOnError }} - {{ 'istanbul ignore if'; }} - {{? it.async }} - throw new ValidationError([{{=__err}}]); - {{??}} - validate.errors = [{{=__err}}]; - return false; - {{?}} - {{??}} - var err = {{=__err}}; - {{# def._addError:_rule }} - {{?}} -#}} - - -{{## def.extraError:_rule: - {{# def.addError:_rule}} - {{? !it.compositeRule && $breakOnError }} - {{ 'istanbul ignore if'; }} - {{? it.async }} - throw new ValidationError(vErrors); - {{??}} - validate.errors = vErrors; - return false; - {{?}} - {{?}} -#}} - - -{{## def.checkError:_rule: - if (!{{=$valid}}) { - {{# def.error:_rule }} - } -#}} - - -{{## def.resetErrors: - errors = {{=$errs}}; - if (vErrors !== null) { - if ({{=$errs}}) vErrors.length = {{=$errs}}; - else vErrors = null; - } -#}} - - -{{## def.concatSchema:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=$schema}}{{?}}#}} -{{## def.appendSchema:{{?$isData}}' + {{=$schemaValue}}{{??}}{{=$schemaValue}}'{{?}}#}} -{{## def.concatSchemaEQ:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=it.util.escapeQuotes($schema)}}{{?}}#}} - -{{## def._errorMessages = { - 'false schema': "'boolean schema is false'", - $ref: "'can\\\'t resolve reference {{=it.util.escapeQuotes($schema)}}'", - additionalItems: "'should NOT have more than {{=$schema.length}} items'", - additionalProperties: "'{{? it.opts._errorDataPathProperty }}is an invalid additional property{{??}}should NOT have additional properties{{?}}'", - anyOf: "'should match some schema in anyOf'", - const: "'should be equal to constant'", - contains: "'should contain a valid item'", - dependencies: "'should have {{? $deps.length == 1 }}property {{= it.util.escapeQuotes($deps[0]) }}{{??}}properties {{= it.util.escapeQuotes($deps.join(\", \")) }}{{?}} when property {{= it.util.escapeQuotes($property) }} is present'", - 'enum': "'should be equal to one of the allowed values'", - format: "'should match format \"{{#def.concatSchemaEQ}}\"'", - 'if': "'should match \"' + {{=$ifClause}} + '\" schema'", - _limit: "'should be {{=$opStr}} {{#def.appendSchema}}", - _exclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'", - _limitItems: "'should NOT have {{?$keyword=='maxItems'}}more{{??}}fewer{{?}} than {{#def.concatSchema}} items'", - _limitLength: "'should NOT be {{?$keyword=='maxLength'}}longer{{??}}shorter{{?}} than {{#def.concatSchema}} characters'", - _limitProperties:"'should NOT have {{?$keyword=='maxProperties'}}more{{??}}fewer{{?}} than {{#def.concatSchema}} properties'", - multipleOf: "'should be multiple of {{#def.appendSchema}}", - not: "'should NOT be valid'", - oneOf: "'should match exactly one schema in oneOf'", - pattern: "'should match pattern \"{{#def.concatSchemaEQ}}\"'", - propertyNames: "'property name \\'{{=$invalidName}}\\' is invalid'", - required: "'{{? it.opts._errorDataPathProperty }}is a required property{{??}}should have required property \\'{{=$missingProperty}}\\'{{?}}'", - type: "'should be {{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}'", - uniqueItems: "'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)'", - custom: "'should pass \"{{=$rule.keyword}}\" keyword validation'", - patternRequired: "'should have property matching pattern \\'{{=$missingPattern}}\\''", - switch: "'should pass \"switch\" keyword validation'", - _formatLimit: "'should be {{=$opStr}} \"{{#def.concatSchemaEQ}}\"'", - _formatExclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'" -} #}} - - -{{## def.schemaRefOrVal: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=$schema}}{{?}} #}} -{{## def.schemaRefOrQS: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}} - -{{## def._errorSchemas = { - 'false schema': "false", - $ref: "{{=it.util.toQuotedString($schema)}}", - additionalItems: "false", - additionalProperties: "false", - anyOf: "validate.schema{{=$schemaPath}}", - const: "validate.schema{{=$schemaPath}}", - contains: "validate.schema{{=$schemaPath}}", - dependencies: "validate.schema{{=$schemaPath}}", - 'enum': "validate.schema{{=$schemaPath}}", - format: "{{#def.schemaRefOrQS}}", - 'if': "validate.schema{{=$schemaPath}}", - _limit: "{{#def.schemaRefOrVal}}", - _exclusiveLimit: "validate.schema{{=$schemaPath}}", - _limitItems: "{{#def.schemaRefOrVal}}", - _limitLength: "{{#def.schemaRefOrVal}}", - _limitProperties:"{{#def.schemaRefOrVal}}", - multipleOf: "{{#def.schemaRefOrVal}}", - not: "validate.schema{{=$schemaPath}}", - oneOf: "validate.schema{{=$schemaPath}}", - pattern: "{{#def.schemaRefOrQS}}", - propertyNames: "validate.schema{{=$schemaPath}}", - required: "validate.schema{{=$schemaPath}}", - type: "validate.schema{{=$schemaPath}}", - uniqueItems: "{{#def.schemaRefOrVal}}", - custom: "validate.schema{{=$schemaPath}}", - patternRequired: "validate.schema{{=$schemaPath}}", - switch: "validate.schema{{=$schemaPath}}", - _formatLimit: "{{#def.schemaRefOrQS}}", - _formatExclusiveLimit: "validate.schema{{=$schemaPath}}" -} #}} - - -{{## def.schemaValueQS: {{?$isData}}{{=$schemaValue}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}} - -{{## def._errorParams = { - 'false schema': "{}", - $ref: "{ ref: '{{=it.util.escapeQuotes($schema)}}' }", - additionalItems: "{ limit: {{=$schema.length}} }", - additionalProperties: "{ additionalProperty: '{{=$additionalProperty}}' }", - anyOf: "{}", - const: "{ allowedValue: schema{{=$lvl}} }", - contains: "{}", - dependencies: "{ property: '{{= it.util.escapeQuotes($property) }}', missingProperty: '{{=$missingProperty}}', depsCount: {{=$deps.length}}, deps: '{{= it.util.escapeQuotes($deps.length==1 ? $deps[0] : $deps.join(\", \")) }}' }", - 'enum': "{ allowedValues: schema{{=$lvl}} }", - format: "{ format: {{#def.schemaValueQS}} }", - 'if': "{ failingKeyword: {{=$ifClause}} }", - _limit: "{ comparison: {{=$opExpr}}, limit: {{=$schemaValue}}, exclusive: {{=$exclusive}} }", - _exclusiveLimit: "{}", - _limitItems: "{ limit: {{=$schemaValue}} }", - _limitLength: "{ limit: {{=$schemaValue}} }", - _limitProperties:"{ limit: {{=$schemaValue}} }", - multipleOf: "{ multipleOf: {{=$schemaValue}} }", - not: "{}", - oneOf: "{ passingSchemas: {{=$passingSchemas}} }", - pattern: "{ pattern: {{#def.schemaValueQS}} }", - propertyNames: "{ propertyName: '{{=$invalidName}}' }", - required: "{ missingProperty: '{{=$missingProperty}}' }", - type: "{ type: '{{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}' }", - uniqueItems: "{ i: i, j: j }", - custom: "{ keyword: '{{=$rule.keyword}}' }", - patternRequired: "{ missingPattern: '{{=$missingPattern}}' }", - switch: "{ caseIndex: {{=$caseIndex}} }", - _formatLimit: "{ comparison: {{=$opExpr}}, limit: {{#def.schemaValueQS}}, exclusive: {{=$exclusive}} }", - _formatExclusiveLimit: "{}" -} #}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/format.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/format.jst deleted file mode 100644 index 37f14da..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/format.jst +++ /dev/null @@ -1,106 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} - -{{## def.skipFormat: - {{? $breakOnError }} if (true) { {{?}} - {{ return out; }} -#}} - -{{? it.opts.format === false }}{{# def.skipFormat }}{{?}} - - -{{# def.$data }} - - -{{## def.$dataCheckFormat: - {{# def.$dataNotType:'string' }} - ({{? $unknownFormats != 'ignore' }} - ({{=$schemaValue}} && !{{=$format}} - {{? $allowUnknown }} - && self._opts.unknownFormats.indexOf({{=$schemaValue}}) == -1 - {{?}}) || - {{?}} - ({{=$format}} && {{=$formatType}} == '{{=$ruleType}}' - && !(typeof {{=$format}} == 'function' - ? {{? it.async}} - (async{{=$lvl}} ? await {{=$format}}({{=$data}}) : {{=$format}}({{=$data}})) - {{??}} - {{=$format}}({{=$data}}) - {{?}} - : {{=$format}}.test({{=$data}})))) -#}} - -{{## def.checkFormat: - {{ - var $formatRef = 'formats' + it.util.getProperty($schema); - if ($isObject) $formatRef += '.validate'; - }} - {{? typeof $format == 'function' }} - {{=$formatRef}}({{=$data}}) - {{??}} - {{=$formatRef}}.test({{=$data}}) - {{?}} -#}} - - -{{ - var $unknownFormats = it.opts.unknownFormats - , $allowUnknown = Array.isArray($unknownFormats); -}} - -{{? $isData }} - {{ - var $format = 'format' + $lvl - , $isObject = 'isObject' + $lvl - , $formatType = 'formatType' + $lvl; - }} - var {{=$format}} = formats[{{=$schemaValue}}]; - var {{=$isObject}} = typeof {{=$format}} == 'object' - && !({{=$format}} instanceof RegExp) - && {{=$format}}.validate; - var {{=$formatType}} = {{=$isObject}} && {{=$format}}.type || 'string'; - if ({{=$isObject}}) { - {{? it.async}} - var async{{=$lvl}} = {{=$format}}.async; - {{?}} - {{=$format}} = {{=$format}}.validate; - } - if ({{# def.$dataCheckFormat }}) { -{{??}} - {{ var $format = it.formats[$schema]; }} - {{? !$format }} - {{? $unknownFormats == 'ignore' }} - {{ it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); }} - {{# def.skipFormat }} - {{?? $allowUnknown && $unknownFormats.indexOf($schema) >= 0 }} - {{# def.skipFormat }} - {{??}} - {{ throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"'); }} - {{?}} - {{?}} - {{ - var $isObject = typeof $format == 'object' - && !($format instanceof RegExp) - && $format.validate; - var $formatType = $isObject && $format.type || 'string'; - if ($isObject) { - var $async = $format.async === true; - $format = $format.validate; - } - }} - {{? $formatType != $ruleType }} - {{# def.skipFormat }} - {{?}} - {{? $async }} - {{ - if (!it.async) throw new Error('async format in sync schema'); - var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate'; - }} - if (!(await {{=$formatRef}}({{=$data}}))) { - {{??}} - if (!{{# def.checkFormat }}) { - {{?}} -{{?}} - {{# def.error:'format' }} - } {{? $breakOnError }} else { {{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/if.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/if.jst deleted file mode 100644 index adb5036..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/if.jst +++ /dev/null @@ -1,73 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - - -{{## def.validateIfClause:_clause: - {{ - $it.schema = it.schema['_clause']; - $it.schemaPath = it.schemaPath + '._clause'; - $it.errSchemaPath = it.errSchemaPath + '/_clause'; - }} - {{# def.insertSubschemaCode }} - {{=$valid}} = {{=$nextValid}}; - {{? $thenPresent && $elsePresent }} - {{ $ifClause = 'ifClause' + $lvl; }} - var {{=$ifClause}} = '_clause'; - {{??}} - {{ $ifClause = '\'_clause\''; }} - {{?}} -#}} - -{{ - var $thenSch = it.schema['then'] - , $elseSch = it.schema['else'] - , $thenPresent = $thenSch !== undefined && {{# def.nonEmptySchema:$thenSch }} - , $elsePresent = $elseSch !== undefined && {{# def.nonEmptySchema:$elseSch }} - , $currentBaseId = $it.baseId; -}} - -{{? $thenPresent || $elsePresent }} - {{ - var $ifClause; - $it.createErrors = false; - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - }} - var {{=$errs}} = errors; - var {{=$valid}} = true; - - {{# def.setCompositeRule }} - {{# def.insertSubschemaCode }} - {{ $it.createErrors = true; }} - {{# def.resetErrors }} - {{# def.resetCompositeRule }} - - {{? $thenPresent }} - if ({{=$nextValid}}) { - {{# def.validateIfClause:then }} - } - {{? $elsePresent }} - else { - {{?}} - {{??}} - if (!{{=$nextValid}}) { - {{?}} - - {{? $elsePresent }} - {{# def.validateIfClause:else }} - } - {{?}} - - if (!{{=$valid}}) { - {{# def.extraError:'if' }} - } - {{? $breakOnError }} else { {{?}} -{{??}} - {{? $breakOnError }} - if (true) { - {{?}} -{{?}} - diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/items.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/items.jst deleted file mode 100644 index acc932a..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/items.jst +++ /dev/null @@ -1,98 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - - -{{## def.validateItems:startFrom: - for (var {{=$idx}} = {{=startFrom}}; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) { - {{ - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - }} - - {{# def.generateSubschemaCode }} - {{# def.optimizeValidate }} - - {{? $breakOnError }} - if (!{{=$nextValid}}) break; - {{?}} - } -#}} - -{{ - var $idx = 'i' + $lvl - , $dataNxt = $it.dataLevel = it.dataLevel + 1 - , $nextData = 'data' + $dataNxt - , $currentBaseId = it.baseId; -}} - -var {{=$errs}} = errors; -var {{=$valid}}; - -{{? Array.isArray($schema) }} - {{ /* 'items' is an array of schemas */}} - {{ var $additionalItems = it.schema.additionalItems; }} - {{? $additionalItems === false }} - {{=$valid}} = {{=$data}}.length <= {{= $schema.length }}; - {{ - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + '/additionalItems'; - }} - {{# def.checkError:'additionalItems' }} - {{ $errSchemaPath = $currErrSchemaPath; }} - {{# def.elseIfValid}} - {{?}} - - {{~ $schema:$sch:$i }} - {{? {{# def.nonEmptySchema:$sch }} }} - {{=$nextValid}} = true; - - if ({{=$data}}.length > {{=$i}}) { - {{ - var $passData = $data + '[' + $i + ']'; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true); - $it.dataPathArr[$dataNxt] = $i; - }} - - {{# def.generateSubschemaCode }} - {{# def.optimizeValidate }} - } - - {{# def.ifResultValid }} - {{?}} - {{~}} - - {{? typeof $additionalItems == 'object' && {{# def.nonEmptySchema:$additionalItems }} }} - {{ - $it.schema = $additionalItems; - $it.schemaPath = it.schemaPath + '.additionalItems'; - $it.errSchemaPath = it.errSchemaPath + '/additionalItems'; - }} - {{=$nextValid}} = true; - - if ({{=$data}}.length > {{= $schema.length }}) { - {{# def.validateItems: $schema.length }} - } - - {{# def.ifResultValid }} - {{?}} - -{{?? {{# def.nonEmptySchema:$schema }} }} - {{ /* 'items' is a single schema */}} - {{ - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - }} - {{# def.validateItems: 0 }} -{{?}} - -{{? $breakOnError }} - {{= $closingBraces }} - if ({{=$errs}} == errors) { -{{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/missing.def b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/missing.def deleted file mode 100644 index a73b9f9..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/missing.def +++ /dev/null @@ -1,39 +0,0 @@ -{{## def.checkMissingProperty:_properties: - {{~ _properties:$propertyKey:$i }} - {{?$i}} || {{?}} - {{ - var $prop = it.util.getProperty($propertyKey) - , $useData = $data + $prop; - }} - ( ({{# def.noPropertyInData }}) && (missing{{=$lvl}} = {{= it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop) }}) ) - {{~}} -#}} - - -{{## def.errorMissingProperty:_error: - {{ - var $propertyPath = 'missing' + $lvl - , $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.opts.jsonPointers - ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) - : $currentErrorPath + ' + ' + $propertyPath; - } - }} - {{# def.error:_error }} -#}} - - -{{## def.allErrorsMissingProperty:_error: - {{ - var $prop = it.util.getProperty($propertyKey) - , $missingProperty = it.util.escapeQuotes($propertyKey) - , $useData = $data + $prop; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - }} - if ({{# def.noPropertyInData }}) { - {{# def.addError:_error }} - } -#}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/multipleOf.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/multipleOf.jst deleted file mode 100644 index 6d88a45..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/multipleOf.jst +++ /dev/null @@ -1,22 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - -{{# def.numberKeyword }} - -var division{{=$lvl}}; -if ({{?$isData}} - {{=$schemaValue}} !== undefined && ( - typeof {{=$schemaValue}} != 'number' || - {{?}} - (division{{=$lvl}} = {{=$data}} / {{=$schemaValue}}, - {{? it.opts.multipleOfPrecision }} - Math.abs(Math.round(division{{=$lvl}}) - division{{=$lvl}}) > 1e-{{=it.opts.multipleOfPrecision}} - {{??}} - division{{=$lvl}} !== parseInt(division{{=$lvl}}) - {{?}} - ) - {{?$isData}} ) {{?}} ) { - {{# def.error:'multipleOf' }} -} {{? $breakOnError }} else { {{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/not.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/not.jst deleted file mode 100644 index e03185a..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/not.jst +++ /dev/null @@ -1,43 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - -{{? {{# def.nonEmptySchema:$schema }} }} - {{ - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - }} - - var {{=$errs}} = errors; - - {{# def.setCompositeRule }} - - {{ - $it.createErrors = false; - var $allErrorsOption; - if ($it.opts.allErrors) { - $allErrorsOption = $it.opts.allErrors; - $it.opts.allErrors = false; - } - }} - {{= it.validate($it) }} - {{ - $it.createErrors = true; - if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption; - }} - - {{# def.resetCompositeRule }} - - if ({{=$nextValid}}) { - {{# def.error:'not' }} - } else { - {{# def.resetErrors }} - {{? it.opts.allErrors }} } {{?}} -{{??}} - {{# def.addError:'not' }} - {{? $breakOnError}} - if (false) { - {{?}} -{{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/oneOf.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/oneOf.jst deleted file mode 100644 index bcce2c6..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/oneOf.jst +++ /dev/null @@ -1,54 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - -{{ - var $currentBaseId = $it.baseId - , $prevValid = 'prevValid' + $lvl - , $passingSchemas = 'passingSchemas' + $lvl; -}} - -var {{=$errs}} = errors - , {{=$prevValid}} = false - , {{=$valid}} = false - , {{=$passingSchemas}} = null; - -{{# def.setCompositeRule }} - -{{~ $schema:$sch:$i }} - {{? {{# def.nonEmptySchema:$sch }} }} - {{ - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - }} - - {{# def.insertSubschemaCode }} - {{??}} - var {{=$nextValid}} = true; - {{?}} - - {{? $i }} - if ({{=$nextValid}} && {{=$prevValid}}) { - {{=$valid}} = false; - {{=$passingSchemas}} = [{{=$passingSchemas}}, {{=$i}}]; - } else { - {{ $closingBraces += '}'; }} - {{?}} - - if ({{=$nextValid}}) { - {{=$valid}} = {{=$prevValid}} = true; - {{=$passingSchemas}} = {{=$i}}; - } -{{~}} - -{{# def.resetCompositeRule }} - -{{= $closingBraces }} - -if (!{{=$valid}}) { - {{# def.extraError:'oneOf' }} -} else { - {{# def.resetErrors }} -{{? it.opts.allErrors }} } {{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/pattern.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/pattern.jst deleted file mode 100644 index 3a37ef6..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/pattern.jst +++ /dev/null @@ -1,14 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - -{{ - var $regexp = $isData - ? '(new RegExp(' + $schemaValue + '))' - : it.usePattern($schema); -}} - -if ({{# def.$dataNotType:'string' }} !{{=$regexp}}.test({{=$data}}) ) { - {{# def.error:'pattern' }} -} {{? $breakOnError }} else { {{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/properties.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/properties.jst deleted file mode 100644 index 5cebb9b..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/properties.jst +++ /dev/null @@ -1,245 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - - -{{## def.validateAdditional: - {{ /* additionalProperties is schema */ - $it.schema = $aProperties; - $it.schemaPath = it.schemaPath + '.additionalProperties'; - $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; - $it.errorPath = it.opts._errorDataPathProperty - ? it.errorPath - : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - }} - - {{# def.generateSubschemaCode }} - {{# def.optimizeValidate }} -#}} - - -{{ - var $key = 'key' + $lvl - , $idx = 'idx' + $lvl - , $dataNxt = $it.dataLevel = it.dataLevel + 1 - , $nextData = 'data' + $dataNxt - , $dataProperties = 'dataProperties' + $lvl; - - var $schemaKeys = Object.keys($schema || {}).filter(notProto) - , $pProperties = it.schema.patternProperties || {} - , $pPropertyKeys = Object.keys($pProperties).filter(notProto) - , $aProperties = it.schema.additionalProperties - , $someProperties = $schemaKeys.length || $pPropertyKeys.length - , $noAdditional = $aProperties === false - , $additionalIsSchema = typeof $aProperties == 'object' - && Object.keys($aProperties).length - , $removeAdditional = it.opts.removeAdditional - , $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional - , $ownProperties = it.opts.ownProperties - , $currentBaseId = it.baseId; - - var $required = it.schema.required; - if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) { - var $requiredHash = it.util.toHash($required); - } - - function notProto(p) { return p !== '__proto__'; } -}} - - -var {{=$errs}} = errors; -var {{=$nextValid}} = true; -{{? $ownProperties }} - var {{=$dataProperties}} = undefined; -{{?}} - -{{? $checkAdditional }} - {{# def.iterateProperties }} - {{? $someProperties }} - var isAdditional{{=$lvl}} = !(false - {{? $schemaKeys.length }} - {{? $schemaKeys.length > 8 }} - || validate.schema{{=$schemaPath}}.hasOwnProperty({{=$key}}) - {{??}} - {{~ $schemaKeys:$propertyKey }} - || {{=$key}} == {{= it.util.toQuotedString($propertyKey) }} - {{~}} - {{?}} - {{?}} - {{? $pPropertyKeys.length }} - {{~ $pPropertyKeys:$pProperty:$i }} - || {{= it.usePattern($pProperty) }}.test({{=$key}}) - {{~}} - {{?}} - ); - - if (isAdditional{{=$lvl}}) { - {{?}} - {{? $removeAdditional == 'all' }} - delete {{=$data}}[{{=$key}}]; - {{??}} - {{ - var $currentErrorPath = it.errorPath; - var $additionalProperty = '\' + ' + $key + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - } - }} - {{? $noAdditional }} - {{? $removeAdditional }} - delete {{=$data}}[{{=$key}}]; - {{??}} - {{=$nextValid}} = false; - {{ - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + '/additionalProperties'; - }} - {{# def.error:'additionalProperties' }} - {{ $errSchemaPath = $currErrSchemaPath; }} - {{? $breakOnError }} break; {{?}} - {{?}} - {{?? $additionalIsSchema }} - {{? $removeAdditional == 'failing' }} - var {{=$errs}} = errors; - {{# def.setCompositeRule }} - - {{# def.validateAdditional }} - - if (!{{=$nextValid}}) { - errors = {{=$errs}}; - if (validate.errors !== null) { - if (errors) validate.errors.length = errors; - else validate.errors = null; - } - delete {{=$data}}[{{=$key}}]; - } - - {{# def.resetCompositeRule }} - {{??}} - {{# def.validateAdditional }} - {{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}} - {{?}} - {{?}} - {{ it.errorPath = $currentErrorPath; }} - {{?}} - {{? $someProperties }} - } - {{?}} - } - - {{# def.ifResultValid }} -{{?}} - -{{ var $useDefaults = it.opts.useDefaults && !it.compositeRule; }} - -{{? $schemaKeys.length }} - {{~ $schemaKeys:$propertyKey }} - {{ var $sch = $schema[$propertyKey]; }} - - {{? {{# def.nonEmptySchema:$sch}} }} - {{ - var $prop = it.util.getProperty($propertyKey) - , $passData = $data + $prop - , $hasDefault = $useDefaults && $sch.default !== undefined; - $it.schema = $sch; - $it.schemaPath = $schemaPath + $prop; - $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey); - $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers); - $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey); - }} - - {{# def.generateSubschemaCode }} - - {{? {{# def.willOptimize }} }} - {{ - $code = {{# def._optimizeValidate }}; - var $useData = $passData; - }} - {{??}} - {{ var $useData = $nextData; }} - var {{=$nextData}} = {{=$passData}}; - {{?}} - - {{? $hasDefault }} - {{= $code }} - {{??}} - {{? $requiredHash && $requiredHash[$propertyKey] }} - if ({{# def.noPropertyInData }}) { - {{=$nextValid}} = false; - {{ - var $currentErrorPath = it.errorPath - , $currErrSchemaPath = $errSchemaPath - , $missingProperty = it.util.escapeQuotes($propertyKey); - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - $errSchemaPath = it.errSchemaPath + '/required'; - }} - {{# def.error:'required' }} - {{ $errSchemaPath = $currErrSchemaPath; }} - {{ it.errorPath = $currentErrorPath; }} - } else { - {{??}} - {{? $breakOnError }} - if ({{# def.noPropertyInData }}) { - {{=$nextValid}} = true; - } else { - {{??}} - if ({{=$useData}} !== undefined - {{? $ownProperties }} - && {{# def.isOwnProperty }} - {{?}} - ) { - {{?}} - {{?}} - - {{= $code }} - } - {{?}} {{ /* $hasDefault */ }} - {{?}} {{ /* def.nonEmptySchema */ }} - - {{# def.ifResultValid }} - {{~}} -{{?}} - -{{? $pPropertyKeys.length }} - {{~ $pPropertyKeys:$pProperty }} - {{ var $sch = $pProperties[$pProperty]; }} - - {{? {{# def.nonEmptySchema:$sch}} }} - {{ - $it.schema = $sch; - $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty); - $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' - + it.util.escapeFragment($pProperty); - }} - - {{# def.iterateProperties }} - if ({{= it.usePattern($pProperty) }}.test({{=$key}})) { - {{ - $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - }} - - {{# def.generateSubschemaCode }} - {{# def.optimizeValidate }} - - {{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}} - } - {{? $breakOnError }} else {{=$nextValid}} = true; {{?}} - } - - {{# def.ifResultValid }} - {{?}} {{ /* def.nonEmptySchema */ }} - {{~}} -{{?}} - - -{{? $breakOnError }} - {{= $closingBraces }} - if ({{=$errs}} == errors) { -{{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/propertyNames.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/propertyNames.jst deleted file mode 100644 index d456cca..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/propertyNames.jst +++ /dev/null @@ -1,52 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - -var {{=$errs}} = errors; - -{{? {{# def.nonEmptySchema:$schema }} }} - {{ - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - }} - - {{ - var $key = 'key' + $lvl - , $idx = 'idx' + $lvl - , $i = 'i' + $lvl - , $invalidName = '\' + ' + $key + ' + \'' - , $dataNxt = $it.dataLevel = it.dataLevel + 1 - , $nextData = 'data' + $dataNxt - , $dataProperties = 'dataProperties' + $lvl - , $ownProperties = it.opts.ownProperties - , $currentBaseId = it.baseId; - }} - - {{? $ownProperties }} - var {{=$dataProperties}} = undefined; - {{?}} - {{# def.iterateProperties }} - var startErrs{{=$lvl}} = errors; - - {{ var $passData = $key; }} - {{# def.setCompositeRule }} - {{# def.generateSubschemaCode }} - {{# def.optimizeValidate }} - {{# def.resetCompositeRule }} - - if (!{{=$nextValid}}) { - for (var {{=$i}}=startErrs{{=$lvl}}; {{=$i}}= it.opts.loopRequired - , $ownProperties = it.opts.ownProperties; - }} - - {{? $breakOnError }} - var missing{{=$lvl}}; - {{? $loopRequired }} - {{# def.setupLoop }} - var {{=$valid}} = true; - - {{?$isData}}{{# def.check$dataIsArray }}{{?}} - - for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) { - {{=$valid}} = {{=$data}}[{{=$vSchema}}[{{=$i}}]] !== undefined - {{? $ownProperties }} - && {{# def.isRequiredOwnProperty }} - {{?}}; - if (!{{=$valid}}) break; - } - - {{? $isData }} } {{?}} - - {{# def.checkError:'required' }} - else { - {{??}} - if ({{# def.checkMissingProperty:$required }}) { - {{# def.errorMissingProperty:'required' }} - } else { - {{?}} - {{??}} - {{? $loopRequired }} - {{# def.setupLoop }} - {{? $isData }} - if ({{=$vSchema}} && !Array.isArray({{=$vSchema}})) { - {{# def.addError:'required' }} - } else if ({{=$vSchema}} !== undefined) { - {{?}} - - for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) { - if ({{=$data}}[{{=$vSchema}}[{{=$i}}]] === undefined - {{? $ownProperties }} - || !{{# def.isRequiredOwnProperty }} - {{?}}) { - {{# def.addError:'required' }} - } - } - - {{? $isData }} } {{?}} - {{??}} - {{~ $required:$propertyKey }} - {{# def.allErrorsMissingProperty:'required' }} - {{~}} - {{?}} - {{?}} - - {{ it.errorPath = $currentErrorPath; }} - -{{?? $breakOnError }} - if (true) { -{{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/uniqueItems.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/uniqueItems.jst deleted file mode 100644 index e69b830..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/uniqueItems.jst +++ /dev/null @@ -1,62 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - - -{{? ($schema || $isData) && it.opts.uniqueItems !== false }} - {{? $isData }} - var {{=$valid}}; - if ({{=$schemaValue}} === false || {{=$schemaValue}} === undefined) - {{=$valid}} = true; - else if (typeof {{=$schemaValue}} != 'boolean') - {{=$valid}} = false; - else { - {{?}} - - var i = {{=$data}}.length - , {{=$valid}} = true - , j; - if (i > 1) { - {{ - var $itemType = it.schema.items && it.schema.items.type - , $typeIsArray = Array.isArray($itemType); - }} - {{? !$itemType || $itemType == 'object' || $itemType == 'array' || - ($typeIsArray && ($itemType.indexOf('object') >= 0 || $itemType.indexOf('array') >= 0)) }} - outer: - for (;i--;) { - for (j = i; j--;) { - if (equal({{=$data}}[i], {{=$data}}[j])) { - {{=$valid}} = false; - break outer; - } - } - } - {{??}} - var itemIndices = {}, item; - for (;i--;) { - var item = {{=$data}}[i]; - {{ var $method = 'checkDataType' + ($typeIsArray ? 's' : ''); }} - if ({{= it.util[$method]($itemType, 'item', it.opts.strictNumbers, true) }}) continue; - {{? $typeIsArray}} - if (typeof item == 'string') item = '"' + item; - {{?}} - if (typeof itemIndices[item] == 'number') { - {{=$valid}} = false; - j = itemIndices[item]; - break; - } - itemIndices[item] = i; - } - {{?}} - } - - {{? $isData }} } {{?}} - - if (!{{=$valid}}) { - {{# def.error:'uniqueItems' }} - } {{? $breakOnError }} else { {{?}} -{{??}} - {{? $breakOnError }} if (true) { {{?}} -{{?}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/validate.jst b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/validate.jst deleted file mode 100644 index 32087e7..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dot/validate.jst +++ /dev/null @@ -1,276 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.defaults }} -{{# def.coerce }} - -{{ /** - * schema compilation (render) time: - * it = { schema, RULES, _validate, opts } - * it.validate - this template function, - * it is used recursively to generate code for subschemas - * - * runtime: - * "validate" is a variable name to which this function will be assigned - * validateRef etc. are defined in the parent scope in index.js - */ }} - -{{ - var $async = it.schema.$async === true - , $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref') - , $id = it.self._getId(it.schema); -}} - -{{ - if (it.opts.strictKeywords) { - var $unknownKwd = it.util.schemaUnknownRules(it.schema, it.RULES.keywords); - if ($unknownKwd) { - var $keywordsMsg = 'unknown keyword: ' + $unknownKwd; - if (it.opts.strictKeywords === 'log') it.logger.warn($keywordsMsg); - else throw new Error($keywordsMsg); - } - } -}} - -{{? it.isTop }} - var validate = {{?$async}}{{it.async = true;}}async {{?}}function(data, dataPath, parentData, parentDataProperty, rootData) { - 'use strict'; - {{? $id && (it.opts.sourceCode || it.opts.processCode) }} - {{= '/\*# sourceURL=' + $id + ' */' }} - {{?}} -{{?}} - -{{? typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref) }} - {{ var $keyword = 'false schema'; }} - {{# def.setupKeyword }} - {{? it.schema === false}} - {{? it.isTop}} - {{ $breakOnError = true; }} - {{??}} - var {{=$valid}} = false; - {{?}} - {{# def.error:'false schema' }} - {{??}} - {{? it.isTop}} - {{? $async }} - return data; - {{??}} - validate.errors = null; - return true; - {{?}} - {{??}} - var {{=$valid}} = true; - {{?}} - {{?}} - - {{? it.isTop}} - }; - return validate; - {{?}} - - {{ return out; }} -{{?}} - - -{{? it.isTop }} - {{ - var $top = it.isTop - , $lvl = it.level = 0 - , $dataLvl = it.dataLevel = 0 - , $data = 'data'; - it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema)); - it.baseId = it.baseId || it.rootId; - delete it.isTop; - - it.dataPathArr = [""]; - - if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) { - var $defaultMsg = 'default is ignored in the schema root'; - if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); - else throw new Error($defaultMsg); - } - }} - - var vErrors = null; {{ /* don't edit, used in replace */ }} - var errors = 0; {{ /* don't edit, used in replace */ }} - if (rootData === undefined) rootData = data; {{ /* don't edit, used in replace */ }} -{{??}} - {{ - var $lvl = it.level - , $dataLvl = it.dataLevel - , $data = 'data' + ($dataLvl || ''); - - if ($id) it.baseId = it.resolve.url(it.baseId, $id); - - if ($async && !it.async) throw new Error('async schema in sync schema'); - }} - - var errs_{{=$lvl}} = errors; -{{?}} - -{{ - var $valid = 'valid' + $lvl - , $breakOnError = !it.opts.allErrors - , $closingBraces1 = '' - , $closingBraces2 = ''; - - var $errorKeyword; - var $typeSchema = it.schema.type - , $typeIsArray = Array.isArray($typeSchema); - - if ($typeSchema && it.opts.nullable && it.schema.nullable === true) { - if ($typeIsArray) { - if ($typeSchema.indexOf('null') == -1) - $typeSchema = $typeSchema.concat('null'); - } else if ($typeSchema != 'null') { - $typeSchema = [$typeSchema, 'null']; - $typeIsArray = true; - } - } - - if ($typeIsArray && $typeSchema.length == 1) { - $typeSchema = $typeSchema[0]; - $typeIsArray = false; - } -}} - -{{## def.checkType: - {{ - var $schemaPath = it.schemaPath + '.type' - , $errSchemaPath = it.errSchemaPath + '/type' - , $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType'; - }} - - if ({{= it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true) }}) { -#}} - -{{? it.schema.$ref && $refKeywords }} - {{? it.opts.extendRefs == 'fail' }} - {{ throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); }} - {{?? it.opts.extendRefs !== true }} - {{ - $refKeywords = false; - it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"'); - }} - {{?}} -{{?}} - -{{? it.schema.$comment && it.opts.$comment }} - {{= it.RULES.all.$comment.code(it, '$comment') }} -{{?}} - -{{? $typeSchema }} - {{? it.opts.coerceTypes }} - {{ var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); }} - {{?}} - - {{ var $rulesGroup = it.RULES.types[$typeSchema]; }} - {{? $coerceToTypes || $typeIsArray || $rulesGroup === true || - ($rulesGroup && !$shouldUseGroup($rulesGroup)) }} - {{ - var $schemaPath = it.schemaPath + '.type' - , $errSchemaPath = it.errSchemaPath + '/type'; - }} - {{# def.checkType }} - {{? $coerceToTypes }} - {{# def.coerceType }} - {{??}} - {{# def.error:'type' }} - {{?}} - } - {{?}} -{{?}} - - -{{? it.schema.$ref && !$refKeywords }} - {{= it.RULES.all.$ref.code(it, '$ref') }} - {{? $breakOnError }} - } - if (errors === {{?$top}}0{{??}}errs_{{=$lvl}}{{?}}) { - {{ $closingBraces2 += '}'; }} - {{?}} -{{??}} - {{~ it.RULES:$rulesGroup }} - {{? $shouldUseGroup($rulesGroup) }} - {{? $rulesGroup.type }} - if ({{= it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers) }}) { - {{?}} - {{? it.opts.useDefaults }} - {{? $rulesGroup.type == 'object' && it.schema.properties }} - {{# def.defaultProperties }} - {{?? $rulesGroup.type == 'array' && Array.isArray(it.schema.items) }} - {{# def.defaultItems }} - {{?}} - {{?}} - {{~ $rulesGroup.rules:$rule }} - {{? $shouldUseRule($rule) }} - {{ var $code = $rule.code(it, $rule.keyword, $rulesGroup.type); }} - {{? $code }} - {{= $code }} - {{? $breakOnError }} - {{ $closingBraces1 += '}'; }} - {{?}} - {{?}} - {{?}} - {{~}} - {{? $breakOnError }} - {{= $closingBraces1 }} - {{ $closingBraces1 = ''; }} - {{?}} - {{? $rulesGroup.type }} - } - {{? $typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes }} - else { - {{ - var $schemaPath = it.schemaPath + '.type' - , $errSchemaPath = it.errSchemaPath + '/type'; - }} - {{# def.error:'type' }} - } - {{?}} - {{?}} - - {{? $breakOnError }} - if (errors === {{?$top}}0{{??}}errs_{{=$lvl}}{{?}}) { - {{ $closingBraces2 += '}'; }} - {{?}} - {{?}} - {{~}} -{{?}} - -{{? $breakOnError }} {{= $closingBraces2 }} {{?}} - -{{? $top }} - {{? $async }} - if (errors === 0) return data; {{ /* don't edit, used in replace */ }} - else throw new ValidationError(vErrors); {{ /* don't edit, used in replace */ }} - {{??}} - validate.errors = vErrors; {{ /* don't edit, used in replace */ }} - return errors === 0; {{ /* don't edit, used in replace */ }} - {{?}} - }; - - return validate; -{{??}} - var {{=$valid}} = errors === errs_{{=$lvl}}; -{{?}} - -{{ - function $shouldUseGroup($rulesGroup) { - var rules = $rulesGroup.rules; - for (var i=0; i < rules.length; i++) - if ($shouldUseRule(rules[i])) - return true; - } - - function $shouldUseRule($rule) { - return it.schema[$rule.keyword] !== undefined || - ($rule.implements && $ruleImplementsSomeKeyword($rule)); - } - - function $ruleImplementsSomeKeyword($rule) { - var impl = $rule.implements; - for (var i=0; i < impl.length; i++) - if (it.schema[impl[i]] !== undefined) - return true; - } -}} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/README.md b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/README.md deleted file mode 100644 index 4d99484..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/README.md +++ /dev/null @@ -1,3 +0,0 @@ -These files are compiled dot templates from dot folder. - -Do NOT edit them directly, edit the templates and run `npm run build` from main ajv folder. diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/_limit.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/_limit.js deleted file mode 100644 index 05a1979..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/_limit.js +++ /dev/null @@ -1,163 +0,0 @@ -'use strict'; -module.exports = function generate__limit(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $isMax = $keyword == 'maximum', - $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum', - $schemaExcl = it.schema[$exclusiveKeyword], - $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data, - $op = $isMax ? '<' : '>', - $notOp = $isMax ? '>' : '<', - $errorKeyword = undefined; - if (!($isData || typeof $schema == 'number' || $schema === undefined)) { - throw new Error($keyword + ' must be number'); - } - if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) { - throw new Error($exclusiveKeyword + ' must be number or boolean'); - } - if ($isDataExcl) { - var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr), - $exclusive = 'exclusive' + $lvl, - $exclType = 'exclType' + $lvl, - $exclIsNumber = 'exclIsNumber' + $lvl, - $opExpr = 'op' + $lvl, - $opStr = '\' + ' + $opExpr + ' + \''; - out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; '; - $schemaValueExcl = 'schemaExcl' + $lvl; - out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \'boolean\' && ' + ($exclType) + ' != \'undefined\' && ' + ($exclType) + ' != \'number\') { '; - var $errorKeyword = $exclusiveKeyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ' + ($exclType) + ' == \'number\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\'; '; - if ($schema === undefined) { - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $schemaValue = $schemaValueExcl; - $isData = $isDataExcl; - } - } else { - var $exclIsNumber = typeof $schemaExcl == 'number', - $opStr = $op; - if ($exclIsNumber && $isData) { - var $opExpr = '\'' + $opStr + '\''; - out += ' if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { '; - } else { - if ($exclIsNumber && $schema === undefined) { - $exclusive = true; - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $schemaValue = $schemaExcl; - $notOp += '='; - } else { - if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema); - if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) { - $exclusive = true; - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $notOp += '='; - } else { - $exclusive = false; - $opStr += '='; - } - } - var $opExpr = '\'' + $opStr + '\''; - out += ' if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { '; - } - } - $errorKeyword = $errorKeyword || $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be ' + ($opStr) + ' '; - if ($isData) { - out += '\' + ' + ($schemaValue); - } else { - out += '' + ($schemaValue) + '\''; - } - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/_limitItems.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/_limitItems.js deleted file mode 100644 index e092a55..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/_limitItems.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict'; -module.exports = function generate__limitItems(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!($isData || typeof $schema == 'number')) { - throw new Error($keyword + ' must be number'); - } - var $op = $keyword == 'maxItems' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have '; - if ($keyword == 'maxItems') { - out += 'more'; - } else { - out += 'fewer'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' items\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/_limitLength.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/_limitLength.js deleted file mode 100644 index ecbd3fe..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/_limitLength.js +++ /dev/null @@ -1,85 +0,0 @@ -'use strict'; -module.exports = function generate__limitLength(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!($isData || typeof $schema == 'number')) { - throw new Error($keyword + ' must be number'); - } - var $op = $keyword == 'maxLength' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - if (it.opts.unicode === false) { - out += ' ' + ($data) + '.length '; - } else { - out += ' ucs2length(' + ($data) + ') '; - } - out += ' ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT be '; - if ($keyword == 'maxLength') { - out += 'longer'; - } else { - out += 'shorter'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' characters\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/_limitProperties.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/_limitProperties.js deleted file mode 100644 index d232755..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/_limitProperties.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict'; -module.exports = function generate__limitProperties(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!($isData || typeof $schema == 'number')) { - throw new Error($keyword + ' must be number'); - } - var $op = $keyword == 'maxProperties' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have '; - if ($keyword == 'maxProperties') { - out += 'more'; - } else { - out += 'fewer'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' properties\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/allOf.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/allOf.js deleted file mode 100644 index fb8c2e4..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/allOf.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; -module.exports = function generate_allOf(it, $keyword, $ruleType) { - var out = ' '; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $currentBaseId = $it.baseId, - $allSchemasEmpty = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - $allSchemasEmpty = false; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if ($breakOnError) { - if ($allSchemasEmpty) { - out += ' if (true) { '; - } else { - out += ' ' + ($closingBraces.slice(0, -1)) + ' '; - } - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/anyOf.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/anyOf.js deleted file mode 100644 index 0600a9d..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/anyOf.js +++ /dev/null @@ -1,73 +0,0 @@ -'use strict'; -module.exports = function generate_anyOf(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $noEmptySchema = $schema.every(function($sch) { - return (it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)); - }); - if ($noEmptySchema) { - var $currentBaseId = $it.baseId; - out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { '; - $closingBraces += '}'; - } - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should match some schema in anyOf\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; return false; '; - } - } - out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - if (it.opts.allErrors) { - out += ' } '; - } - } else { - if ($breakOnError) { - out += ' if (true) { '; - } - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/comment.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/comment.js deleted file mode 100644 index dd66bb8..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/comment.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; -module.exports = function generate_comment(it, $keyword, $ruleType) { - var out = ' '; - var $schema = it.schema[$keyword]; - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $comment = it.util.toQuotedString($schema); - if (it.opts.$comment === true) { - out += ' console.log(' + ($comment) + ');'; - } else if (typeof it.opts.$comment == 'function') { - out += ' self._opts.$comment(' + ($comment) + ', ' + (it.util.toQuotedString($errSchemaPath)) + ', validate.root.schema);'; - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/const.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/const.js deleted file mode 100644 index 15b7c61..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/const.js +++ /dev/null @@ -1,56 +0,0 @@ -'use strict'; -module.exports = function generate_const(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!$isData) { - out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';'; - } - out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('const') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValue: schema' + ($lvl) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be equal to constant\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' }'; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/contains.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/contains.js deleted file mode 100644 index 7d76300..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/contains.js +++ /dev/null @@ -1,81 +0,0 @@ -'use strict'; -module.exports = function generate_contains(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $idx = 'i' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $currentBaseId = it.baseId, - $nonEmptySchema = (it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all)); - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if ($nonEmptySchema) { - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' var ' + ($nextValid) + ' = false; for (var ' + ($idx) + ' = 0; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - out += ' if (' + ($nextValid) + ') break; } '; - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($closingBraces) + ' if (!' + ($nextValid) + ') {'; - } else { - out += ' if (' + ($data) + '.length == 0) {'; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('contains') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should contain a valid item\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - if ($nonEmptySchema) { - out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - } - if (it.opts.allErrors) { - out += ' } '; - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/custom.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/custom.js deleted file mode 100644 index f3e641e..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/custom.js +++ /dev/null @@ -1,228 +0,0 @@ -'use strict'; -module.exports = function generate_custom(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $rule = this, - $definition = 'definition' + $lvl, - $rDef = $rule.definition, - $closingBraces = ''; - var $compile, $inline, $macro, $ruleValidate, $validateCode; - if ($isData && $rDef.$data) { - $validateCode = 'keywordValidate' + $lvl; - var $validateSchema = $rDef.validateSchema; - out += ' var ' + ($definition) + ' = RULES.custom[\'' + ($keyword) + '\'].definition; var ' + ($validateCode) + ' = ' + ($definition) + '.validate;'; - } else { - $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it); - if (!$ruleValidate) return; - $schemaValue = 'validate.schema' + $schemaPath; - $validateCode = $ruleValidate.code; - $compile = $rDef.compile; - $inline = $rDef.inline; - $macro = $rDef.macro; - } - var $ruleErrs = $validateCode + '.errors', - $i = 'i' + $lvl, - $ruleErr = 'ruleErr' + $lvl, - $asyncKeyword = $rDef.async; - if ($asyncKeyword && !it.async) throw new Error('async keyword in sync schema'); - if (!($inline || $macro)) { - out += '' + ($ruleErrs) + ' = null;'; - } - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if ($isData && $rDef.$data) { - $closingBraces += '}'; - out += ' if (' + ($schemaValue) + ' === undefined) { ' + ($valid) + ' = true; } else { '; - if ($validateSchema) { - $closingBraces += '}'; - out += ' ' + ($valid) + ' = ' + ($definition) + '.validateSchema(' + ($schemaValue) + '); if (' + ($valid) + ') { '; - } - } - if ($inline) { - if ($rDef.statements) { - out += ' ' + ($ruleValidate.validate) + ' '; - } else { - out += ' ' + ($valid) + ' = ' + ($ruleValidate.validate) + '; '; - } - } else if ($macro) { - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - $it.schema = $ruleValidate.validate; - $it.schemaPath = ''; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($code); - } else { - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; - out += ' ' + ($validateCode) + '.call( '; - if (it.opts.passContext) { - out += 'this'; - } else { - out += 'self'; - } - if ($compile || $rDef.schema === false) { - out += ' , ' + ($data) + ' '; - } else { - out += ' , ' + ($schemaValue) + ' , ' + ($data) + ' , validate.schema' + (it.schemaPath) + ' '; - } - out += ' , (dataPath || \'\')'; - if (it.errorPath != '""') { - out += ' + ' + (it.errorPath); - } - var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', - $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; - out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ' , rootData ) '; - var def_callRuleValidate = out; - out = $$outStack.pop(); - if ($rDef.errors === false) { - out += ' ' + ($valid) + ' = '; - if ($asyncKeyword) { - out += 'await '; - } - out += '' + (def_callRuleValidate) + '; '; - } else { - if ($asyncKeyword) { - $ruleErrs = 'customErrors' + $lvl; - out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = await ' + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } '; - } else { - out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; '; - } - } - } - if ($rDef.modifying) { - out += ' if (' + ($parentData) + ') ' + ($data) + ' = ' + ($parentData) + '[' + ($parentDataProperty) + '];'; - } - out += '' + ($closingBraces); - if ($rDef.valid) { - if ($breakOnError) { - out += ' if (true) { '; - } - } else { - out += ' if ( '; - if ($rDef.valid === undefined) { - out += ' !'; - if ($macro) { - out += '' + ($nextValid); - } else { - out += '' + ($valid); - } - } else { - out += ' ' + (!$rDef.valid) + ' '; - } - out += ') { '; - $errorKeyword = $rule.keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - var def_customError = out; - out = $$outStack.pop(); - if ($inline) { - if ($rDef.errors) { - if ($rDef.errors != 'full') { - out += ' for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + ' 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') '; - } - out += ') { '; - $it.schema = $sch; - $it.schemaPath = $schemaPath + it.util.getProperty($property); - $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property); - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/enum.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/enum.js deleted file mode 100644 index 90580b9..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/enum.js +++ /dev/null @@ -1,66 +0,0 @@ -'use strict'; -module.exports = function generate_enum(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $i = 'i' + $lvl, - $vSchema = 'schema' + $lvl; - if (!$isData) { - out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + ';'; - } - out += 'var ' + ($valid) + ';'; - if ($isData) { - out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {'; - } - out += '' + ($valid) + ' = false;for (var ' + ($i) + '=0; ' + ($i) + '<' + ($vSchema) + '.length; ' + ($i) + '++) if (equal(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + '])) { ' + ($valid) + ' = true; break; }'; - if ($isData) { - out += ' } '; - } - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('enum') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValues: schema' + ($lvl) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be equal to one of the allowed values\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' }'; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/format.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/format.js deleted file mode 100644 index cd9a569..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/format.js +++ /dev/null @@ -1,150 +0,0 @@ -'use strict'; -module.exports = function generate_format(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - if (it.opts.format === false) { - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $unknownFormats = it.opts.unknownFormats, - $allowUnknown = Array.isArray($unknownFormats); - if ($isData) { - var $format = 'format' + $lvl, - $isObject = 'isObject' + $lvl, - $formatType = 'formatType' + $lvl; - out += ' var ' + ($format) + ' = formats[' + ($schemaValue) + ']; var ' + ($isObject) + ' = typeof ' + ($format) + ' == \'object\' && !(' + ($format) + ' instanceof RegExp) && ' + ($format) + '.validate; var ' + ($formatType) + ' = ' + ($isObject) + ' && ' + ($format) + '.type || \'string\'; if (' + ($isObject) + ') { '; - if (it.async) { - out += ' var async' + ($lvl) + ' = ' + ($format) + '.async; '; - } - out += ' ' + ($format) + ' = ' + ($format) + '.validate; } if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || '; - } - out += ' ('; - if ($unknownFormats != 'ignore') { - out += ' (' + ($schemaValue) + ' && !' + ($format) + ' '; - if ($allowUnknown) { - out += ' && self._opts.unknownFormats.indexOf(' + ($schemaValue) + ') == -1 '; - } - out += ') || '; - } - out += ' (' + ($format) + ' && ' + ($formatType) + ' == \'' + ($ruleType) + '\' && !(typeof ' + ($format) + ' == \'function\' ? '; - if (it.async) { - out += ' (async' + ($lvl) + ' ? await ' + ($format) + '(' + ($data) + ') : ' + ($format) + '(' + ($data) + ')) '; - } else { - out += ' ' + ($format) + '(' + ($data) + ') '; - } - out += ' : ' + ($format) + '.test(' + ($data) + '))))) {'; - } else { - var $format = it.formats[$schema]; - if (!$format) { - if ($unknownFormats == 'ignore') { - it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } else if ($allowUnknown && $unknownFormats.indexOf($schema) >= 0) { - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } else { - throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"'); - } - } - var $isObject = typeof $format == 'object' && !($format instanceof RegExp) && $format.validate; - var $formatType = $isObject && $format.type || 'string'; - if ($isObject) { - var $async = $format.async === true; - $format = $format.validate; - } - if ($formatType != $ruleType) { - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } - if ($async) { - if (!it.async) throw new Error('async format in sync schema'); - var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate'; - out += ' if (!(await ' + ($formatRef) + '(' + ($data) + '))) { '; - } else { - out += ' if (! '; - var $formatRef = 'formats' + it.util.getProperty($schema); - if ($isObject) $formatRef += '.validate'; - if (typeof $format == 'function') { - out += ' ' + ($formatRef) + '(' + ($data) + ') '; - } else { - out += ' ' + ($formatRef) + '.test(' + ($data) + ') '; - } - out += ') { '; - } - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('format') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: '; - if ($isData) { - out += '' + ($schemaValue); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match format "'; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + (it.util.escapeQuotes($schema)); - } - out += '"\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/if.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/if.js deleted file mode 100644 index 94d27ad..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/if.js +++ /dev/null @@ -1,103 +0,0 @@ -'use strict'; -module.exports = function generate_if(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - $it.level++; - var $nextValid = 'valid' + $it.level; - var $thenSch = it.schema['then'], - $elseSch = it.schema['else'], - $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)), - $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)), - $currentBaseId = $it.baseId; - if ($thenPresent || $elsePresent) { - var $ifClause; - $it.createErrors = false; - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = true; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - $it.createErrors = true; - out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - it.compositeRule = $it.compositeRule = $wasComposite; - if ($thenPresent) { - out += ' if (' + ($nextValid) + ') { '; - $it.schema = it.schema['then']; - $it.schemaPath = it.schemaPath + '.then'; - $it.errSchemaPath = it.errSchemaPath + '/then'; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' ' + ($valid) + ' = ' + ($nextValid) + '; '; - if ($thenPresent && $elsePresent) { - $ifClause = 'ifClause' + $lvl; - out += ' var ' + ($ifClause) + ' = \'then\'; '; - } else { - $ifClause = '\'then\''; - } - out += ' } '; - if ($elsePresent) { - out += ' else { '; - } - } else { - out += ' if (!' + ($nextValid) + ') { '; - } - if ($elsePresent) { - $it.schema = it.schema['else']; - $it.schemaPath = it.schemaPath + '.else'; - $it.errSchemaPath = it.errSchemaPath + '/else'; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' ' + ($valid) + ' = ' + ($nextValid) + '; '; - if ($thenPresent && $elsePresent) { - $ifClause = 'ifClause' + $lvl; - out += ' var ' + ($ifClause) + ' = \'else\'; '; - } else { - $ifClause = '\'else\''; - } - out += ' } '; - } - out += ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('if') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { failingKeyword: ' + ($ifClause) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match "\' + ' + ($ifClause) + ' + \'" schema\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; return false; '; - } - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - } else { - if ($breakOnError) { - out += ' if (true) { '; - } - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/index.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/index.js deleted file mode 100644 index 2fb1b00..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/index.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; - -//all requires must be explicit because browserify won't work with dynamic requires -module.exports = { - '$ref': require('./ref'), - allOf: require('./allOf'), - anyOf: require('./anyOf'), - '$comment': require('./comment'), - const: require('./const'), - contains: require('./contains'), - dependencies: require('./dependencies'), - 'enum': require('./enum'), - format: require('./format'), - 'if': require('./if'), - items: require('./items'), - maximum: require('./_limit'), - minimum: require('./_limit'), - maxItems: require('./_limitItems'), - minItems: require('./_limitItems'), - maxLength: require('./_limitLength'), - minLength: require('./_limitLength'), - maxProperties: require('./_limitProperties'), - minProperties: require('./_limitProperties'), - multipleOf: require('./multipleOf'), - not: require('./not'), - oneOf: require('./oneOf'), - pattern: require('./pattern'), - properties: require('./properties'), - propertyNames: require('./propertyNames'), - required: require('./required'), - uniqueItems: require('./uniqueItems'), - validate: require('./validate') -}; diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/items.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/items.js deleted file mode 100644 index bee5d67..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/items.js +++ /dev/null @@ -1,140 +0,0 @@ -'use strict'; -module.exports = function generate_items(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $idx = 'i' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $currentBaseId = it.baseId; - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if (Array.isArray($schema)) { - var $additionalItems = it.schema.additionalItems; - if ($additionalItems === false) { - out += ' ' + ($valid) + ' = ' + ($data) + '.length <= ' + ($schema.length) + '; '; - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + '/additionalItems'; - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('additionalItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schema.length) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have more than ' + ($schema.length) + ' items\' '; - } - if (it.opts.verbose) { - out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - $errSchemaPath = $currErrSchemaPath; - if ($breakOnError) { - $closingBraces += '}'; - out += ' else { '; - } - } - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { '; - var $passData = $data + '[' + $i + ']'; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true); - $it.dataPathArr[$dataNxt] = $i; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? (typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0) || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) { - $it.schema = $additionalItems; - $it.schemaPath = it.schemaPath + '.additionalItems'; - $it.errSchemaPath = it.errSchemaPath + '/additionalItems'; - out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($schema.length) + ') { for (var ' + ($idx) + ' = ' + ($schema.length) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' } } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } else if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' for (var ' + ($idx) + ' = ' + (0) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' }'; - } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/multipleOf.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/multipleOf.js deleted file mode 100644 index 9d6401b..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/multipleOf.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict'; -module.exports = function generate_multipleOf(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!($isData || typeof $schema == 'number')) { - throw new Error($keyword + ' must be number'); - } - out += 'var division' + ($lvl) + ';if ('; - if ($isData) { - out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || '; - } - out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', '; - if (it.opts.multipleOfPrecision) { - out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' '; - } else { - out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') '; - } - out += ' ) '; - if ($isData) { - out += ' ) '; - } - out += ' ) { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('multipleOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be multiple of '; - if ($isData) { - out += '\' + ' + ($schemaValue); - } else { - out += '' + ($schemaValue) + '\''; - } - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/not.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/not.js deleted file mode 100644 index f50c937..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/not.js +++ /dev/null @@ -1,84 +0,0 @@ -'use strict'; -module.exports = function generate_not(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - $it.level++; - var $nextValid = 'valid' + $it.level; - if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' var ' + ($errs) + ' = errors; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.createErrors = false; - var $allErrorsOption; - if ($it.opts.allErrors) { - $allErrorsOption = $it.opts.allErrors; - $it.opts.allErrors = false; - } - out += ' ' + (it.validate($it)) + ' '; - $it.createErrors = true; - if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption; - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' if (' + ($nextValid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT be valid\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - if (it.opts.allErrors) { - out += ' } '; - } - } else { - out += ' var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT be valid\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if ($breakOnError) { - out += ' if (false) { '; - } - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/oneOf.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/oneOf.js deleted file mode 100644 index dfe2fd5..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/oneOf.js +++ /dev/null @@ -1,73 +0,0 @@ -'use strict'; -module.exports = function generate_oneOf(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $currentBaseId = $it.baseId, - $prevValid = 'prevValid' + $lvl, - $passingSchemas = 'passingSchemas' + $lvl; - out += 'var ' + ($errs) + ' = errors , ' + ($prevValid) + ' = false , ' + ($valid) + ' = false , ' + ($passingSchemas) + ' = null; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - } else { - out += ' var ' + ($nextValid) + ' = true; '; - } - if ($i) { - out += ' if (' + ($nextValid) + ' && ' + ($prevValid) + ') { ' + ($valid) + ' = false; ' + ($passingSchemas) + ' = [' + ($passingSchemas) + ', ' + ($i) + ']; } else { '; - $closingBraces += '}'; - } - out += ' if (' + ($nextValid) + ') { ' + ($valid) + ' = ' + ($prevValid) + ' = true; ' + ($passingSchemas) + ' = ' + ($i) + '; }'; - } - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { passingSchemas: ' + ($passingSchemas) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match exactly one schema in oneOf\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; return false; '; - } - } - out += '} else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; }'; - if (it.opts.allErrors) { - out += ' } '; - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/pattern.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/pattern.js deleted file mode 100644 index 1d74d6b..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/pattern.js +++ /dev/null @@ -1,75 +0,0 @@ -'use strict'; -module.exports = function generate_pattern(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema); - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || '; - } - out += ' !' + ($regexp) + '.test(' + ($data) + ') ) { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('pattern') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern: '; - if ($isData) { - out += '' + ($schemaValue); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match pattern "'; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + (it.util.escapeQuotes($schema)); - } - out += '"\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/properties.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/properties.js deleted file mode 100644 index bc5ee55..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/properties.js +++ /dev/null @@ -1,335 +0,0 @@ -'use strict'; -module.exports = function generate_properties(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $key = 'key' + $lvl, - $idx = 'idx' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $dataProperties = 'dataProperties' + $lvl; - var $schemaKeys = Object.keys($schema || {}).filter(notProto), - $pProperties = it.schema.patternProperties || {}, - $pPropertyKeys = Object.keys($pProperties).filter(notProto), - $aProperties = it.schema.additionalProperties, - $someProperties = $schemaKeys.length || $pPropertyKeys.length, - $noAdditional = $aProperties === false, - $additionalIsSchema = typeof $aProperties == 'object' && Object.keys($aProperties).length, - $removeAdditional = it.opts.removeAdditional, - $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional, - $ownProperties = it.opts.ownProperties, - $currentBaseId = it.baseId; - var $required = it.schema.required; - if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) { - var $requiredHash = it.util.toHash($required); - } - - function notProto(p) { - return p !== '__proto__'; - } - out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;'; - if ($ownProperties) { - out += ' var ' + ($dataProperties) + ' = undefined;'; - } - if ($checkAdditional) { - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - if ($someProperties) { - out += ' var isAdditional' + ($lvl) + ' = !(false '; - if ($schemaKeys.length) { - if ($schemaKeys.length > 8) { - out += ' || validate.schema' + ($schemaPath) + '.hasOwnProperty(' + ($key) + ') '; - } else { - var arr1 = $schemaKeys; - if (arr1) { - var $propertyKey, i1 = -1, - l1 = arr1.length - 1; - while (i1 < l1) { - $propertyKey = arr1[i1 += 1]; - out += ' || ' + ($key) + ' == ' + (it.util.toQuotedString($propertyKey)) + ' '; - } - } - } - } - if ($pPropertyKeys.length) { - var arr2 = $pPropertyKeys; - if (arr2) { - var $pProperty, $i = -1, - l2 = arr2.length - 1; - while ($i < l2) { - $pProperty = arr2[$i += 1]; - out += ' || ' + (it.usePattern($pProperty)) + '.test(' + ($key) + ') '; - } - } - } - out += ' ); if (isAdditional' + ($lvl) + ') { '; - } - if ($removeAdditional == 'all') { - out += ' delete ' + ($data) + '[' + ($key) + ']; '; - } else { - var $currentErrorPath = it.errorPath; - var $additionalProperty = '\' + ' + $key + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - } - if ($noAdditional) { - if ($removeAdditional) { - out += ' delete ' + ($data) + '[' + ($key) + ']; '; - } else { - out += ' ' + ($nextValid) + ' = false; '; - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + '/additionalProperties'; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('additionalProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \'' + ($additionalProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is an invalid additional property'; - } else { - out += 'should NOT have additional properties'; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - $errSchemaPath = $currErrSchemaPath; - if ($breakOnError) { - out += ' break; '; - } - } - } else if ($additionalIsSchema) { - if ($removeAdditional == 'failing') { - out += ' var ' + ($errs) + ' = errors; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.schema = $aProperties; - $it.schemaPath = it.schemaPath + '.additionalProperties'; - $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; - $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - out += ' if (!' + ($nextValid) + ') { errors = ' + ($errs) + '; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete ' + ($data) + '[' + ($key) + ']; } '; - it.compositeRule = $it.compositeRule = $wasComposite; - } else { - $it.schema = $aProperties; - $it.schemaPath = it.schemaPath + '.additionalProperties'; - $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; - $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - } - } - it.errorPath = $currentErrorPath; - } - if ($someProperties) { - out += ' } '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - var $useDefaults = it.opts.useDefaults && !it.compositeRule; - if ($schemaKeys.length) { - var arr3 = $schemaKeys; - if (arr3) { - var $propertyKey, i3 = -1, - l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $sch = $schema[$propertyKey]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - var $prop = it.util.getProperty($propertyKey), - $passData = $data + $prop, - $hasDefault = $useDefaults && $sch.default !== undefined; - $it.schema = $sch; - $it.schemaPath = $schemaPath + $prop; - $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey); - $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers); - $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey); - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - $code = it.util.varReplace($code, $nextData, $passData); - var $useData = $passData; - } else { - var $useData = $nextData; - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; '; - } - if ($hasDefault) { - out += ' ' + ($code) + ' '; - } else { - if ($requiredHash && $requiredHash[$propertyKey]) { - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { ' + ($nextValid) + ' = false; '; - var $currentErrorPath = it.errorPath, - $currErrSchemaPath = $errSchemaPath, - $missingProperty = it.util.escapeQuotes($propertyKey); - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - $errSchemaPath = it.errSchemaPath + '/required'; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - $errSchemaPath = $currErrSchemaPath; - it.errorPath = $currentErrorPath; - out += ' } else { '; - } else { - if ($breakOnError) { - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { ' + ($nextValid) + ' = true; } else { '; - } else { - out += ' if (' + ($useData) + ' !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ' ) { '; - } - } - out += ' ' + ($code) + ' } '; - } - } - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if ($pPropertyKeys.length) { - var arr4 = $pPropertyKeys; - if (arr4) { - var $pProperty, i4 = -1, - l4 = arr4.length - 1; - while (i4 < l4) { - $pProperty = arr4[i4 += 1]; - var $sch = $pProperties[$pProperty]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - $it.schema = $sch; - $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty); - $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty); - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - out += ' if (' + (it.usePattern($pProperty)) + '.test(' + ($key) + ')) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else ' + ($nextValid) + ' = true; '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/propertyNames.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/propertyNames.js deleted file mode 100644 index 2a54a08..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/propertyNames.js +++ /dev/null @@ -1,81 +0,0 @@ -'use strict'; -module.exports = function generate_propertyNames(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - out += 'var ' + ($errs) + ' = errors;'; - if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - var $key = 'key' + $lvl, - $idx = 'idx' + $lvl, - $i = 'i' + $lvl, - $invalidName = '\' + ' + $key + ' + \'', - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $dataProperties = 'dataProperties' + $lvl, - $ownProperties = it.opts.ownProperties, - $currentBaseId = it.baseId; - if ($ownProperties) { - out += ' var ' + ($dataProperties) + ' = undefined; '; - } - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - out += ' var startErrs' + ($lvl) + ' = errors; '; - var $passData = $key; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' if (!' + ($nextValid) + ') { for (var ' + ($i) + '=startErrs' + ($lvl) + '; ' + ($i) + ' 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) { - $required[$required.length] = $property; - } - } - } - } else { - var $required = $schema; - } - } - if ($isData || $required.length) { - var $currentErrorPath = it.errorPath, - $loopRequired = $isData || $required.length >= it.opts.loopRequired, - $ownProperties = it.opts.ownProperties; - if ($breakOnError) { - out += ' var missing' + ($lvl) + '; '; - if ($loopRequired) { - if (!$isData) { - out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; - } - var $i = 'i' + $lvl, - $propertyPath = 'schema' + $lvl + '[' + $i + ']', - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); - } - out += ' var ' + ($valid) + ' = true; '; - if ($isData) { - out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {'; - } - out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) '; - } - out += '; if (!' + ($valid) + ') break; } '; - if ($isData) { - out += ' } '; - } - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - } else { - out += ' if ( '; - var arr2 = $required; - if (arr2) { - var $propertyKey, $i = -1, - l2 = arr2.length - 1; - while ($i < l2) { - $propertyKey = arr2[$i += 1]; - if ($i) { - out += ' || '; - } - var $prop = it.util.getProperty($propertyKey), - $useData = $data + $prop; - out += ' ( ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) '; - } - } - out += ') { '; - var $propertyPath = 'missing' + $lvl, - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - } - } else { - if ($loopRequired) { - if (!$isData) { - out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; - } - var $i = 'i' + $lvl, - $propertyPath = 'schema' + $lvl + '[' + $i + ']', - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); - } - if ($isData) { - out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { '; - } - out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) '; - } - out += ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } '; - if ($isData) { - out += ' } '; - } - } else { - var arr3 = $required; - if (arr3) { - var $propertyKey, i3 = -1, - l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $prop = it.util.getProperty($propertyKey), - $missingProperty = it.util.escapeQuotes($propertyKey), - $useData = $data + $prop; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } '; - } - } - } - } - it.errorPath = $currentErrorPath; - } else if ($breakOnError) { - out += ' if (true) {'; - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/uniqueItems.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/uniqueItems.js deleted file mode 100644 index 0736a0e..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/uniqueItems.js +++ /dev/null @@ -1,86 +0,0 @@ -'use strict'; -module.exports = function generate_uniqueItems(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (($schema || $isData) && it.opts.uniqueItems !== false) { - if ($isData) { - out += ' var ' + ($valid) + '; if (' + ($schemaValue) + ' === false || ' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'boolean\') ' + ($valid) + ' = false; else { '; - } - out += ' var i = ' + ($data) + '.length , ' + ($valid) + ' = true , j; if (i > 1) { '; - var $itemType = it.schema.items && it.schema.items.type, - $typeIsArray = Array.isArray($itemType); - if (!$itemType || $itemType == 'object' || $itemType == 'array' || ($typeIsArray && ($itemType.indexOf('object') >= 0 || $itemType.indexOf('array') >= 0))) { - out += ' outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } '; - } else { - out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; '; - var $method = 'checkDataType' + ($typeIsArray ? 's' : ''); - out += ' if (' + (it.util[$method]($itemType, 'item', it.opts.strictNumbers, true)) + ') continue; '; - if ($typeIsArray) { - out += ' if (typeof item == \'string\') item = \'"\' + item; '; - } - out += ' if (typeof itemIndices[item] == \'number\') { ' + ($valid) + ' = false; j = itemIndices[item]; break; } itemIndices[item] = i; } '; - } - out += ' } '; - if ($isData) { - out += ' } '; - } - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('uniqueItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { i: i, j: j } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have duplicate items (items ## \' + j + \' and \' + i + \' are identical)\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - } else { - if ($breakOnError) { - out += ' if (true) { '; - } - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/validate.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/validate.js deleted file mode 100644 index f295824..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/dotjs/validate.js +++ /dev/null @@ -1,482 +0,0 @@ -'use strict'; -module.exports = function generate_validate(it, $keyword, $ruleType) { - var out = ''; - var $async = it.schema.$async === true, - $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref'), - $id = it.self._getId(it.schema); - if (it.opts.strictKeywords) { - var $unknownKwd = it.util.schemaUnknownRules(it.schema, it.RULES.keywords); - if ($unknownKwd) { - var $keywordsMsg = 'unknown keyword: ' + $unknownKwd; - if (it.opts.strictKeywords === 'log') it.logger.warn($keywordsMsg); - else throw new Error($keywordsMsg); - } - } - if (it.isTop) { - out += ' var validate = '; - if ($async) { - it.async = true; - out += 'async '; - } - out += 'function(data, dataPath, parentData, parentDataProperty, rootData) { \'use strict\'; '; - if ($id && (it.opts.sourceCode || it.opts.processCode)) { - out += ' ' + ('/\*# sourceURL=' + $id + ' */') + ' '; - } - } - if (typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref)) { - var $keyword = 'false schema'; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - if (it.schema === false) { - if (it.isTop) { - $breakOnError = true; - } else { - out += ' var ' + ($valid) + ' = false; '; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'false schema') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'boolean schema is false\' '; - } - if (it.opts.verbose) { - out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - } else { - if (it.isTop) { - if ($async) { - out += ' return data; '; - } else { - out += ' validate.errors = null; return true; '; - } - } else { - out += ' var ' + ($valid) + ' = true; '; - } - } - if (it.isTop) { - out += ' }; return validate; '; - } - return out; - } - if (it.isTop) { - var $top = it.isTop, - $lvl = it.level = 0, - $dataLvl = it.dataLevel = 0, - $data = 'data'; - it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema)); - it.baseId = it.baseId || it.rootId; - delete it.isTop; - it.dataPathArr = [""]; - if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) { - var $defaultMsg = 'default is ignored in the schema root'; - if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); - else throw new Error($defaultMsg); - } - out += ' var vErrors = null; '; - out += ' var errors = 0; '; - out += ' if (rootData === undefined) rootData = data; '; - } else { - var $lvl = it.level, - $dataLvl = it.dataLevel, - $data = 'data' + ($dataLvl || ''); - if ($id) it.baseId = it.resolve.url(it.baseId, $id); - if ($async && !it.async) throw new Error('async schema in sync schema'); - out += ' var errs_' + ($lvl) + ' = errors;'; - } - var $valid = 'valid' + $lvl, - $breakOnError = !it.opts.allErrors, - $closingBraces1 = '', - $closingBraces2 = ''; - var $errorKeyword; - var $typeSchema = it.schema.type, - $typeIsArray = Array.isArray($typeSchema); - if ($typeSchema && it.opts.nullable && it.schema.nullable === true) { - if ($typeIsArray) { - if ($typeSchema.indexOf('null') == -1) $typeSchema = $typeSchema.concat('null'); - } else if ($typeSchema != 'null') { - $typeSchema = [$typeSchema, 'null']; - $typeIsArray = true; - } - } - if ($typeIsArray && $typeSchema.length == 1) { - $typeSchema = $typeSchema[0]; - $typeIsArray = false; - } - if (it.schema.$ref && $refKeywords) { - if (it.opts.extendRefs == 'fail') { - throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); - } else if (it.opts.extendRefs !== true) { - $refKeywords = false; - it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"'); - } - } - if (it.schema.$comment && it.opts.$comment) { - out += ' ' + (it.RULES.all.$comment.code(it, '$comment')); - } - if ($typeSchema) { - if (it.opts.coerceTypes) { - var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); - } - var $rulesGroup = it.RULES.types[$typeSchema]; - if ($coerceToTypes || $typeIsArray || $rulesGroup === true || ($rulesGroup && !$shouldUseGroup($rulesGroup))) { - var $schemaPath = it.schemaPath + '.type', - $errSchemaPath = it.errSchemaPath + '/type'; - var $schemaPath = it.schemaPath + '.type', - $errSchemaPath = it.errSchemaPath + '/type', - $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType'; - out += ' if (' + (it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true)) + ') { '; - if ($coerceToTypes) { - var $dataType = 'dataType' + $lvl, - $coerced = 'coerced' + $lvl; - out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; var ' + ($coerced) + ' = undefined; '; - if (it.opts.coerceTypes == 'array') { - out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ') && ' + ($data) + '.length == 1) { ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; if (' + (it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)) + ') ' + ($coerced) + ' = ' + ($data) + '; } '; - } - out += ' if (' + ($coerced) + ' !== undefined) ; '; - var arr1 = $coerceToTypes; - if (arr1) { - var $type, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $type = arr1[$i += 1]; - if ($type == 'string') { - out += ' else if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; '; - } else if ($type == 'number' || $type == 'integer') { - out += ' else if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' '; - if ($type == 'integer') { - out += ' && !(' + ($data) + ' % 1)'; - } - out += ')) ' + ($coerced) + ' = +' + ($data) + '; '; - } else if ($type == 'boolean') { - out += ' else if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; '; - } else if ($type == 'null') { - out += ' else if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; '; - } else if (it.opts.coerceTypes == 'array' && $type == 'array') { - out += ' else if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; '; - } - } - } - out += ' else { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be '; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } if (' + ($coerced) + ' !== undefined) { '; - var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', - $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; - out += ' ' + ($data) + ' = ' + ($coerced) + '; '; - if (!$dataLvl) { - out += 'if (' + ($parentData) + ' !== undefined)'; - } - out += ' ' + ($parentData) + '[' + ($parentDataProperty) + '] = ' + ($coerced) + '; } '; - } else { - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be '; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - } - out += ' } '; - } - } - if (it.schema.$ref && !$refKeywords) { - out += ' ' + (it.RULES.all.$ref.code(it, '$ref')) + ' '; - if ($breakOnError) { - out += ' } if (errors === '; - if ($top) { - out += '0'; - } else { - out += 'errs_' + ($lvl); - } - out += ') { '; - $closingBraces2 += '}'; - } - } else { - var arr2 = it.RULES; - if (arr2) { - var $rulesGroup, i2 = -1, - l2 = arr2.length - 1; - while (i2 < l2) { - $rulesGroup = arr2[i2 += 1]; - if ($shouldUseGroup($rulesGroup)) { - if ($rulesGroup.type) { - out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers)) + ') { '; - } - if (it.opts.useDefaults) { - if ($rulesGroup.type == 'object' && it.schema.properties) { - var $schema = it.schema.properties, - $schemaKeys = Object.keys($schema); - var arr3 = $schemaKeys; - if (arr3) { - var $propertyKey, i3 = -1, - l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $sch = $schema[$propertyKey]; - if ($sch.default !== undefined) { - var $passData = $data + it.util.getProperty($propertyKey); - if (it.compositeRule) { - if (it.opts.strictDefaults) { - var $defaultMsg = 'default is ignored for: ' + $passData; - if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); - else throw new Error($defaultMsg); - } - } else { - out += ' if (' + ($passData) + ' === undefined '; - if (it.opts.useDefaults == 'empty') { - out += ' || ' + ($passData) + ' === null || ' + ($passData) + ' === \'\' '; - } - out += ' ) ' + ($passData) + ' = '; - if (it.opts.useDefaults == 'shared') { - out += ' ' + (it.useDefault($sch.default)) + ' '; - } else { - out += ' ' + (JSON.stringify($sch.default)) + ' '; - } - out += '; '; - } - } - } - } - } else if ($rulesGroup.type == 'array' && Array.isArray(it.schema.items)) { - var arr4 = it.schema.items; - if (arr4) { - var $sch, $i = -1, - l4 = arr4.length - 1; - while ($i < l4) { - $sch = arr4[$i += 1]; - if ($sch.default !== undefined) { - var $passData = $data + '[' + $i + ']'; - if (it.compositeRule) { - if (it.opts.strictDefaults) { - var $defaultMsg = 'default is ignored for: ' + $passData; - if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); - else throw new Error($defaultMsg); - } - } else { - out += ' if (' + ($passData) + ' === undefined '; - if (it.opts.useDefaults == 'empty') { - out += ' || ' + ($passData) + ' === null || ' + ($passData) + ' === \'\' '; - } - out += ' ) ' + ($passData) + ' = '; - if (it.opts.useDefaults == 'shared') { - out += ' ' + (it.useDefault($sch.default)) + ' '; - } else { - out += ' ' + (JSON.stringify($sch.default)) + ' '; - } - out += '; '; - } - } - } - } - } - } - var arr5 = $rulesGroup.rules; - if (arr5) { - var $rule, i5 = -1, - l5 = arr5.length - 1; - while (i5 < l5) { - $rule = arr5[i5 += 1]; - if ($shouldUseRule($rule)) { - var $code = $rule.code(it, $rule.keyword, $rulesGroup.type); - if ($code) { - out += ' ' + ($code) + ' '; - if ($breakOnError) { - $closingBraces1 += '}'; - } - } - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces1) + ' '; - $closingBraces1 = ''; - } - if ($rulesGroup.type) { - out += ' } '; - if ($typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes) { - out += ' else { '; - var $schemaPath = it.schemaPath + '.type', - $errSchemaPath = it.errSchemaPath + '/type'; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be '; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - } - } - if ($breakOnError) { - out += ' if (errors === '; - if ($top) { - out += '0'; - } else { - out += 'errs_' + ($lvl); - } - out += ') { '; - $closingBraces2 += '}'; - } - } - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces2) + ' '; - } - if ($top) { - if ($async) { - out += ' if (errors === 0) return data; '; - out += ' else throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; '; - out += ' return errors === 0; '; - } - out += ' }; return validate;'; - } else { - out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';'; - } - - function $shouldUseGroup($rulesGroup) { - var rules = $rulesGroup.rules; - for (var i = 0; i < rules.length; i++) - if ($shouldUseRule(rules[i])) return true; - } - - function $shouldUseRule($rule) { - return it.schema[$rule.keyword] !== undefined || ($rule.implements && $ruleImplementsSomeKeyword($rule)); - } - - function $ruleImplementsSomeKeyword($rule) { - var impl = $rule.implements; - for (var i = 0; i < impl.length; i++) - if (it.schema[impl[i]] !== undefined) return true; - } - return out; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/keyword.js b/node_modules/terser-webpack-plugin/node_modules/ajv/lib/keyword.js deleted file mode 100644 index 06da9a2..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/lib/keyword.js +++ /dev/null @@ -1,146 +0,0 @@ -'use strict'; - -var IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i; -var customRuleCode = require('./dotjs/custom'); -var definitionSchema = require('./definition_schema'); - -module.exports = { - add: addKeyword, - get: getKeyword, - remove: removeKeyword, - validate: validateKeyword -}; - - -/** - * Define custom keyword - * @this Ajv - * @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords). - * @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`. - * @return {Ajv} this for method chaining - */ -function addKeyword(keyword, definition) { - /* jshint validthis: true */ - /* eslint no-shadow: 0 */ - var RULES = this.RULES; - if (RULES.keywords[keyword]) - throw new Error('Keyword ' + keyword + ' is already defined'); - - if (!IDENTIFIER.test(keyword)) - throw new Error('Keyword ' + keyword + ' is not a valid identifier'); - - if (definition) { - this.validateKeyword(definition, true); - - var dataType = definition.type; - if (Array.isArray(dataType)) { - for (var i=0; i ../ajv-dist/bower.json - cd ../ajv-dist - - if [[ `git status --porcelain` ]]; then - echo "Changes detected. Updating master branch..." - git add -A - git commit -m "updated by travis build #$TRAVIS_BUILD_NUMBER" - git push --quiet origin master > /dev/null 2>&1 - fi - - echo "Publishing tag..." - - git tag $TRAVIS_TAG - git push --tags > /dev/null 2>&1 - - echo "Done" -fi diff --git a/node_modules/terser-webpack-plugin/node_modules/ajv/scripts/travis-gh-pages b/node_modules/terser-webpack-plugin/node_modules/ajv/scripts/travis-gh-pages deleted file mode 100644 index b3d4f3d..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/ajv/scripts/travis-gh-pages +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -set -e - -if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" && $TRAVIS_JOB_NUMBER =~ ".3" ]]; then - git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qE '\.md$|^LICENSE$|travis-gh-pages$' && { - rm -rf ../gh-pages - git clone -b gh-pages --single-branch https://${GITHUB_TOKEN}@github.com/ajv-validator/ajv.git ../gh-pages - mkdir -p ../gh-pages/_source - cp *.md ../gh-pages/_source - cp LICENSE ../gh-pages/_source - currentDir=$(pwd) - cd ../gh-pages - $currentDir/node_modules/.bin/gh-pages-generator - # remove logo from README - sed -i -E "s/]+ajv_logo[^>]+>//" index.md - git config user.email "$GIT_USER_EMAIL" - git config user.name "$GIT_USER_NAME" - git add . - git commit -am "updated by travis build #$TRAVIS_BUILD_NUMBER" - git push --quiet origin gh-pages > /dev/null 2>&1 - } -fi diff --git a/node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/.eslintrc.yml b/node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/.eslintrc.yml deleted file mode 100644 index ab1762d..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/.eslintrc.yml +++ /dev/null @@ -1,27 +0,0 @@ -extends: eslint:recommended -env: - node: true - browser: true -rules: - block-scoped-var: 2 - complexity: [2, 13] - curly: [2, multi-or-nest, consistent] - dot-location: [2, property] - dot-notation: 2 - indent: [2, 2, SwitchCase: 1] - linebreak-style: [2, unix] - new-cap: 2 - no-console: [2, allow: [warn, error]] - no-else-return: 2 - no-eq-null: 2 - no-fallthrough: 2 - no-invalid-this: 2 - no-return-assign: 2 - no-shadow: 1 - no-trailing-spaces: 2 - no-use-before-define: [2, nofunc] - quotes: [2, single, avoid-escape] - semi: [2, always] - strict: [2, global] - valid-jsdoc: [2, requireReturn: false] - no-control-regex: 0 diff --git a/node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/.travis.yml b/node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/.travis.yml deleted file mode 100644 index 7ddce74..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -node_js: - - "4" - - "6" - - "7" - - "8" -after_script: - - coveralls < coverage/lcov.info diff --git a/node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/LICENSE b/node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/LICENSE deleted file mode 100644 index 7f15435..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Evgeny Poberezkin - -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/node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/README.md b/node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/README.md deleted file mode 100644 index d5ccaf4..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# json-schema-traverse -Traverse JSON Schema passing each schema object to callback - -[![Build Status](https://travis-ci.org/epoberezkin/json-schema-traverse.svg?branch=master)](https://travis-ci.org/epoberezkin/json-schema-traverse) -[![npm version](https://badge.fury.io/js/json-schema-traverse.svg)](https://www.npmjs.com/package/json-schema-traverse) -[![Coverage Status](https://coveralls.io/repos/github/epoberezkin/json-schema-traverse/badge.svg?branch=master)](https://coveralls.io/github/epoberezkin/json-schema-traverse?branch=master) - - -## Install - -``` -npm install json-schema-traverse -``` - - -## Usage - -```javascript -const traverse = require('json-schema-traverse'); -const schema = { - properties: { - foo: {type: 'string'}, - bar: {type: 'integer'} - } -}; - -traverse(schema, {cb}); -// cb is called 3 times with: -// 1. root schema -// 2. {type: 'string'} -// 3. {type: 'integer'} - -// Or: - -traverse(schema, {cb: {pre, post}}); -// pre is called 3 times with: -// 1. root schema -// 2. {type: 'string'} -// 3. {type: 'integer'} -// -// post is called 3 times with: -// 1. {type: 'string'} -// 2. {type: 'integer'} -// 3. root schema - -``` - -Callback function `cb` is called for each schema object (not including draft-06 boolean schemas), including the root schema, in pre-order traversal. Schema references ($ref) are not resolved, they are passed as is. Alternatively, you can pass a `{pre, post}` object as `cb`, and then `pre` will be called before traversing child elements, and `post` will be called after all child elements have been traversed. - -Callback is passed these parameters: - -- _schema_: the current schema object -- _JSON pointer_: from the root schema to the current schema object -- _root schema_: the schema passed to `traverse` object -- _parent JSON pointer_: from the root schema to the parent schema object (see below) -- _parent keyword_: the keyword inside which this schema appears (e.g. `properties`, `anyOf`, etc.) -- _parent schema_: not necessarily parent object/array; in the example above the parent schema for `{type: 'string'}` is the root schema -- _index/property_: index or property name in the array/object containing multiple schemas; in the example above for `{type: 'string'}` the property name is `'foo'` - - -## Traverse objects in all unknown keywords - -```javascript -const traverse = require('json-schema-traverse'); -const schema = { - mySchema: { - minimum: 1, - maximum: 2 - } -}; - -traverse(schema, {allKeys: true, cb}); -// cb is called 2 times with: -// 1. root schema -// 2. mySchema -``` - -Without option `allKeys: true` callback will be called only with root schema. - - -## License - -[MIT](https://github.com/epoberezkin/json-schema-traverse/blob/master/LICENSE) diff --git a/node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/index.js b/node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/index.js deleted file mode 100644 index d4a18df..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/json-schema-traverse/index.js +++ /dev/null @@ -1,89 +0,0 @@ -'use strict'; - -var traverse = module.exports = function (schema, opts, cb) { - // Legacy support for v0.3.1 and earlier. - if (typeof opts == 'function') { - cb = opts; - opts = {}; - } - - cb = opts.cb || cb; - var pre = (typeof cb == 'function') ? cb : cb.pre || function() {}; - var post = cb.post || function() {}; - - _traverse(opts, pre, post, schema, '', schema); -}; - - -traverse.keywords = { - additionalItems: true, - items: true, - contains: true, - additionalProperties: true, - propertyNames: true, - not: true -}; - -traverse.arrayKeywords = { - items: true, - allOf: true, - anyOf: true, - oneOf: true -}; - -traverse.propsKeywords = { - definitions: true, - properties: true, - patternProperties: true, - dependencies: true -}; - -traverse.skipKeywords = { - default: true, - enum: true, - const: true, - required: true, - maximum: true, - minimum: true, - exclusiveMaximum: true, - exclusiveMinimum: true, - multipleOf: true, - maxLength: true, - minLength: true, - pattern: true, - format: true, - maxItems: true, - minItems: true, - uniqueItems: true, - maxProperties: true, - minProperties: true -}; - - -function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { - if (schema && typeof schema == 'object' && !Array.isArray(schema)) { - pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex); - for (var key in schema) { - var sch = schema[key]; - if (Array.isArray(sch)) { - if (key in traverse.arrayKeywords) { - for (var i=0; i -# [1.0.0](https://github.com/webpack-contrib/schema-utils/compare/v0.4.7...v1.0.0) (2018-08-07) - - -### Features - -* **src:** add support for custom error messages ([#33](https://github.com/webpack-contrib/schema-utils/issues/33)) ([1cbe4ef](https://github.com/webpack-contrib/schema-utils/commit/1cbe4ef)) - - - - -## [0.4.7](https://github.com/webpack-contrib/schema-utils/compare/v0.4.6...v0.4.7) (2018-08-07) - - -### Bug Fixes - -* **src:** `node >= v4.0.0` support ([#32](https://github.com/webpack-contrib/schema-utils/issues/32)) ([cb13dd4](https://github.com/webpack-contrib/schema-utils/commit/cb13dd4)) - - - - -## [0.4.6](https://github.com/webpack-contrib/schema-utils/compare/v0.4.5...v0.4.6) (2018-08-06) - - -### Bug Fixes - -* **package:** remove lockfile ([#28](https://github.com/webpack-contrib/schema-utils/issues/28)) ([69f1a81](https://github.com/webpack-contrib/schema-utils/commit/69f1a81)) -* **package:** remove unnecessary `webpack` dependency ([#26](https://github.com/webpack-contrib/schema-utils/issues/26)) ([532eaa5](https://github.com/webpack-contrib/schema-utils/commit/532eaa5)) - - - - -## [0.4.5](https://github.com/webpack-contrib/schema-utils/compare/v0.4.4...v0.4.5) (2018-02-13) - - -### Bug Fixes - -* **CHANGELOG:** update broken links ([4483b9f](https://github.com/webpack-contrib/schema-utils/commit/4483b9f)) -* **package:** update broken links ([f2494ba](https://github.com/webpack-contrib/schema-utils/commit/f2494ba)) - - - - -## [0.4.4](https://github.com/webpack-contrib/schema-utils/compare/v0.4.3...v0.4.4) (2018-02-13) - - -### Bug Fixes - -* **package:** update `dependencies` ([#22](https://github.com/webpack-contrib/schema-utils/issues/22)) ([3aecac6](https://github.com/webpack-contrib/schema-utils/commit/3aecac6)) - - - - -## [0.4.3](https://github.com/webpack-contrib/schema-utils/compare/v0.4.2...v0.4.3) (2017-12-14) - - -### Bug Fixes - -* **validateOptions:** throw `err` instead of `process.exit(1)` ([#17](https://github.com/webpack-contrib/schema-utils/issues/17)) ([c595eda](https://github.com/webpack-contrib/schema-utils/commit/c595eda)) -* **ValidationError:** never return `this` in the ctor ([#16](https://github.com/webpack-contrib/schema-utils/issues/16)) ([c723791](https://github.com/webpack-contrib/schema-utils/commit/c723791)) - - - - -## [0.4.2](https://github.com/webpack-contrib/schema-utils/compare/v0.4.1...v0.4.2) (2017-11-09) - - -### Bug Fixes - -* **validateOptions:** catch `ValidationError` and handle it internally ([#15](https://github.com/webpack-contrib/schema-utils/issues/15)) ([9c5ef5e](https://github.com/webpack-contrib/schema-utils/commit/9c5ef5e)) - - - - -## [0.4.1](https://github.com/webpack-contrib/schema-utils/compare/v0.4.0...v0.4.1) (2017-11-03) - - -### Bug Fixes - -* **ValidationError:** use `Error.captureStackTrace` for `err.stack` handling ([#14](https://github.com/webpack-contrib/schema-utils/issues/14)) ([a6fb974](https://github.com/webpack-contrib/schema-utils/commit/a6fb974)) - - - - -# [0.4.0](https://github.com/webpack-contrib/schema-utils/compare/v0.3.0...v0.4.0) (2017-10-28) - - -### Features - -* add support for `typeof`, `instanceof` (`{Function\|RegExp}`) ([#10](https://github.com/webpack-contrib/schema-utils/issues/10)) ([9f01816](https://github.com/webpack-contrib/schema-utils/commit/9f01816)) - - - - -# [0.3.0](https://github.com/webpack-contrib/schema-utils/compare/v0.2.1...v0.3.0) (2017-04-29) - - -### Features - -* add ValidationError ([#8](https://github.com/webpack-contrib/schema-utils/issues/8)) ([d48f0fb](https://github.com/webpack-contrib/schema-utils/commit/d48f0fb)) - - - - -## [0.2.1](https://github.com/webpack-contrib/schema-utils/compare/v0.2.0...v0.2.1) (2017-03-13) - - -### Bug Fixes - -* Include .babelrc to `files` ([28f0363](https://github.com/webpack-contrib/schema-utils/commit/28f0363)) -* Include source to `files` ([43b0f2f](https://github.com/webpack-contrib/schema-utils/commit/43b0f2f)) - - - - -# [0.2.0](https://github.com/webpack-contrib/schema-utils/compare/v0.1.0...v0.2.0) (2017-03-12) - - -# 0.1.0 (2017-03-07) - - -### Features - -* **validations:** add validateOptions module ([ae9b47b](https://github.com/webpack-contrib/schema-utils/commit/ae9b47b)) - - - -# Change Log - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. diff --git a/node_modules/terser-webpack-plugin/node_modules/schema-utils/LICENSE b/node_modules/terser-webpack-plugin/node_modules/schema-utils/LICENSE deleted file mode 100644 index 8c11fc7..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/schema-utils/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright JS Foundation and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/terser-webpack-plugin/node_modules/schema-utils/README.md b/node_modules/terser-webpack-plugin/node_modules/schema-utils/README.md deleted file mode 100644 index b56ab02..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/schema-utils/README.md +++ /dev/null @@ -1,290 +0,0 @@ - - -[![npm][npm]][npm-url] -[![node][node]][node-url] -[![deps][deps]][deps-url] -[![tests][tests]][tests-url] -[![coverage][cover]][cover-url] -[![chat][chat]][chat-url] -[![size][size]][size-url] - -# schema-utils - -Package for validate options in loaders and plugins. - -## Getting Started - -To begin, you'll need to install `schema-utils`: - -```console -npm install schema-utils -``` - -## API - -**schema.json** - -```json -{ - "type": "object", - "properties": { - "option": { - "type": "boolean" - } - }, - "additionalProperties": false -} -``` - -```js -import schema from "./path/to/schema.json"; -import { validate } from "schema-utils"; - -const options = { option: true }; -const configuration = { name: "Loader Name/Plugin Name/Name" }; - -validate(schema, options, configuration); -``` - -### `schema` - -Type: `String` - -JSON schema. - -Simple example of schema: - -```json -{ - "type": "object", - "properties": { - "name": { - "description": "This is description of option.", - "type": "string" - } - }, - "additionalProperties": false -} -``` - -### `options` - -Type: `Object` - -Object with options. - -```js -import schema from "./path/to/schema.json"; -import { validate } from "schema-utils"; - -const options = { foo: "bar" }; - -validate(schema, { name: 123 }, { name: "MyPlugin" }); -``` - -### `configuration` - -Allow to configure validator. - -There is an alternative method to configure the `name` and`baseDataPath` options via the `title` property in the schema. -For example: - -```json -{ - "title": "My Loader options", - "type": "object", - "properties": { - "name": { - "description": "This is description of option.", - "type": "string" - } - }, - "additionalProperties": false -} -``` - -The last word used for the `baseDataPath` option, other words used for the `name` option. -Based on the example above the `name` option equals `My Loader`, the `baseDataPath` option equals `options`. - -#### `name` - -Type: `Object` -Default: `"Object"` - -Allow to setup name in validation errors. - -```js -import schema from "./path/to/schema.json"; -import { validate } from "schema-utils"; - -const options = { foo: "bar" }; - -validate(schema, options, { name: "MyPlugin" }); -``` - -```shell -Invalid configuration object. MyPlugin has been initialised using a configuration object that does not match the API schema. - - configuration.optionName should be a integer. -``` - -#### `baseDataPath` - -Type: `String` -Default: `"configuration"` - -Allow to setup base data path in validation errors. - -```js -import schema from "./path/to/schema.json"; -import { validate } from "schema-utils"; - -const options = { foo: "bar" }; - -validate(schema, options, { name: "MyPlugin", baseDataPath: "options" }); -``` - -```shell -Invalid options object. MyPlugin has been initialised using an options object that does not match the API schema. - - options.optionName should be a integer. -``` - -#### `postFormatter` - -Type: `Function` -Default: `undefined` - -Allow to reformat errors. - -```js -import schema from "./path/to/schema.json"; -import { validate } from "schema-utils"; - -const options = { foo: "bar" }; - -validate(schema, options, { - name: "MyPlugin", - postFormatter: (formattedError, error) => { - if (error.keyword === "type") { - return `${formattedError}\nAdditional Information.`; - } - - return formattedError; - }, -}); -``` - -```shell -Invalid options object. MyPlugin has been initialized using an options object that does not match the API schema. - - options.optionName should be a integer. - Additional Information. -``` - -## Examples - -**schema.json** - -```json -{ - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "test": { - "anyOf": [ - { "type": "array" }, - { "type": "string" }, - { "instanceof": "RegExp" } - ] - }, - "transform": { - "instanceof": "Function" - }, - "sourceMap": { - "type": "boolean" - } - }, - "additionalProperties": false -} -``` - -### `Loader` - -```js -import { getOptions } from "loader-utils"; -import { validate } from "schema-utils"; - -import schema from "path/to/schema.json"; - -function loader(src, map) { - const options = getOptions(this); - - validate(schema, options, { - name: "Loader Name", - baseDataPath: "options", - }); - - // Code... -} - -export default loader; -``` - -### `Plugin` - -```js -import { validate } from "schema-utils"; - -import schema from "path/to/schema.json"; - -class Plugin { - constructor(options) { - validate(schema, options, { - name: "Plugin Name", - baseDataPath: "options", - }); - - this.options = options; - } - - apply(compiler) { - // Code... - } -} - -export default Plugin; -``` - -## Contributing - -Please take a moment to read our contributing guidelines if you haven't yet done so. - -[CONTRIBUTING](./.github/CONTRIBUTING.md) - -## License - -[MIT](./LICENSE) - -[npm]: https://img.shields.io/npm/v/schema-utils.svg -[npm-url]: https://npmjs.com/package/schema-utils -[node]: https://img.shields.io/node/v/schema-utils.svg -[node-url]: https://nodejs.org -[deps]: https://david-dm.org/webpack/schema-utils.svg -[deps-url]: https://david-dm.org/webpack/schema-utils -[tests]: https://github.com/webpack/schema-utils/workflows/schema-utils/badge.svg -[tests-url]: https://github.com/webpack/schema-utils/actions -[cover]: https://codecov.io/gh/webpack/schema-utils/branch/master/graph/badge.svg -[cover-url]: https://codecov.io/gh/webpack/schema-utils -[chat]: https://badges.gitter.im/webpack/webpack.svg -[chat-url]: https://gitter.im/webpack/webpack -[size]: https://packagephobia.com/badge?p=schema-utils -[size-url]: https://packagephobia.com/result?p=schema-utils diff --git a/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/ValidationError.d.ts b/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/ValidationError.d.ts deleted file mode 100644 index 55a8a9a..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/ValidationError.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -export default ValidationError; -export type JSONSchema6 = import("json-schema").JSONSchema6; -export type JSONSchema7 = import("json-schema").JSONSchema7; -export type Schema = import("./validate").Schema; -export type ValidationErrorConfiguration = - import("./validate").ValidationErrorConfiguration; -export type PostFormatter = import("./validate").PostFormatter; -export type SchemaUtilErrorObject = import("./validate").SchemaUtilErrorObject; -declare class ValidationError extends Error { - /** - * @param {Array} errors - * @param {Schema} schema - * @param {ValidationErrorConfiguration} configuration - */ - constructor( - errors: Array, - schema: Schema, - configuration?: ValidationErrorConfiguration - ); - /** @type {Array} */ - errors: Array; - /** @type {Schema} */ - schema: Schema; - /** @type {string} */ - headerName: string; - /** @type {string} */ - baseDataPath: string; - /** @type {PostFormatter | null} */ - postFormatter: PostFormatter | null; - /** - * @param {string} path - * @returns {Schema} - */ - getSchemaPart(path: string): Schema; - /** - * @param {Schema} schema - * @param {boolean} logic - * @param {Array} prevSchemas - * @returns {string} - */ - formatSchema( - schema: Schema, - logic?: boolean, - prevSchemas?: Array - ): string; - /** - * @param {Schema=} schemaPart - * @param {(boolean | Array)=} additionalPath - * @param {boolean=} needDot - * @param {boolean=} logic - * @returns {string} - */ - getSchemaPartText( - schemaPart?: Schema | undefined, - additionalPath?: (boolean | Array) | undefined, - needDot?: boolean | undefined, - logic?: boolean | undefined - ): string; - /** - * @param {Schema=} schemaPart - * @returns {string} - */ - getSchemaPartDescription(schemaPart?: Schema | undefined): string; - /** - * @param {SchemaUtilErrorObject} error - * @returns {string} - */ - formatValidationError(error: SchemaUtilErrorObject): string; - /** - * @param {Array} errors - * @returns {string} - */ - formatValidationErrors(errors: Array): string; -} diff --git a/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/index.d.ts b/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/index.d.ts deleted file mode 100644 index def01ba..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { validate } from "./validate"; -import { ValidationError } from "./validate"; -import { enableValidation } from "./validate"; -import { disableValidation } from "./validate"; -import { needValidate } from "./validate"; -export { - validate, - ValidationError, - enableValidation, - disableValidation, - needValidate, -}; diff --git a/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts b/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts deleted file mode 100644 index 0d16689..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export default addAbsolutePathKeyword; -export type Ajv = import("ajv").Ajv; -export type ValidateFunction = import("ajv").ValidateFunction; -export type SchemaUtilErrorObject = import("../validate").SchemaUtilErrorObject; -/** - * - * @param {Ajv} ajv - * @returns {Ajv} - */ -declare function addAbsolutePathKeyword(ajv: Ajv): Ajv; diff --git a/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/keywords/undefinedAsNull.d.ts b/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/keywords/undefinedAsNull.d.ts deleted file mode 100644 index 3509652..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/keywords/undefinedAsNull.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export default addUndefinedAsNullKeyword; -export type Ajv = import("ajv").Ajv; -/** - * - * @param {Ajv} ajv - * @returns {Ajv} - */ -declare function addUndefinedAsNullKeyword(ajv: Ajv): Ajv; diff --git a/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/util/Range.d.ts b/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/util/Range.d.ts deleted file mode 100644 index 2ba97fc..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/util/Range.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -export = Range; -/** - * @typedef {[number, boolean]} RangeValue - */ -/** - * @callback RangeValueCallback - * @param {RangeValue} rangeValue - * @returns {boolean} - */ -declare class Range { - /** - * @param {"left" | "right"} side - * @param {boolean} exclusive - * @returns {">" | ">=" | "<" | "<="} - */ - static getOperator( - side: "left" | "right", - exclusive: boolean - ): ">" | ">=" | "<" | "<="; - /** - * @param {number} value - * @param {boolean} logic is not logic applied - * @param {boolean} exclusive is range exclusive - * @returns {string} - */ - static formatRight(value: number, logic: boolean, exclusive: boolean): string; - /** - * @param {number} value - * @param {boolean} logic is not logic applied - * @param {boolean} exclusive is range exclusive - * @returns {string} - */ - static formatLeft(value: number, logic: boolean, exclusive: boolean): string; - /** - * @param {number} start left side value - * @param {number} end right side value - * @param {boolean} startExclusive is range exclusive from left side - * @param {boolean} endExclusive is range exclusive from right side - * @param {boolean} logic is not logic applied - * @returns {string} - */ - static formatRange( - start: number, - end: number, - startExclusive: boolean, - endExclusive: boolean, - logic: boolean - ): string; - /** - * @param {Array} values - * @param {boolean} logic is not logic applied - * @return {RangeValue} computed value and it's exclusive flag - */ - static getRangeValue(values: Array, logic: boolean): RangeValue; - /** @type {Array} */ - _left: Array; - /** @type {Array} */ - _right: Array; - /** - * @param {number} value - * @param {boolean=} exclusive - */ - left(value: number, exclusive?: boolean | undefined): void; - /** - * @param {number} value - * @param {boolean=} exclusive - */ - right(value: number, exclusive?: boolean | undefined): void; - /** - * @param {boolean} logic is not logic applied - * @return {string} "smart" range string representation - */ - format(logic?: boolean): string; -} -declare namespace Range { - export { RangeValue, RangeValueCallback }; -} -type RangeValue = [number, boolean]; -type RangeValueCallback = (rangeValue: RangeValue) => boolean; diff --git a/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/util/hints.d.ts b/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/util/hints.d.ts deleted file mode 100644 index e43e32a..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/util/hints.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function stringHints(schema: Schema, logic: boolean): string[]; -export function numberHints(schema: Schema, logic: boolean): string[]; -export type Schema = import("../validate").Schema; diff --git a/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/validate.d.ts b/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/validate.d.ts deleted file mode 100644 index 7f1c87f..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/schema-utils/declarations/validate.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -export type JSONSchema4 = import("json-schema").JSONSchema4; -export type JSONSchema6 = import("json-schema").JSONSchema6; -export type JSONSchema7 = import("json-schema").JSONSchema7; -export type ErrorObject = import("ajv").ErrorObject; -export type ValidateFunction = import("ajv").ValidateFunction; -export type Extend = { - formatMinimum?: number | undefined; - formatMaximum?: number | undefined; - formatExclusiveMinimum?: boolean | undefined; - formatExclusiveMaximum?: boolean | undefined; - link?: string | undefined; - undefinedAsNull?: boolean | undefined; -}; -export type Schema = (JSONSchema4 | JSONSchema6 | JSONSchema7) & Extend; -export type SchemaUtilErrorObject = ErrorObject & { - children?: Array; -}; -export type PostFormatter = ( - formattedError: string, - error: SchemaUtilErrorObject -) => string; -export type ValidationErrorConfiguration = { - name?: string | undefined; - baseDataPath?: string | undefined; - postFormatter?: PostFormatter | undefined; -}; -/** - * @param {Schema} schema - * @param {Array | object} options - * @param {ValidationErrorConfiguration=} configuration - * @returns {void} - */ -export function validate( - schema: Schema, - options: Array | object, - configuration?: ValidationErrorConfiguration | undefined -): void; -export function enableValidation(): void; -export function disableValidation(): void; -export function needValidate(): boolean; -import ValidationError from "./ValidationError"; -export { ValidationError }; diff --git a/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/ValidationError.js b/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/ValidationError.js deleted file mode 100644 index bd4086f..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/ValidationError.js +++ /dev/null @@ -1,1277 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -const { - stringHints, - numberHints -} = require("./util/hints"); -/** @typedef {import("json-schema").JSONSchema6} JSONSchema6 */ - -/** @typedef {import("json-schema").JSONSchema7} JSONSchema7 */ - -/** @typedef {import("./validate").Schema} Schema */ - -/** @typedef {import("./validate").ValidationErrorConfiguration} ValidationErrorConfiguration */ - -/** @typedef {import("./validate").PostFormatter} PostFormatter */ - -/** @typedef {import("./validate").SchemaUtilErrorObject} SchemaUtilErrorObject */ - -/** @enum {number} */ - - -const SPECIFICITY = { - type: 1, - not: 1, - oneOf: 1, - anyOf: 1, - if: 1, - enum: 1, - const: 1, - instanceof: 1, - required: 2, - pattern: 2, - patternRequired: 2, - format: 2, - formatMinimum: 2, - formatMaximum: 2, - minimum: 2, - exclusiveMinimum: 2, - maximum: 2, - exclusiveMaximum: 2, - multipleOf: 2, - uniqueItems: 2, - contains: 2, - minLength: 2, - maxLength: 2, - minItems: 2, - maxItems: 2, - minProperties: 2, - maxProperties: 2, - dependencies: 2, - propertyNames: 2, - additionalItems: 2, - additionalProperties: 2, - absolutePath: 2 -}; -/** - * - * @param {Array} array - * @param {(item: SchemaUtilErrorObject) => number} fn - * @returns {Array} - */ - -function filterMax(array, fn) { - const evaluatedMax = array.reduce((max, item) => Math.max(max, fn(item)), 0); - return array.filter(item => fn(item) === evaluatedMax); -} -/** - * - * @param {Array} children - * @returns {Array} - */ - - -function filterChildren(children) { - let newChildren = children; - newChildren = filterMax(newChildren, - /** - * - * @param {SchemaUtilErrorObject} error - * @returns {number} - */ - error => error.dataPath ? error.dataPath.length : 0); - newChildren = filterMax(newChildren, - /** - * @param {SchemaUtilErrorObject} error - * @returns {number} - */ - error => SPECIFICITY[ - /** @type {keyof typeof SPECIFICITY} */ - error.keyword] || 2); - return newChildren; -} -/** - * Find all children errors - * @param {Array} children - * @param {Array} schemaPaths - * @return {number} returns index of first child - */ - - -function findAllChildren(children, schemaPaths) { - let i = children.length - 1; - - const predicate = - /** - * @param {string} schemaPath - * @returns {boolean} - */ - schemaPath => children[i].schemaPath.indexOf(schemaPath) !== 0; - - while (i > -1 && !schemaPaths.every(predicate)) { - if (children[i].keyword === "anyOf" || children[i].keyword === "oneOf") { - const refs = extractRefs(children[i]); - const childrenStart = findAllChildren(children.slice(0, i), refs.concat(children[i].schemaPath)); - i = childrenStart - 1; - } else { - i -= 1; - } - } - - return i + 1; -} -/** - * Extracts all refs from schema - * @param {SchemaUtilErrorObject} error - * @return {Array} - */ - - -function extractRefs(error) { - const { - schema - } = error; - - if (!Array.isArray(schema)) { - return []; - } - - return schema.map(({ - $ref - }) => $ref).filter(s => s); -} -/** - * Groups children by their first level parent (assuming that error is root) - * @param {Array} children - * @return {Array} - */ - - -function groupChildrenByFirstChild(children) { - const result = []; - let i = children.length - 1; - - while (i > 0) { - const child = children[i]; - - if (child.keyword === "anyOf" || child.keyword === "oneOf") { - const refs = extractRefs(child); - const childrenStart = findAllChildren(children.slice(0, i), refs.concat(child.schemaPath)); - - if (childrenStart !== i) { - result.push(Object.assign({}, child, { - children: children.slice(childrenStart, i) - })); - i = childrenStart; - } else { - result.push(child); - } - } else { - result.push(child); - } - - i -= 1; - } - - if (i === 0) { - result.push(children[i]); - } - - return result.reverse(); -} -/** - * @param {string} str - * @param {string} prefix - * @returns {string} - */ - - -function indent(str, prefix) { - return str.replace(/\n(?!$)/g, `\n${prefix}`); -} -/** - * @param {Schema} schema - * @returns {schema is (Schema & {not: Schema})} - */ - - -function hasNotInSchema(schema) { - return !!schema.not; -} -/** - * @param {Schema} schema - * @return {Schema} - */ - - -function findFirstTypedSchema(schema) { - if (hasNotInSchema(schema)) { - return findFirstTypedSchema(schema.not); - } - - return schema; -} -/** - * @param {Schema} schema - * @return {boolean} - */ - - -function canApplyNot(schema) { - const typedSchema = findFirstTypedSchema(schema); - return likeNumber(typedSchema) || likeInteger(typedSchema) || likeString(typedSchema) || likeNull(typedSchema) || likeBoolean(typedSchema); -} -/** - * @param {any} maybeObj - * @returns {boolean} - */ - - -function isObject(maybeObj) { - return typeof maybeObj === "object" && maybeObj !== null; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeNumber(schema) { - return schema.type === "number" || typeof schema.minimum !== "undefined" || typeof schema.exclusiveMinimum !== "undefined" || typeof schema.maximum !== "undefined" || typeof schema.exclusiveMaximum !== "undefined" || typeof schema.multipleOf !== "undefined"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeInteger(schema) { - return schema.type === "integer" || typeof schema.minimum !== "undefined" || typeof schema.exclusiveMinimum !== "undefined" || typeof schema.maximum !== "undefined" || typeof schema.exclusiveMaximum !== "undefined" || typeof schema.multipleOf !== "undefined"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeString(schema) { - return schema.type === "string" || typeof schema.minLength !== "undefined" || typeof schema.maxLength !== "undefined" || typeof schema.pattern !== "undefined" || typeof schema.format !== "undefined" || typeof schema.formatMinimum !== "undefined" || typeof schema.formatMaximum !== "undefined"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeBoolean(schema) { - return schema.type === "boolean"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeArray(schema) { - return schema.type === "array" || typeof schema.minItems === "number" || typeof schema.maxItems === "number" || typeof schema.uniqueItems !== "undefined" || typeof schema.items !== "undefined" || typeof schema.additionalItems !== "undefined" || typeof schema.contains !== "undefined"; -} -/** - * @param {Schema & {patternRequired?: Array}} schema - * @returns {boolean} - */ - - -function likeObject(schema) { - return schema.type === "object" || typeof schema.minProperties !== "undefined" || typeof schema.maxProperties !== "undefined" || typeof schema.required !== "undefined" || typeof schema.properties !== "undefined" || typeof schema.patternProperties !== "undefined" || typeof schema.additionalProperties !== "undefined" || typeof schema.dependencies !== "undefined" || typeof schema.propertyNames !== "undefined" || typeof schema.patternRequired !== "undefined"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeNull(schema) { - return schema.type === "null"; -} -/** - * @param {string} type - * @returns {string} - */ - - -function getArticle(type) { - if (/^[aeiou]/i.test(type)) { - return "an"; - } - - return "a"; -} -/** - * @param {Schema=} schema - * @returns {string} - */ - - -function getSchemaNonTypes(schema) { - if (!schema) { - return ""; - } - - if (!schema.type) { - if (likeNumber(schema) || likeInteger(schema)) { - return " | should be any non-number"; - } - - if (likeString(schema)) { - return " | should be any non-string"; - } - - if (likeArray(schema)) { - return " | should be any non-array"; - } - - if (likeObject(schema)) { - return " | should be any non-object"; - } - } - - return ""; -} -/** - * @param {Array} hints - * @returns {string} - */ - - -function formatHints(hints) { - return hints.length > 0 ? `(${hints.join(", ")})` : ""; -} -/** - * @param {Schema} schema - * @param {boolean} logic - * @returns {string[]} - */ - - -function getHints(schema, logic) { - if (likeNumber(schema) || likeInteger(schema)) { - return numberHints(schema, logic); - } else if (likeString(schema)) { - return stringHints(schema, logic); - } - - return []; -} - -class ValidationError extends Error { - /** - * @param {Array} errors - * @param {Schema} schema - * @param {ValidationErrorConfiguration} configuration - */ - constructor(errors, schema, configuration = {}) { - super(); - /** @type {string} */ - - this.name = "ValidationError"; - /** @type {Array} */ - - this.errors = errors; - /** @type {Schema} */ - - this.schema = schema; - let headerNameFromSchema; - let baseDataPathFromSchema; - - if (schema.title && (!configuration.name || !configuration.baseDataPath)) { - const splittedTitleFromSchema = schema.title.match(/^(.+) (.+)$/); - - if (splittedTitleFromSchema) { - if (!configuration.name) { - [, headerNameFromSchema] = splittedTitleFromSchema; - } - - if (!configuration.baseDataPath) { - [,, baseDataPathFromSchema] = splittedTitleFromSchema; - } - } - } - /** @type {string} */ - - - this.headerName = configuration.name || headerNameFromSchema || "Object"; - /** @type {string} */ - - this.baseDataPath = configuration.baseDataPath || baseDataPathFromSchema || "configuration"; - /** @type {PostFormatter | null} */ - - this.postFormatter = configuration.postFormatter || null; - const header = `Invalid ${this.baseDataPath} object. ${this.headerName} has been initialized using ${getArticle(this.baseDataPath)} ${this.baseDataPath} object that does not match the API schema.\n`; - /** @type {string} */ - - this.message = `${header}${this.formatValidationErrors(errors)}`; - Error.captureStackTrace(this, this.constructor); - } - /** - * @param {string} path - * @returns {Schema} - */ - - - getSchemaPart(path) { - const newPath = path.split("/"); - let schemaPart = this.schema; - - for (let i = 1; i < newPath.length; i++) { - const inner = schemaPart[ - /** @type {keyof Schema} */ - newPath[i]]; - - if (!inner) { - break; - } - - schemaPart = inner; - } - - return schemaPart; - } - /** - * @param {Schema} schema - * @param {boolean} logic - * @param {Array} prevSchemas - * @returns {string} - */ - - - formatSchema(schema, logic = true, prevSchemas = []) { - let newLogic = logic; - - const formatInnerSchema = - /** - * - * @param {Object} innerSchema - * @param {boolean=} addSelf - * @returns {string} - */ - (innerSchema, addSelf) => { - if (!addSelf) { - return this.formatSchema(innerSchema, newLogic, prevSchemas); - } - - if (prevSchemas.includes(innerSchema)) { - return "(recursive)"; - } - - return this.formatSchema(innerSchema, newLogic, prevSchemas.concat(schema)); - }; - - if (hasNotInSchema(schema) && !likeObject(schema)) { - if (canApplyNot(schema.not)) { - newLogic = !logic; - return formatInnerSchema(schema.not); - } - - const needApplyLogicHere = !schema.not.not; - const prefix = logic ? "" : "non "; - newLogic = !logic; - return needApplyLogicHere ? prefix + formatInnerSchema(schema.not) : formatInnerSchema(schema.not); - } - - if ( - /** @type {Schema & {instanceof: string | Array}} */ - schema.instanceof) { - const { - instanceof: value - } = - /** @type {Schema & {instanceof: string | Array}} */ - schema; - const values = !Array.isArray(value) ? [value] : value; - return values.map( - /** - * @param {string} item - * @returns {string} - */ - item => item === "Function" ? "function" : item).join(" | "); - } - - if (schema.enum) { - const enumValues = - /** @type {Array} */ - schema.enum.map(item => { - if (item === null && schema.undefinedAsNull) { - return `${JSON.stringify(item)} | undefined`; - } - - return JSON.stringify(item); - }).join(" | "); - return `${enumValues}`; - } - - if (typeof schema.const !== "undefined") { - return JSON.stringify(schema.const); - } - - if (schema.oneOf) { - return ( - /** @type {Array} */ - schema.oneOf.map(item => formatInnerSchema(item, true)).join(" | ") - ); - } - - if (schema.anyOf) { - return ( - /** @type {Array} */ - schema.anyOf.map(item => formatInnerSchema(item, true)).join(" | ") - ); - } - - if (schema.allOf) { - return ( - /** @type {Array} */ - schema.allOf.map(item => formatInnerSchema(item, true)).join(" & ") - ); - } - - if ( - /** @type {JSONSchema7} */ - schema.if) { - const { - if: ifValue, - then: thenValue, - else: elseValue - } = - /** @type {JSONSchema7} */ - schema; - return `${ifValue ? `if ${formatInnerSchema(ifValue)}` : ""}${thenValue ? ` then ${formatInnerSchema(thenValue)}` : ""}${elseValue ? ` else ${formatInnerSchema(elseValue)}` : ""}`; - } - - if (schema.$ref) { - return formatInnerSchema(this.getSchemaPart(schema.$ref), true); - } - - if (likeNumber(schema) || likeInteger(schema)) { - const [type, ...hints] = getHints(schema, logic); - const str = `${type}${hints.length > 0 ? ` ${formatHints(hints)}` : ""}`; - return logic ? str : hints.length > 0 ? `non-${type} | ${str}` : `non-${type}`; - } - - if (likeString(schema)) { - const [type, ...hints] = getHints(schema, logic); - const str = `${type}${hints.length > 0 ? ` ${formatHints(hints)}` : ""}`; - return logic ? str : str === "string" ? "non-string" : `non-string | ${str}`; - } - - if (likeBoolean(schema)) { - return `${logic ? "" : "non-"}boolean`; - } - - if (likeArray(schema)) { - // not logic already applied in formatValidationError - newLogic = true; - const hints = []; - - if (typeof schema.minItems === "number") { - hints.push(`should not have fewer than ${schema.minItems} item${schema.minItems > 1 ? "s" : ""}`); - } - - if (typeof schema.maxItems === "number") { - hints.push(`should not have more than ${schema.maxItems} item${schema.maxItems > 1 ? "s" : ""}`); - } - - if (schema.uniqueItems) { - hints.push("should not have duplicate items"); - } - - const hasAdditionalItems = typeof schema.additionalItems === "undefined" || Boolean(schema.additionalItems); - let items = ""; - - if (schema.items) { - if (Array.isArray(schema.items) && schema.items.length > 0) { - items = `${ - /** @type {Array} */ - schema.items.map(item => formatInnerSchema(item)).join(", ")}`; - - if (hasAdditionalItems) { - if (schema.additionalItems && isObject(schema.additionalItems) && Object.keys(schema.additionalItems).length > 0) { - hints.push(`additional items should be ${formatInnerSchema(schema.additionalItems)}`); - } - } - } else if (schema.items && Object.keys(schema.items).length > 0) { - // "additionalItems" is ignored - items = `${formatInnerSchema(schema.items)}`; - } else { - // Fallback for empty `items` value - items = "any"; - } - } else { - // "additionalItems" is ignored - items = "any"; - } - - if (schema.contains && Object.keys(schema.contains).length > 0) { - hints.push(`should contains at least one ${this.formatSchema(schema.contains)} item`); - } - - return `[${items}${hasAdditionalItems ? ", ..." : ""}]${hints.length > 0 ? ` (${hints.join(", ")})` : ""}`; - } - - if (likeObject(schema)) { - // not logic already applied in formatValidationError - newLogic = true; - const hints = []; - - if (typeof schema.minProperties === "number") { - hints.push(`should not have fewer than ${schema.minProperties} ${schema.minProperties > 1 ? "properties" : "property"}`); - } - - if (typeof schema.maxProperties === "number") { - hints.push(`should not have more than ${schema.maxProperties} ${schema.minProperties && schema.minProperties > 1 ? "properties" : "property"}`); - } - - if (schema.patternProperties && Object.keys(schema.patternProperties).length > 0) { - const patternProperties = Object.keys(schema.patternProperties); - hints.push(`additional property names should match pattern${patternProperties.length > 1 ? "s" : ""} ${patternProperties.map(pattern => JSON.stringify(pattern)).join(" | ")}`); - } - - const properties = schema.properties ? Object.keys(schema.properties) : []; - const required = schema.required ? schema.required : []; - const allProperties = [...new Set( - /** @type {Array} */ - [].concat(required).concat(properties))]; - const objectStructure = allProperties.map(property => { - const isRequired = required.includes(property); // Some properties need quotes, maybe we should add check - // Maybe we should output type of property (`foo: string`), but it is looks very unreadable - - return `${property}${isRequired ? "" : "?"}`; - }).concat(typeof schema.additionalProperties === "undefined" || Boolean(schema.additionalProperties) ? schema.additionalProperties && isObject(schema.additionalProperties) ? [`: ${formatInnerSchema(schema.additionalProperties)}`] : ["…"] : []).join(", "); - const { - dependencies, - propertyNames, - patternRequired - } = - /** @type {Schema & {patternRequired?: Array;}} */ - schema; - - if (dependencies) { - Object.keys(dependencies).forEach(dependencyName => { - const dependency = dependencies[dependencyName]; - - if (Array.isArray(dependency)) { - hints.push(`should have ${dependency.length > 1 ? "properties" : "property"} ${dependency.map(dep => `'${dep}'`).join(", ")} when property '${dependencyName}' is present`); - } else { - hints.push(`should be valid according to the schema ${formatInnerSchema(dependency)} when property '${dependencyName}' is present`); - } - }); - } - - if (propertyNames && Object.keys(propertyNames).length > 0) { - hints.push(`each property name should match format ${JSON.stringify(schema.propertyNames.format)}`); - } - - if (patternRequired && patternRequired.length > 0) { - hints.push(`should have property matching pattern ${patternRequired.map( - /** - * @param {string} item - * @returns {string} - */ - item => JSON.stringify(item))}`); - } - - return `object {${objectStructure ? ` ${objectStructure} ` : ""}}${hints.length > 0 ? ` (${hints.join(", ")})` : ""}`; - } - - if (likeNull(schema)) { - return `${logic ? "" : "non-"}null`; - } - - if (Array.isArray(schema.type)) { - // not logic already applied in formatValidationError - return `${schema.type.join(" | ")}`; - } // Fallback for unknown keywords - // not logic already applied in formatValidationError - - /* istanbul ignore next */ - - - return JSON.stringify(schema, null, 2); - } - /** - * @param {Schema=} schemaPart - * @param {(boolean | Array)=} additionalPath - * @param {boolean=} needDot - * @param {boolean=} logic - * @returns {string} - */ - - - getSchemaPartText(schemaPart, additionalPath, needDot = false, logic = true) { - if (!schemaPart) { - return ""; - } - - if (Array.isArray(additionalPath)) { - for (let i = 0; i < additionalPath.length; i++) { - /** @type {Schema | undefined} */ - const inner = schemaPart[ - /** @type {keyof Schema} */ - additionalPath[i]]; - - if (inner) { - // eslint-disable-next-line no-param-reassign - schemaPart = inner; - } else { - break; - } - } - } - - while (schemaPart.$ref) { - // eslint-disable-next-line no-param-reassign - schemaPart = this.getSchemaPart(schemaPart.$ref); - } - - let schemaText = `${this.formatSchema(schemaPart, logic)}${needDot ? "." : ""}`; - - if (schemaPart.description) { - schemaText += `\n-> ${schemaPart.description}`; - } - - if (schemaPart.link) { - schemaText += `\n-> Read more at ${schemaPart.link}`; - } - - return schemaText; - } - /** - * @param {Schema=} schemaPart - * @returns {string} - */ - - - getSchemaPartDescription(schemaPart) { - if (!schemaPart) { - return ""; - } - - while (schemaPart.$ref) { - // eslint-disable-next-line no-param-reassign - schemaPart = this.getSchemaPart(schemaPart.$ref); - } - - let schemaText = ""; - - if (schemaPart.description) { - schemaText += `\n-> ${schemaPart.description}`; - } - - if (schemaPart.link) { - schemaText += `\n-> Read more at ${schemaPart.link}`; - } - - return schemaText; - } - /** - * @param {SchemaUtilErrorObject} error - * @returns {string} - */ - - - formatValidationError(error) { - const { - keyword, - dataPath: errorDataPath - } = error; - const dataPath = `${this.baseDataPath}${errorDataPath}`; - - switch (keyword) { - case "type": - { - const { - parentSchema, - params - } = error; // eslint-disable-next-line default-case - - switch ( - /** @type {import("ajv").TypeParams} */ - params.type) { - case "number": - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - - case "integer": - return `${dataPath} should be an ${this.getSchemaPartText(parentSchema, false, true)}`; - - case "string": - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - - case "boolean": - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - - case "array": - return `${dataPath} should be an array:\n${this.getSchemaPartText(parentSchema)}`; - - case "object": - return `${dataPath} should be an object:\n${this.getSchemaPartText(parentSchema)}`; - - case "null": - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - - default: - return `${dataPath} should be:\n${this.getSchemaPartText(parentSchema)}`; - } - } - - case "instanceof": - { - const { - parentSchema - } = error; - return `${dataPath} should be an instance of ${this.getSchemaPartText(parentSchema, false, true)}`; - } - - case "pattern": - { - const { - params, - parentSchema - } = error; - const { - pattern - } = - /** @type {import("ajv").PatternParams} */ - params; - return `${dataPath} should match pattern ${JSON.stringify(pattern)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "format": - { - const { - params, - parentSchema - } = error; - const { - format - } = - /** @type {import("ajv").FormatParams} */ - params; - return `${dataPath} should match format ${JSON.stringify(format)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "formatMinimum": - case "formatMaximum": - { - const { - params, - parentSchema - } = error; - const { - comparison, - limit - } = - /** @type {import("ajv").ComparisonParams} */ - params; - return `${dataPath} should be ${comparison} ${JSON.stringify(limit)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "minimum": - case "maximum": - case "exclusiveMinimum": - case "exclusiveMaximum": - { - const { - parentSchema, - params - } = error; - const { - comparison, - limit - } = - /** @type {import("ajv").ComparisonParams} */ - params; - const [, ...hints] = getHints( - /** @type {Schema} */ - parentSchema, true); - - if (hints.length === 0) { - hints.push(`should be ${comparison} ${limit}`); - } - - return `${dataPath} ${hints.join(" ")}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "multipleOf": - { - const { - params, - parentSchema - } = error; - const { - multipleOf - } = - /** @type {import("ajv").MultipleOfParams} */ - params; - return `${dataPath} should be multiple of ${multipleOf}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "patternRequired": - { - const { - params, - parentSchema - } = error; - const { - missingPattern - } = - /** @type {import("ajv").PatternRequiredParams} */ - params; - return `${dataPath} should have property matching pattern ${JSON.stringify(missingPattern)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "minLength": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - - if (limit === 1) { - return `${dataPath} should be a non-empty string${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - const length = limit - 1; - return `${dataPath} should be longer than ${length} character${length > 1 ? "s" : ""}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "minItems": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - - if (limit === 1) { - return `${dataPath} should be a non-empty array${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - return `${dataPath} should not have fewer than ${limit} items${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "minProperties": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - - if (limit === 1) { - return `${dataPath} should be a non-empty object${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - return `${dataPath} should not have fewer than ${limit} properties${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "maxLength": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - const max = limit + 1; - return `${dataPath} should be shorter than ${max} character${max > 1 ? "s" : ""}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "maxItems": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - return `${dataPath} should not have more than ${limit} items${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "maxProperties": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - return `${dataPath} should not have more than ${limit} properties${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "uniqueItems": - { - const { - params, - parentSchema - } = error; - const { - i - } = - /** @type {import("ajv").UniqueItemsParams} */ - params; - return `${dataPath} should not contain the item '${error.data[i]}' twice${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "additionalItems": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - return `${dataPath} should not have more than ${limit} items${getSchemaNonTypes(parentSchema)}. These items are valid:\n${this.getSchemaPartText(parentSchema)}`; - } - - case "contains": - { - const { - parentSchema - } = error; - return `${dataPath} should contains at least one ${this.getSchemaPartText(parentSchema, ["contains"])} item${getSchemaNonTypes(parentSchema)}.`; - } - - case "required": - { - const { - parentSchema, - params - } = error; - const missingProperty = - /** @type {import("ajv").DependenciesParams} */ - params.missingProperty.replace(/^\./, ""); - const hasProperty = parentSchema && Boolean( - /** @type {Schema} */ - parentSchema.properties && - /** @type {Schema} */ - parentSchema.properties[missingProperty]); - return `${dataPath} misses the property '${missingProperty}'${getSchemaNonTypes(parentSchema)}.${hasProperty ? ` Should be:\n${this.getSchemaPartText(parentSchema, ["properties", missingProperty])}` : this.getSchemaPartDescription(parentSchema)}`; - } - - case "additionalProperties": - { - const { - params, - parentSchema - } = error; - const { - additionalProperty - } = - /** @type {import("ajv").AdditionalPropertiesParams} */ - params; - return `${dataPath} has an unknown property '${additionalProperty}'${getSchemaNonTypes(parentSchema)}. These properties are valid:\n${this.getSchemaPartText(parentSchema)}`; - } - - case "dependencies": - { - const { - params, - parentSchema - } = error; - const { - property, - deps - } = - /** @type {import("ajv").DependenciesParams} */ - params; - const dependencies = deps.split(",").map( - /** - * @param {string} dep - * @returns {string} - */ - dep => `'${dep.trim()}'`).join(", "); - return `${dataPath} should have properties ${dependencies} when property '${property}' is present${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "propertyNames": - { - const { - params, - parentSchema, - schema - } = error; - const { - propertyName - } = - /** @type {import("ajv").PropertyNamesParams} */ - params; - return `${dataPath} property name '${propertyName}' is invalid${getSchemaNonTypes(parentSchema)}. Property names should be match format ${JSON.stringify(schema.format)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "enum": - { - const { - parentSchema - } = error; - - if (parentSchema && - /** @type {Schema} */ - parentSchema.enum && - /** @type {Schema} */ - parentSchema.enum.length === 1) { - return `${dataPath} should be ${this.getSchemaPartText(parentSchema, false, true)}`; - } - - return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}`; - } - - case "const": - { - const { - parentSchema - } = error; - return `${dataPath} should be equal to constant ${this.getSchemaPartText(parentSchema, false, true)}`; - } - - case "not": - { - const postfix = likeObject( - /** @type {Schema} */ - error.parentSchema) ? `\n${this.getSchemaPartText(error.parentSchema)}` : ""; - const schemaOutput = this.getSchemaPartText(error.schema, false, false, false); - - if (canApplyNot(error.schema)) { - return `${dataPath} should be any ${schemaOutput}${postfix}.`; - } - - const { - schema, - parentSchema - } = error; - return `${dataPath} should not be ${this.getSchemaPartText(schema, false, true)}${parentSchema && likeObject(parentSchema) ? `\n${this.getSchemaPartText(parentSchema)}` : ""}`; - } - - case "oneOf": - case "anyOf": - { - const { - parentSchema, - children - } = error; - - if (children && children.length > 0) { - if (error.schema.length === 1) { - const lastChild = children[children.length - 1]; - const remainingChildren = children.slice(0, children.length - 1); - return this.formatValidationError(Object.assign({}, lastChild, { - children: remainingChildren, - parentSchema: Object.assign({}, parentSchema, lastChild.parentSchema) - })); - } - - let filteredChildren = filterChildren(children); - - if (filteredChildren.length === 1) { - return this.formatValidationError(filteredChildren[0]); - } - - filteredChildren = groupChildrenByFirstChild(filteredChildren); - return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}\nDetails:\n${filteredChildren.map( - /** - * @param {SchemaUtilErrorObject} nestedError - * @returns {string} - */ - nestedError => ` * ${indent(this.formatValidationError(nestedError), " ")}`).join("\n")}`; - } - - return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}`; - } - - case "if": - { - const { - params, - parentSchema - } = error; - const { - failingKeyword - } = - /** @type {import("ajv").IfParams} */ - params; - return `${dataPath} should match "${failingKeyword}" schema:\n${this.getSchemaPartText(parentSchema, [failingKeyword])}`; - } - - case "absolutePath": - { - const { - message, - parentSchema - } = error; - return `${dataPath}: ${message}${this.getSchemaPartDescription(parentSchema)}`; - } - - /* istanbul ignore next */ - - default: - { - const { - message, - parentSchema - } = error; - const ErrorInJSON = JSON.stringify(error, null, 2); // For `custom`, `false schema`, `$ref` keywords - // Fallback for unknown keywords - - return `${dataPath} ${message} (${ErrorInJSON}).\n${this.getSchemaPartText(parentSchema, false)}`; - } - } - } - /** - * @param {Array} errors - * @returns {string} - */ - - - formatValidationErrors(errors) { - return errors.map(error => { - let formattedError = this.formatValidationError(error); - - if (this.postFormatter) { - formattedError = this.postFormatter(formattedError, error); - } - - return ` - ${indent(formattedError, " ")}`; - }).join("\n"); - } - -} - -var _default = ValidationError; -exports.default = _default; \ No newline at end of file diff --git a/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/index.js b/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/index.js deleted file mode 100644 index 94d676f..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/index.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -const { - validate, - ValidationError, - enableValidation, - disableValidation, - needValidate -} = require("./validate"); - -module.exports = { - validate, - ValidationError, - enableValidation, - disableValidation, - needValidate -}; \ No newline at end of file diff --git a/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/keywords/absolutePath.js b/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/keywords/absolutePath.js deleted file mode 100644 index 0a912da..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/keywords/absolutePath.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -/** @typedef {import("ajv").Ajv} Ajv */ - -/** @typedef {import("ajv").ValidateFunction} ValidateFunction */ - -/** @typedef {import("../validate").SchemaUtilErrorObject} SchemaUtilErrorObject */ - -/** - * @param {string} message - * @param {object} schema - * @param {string} data - * @returns {SchemaUtilErrorObject} - */ -function errorMessage(message, schema, data) { - return { - // @ts-ignore - // eslint-disable-next-line no-undefined - dataPath: undefined, - // @ts-ignore - // eslint-disable-next-line no-undefined - schemaPath: undefined, - keyword: "absolutePath", - params: { - absolutePath: data - }, - message, - parentSchema: schema - }; -} -/** - * @param {boolean} shouldBeAbsolute - * @param {object} schema - * @param {string} data - * @returns {SchemaUtilErrorObject} - */ - - -function getErrorFor(shouldBeAbsolute, schema, data) { - const message = shouldBeAbsolute ? `The provided value ${JSON.stringify(data)} is not an absolute path!` : `A relative path is expected. However, the provided value ${JSON.stringify(data)} is an absolute path!`; - return errorMessage(message, schema, data); -} -/** - * - * @param {Ajv} ajv - * @returns {Ajv} - */ - - -function addAbsolutePathKeyword(ajv) { - ajv.addKeyword("absolutePath", { - errors: true, - type: "string", - - compile(schema, parentSchema) { - /** @type {ValidateFunction} */ - const callback = data => { - let passes = true; - const isExclamationMarkPresent = data.includes("!"); - - if (isExclamationMarkPresent) { - callback.errors = [errorMessage(`The provided value ${JSON.stringify(data)} contains exclamation mark (!) which is not allowed because it's reserved for loader syntax.`, parentSchema, data)]; - passes = false; - } // ?:[A-Za-z]:\\ - Windows absolute path - // \\\\ - Windows network absolute path - // \/ - Unix-like OS absolute path - - - const isCorrectAbsolutePath = schema === /^(?:[A-Za-z]:(\\|\/)|\\\\|\/)/.test(data); - - if (!isCorrectAbsolutePath) { - callback.errors = [getErrorFor(schema, parentSchema, data)]; - passes = false; - } - - return passes; - }; - - callback.errors = []; - return callback; - } - - }); - return ajv; -} - -var _default = addAbsolutePathKeyword; -exports.default = _default; \ No newline at end of file diff --git a/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/keywords/undefinedAsNull.js b/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/keywords/undefinedAsNull.js deleted file mode 100644 index 1d54aab..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/keywords/undefinedAsNull.js +++ /dev/null @@ -1,95 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -/** @typedef {import("ajv").Ajv} Ajv */ - -/** - * - * @param {Ajv} ajv - * @param {string} keyword - * @param {any} definition - */ -function addKeyword(ajv, keyword, definition) { - let customRuleCode; - - try { - // @ts-ignore - // eslint-disable-next-line global-require - customRuleCode = require("ajv/lib/dotjs/custom"); // @ts-ignore - - const { - RULES - } = ajv; - let ruleGroup; - - for (let i = 0; i < RULES.length; i++) { - const rg = RULES[i]; - - if (typeof rg.type === "undefined") { - ruleGroup = rg; - break; - } - } - - const rule = { - keyword, - definition, - custom: true, - code: customRuleCode, - implements: definition.implements - }; - ruleGroup.rules.unshift(rule); - RULES.custom[keyword] = rule; - RULES.keywords[keyword] = true; - RULES.all[keyword] = true; - } catch (e) {// Nothing, fallback - } -} -/** - * - * @param {Ajv} ajv - * @returns {Ajv} - */ - - -function addUndefinedAsNullKeyword(ajv) { - // There is workaround for old versions of ajv, where `before` is not implemented - addKeyword(ajv, "undefinedAsNull", { - modifying: true, - - /** - * @param {boolean} kwVal - * @param {unknown} data - * @param {any} parentSchema - * @param {string} dataPath - * @param {unknown} parentData - * @param {number | string} parentDataProperty - * @return {boolean} - */ - validate(kwVal, data, parentSchema, dataPath, parentData, parentDataProperty) { - if (kwVal && parentSchema && typeof parentSchema.enum !== "undefined" && parentData && typeof parentDataProperty === "number") { - const idx = - /** @type {number} */ - parentDataProperty; - const parentDataRef = - /** @type {any[]} */ - parentData; - - if (typeof parentDataRef[idx] === "undefined") { - parentDataRef[idx] = null; - } - } - - return true; - } - - }); - return ajv; -} - -var _default = addUndefinedAsNullKeyword; -exports.default = _default; \ No newline at end of file diff --git a/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/util/Range.js b/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/util/Range.js deleted file mode 100644 index 14b2431..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/util/Range.js +++ /dev/null @@ -1,163 +0,0 @@ -"use strict"; - -/** - * @typedef {[number, boolean]} RangeValue - */ - -/** - * @callback RangeValueCallback - * @param {RangeValue} rangeValue - * @returns {boolean} - */ -class Range { - /** - * @param {"left" | "right"} side - * @param {boolean} exclusive - * @returns {">" | ">=" | "<" | "<="} - */ - static getOperator(side, exclusive) { - if (side === "left") { - return exclusive ? ">" : ">="; - } - - return exclusive ? "<" : "<="; - } - /** - * @param {number} value - * @param {boolean} logic is not logic applied - * @param {boolean} exclusive is range exclusive - * @returns {string} - */ - - - static formatRight(value, logic, exclusive) { - if (logic === false) { - return Range.formatLeft(value, !logic, !exclusive); - } - - return `should be ${Range.getOperator("right", exclusive)} ${value}`; - } - /** - * @param {number} value - * @param {boolean} logic is not logic applied - * @param {boolean} exclusive is range exclusive - * @returns {string} - */ - - - static formatLeft(value, logic, exclusive) { - if (logic === false) { - return Range.formatRight(value, !logic, !exclusive); - } - - return `should be ${Range.getOperator("left", exclusive)} ${value}`; - } - /** - * @param {number} start left side value - * @param {number} end right side value - * @param {boolean} startExclusive is range exclusive from left side - * @param {boolean} endExclusive is range exclusive from right side - * @param {boolean} logic is not logic applied - * @returns {string} - */ - - - static formatRange(start, end, startExclusive, endExclusive, logic) { - let result = "should be"; - result += ` ${Range.getOperator(logic ? "left" : "right", logic ? startExclusive : !startExclusive)} ${start} `; - result += logic ? "and" : "or"; - result += ` ${Range.getOperator(logic ? "right" : "left", logic ? endExclusive : !endExclusive)} ${end}`; - return result; - } - /** - * @param {Array} values - * @param {boolean} logic is not logic applied - * @return {RangeValue} computed value and it's exclusive flag - */ - - - static getRangeValue(values, logic) { - let minMax = logic ? Infinity : -Infinity; - let j = -1; - const predicate = logic ? - /** @type {RangeValueCallback} */ - ([value]) => value <= minMax : - /** @type {RangeValueCallback} */ - ([value]) => value >= minMax; - - for (let i = 0; i < values.length; i++) { - if (predicate(values[i])) { - [minMax] = values[i]; - j = i; - } - } - - if (j > -1) { - return values[j]; - } - - return [Infinity, true]; - } - - constructor() { - /** @type {Array} */ - this._left = []; - /** @type {Array} */ - - this._right = []; - } - /** - * @param {number} value - * @param {boolean=} exclusive - */ - - - left(value, exclusive = false) { - this._left.push([value, exclusive]); - } - /** - * @param {number} value - * @param {boolean=} exclusive - */ - - - right(value, exclusive = false) { - this._right.push([value, exclusive]); - } - /** - * @param {boolean} logic is not logic applied - * @return {string} "smart" range string representation - */ - - - format(logic = true) { - const [start, leftExclusive] = Range.getRangeValue(this._left, logic); - const [end, rightExclusive] = Range.getRangeValue(this._right, !logic); - - if (!Number.isFinite(start) && !Number.isFinite(end)) { - return ""; - } - - const realStart = leftExclusive ? start + 1 : start; - const realEnd = rightExclusive ? end - 1 : end; // e.g. 5 < x < 7, 5 < x <= 6, 6 <= x <= 6 - - if (realStart === realEnd) { - return `should be ${logic ? "" : "!"}= ${realStart}`; - } // e.g. 4 < x < ∞ - - - if (Number.isFinite(start) && !Number.isFinite(end)) { - return Range.formatLeft(start, logic, leftExclusive); - } // e.g. ∞ < x < 4 - - - if (!Number.isFinite(start) && Number.isFinite(end)) { - return Range.formatRight(end, logic, rightExclusive); - } - - return Range.formatRange(start, end, leftExclusive, rightExclusive, logic); - } - -} - -module.exports = Range; \ No newline at end of file diff --git a/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/util/hints.js b/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/util/hints.js deleted file mode 100644 index 4317b86..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/util/hints.js +++ /dev/null @@ -1,105 +0,0 @@ -"use strict"; - -const Range = require("./Range"); -/** @typedef {import("../validate").Schema} Schema */ - -/** - * @param {Schema} schema - * @param {boolean} logic - * @return {string[]} - */ - - -module.exports.stringHints = function stringHints(schema, logic) { - const hints = []; - let type = "string"; - const currentSchema = { ...schema - }; - - if (!logic) { - const tmpLength = currentSchema.minLength; - const tmpFormat = currentSchema.formatMinimum; - const tmpExclusive = currentSchema.formatExclusiveMaximum; - currentSchema.minLength = currentSchema.maxLength; - currentSchema.maxLength = tmpLength; - currentSchema.formatMinimum = currentSchema.formatMaximum; - currentSchema.formatMaximum = tmpFormat; - currentSchema.formatExclusiveMaximum = !currentSchema.formatExclusiveMinimum; - currentSchema.formatExclusiveMinimum = !tmpExclusive; - } - - if (typeof currentSchema.minLength === "number") { - if (currentSchema.minLength === 1) { - type = "non-empty string"; - } else { - const length = Math.max(currentSchema.minLength - 1, 0); - hints.push(`should be longer than ${length} character${length > 1 ? "s" : ""}`); - } - } - - if (typeof currentSchema.maxLength === "number") { - if (currentSchema.maxLength === 0) { - type = "empty string"; - } else { - const length = currentSchema.maxLength + 1; - hints.push(`should be shorter than ${length} character${length > 1 ? "s" : ""}`); - } - } - - if (currentSchema.pattern) { - hints.push(`should${logic ? "" : " not"} match pattern ${JSON.stringify(currentSchema.pattern)}`); - } - - if (currentSchema.format) { - hints.push(`should${logic ? "" : " not"} match format ${JSON.stringify(currentSchema.format)}`); - } - - if (currentSchema.formatMinimum) { - hints.push(`should be ${currentSchema.formatExclusiveMinimum ? ">" : ">="} ${JSON.stringify(currentSchema.formatMinimum)}`); - } - - if (currentSchema.formatMaximum) { - hints.push(`should be ${currentSchema.formatExclusiveMaximum ? "<" : "<="} ${JSON.stringify(currentSchema.formatMaximum)}`); - } - - return [type].concat(hints); -}; -/** - * @param {Schema} schema - * @param {boolean} logic - * @return {string[]} - */ - - -module.exports.numberHints = function numberHints(schema, logic) { - const hints = [schema.type === "integer" ? "integer" : "number"]; - const range = new Range(); - - if (typeof schema.minimum === "number") { - range.left(schema.minimum); - } - - if (typeof schema.exclusiveMinimum === "number") { - range.left(schema.exclusiveMinimum, true); - } - - if (typeof schema.maximum === "number") { - range.right(schema.maximum); - } - - if (typeof schema.exclusiveMaximum === "number") { - range.right(schema.exclusiveMaximum, true); - } - - const rangeFormat = range.format(logic); - - if (rangeFormat) { - hints.push(rangeFormat); - } - - if (typeof schema.multipleOf === "number") { - hints.push(`should${logic ? "" : " not"} be multiple of ${schema.multipleOf}`); - } - - return hints; -}; \ No newline at end of file diff --git a/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/validate.js b/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/validate.js deleted file mode 100644 index cb09145..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/validate.js +++ /dev/null @@ -1,258 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.validate = validate; -exports.enableValidation = enableValidation; -exports.disableValidation = disableValidation; -exports.needValidate = needValidate; -Object.defineProperty(exports, "ValidationError", { - enumerable: true, - get: function () { - return _ValidationError.default; - } -}); - -var _absolutePath = _interopRequireDefault(require("./keywords/absolutePath")); - -var _undefinedAsNull = _interopRequireDefault(require("./keywords/undefinedAsNull")); - -var _ValidationError = _interopRequireDefault(require("./ValidationError")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * @template T - * @param fn {(function(): any) | undefined} - * @returns {function(): T} - */ -const memoize = fn => { - let cache = false; - /** @type {T} */ - - let result; - return () => { - if (cache) { - return result; - } - - result = - /** @type {function(): any} */ - fn(); - cache = true; // Allow to clean up memory for fn - // and all dependent resources - // eslint-disable-next-line no-undefined, no-param-reassign - - fn = undefined; - return result; - }; -}; - -const getAjv = memoize(() => { - // Use CommonJS require for ajv libs so TypeScript consumers aren't locked into esModuleInterop (see #110). - // eslint-disable-next-line global-require - const Ajv = require("ajv"); // eslint-disable-next-line global-require - - - const ajvKeywords = require("ajv-keywords"); - - const ajv = new Ajv({ - allErrors: true, - verbose: true, - $data: true - }); - ajvKeywords(ajv, ["instanceof", "formatMinimum", "formatMaximum", "patternRequired"]); // Custom keywords - - (0, _absolutePath.default)(ajv); - (0, _undefinedAsNull.default)(ajv); - return ajv; -}); -/** @typedef {import("json-schema").JSONSchema4} JSONSchema4 */ - -/** @typedef {import("json-schema").JSONSchema6} JSONSchema6 */ - -/** @typedef {import("json-schema").JSONSchema7} JSONSchema7 */ - -/** @typedef {import("ajv").ErrorObject} ErrorObject */ - -/** @typedef {import("ajv").ValidateFunction} ValidateFunction */ - -/** - * @typedef {Object} Extend - * @property {number=} formatMinimum - * @property {number=} formatMaximum - * @property {boolean=} formatExclusiveMinimum - * @property {boolean=} formatExclusiveMaximum - * @property {string=} link - * @property {boolean=} undefinedAsNull - */ - -/** @typedef {(JSONSchema4 | JSONSchema6 | JSONSchema7) & Extend} Schema */ - -/** @typedef {ErrorObject & { children?: Array}} SchemaUtilErrorObject */ - -/** - * @callback PostFormatter - * @param {string} formattedError - * @param {SchemaUtilErrorObject} error - * @returns {string} - */ - -/** - * @typedef {Object} ValidationErrorConfiguration - * @property {string=} name - * @property {string=} baseDataPath - * @property {PostFormatter=} postFormatter - */ - -/** - * @param {SchemaUtilErrorObject} error - * @param {number} idx - * @returns {SchemaUtilErrorObject} - */ - -function applyPrefix(error, idx) { - // eslint-disable-next-line no-param-reassign - error.dataPath = `[${idx}]${error.dataPath}`; - - if (error.children) { - error.children.forEach(err => applyPrefix(err, idx)); - } - - return error; -} - -let skipValidation = false; // We use `process.env.SKIP_VALIDATION` because you can have multiple `schema-utils` with different version, -// so we want to disable it globally, `process.env` doesn't supported by browsers, so we have the local `skipValidation` variables -// Enable validation - -function enableValidation() { - skipValidation = false; // Disable validation for any versions - - if (process && process.env) { - process.env.SKIP_VALIDATION = "n"; - } -} // Disable validation - - -function disableValidation() { - skipValidation = true; - - if (process && process.env) { - process.env.SKIP_VALIDATION = "y"; - } -} // Check if we need to confirm - - -function needValidate() { - if (skipValidation) { - return false; - } - - if (process && process.env && process.env.SKIP_VALIDATION) { - const value = process.env.SKIP_VALIDATION.trim(); - - if (/^(?:y|yes|true|1|on)$/i.test(value)) { - return false; - } - - if (/^(?:n|no|false|0|off)$/i.test(value)) { - return true; - } - } - - return true; -} -/** - * @param {Schema} schema - * @param {Array | object} options - * @param {ValidationErrorConfiguration=} configuration - * @returns {void} - */ - - -function validate(schema, options, configuration) { - if (!needValidate()) { - return; - } - - let errors = []; - - if (Array.isArray(options)) { - for (let i = 0; i <= options.length - 1; i++) { - errors.push(...validateObject(schema, options[i]).map(err => applyPrefix(err, i))); - } - } else { - errors = validateObject(schema, options); - } - - if (errors.length > 0) { - throw new _ValidationError.default(errors, schema, configuration); - } -} -/** @typedef {WeakMap} */ - - -const schemaCache = new WeakMap(); -/** - * @param {Schema} schema - * @param {Array | object} options - * @returns {Array} - */ - -function validateObject(schema, options) { - let compiledSchema = schemaCache.get(schema); - - if (!compiledSchema) { - compiledSchema = getAjv().compile(schema); - schemaCache.set(schema, compiledSchema); - } - - const valid = compiledSchema(options); - if (valid) return []; - return compiledSchema.errors ? filterErrors(compiledSchema.errors) : []; -} -/** - * @param {Array} errors - * @returns {Array} - */ - - -function filterErrors(errors) { - /** @type {Array} */ - let newErrors = []; - - for (const error of - /** @type {Array} */ - errors) { - const { - dataPath - } = error; - /** @type {Array} */ - - let children = []; - newErrors = newErrors.filter(oldError => { - if (oldError.dataPath.includes(dataPath)) { - if (oldError.children) { - children = children.concat(oldError.children.slice(0)); - } // eslint-disable-next-line no-undefined, no-param-reassign - - - oldError.children = undefined; - children.push(oldError); - return false; - } - - return true; - }); - - if (children.length) { - error.children = children; - } - - newErrors.push(error); - } - - return newErrors; -} \ No newline at end of file diff --git a/node_modules/terser-webpack-plugin/node_modules/schema-utils/package.json b/node_modules/terser-webpack-plugin/node_modules/schema-utils/package.json deleted file mode 100644 index 47943ef..0000000 --- a/node_modules/terser-webpack-plugin/node_modules/schema-utils/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "name": "schema-utils", - "version": "3.3.0", - "description": "webpack Validation Utils", - "license": "MIT", - "repository": "webpack/schema-utils", - "author": "webpack Contrib (https://github.com/webpack-contrib)", - "homepage": "https://github.com/webpack/schema-utils", - "bugs": "https://github.com/webpack/schema-utils/issues", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "main": "dist/index.js", - "types": "declarations/index.d.ts", - "engines": { - "node": ">= 10.13.0" - }, - "scripts": { - "start": "npm run build -- -w", - "clean": "del-cli dist declarations", - "prebuild": "npm run clean", - "build:types": "tsc --declaration --emitDeclarationOnly --outDir declarations && prettier \"declarations/**/*.ts\" --write", - "build:code": "cross-env NODE_ENV=production babel src -d dist --copy-files", - "build": "npm-run-all -p \"build:**\"", - "commitlint": "commitlint --from=master", - "security": "npm audit --production", - "fmt:check": "prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different", - "lint:js": "eslint --cache .", - "lint:types": "tsc --pretty --noEmit", - "lint": "npm-run-all lint:js lint:types fmt:check", - "fmt": "npm run fmt:check -- --write", - "fix:js": "npm run lint:js -- --fix", - "fix": "npm-run-all fix:js fmt", - "test:only": "cross-env NODE_ENV=test jest", - "test:watch": "npm run test:only -- --watch", - "test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage", - "pretest": "npm run lint", - "test": "npm run test:coverage", - "prepare": "npm run build && husky install", - "release": "standard-version" - }, - "files": [ - "dist", - "declarations" - ], - "dependencies": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - }, - "devDependencies": { - "@babel/cli": "^7.14.3", - "@babel/core": "^7.14.6", - "@babel/preset-env": "^7.14.7", - "@commitlint/cli": "^12.1.4", - "@commitlint/config-conventional": "^12.1.4", - "@webpack-contrib/eslint-config-webpack": "^3.0.0", - "babel-jest": "^27.0.6", - "cross-env": "^7.0.3", - "del": "^6.0.0", - "del-cli": "^3.0.1", - "eslint": "^7.31.0", - "eslint-config-prettier": "^8.3.0", - "eslint-plugin-import": "^2.23.4", - "husky": "^6.0.0", - "jest": "^27.0.6", - "lint-staged": "^11.0.1", - "npm-run-all": "^4.1.5", - "prettier": "^2.3.2", - "standard-version": "^9.3.1", - "typescript": "^4.3.5", - "webpack": "^5.45.1" - }, - "keywords": [ - "webpack" - ] -} diff --git a/node_modules/unicode-canonical-property-names-ecmascript/README.md b/node_modules/unicode-canonical-property-names-ecmascript/README.md index 3e86abc..62ff5ba 100644 --- a/node_modules/unicode-canonical-property-names-ecmascript/README.md +++ b/node_modules/unicode-canonical-property-names-ecmascript/README.md @@ -1,4 +1,4 @@ -# unicode-canonical-property-names-ecmascript [![Build status](https://travis-ci.org/mathiasbynens/unicode-canonical-property-names-ecmascript.svg?branch=main)](https://travis-ci.org/mathiasbynens/unicode-canonical-property-names-ecmascript) [![unicode-canonical-property-names-ecmascript on npm](https://img.shields.io/npm/v/unicode-canonical-property-names-ecmascript)](https://www.npmjs.com/package/unicode-canonical-property-names-ecmascript) +# unicode-canonical-property-names-ecmascript [![unicode-canonical-property-names-ecmascript on npm](https://img.shields.io/npm/v/unicode-canonical-property-names-ecmascript)](https://www.npmjs.com/package/unicode-canonical-property-names-ecmascript) _unicode-canonical-property-names-ecmascript_ exports the set of canonical Unicode property names that are supported in [ECMAScript RegExp property escapes](https://github.com/tc39/proposal-regexp-unicode-property-escapes). diff --git a/node_modules/unicode-canonical-property-names-ecmascript/package.json b/node_modules/unicode-canonical-property-names-ecmascript/package.json index dc072e2..2115889 100644 --- a/node_modules/unicode-canonical-property-names-ecmascript/package.json +++ b/node_modules/unicode-canonical-property-names-ecmascript/package.json @@ -1,6 +1,6 @@ { "name": "unicode-canonical-property-names-ecmascript", - "version": "2.0.0", + "version": "2.0.1", "description": "The set of canonical Unicode property names supported in ECMAScript RegExp property escapes.", "homepage": "https://github.com/mathiasbynens/unicode-canonical-property-names-ecmascript", "main": "index.js", diff --git a/node_modules/unicode-match-property-value-ecmascript/README.md b/node_modules/unicode-match-property-value-ecmascript/README.md index 1071c4c..7850ef4 100644 --- a/node_modules/unicode-match-property-value-ecmascript/README.md +++ b/node_modules/unicode-match-property-value-ecmascript/README.md @@ -1,4 +1,4 @@ -# unicode-match-property-value-ecmascript [![Build status](https://travis-ci.org/mathiasbynens/unicode-match-property-value-ecmascript.svg?branch=main)](https://travis-ci.org/mathiasbynens/unicode-match-property-value-ecmascript) [![unicode-match-property-value-ecmascript on npm](https://img.shields.io/npm/v/unicode-match-property-value-ecmascript)](https://www.npmjs.com/package/unicode-match-property-value-ecmascript) +# unicode-match-property-value-ecmascript [![unicode-match-property-value-ecmascript on npm](https://img.shields.io/npm/v/unicode-match-property-value-ecmascript)](https://www.npmjs.com/package/unicode-match-property-value-ecmascript) _unicode-match-property-value-ecmascript_ matches a given Unicode property value or [property value alias](https://github.com/mathiasbynens/unicode-property-value-aliases) to its canonical property value without applying [loose matching](https://github.com/mathiasbynens/unicode-loose-match), per the algorithm used for [RegExp Unicode property escapes in ECMAScript](https://github.com/tc39/proposal-regexp-unicode-property-escapes). Consider it a strict alternative to loose matching. diff --git a/node_modules/unicode-match-property-value-ecmascript/data/mappings.js b/node_modules/unicode-match-property-value-ecmascript/data/mappings.js index 367ee9a..f1ccffd 100644 --- a/node_modules/unicode-match-property-value-ecmascript/data/mappings.js +++ b/node_modules/unicode-match-property-value-ecmascript/data/mappings.js @@ -120,6 +120,7 @@ module.exports = new Map([ ['Elba', 'Elbasan'], ['Elym', 'Elymaic'], ['Ethi', 'Ethiopic'], + ['Gara', 'Garay'], ['Geor', 'Georgian'], ['Glag', 'Glagolitic'], ['Gong', 'Gunjala_Gondi'], @@ -128,6 +129,7 @@ module.exports = new Map([ ['Gran', 'Grantha'], ['Grek', 'Greek'], ['Gujr', 'Gujarati'], + ['Gukh', 'Gurung_Khema'], ['Guru', 'Gurmukhi'], ['Hang', 'Hangul'], ['Hani', 'Han'], @@ -150,6 +152,7 @@ module.exports = new Map([ ['Khoj', 'Khojki'], ['Kits', 'Khitan_Small_Script'], ['Knda', 'Kannada'], + ['Krai', 'Kirat_Rai'], ['Kthi', 'Kaithi'], ['Lana', 'Tai_Tham'], ['Laoo', 'Lao'], @@ -186,6 +189,7 @@ module.exports = new Map([ ['Nshu', 'Nushu'], ['Ogam', 'Ogham'], ['Olck', 'Ol_Chiki'], + ['Onao', 'Ol_Onal'], ['Orkh', 'Old_Turkic'], ['Orya', 'Oriya'], ['Osge', 'Osage'], @@ -217,6 +221,7 @@ module.exports = new Map([ ['Sora', 'Sora_Sompeng'], ['Soyo', 'Soyombo'], ['Sund', 'Sundanese'], + ['Sunu', 'Sunuwar'], ['Sylo', 'Syloti_Nagri'], ['Syrc', 'Syriac'], ['Tagb', 'Tagbanwa'], @@ -234,7 +239,9 @@ module.exports = new Map([ ['Tibt', 'Tibetan'], ['Tirh', 'Tirhuta'], ['Tnsa', 'Tangsa'], + ['Todr', 'Todhri'], ['Toto', 'Toto'], + ['Tutg', 'Tulu_Tigalari'], ['Ugar', 'Ugaritic'], ['Vaii', 'Vai'], ['Vith', 'Vithkuqi'], @@ -284,6 +291,7 @@ module.exports = new Map([ ['Elbasan', 'Elbasan'], ['Elymaic', 'Elymaic'], ['Ethiopic', 'Ethiopic'], + ['Garay', 'Garay'], ['Georgian', 'Georgian'], ['Glagolitic', 'Glagolitic'], ['Gunjala_Gondi', 'Gunjala_Gondi'], @@ -292,6 +300,7 @@ module.exports = new Map([ ['Grantha', 'Grantha'], ['Greek', 'Greek'], ['Gujarati', 'Gujarati'], + ['Gurung_Khema', 'Gurung_Khema'], ['Gurmukhi', 'Gurmukhi'], ['Hangul', 'Hangul'], ['Han', 'Han'], @@ -313,6 +322,7 @@ module.exports = new Map([ ['Khojki', 'Khojki'], ['Khitan_Small_Script', 'Khitan_Small_Script'], ['Kannada', 'Kannada'], + ['Kirat_Rai', 'Kirat_Rai'], ['Kaithi', 'Kaithi'], ['Tai_Tham', 'Tai_Tham'], ['Lao', 'Lao'], @@ -346,6 +356,7 @@ module.exports = new Map([ ['Nushu', 'Nushu'], ['Ogham', 'Ogham'], ['Ol_Chiki', 'Ol_Chiki'], + ['Ol_Onal', 'Ol_Onal'], ['Old_Turkic', 'Old_Turkic'], ['Oriya', 'Oriya'], ['Osage', 'Osage'], @@ -377,6 +388,7 @@ module.exports = new Map([ ['Sora_Sompeng', 'Sora_Sompeng'], ['Soyombo', 'Soyombo'], ['Sundanese', 'Sundanese'], + ['Sunuwar', 'Sunuwar'], ['Syloti_Nagri', 'Syloti_Nagri'], ['Syriac', 'Syriac'], ['Tagbanwa', 'Tagbanwa'], @@ -393,6 +405,8 @@ module.exports = new Map([ ['Tibetan', 'Tibetan'], ['Tirhuta', 'Tirhuta'], ['Tangsa', 'Tangsa'], + ['Todhri', 'Todhri'], + ['Tulu_Tigalari', 'Tulu_Tigalari'], ['Ugaritic', 'Ugaritic'], ['Vai', 'Vai'], ['Vithkuqi', 'Vithkuqi'], @@ -446,6 +460,7 @@ module.exports = new Map([ ['Elba', 'Elbasan'], ['Elym', 'Elymaic'], ['Ethi', 'Ethiopic'], + ['Gara', 'Garay'], ['Geor', 'Georgian'], ['Glag', 'Glagolitic'], ['Gong', 'Gunjala_Gondi'], @@ -454,6 +469,7 @@ module.exports = new Map([ ['Gran', 'Grantha'], ['Grek', 'Greek'], ['Gujr', 'Gujarati'], + ['Gukh', 'Gurung_Khema'], ['Guru', 'Gurmukhi'], ['Hang', 'Hangul'], ['Hani', 'Han'], @@ -476,6 +492,7 @@ module.exports = new Map([ ['Khoj', 'Khojki'], ['Kits', 'Khitan_Small_Script'], ['Knda', 'Kannada'], + ['Krai', 'Kirat_Rai'], ['Kthi', 'Kaithi'], ['Lana', 'Tai_Tham'], ['Laoo', 'Lao'], @@ -512,6 +529,7 @@ module.exports = new Map([ ['Nshu', 'Nushu'], ['Ogam', 'Ogham'], ['Olck', 'Ol_Chiki'], + ['Onao', 'Ol_Onal'], ['Orkh', 'Old_Turkic'], ['Orya', 'Oriya'], ['Osge', 'Osage'], @@ -543,6 +561,7 @@ module.exports = new Map([ ['Sora', 'Sora_Sompeng'], ['Soyo', 'Soyombo'], ['Sund', 'Sundanese'], + ['Sunu', 'Sunuwar'], ['Sylo', 'Syloti_Nagri'], ['Syrc', 'Syriac'], ['Tagb', 'Tagbanwa'], @@ -560,7 +579,9 @@ module.exports = new Map([ ['Tibt', 'Tibetan'], ['Tirh', 'Tirhuta'], ['Tnsa', 'Tangsa'], + ['Todr', 'Todhri'], ['Toto', 'Toto'], + ['Tutg', 'Tulu_Tigalari'], ['Ugar', 'Ugaritic'], ['Vaii', 'Vai'], ['Vith', 'Vithkuqi'], @@ -610,6 +631,7 @@ module.exports = new Map([ ['Elbasan', 'Elbasan'], ['Elymaic', 'Elymaic'], ['Ethiopic', 'Ethiopic'], + ['Garay', 'Garay'], ['Georgian', 'Georgian'], ['Glagolitic', 'Glagolitic'], ['Gunjala_Gondi', 'Gunjala_Gondi'], @@ -618,6 +640,7 @@ module.exports = new Map([ ['Grantha', 'Grantha'], ['Greek', 'Greek'], ['Gujarati', 'Gujarati'], + ['Gurung_Khema', 'Gurung_Khema'], ['Gurmukhi', 'Gurmukhi'], ['Hangul', 'Hangul'], ['Han', 'Han'], @@ -639,6 +662,7 @@ module.exports = new Map([ ['Khojki', 'Khojki'], ['Khitan_Small_Script', 'Khitan_Small_Script'], ['Kannada', 'Kannada'], + ['Kirat_Rai', 'Kirat_Rai'], ['Kaithi', 'Kaithi'], ['Tai_Tham', 'Tai_Tham'], ['Lao', 'Lao'], @@ -672,6 +696,7 @@ module.exports = new Map([ ['Nushu', 'Nushu'], ['Ogham', 'Ogham'], ['Ol_Chiki', 'Ol_Chiki'], + ['Ol_Onal', 'Ol_Onal'], ['Old_Turkic', 'Old_Turkic'], ['Oriya', 'Oriya'], ['Osage', 'Osage'], @@ -703,6 +728,7 @@ module.exports = new Map([ ['Sora_Sompeng', 'Sora_Sompeng'], ['Soyombo', 'Soyombo'], ['Sundanese', 'Sundanese'], + ['Sunuwar', 'Sunuwar'], ['Syloti_Nagri', 'Syloti_Nagri'], ['Syriac', 'Syriac'], ['Tagbanwa', 'Tagbanwa'], @@ -719,6 +745,8 @@ module.exports = new Map([ ['Tibetan', 'Tibetan'], ['Tirhuta', 'Tirhuta'], ['Tangsa', 'Tangsa'], + ['Todhri', 'Todhri'], + ['Tulu_Tigalari', 'Tulu_Tigalari'], ['Ugaritic', 'Ugaritic'], ['Vai', 'Vai'], ['Vithkuqi', 'Vithkuqi'], diff --git a/node_modules/unicode-match-property-value-ecmascript/package.json b/node_modules/unicode-match-property-value-ecmascript/package.json index 1d3076c..09156aa 100644 --- a/node_modules/unicode-match-property-value-ecmascript/package.json +++ b/node_modules/unicode-match-property-value-ecmascript/package.json @@ -1,6 +1,6 @@ { "name": "unicode-match-property-value-ecmascript", - "version": "2.1.0", + "version": "2.2.0", "description": "Match a Unicode property or property alias to its canonical property name per the algorithm used for RegExp Unicode property escapes in ECMAScript.", "homepage": "https://github.com/mathiasbynens/unicode-match-property-value-ecmascript", "main": "index.js", @@ -30,7 +30,7 @@ "devDependencies": { "ava": "*", "jsesc": "^3.0.2", - "unicode-property-value-aliases-ecmascript": "^2.1.0" + "unicode-property-value-aliases-ecmascript": "^2.2.0" }, "scripts": { "build": "node scripts/build.js", diff --git a/node_modules/webpack-cli/README.md b/node_modules/webpack-cli/README.md index 063b299..430d7f0 100644 --- a/node_modules/webpack-cli/README.md +++ b/node_modules/webpack-cli/README.md @@ -69,51 +69,49 @@ npx webpack-cli --help verbose info|i [options] Outputs information about your system. init|create|new|c|n [generation-path] [options] Initialize a new webpack project. loader|l [output-path] [options] Scaffold a loader. - migrate|m [new-config-path] Migrate a configuration to a new version. plugin|p [output-path] [options] Scaffold a plugin. serve|server|s [entries...] [options] Run the webpack dev server. version|v [commands...] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. watch|w [entries...] [options] Run webpack and watch for files changes. ``` -### webpack 4 +### Available Options ``` - Options: - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information - -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --entry The entry point(s) of your application e.g. ./src/main.js. - -h, --hot [value] Enables Hot Module Replacement - --no-hot Disables Hot Module Replacement - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. - --prefetch Prefetch this request - --stats [value] It instructs webpack on how to treat the stats e.g. verbose. - --no-stats Disable stats output. - -t, --target Sets the build target e.g. node. - -w, --watch Watch for files changes. - --no-watch Do not watch for file changes. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. +Options: + -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using 'webpack-merge'. + --disable-interpret Disable interpret for loading the config file. + --env Environment passed to the configuration when it is a function. + --node-env Sets process.env.NODE_ENV to the specified value. + --define-process-env-node-env Sets process.env.NODE_ENV to the specified value. (Currently an alias for `--node-env`) + --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack + -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). + --no-devtool Negative 'devtool' option. + --entry A module that is loaded upon startup. Only the last one is exported. + --mode Enable production optimizations or development hints. + --name Name of the configuration. Used when loading multiple configurations. + -o, --output-path The output directory as **absolute path** (required). + --stats [value] Stats options object or preset name. + --no-stats Negative 'stats' option. + -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. + --no-target Negative 'target' option. + -w, --watch Enter watch mode, which rebuilds on file change. + --no-watch Negative 'watch' option. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Negative 'watch-options-stdin' option. Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. ``` -### webpack 5 - Checkout [`OPTIONS.md`](https://github.com/webpack/webpack-cli/blob/master/OPTIONS.md) to see list of all available options. ## Exit codes and their meanings diff --git a/node_modules/webpack-cli/lib/index.d.ts b/node_modules/webpack-cli/lib/index.d.ts index eea524d..267f746 100644 --- a/node_modules/webpack-cli/lib/index.d.ts +++ b/node_modules/webpack-cli/lib/index.d.ts @@ -1 +1 @@ -export * from "./types"; +export type * from "./types"; diff --git a/node_modules/webpack-cli/lib/index.js b/node_modules/webpack-cli/lib/index.js index 709cf1a..f029c39 100644 --- a/node_modules/webpack-cli/lib/index.js +++ b/node_modules/webpack-cli/lib/index.js @@ -1,22 +1,5 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./types"), exports); // eslint-disable-next-line @typescript-eslint/no-var-requires const CLI = require("./webpack-cli"); module.exports = CLI; -// TODO remove after drop `@webpack-cli/migrate` -module.exports.utils = { logger: console }; diff --git a/node_modules/webpack-cli/lib/types.d.ts b/node_modules/webpack-cli/lib/types.d.ts index 8b5d86e..39afdc2 100644 --- a/node_modules/webpack-cli/lib/types.d.ts +++ b/node_modules/webpack-cli/lib/types.d.ts @@ -1,10 +1,11 @@ /// -import webpack, { EntryOptions, Stats, Configuration, WebpackError, StatsOptions, WebpackOptionsNormalized, Compiler, MultiCompiler, Problem, Argument, AssetEmittedInfo, FileCacheOptions } from "webpack"; -import { ClientConfiguration, Configuration as DevServerConfig } from "webpack-dev-server"; -import { Colorette } from "colorette"; -import { Command, CommandOptions, OptionConstructor, ParseOptions } from "commander"; -import { prepare } from "rechoir"; -import { stringifyStream } from "@discoveryjs/json-ext"; +import type { EntryOptions, Stats, Configuration, WebpackError, StatsOptions, WebpackOptionsNormalized, Compiler, MultiCompiler, Problem, Argument, AssetEmittedInfo, FileCacheOptions } from "webpack"; +import type webpack from "webpack"; +import type { ClientConfiguration, Configuration as DevServerConfig } from "webpack-dev-server"; +import { type Colorette } from "colorette"; +import { type Command, type CommandOptions, type Option, type ParseOptions } from "commander"; +import { type prepare } from "rechoir"; +import { type stringifyStream } from "@discoveryjs/json-ext"; /** * Webpack CLI */ @@ -28,6 +29,11 @@ interface IWebpackCLI { doInstall(packageName: string, options?: PackageInstallOptions): Promise; loadJSONFile(path: Path, handleError: boolean): Promise; tryRequireThenImport(module: ModuleName, handleError: boolean): Promise; + getInfoOptions(): WebpackCLIBuiltInOption[]; + getInfoOutput(options: { + output: string; + additionalPackage: string[]; + }): Promise; makeCommand(commandOptions: WebpackCLIOptions, options: WebpackCLICommandOptions, action: CommandAction): Promise; makeOption(command: WebpackCLICommand, option: WebpackCLIBuiltInOption): void; run(args: Parameters[0], parseOptions?: ParseOptions): Promise; @@ -56,18 +62,17 @@ interface WebpackCLICommandOption extends CommanderOption { } interface WebpackCLIConfig { options: WebpackConfiguration | WebpackConfiguration[]; - path: WeakMap; + path: WeakMap; } interface WebpackCLICommand extends Command { pkg: string | undefined; forHelp: boolean | undefined; - options: WebpackCLICommandOption[]; _args: WebpackCLICommandOption[]; } interface WebpackCLIStats extends Stats { presetToOptions?: (item: string | boolean) => StatsOptions; } -declare type WebpackCLIMainOption = Pick & { +type WebpackCLIMainOption = Pick & { flags: string; type: Set; }; @@ -82,7 +87,7 @@ interface WebpackCLIOptions extends CommandOptions { [argName: string]: string; }; } -declare type WebpackCLICommandOptions = WebpackCLIBuiltInOption[] | (() => Promise); +type WebpackCLICommandOptions = WebpackCLIBuiltInOption[] | (() => Promise); interface WebpackCLIBuiltInFlag { name: string; alias?: string; @@ -90,23 +95,24 @@ interface WebpackCLIBuiltInFlag { configs?: Partial[]; negative?: boolean; multiple?: boolean; + valueName?: string; description: string; describe?: string; negatedDescription?: string; defaultValue?: string; + helpLevel: "minimum" | "verbose"; } interface WebpackCLIBuiltInOption extends WebpackCLIBuiltInFlag { hidden?: boolean; group?: "core"; - helpLevel?: "minimum" | "verbose"; } -declare type WebpackCLIExternalCommandInfo = Pick & { +type WebpackCLIExternalCommandInfo = Pick & { pkg: string; }; /** * Webpack dev server */ -declare type WebpackDevServerOptions = DevServerConfig & WebpackConfiguration & ClientConfiguration & AssetEmittedInfo & WebpackOptionsNormalized & FileCacheOptions & Argv & { +type WebpackDevServerOptions = DevServerConfig & WebpackConfiguration & ClientConfiguration & AssetEmittedInfo & WebpackOptionsNormalized & FileCacheOptions & Argv & { nodeEnv?: "string"; watchOptionsStdin?: boolean; progress?: boolean | "profile" | undefined; @@ -117,41 +123,43 @@ declare type WebpackDevServerOptions = DevServerConfig & WebpackConfiguration & merge?: boolean; config: string[]; configName?: string[]; + disableInterpret?: boolean; + extends?: string[]; argv: Argv; }; -declare type Callback = (...args: T) => void; +type Callback = (...args: T) => void; /** * Webpack */ -declare type WebpackConfiguration = Configuration; -declare type ConfigOptions = PotentialPromise; -declare type CallableOption = (env: Env | undefined, argv: Argv) => WebpackConfiguration; -declare type WebpackCompiler = Compiler | MultiCompiler; -declare type FlagType = boolean | "enum" | "string" | "path" | "number" | "boolean" | "RegExp" | "reset"; -declare type FlagConfig = { +type WebpackConfiguration = Configuration; +type ConfigOptions = PotentialPromise; +type CallableOption = (env: Env | undefined, argv: Argv) => WebpackConfiguration; +type WebpackCompiler = Compiler | MultiCompiler; +type FlagType = boolean | "enum" | "string" | "path" | "number" | "boolean" | "RegExp" | "reset"; +type FlagConfig = { negatedDescription: string; type: FlagType; values: FlagType[]; }; -declare type FileSystemCacheOptions = WebpackConfiguration & { +type FileSystemCacheOptions = WebpackConfiguration & { cache: FileCacheOptions & { defaultConfig: string[]; }; }; -declare type ProcessedArguments = Record; -declare type MultipleCompilerStatsOptions = StatsOptions & { - children: StatsOptions[]; -}; -declare type CommandAction = Parameters[0]; +type ProcessedArguments = Record; +type CommandAction = Parameters[0]; interface WebpackRunOptions extends WebpackOptionsNormalized { + progress?: boolean | "profile"; json?: boolean; argv?: Argv; env: Env; + failOnWarnings?: boolean; + isWatchingLikeCommand?: boolean; } /** * Package management */ -declare type PackageManager = "pnpm" | "yarn" | "npm"; +type PackageManager = "pnpm" | "yarn" | "npm"; interface PackageInstallOptions { preMessage?: () => void; } @@ -161,33 +169,27 @@ interface BasicPackageJsonContent { description: string; license: string; } -/** - * Webpack V4 - */ -declare type WebpackV4LegacyStats = Required; -interface WebpackV4Compiler extends Compiler { - compiler: Compiler; -} /** * Plugins and util types */ interface CLIPluginOptions { - configPath?: string; + isMultiCompiler?: boolean; + configPath?: string[]; helpfulOutput: boolean; hot?: boolean | "only"; progress?: boolean | "profile"; prefetch?: string; analyze?: boolean; } -declare type BasicPrimitive = string | boolean | number; -declare type Instantiable = { +type BasicPrimitive = string | boolean | number; +type Instantiable = { new (...args: ConstructorParameters): InstanceType; }; -declare type PotentialPromise = T | Promise; -declare type ModuleName = string; -declare type Path = string; -declare type LogHandler = (value: any) => void; -declare type StringFormatter = (value: string) => string; +type PotentialPromise = T | Promise; +type ModuleName = string; +type Path = string; +type LogHandler = (value: any) => void; +type StringFormatter = (value: string) => string; interface Argv extends Record { env?: Env; } @@ -199,7 +201,7 @@ interface Env { WEBPACK_PACKAGE?: string; WEBPACK_DEV_SERVER_PACKAGE?: string; } -declare type DynamicImport = (url: string) => Promise<{ +type DynamicImport = (url: string) => Promise<{ default: T; }>; interface ImportLoaderError extends Error { @@ -208,7 +210,8 @@ interface ImportLoaderError extends Error { /** * External libraries types */ -declare type CommanderOption = InstanceType; +type OptionConstructor = new (flags: string, description?: string) => Option; +type CommanderOption = InstanceType; interface Rechoir { prepare: typeof prepare; } @@ -224,4 +227,4 @@ interface PromptOptions { defaultResponse: string; stream: NodeJS.WritableStream; } -export { IWebpackCLI, WebpackCLICommandOption, WebpackCLIBuiltInOption, WebpackCLIBuiltInFlag, WebpackCLIColors, WebpackCLIStats, WebpackCLIConfig, WebpackCLIExternalCommandInfo, WebpackCLIOptions, WebpackCLICommand, WebpackCLICommandOptions, WebpackCLIMainOption, WebpackCLILogger, WebpackV4LegacyStats, WebpackDevServerOptions, WebpackRunOptions, WebpackV4Compiler, WebpackCompiler, WebpackConfiguration, Argv, Argument, BasicPrimitive, BasicPackageJsonContent, CallableOption, Callback, CLIPluginOptions, CommandAction, CommanderOption, CommandOptions, ConfigOptions, DynamicImport, FileSystemCacheOptions, FlagConfig, ImportLoaderError, Instantiable, JsonExt, ModuleName, MultipleCompilerStatsOptions, PackageInstallOptions, PackageManager, Path, ProcessedArguments, PromptOptions, Problem, PotentialPromise, Rechoir, RechoirError, }; +export { IWebpackCLI, WebpackCLICommandOption, WebpackCLIBuiltInOption, WebpackCLIBuiltInFlag, WebpackCLIColors, WebpackCLIStats, WebpackCLIConfig, WebpackCLIExternalCommandInfo, WebpackCLIOptions, WebpackCLICommand, WebpackCLICommandOptions, WebpackCLIMainOption, WebpackCLILogger, WebpackDevServerOptions, WebpackRunOptions, WebpackCompiler, WebpackConfiguration, Argv, Argument, BasicPrimitive, BasicPackageJsonContent, CallableOption, Callback, CLIPluginOptions, CommandAction, CommanderOption, CommandOptions, ConfigOptions, DynamicImport, FileSystemCacheOptions, FlagConfig, ImportLoaderError, Instantiable, JsonExt, ModuleName, PackageInstallOptions, PackageManager, Path, ProcessedArguments, PromptOptions, Problem, PotentialPromise, Rechoir, RechoirError, }; diff --git a/node_modules/webpack-cli/lib/webpack-cli.js b/node_modules/webpack-cli/lib/webpack-cli.js index 9e99f5a..8e07613 100644 --- a/node_modules/webpack-cli/lib/webpack-cli.js +++ b/node_modules/webpack-cli/lib/webpack-cli.js @@ -5,8 +5,14 @@ const path = require("path"); const { pathToFileURL } = require("url"); const util = require("util"); const { program, Option } = require("commander"); -const WEBPACK_PACKAGE = process.env.WEBPACK_PACKAGE || "webpack"; -const WEBPACK_DEV_SERVER_PACKAGE = process.env.WEBPACK_DEV_SERVER_PACKAGE || "webpack-dev-server"; +const WEBPACK_PACKAGE_IS_CUSTOM = !!process.env.WEBPACK_PACKAGE; +const WEBPACK_PACKAGE = WEBPACK_PACKAGE_IS_CUSTOM + ? process.env.WEBPACK_PACKAGE + : "webpack"; +const WEBPACK_DEV_SERVER_PACKAGE_IS_CUSTOM = !!process.env.WEBPACK_DEV_SERVER_PACKAGE; +const WEBPACK_DEV_SERVER_PACKAGE = WEBPACK_DEV_SERVER_PACKAGE_IS_CUSTOM + ? process.env.WEBPACK_DEV_SERVER_PACKAGE + : "webpack-dev-server"; class WebpackCLI { constructor() { this.colors = this.createColors(); @@ -73,6 +79,17 @@ class WebpackCLI { // Nothing } } while (dir !== (dir = path.dirname(dir))); + // https://github.com/nodejs/node/blob/v18.9.1/lib/internal/modules/cjs/loader.js#L1274 + for (const internalPath of require("module").globalPaths) { + try { + if (fs.statSync(path.join(internalPath, packageName)).isDirectory()) { + return true; + } + } + catch (_error) { + // Nothing + } + } return false; } getAvailablePackageManagers() { @@ -198,31 +215,72 @@ class WebpackCLI { } process.exit(2); } - async tryRequireThenImport(module, handleError = true) { + async tryRequireThenImport(module, handleError = true, moduleType = "unknown") { let result; - try { - result = require(module); - } - catch (error) { - const dynamicImportLoader = require("./utils/dynamic-import-loader")(); - if ((error.code === "ERR_REQUIRE_ESM" || - process.env.WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG) && - pathToFileURL && - dynamicImportLoader) { - const urlForConfig = pathToFileURL(module); - result = await dynamicImportLoader(urlForConfig); - result = result.default; - return result; + switch (moduleType) { + case "unknown": { + try { + result = require(module); + } + catch (error) { + const dynamicImportLoader = require("./utils/dynamic-import-loader")(); + if ((error.code === "ERR_REQUIRE_ESM" || + process.env.WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG) && + pathToFileURL && + dynamicImportLoader) { + const urlForConfig = pathToFileURL(module); + result = await dynamicImportLoader(urlForConfig); + result = result.default; + return result; + } + if (handleError) { + this.logger.error(error); + process.exit(2); + } + else { + throw error; + } + } + break; } - if (handleError) { - this.logger.error(error); - process.exit(2); + case "commonjs": { + try { + result = require(module); + } + catch (error) { + if (handleError) { + this.logger.error(error); + process.exit(2); + } + else { + throw error; + } + } + break; } - else { - throw error; + case "esm": { + try { + const dynamicImportLoader = require("./utils/dynamic-import-loader")(); + if (pathToFileURL && dynamicImportLoader) { + const urlForConfig = pathToFileURL(module); + result = await dynamicImportLoader(urlForConfig); + result = result.default; + return result; + } + } + catch (error) { + if (handleError) { + this.logger.error(error); + process.exit(2); + } + else { + throw error; + } + } + break; } } - // For babel/typescript + // For babel and other, only commonjs if (result && typeof result === "object" && "default" in result) { result = result.default || {}; } @@ -244,6 +302,76 @@ class WebpackCLI { } return result; } + getInfoOptions() { + return [ + { + name: "output", + alias: "o", + configs: [ + { + type: "string", + }, + ], + description: "To get the output in a specified format ( accept json or markdown )", + helpLevel: "minimum", + }, + { + name: "additional-package", + alias: "a", + configs: [{ type: "string" }], + multiple: true, + description: "Adds additional packages to the output", + helpLevel: "minimum", + }, + ]; + } + async getInfoOutput(options) { + let { output } = options; + const envinfoConfig = {}; + if (output) { + // Remove quotes if exist + output = output.replace(/['"]+/g, ""); + switch (output) { + case "markdown": + envinfoConfig["markdown"] = true; + break; + case "json": + envinfoConfig["json"] = true; + break; + default: + this.logger.error(`'${output}' is not a valid value for output`); + process.exit(2); + } + } + const defaultInformation = { + Binaries: ["Node", "Yarn", "npm"], + Browsers: [ + "Brave Browser", + "Chrome", + "Chrome Canary", + "Edge", + "Firefox", + "Firefox Developer Edition", + "Firefox Nightly", + "Internet Explorer", + "Safari", + "Safari Technology Preview", + ], + Monorepos: ["Yarn Workspaces", "Lerna"], + System: ["OS", "CPU", "Memory"], + npmGlobalPackages: ["webpack", "webpack-cli", "webpack-dev-server"], + }; + let defaultPackages = ["webpack", "loader", "@webpack-cli/"]; + if (typeof options.additionalPackage !== "undefined") { + defaultPackages = [...defaultPackages, ...options.additionalPackage]; + } + defaultInformation.npmPackages = `{${defaultPackages.map((item) => `*${item}*`).join(",")}}`; + const envinfo = await this.tryRequireThenImport("envinfo", false); + let info = await envinfo.run(defaultInformation, envinfoConfig); + info = info.replace(/npmPackages/g, "Packages"); + info = info.replace(/npmGlobalPackages/g, "Global Packages"); + return info; + } async makeCommand(commandOptions, options, action) { const alreadyLoaded = this.program.commands.find((command) => command.name() === commandOptions.name.split(" ")[0] || command.aliases().includes(commandOptions.alias)); @@ -251,7 +379,6 @@ class WebpackCLI { return; } const command = this.program.command(commandOptions.name, { - noHelp: commandOptions.noHelp, hidden: commandOptions.hidden, isDefault: commandOptions.isDefault, }); @@ -287,11 +414,11 @@ class WebpackCLI { } let skipInstallation = false; // Allow to use `./path/to/webpack.js` outside `node_modules` - if (dependency === WEBPACK_PACKAGE && fs.existsSync(WEBPACK_PACKAGE)) { + if (dependency === WEBPACK_PACKAGE && WEBPACK_PACKAGE_IS_CUSTOM) { skipInstallation = true; } // Allow to use `./path/to/webpack-dev-server.js` outside `node_modules` - if (dependency === WEBPACK_DEV_SERVER_PACKAGE && fs.existsSync(WEBPACK_PACKAGE)) { + if (dependency === WEBPACK_DEV_SERVER_PACKAGE && WEBPACK_DEV_SERVER_PACKAGE_IS_CUSTOM) { skipInstallation = true; } if (skipInstallation) { @@ -316,9 +443,9 @@ class WebpackCLI { options = await options(); } } - options.forEach((optionForCommand) => { - this.makeOption(command, optionForCommand); - }); + for (const option of options) { + this.makeOption(command, option); + } } command.action(action); return command; @@ -326,11 +453,15 @@ class WebpackCLI { makeOption(command, option) { let mainOption; let negativeOption; + const flagsWithAlias = ["devtool", "output-path", "target", "watch"]; + if (flagsWithAlias.includes(option.name)) { + option.alias = option.name[0]; + } if (option.configs) { let needNegativeOption = false; let negatedDescription; const mainOptionType = new Set(); - option.configs.forEach((config) => { + for (const config of option.configs) { switch (config.type) { case "reset": mainOptionType.add(Boolean); @@ -352,7 +483,7 @@ class WebpackCLI { break; case "enum": { let hasFalseEnum = false; - const enumTypes = (config.values || []).map((value) => { + for (const value of config.values || []) { switch (typeof value) { case "string": mainOptionType.add(String); @@ -368,17 +499,17 @@ class WebpackCLI { mainOptionType.add(Boolean); break; } - }); + } if (!needNegativeOption) { needNegativeOption = hasFalseEnum; negatedDescription = config.negatedDescription; } - return enumTypes; } } - }); + } mainOption = { flags: option.alias ? `-${option.alias}, --${option.name}` : `--${option.name}`, + valueName: option.valueName || "value", description: option.description || "", type: mainOptionType, multiple: option.multiple, @@ -394,8 +525,8 @@ class WebpackCLI { else { mainOption = { flags: option.alias ? `-${option.alias}, --${option.name}` : `--${option.name}`, - // TODO `describe` used by `webpack-dev-server@3` - description: option.description || option.describe || "", + valueName: option.valueName || "value", + description: option.description || "", type: option.type ? new Set(Array.isArray(option.type) ? option.type : [option.type]) : new Set([Boolean]), @@ -412,10 +543,10 @@ class WebpackCLI { } } if (mainOption.type.size > 1 && mainOption.type.has(Boolean)) { - mainOption.flags = `${mainOption.flags} [value${mainOption.multiple ? "..." : ""}]`; + mainOption.flags = `${mainOption.flags} [${mainOption.valueName || "value"}${mainOption.multiple ? "..." : ""}]`; } else if (mainOption.type.size > 0 && !mainOption.type.has(Boolean)) { - mainOption.flags = `${mainOption.flags} `; + mainOption.flags = `${mainOption.flags} <${mainOption.valueName || "value"}${mainOption.multiple ? "..." : ""}>`; } if (mainOption.type.size === 1) { if (mainOption.type.has(Number)) { @@ -503,24 +634,6 @@ class WebpackCLI { if (this.builtInOptionsCache) { return this.builtInOptionsCache; } - const minimumHelpFlags = [ - "config", - "config-name", - "merge", - "env", - "mode", - "watch", - "watch-options-stdin", - "stats", - "devtool", - "entry", - "target", - "progress", - "json", - "name", - "output-path", - "node-env", - ]; const builtInFlags = [ // For configs { @@ -532,7 +645,9 @@ class WebpackCLI { }, ], multiple: true, - description: "Provide path to a webpack configuration file e.g. ./webpack.config.js.", + valueName: "pathToConfigFile", + description: 'Provide path to one or more webpack configuration files to process, e.g. "./webpack.config.js".', + helpLevel: "minimum", }, { name: "config-name", @@ -542,7 +657,9 @@ class WebpackCLI { }, ], multiple: true, - description: "Name of the configuration to use.", + valueName: "name", + description: "Name(s) of particular configuration(s) to use if configuration file exports an array of multiple configurations.", + helpLevel: "minimum", }, { name: "merge", @@ -554,6 +671,18 @@ class WebpackCLI { }, ], description: "Merge two or more configurations using 'webpack-merge'.", + helpLevel: "minimum", + }, + { + name: "disable-interpret", + configs: [ + { + type: "enum", + values: [true], + }, + ], + description: "Disable interpret for loading the config file.", + helpLevel: "minimum", }, // Complex configs { @@ -591,7 +720,8 @@ class WebpackCLI { return previous; }, multiple: true, - description: "Environment passed to the configuration when it is a function.", + description: 'Environment variables passed to the configuration when it is a function, e.g. "myvar" or "myvar=myval".', + helpLevel: "minimum", }, { name: "node-env", @@ -602,23 +732,20 @@ class WebpackCLI { ], multiple: false, description: "Sets process.env.NODE_ENV to the specified value.", + helpLevel: "minimum", }, - // Adding more plugins { - name: "hot", - alias: "h", + name: "define-process-env-node-env", configs: [ { type: "string", }, - { - type: "boolean", - }, ], - negative: true, - description: "Enables Hot Module Replacement", - negatedDescription: "Disables Hot Module Replacement.", + multiple: false, + description: "Sets process.env.NODE_ENV to the specified value. (Currently an alias for `--node-env`).", + helpLevel: "verbose", }, + // Adding more plugins { name: "analyze", configs: [ @@ -629,6 +756,7 @@ class WebpackCLI { ], multiple: false, description: "It invokes webpack-bundle-analyzer plugin to get bundle information.", + helpLevel: "minimum", }, { name: "progress", @@ -642,15 +770,7 @@ class WebpackCLI { }, ], description: "Print compilation progress during build.", - }, - { - name: "prefetch", - configs: [ - { - type: "string", - }, - ], - description: "Prefetch this request.", + helpLevel: "minimum", }, // Output options { @@ -665,134 +785,52 @@ class WebpackCLI { }, ], alias: "j", + valueName: "pathToJsonFile", description: "Prints result as JSON or store it in a file.", - }, - // For webpack@4 - { - name: "entry", - configs: [ - { - type: "string", - }, - ], - multiple: true, - description: "The entry point(s) of your application e.g. ./src/main.js.", - }, - { - name: "output-path", - alias: "o", - configs: [ - { - type: "string", - }, - ], - description: "Output location of the file generated by webpack e.g. ./dist/.", + helpLevel: "minimum", }, { - name: "target", - alias: "t", + name: "fail-on-warnings", configs: [ - { - type: "string", - }, - ], - multiple: this.webpack.cli !== undefined, - description: "Sets the build target e.g. node.", - }, - { - name: "devtool", - configs: [ - { - type: "string", - }, { type: "enum", - values: [false], - }, - ], - negative: true, - alias: "d", - description: "Determine source maps to use.", - negatedDescription: "Do not generate source maps.", - }, - { - name: "mode", - configs: [ - { - type: "string", - }, - ], - description: "Defines the mode to pass to webpack.", - }, - { - name: "name", - configs: [ - { - type: "string", + values: [true], }, ], - description: "Name of the configuration. Used when loading multiple configurations.", + description: "Stop webpack-cli process with non-zero exit code on warnings from webpack.", + helpLevel: "minimum", }, + // TODO remove this in the next major release, because not all webpack versions have this flag in CLI options { - name: "stats", + name: "extends", + alias: "e", configs: [ { type: "string", }, - { - type: "boolean", - }, - ], - negative: true, - description: "It instructs webpack on how to treat the stats e.g. verbose.", - negatedDescription: "Disable stats output.", - }, - { - name: "watch", - configs: [ - { - type: "boolean", - }, - ], - negative: true, - alias: "w", - description: "Watch for files changes.", - negatedDescription: "Do not watch for file changes.", - }, - { - name: "watch-options-stdin", - configs: [ - { - type: "boolean", - }, ], - negative: true, - description: "Stop watching when stdin stream has ended.", - negatedDescription: "Do not stop watching when stdin stream has ended.", + multiple: true, + description: "Path to the configuration to be extended (only works when using webpack-cli).", + helpLevel: "minimum", }, ]; + const minimumHelpFlags = [ + "mode", + "watch", + "watch-options-stdin", + "stats", + "devtool", + "entry", + "target", + "name", + "output-path", + "extends", + ]; // Extract all the flags being exported from core. - // A list of cli flags generated by core can be found here https://github.com/webpack/webpack/blob/master/test/__snapshots__/Cli.test.js.snap - const coreFlags = this.webpack.cli - ? Object.entries(this.webpack.cli.getArguments()).map(([flag, meta]) => { - const inBuiltIn = builtInFlags.find((builtInFlag) => builtInFlag.name === flag); - if (inBuiltIn) { - return Object.assign(Object.assign(Object.assign(Object.assign({}, meta), { - // @ts-expect-error this might be overwritten - name: flag, group: "core" }), inBuiltIn), { configs: meta.configs || [] }); - } - return Object.assign(Object.assign({}, meta), { name: flag, group: "core" }); - }) - : []; - const options = [] - .concat(builtInFlags.filter((builtInFlag) => !coreFlags.find((coreFlag) => builtInFlag.name === coreFlag.name))) - .concat(coreFlags) - .map((option) => { - option.helpLevel = minimumHelpFlags.includes(option.name) - ? "minimum" - : "verbose"; - return option; - }); + // A list of cli flags generated by core can be found here https://github.com/webpack/webpack/blob/main/test/__snapshots__/Cli.basictest.js.snap + const options = builtInFlags.concat(Object.entries(this.webpack.cli.getArguments()).map(([name, meta]) => { + return Object.assign(Object.assign({}, meta), { name, group: "core", helpLevel: minimumHelpFlags.includes(name) ? "minimum" : "verbose" }); + })); this.builtInOptionsCache = options; return options; } @@ -816,8 +854,9 @@ class WebpackCLI { dependencies: [WEBPACK_PACKAGE], }; const versionCommandOptions = { - name: "version [commands...]", + name: "version", alias: "v", + usage: "[options]", description: "Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.", }; const helpCommandOptions = { @@ -852,11 +891,6 @@ class WebpackCLI { alias: "p", pkg: "@webpack-cli/generators", }, - { - name: "migrate", - alias: "m", - pkg: "@webpack-cli/migrate", - }, { name: "configtest [config-path]", alias: "t", @@ -902,9 +936,7 @@ class WebpackCLI { if (isBuildCommandUsed || isWatchCommandUsed) { await this.makeCommand(isBuildCommandUsed ? buildCommandOptions : watchCommandOptions, async () => { this.webpack = await this.loadWebpack(); - return isWatchCommandUsed - ? this.getBuiltInOptions().filter((option) => option.name !== "watch") - : this.getBuiltInOptions(); + return this.getBuiltInOptions(); }, async (entries, options) => { if (entries.length > 0) { options.entry = [...entries, ...(options.entry || [])]; @@ -919,8 +951,10 @@ class WebpackCLI { } else if (isCommand(commandName, versionCommandOptions)) { // Stub for the `version` command - // eslint-disable-next-line @typescript-eslint/no-empty-function - this.makeCommand(versionCommandOptions, [], () => { }); + this.makeCommand(versionCommandOptions, this.getInfoOptions(), async (options) => { + const info = await cli.getInfoOutput(options); + cli.logger.raw(info); + }); } else { const builtInExternalCommandInfo = externalBuiltInCommandsInfo.find((externalBuiltInCommandInfo) => getCommandName(externalBuiltInCommandInfo.name) === commandName || @@ -966,6 +1000,7 @@ class WebpackCLI { }; // Register own exit this.program.exitOverride(async (error) => { + var _a; if (error.exitCode === 0) { process.exit(0); } @@ -994,12 +1029,11 @@ class WebpackCLI { process.exit(2); } const levenshtein = require("fastest-levenshtein"); - command.options.forEach((option) => { - var _a; + for (const option of command.options) { if (!option.hidden && levenshtein.distance(name, (_a = option.long) === null || _a === void 0 ? void 0 : _a.slice(2)) < 3) { this.logger.error(`Did you mean '--${option.name()}'?`); } - }); + } } } } @@ -1028,62 +1062,9 @@ class WebpackCLI { cli.isColorSupportChanged = color; cli.colors = cli.createColors(color); }); - // Make `-v, --version` options - // Make `version|v [commands...]` command - const outputVersion = async (options) => { - // Filter `bundle`, `watch`, `version` and `help` commands - const possibleCommandNames = options.filter((option) => !isCommand(option, buildCommandOptions) && - !isCommand(option, watchCommandOptions) && - !isCommand(option, versionCommandOptions) && - !isCommand(option, helpCommandOptions)); - possibleCommandNames.forEach((possibleCommandName) => { - if (!isOption(possibleCommandName)) { - return; - } - this.logger.error(`Unknown option '${possibleCommandName}'`); - this.logger.error("Run 'webpack --help' to see available commands and options"); - process.exit(2); - }); - if (possibleCommandNames.length > 0) { - await Promise.all(possibleCommandNames.map((possibleCommand) => loadCommandByName(possibleCommand))); - for (const possibleCommandName of possibleCommandNames) { - const foundCommand = findCommandByName(possibleCommandName); - if (!foundCommand) { - this.logger.error(`Unknown command '${possibleCommandName}'`); - this.logger.error("Run 'webpack --help' to see available commands and options"); - process.exit(2); - } - try { - const { name, version } = this.loadJSONFile(`${foundCommand.pkg}/package.json`); - this.logger.raw(`${name} ${version}`); - } - catch (e) { - this.logger.error(`Error: External package '${foundCommand.pkg}' not found`); - process.exit(2); - } - } - } - let webpack; - try { - webpack = await this.loadWebpack(false); - } - catch (_error) { - // Nothing - } - this.logger.raw(`webpack: ${webpack ? webpack.version : "not installed"}`); - const pkgJSON = this.loadJSONFile("../package.json"); - this.logger.raw(`webpack-cli: ${pkgJSON.version}`); - let devServer; - try { - devServer = await this.loadJSONFile("webpack-dev-server/package.json", false); - } - catch (_error) { - // Nothing - } - this.logger.raw(`webpack-dev-server ${devServer ? devServer.version : "not installed"}`); - process.exit(0); - }; this.program.option("-v, --version", "Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands."); + // webpack-cli has it's own logic for showing suggestions + this.program.showSuggestionAfterError(false); const outputHelp = async (options, isVerbose, isHelpCommandSyntax, program) => { const { bold } = this.colors; const outputIncorrectUsageOfHelp = () => { @@ -1113,7 +1094,7 @@ class WebpackCLI { // Support multiple aliases subcommandTerm: (command) => { const humanReadableArgumentName = (argument) => { - const nameOutput = argument.name + (argument.variadic === true ? "..." : ""); + const nameOutput = argument.name() + (argument.variadic ? "..." : ""); return argument.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]"; }; const args = command._args @@ -1126,6 +1107,11 @@ class WebpackCLI { if (option.hidden) { return false; } + // Hide `--watch` option when developer use `webpack watch --help` + if ((options[0] === "w" || options[0] === "watch") && + (option.name() === "watch" || option.name() === "no-watch")) { + return false; + } switch (option.helpLevel) { case "verbose": return isVerbose; @@ -1165,7 +1151,7 @@ class WebpackCLI { // Arguments const argumentList = helper .visibleArguments(command) - .map((argument) => formatItem(argument.term, argument.description)); + .map((argument) => formatItem(argument.name(), argument.description)); if (argumentList.length > 0) { output = output.concat([bold("Arguments:"), formatList(argumentList), ""]); } @@ -1298,6 +1284,7 @@ class WebpackCLI { // Default action this.program.usage("[options]"); this.program.allowUnknownOption(true); + // Basic command for lazy loading other commands this.program.action(async (options, program) => { if (!isInternalActionCalled) { isInternalActionCalled = true; @@ -1338,13 +1325,10 @@ class WebpackCLI { await outputHelp(optionsForHelp, isVerbose, isHelpCommandSyntax, program); } const isVersionOption = typeof options.version !== "undefined"; - const isVersionCommandSyntax = isCommand(operand, versionCommandOptions); - if (isVersionOption || isVersionCommandSyntax) { - const optionsForVersion = [] - .concat(isVersionOption ? [operand] : []) - .concat(operands.slice(1)) - .concat(unknown); - await outputVersion(optionsForVersion); + if (isVersionOption) { + const info = await this.getInfoOutput({ output: "", additionalPackage: [] }); + this.logger.raw(info); + process.exit(0); } let commandToRun = operand; let commandOperands = operands.slice(1); @@ -1376,11 +1360,18 @@ class WebpackCLI { await this.program.parseAsync(args, parseOptions); } async loadConfig(options) { + const disableInterpret = typeof options.disableInterpret !== "undefined" && options.disableInterpret; const interpret = require("interpret"); const loadConfigByPath = async (configPath, argv = {}) => { - const ext = path.extname(configPath); - const interpreted = Object.keys(interpret.jsVariants).find((variant) => variant === ext); - if (interpreted) { + const ext = path.extname(configPath).toLowerCase(); + let interpreted = Object.keys(interpret.jsVariants).find((variant) => variant === ext); + // Fallback `.cts` to `.ts` + // TODO implement good `.mts` support after https://github.com/gulpjs/rechoir/issues/43 + // For ESM and `.mts` you need to use: 'NODE_OPTIONS="--loader ts-node/esm" webpack-cli --config ./webpack.config.mts' + if (!interpreted && /\.cts$/.test(ext)) { + interpreted = interpret.jsVariants[".ts"]; + } + if (interpreted && !disableInterpret) { const rechoir = require("rechoir"); try { rechoir.prepare(interpret.extensions, configPath); @@ -1389,9 +1380,9 @@ class WebpackCLI { if (error === null || error === void 0 ? void 0 : error.failures) { this.logger.error(`Unable load '${configPath}'`); this.logger.error(error.message); - error.failures.forEach((failure) => { + for (const failure of error.failures) { this.logger.error(failure.error.message); - }); + } this.logger.error("Please install one of them"); process.exit(2); } @@ -1400,8 +1391,19 @@ class WebpackCLI { } } let options; + let moduleType = "unknown"; + switch (ext) { + case ".cjs": + case ".cts": + moduleType = "commonjs"; + break; + case ".mjs": + case ".mts": + moduleType = "esm"; + break; + } try { - options = await this.tryRequireThenImport(configPath, false); + options = await this.tryRequireThenImport(configPath, false, moduleType); // @ts-expect-error error type assertion } catch (error) { @@ -1414,6 +1416,10 @@ class WebpackCLI { } process.exit(2); } + if (!options) { + this.logger.error(`Failed to load '${configPath}' config. Unable to find default export.`); + process.exit(2); + } if (Array.isArray(options)) { // reassign the value to assert type const optionsArray = options; @@ -1464,58 +1470,57 @@ class WebpackCLI { config.options = [config.options]; } if (isArray) { - loadedConfig.options.forEach((item) => { + for (const item of loadedConfig.options) { config.options.push(item); - }); + } } else { config.options.push(loadedConfig.options); } } if (isArray) { - loadedConfig.options.forEach((options) => { - config.path.set(options, loadedConfig.path); - }); + for (const options of loadedConfig.options) { + config.path.set(options, [loadedConfig.path]); + } } else { - config.path.set(loadedConfig.options, loadedConfig.path); + config.path.set(loadedConfig.options, [loadedConfig.path]); } }); config.options = config.options.length === 1 ? config.options[0] : config.options; } else { + // TODO ".mts" is not supported by `interpret`, need to add it + // Prioritize popular extensions first to avoid unnecessary fs calls + const extensions = [ + ".js", + ".mjs", + ".cjs", + ".ts", + ".cts", + ".mts", + ...Object.keys(interpret.extensions), + ]; // Order defines the priority, in decreasing order - const defaultConfigFiles = [ - "webpack.config", - ".webpack/webpack.config", - ".webpack/webpackfile", - ] - .map((filename) => - // Since .cjs is not available on interpret side add it manually to default config extension list - [...Object.keys(interpret.extensions), ".cjs"].map((ext) => ({ - path: path.resolve(filename + ext), - ext: ext, - module: interpret.extensions[ext], - }))) - .reduce((accumulator, currentValue) => accumulator.concat(currentValue), []); + const defaultConfigFiles = new Set(["webpack.config", ".webpack/webpack.config", ".webpack/webpackfile"].flatMap((filename) => extensions.map((ext) => path.resolve(filename + ext)))); let foundDefaultConfigFile; for (const defaultConfigFile of defaultConfigFiles) { - if (!fs.existsSync(defaultConfigFile.path)) { + if (!fs.existsSync(defaultConfigFile)) { continue; } foundDefaultConfigFile = defaultConfigFile; break; } if (foundDefaultConfigFile) { - const loadedConfig = await loadConfigByPath(foundDefaultConfigFile.path, options.argv); + const loadedConfig = await loadConfigByPath(foundDefaultConfigFile, options.argv); config.options = loadedConfig.options; if (Array.isArray(config.options)) { - config.options.forEach((item) => { - config.path.set(item, loadedConfig.path); - }); + for (const item of config.options) { + config.path.set(item, [loadedConfig.path]); + } } else { - config.path.set(loadedConfig.options, loadedConfig.path); + config.path.set(loadedConfig.options, [loadedConfig.path]); } } } @@ -1541,6 +1546,59 @@ class WebpackCLI { process.exit(2); } } + const resolveExtends = async (config, configPaths, extendsPaths) => { + delete config.extends; + const loadedConfigs = await Promise.all(extendsPaths.map((extendsPath) => loadConfigByPath(path.resolve(extendsPath), options.argv))); + const merge = await this.tryRequireThenImport("webpack-merge"); + const loadedOptions = loadedConfigs.flatMap((config) => config.options); + if (loadedOptions.length > 0) { + const prevPaths = configPaths.get(config); + const loadedPaths = loadedConfigs.flatMap((config) => config.path); + if (prevPaths) { + const intersection = loadedPaths.filter((element) => prevPaths.includes(element)); + if (intersection.length > 0) { + this.logger.error(`Recursive configuration detected, exiting.`); + process.exit(2); + } + } + config = merge(...loadedOptions, config); + if (prevPaths) { + configPaths.set(config, [...prevPaths, ...loadedPaths]); + } + } + if (config.extends) { + const extendsPaths = typeof config.extends === "string" ? [config.extends] : config.extends; + config = await resolveExtends(config, configPaths, extendsPaths); + } + return config; + }; + // The `extends` param in CLI gets priority over extends in config file + if (options.extends && options.extends.length > 0) { + const extendsPaths = options.extends; + if (Array.isArray(config.options)) { + config.options = await Promise.all(config.options.map((options) => resolveExtends(options, config.path, extendsPaths))); + } + else { + // load the config from the extends option + config.options = await resolveExtends(config.options, config.path, extendsPaths); + } + } + // if no extends option is passed, check if the config file has extends + else if (Array.isArray(config.options) && config.options.some((options) => options.extends)) { + config.options = await Promise.all(config.options.map((options) => { + if (options.extends) { + return resolveExtends(options, config.path, typeof options.extends === "string" ? [options.extends] : options.extends); + } + else { + return options; + } + })); + } + else if (!Array.isArray(config.options) && config.options.extends) { + config.options = await resolveExtends(config.options, config.path, typeof config.options.extends === "string" + ? [config.options.extends] + : config.options.extends); + } if (options.merge) { const merge = await this.tryRequireThenImport("webpack-merge"); // we can only merge when there are multiple configurations @@ -1554,7 +1612,9 @@ class WebpackCLI { config.options = config.options.reduce((accumulator, options) => { const configPath = config.path.get(options); const mergedOptions = merge(accumulator, options); - mergedConfigPaths.push(configPath); + if (configPath) { + mergedConfigPaths.push(...configPath); + } return mergedOptions; }, {}); config.path.set(config.options, mergedConfigPaths); @@ -1562,17 +1622,6 @@ class WebpackCLI { return config; } async buildConfig(config, options) { - const runFunctionOnEachConfig = (options, fn) => { - if (Array.isArray(options)) { - for (let item of options) { - item = fn(item); - } - } - else { - options = fn(options); - } - return options; - }; if (options.analyze) { if (!this.checkPackageExists("webpack-bundle-analyzer")) { await this.doInstall("webpack-bundle-analyzer", { @@ -1587,40 +1636,27 @@ class WebpackCLI { this.logger.error(`'${options.progress}' is an invalid value for the --progress option. Only 'profile' is allowed.`); process.exit(2); } - if (typeof options.hot === "string" && options.hot !== "only") { - this.logger.error(`'${options.hot}' is an invalid value for the --hot option. Use 'only' instead.`); - process.exit(2); - } - const CLIPlugin = await this.tryRequireThenImport("./plugins/CLIPlugin"); + const CLIPlugin = await this.tryRequireThenImport("./plugins/cli-plugin"); const internalBuildConfig = (item) => { - // Output warnings - if (item.watch && - options.argv && - options.argv.env && - (options.argv.env["WEBPACK_WATCH"] || options.argv.env["WEBPACK_SERVE"])) { - this.logger.warn(`No need to use the '${options.argv.env["WEBPACK_WATCH"] ? "watch" : "serve"}' command together with '{ watch: true }' configuration, it does not make sense.`); - if (options.argv.env["WEBPACK_SERVE"]) { - item.watch = false; - } - } + const originalWatchValue = item.watch; // Apply options - if (this.webpack.cli) { - const args = this.getBuiltInOptions() - .filter((flag) => flag.group === "core") - .reduce((accumulator, flag) => { + const args = this.getBuiltInOptions().reduce((accumulator, flag) => { + if (flag.group === "core") { accumulator[flag.name] = flag; + } + return accumulator; + }, {}); + const values = Object.keys(options).reduce((accumulator, name) => { + if (name === "argv") { return accumulator; - }, {}); - const values = Object.keys(options).reduce((accumulator, name) => { - if (name === "argv") { - return accumulator; - } - const kebabName = this.toKebabCase(name); - if (args[kebabName]) { - accumulator[kebabName] = options[name]; - } - return accumulator; - }, {}); + } + const kebabName = this.toKebabCase(name); + if (args[kebabName]) { + accumulator[kebabName] = options[name]; + } + return accumulator; + }, {}); + if (Object.keys(values).length > 0) { const problems = this.webpack.cli.processArguments(args, item, values); if (problems) { // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -1633,69 +1669,49 @@ class WebpackCLI { const problemsByPath = groupBy(problems, "path"); for (const path in problemsByPath) { const problems = problemsByPath[path]; - problems.forEach((problem) => { + for (const problem of problems) { this.logger.error(`${this.capitalizeFirstLetter(problem.type.replace(/-/g, " "))}${problem.value ? ` '${problem.value}'` : ""} for the '--${problem.argument}' option${problem.index ? ` by index '${problem.index}'` : ""}`); if (problem.expected) { this.logger.error(`Expected: '${problem.expected}'`); } - }); + } } process.exit(2); } - const isFileSystemCacheOptions = (config) => { - return (Boolean(config.cache) && config.cache.type === "filesystem"); - }; - // Setup default cache options - if (isFileSystemCacheOptions(item)) { - const configPath = config.path.get(item); - if (configPath) { - if (!item.cache.buildDependencies) { - item.cache.buildDependencies = {}; - } - if (!item.cache.buildDependencies.defaultConfig) { - item.cache.buildDependencies.defaultConfig = []; - } - if (Array.isArray(configPath)) { - configPath.forEach((oneOfConfigPath) => { - item.cache.buildDependencies.defaultConfig.push(oneOfConfigPath); - }); - } - else { - item.cache.buildDependencies.defaultConfig.push(configPath); + } + // Output warnings + if (options.isWatchingLikeCommand && + options.argv && + options.argv.env && + (typeof originalWatchValue !== "undefined" || typeof options.argv.watch !== "undefined")) { + this.logger.warn(`No need to use the '${options.argv.env["WEBPACK_WATCH"] ? "watch" : "serve"}' command together with '{ watch: true | false }' or '--watch'/'--no-watch' configuration, it does not make sense.`); + if (options.argv.env["WEBPACK_SERVE"]) { + item.watch = false; + } + } + const isFileSystemCacheOptions = (config) => { + return (Boolean(config.cache) && config.cache.type === "filesystem"); + }; + // Setup default cache options + if (isFileSystemCacheOptions(item)) { + const configPath = config.path.get(item); + if (configPath) { + if (!item.cache.buildDependencies) { + item.cache.buildDependencies = {}; + } + if (!item.cache.buildDependencies.defaultConfig) { + item.cache.buildDependencies.defaultConfig = []; + } + if (Array.isArray(configPath)) { + for (const oneOfConfigPath of configPath) { + item.cache.buildDependencies.defaultConfig.push(oneOfConfigPath); } } + else { + item.cache.buildDependencies.defaultConfig.push(configPath); + } } } - // Setup legacy logic for webpack@4 - // TODO respect `--entry-reset` in th next major release - // TODO drop in the next major release - if (options.entry) { - item.entry = options.entry; - } - if (options.outputPath) { - item.output = Object.assign(Object.assign({}, item.output), { path: path.resolve(options.outputPath) }); - } - if (options.target) { - item.target = options.target; - } - if (typeof options.devtool !== "undefined") { - item.devtool = options.devtool; - } - if (options.name) { - item.name = options.name; - } - if (typeof options.stats !== "undefined") { - item.stats = options.stats; - } - if (typeof options.watch !== "undefined") { - item.watch = options.watch; - } - if (typeof options.watchOptionsStdin !== "undefined") { - item.watchOptions = Object.assign(Object.assign({}, item.watchOptions), { stdin: options.watchOptionsStdin }); - } - if (options.mode) { - item.mode = options.mode; - } // Respect `process.env.NODE_ENV` if (!item.mode && process.env && @@ -1706,37 +1722,14 @@ class WebpackCLI { item.mode = process.env.NODE_ENV; } // Setup stats - // TODO remove after drop webpack@4 - const statsForWebpack4 = this.webpack.Stats && - this.webpack.Stats.presetToOptions; - if (statsForWebpack4) { - if (typeof item.stats === "undefined") { - item.stats = {}; - } - else if (typeof item.stats === "boolean") { - item.stats = this.webpack.Stats.presetToOptions(item.stats); - } - else if (typeof item.stats === "string" && - (item.stats === "none" || - item.stats === "verbose" || - item.stats === "detailed" || - item.stats === "normal" || - item.stats === "minimal" || - item.stats === "errors-only" || - item.stats === "errors-warnings")) { - item.stats = this.webpack.Stats.presetToOptions(item.stats); - } + if (typeof item.stats === "undefined") { + item.stats = { preset: "normal" }; } - else { - if (typeof item.stats === "undefined") { - item.stats = { preset: "normal" }; - } - else if (typeof item.stats === "boolean") { - item.stats = item.stats ? { preset: "normal" } : { preset: "none" }; - } - else if (typeof item.stats === "string") { - item.stats = { preset: item.stats }; - } + else if (typeof item.stats === "boolean") { + item.stats = item.stats ? { preset: "normal" } : { preset: "none" }; + } + else if (typeof item.stats === "string") { + item.stats = { preset: item.stats }; } let colors; // From arguments @@ -1751,10 +1744,7 @@ class WebpackCLI { else { colors = Boolean(this.colors.isColorSupported); } - // TODO remove after drop webpack v4 - if (typeof item.stats === "object" && item.stats !== null) { - item.stats.colors = colors; - } + item.stats.colors = colors; // Apply CLI plugin if (!item.plugins) { item.plugins = []; @@ -1762,24 +1752,30 @@ class WebpackCLI { item.plugins.unshift(new CLIPlugin({ configPath: config.path.get(item), helpfulOutput: !options.json, - hot: options.hot, progress: options.progress, - prefetch: options.prefetch, analyze: options.analyze, + isMultiCompiler: Array.isArray(config.options), })); - return options; }; - runFunctionOnEachConfig(config.options, internalBuildConfig); + if (Array.isArray(config.options)) { + for (const item of config.options) { + internalBuildConfig(item); + } + } + else { + internalBuildConfig(config.options); + } return config; } isValidationError(error) { - // https://github.com/webpack/webpack/blob/master/lib/index.js#L267 - // https://github.com/webpack/webpack/blob/v4.44.2/lib/webpack.js#L90 - const ValidationError = this.webpack.ValidationError || this.webpack.WebpackOptionsValidationError; - return error instanceof ValidationError || error.name === "ValidationError"; + return error instanceof this.webpack.ValidationError || error.name === "ValidationError"; } async createCompiler(options, callback) { - if (typeof options.nodeEnv === "string") { + if (typeof options.defineProcessEnvNodeEnv === "string") { + // TODO: This should only set NODE_ENV for the runtime not for the config too. Change this during next breaking change. + process.env.NODE_ENV = options.defineProcessEnvNodeEnv; + } + else if (typeof options.nodeEnv === "string") { process.env.NODE_ENV = options.nodeEnv; } let config = await this.loadConfig(options); @@ -1806,10 +1802,6 @@ class WebpackCLI { } process.exit(2); } - // TODO webpack@4 return Watching and MultiWatching instead Compiler and MultiCompiler, remove this after drop webpack@4 - if (compiler && compiler.compiler) { - compiler = compiler.compiler; - } return compiler; } needWatchStdin(compiler) { @@ -1831,7 +1823,7 @@ class WebpackCLI { this.logger.error(error); process.exit(2); } - if (stats && stats.hasErrors()) { + if (stats && (stats.hasErrors() || (options.failOnWarnings && stats.hasWarnings()))) { process.exitCode = 1; } if (!compiler || !stats) { @@ -1844,12 +1836,6 @@ class WebpackCLI { : compiler.options ? compiler.options.stats : undefined; - // TODO webpack@4 doesn't support `{ children: [{ colors: true }, { colors: true }] }` for stats - const statsForWebpack4 = this.webpack.Stats && - this.webpack.Stats.presetToOptions; - if (this.isMultipleCompiler(compiler) && statsForWebpack4) { - statsOptions.colors = statsOptions.children.some((child) => child.colors); - } if (options.json && createJsonStringifyStream) { const handleWriteError = (error) => { this.logger.error(error); @@ -1886,6 +1872,7 @@ class WebpackCLI { options.argv = Object.assign(Object.assign({}, options), { env }); if (isWatchCommand) { options.watch = true; + options.isWatchingLikeCommand = true; } compiler = await this.createCompiler(options, callback); if (!compiler) { diff --git a/node_modules/webpack-cli/node_modules/commander/Readme.md b/node_modules/webpack-cli/node_modules/commander/Readme.md index d2a88a7..095e2ae 100644 --- a/node_modules/webpack-cli/node_modules/commander/Readme.md +++ b/node_modules/webpack-cli/node_modules/commander/Readme.md @@ -11,6 +11,7 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md) - [Commander.js](#commanderjs) - [Installation](#installation) + - [Quick Start](#quick-start) - [Declaring _program_ variable](#declaring-program-variable) - [Options](#options) - [Common option types, boolean and value](#common-option-types-boolean-and-value) @@ -22,16 +23,22 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md) - [More configuration](#more-configuration) - [Custom option processing](#custom-option-processing) - [Commands](#commands) - - [Specify the argument syntax](#specify-the-argument-syntax) + - [Command-arguments](#command-arguments) + - [More configuration](#more-configuration-1) + - [Custom argument processing](#custom-argument-processing) - [Action handler](#action-handler) - [Stand-alone executable (sub)commands](#stand-alone-executable-subcommands) + - [Life cycle hooks](#life-cycle-hooks) - [Automated help](#automated-help) - [Custom help](#custom-help) + - [Display help after errors](#display-help-after-errors) - [Display help from code](#display-help-from-code) - - [.usage and .name](#usage-and-name) + - [.name](#name) + - [.usage](#usage) + - [.description and .summary](#description-and-summary) - [.helpOption(flags, description)](#helpoptionflags-description) - [.addHelpCommand()](#addhelpcommand) - - [More configuration](#more-configuration-1) + - [More configuration](#more-configuration-2) - [Custom event listeners](#custom-event-listeners) - [Bits and pieces](#bits-and-pieces) - [.parse() and .parseAsync()](#parse-and-parseasync) @@ -41,9 +48,9 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md) - [createCommand()](#createcommand) - [Node options such as `--harmony`](#node-options-such-as---harmony) - [Debugging stand-alone executable subcommands](#debugging-stand-alone-executable-subcommands) + - [Display error](#display-error) - [Override exit and output handling](#override-exit-and-output-handling) - [Additional documentation](#additional-documentation) - - [Examples](#examples) - [Support](#support) - [Commander for enterprise](#commander-for-enterprise) @@ -51,62 +58,150 @@ For information about terms used in this document see: [terminology](./docs/term ## Installation -```bash +```sh npm install commander ``` +## Quick Start + +You write code to describe your command line interface. +Commander looks after parsing the arguments into options and command-arguments, +displays usage errors for problems, and implements a help system. + +Commander is strict and displays an error for unrecognised options. +The two most used option types are a boolean option, and an option which takes its value from the following argument. + +Example file: [split.js](./examples/split.js) + +```js +const { program } = require('commander'); + +program + .option('--first') + .option('-s, --separator '); + +program.parse(); + +const options = program.opts(); +const limit = options.first ? 1 : undefined; +console.log(program.args[0].split(options.separator, limit)); +``` + +```console +$ node split.js -s / --fits a/b/c +error: unknown option '--fits' +(Did you mean --first?) +$ node split.js -s / --first a/b/c +[ 'a' ] +``` + +Here is a more complete program using a subcommand and with descriptions for the help. In a multi-command program, you have an action handler for each command (or stand-alone executables for the commands). + +Example file: [string-util.js](./examples/string-util.js) + +```js +const { Command } = require('commander'); +const program = new Command(); + +program + .name('string-util') + .description('CLI to some JavaScript string utilities') + .version('0.8.0'); + +program.command('split') + .description('Split a string into substrings and display as an array') + .argument('', 'string to split') + .option('--first', 'display just the first substring') + .option('-s, --separator ', 'separator character', ',') + .action((str, options) => { + const limit = options.first ? 1 : undefined; + console.log(str.split(options.separator, limit)); + }); + +program.parse(); +``` + +```console +$ node string-util.js help split +Usage: string-util split [options] + +Split a string into substrings and display as an array. + +Arguments: + string string to split + +Options: + --first display just the first substring + -s, --separator separator character (default: ",") + -h, --help display help for command + +$ node string-util.js split --separator=/ a/b/c +[ 'a', 'b', 'c' ] +``` + +More samples can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory. + ## Declaring _program_ variable Commander exports a global object which is convenient for quick programs. This is used in the examples in this README for brevity. ```js +// CommonJS (.cjs) const { program } = require('commander'); -program.version('0.0.1'); ``` For larger programs which may use commander in multiple ways, including unit testing, it is better to create a local Command object to use. ```js +// CommonJS (.cjs) const { Command } = require('commander'); const program = new Command(); -program.version('0.0.1'); ``` -For named imports in ECMAScript modules, import from `commander/esm.mjs`. - ```js -// index.mjs -import { Command } from 'commander/esm.mjs'; +// ECMAScript (.mjs) +import { Command } from 'commander'; const program = new Command(); ``` -And in TypeScript: - ```ts -// index.ts +// TypeScript (.ts) import { Command } from 'commander'; const program = new Command(); ``` - ## Options Options are defined with the `.option()` method, also serving as documentation for the options. Each option can have a short flag (single character) and a long name, separated by a comma or space or vertical bar ('|'). -The parsed options can be accessed by calling `.opts()` on a `Command` object, and are passed to the action handler. Multi-word options such as "--template-engine" are camel-cased, becoming `program.opts().templateEngine` etc. +The parsed options can be accessed by calling `.opts()` on a `Command` object, and are passed to the action handler. -Multiple short flags may optionally be combined in a single argument following the dash: boolean flags, followed by a single option taking a value (possibly followed by the value). -For example `-a -b -p 80` may be written as `-ab -p80` or even `-abp80`. +Multi-word options such as "--template-engine" are camel-cased, becoming `program.opts().templateEngine` etc. + +An option and its option-argument can be separated by a space, or combined into the same argument. The option-argument can follow the short option directly or follow an `=` for a long option. + +```sh +serve -p 80 +serve -p80 +serve --port 80 +serve --port=80 +``` You can use `--` to indicate the end of the options, and any remaining arguments will be used without being interpreted. By default options on the command line are not positional, and can be specified before or after other arguments. +There are additional related routines for when `.opts()` is not enough: + +- `.optsWithGlobals()` returns merged local and global option values +- `.getOptionValue()` and `.setOptionValue()` work with a single option value +- `.getOptionValueSource()` and `.setOptionValueWithSource()` include where the option value came from + ### Common option types, boolean and value The two most used option types are a boolean option, and an option which takes its value -from the following argument (declared with angle brackets like `--expect `). Both are `undefined` unless specified on command line. +from the following argument (declared with angle brackets like `--expect `). Both are `undefined` unless specified on command line. Example file: [options-common.js](./examples/options-common.js) @@ -125,13 +220,10 @@ if (options.small) console.log('- small pizza size'); if (options.pizzaType) console.log(`- ${options.pizzaType}`); ``` -```bash -$ pizza-options -d -{ debug: true, small: undefined, pizzaType: undefined } -pizza details: +```console $ pizza-options -p error: option '-p, --pizza-type ' argument missing -$ pizza-options -ds -p vegetarian +$ pizza-options -d -s -p vegetarian { debug: true, small: true, pizzaType: 'vegetarian' } pizza details: - small pizza size @@ -141,11 +233,17 @@ pizza details: - cheese ``` +Multiple boolean short options may be combined together following the dash, and may be followed by a single short option taking a value. +For example `-d -s -p cheese` may be written as `-ds -p cheese` or even `-dsp cheese`. + +Options with an expected option-argument are greedy and will consume the following argument whatever the value. +So `--id -xyz` reads `-xyz` as the option-argument. + `program.parse(arguments)` processes the arguments, leaving any args not consumed by the program options in the `program.args` array. The parameter is optional and defaults to `process.argv`. ### Default option value -You can specify a default value for an option which takes a value. +You can specify a default value for an option. Example file: [options-defaults.js](./examples/options-defaults.js) @@ -158,7 +256,7 @@ program.parse(); console.log(`cheese: ${program.opts().cheese}`); ``` -```bash +```console $ pizza-options cheese: blue $ pizza-options --cheese stilton @@ -171,7 +269,7 @@ You can define a boolean option long name with a leading `no-` to set the option Defined alone this also makes the option true by default. If you define `--foo` first, adding `--no-foo` does not change the default value from what it would -otherwise be. You can specify a default boolean value for a boolean option and it can be overridden on command line. +otherwise be. Example file: [options-negatable.js](./examples/options-negatable.js) @@ -188,7 +286,7 @@ const cheeseStr = (options.cheese === false) ? 'no cheese' : `${options.cheese} console.log(`You ordered a pizza with ${sauceStr} and ${cheeseStr}`); ``` -```bash +```console $ pizza-options You ordered a pizza with sauce and mozzarella cheese $ pizza-options --sauce @@ -216,7 +314,7 @@ else if (options.cheese === true) console.log('add cheese'); else console.log(`add cheese type ${options.cheese}`); ``` -```bash +```console $ pizza-options no cheese $ pizza-options --cheese @@ -225,11 +323,14 @@ $ pizza-options --cheese mozzarella add cheese type mozzarella ``` +Options with an optional option-argument are not greedy and will ignore arguments starting with a dash. +So `id` behaves as a boolean option for `--id -5`, but you can use a combined form if needed like `--id=-5`. + For information about possible ambiguous cases, see [options taking varying arguments](./docs/options-taking-varying-arguments.md). ### Required option -You may specify a required (mandatory) option using `.requiredOption`. The option must have a value after parsing, usually specified on the command line, or perhaps from a default value (say from environment). The method is otherwise the same as `.option` in format, taking flags and description, and optional default value or custom processing. +You may specify a required (mandatory) option using `.requiredOption()`. The option must have a value after parsing, usually specified on the command line, or perhaps from a default value (say from environment). The method is otherwise the same as `.option()` in format, taking flags and description, and optional default value or custom processing. Example file: [options-required.js](./examples/options-required.js) @@ -240,7 +341,7 @@ program program.parse(); ``` -```bash +```console $ pizza error: required option '-c, --cheese ' not specified ``` @@ -265,7 +366,7 @@ console.log('Options: ', program.opts()); console.log('Remaining arguments: ', program.args); ``` -```bash +```console $ collect -n 1 2 3 --letter a b c Options: { number: [ '1', '2', '3' ], letter: [ 'a', 'b', 'c' ] } Remaining arguments: [] @@ -287,7 +388,7 @@ The optional `version` method adds handling for displaying the command version. program.version('0.0.1'); ``` -```bash +```console $ ./examples/pizza -V 0.0.1 ``` @@ -304,28 +405,44 @@ program.version('0.0.1', '-v, --vers', 'output the current version'); You can add most options using the `.option()` method, but there are some additional features available by constructing an `Option` explicitly for less common cases. -Example file: [options-extra.js](./examples/options-extra.js) +Example files: [options-extra.js](./examples/options-extra.js), [options-env.js](./examples/options-env.js), [options-conflicts.js](./examples/options-conflicts.js), [options-implies.js](./examples/options-implies.js) ```js program .addOption(new Option('-s, --secret').hideHelp()) .addOption(new Option('-t, --timeout ', 'timeout in seconds').default(60, 'one minute')) - .addOption(new Option('-d, --drink ', 'drink size').choices(['small', 'medium', 'large'])); + .addOption(new Option('-d, --drink ', 'drink size').choices(['small', 'medium', 'large'])) + .addOption(new Option('-p, --port ', 'port number').env('PORT')) + .addOption(new Option('--donate [amount]', 'optional donation in dollars').preset('20').argParser(parseFloat)) + .addOption(new Option('--disable-server', 'disables the server').conflicts('port')) + .addOption(new Option('--free-drink', 'small drink included free ').implies({ drink: 'small' })); ``` -```bash +```console $ extra --help Usage: help [options] Options: -t, --timeout timeout in seconds (default: one minute) -d, --drink drink cup size (choices: "small", "medium", "large") + -p, --port port number (env: PORT) + --donate [amount] optional donation in dollars (preset: "20") + --disable-server disables the server + --free-drink small drink included free -h, --help display help for command $ extra --drink huge error: option '-d, --drink ' argument 'huge' is invalid. Allowed choices are small, medium, large. + +$ PORT=80 extra --donate --free-drink +Options: { timeout: 60, donate: 20, port: '80', freeDrink: true, drink: 'small' } + +$ extra --disable-server --port 8000 +error: option '--disable-server' cannot be used with option '-p, --port ' ``` +Specify a required (mandatory) option using the `Option` method `.makeOptionMandatory()`. This matches the `Command` method [.requiredOption()](#required-option). + ### Custom option processing You may specify a function to do custom processing of option-arguments. The callback function receives two parameters, @@ -342,7 +459,7 @@ function myParseInt(value, dummyPrevious) { // parseInt takes a string and a radix const parsedValue = parseInt(value, 10); if (isNaN(parsedValue)) { - throw new commander.InvalidOptionArgumentError('Not a number.'); + throw new commander.InvalidArgumentError('Not a number.'); } return parsedValue; } @@ -377,7 +494,7 @@ if (options.collect.length > 0) console.log(options.collect); if (options.list !== undefined) console.log(options.list); ``` -```bash +```console $ custom -f 1e2 float: 100 $ custom --integer 2 @@ -394,7 +511,7 @@ $ custom --list x,y,z You can specify (sub)commands using `.command()` or `.addCommand()`. There are two ways these can be implemented: using an action handler attached to the command, or as a stand-alone executable file (described in more detail later). The subcommands may be nested ([example](./examples/nestedCommands.js)). -In the first parameter to `.command()` you specify the command name and any command-arguments. The arguments may be `` or `[optional]`, and the last argument may also be `variadic...`. +In the first parameter to `.command()` you specify the command name. You may append the command-arguments after the command name, or specify them separately using `.argument()`. The arguments may be `` or `[optional]`, and the last argument may also be `variadic...`. You can use `.addCommand()` to add an already configured subcommand to the program. @@ -410,7 +527,7 @@ program console.log('clone command called'); }); -// Command implemented using stand-alone executable file (description is second parameter to `.command`) +// Command implemented using stand-alone executable file, indicated by adding description as second parameter to `.command`. // Returns `this` for adding more commands. program .command('start ', 'start named service') @@ -422,40 +539,45 @@ program .addCommand(build.makeBuildCommand()); ``` -Configuration options can be passed with the call to `.command()` and `.addCommand()`. Specifying `hidden: true` will +Configuration options can be passed with the call to `.command()` and `.addCommand()`. Specifying `hidden: true` will remove the command from the generated help output. Specifying `isDefault: true` will run the subcommand if no other subcommand is specified ([example](./examples/defaultCommand.js)). -### Specify the argument syntax +You can add alternative names for a command with `.alias()`. ([example](./examples/alias.js)) + +For safety, `.addCommand()` does not automatically copy the inherited settings from the parent command. There is a helper routine `.copyInheritedSettings()` for copying the settings when they are wanted. + +### Command-arguments -You use `.arguments` to specify the expected command-arguments for the top-level command, and for subcommands they are usually -included in the `.command` call. Angled brackets (e.g. ``) indicate required command-arguments. -Square brackets (e.g. `[optional]`) indicate optional command-arguments. -You can optionally describe the arguments in the help by supplying a hash as second parameter to `.description()`. +For subcommands, you can specify the argument syntax in the call to `.command()` (as shown above). This +is the only method usable for subcommands implemented using a stand-alone executable, but for other subcommands +you can instead use the following method. -Example file: [arguments.js](./examples/arguments.js) +To configure a command, you can use `.argument()` to specify each expected command-argument. +You supply the argument name and an optional description. The argument may be `` or `[optional]`. +You can specify a default value for an optional command-argument. + +Example file: [argument.js](./examples/argument.js) ```js program .version('0.1.0') - .arguments(' [password]') - .description('test command', { - username: 'user to login', - password: 'password for user, if required' - }) + .argument('', 'user to login') + .argument('[password]', 'password for user, if required', 'no password given') .action((username, password) => { console.log('username:', username); - console.log('environment:', password || 'no password given'); + console.log('password:', password); }); ``` The last argument of a command can be variadic, and only the last argument. To make an argument variadic you - append `...` to the argument name. For example: + append `...` to the argument name. A variadic argument is passed to the action handler as an array. For example: ```js program .version('0.1.0') - .command('rmdir ') + .command('rmdir') + .argument('') .action(function (dirs) { dirs.forEach((dir) => { console.log('rmdir %s', dir); @@ -463,18 +585,58 @@ program }); ``` -The variadic argument is passed to the action handler as an array. +There is a convenience method to add multiple arguments at once, but without descriptions: + +```js +program + .arguments(' '); +``` + +#### More configuration + +There are some additional features available by constructing an `Argument` explicitly for less common cases. + +Example file: [arguments-extra.js](./examples/arguments-extra.js) + +```js +program + .addArgument(new commander.Argument('', 'drink cup size').choices(['small', 'medium', 'large'])) + .addArgument(new commander.Argument('[timeout]', 'timeout in seconds').default(60, 'one minute')) +``` + +#### Custom argument processing + +You may specify a function to do custom processing of command-arguments (like for option-arguments). +The callback function receives two parameters, the user specified command-argument and the previous value for the argument. +It returns the new value for the argument. + +The processed argument values are passed to the action handler, and saved as `.processedArgs`. + +You can optionally specify the default/starting value for the argument after the function parameter. + +Example file: [arguments-custom-processing.js](./examples/arguments-custom-processing.js) + +```js +program + .command('add') + .argument('', 'integer argument', myParseInt) + .argument('[second]', 'integer argument', myParseInt, 1000) + .action((first, second) => { + console.log(`${first} + ${second} = ${first + second}`); + }) +; +``` ### Action handler The action handler gets passed a parameter for each command-argument you declared, and two additional parameters -which are the parsed options and the command object itself. +which are the parsed options and the command object itself. Example file: [thank.js](./examples/thank.js) ```js program - .arguments('') + .argument('') .option('-t, --title ', 'title to use before name') .option('-d, --debug', 'display some debugging') .action((name, options, command) => { @@ -486,6 +648,20 @@ program }); ``` +If you prefer, you can work with the command directly and skip declaring the parameters for the action handler. The `this` keyword is set to the running command and can be used from a function expression (but not from an arrow function). + +Example file: [action-this.js](./examples/action-this.js) + +```js +program + .command('serve') + .argument(' -``` - -This bundle can be used with different module systems; it creates global `Ajv` if no module system is found. - -The browser bundle is available on [cdnjs](https://cdnjs.com/libraries/ajv). - -Ajv is tested with these browsers: - -[![Sauce Test Status](https://saucelabs.com/browser-matrix/epoberezkin.svg)](https://saucelabs.com/u/epoberezkin) - -__Please note__: some frameworks, e.g. Dojo, may redefine global require in such way that is not compatible with CommonJS module format. In such case Ajv bundle has to be loaded before the framework and then you can use global Ajv (see issue [#234](https://github.com/ajv-validator/ajv/issues/234)). - - -### Ajv and Content Security Policies (CSP) - -If you're using Ajv to compile a schema (the typical use) in a browser document that is loaded with a Content Security Policy (CSP), that policy will require a `script-src` directive that includes the value `'unsafe-eval'`. -:warning: NOTE, however, that `unsafe-eval` is NOT recommended in a secure CSP[[1]](https://developer.chrome.com/extensions/contentSecurityPolicy#relaxing-eval), as it has the potential to open the document to cross-site scripting (XSS) attacks. - -In order to make use of Ajv without easing your CSP, you can [pre-compile a schema using the CLI](https://github.com/ajv-validator/ajv-cli#compile-schemas). This will transpile the schema JSON into a JavaScript file that exports a `validate` function that works simlarly to a schema compiled at runtime. - -Note that pre-compilation of schemas is performed using [ajv-pack](https://github.com/ajv-validator/ajv-pack) and there are [some limitations to the schema features it can compile](https://github.com/ajv-validator/ajv-pack#limitations). A successfully pre-compiled schema is equivalent to the same schema compiled at runtime. - - -## Command line interface - -CLI is available as a separate npm package [ajv-cli](https://github.com/ajv-validator/ajv-cli). It supports: - -- compiling JSON Schemas to test their validity -- BETA: generating standalone module exporting a validation function to be used without Ajv (using [ajv-pack](https://github.com/ajv-validator/ajv-pack)) -- migrate schemas to draft-07 (using [json-schema-migrate](https://github.com/epoberezkin/json-schema-migrate)) -- validating data file(s) against JSON Schema -- testing expected validity of data against JSON Schema -- referenced schemas -- custom meta-schemas -- files in JSON, JSON5, YAML, and JavaScript format -- all Ajv options -- reporting changes in data after validation in [JSON-patch](https://tools.ietf.org/html/rfc6902) format - - -## Validation keywords - -Ajv supports all validation keywords from draft-07 of JSON Schema standard: - -- [type](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#type) -- [for numbers](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-numbers) - maximum, minimum, exclusiveMaximum, exclusiveMinimum, multipleOf -- [for strings](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-strings) - maxLength, minLength, pattern, format -- [for arrays](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-arrays) - maxItems, minItems, uniqueItems, items, additionalItems, [contains](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#contains) -- [for objects](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-objects) - maxProperties, minProperties, required, properties, patternProperties, additionalProperties, dependencies, [propertyNames](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#propertynames) -- [for all types](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-all-types) - enum, [const](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#const) -- [compound keywords](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#compound-keywords) - not, oneOf, anyOf, allOf, [if/then/else](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#ifthenelse) - -With [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package Ajv also supports validation keywords from [JSON Schema extension proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals) for JSON Schema standard: - -- [patternRequired](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#patternrequired-proposed) - like `required` but with patterns that some property should match. -- [formatMaximum, formatMinimum, formatExclusiveMaximum, formatExclusiveMinimum](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#formatmaximum--formatminimum-and-exclusiveformatmaximum--exclusiveformatminimum-proposed) - setting limits for date, time, etc. - -See [JSON Schema validation keywords](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md) for more details. - - -## Annotation keywords - -JSON Schema specification defines several annotation keywords that describe schema itself but do not perform any validation. - -- `title` and `description`: information about the data represented by that schema -- `$comment` (NEW in draft-07): information for developers. With option `$comment` Ajv logs or passes the comment string to the user-supplied function. See [Options](#options). -- `default`: a default value of the data instance, see [Assigning defaults](#assigning-defaults). -- `examples` (NEW in draft-06): an array of data instances. Ajv does not check the validity of these instances against the schema. -- `readOnly` and `writeOnly` (NEW in draft-07): marks data-instance as read-only or write-only in relation to the source of the data (database, api, etc.). -- `contentEncoding`: [RFC 2045](https://tools.ietf.org/html/rfc2045#section-6.1 ), e.g., "base64". -- `contentMediaType`: [RFC 2046](https://tools.ietf.org/html/rfc2046), e.g., "image/png". - -__Please note__: Ajv does not implement validation of the keywords `examples`, `contentEncoding` and `contentMediaType` but it reserves them. If you want to create a plugin that implements some of them, it should remove these keywords from the instance. - - -## Formats - -Ajv implements formats defined by JSON Schema specification and several other formats. It is recommended NOT to use "format" keyword implementations with untrusted data, as they use potentially unsafe regular expressions - see [ReDoS attack](#redos-attack). - -__Please note__: if you need to use "format" keyword to validate untrusted data, you MUST assess their suitability and safety for your validation scenarios. - -The following formats are implemented for string validation with "format" keyword: - -- _date_: full-date according to [RFC3339](http://tools.ietf.org/html/rfc3339#section-5.6). -- _time_: time with optional time-zone. -- _date-time_: date-time from the same source (time-zone is mandatory). `date`, `time` and `date-time` validate ranges in `full` mode and only regexp in `fast` mode (see [options](#options)). -- _uri_: full URI. -- _uri-reference_: URI reference, including full and relative URIs. -- _uri-template_: URI template according to [RFC6570](https://tools.ietf.org/html/rfc6570) -- _url_ (deprecated): [URL record](https://url.spec.whatwg.org/#concept-url). -- _email_: email address. -- _hostname_: host name according to [RFC1034](http://tools.ietf.org/html/rfc1034#section-3.5). -- _ipv4_: IP address v4. -- _ipv6_: IP address v6. -- _regex_: tests whether a string is a valid regular expression by passing it to RegExp constructor. -- _uuid_: Universally Unique IDentifier according to [RFC4122](http://tools.ietf.org/html/rfc4122). -- _json-pointer_: JSON-pointer according to [RFC6901](https://tools.ietf.org/html/rfc6901). -- _relative-json-pointer_: relative JSON-pointer according to [this draft](http://tools.ietf.org/html/draft-luff-relative-json-pointer-00). - -__Please note__: JSON Schema draft-07 also defines formats `iri`, `iri-reference`, `idn-hostname` and `idn-email` for URLs, hostnames and emails with international characters. Ajv does not implement these formats. If you create Ajv plugin that implements them please make a PR to mention this plugin here. - -There are two modes of format validation: `fast` and `full`. This mode affects formats `date`, `time`, `date-time`, `uri`, `uri-reference`, and `email`. See [Options](#options) for details. - -You can add additional formats and replace any of the formats above using [addFormat](#api-addformat) method. - -The option `unknownFormats` allows changing the default behaviour when an unknown format is encountered. In this case Ajv can either fail schema compilation (default) or ignore it (default in versions before 5.0.0). You also can allow specific format(s) that will be ignored. See [Options](#options) for details. - -You can find regular expressions used for format validation and the sources that were used in [formats.js](https://github.com/ajv-validator/ajv/blob/master/lib/compile/formats.js). - - -## Combining schemas with $ref - -You can structure your validation logic across multiple schema files and have schemas reference each other using `$ref` keyword. - -Example: - -```javascript -var schema = { - "$id": "http://example.com/schemas/schema.json", - "type": "object", - "properties": { - "foo": { "$ref": "defs.json#/definitions/int" }, - "bar": { "$ref": "defs.json#/definitions/str" } - } -}; - -var defsSchema = { - "$id": "http://example.com/schemas/defs.json", - "definitions": { - "int": { "type": "integer" }, - "str": { "type": "string" } - } -}; -``` - -Now to compile your schema you can either pass all schemas to Ajv instance: - -```javascript -var ajv = new Ajv({schemas: [schema, defsSchema]}); -var validate = ajv.getSchema('http://example.com/schemas/schema.json'); -``` - -or use `addSchema` method: - -```javascript -var ajv = new Ajv; -var validate = ajv.addSchema(defsSchema) - .compile(schema); -``` - -See [Options](#options) and [addSchema](#api) method. - -__Please note__: -- `$ref` is resolved as the uri-reference using schema $id as the base URI (see the example). -- References can be recursive (and mutually recursive) to implement the schemas for different data structures (such as linked lists, trees, graphs, etc.). -- You don't have to host your schema files at the URIs that you use as schema $id. These URIs are only used to identify the schemas, and according to JSON Schema specification validators should not expect to be able to download the schemas from these URIs. -- The actual location of the schema file in the file system is not used. -- You can pass the identifier of the schema as the second parameter of `addSchema` method or as a property name in `schemas` option. This identifier can be used instead of (or in addition to) schema $id. -- You cannot have the same $id (or the schema identifier) used for more than one schema - the exception will be thrown. -- You can implement dynamic resolution of the referenced schemas using `compileAsync` method. In this way you can store schemas in any system (files, web, database, etc.) and reference them without explicitly adding to Ajv instance. See [Asynchronous schema compilation](#asynchronous-schema-compilation). - - -## $data reference - -With `$data` option you can use values from the validated data as the values for the schema keywords. See [proposal](https://github.com/json-schema-org/json-schema-spec/issues/51) for more information about how it works. - -`$data` reference is supported in the keywords: const, enum, format, maximum/minimum, exclusiveMaximum / exclusiveMinimum, maxLength / minLength, maxItems / minItems, maxProperties / minProperties, formatMaximum / formatMinimum, formatExclusiveMaximum / formatExclusiveMinimum, multipleOf, pattern, required, uniqueItems. - -The value of "$data" should be a [JSON-pointer](https://tools.ietf.org/html/rfc6901) to the data (the root is always the top level data object, even if the $data reference is inside a referenced subschema) or a [relative JSON-pointer](http://tools.ietf.org/html/draft-luff-relative-json-pointer-00) (it is relative to the current point in data; if the $data reference is inside a referenced subschema it cannot point to the data outside of the root level for this subschema). - -Examples. - -This schema requires that the value in property `smaller` is less or equal than the value in the property larger: - -```javascript -var ajv = new Ajv({$data: true}); - -var schema = { - "properties": { - "smaller": { - "type": "number", - "maximum": { "$data": "1/larger" } - }, - "larger": { "type": "number" } - } -}; - -var validData = { - smaller: 5, - larger: 7 -}; - -ajv.validate(schema, validData); // true -``` - -This schema requires that the properties have the same format as their field names: - -```javascript -var schema = { - "additionalProperties": { - "type": "string", - "format": { "$data": "0#" } - } -}; - -var validData = { - 'date-time': '1963-06-19T08:30:06.283185Z', - email: 'joe.bloggs@example.com' -} -``` - -`$data` reference is resolved safely - it won't throw even if some property is undefined. If `$data` resolves to `undefined` the validation succeeds (with the exclusion of `const` keyword). If `$data` resolves to incorrect type (e.g. not "number" for maximum keyword) the validation fails. - - -## $merge and $patch keywords - -With the package [ajv-merge-patch](https://github.com/ajv-validator/ajv-merge-patch) you can use the keywords `$merge` and `$patch` that allow extending JSON Schemas with patches using formats [JSON Merge Patch (RFC 7396)](https://tools.ietf.org/html/rfc7396) and [JSON Patch (RFC 6902)](https://tools.ietf.org/html/rfc6902). - -To add keywords `$merge` and `$patch` to Ajv instance use this code: - -```javascript -require('ajv-merge-patch')(ajv); -``` - -Examples. - -Using `$merge`: - -```json -{ - "$merge": { - "source": { - "type": "object", - "properties": { "p": { "type": "string" } }, - "additionalProperties": false - }, - "with": { - "properties": { "q": { "type": "number" } } - } - } -} -``` - -Using `$patch`: - -```json -{ - "$patch": { - "source": { - "type": "object", - "properties": { "p": { "type": "string" } }, - "additionalProperties": false - }, - "with": [ - { "op": "add", "path": "/properties/q", "value": { "type": "number" } } - ] - } -} -``` - -The schemas above are equivalent to this schema: - -```json -{ - "type": "object", - "properties": { - "p": { "type": "string" }, - "q": { "type": "number" } - }, - "additionalProperties": false -} -``` - -The properties `source` and `with` in the keywords `$merge` and `$patch` can use absolute or relative `$ref` to point to other schemas previously added to the Ajv instance or to the fragments of the current schema. - -See the package [ajv-merge-patch](https://github.com/ajv-validator/ajv-merge-patch) for more information. - - -## Defining custom keywords - -The advantages of using custom keywords are: - -- allow creating validation scenarios that cannot be expressed using JSON Schema -- simplify your schemas -- help bringing a bigger part of the validation logic to your schemas -- make your schemas more expressive, less verbose and closer to your application domain -- implement custom data processors that modify your data (`modifying` option MUST be used in keyword definition) and/or create side effects while the data is being validated - -If a keyword is used only for side-effects and its validation result is pre-defined, use option `valid: true/false` in keyword definition to simplify both generated code (no error handling in case of `valid: true`) and your keyword functions (no need to return any validation result). - -The concerns you have to be aware of when extending JSON Schema standard with custom keywords are the portability and understanding of your schemas. You will have to support these custom keywords on other platforms and to properly document these keywords so that everybody can understand them in your schemas. - -You can define custom keywords with [addKeyword](#api-addkeyword) method. Keywords are defined on the `ajv` instance level - new instances will not have previously defined keywords. - -Ajv allows defining keywords with: -- validation function -- compilation function -- macro function -- inline compilation function that should return code (as string) that will be inlined in the currently compiled schema. - -Example. `range` and `exclusiveRange` keywords using compiled schema: - -```javascript -ajv.addKeyword('range', { - type: 'number', - compile: function (sch, parentSchema) { - var min = sch[0]; - var max = sch[1]; - - return parentSchema.exclusiveRange === true - ? function (data) { return data > min && data < max; } - : function (data) { return data >= min && data <= max; } - } -}); - -var schema = { "range": [2, 4], "exclusiveRange": true }; -var validate = ajv.compile(schema); -console.log(validate(2.01)); // true -console.log(validate(3.99)); // true -console.log(validate(2)); // false -console.log(validate(4)); // false -``` - -Several custom keywords (typeof, instanceof, range and propertyNames) are defined in [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package - they can be used for your schemas and as a starting point for your own custom keywords. - -See [Defining custom keywords](https://github.com/ajv-validator/ajv/blob/master/CUSTOM.md) for more details. - - -## Asynchronous schema compilation - -During asynchronous compilation remote references are loaded using supplied function. See `compileAsync` [method](#api-compileAsync) and `loadSchema` [option](#options). - -Example: - -```javascript -var ajv = new Ajv({ loadSchema: loadSchema }); - -ajv.compileAsync(schema).then(function (validate) { - var valid = validate(data); - // ... -}); - -function loadSchema(uri) { - return request.json(uri).then(function (res) { - if (res.statusCode >= 400) - throw new Error('Loading error: ' + res.statusCode); - return res.body; - }); -} -``` - -__Please note__: [Option](#options) `missingRefs` should NOT be set to `"ignore"` or `"fail"` for asynchronous compilation to work. - - -## Asynchronous validation - -Example in Node.js REPL: https://tonicdev.com/esp/ajv-asynchronous-validation - -You can define custom formats and keywords that perform validation asynchronously by accessing database or some other service. You should add `async: true` in the keyword or format definition (see [addFormat](#api-addformat), [addKeyword](#api-addkeyword) and [Defining custom keywords](#defining-custom-keywords)). - -If your schema uses asynchronous formats/keywords or refers to some schema that contains them it should have `"$async": true` keyword so that Ajv can compile it correctly. If asynchronous format/keyword or reference to asynchronous schema is used in the schema without `$async` keyword Ajv will throw an exception during schema compilation. - -__Please note__: all asynchronous subschemas that are referenced from the current or other schemas should have `"$async": true` keyword as well, otherwise the schema compilation will fail. - -Validation function for an asynchronous custom format/keyword should return a promise that resolves with `true` or `false` (or rejects with `new Ajv.ValidationError(errors)` if you want to return custom errors from the keyword function). - -Ajv compiles asynchronous schemas to [es7 async functions](http://tc39.github.io/ecmascript-asyncawait/) that can optionally be transpiled with [nodent](https://github.com/MatAtBread/nodent). Async functions are supported in Node.js 7+ and all modern browsers. You can also supply any other transpiler as a function via `processCode` option. See [Options](#options). - -The compiled validation function has `$async: true` property (if the schema is asynchronous), so you can differentiate these functions if you are using both synchronous and asynchronous schemas. - -Validation result will be a promise that resolves with validated data or rejects with an exception `Ajv.ValidationError` that contains the array of validation errors in `errors` property. - - -Example: - -```javascript -var ajv = new Ajv; -// require('ajv-async')(ajv); - -ajv.addKeyword('idExists', { - async: true, - type: 'number', - validate: checkIdExists -}); - - -function checkIdExists(schema, data) { - return knex(schema.table) - .select('id') - .where('id', data) - .then(function (rows) { - return !!rows.length; // true if record is found - }); -} - -var schema = { - "$async": true, - "properties": { - "userId": { - "type": "integer", - "idExists": { "table": "users" } - }, - "postId": { - "type": "integer", - "idExists": { "table": "posts" } - } - } -}; - -var validate = ajv.compile(schema); - -validate({ userId: 1, postId: 19 }) -.then(function (data) { - console.log('Data is valid', data); // { userId: 1, postId: 19 } -}) -.catch(function (err) { - if (!(err instanceof Ajv.ValidationError)) throw err; - // data is invalid - console.log('Validation errors:', err.errors); -}); -``` - -### Using transpilers with asynchronous validation functions. - -[ajv-async](https://github.com/ajv-validator/ajv-async) uses [nodent](https://github.com/MatAtBread/nodent) to transpile async functions. To use another transpiler you should separately install it (or load its bundle in the browser). - - -#### Using nodent - -```javascript -var ajv = new Ajv; -require('ajv-async')(ajv); -// in the browser if you want to load ajv-async bundle separately you can: -// window.ajvAsync(ajv); -var validate = ajv.compile(schema); // transpiled es7 async function -validate(data).then(successFunc).catch(errorFunc); -``` - - -#### Using other transpilers - -```javascript -var ajv = new Ajv({ processCode: transpileFunc }); -var validate = ajv.compile(schema); // transpiled es7 async function -validate(data).then(successFunc).catch(errorFunc); -``` - -See [Options](#options). - - -## Security considerations - -JSON Schema, if properly used, can replace data sanitisation. It doesn't replace other API security considerations. It also introduces additional security aspects to consider. - - -##### Security contact - -To report a security vulnerability, please use the -[Tidelift security contact](https://tidelift.com/security). -Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerabilities via GitHub issues. - - -##### Untrusted schemas - -Ajv treats JSON schemas as trusted as your application code. This security model is based on the most common use case, when the schemas are static and bundled together with the application. - -If your schemas are received from untrusted sources (or generated from untrusted data) there are several scenarios you need to prevent: -- compiling schemas can cause stack overflow (if they are too deep) -- compiling schemas can be slow (e.g. [#557](https://github.com/ajv-validator/ajv/issues/557)) -- validating certain data can be slow - -It is difficult to predict all the scenarios, but at the very least it may help to limit the size of untrusted schemas (e.g. limit JSON string length) and also the maximum schema object depth (that can be high for relatively small JSON strings). You also may want to mitigate slow regular expressions in `pattern` and `patternProperties` keywords. - -Regardless the measures you take, using untrusted schemas increases security risks. - - -##### Circular references in JavaScript objects - -Ajv does not support schemas and validated data that have circular references in objects. See [issue #802](https://github.com/ajv-validator/ajv/issues/802). - -An attempt to compile such schemas or validate such data would cause stack overflow (or will not complete in case of asynchronous validation). Depending on the parser you use, untrusted data can lead to circular references. - - -##### Security risks of trusted schemas - -Some keywords in JSON Schemas can lead to very slow validation for certain data. These keywords include (but may be not limited to): - -- `pattern` and `format` for large strings - in some cases using `maxLength` can help mitigate it, but certain regular expressions can lead to exponential validation time even with relatively short strings (see [ReDoS attack](#redos-attack)). -- `patternProperties` for large property names - use `propertyNames` to mitigate, but some regular expressions can have exponential evaluation time as well. -- `uniqueItems` for large non-scalar arrays - use `maxItems` to mitigate - -__Please note__: The suggestions above to prevent slow validation would only work if you do NOT use `allErrors: true` in production code (using it would continue validation after validation errors). - -You can validate your JSON schemas against [this meta-schema](https://github.com/ajv-validator/ajv/blob/master/lib/refs/json-schema-secure.json) to check that these recommendations are followed: - -```javascript -const isSchemaSecure = ajv.compile(require('ajv/lib/refs/json-schema-secure.json')); - -const schema1 = {format: 'email'}; -isSchemaSecure(schema1); // false - -const schema2 = {format: 'email', maxLength: MAX_LENGTH}; -isSchemaSecure(schema2); // true -``` - -__Please note__: following all these recommendation is not a guarantee that validation of untrusted data is safe - it can still lead to some undesirable results. - - -##### Content Security Policies (CSP) -See [Ajv and Content Security Policies (CSP)](#ajv-and-content-security-policies-csp) - - -## ReDoS attack - -Certain regular expressions can lead to the exponential evaluation time even with relatively short strings. - -Please assess the regular expressions you use in the schemas on their vulnerability to this attack - see [safe-regex](https://github.com/substack/safe-regex), for example. - -__Please note__: some formats that Ajv implements use [regular expressions](https://github.com/ajv-validator/ajv/blob/master/lib/compile/formats.js) that can be vulnerable to ReDoS attack, so if you use Ajv to validate data from untrusted sources __it is strongly recommended__ to consider the following: - -- making assessment of "format" implementations in Ajv. -- using `format: 'fast'` option that simplifies some of the regular expressions (although it does not guarantee that they are safe). -- replacing format implementations provided by Ajv with your own implementations of "format" keyword that either uses different regular expressions or another approach to format validation. Please see [addFormat](#api-addformat) method. -- disabling format validation by ignoring "format" keyword with option `format: false` - -Whatever mitigation you choose, please assume all formats provided by Ajv as potentially unsafe and make your own assessment of their suitability for your validation scenarios. - - -## Filtering data - -With [option `removeAdditional`](#options) (added by [andyscott](https://github.com/andyscott)) you can filter data during the validation. - -This option modifies original data. - -Example: - -```javascript -var ajv = new Ajv({ removeAdditional: true }); -var schema = { - "additionalProperties": false, - "properties": { - "foo": { "type": "number" }, - "bar": { - "additionalProperties": { "type": "number" }, - "properties": { - "baz": { "type": "string" } - } - } - } -} - -var data = { - "foo": 0, - "additional1": 1, // will be removed; `additionalProperties` == false - "bar": { - "baz": "abc", - "additional2": 2 // will NOT be removed; `additionalProperties` != false - }, -} - -var validate = ajv.compile(schema); - -console.log(validate(data)); // true -console.log(data); // { "foo": 0, "bar": { "baz": "abc", "additional2": 2 } -``` - -If `removeAdditional` option in the example above were `"all"` then both `additional1` and `additional2` properties would have been removed. - -If the option were `"failing"` then property `additional1` would have been removed regardless of its value and property `additional2` would have been removed only if its value were failing the schema in the inner `additionalProperties` (so in the example above it would have stayed because it passes the schema, but any non-number would have been removed). - -__Please note__: If you use `removeAdditional` option with `additionalProperties` keyword inside `anyOf`/`oneOf` keywords your validation can fail with this schema, for example: - -```json -{ - "type": "object", - "oneOf": [ - { - "properties": { - "foo": { "type": "string" } - }, - "required": [ "foo" ], - "additionalProperties": false - }, - { - "properties": { - "bar": { "type": "integer" } - }, - "required": [ "bar" ], - "additionalProperties": false - } - ] -} -``` - -The intention of the schema above is to allow objects with either the string property "foo" or the integer property "bar", but not with both and not with any other properties. - -With the option `removeAdditional: true` the validation will pass for the object `{ "foo": "abc"}` but will fail for the object `{"bar": 1}`. It happens because while the first subschema in `oneOf` is validated, the property `bar` is removed because it is an additional property according to the standard (because it is not included in `properties` keyword in the same schema). - -While this behaviour is unexpected (issues [#129](https://github.com/ajv-validator/ajv/issues/129), [#134](https://github.com/ajv-validator/ajv/issues/134)), it is correct. To have the expected behaviour (both objects are allowed and additional properties are removed) the schema has to be refactored in this way: - -```json -{ - "type": "object", - "properties": { - "foo": { "type": "string" }, - "bar": { "type": "integer" } - }, - "additionalProperties": false, - "oneOf": [ - { "required": [ "foo" ] }, - { "required": [ "bar" ] } - ] -} -``` - -The schema above is also more efficient - it will compile into a faster function. - - -## Assigning defaults - -With [option `useDefaults`](#options) Ajv will assign values from `default` keyword in the schemas of `properties` and `items` (when it is the array of schemas) to the missing properties and items. - -With the option value `"empty"` properties and items equal to `null` or `""` (empty string) will be considered missing and assigned defaults. - -This option modifies original data. - -__Please note__: the default value is inserted in the generated validation code as a literal, so the value inserted in the data will be the deep clone of the default in the schema. - - -Example 1 (`default` in `properties`): - -```javascript -var ajv = new Ajv({ useDefaults: true }); -var schema = { - "type": "object", - "properties": { - "foo": { "type": "number" }, - "bar": { "type": "string", "default": "baz" } - }, - "required": [ "foo", "bar" ] -}; - -var data = { "foo": 1 }; - -var validate = ajv.compile(schema); - -console.log(validate(data)); // true -console.log(data); // { "foo": 1, "bar": "baz" } -``` - -Example 2 (`default` in `items`): - -```javascript -var schema = { - "type": "array", - "items": [ - { "type": "number" }, - { "type": "string", "default": "foo" } - ] -} - -var data = [ 1 ]; - -var validate = ajv.compile(schema); - -console.log(validate(data)); // true -console.log(data); // [ 1, "foo" ] -``` - -`default` keywords in other cases are ignored: - -- not in `properties` or `items` subschemas -- in schemas inside `anyOf`, `oneOf` and `not` (see [#42](https://github.com/ajv-validator/ajv/issues/42)) -- in `if` subschema of `switch` keyword -- in schemas generated by custom macro keywords - -The [`strictDefaults` option](#options) customizes Ajv's behavior for the defaults that Ajv ignores (`true` raises an error, and `"log"` outputs a warning). - - -## Coercing data types - -When you are validating user inputs all your data properties are usually strings. The option `coerceTypes` allows you to have your data types coerced to the types specified in your schema `type` keywords, both to pass the validation and to use the correctly typed data afterwards. - -This option modifies original data. - -__Please note__: if you pass a scalar value to the validating function its type will be coerced and it will pass the validation, but the value of the variable you pass won't be updated because scalars are passed by value. - - -Example 1: - -```javascript -var ajv = new Ajv({ coerceTypes: true }); -var schema = { - "type": "object", - "properties": { - "foo": { "type": "number" }, - "bar": { "type": "boolean" } - }, - "required": [ "foo", "bar" ] -}; - -var data = { "foo": "1", "bar": "false" }; - -var validate = ajv.compile(schema); - -console.log(validate(data)); // true -console.log(data); // { "foo": 1, "bar": false } -``` - -Example 2 (array coercions): - -```javascript -var ajv = new Ajv({ coerceTypes: 'array' }); -var schema = { - "properties": { - "foo": { "type": "array", "items": { "type": "number" } }, - "bar": { "type": "boolean" } - } -}; - -var data = { "foo": "1", "bar": ["false"] }; - -var validate = ajv.compile(schema); - -console.log(validate(data)); // true -console.log(data); // { "foo": [1], "bar": false } -``` - -The coercion rules, as you can see from the example, are different from JavaScript both to validate user input as expected and to have the coercion reversible (to correctly validate cases where different types are defined in subschemas of "anyOf" and other compound keywords). - -See [Coercion rules](https://github.com/ajv-validator/ajv/blob/master/COERCION.md) for details. - - -## API - -##### new Ajv(Object options) -> Object - -Create Ajv instance. - - -##### .compile(Object schema) -> Function<Object data> - -Generate validating function and cache the compiled schema for future use. - -Validating function returns a boolean value. This function has properties `errors` and `schema`. Errors encountered during the last validation are assigned to `errors` property (it is assigned `null` if there was no errors). `schema` property contains the reference to the original schema. - -The schema passed to this method will be validated against meta-schema unless `validateSchema` option is false. If schema is invalid, an error will be thrown. See [options](#options). - - -##### .compileAsync(Object schema [, Boolean meta] [, Function callback]) -> Promise - -Asynchronous version of `compile` method that loads missing remote schemas using asynchronous function in `options.loadSchema`. This function returns a Promise that resolves to a validation function. An optional callback passed to `compileAsync` will be called with 2 parameters: error (or null) and validating function. The returned promise will reject (and the callback will be called with an error) when: - -- missing schema can't be loaded (`loadSchema` returns a Promise that rejects). -- a schema containing a missing reference is loaded, but the reference cannot be resolved. -- schema (or some loaded/referenced schema) is invalid. - -The function compiles schema and loads the first missing schema (or meta-schema) until all missing schemas are loaded. - -You can asynchronously compile meta-schema by passing `true` as the second parameter. - -See example in [Asynchronous compilation](#asynchronous-schema-compilation). - - -##### .validate(Object schema|String key|String ref, data) -> Boolean - -Validate data using passed schema (it will be compiled and cached). - -Instead of the schema you can use the key that was previously passed to `addSchema`, the schema id if it was present in the schema or any previously resolved reference. - -Validation errors will be available in the `errors` property of Ajv instance (`null` if there were no errors). - -__Please note__: every time this method is called the errors are overwritten so you need to copy them to another variable if you want to use them later. - -If the schema is asynchronous (has `$async` keyword on the top level) this method returns a Promise. See [Asynchronous validation](#asynchronous-validation). - - -##### .addSchema(Array<Object>|Object schema [, String key]) -> Ajv - -Add schema(s) to validator instance. This method does not compile schemas (but it still validates them). Because of that dependencies can be added in any order and circular dependencies are supported. It also prevents unnecessary compilation of schemas that are containers for other schemas but not used as a whole. - -Array of schemas can be passed (schemas should have ids), the second parameter will be ignored. - -Key can be passed that can be used to reference the schema and will be used as the schema id if there is no id inside the schema. If the key is not passed, the schema id will be used as the key. - - -Once the schema is added, it (and all the references inside it) can be referenced in other schemas and used to validate data. - -Although `addSchema` does not compile schemas, explicit compilation is not required - the schema will be compiled when it is used first time. - -By default the schema is validated against meta-schema before it is added, and if the schema does not pass validation the exception is thrown. This behaviour is controlled by `validateSchema` option. - -__Please note__: Ajv uses the [method chaining syntax](https://en.wikipedia.org/wiki/Method_chaining) for all methods with the prefix `add*` and `remove*`. -This allows you to do nice things like the following. - -```javascript -var validate = new Ajv().addSchema(schema).addFormat(name, regex).getSchema(uri); -``` - -##### .addMetaSchema(Array<Object>|Object schema [, String key]) -> Ajv - -Adds meta schema(s) that can be used to validate other schemas. That function should be used instead of `addSchema` because there may be instance options that would compile a meta schema incorrectly (at the moment it is `removeAdditional` option). - -There is no need to explicitly add draft-07 meta schema (http://json-schema.org/draft-07/schema) - it is added by default, unless option `meta` is set to `false`. You only need to use it if you have a changed meta-schema that you want to use to validate your schemas. See `validateSchema`. - - -##### .validateSchema(Object schema) -> Boolean - -Validates schema. This method should be used to validate schemas rather than `validate` due to the inconsistency of `uri` format in JSON Schema standard. - -By default this method is called automatically when the schema is added, so you rarely need to use it directly. - -If schema doesn't have `$schema` property, it is validated against draft 6 meta-schema (option `meta` should not be false). - -If schema has `$schema` property, then the schema with this id (that should be previously added) is used to validate passed schema. - -Errors will be available at `ajv.errors`. - - -##### .getSchema(String key) -> Function<Object data> - -Retrieve compiled schema previously added with `addSchema` by the key passed to `addSchema` or by its full reference (id). The returned validating function has `schema` property with the reference to the original schema. - - -##### .removeSchema([Object schema|String key|String ref|RegExp pattern]) -> Ajv - -Remove added/cached schema. Even if schema is referenced by other schemas it can be safely removed as dependent schemas have local references. - -Schema can be removed using: -- key passed to `addSchema` -- it's full reference (id) -- RegExp that should match schema id or key (meta-schemas won't be removed) -- actual schema object that will be stable-stringified to remove schema from cache - -If no parameter is passed all schemas but meta-schemas will be removed and the cache will be cleared. - - -##### .addFormat(String name, String|RegExp|Function|Object format) -> Ajv - -Add custom format to validate strings or numbers. It can also be used to replace pre-defined formats for Ajv instance. - -Strings are converted to RegExp. - -Function should return validation result as `true` or `false`. - -If object is passed it should have properties `validate`, `compare` and `async`: - -- _validate_: a string, RegExp or a function as described above. -- _compare_: an optional comparison function that accepts two strings and compares them according to the format meaning. This function is used with keywords `formatMaximum`/`formatMinimum` (defined in [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package). It should return `1` if the first value is bigger than the second value, `-1` if it is smaller and `0` if it is equal. -- _async_: an optional `true` value if `validate` is an asynchronous function; in this case it should return a promise that resolves with a value `true` or `false`. -- _type_: an optional type of data that the format applies to. It can be `"string"` (default) or `"number"` (see https://github.com/ajv-validator/ajv/issues/291#issuecomment-259923858). If the type of data is different, the validation will pass. - -Custom formats can be also added via `formats` option. - - -##### .addKeyword(String keyword, Object definition) -> Ajv - -Add custom validation keyword to Ajv instance. - -Keyword should be different from all standard JSON Schema keywords and different from previously defined keywords. There is no way to redefine keywords or to remove keyword definition from the instance. - -Keyword must start with a letter, `_` or `$`, and may continue with letters, numbers, `_`, `$`, or `-`. -It is recommended to use an application-specific prefix for keywords to avoid current and future name collisions. - -Example Keywords: -- `"xyz-example"`: valid, and uses prefix for the xyz project to avoid name collisions. -- `"example"`: valid, but not recommended as it could collide with future versions of JSON Schema etc. -- `"3-example"`: invalid as numbers are not allowed to be the first character in a keyword - -Keyword definition is an object with the following properties: - -- _type_: optional string or array of strings with data type(s) that the keyword applies to. If not present, the keyword will apply to all types. -- _validate_: validating function -- _compile_: compiling function -- _macro_: macro function -- _inline_: compiling function that returns code (as string) -- _schema_: an optional `false` value used with "validate" keyword to not pass schema -- _metaSchema_: an optional meta-schema for keyword schema -- _dependencies_: an optional list of properties that must be present in the parent schema - it will be checked during schema compilation -- _modifying_: `true` MUST be passed if keyword modifies data -- _statements_: `true` can be passed in case inline keyword generates statements (as opposed to expression) -- _valid_: pass `true`/`false` to pre-define validation result, the result returned from validation function will be ignored. This option cannot be used with macro keywords. -- _$data_: an optional `true` value to support [$data reference](#data-reference) as the value of custom keyword. The reference will be resolved at validation time. If the keyword has meta-schema it would be extended to allow $data and it will be used to validate the resolved value. Supporting $data reference requires that keyword has validating function (as the only option or in addition to compile, macro or inline function). -- _async_: an optional `true` value if the validation function is asynchronous (whether it is compiled or passed in _validate_ property); in this case it should return a promise that resolves with a value `true` or `false`. This option is ignored in case of "macro" and "inline" keywords. -- _errors_: an optional boolean or string `"full"` indicating whether keyword returns errors. If this property is not set Ajv will determine if the errors were set in case of failed validation. - -_compile_, _macro_ and _inline_ are mutually exclusive, only one should be used at a time. _validate_ can be used separately or in addition to them to support $data reference. - -__Please note__: If the keyword is validating data type that is different from the type(s) in its definition, the validation function will not be called (and expanded macro will not be used), so there is no need to check for data type inside validation function or inside schema returned by macro function (unless you want to enforce a specific type and for some reason do not want to use a separate `type` keyword for that). In the same way as standard keywords work, if the keyword does not apply to the data type being validated, the validation of this keyword will succeed. - -See [Defining custom keywords](#defining-custom-keywords) for more details. - - -##### .getKeyword(String keyword) -> Object|Boolean - -Returns custom keyword definition, `true` for pre-defined keywords and `false` if the keyword is unknown. - - -##### .removeKeyword(String keyword) -> Ajv - -Removes custom or pre-defined keyword so you can redefine them. - -While this method can be used to extend pre-defined keywords, it can also be used to completely change their meaning - it may lead to unexpected results. - -__Please note__: schemas compiled before the keyword is removed will continue to work without changes. To recompile schemas use `removeSchema` method and compile them again. - - -##### .errorsText([Array<Object> errors [, Object options]]) -> String - -Returns the text with all errors in a String. - -Options can have properties `separator` (string used to separate errors, ", " by default) and `dataVar` (the variable name that dataPaths are prefixed with, "data" by default). - - -## Options - -Defaults: - -```javascript -{ - // validation and reporting options: - $data: false, - allErrors: false, - verbose: false, - $comment: false, // NEW in Ajv version 6.0 - jsonPointers: false, - uniqueItems: true, - unicode: true, - nullable: false, - format: 'fast', - formats: {}, - unknownFormats: true, - schemas: {}, - logger: undefined, - // referenced schema options: - schemaId: '$id', - missingRefs: true, - extendRefs: 'ignore', // recommended 'fail' - loadSchema: undefined, // function(uri: string): Promise {} - // options to modify validated data: - removeAdditional: false, - useDefaults: false, - coerceTypes: false, - // strict mode options - strictDefaults: false, - strictKeywords: false, - strictNumbers: false, - // asynchronous validation options: - transpile: undefined, // requires ajv-async package - // advanced options: - meta: true, - validateSchema: true, - addUsedSchema: true, - inlineRefs: true, - passContext: false, - loopRequired: Infinity, - ownProperties: false, - multipleOfPrecision: false, - errorDataPath: 'object', // deprecated - messages: true, - sourceCode: false, - processCode: undefined, // function (str: string, schema: object): string {} - cache: new Cache, - serialize: undefined -} -``` - -##### Validation and reporting options - -- _$data_: support [$data references](#data-reference). Draft 6 meta-schema that is added by default will be extended to allow them. If you want to use another meta-schema you need to use $dataMetaSchema method to add support for $data reference. See [API](#api). -- _allErrors_: check all rules collecting all errors. Default is to return after the first error. -- _verbose_: include the reference to the part of the schema (`schema` and `parentSchema`) and validated data in errors (false by default). -- _$comment_ (NEW in Ajv version 6.0): log or pass the value of `$comment` keyword to a function. Option values: - - `false` (default): ignore $comment keyword. - - `true`: log the keyword value to console. - - function: pass the keyword value, its schema path and root schema to the specified function -- _jsonPointers_: set `dataPath` property of errors using [JSON Pointers](https://tools.ietf.org/html/rfc6901) instead of JavaScript property access notation. -- _uniqueItems_: validate `uniqueItems` keyword (true by default). -- _unicode_: calculate correct length of strings with unicode pairs (true by default). Pass `false` to use `.length` of strings that is faster, but gives "incorrect" lengths of strings with unicode pairs - each unicode pair is counted as two characters. -- _nullable_: support keyword "nullable" from [Open API 3 specification](https://swagger.io/docs/specification/data-models/data-types/). -- _format_: formats validation mode. Option values: - - `"fast"` (default) - simplified and fast validation (see [Formats](#formats) for details of which formats are available and affected by this option). - - `"full"` - more restrictive and slow validation. E.g., 25:00:00 and 2015/14/33 will be invalid time and date in 'full' mode but it will be valid in 'fast' mode. - - `false` - ignore all format keywords. -- _formats_: an object with custom formats. Keys and values will be passed to `addFormat` method. -- _keywords_: an object with custom keywords. Keys and values will be passed to `addKeyword` method. -- _unknownFormats_: handling of unknown formats. Option values: - - `true` (default) - if an unknown format is encountered the exception is thrown during schema compilation. If `format` keyword value is [$data reference](#data-reference) and it is unknown the validation will fail. - - `[String]` - an array of unknown format names that will be ignored. This option can be used to allow usage of third party schemas with format(s) for which you don't have definitions, but still fail if another unknown format is used. If `format` keyword value is [$data reference](#data-reference) and it is not in this array the validation will fail. - - `"ignore"` - to log warning during schema compilation and always pass validation (the default behaviour in versions before 5.0.0). This option is not recommended, as it allows to mistype format name and it won't be validated without any error message. This behaviour is required by JSON Schema specification. -- _schemas_: an array or object of schemas that will be added to the instance. In case you pass the array the schemas must have IDs in them. When the object is passed the method `addSchema(value, key)` will be called for each schema in this object. -- _logger_: sets the logging method. Default is the global `console` object that should have methods `log`, `warn` and `error`. See [Error logging](#error-logging). Option values: - - custom logger - it should have methods `log`, `warn` and `error`. If any of these methods is missing an exception will be thrown. - - `false` - logging is disabled. - - -##### Referenced schema options - -- _schemaId_: this option defines which keywords are used as schema URI. Option value: - - `"$id"` (default) - only use `$id` keyword as schema URI (as specified in JSON Schema draft-06/07), ignore `id` keyword (if it is present a warning will be logged). - - `"id"` - only use `id` keyword as schema URI (as specified in JSON Schema draft-04), ignore `$id` keyword (if it is present a warning will be logged). - - `"auto"` - use both `$id` and `id` keywords as schema URI. If both are present (in the same schema object) and different the exception will be thrown during schema compilation. -- _missingRefs_: handling of missing referenced schemas. Option values: - - `true` (default) - if the reference cannot be resolved during compilation the exception is thrown. The thrown error has properties `missingRef` (with hash fragment) and `missingSchema` (without it). Both properties are resolved relative to the current base id (usually schema id, unless it was substituted). - - `"ignore"` - to log error during compilation and always pass validation. - - `"fail"` - to log error and successfully compile schema but fail validation if this rule is checked. -- _extendRefs_: validation of other keywords when `$ref` is present in the schema. Option values: - - `"ignore"` (default) - when `$ref` is used other keywords are ignored (as per [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03#section-3) standard). A warning will be logged during the schema compilation. - - `"fail"` (recommended) - if other validation keywords are used together with `$ref` the exception will be thrown when the schema is compiled. This option is recommended to make sure schema has no keywords that are ignored, which can be confusing. - - `true` - validate all keywords in the schemas with `$ref` (the default behaviour in versions before 5.0.0). -- _loadSchema_: asynchronous function that will be used to load remote schemas when `compileAsync` [method](#api-compileAsync) is used and some reference is missing (option `missingRefs` should NOT be 'fail' or 'ignore'). This function should accept remote schema uri as a parameter and return a Promise that resolves to a schema. See example in [Asynchronous compilation](#asynchronous-schema-compilation). - - -##### Options to modify validated data - -- _removeAdditional_: remove additional properties - see example in [Filtering data](#filtering-data). This option is not used if schema is added with `addMetaSchema` method. Option values: - - `false` (default) - not to remove additional properties - - `"all"` - all additional properties are removed, regardless of `additionalProperties` keyword in schema (and no validation is made for them). - - `true` - only additional properties with `additionalProperties` keyword equal to `false` are removed. - - `"failing"` - additional properties that fail schema validation will be removed (where `additionalProperties` keyword is `false` or schema). -- _useDefaults_: replace missing or undefined properties and items with the values from corresponding `default` keywords. Default behaviour is to ignore `default` keywords. This option is not used if schema is added with `addMetaSchema` method. See examples in [Assigning defaults](#assigning-defaults). Option values: - - `false` (default) - do not use defaults - - `true` - insert defaults by value (object literal is used). - - `"empty"` - in addition to missing or undefined, use defaults for properties and items that are equal to `null` or `""` (an empty string). - - `"shared"` (deprecated) - insert defaults by reference. If the default is an object, it will be shared by all instances of validated data. If you modify the inserted default in the validated data, it will be modified in the schema as well. -- _coerceTypes_: change data type of data to match `type` keyword. See the example in [Coercing data types](#coercing-data-types) and [coercion rules](https://github.com/ajv-validator/ajv/blob/master/COERCION.md). Option values: - - `false` (default) - no type coercion. - - `true` - coerce scalar data types. - - `"array"` - in addition to coercions between scalar types, coerce scalar data to an array with one element and vice versa (as required by the schema). - - -##### Strict mode options - -- _strictDefaults_: report ignored `default` keywords in schemas. Option values: - - `false` (default) - ignored defaults are not reported - - `true` - if an ignored default is present, throw an error - - `"log"` - if an ignored default is present, log warning -- _strictKeywords_: report unknown keywords in schemas. Option values: - - `false` (default) - unknown keywords are not reported - - `true` - if an unknown keyword is present, throw an error - - `"log"` - if an unknown keyword is present, log warning -- _strictNumbers_: validate numbers strictly, failing validation for NaN and Infinity. Option values: - - `false` (default) - NaN or Infinity will pass validation for numeric types - - `true` - NaN or Infinity will not pass validation for numeric types - -##### Asynchronous validation options - -- _transpile_: Requires [ajv-async](https://github.com/ajv-validator/ajv-async) package. It determines whether Ajv transpiles compiled asynchronous validation function. Option values: - - `undefined` (default) - transpile with [nodent](https://github.com/MatAtBread/nodent) if async functions are not supported. - - `true` - always transpile with nodent. - - `false` - do not transpile; if async functions are not supported an exception will be thrown. - - -##### Advanced options - -- _meta_: add [meta-schema](http://json-schema.org/documentation.html) so it can be used by other schemas (true by default). If an object is passed, it will be used as the default meta-schema for schemas that have no `$schema` keyword. This default meta-schema MUST have `$schema` keyword. -- _validateSchema_: validate added/compiled schemas against meta-schema (true by default). `$schema` property in the schema can be http://json-schema.org/draft-07/schema or absent (draft-07 meta-schema will be used) or can be a reference to the schema previously added with `addMetaSchema` method. Option values: - - `true` (default) - if the validation fails, throw the exception. - - `"log"` - if the validation fails, log error. - - `false` - skip schema validation. -- _addUsedSchema_: by default methods `compile` and `validate` add schemas to the instance if they have `$id` (or `id`) property that doesn't start with "#". If `$id` is present and it is not unique the exception will be thrown. Set this option to `false` to skip adding schemas to the instance and the `$id` uniqueness check when these methods are used. This option does not affect `addSchema` method. -- _inlineRefs_: Affects compilation of referenced schemas. Option values: - - `true` (default) - the referenced schemas that don't have refs in them are inlined, regardless of their size - that substantially improves performance at the cost of the bigger size of compiled schema functions. - - `false` - to not inline referenced schemas (they will be compiled as separate functions). - - integer number - to limit the maximum number of keywords of the schema that will be inlined. -- _passContext_: pass validation context to custom keyword functions. If this option is `true` and you pass some context to the compiled validation function with `validate.call(context, data)`, the `context` will be available as `this` in your custom keywords. By default `this` is Ajv instance. -- _loopRequired_: by default `required` keyword is compiled into a single expression (or a sequence of statements in `allErrors` mode). In case of a very large number of properties in this keyword it may result in a very big validation function. Pass integer to set the number of properties above which `required` keyword will be validated in a loop - smaller validation function size but also worse performance. -- _ownProperties_: by default Ajv iterates over all enumerable object properties; when this option is `true` only own enumerable object properties (i.e. found directly on the object rather than on its prototype) are iterated. Contributed by @mbroadst. -- _multipleOfPrecision_: by default `multipleOf` keyword is validated by comparing the result of division with parseInt() of that result. It works for dividers that are bigger than 1. For small dividers such as 0.01 the result of the division is usually not integer (even when it should be integer, see issue [#84](https://github.com/ajv-validator/ajv/issues/84)). If you need to use fractional dividers set this option to some positive integer N to have `multipleOf` validated using this formula: `Math.abs(Math.round(division) - division) < 1e-N` (it is slower but allows for float arithmetics deviations). -- _errorDataPath_ (deprecated): set `dataPath` to point to 'object' (default) or to 'property' when validating keywords `required`, `additionalProperties` and `dependencies`. -- _messages_: Include human-readable messages in errors. `true` by default. `false` can be passed when custom messages are used (e.g. with [ajv-i18n](https://github.com/ajv-validator/ajv-i18n)). -- _sourceCode_: add `sourceCode` property to validating function (for debugging; this code can be different from the result of toString call). -- _processCode_: an optional function to process generated code before it is passed to Function constructor. It can be used to either beautify (the validating function is generated without line-breaks) or to transpile code. Starting from version 5.0.0 this option replaced options: - - `beautify` that formatted the generated function using [js-beautify](https://github.com/beautify-web/js-beautify). If you want to beautify the generated code pass a function calling `require('js-beautify').js_beautify` as `processCode: code => js_beautify(code)`. - - `transpile` that transpiled asynchronous validation function. You can still use `transpile` option with [ajv-async](https://github.com/ajv-validator/ajv-async) package. See [Asynchronous validation](#asynchronous-validation) for more information. -- _cache_: an optional instance of cache to store compiled schemas using stable-stringified schema as a key. For example, set-associative cache [sacjs](https://github.com/epoberezkin/sacjs) can be used. If not passed then a simple hash is used which is good enough for the common use case (a limited number of statically defined schemas). Cache should have methods `put(key, value)`, `get(key)`, `del(key)` and `clear()`. -- _serialize_: an optional function to serialize schema to cache key. Pass `false` to use schema itself as a key (e.g., if WeakMap used as a cache). By default [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used. - - -## Validation errors - -In case of validation failure, Ajv assigns the array of errors to `errors` property of validation function (or to `errors` property of Ajv instance when `validate` or `validateSchema` methods were called). In case of [asynchronous validation](#asynchronous-validation), the returned promise is rejected with exception `Ajv.ValidationError` that has `errors` property. - - -### Error objects - -Each error is an object with the following properties: - -- _keyword_: validation keyword. -- _dataPath_: the path to the part of the data that was validated. By default `dataPath` uses JavaScript property access notation (e.g., `".prop[1].subProp"`). When the option `jsonPointers` is true (see [Options](#options)) `dataPath` will be set using JSON pointer standard (e.g., `"/prop/1/subProp"`). -- _schemaPath_: the path (JSON-pointer as a URI fragment) to the schema of the keyword that failed validation. -- _params_: the object with the additional information about error that can be used to create custom error messages (e.g., using [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) package). See below for parameters set by all keywords. -- _message_: the standard error message (can be excluded with option `messages` set to false). -- _schema_: the schema of the keyword (added with `verbose` option). -- _parentSchema_: the schema containing the keyword (added with `verbose` option) -- _data_: the data validated by the keyword (added with `verbose` option). - -__Please note__: `propertyNames` keyword schema validation errors have an additional property `propertyName`, `dataPath` points to the object. After schema validation for each property name, if it is invalid an additional error is added with the property `keyword` equal to `"propertyNames"`. - - -### Error parameters - -Properties of `params` object in errors depend on the keyword that failed validation. - -- `maxItems`, `minItems`, `maxLength`, `minLength`, `maxProperties`, `minProperties` - property `limit` (number, the schema of the keyword). -- `additionalItems` - property `limit` (the maximum number of allowed items in case when `items` keyword is an array of schemas and `additionalItems` is false). -- `additionalProperties` - property `additionalProperty` (the property not used in `properties` and `patternProperties` keywords). -- `dependencies` - properties: - - `property` (dependent property), - - `missingProperty` (required missing dependency - only the first one is reported currently) - - `deps` (required dependencies, comma separated list as a string), - - `depsCount` (the number of required dependencies). -- `format` - property `format` (the schema of the keyword). -- `maximum`, `minimum` - properties: - - `limit` (number, the schema of the keyword), - - `exclusive` (boolean, the schema of `exclusiveMaximum` or `exclusiveMinimum`), - - `comparison` (string, comparison operation to compare the data to the limit, with the data on the left and the limit on the right; can be "<", "<=", ">", ">=") -- `multipleOf` - property `multipleOf` (the schema of the keyword) -- `pattern` - property `pattern` (the schema of the keyword) -- `required` - property `missingProperty` (required property that is missing). -- `propertyNames` - property `propertyName` (an invalid property name). -- `patternRequired` (in ajv-keywords) - property `missingPattern` (required pattern that did not match any property). -- `type` - property `type` (required type(s), a string, can be a comma-separated list) -- `uniqueItems` - properties `i` and `j` (indices of duplicate items). -- `const` - property `allowedValue` pointing to the value (the schema of the keyword). -- `enum` - property `allowedValues` pointing to the array of values (the schema of the keyword). -- `$ref` - property `ref` with the referenced schema URI. -- `oneOf` - property `passingSchemas` (array of indices of passing schemas, null if no schema passes). -- custom keywords (in case keyword definition doesn't create errors) - property `keyword` (the keyword name). - - -### Error logging - -Using the `logger` option when initiallizing Ajv will allow you to define custom logging. Here you can build upon the exisiting logging. The use of other logging packages is supported as long as the package or its associated wrapper exposes the required methods. If any of the required methods are missing an exception will be thrown. -- **Required Methods**: `log`, `warn`, `error` - -```javascript -var otherLogger = new OtherLogger(); -var ajv = new Ajv({ - logger: { - log: console.log.bind(console), - warn: function warn() { - otherLogger.logWarn.apply(otherLogger, arguments); - }, - error: function error() { - otherLogger.logError.apply(otherLogger, arguments); - console.error.apply(console, arguments); - } - } -}); -``` - - -## Plugins - -Ajv can be extended with plugins that add custom keywords, formats or functions to process generated code. When such plugin is published as npm package it is recommended that it follows these conventions: - -- it exports a function -- this function accepts ajv instance as the first parameter and returns the same instance to allow chaining -- this function can accept an optional configuration as the second parameter - -If you have published a useful plugin please submit a PR to add it to the next section. - - -## Related packages - -- [ajv-async](https://github.com/ajv-validator/ajv-async) - plugin to configure async validation mode -- [ajv-bsontype](https://github.com/BoLaMN/ajv-bsontype) - plugin to validate mongodb's bsonType formats -- [ajv-cli](https://github.com/jessedc/ajv-cli) - command line interface -- [ajv-errors](https://github.com/ajv-validator/ajv-errors) - plugin for custom error messages -- [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) - internationalised error messages -- [ajv-istanbul](https://github.com/ajv-validator/ajv-istanbul) - plugin to instrument generated validation code to measure test coverage of your schemas -- [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) - plugin with custom validation keywords (select, typeof, etc.) -- [ajv-merge-patch](https://github.com/ajv-validator/ajv-merge-patch) - plugin with keywords $merge and $patch -- [ajv-pack](https://github.com/ajv-validator/ajv-pack) - produces a compact module exporting validation functions -- [ajv-formats-draft2019](https://github.com/luzlab/ajv-formats-draft2019) - format validators for draft2019 that aren't already included in ajv (ie. `idn-hostname`, `idn-email`, `iri`, `iri-reference` and `duration`). - -## Some packages using Ajv - -- [webpack](https://github.com/webpack/webpack) - a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser -- [jsonscript-js](https://github.com/JSONScript/jsonscript-js) - the interpreter for [JSONScript](http://www.jsonscript.org) - scripted processing of existing endpoints and services -- [osprey-method-handler](https://github.com/mulesoft-labs/osprey-method-handler) - Express middleware for validating requests and responses based on a RAML method object, used in [osprey](https://github.com/mulesoft/osprey) - validating API proxy generated from a RAML definition -- [har-validator](https://github.com/ahmadnassri/har-validator) - HTTP Archive (HAR) validator -- [jsoneditor](https://github.com/josdejong/jsoneditor) - a web-based tool to view, edit, format, and validate JSON http://jsoneditoronline.org -- [JSON Schema Lint](https://github.com/nickcmaynard/jsonschemalint) - a web tool to validate JSON/YAML document against a single JSON Schema http://jsonschemalint.com -- [objection](https://github.com/vincit/objection.js) - SQL-friendly ORM for Node.js -- [table](https://github.com/gajus/table) - formats data into a string table -- [ripple-lib](https://github.com/ripple/ripple-lib) - a JavaScript API for interacting with [Ripple](https://ripple.com) in Node.js and the browser -- [restbase](https://github.com/wikimedia/restbase) - distributed storage with REST API & dispatcher for backend services built to provide a low-latency & high-throughput API for Wikipedia / Wikimedia content -- [hippie-swagger](https://github.com/CacheControl/hippie-swagger) - [Hippie](https://github.com/vesln/hippie) wrapper that provides end to end API testing with swagger validation -- [react-form-controlled](https://github.com/seeden/react-form-controlled) - React controlled form components with validation -- [rabbitmq-schema](https://github.com/tjmehta/rabbitmq-schema) - a schema definition module for RabbitMQ graphs and messages -- [@query/schema](https://www.npmjs.com/package/@query/schema) - stream filtering with a URI-safe query syntax parsing to JSON Schema -- [chai-ajv-json-schema](https://github.com/peon374/chai-ajv-json-schema) - chai plugin to us JSON Schema with expect in mocha tests -- [grunt-jsonschema-ajv](https://github.com/SignpostMarv/grunt-jsonschema-ajv) - Grunt plugin for validating files against JSON Schema -- [extract-text-webpack-plugin](https://github.com/webpack-contrib/extract-text-webpack-plugin) - extract text from bundle into a file -- [electron-builder](https://github.com/electron-userland/electron-builder) - a solution to package and build a ready for distribution Electron app -- [addons-linter](https://github.com/mozilla/addons-linter) - Mozilla Add-ons Linter -- [gh-pages-generator](https://github.com/epoberezkin/gh-pages-generator) - multi-page site generator converting markdown files to GitHub pages -- [ESLint](https://github.com/eslint/eslint) - the pluggable linting utility for JavaScript and JSX - - -## Tests - -``` -npm install -git submodule update --init -npm test -``` - -## Contributing - -All validation functions are generated using doT templates in [dot](https://github.com/ajv-validator/ajv/tree/master/lib/dot) folder. Templates are precompiled so doT is not a run-time dependency. - -`npm run build` - compiles templates to [dotjs](https://github.com/ajv-validator/ajv/tree/master/lib/dotjs) folder. - -`npm run watch` - automatically compiles templates when files in dot folder change - -Please see [Contributing guidelines](https://github.com/ajv-validator/ajv/blob/master/CONTRIBUTING.md) - - -## Changes history - -See https://github.com/ajv-validator/ajv/releases - -__Please note__: [Changes in version 7.0.0-beta](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0-beta.0) - -[Version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0). - -## Code of conduct - -Please review and follow the [Code of conduct](https://github.com/ajv-validator/ajv/blob/master/CODE_OF_CONDUCT.md). - -Please report any unacceptable behaviour to ajv.validator@gmail.com - it will be reviewed by the project team. - - -## Open-source software support - -Ajv is a part of [Tidelift subscription](https://tidelift.com/subscription/pkg/npm-ajv?utm_source=npm-ajv&utm_medium=referral&utm_campaign=readme) - it provides a centralised support to open-source software users, in addition to the support provided by software maintainers. - - -## License - -[MIT](https://github.com/ajv-validator/ajv/blob/master/LICENSE) diff --git a/node_modules/webpack/node_modules/ajv/dist/ajv.bundle.js b/node_modules/webpack/node_modules/ajv/dist/ajv.bundle.js deleted file mode 100644 index e4d9d15..0000000 --- a/node_modules/webpack/node_modules/ajv/dist/ajv.bundle.js +++ /dev/null @@ -1,7189 +0,0 @@ -(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.Ajv = 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%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i; -// For the source: https://gist.github.com/dperini/729294 -// For test cases: https://mathiasbynens.be/demo/url-regex -// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983. -// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu; -var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i; -var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i; -var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/; -var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i; -var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/; - - -module.exports = formats; - -function formats(mode) { - mode = mode == 'full' ? 'full' : 'fast'; - return util.copy(formats[mode]); -} - - -formats.fast = { - // date: http://tools.ietf.org/html/rfc3339#section-5.6 - date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/, - // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 - time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, - 'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, - // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js - uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i, - 'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i, - 'uri-template': URITEMPLATE, - url: URL, - // email (sources from jsen validator): - // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363 - // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation') - email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i, - hostname: HOSTNAME, - // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html - ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, - // optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses - ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, - regex: regex, - // uuid: http://tools.ietf.org/html/rfc4122 - uuid: UUID, - // JSON-pointer: https://tools.ietf.org/html/rfc6901 - // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A - 'json-pointer': JSON_POINTER, - 'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT, - // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00 - 'relative-json-pointer': RELATIVE_JSON_POINTER -}; - - -formats.full = { - date: date, - time: time, - 'date-time': date_time, - uri: uri, - 'uri-reference': URIREF, - 'uri-template': URITEMPLATE, - url: URL, - email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, - hostname: HOSTNAME, - ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, - ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, - regex: regex, - uuid: UUID, - 'json-pointer': JSON_POINTER, - 'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT, - 'relative-json-pointer': RELATIVE_JSON_POINTER -}; - - -function isLeapYear(year) { - // https://tools.ietf.org/html/rfc3339#appendix-C - return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); -} - - -function date(str) { - // full-date from http://tools.ietf.org/html/rfc3339#section-5.6 - var matches = str.match(DATE); - if (!matches) return false; - - var year = +matches[1]; - var month = +matches[2]; - var day = +matches[3]; - - return month >= 1 && month <= 12 && day >= 1 && - day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]); -} - - -function time(str, full) { - var matches = str.match(TIME); - if (!matches) return false; - - var hour = matches[1]; - var minute = matches[2]; - var second = matches[3]; - var timeZone = matches[5]; - return ((hour <= 23 && minute <= 59 && second <= 59) || - (hour == 23 && minute == 59 && second == 60)) && - (!full || timeZone); -} - - -var DATE_TIME_SEPARATOR = /t|\s/i; -function date_time(str) { - // http://tools.ietf.org/html/rfc3339#section-5.6 - var dateTime = str.split(DATE_TIME_SEPARATOR); - return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true); -} - - -var NOT_URI_FRAGMENT = /\/|:/; -function uri(str) { - // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "." - return NOT_URI_FRAGMENT.test(str) && URI.test(str); -} - - -var Z_ANCHOR = /[^\\]\\Z/; -function regex(str) { - if (Z_ANCHOR.test(str)) return false; - try { - new RegExp(str); - return true; - } catch(e) { - return false; - } -} - -},{"./util":10}],5:[function(require,module,exports){ -'use strict'; - -var resolve = require('./resolve') - , util = require('./util') - , errorClasses = require('./error_classes') - , stableStringify = require('fast-json-stable-stringify'); - -var validateGenerator = require('../dotjs/validate'); - -/** - * Functions below are used inside compiled validations function - */ - -var ucs2length = util.ucs2length; -var equal = require('fast-deep-equal'); - -// this error is thrown by async schemas to return validation errors via exception -var ValidationError = errorClasses.Validation; - -module.exports = compile; - - -/** - * Compiles schema to validation function - * @this Ajv - * @param {Object} schema schema object - * @param {Object} root object with information about the root schema for this schema - * @param {Object} localRefs the hash of local references inside the schema (created by resolve.id), used for inline resolution - * @param {String} baseId base ID for IDs in the schema - * @return {Function} validation function - */ -function compile(schema, root, localRefs, baseId) { - /* jshint validthis: true, evil: true */ - /* eslint no-shadow: 0 */ - var self = this - , opts = this._opts - , refVal = [ undefined ] - , refs = {} - , patterns = [] - , patternsHash = {} - , defaults = [] - , defaultsHash = {} - , customRules = []; - - root = root || { schema: schema, refVal: refVal, refs: refs }; - - var c = checkCompiling.call(this, schema, root, baseId); - var compilation = this._compilations[c.index]; - if (c.compiling) return (compilation.callValidate = callValidate); - - var formats = this._formats; - var RULES = this.RULES; - - try { - var v = localCompile(schema, root, localRefs, baseId); - compilation.validate = v; - var cv = compilation.callValidate; - if (cv) { - cv.schema = v.schema; - cv.errors = null; - cv.refs = v.refs; - cv.refVal = v.refVal; - cv.root = v.root; - cv.$async = v.$async; - if (opts.sourceCode) cv.source = v.source; - } - return v; - } finally { - endCompiling.call(this, schema, root, baseId); - } - - /* @this {*} - custom context, see passContext option */ - function callValidate() { - /* jshint validthis: true */ - var validate = compilation.validate; - var result = validate.apply(this, arguments); - callValidate.errors = validate.errors; - return result; - } - - function localCompile(_schema, _root, localRefs, baseId) { - var isRoot = !_root || (_root && _root.schema == _schema); - if (_root.schema != root.schema) - return compile.call(self, _schema, _root, localRefs, baseId); - - var $async = _schema.$async === true; - - var sourceCode = validateGenerator({ - isTop: true, - schema: _schema, - isRoot: isRoot, - baseId: baseId, - root: _root, - schemaPath: '', - errSchemaPath: '#', - errorPath: '""', - MissingRefError: errorClasses.MissingRef, - RULES: RULES, - validate: validateGenerator, - util: util, - resolve: resolve, - resolveRef: resolveRef, - usePattern: usePattern, - useDefault: useDefault, - useCustomRule: useCustomRule, - opts: opts, - formats: formats, - logger: self.logger, - self: self - }); - - sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode) - + vars(defaults, defaultCode) + vars(customRules, customRuleCode) - + sourceCode; - - if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema); - // console.log('\n\n\n *** \n', JSON.stringify(sourceCode)); - var validate; - try { - var makeValidate = new Function( - 'self', - 'RULES', - 'formats', - 'root', - 'refVal', - 'defaults', - 'customRules', - 'equal', - 'ucs2length', - 'ValidationError', - sourceCode - ); - - validate = makeValidate( - self, - RULES, - formats, - root, - refVal, - defaults, - customRules, - equal, - ucs2length, - ValidationError - ); - - refVal[0] = validate; - } catch(e) { - self.logger.error('Error compiling schema, function code:', sourceCode); - throw e; - } - - validate.schema = _schema; - validate.errors = null; - validate.refs = refs; - validate.refVal = refVal; - validate.root = isRoot ? validate : _root; - if ($async) validate.$async = true; - if (opts.sourceCode === true) { - validate.source = { - code: sourceCode, - patterns: patterns, - defaults: defaults - }; - } - - return validate; - } - - function resolveRef(baseId, ref, isRoot) { - ref = resolve.url(baseId, ref); - var refIndex = refs[ref]; - var _refVal, refCode; - if (refIndex !== undefined) { - _refVal = refVal[refIndex]; - refCode = 'refVal[' + refIndex + ']'; - return resolvedRef(_refVal, refCode); - } - if (!isRoot && root.refs) { - var rootRefId = root.refs[ref]; - if (rootRefId !== undefined) { - _refVal = root.refVal[rootRefId]; - refCode = addLocalRef(ref, _refVal); - return resolvedRef(_refVal, refCode); - } - } - - refCode = addLocalRef(ref); - var v = resolve.call(self, localCompile, root, ref); - if (v === undefined) { - var localSchema = localRefs && localRefs[ref]; - if (localSchema) { - v = resolve.inlineRef(localSchema, opts.inlineRefs) - ? localSchema - : compile.call(self, localSchema, root, localRefs, baseId); - } - } - - if (v === undefined) { - removeLocalRef(ref); - } else { - replaceLocalRef(ref, v); - return resolvedRef(v, refCode); - } - } - - function addLocalRef(ref, v) { - var refId = refVal.length; - refVal[refId] = v; - refs[ref] = refId; - return 'refVal' + refId; - } - - function removeLocalRef(ref) { - delete refs[ref]; - } - - function replaceLocalRef(ref, v) { - var refId = refs[ref]; - refVal[refId] = v; - } - - function resolvedRef(refVal, code) { - return typeof refVal == 'object' || typeof refVal == 'boolean' - ? { code: code, schema: refVal, inline: true } - : { code: code, $async: refVal && !!refVal.$async }; - } - - function usePattern(regexStr) { - var index = patternsHash[regexStr]; - if (index === undefined) { - index = patternsHash[regexStr] = patterns.length; - patterns[index] = regexStr; - } - return 'pattern' + index; - } - - function useDefault(value) { - switch (typeof value) { - case 'boolean': - case 'number': - return '' + value; - case 'string': - return util.toQuotedString(value); - case 'object': - if (value === null) return 'null'; - var valueStr = stableStringify(value); - var index = defaultsHash[valueStr]; - if (index === undefined) { - index = defaultsHash[valueStr] = defaults.length; - defaults[index] = value; - } - return 'default' + index; - } - } - - function useCustomRule(rule, schema, parentSchema, it) { - if (self._opts.validateSchema !== false) { - var deps = rule.definition.dependencies; - if (deps && !deps.every(function(keyword) { - return Object.prototype.hasOwnProperty.call(parentSchema, keyword); - })) - throw new Error('parent schema must have all required keywords: ' + deps.join(',')); - - var validateSchema = rule.definition.validateSchema; - if (validateSchema) { - var valid = validateSchema(schema); - if (!valid) { - var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors); - if (self._opts.validateSchema == 'log') self.logger.error(message); - else throw new Error(message); - } - } - } - - var compile = rule.definition.compile - , inline = rule.definition.inline - , macro = rule.definition.macro; - - var validate; - if (compile) { - validate = compile.call(self, schema, parentSchema, it); - } else if (macro) { - validate = macro.call(self, schema, parentSchema, it); - if (opts.validateSchema !== false) self.validateSchema(validate, true); - } else if (inline) { - validate = inline.call(self, it, rule.keyword, schema, parentSchema); - } else { - validate = rule.definition.validate; - if (!validate) return; - } - - if (validate === undefined) - throw new Error('custom keyword "' + rule.keyword + '"failed to compile'); - - var index = customRules.length; - customRules[index] = validate; - - return { - code: 'customRule' + index, - validate: validate - }; - } -} - - -/** - * Checks if the schema is currently compiled - * @this Ajv - * @param {Object} schema schema to compile - * @param {Object} root root object - * @param {String} baseId base schema ID - * @return {Object} object with properties "index" (compilation index) and "compiling" (boolean) - */ -function checkCompiling(schema, root, baseId) { - /* jshint validthis: true */ - var index = compIndex.call(this, schema, root, baseId); - if (index >= 0) return { index: index, compiling: true }; - index = this._compilations.length; - this._compilations[index] = { - schema: schema, - root: root, - baseId: baseId - }; - return { index: index, compiling: false }; -} - - -/** - * Removes the schema from the currently compiled list - * @this Ajv - * @param {Object} schema schema to compile - * @param {Object} root root object - * @param {String} baseId base schema ID - */ -function endCompiling(schema, root, baseId) { - /* jshint validthis: true */ - var i = compIndex.call(this, schema, root, baseId); - if (i >= 0) this._compilations.splice(i, 1); -} - - -/** - * Index of schema compilation in the currently compiled list - * @this Ajv - * @param {Object} schema schema to compile - * @param {Object} root root object - * @param {String} baseId base schema ID - * @return {Integer} compilation index - */ -function compIndex(schema, root, baseId) { - /* jshint validthis: true */ - for (var i=0; i= 0xD800 && value <= 0xDBFF && pos < len) { - // high surrogate, and there is a next character - value = str.charCodeAt(pos); - if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate - } - } - return length; -}; - -},{}],10:[function(require,module,exports){ -'use strict'; - - -module.exports = { - copy: copy, - checkDataType: checkDataType, - checkDataTypes: checkDataTypes, - coerceToTypes: coerceToTypes, - toHash: toHash, - getProperty: getProperty, - escapeQuotes: escapeQuotes, - equal: require('fast-deep-equal'), - ucs2length: require('./ucs2length'), - varOccurences: varOccurences, - varReplace: varReplace, - schemaHasRules: schemaHasRules, - schemaHasRulesExcept: schemaHasRulesExcept, - schemaUnknownRules: schemaUnknownRules, - toQuotedString: toQuotedString, - getPathExpr: getPathExpr, - getPath: getPath, - getData: getData, - unescapeFragment: unescapeFragment, - unescapeJsonPointer: unescapeJsonPointer, - escapeFragment: escapeFragment, - escapeJsonPointer: escapeJsonPointer -}; - - -function copy(o, to) { - to = to || {}; - for (var key in o) to[key] = o[key]; - return to; -} - - -function checkDataType(dataType, data, strictNumbers, negate) { - var EQUAL = negate ? ' !== ' : ' === ' - , AND = negate ? ' || ' : ' && ' - , OK = negate ? '!' : '' - , NOT = negate ? '' : '!'; - switch (dataType) { - case 'null': return data + EQUAL + 'null'; - case 'array': return OK + 'Array.isArray(' + data + ')'; - case 'object': return '(' + OK + data + AND + - 'typeof ' + data + EQUAL + '"object"' + AND + - NOT + 'Array.isArray(' + data + '))'; - case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND + - NOT + '(' + data + ' % 1)' + - AND + data + EQUAL + data + - (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')'; - case 'number': return '(typeof ' + data + EQUAL + '"' + dataType + '"' + - (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')'; - default: return 'typeof ' + data + EQUAL + '"' + dataType + '"'; - } -} - - -function checkDataTypes(dataTypes, data, strictNumbers) { - switch (dataTypes.length) { - case 1: return checkDataType(dataTypes[0], data, strictNumbers, true); - default: - var code = ''; - var types = toHash(dataTypes); - if (types.array && types.object) { - code = types.null ? '(': '(!' + data + ' || '; - code += 'typeof ' + data + ' !== "object")'; - delete types.null; - delete types.array; - delete types.object; - } - if (types.number) delete types.integer; - for (var t in types) - code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true); - - return code; - } -} - - -var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]); -function coerceToTypes(optionCoerceTypes, dataTypes) { - if (Array.isArray(dataTypes)) { - var types = []; - for (var i=0; i= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl); - return paths[lvl - up]; - } - - if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl); - data = 'data' + ((lvl - up) || ''); - if (!jsonPointer) return data; - } - - var expr = data; - var segments = jsonPointer.split('/'); - for (var i=0; i', - $notOp = $isMax ? '>' : '<', - $errorKeyword = undefined; - if (!($isData || typeof $schema == 'number' || $schema === undefined)) { - throw new Error($keyword + ' must be number'); - } - if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) { - throw new Error($exclusiveKeyword + ' must be number or boolean'); - } - if ($isDataExcl) { - var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr), - $exclusive = 'exclusive' + $lvl, - $exclType = 'exclType' + $lvl, - $exclIsNumber = 'exclIsNumber' + $lvl, - $opExpr = 'op' + $lvl, - $opStr = '\' + ' + $opExpr + ' + \''; - out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; '; - $schemaValueExcl = 'schemaExcl' + $lvl; - out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \'boolean\' && ' + ($exclType) + ' != \'undefined\' && ' + ($exclType) + ' != \'number\') { '; - var $errorKeyword = $exclusiveKeyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ' + ($exclType) + ' == \'number\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\'; '; - if ($schema === undefined) { - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $schemaValue = $schemaValueExcl; - $isData = $isDataExcl; - } - } else { - var $exclIsNumber = typeof $schemaExcl == 'number', - $opStr = $op; - if ($exclIsNumber && $isData) { - var $opExpr = '\'' + $opStr + '\''; - out += ' if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { '; - } else { - if ($exclIsNumber && $schema === undefined) { - $exclusive = true; - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $schemaValue = $schemaExcl; - $notOp += '='; - } else { - if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema); - if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) { - $exclusive = true; - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $notOp += '='; - } else { - $exclusive = false; - $opStr += '='; - } - } - var $opExpr = '\'' + $opStr + '\''; - out += ' if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { '; - } - } - $errorKeyword = $errorKeyword || $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be ' + ($opStr) + ' '; - if ($isData) { - out += '\' + ' + ($schemaValue); - } else { - out += '' + ($schemaValue) + '\''; - } - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],14:[function(require,module,exports){ -'use strict'; -module.exports = function generate__limitItems(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!($isData || typeof $schema == 'number')) { - throw new Error($keyword + ' must be number'); - } - var $op = $keyword == 'maxItems' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have '; - if ($keyword == 'maxItems') { - out += 'more'; - } else { - out += 'fewer'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' items\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],15:[function(require,module,exports){ -'use strict'; -module.exports = function generate__limitLength(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!($isData || typeof $schema == 'number')) { - throw new Error($keyword + ' must be number'); - } - var $op = $keyword == 'maxLength' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - if (it.opts.unicode === false) { - out += ' ' + ($data) + '.length '; - } else { - out += ' ucs2length(' + ($data) + ') '; - } - out += ' ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT be '; - if ($keyword == 'maxLength') { - out += 'longer'; - } else { - out += 'shorter'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' characters\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],16:[function(require,module,exports){ -'use strict'; -module.exports = function generate__limitProperties(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!($isData || typeof $schema == 'number')) { - throw new Error($keyword + ' must be number'); - } - var $op = $keyword == 'maxProperties' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have '; - if ($keyword == 'maxProperties') { - out += 'more'; - } else { - out += 'fewer'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' properties\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],17:[function(require,module,exports){ -'use strict'; -module.exports = function generate_allOf(it, $keyword, $ruleType) { - var out = ' '; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $currentBaseId = $it.baseId, - $allSchemasEmpty = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - $allSchemasEmpty = false; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if ($breakOnError) { - if ($allSchemasEmpty) { - out += ' if (true) { '; - } else { - out += ' ' + ($closingBraces.slice(0, -1)) + ' '; - } - } - return out; -} - -},{}],18:[function(require,module,exports){ -'use strict'; -module.exports = function generate_anyOf(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $noEmptySchema = $schema.every(function($sch) { - return (it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)); - }); - if ($noEmptySchema) { - var $currentBaseId = $it.baseId; - out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { '; - $closingBraces += '}'; - } - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should match some schema in anyOf\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; return false; '; - } - } - out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - if (it.opts.allErrors) { - out += ' } '; - } - } else { - if ($breakOnError) { - out += ' if (true) { '; - } - } - return out; -} - -},{}],19:[function(require,module,exports){ -'use strict'; -module.exports = function generate_comment(it, $keyword, $ruleType) { - var out = ' '; - var $schema = it.schema[$keyword]; - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $comment = it.util.toQuotedString($schema); - if (it.opts.$comment === true) { - out += ' console.log(' + ($comment) + ');'; - } else if (typeof it.opts.$comment == 'function') { - out += ' self._opts.$comment(' + ($comment) + ', ' + (it.util.toQuotedString($errSchemaPath)) + ', validate.root.schema);'; - } - return out; -} - -},{}],20:[function(require,module,exports){ -'use strict'; -module.exports = function generate_const(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!$isData) { - out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';'; - } - out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('const') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValue: schema' + ($lvl) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be equal to constant\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' }'; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],21:[function(require,module,exports){ -'use strict'; -module.exports = function generate_contains(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $idx = 'i' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $currentBaseId = it.baseId, - $nonEmptySchema = (it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all)); - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if ($nonEmptySchema) { - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' var ' + ($nextValid) + ' = false; for (var ' + ($idx) + ' = 0; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - out += ' if (' + ($nextValid) + ') break; } '; - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($closingBraces) + ' if (!' + ($nextValid) + ') {'; - } else { - out += ' if (' + ($data) + '.length == 0) {'; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('contains') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should contain a valid item\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - if ($nonEmptySchema) { - out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - } - if (it.opts.allErrors) { - out += ' } '; - } - return out; -} - -},{}],22:[function(require,module,exports){ -'use strict'; -module.exports = function generate_custom(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $rule = this, - $definition = 'definition' + $lvl, - $rDef = $rule.definition, - $closingBraces = ''; - var $compile, $inline, $macro, $ruleValidate, $validateCode; - if ($isData && $rDef.$data) { - $validateCode = 'keywordValidate' + $lvl; - var $validateSchema = $rDef.validateSchema; - out += ' var ' + ($definition) + ' = RULES.custom[\'' + ($keyword) + '\'].definition; var ' + ($validateCode) + ' = ' + ($definition) + '.validate;'; - } else { - $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it); - if (!$ruleValidate) return; - $schemaValue = 'validate.schema' + $schemaPath; - $validateCode = $ruleValidate.code; - $compile = $rDef.compile; - $inline = $rDef.inline; - $macro = $rDef.macro; - } - var $ruleErrs = $validateCode + '.errors', - $i = 'i' + $lvl, - $ruleErr = 'ruleErr' + $lvl, - $asyncKeyword = $rDef.async; - if ($asyncKeyword && !it.async) throw new Error('async keyword in sync schema'); - if (!($inline || $macro)) { - out += '' + ($ruleErrs) + ' = null;'; - } - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if ($isData && $rDef.$data) { - $closingBraces += '}'; - out += ' if (' + ($schemaValue) + ' === undefined) { ' + ($valid) + ' = true; } else { '; - if ($validateSchema) { - $closingBraces += '}'; - out += ' ' + ($valid) + ' = ' + ($definition) + '.validateSchema(' + ($schemaValue) + '); if (' + ($valid) + ') { '; - } - } - if ($inline) { - if ($rDef.statements) { - out += ' ' + ($ruleValidate.validate) + ' '; - } else { - out += ' ' + ($valid) + ' = ' + ($ruleValidate.validate) + '; '; - } - } else if ($macro) { - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - $it.schema = $ruleValidate.validate; - $it.schemaPath = ''; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($code); - } else { - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; - out += ' ' + ($validateCode) + '.call( '; - if (it.opts.passContext) { - out += 'this'; - } else { - out += 'self'; - } - if ($compile || $rDef.schema === false) { - out += ' , ' + ($data) + ' '; - } else { - out += ' , ' + ($schemaValue) + ' , ' + ($data) + ' , validate.schema' + (it.schemaPath) + ' '; - } - out += ' , (dataPath || \'\')'; - if (it.errorPath != '""') { - out += ' + ' + (it.errorPath); - } - var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', - $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; - out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ' , rootData ) '; - var def_callRuleValidate = out; - out = $$outStack.pop(); - if ($rDef.errors === false) { - out += ' ' + ($valid) + ' = '; - if ($asyncKeyword) { - out += 'await '; - } - out += '' + (def_callRuleValidate) + '; '; - } else { - if ($asyncKeyword) { - $ruleErrs = 'customErrors' + $lvl; - out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = await ' + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } '; - } else { - out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; '; - } - } - } - if ($rDef.modifying) { - out += ' if (' + ($parentData) + ') ' + ($data) + ' = ' + ($parentData) + '[' + ($parentDataProperty) + '];'; - } - out += '' + ($closingBraces); - if ($rDef.valid) { - if ($breakOnError) { - out += ' if (true) { '; - } - } else { - out += ' if ( '; - if ($rDef.valid === undefined) { - out += ' !'; - if ($macro) { - out += '' + ($nextValid); - } else { - out += '' + ($valid); - } - } else { - out += ' ' + (!$rDef.valid) + ' '; - } - out += ') { '; - $errorKeyword = $rule.keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - var def_customError = out; - out = $$outStack.pop(); - if ($inline) { - if ($rDef.errors) { - if ($rDef.errors != 'full') { - out += ' for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + ' 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') '; - } - out += ') { '; - $it.schema = $sch; - $it.schemaPath = $schemaPath + it.util.getProperty($property); - $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property); - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; - } - return out; -} - -},{}],24:[function(require,module,exports){ -'use strict'; -module.exports = function generate_enum(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $i = 'i' + $lvl, - $vSchema = 'schema' + $lvl; - if (!$isData) { - out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + ';'; - } - out += 'var ' + ($valid) + ';'; - if ($isData) { - out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {'; - } - out += '' + ($valid) + ' = false;for (var ' + ($i) + '=0; ' + ($i) + '<' + ($vSchema) + '.length; ' + ($i) + '++) if (equal(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + '])) { ' + ($valid) + ' = true; break; }'; - if ($isData) { - out += ' } '; - } - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('enum') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValues: schema' + ($lvl) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be equal to one of the allowed values\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' }'; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],25:[function(require,module,exports){ -'use strict'; -module.exports = function generate_format(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - if (it.opts.format === false) { - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $unknownFormats = it.opts.unknownFormats, - $allowUnknown = Array.isArray($unknownFormats); - if ($isData) { - var $format = 'format' + $lvl, - $isObject = 'isObject' + $lvl, - $formatType = 'formatType' + $lvl; - out += ' var ' + ($format) + ' = formats[' + ($schemaValue) + ']; var ' + ($isObject) + ' = typeof ' + ($format) + ' == \'object\' && !(' + ($format) + ' instanceof RegExp) && ' + ($format) + '.validate; var ' + ($formatType) + ' = ' + ($isObject) + ' && ' + ($format) + '.type || \'string\'; if (' + ($isObject) + ') { '; - if (it.async) { - out += ' var async' + ($lvl) + ' = ' + ($format) + '.async; '; - } - out += ' ' + ($format) + ' = ' + ($format) + '.validate; } if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || '; - } - out += ' ('; - if ($unknownFormats != 'ignore') { - out += ' (' + ($schemaValue) + ' && !' + ($format) + ' '; - if ($allowUnknown) { - out += ' && self._opts.unknownFormats.indexOf(' + ($schemaValue) + ') == -1 '; - } - out += ') || '; - } - out += ' (' + ($format) + ' && ' + ($formatType) + ' == \'' + ($ruleType) + '\' && !(typeof ' + ($format) + ' == \'function\' ? '; - if (it.async) { - out += ' (async' + ($lvl) + ' ? await ' + ($format) + '(' + ($data) + ') : ' + ($format) + '(' + ($data) + ')) '; - } else { - out += ' ' + ($format) + '(' + ($data) + ') '; - } - out += ' : ' + ($format) + '.test(' + ($data) + '))))) {'; - } else { - var $format = it.formats[$schema]; - if (!$format) { - if ($unknownFormats == 'ignore') { - it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } else if ($allowUnknown && $unknownFormats.indexOf($schema) >= 0) { - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } else { - throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"'); - } - } - var $isObject = typeof $format == 'object' && !($format instanceof RegExp) && $format.validate; - var $formatType = $isObject && $format.type || 'string'; - if ($isObject) { - var $async = $format.async === true; - $format = $format.validate; - } - if ($formatType != $ruleType) { - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } - if ($async) { - if (!it.async) throw new Error('async format in sync schema'); - var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate'; - out += ' if (!(await ' + ($formatRef) + '(' + ($data) + '))) { '; - } else { - out += ' if (! '; - var $formatRef = 'formats' + it.util.getProperty($schema); - if ($isObject) $formatRef += '.validate'; - if (typeof $format == 'function') { - out += ' ' + ($formatRef) + '(' + ($data) + ') '; - } else { - out += ' ' + ($formatRef) + '.test(' + ($data) + ') '; - } - out += ') { '; - } - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('format') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: '; - if ($isData) { - out += '' + ($schemaValue); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match format "'; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + (it.util.escapeQuotes($schema)); - } - out += '"\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],26:[function(require,module,exports){ -'use strict'; -module.exports = function generate_if(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - $it.level++; - var $nextValid = 'valid' + $it.level; - var $thenSch = it.schema['then'], - $elseSch = it.schema['else'], - $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)), - $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)), - $currentBaseId = $it.baseId; - if ($thenPresent || $elsePresent) { - var $ifClause; - $it.createErrors = false; - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = true; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - $it.createErrors = true; - out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - it.compositeRule = $it.compositeRule = $wasComposite; - if ($thenPresent) { - out += ' if (' + ($nextValid) + ') { '; - $it.schema = it.schema['then']; - $it.schemaPath = it.schemaPath + '.then'; - $it.errSchemaPath = it.errSchemaPath + '/then'; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' ' + ($valid) + ' = ' + ($nextValid) + '; '; - if ($thenPresent && $elsePresent) { - $ifClause = 'ifClause' + $lvl; - out += ' var ' + ($ifClause) + ' = \'then\'; '; - } else { - $ifClause = '\'then\''; - } - out += ' } '; - if ($elsePresent) { - out += ' else { '; - } - } else { - out += ' if (!' + ($nextValid) + ') { '; - } - if ($elsePresent) { - $it.schema = it.schema['else']; - $it.schemaPath = it.schemaPath + '.else'; - $it.errSchemaPath = it.errSchemaPath + '/else'; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' ' + ($valid) + ' = ' + ($nextValid) + '; '; - if ($thenPresent && $elsePresent) { - $ifClause = 'ifClause' + $lvl; - out += ' var ' + ($ifClause) + ' = \'else\'; '; - } else { - $ifClause = '\'else\''; - } - out += ' } '; - } - out += ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('if') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { failingKeyword: ' + ($ifClause) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match "\' + ' + ($ifClause) + ' + \'" schema\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; return false; '; - } - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - } else { - if ($breakOnError) { - out += ' if (true) { '; - } - } - return out; -} - -},{}],27:[function(require,module,exports){ -'use strict'; - -//all requires must be explicit because browserify won't work with dynamic requires -module.exports = { - '$ref': require('./ref'), - allOf: require('./allOf'), - anyOf: require('./anyOf'), - '$comment': require('./comment'), - const: require('./const'), - contains: require('./contains'), - dependencies: require('./dependencies'), - 'enum': require('./enum'), - format: require('./format'), - 'if': require('./if'), - items: require('./items'), - maximum: require('./_limit'), - minimum: require('./_limit'), - maxItems: require('./_limitItems'), - minItems: require('./_limitItems'), - maxLength: require('./_limitLength'), - minLength: require('./_limitLength'), - maxProperties: require('./_limitProperties'), - minProperties: require('./_limitProperties'), - multipleOf: require('./multipleOf'), - not: require('./not'), - oneOf: require('./oneOf'), - pattern: require('./pattern'), - properties: require('./properties'), - propertyNames: require('./propertyNames'), - required: require('./required'), - uniqueItems: require('./uniqueItems'), - validate: require('./validate') -}; - -},{"./_limit":13,"./_limitItems":14,"./_limitLength":15,"./_limitProperties":16,"./allOf":17,"./anyOf":18,"./comment":19,"./const":20,"./contains":21,"./dependencies":23,"./enum":24,"./format":25,"./if":26,"./items":28,"./multipleOf":29,"./not":30,"./oneOf":31,"./pattern":32,"./properties":33,"./propertyNames":34,"./ref":35,"./required":36,"./uniqueItems":37,"./validate":38}],28:[function(require,module,exports){ -'use strict'; -module.exports = function generate_items(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $idx = 'i' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $currentBaseId = it.baseId; - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if (Array.isArray($schema)) { - var $additionalItems = it.schema.additionalItems; - if ($additionalItems === false) { - out += ' ' + ($valid) + ' = ' + ($data) + '.length <= ' + ($schema.length) + '; '; - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + '/additionalItems'; - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('additionalItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schema.length) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have more than ' + ($schema.length) + ' items\' '; - } - if (it.opts.verbose) { - out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - $errSchemaPath = $currErrSchemaPath; - if ($breakOnError) { - $closingBraces += '}'; - out += ' else { '; - } - } - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { '; - var $passData = $data + '[' + $i + ']'; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true); - $it.dataPathArr[$dataNxt] = $i; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? (typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0) || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) { - $it.schema = $additionalItems; - $it.schemaPath = it.schemaPath + '.additionalItems'; - $it.errSchemaPath = it.errSchemaPath + '/additionalItems'; - out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($schema.length) + ') { for (var ' + ($idx) + ' = ' + ($schema.length) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' } } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } else if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' for (var ' + ($idx) + ' = ' + (0) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' }'; - } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; - } - return out; -} - -},{}],29:[function(require,module,exports){ -'use strict'; -module.exports = function generate_multipleOf(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!($isData || typeof $schema == 'number')) { - throw new Error($keyword + ' must be number'); - } - out += 'var division' + ($lvl) + ';if ('; - if ($isData) { - out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || '; - } - out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', '; - if (it.opts.multipleOfPrecision) { - out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' '; - } else { - out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') '; - } - out += ' ) '; - if ($isData) { - out += ' ) '; - } - out += ' ) { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('multipleOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be multiple of '; - if ($isData) { - out += '\' + ' + ($schemaValue); - } else { - out += '' + ($schemaValue) + '\''; - } - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],30:[function(require,module,exports){ -'use strict'; -module.exports = function generate_not(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - $it.level++; - var $nextValid = 'valid' + $it.level; - if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' var ' + ($errs) + ' = errors; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.createErrors = false; - var $allErrorsOption; - if ($it.opts.allErrors) { - $allErrorsOption = $it.opts.allErrors; - $it.opts.allErrors = false; - } - out += ' ' + (it.validate($it)) + ' '; - $it.createErrors = true; - if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption; - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' if (' + ($nextValid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT be valid\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - if (it.opts.allErrors) { - out += ' } '; - } - } else { - out += ' var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT be valid\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if ($breakOnError) { - out += ' if (false) { '; - } - } - return out; -} - -},{}],31:[function(require,module,exports){ -'use strict'; -module.exports = function generate_oneOf(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $currentBaseId = $it.baseId, - $prevValid = 'prevValid' + $lvl, - $passingSchemas = 'passingSchemas' + $lvl; - out += 'var ' + ($errs) + ' = errors , ' + ($prevValid) + ' = false , ' + ($valid) + ' = false , ' + ($passingSchemas) + ' = null; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - } else { - out += ' var ' + ($nextValid) + ' = true; '; - } - if ($i) { - out += ' if (' + ($nextValid) + ' && ' + ($prevValid) + ') { ' + ($valid) + ' = false; ' + ($passingSchemas) + ' = [' + ($passingSchemas) + ', ' + ($i) + ']; } else { '; - $closingBraces += '}'; - } - out += ' if (' + ($nextValid) + ') { ' + ($valid) + ' = ' + ($prevValid) + ' = true; ' + ($passingSchemas) + ' = ' + ($i) + '; }'; - } - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { passingSchemas: ' + ($passingSchemas) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match exactly one schema in oneOf\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; return false; '; - } - } - out += '} else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; }'; - if (it.opts.allErrors) { - out += ' } '; - } - return out; -} - -},{}],32:[function(require,module,exports){ -'use strict'; -module.exports = function generate_pattern(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema); - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || '; - } - out += ' !' + ($regexp) + '.test(' + ($data) + ') ) { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('pattern') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern: '; - if ($isData) { - out += '' + ($schemaValue); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match pattern "'; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + (it.util.escapeQuotes($schema)); - } - out += '"\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - -},{}],33:[function(require,module,exports){ -'use strict'; -module.exports = function generate_properties(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $key = 'key' + $lvl, - $idx = 'idx' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $dataProperties = 'dataProperties' + $lvl; - var $schemaKeys = Object.keys($schema || {}).filter(notProto), - $pProperties = it.schema.patternProperties || {}, - $pPropertyKeys = Object.keys($pProperties).filter(notProto), - $aProperties = it.schema.additionalProperties, - $someProperties = $schemaKeys.length || $pPropertyKeys.length, - $noAdditional = $aProperties === false, - $additionalIsSchema = typeof $aProperties == 'object' && Object.keys($aProperties).length, - $removeAdditional = it.opts.removeAdditional, - $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional, - $ownProperties = it.opts.ownProperties, - $currentBaseId = it.baseId; - var $required = it.schema.required; - if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) { - var $requiredHash = it.util.toHash($required); - } - - function notProto(p) { - return p !== '__proto__'; - } - out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;'; - if ($ownProperties) { - out += ' var ' + ($dataProperties) + ' = undefined;'; - } - if ($checkAdditional) { - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - if ($someProperties) { - out += ' var isAdditional' + ($lvl) + ' = !(false '; - if ($schemaKeys.length) { - if ($schemaKeys.length > 8) { - out += ' || validate.schema' + ($schemaPath) + '.hasOwnProperty(' + ($key) + ') '; - } else { - var arr1 = $schemaKeys; - if (arr1) { - var $propertyKey, i1 = -1, - l1 = arr1.length - 1; - while (i1 < l1) { - $propertyKey = arr1[i1 += 1]; - out += ' || ' + ($key) + ' == ' + (it.util.toQuotedString($propertyKey)) + ' '; - } - } - } - } - if ($pPropertyKeys.length) { - var arr2 = $pPropertyKeys; - if (arr2) { - var $pProperty, $i = -1, - l2 = arr2.length - 1; - while ($i < l2) { - $pProperty = arr2[$i += 1]; - out += ' || ' + (it.usePattern($pProperty)) + '.test(' + ($key) + ') '; - } - } - } - out += ' ); if (isAdditional' + ($lvl) + ') { '; - } - if ($removeAdditional == 'all') { - out += ' delete ' + ($data) + '[' + ($key) + ']; '; - } else { - var $currentErrorPath = it.errorPath; - var $additionalProperty = '\' + ' + $key + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - } - if ($noAdditional) { - if ($removeAdditional) { - out += ' delete ' + ($data) + '[' + ($key) + ']; '; - } else { - out += ' ' + ($nextValid) + ' = false; '; - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + '/additionalProperties'; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('additionalProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \'' + ($additionalProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is an invalid additional property'; - } else { - out += 'should NOT have additional properties'; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - $errSchemaPath = $currErrSchemaPath; - if ($breakOnError) { - out += ' break; '; - } - } - } else if ($additionalIsSchema) { - if ($removeAdditional == 'failing') { - out += ' var ' + ($errs) + ' = errors; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.schema = $aProperties; - $it.schemaPath = it.schemaPath + '.additionalProperties'; - $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; - $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - out += ' if (!' + ($nextValid) + ') { errors = ' + ($errs) + '; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete ' + ($data) + '[' + ($key) + ']; } '; - it.compositeRule = $it.compositeRule = $wasComposite; - } else { - $it.schema = $aProperties; - $it.schemaPath = it.schemaPath + '.additionalProperties'; - $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; - $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - } - } - it.errorPath = $currentErrorPath; - } - if ($someProperties) { - out += ' } '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - var $useDefaults = it.opts.useDefaults && !it.compositeRule; - if ($schemaKeys.length) { - var arr3 = $schemaKeys; - if (arr3) { - var $propertyKey, i3 = -1, - l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $sch = $schema[$propertyKey]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - var $prop = it.util.getProperty($propertyKey), - $passData = $data + $prop, - $hasDefault = $useDefaults && $sch.default !== undefined; - $it.schema = $sch; - $it.schemaPath = $schemaPath + $prop; - $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey); - $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers); - $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey); - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - $code = it.util.varReplace($code, $nextData, $passData); - var $useData = $passData; - } else { - var $useData = $nextData; - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; '; - } - if ($hasDefault) { - out += ' ' + ($code) + ' '; - } else { - if ($requiredHash && $requiredHash[$propertyKey]) { - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { ' + ($nextValid) + ' = false; '; - var $currentErrorPath = it.errorPath, - $currErrSchemaPath = $errSchemaPath, - $missingProperty = it.util.escapeQuotes($propertyKey); - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - $errSchemaPath = it.errSchemaPath + '/required'; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - $errSchemaPath = $currErrSchemaPath; - it.errorPath = $currentErrorPath; - out += ' } else { '; - } else { - if ($breakOnError) { - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { ' + ($nextValid) + ' = true; } else { '; - } else { - out += ' if (' + ($useData) + ' !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ' ) { '; - } - } - out += ' ' + ($code) + ' } '; - } - } - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if ($pPropertyKeys.length) { - var arr4 = $pPropertyKeys; - if (arr4) { - var $pProperty, i4 = -1, - l4 = arr4.length - 1; - while (i4 < l4) { - $pProperty = arr4[i4 += 1]; - var $sch = $pProperties[$pProperty]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - $it.schema = $sch; - $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty); - $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty); - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - out += ' if (' + (it.usePattern($pProperty)) + '.test(' + ($key) + ')) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else ' + ($nextValid) + ' = true; '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; - } - return out; -} - -},{}],34:[function(require,module,exports){ -'use strict'; -module.exports = function generate_propertyNames(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - out += 'var ' + ($errs) + ' = errors;'; - if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - var $key = 'key' + $lvl, - $idx = 'idx' + $lvl, - $i = 'i' + $lvl, - $invalidName = '\' + ' + $key + ' + \'', - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $dataProperties = 'dataProperties' + $lvl, - $ownProperties = it.opts.ownProperties, - $currentBaseId = it.baseId; - if ($ownProperties) { - out += ' var ' + ($dataProperties) + ' = undefined; '; - } - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - out += ' var startErrs' + ($lvl) + ' = errors; '; - var $passData = $key; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' if (!' + ($nextValid) + ') { for (var ' + ($i) + '=startErrs' + ($lvl) + '; ' + ($i) + ' 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) { - $required[$required.length] = $property; - } - } - } - } else { - var $required = $schema; - } - } - if ($isData || $required.length) { - var $currentErrorPath = it.errorPath, - $loopRequired = $isData || $required.length >= it.opts.loopRequired, - $ownProperties = it.opts.ownProperties; - if ($breakOnError) { - out += ' var missing' + ($lvl) + '; '; - if ($loopRequired) { - if (!$isData) { - out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; - } - var $i = 'i' + $lvl, - $propertyPath = 'schema' + $lvl + '[' + $i + ']', - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); - } - out += ' var ' + ($valid) + ' = true; '; - if ($isData) { - out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {'; - } - out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) '; - } - out += '; if (!' + ($valid) + ') break; } '; - if ($isData) { - out += ' } '; - } - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - } else { - out += ' if ( '; - var arr2 = $required; - if (arr2) { - var $propertyKey, $i = -1, - l2 = arr2.length - 1; - while ($i < l2) { - $propertyKey = arr2[$i += 1]; - if ($i) { - out += ' || '; - } - var $prop = it.util.getProperty($propertyKey), - $useData = $data + $prop; - out += ' ( ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) '; - } - } - out += ') { '; - var $propertyPath = 'missing' + $lvl, - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - } - } else { - if ($loopRequired) { - if (!$isData) { - out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; - } - var $i = 'i' + $lvl, - $propertyPath = 'schema' + $lvl + '[' + $i + ']', - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); - } - if ($isData) { - out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { '; - } - out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) '; - } - out += ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } '; - if ($isData) { - out += ' } '; - } - } else { - var arr3 = $required; - if (arr3) { - var $propertyKey, i3 = -1, - l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $prop = it.util.getProperty($propertyKey), - $missingProperty = it.util.escapeQuotes($propertyKey), - $useData = $data + $prop; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } '; - } - } - } - } - it.errorPath = $currentErrorPath; - } else if ($breakOnError) { - out += ' if (true) {'; - } - return out; -} - -},{}],37:[function(require,module,exports){ -'use strict'; -module.exports = function generate_uniqueItems(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (($schema || $isData) && it.opts.uniqueItems !== false) { - if ($isData) { - out += ' var ' + ($valid) + '; if (' + ($schemaValue) + ' === false || ' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'boolean\') ' + ($valid) + ' = false; else { '; - } - out += ' var i = ' + ($data) + '.length , ' + ($valid) + ' = true , j; if (i > 1) { '; - var $itemType = it.schema.items && it.schema.items.type, - $typeIsArray = Array.isArray($itemType); - if (!$itemType || $itemType == 'object' || $itemType == 'array' || ($typeIsArray && ($itemType.indexOf('object') >= 0 || $itemType.indexOf('array') >= 0))) { - out += ' outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } '; - } else { - out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; '; - var $method = 'checkDataType' + ($typeIsArray ? 's' : ''); - out += ' if (' + (it.util[$method]($itemType, 'item', it.opts.strictNumbers, true)) + ') continue; '; - if ($typeIsArray) { - out += ' if (typeof item == \'string\') item = \'"\' + item; '; - } - out += ' if (typeof itemIndices[item] == \'number\') { ' + ($valid) + ' = false; j = itemIndices[item]; break; } itemIndices[item] = i; } '; - } - out += ' } '; - if ($isData) { - out += ' } '; - } - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('uniqueItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { i: i, j: j } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have duplicate items (items ## \' + j + \' and \' + i + \' are identical)\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - } else { - if ($breakOnError) { - out += ' if (true) { '; - } - } - return out; -} - -},{}],38:[function(require,module,exports){ -'use strict'; -module.exports = function generate_validate(it, $keyword, $ruleType) { - var out = ''; - var $async = it.schema.$async === true, - $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref'), - $id = it.self._getId(it.schema); - if (it.opts.strictKeywords) { - var $unknownKwd = it.util.schemaUnknownRules(it.schema, it.RULES.keywords); - if ($unknownKwd) { - var $keywordsMsg = 'unknown keyword: ' + $unknownKwd; - if (it.opts.strictKeywords === 'log') it.logger.warn($keywordsMsg); - else throw new Error($keywordsMsg); - } - } - if (it.isTop) { - out += ' var validate = '; - if ($async) { - it.async = true; - out += 'async '; - } - out += 'function(data, dataPath, parentData, parentDataProperty, rootData) { \'use strict\'; '; - if ($id && (it.opts.sourceCode || it.opts.processCode)) { - out += ' ' + ('/\*# sourceURL=' + $id + ' */') + ' '; - } - } - if (typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref)) { - var $keyword = 'false schema'; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - if (it.schema === false) { - if (it.isTop) { - $breakOnError = true; - } else { - out += ' var ' + ($valid) + ' = false; '; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'false schema') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'boolean schema is false\' '; - } - if (it.opts.verbose) { - out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - } else { - if (it.isTop) { - if ($async) { - out += ' return data; '; - } else { - out += ' validate.errors = null; return true; '; - } - } else { - out += ' var ' + ($valid) + ' = true; '; - } - } - if (it.isTop) { - out += ' }; return validate; '; - } - return out; - } - if (it.isTop) { - var $top = it.isTop, - $lvl = it.level = 0, - $dataLvl = it.dataLevel = 0, - $data = 'data'; - it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema)); - it.baseId = it.baseId || it.rootId; - delete it.isTop; - it.dataPathArr = [""]; - if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) { - var $defaultMsg = 'default is ignored in the schema root'; - if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); - else throw new Error($defaultMsg); - } - out += ' var vErrors = null; '; - out += ' var errors = 0; '; - out += ' if (rootData === undefined) rootData = data; '; - } else { - var $lvl = it.level, - $dataLvl = it.dataLevel, - $data = 'data' + ($dataLvl || ''); - if ($id) it.baseId = it.resolve.url(it.baseId, $id); - if ($async && !it.async) throw new Error('async schema in sync schema'); - out += ' var errs_' + ($lvl) + ' = errors;'; - } - var $valid = 'valid' + $lvl, - $breakOnError = !it.opts.allErrors, - $closingBraces1 = '', - $closingBraces2 = ''; - var $errorKeyword; - var $typeSchema = it.schema.type, - $typeIsArray = Array.isArray($typeSchema); - if ($typeSchema && it.opts.nullable && it.schema.nullable === true) { - if ($typeIsArray) { - if ($typeSchema.indexOf('null') == -1) $typeSchema = $typeSchema.concat('null'); - } else if ($typeSchema != 'null') { - $typeSchema = [$typeSchema, 'null']; - $typeIsArray = true; - } - } - if ($typeIsArray && $typeSchema.length == 1) { - $typeSchema = $typeSchema[0]; - $typeIsArray = false; - } - if (it.schema.$ref && $refKeywords) { - if (it.opts.extendRefs == 'fail') { - throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); - } else if (it.opts.extendRefs !== true) { - $refKeywords = false; - it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"'); - } - } - if (it.schema.$comment && it.opts.$comment) { - out += ' ' + (it.RULES.all.$comment.code(it, '$comment')); - } - if ($typeSchema) { - if (it.opts.coerceTypes) { - var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); - } - var $rulesGroup = it.RULES.types[$typeSchema]; - if ($coerceToTypes || $typeIsArray || $rulesGroup === true || ($rulesGroup && !$shouldUseGroup($rulesGroup))) { - var $schemaPath = it.schemaPath + '.type', - $errSchemaPath = it.errSchemaPath + '/type'; - var $schemaPath = it.schemaPath + '.type', - $errSchemaPath = it.errSchemaPath + '/type', - $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType'; - out += ' if (' + (it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true)) + ') { '; - if ($coerceToTypes) { - var $dataType = 'dataType' + $lvl, - $coerced = 'coerced' + $lvl; - out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; var ' + ($coerced) + ' = undefined; '; - if (it.opts.coerceTypes == 'array') { - out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ') && ' + ($data) + '.length == 1) { ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; if (' + (it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)) + ') ' + ($coerced) + ' = ' + ($data) + '; } '; - } - out += ' if (' + ($coerced) + ' !== undefined) ; '; - var arr1 = $coerceToTypes; - if (arr1) { - var $type, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $type = arr1[$i += 1]; - if ($type == 'string') { - out += ' else if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; '; - } else if ($type == 'number' || $type == 'integer') { - out += ' else if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' '; - if ($type == 'integer') { - out += ' && !(' + ($data) + ' % 1)'; - } - out += ')) ' + ($coerced) + ' = +' + ($data) + '; '; - } else if ($type == 'boolean') { - out += ' else if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; '; - } else if ($type == 'null') { - out += ' else if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; '; - } else if (it.opts.coerceTypes == 'array' && $type == 'array') { - out += ' else if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; '; - } - } - } - out += ' else { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be '; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } if (' + ($coerced) + ' !== undefined) { '; - var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', - $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; - out += ' ' + ($data) + ' = ' + ($coerced) + '; '; - if (!$dataLvl) { - out += 'if (' + ($parentData) + ' !== undefined)'; - } - out += ' ' + ($parentData) + '[' + ($parentDataProperty) + '] = ' + ($coerced) + '; } '; - } else { - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be '; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - } - out += ' } '; - } - } - if (it.schema.$ref && !$refKeywords) { - out += ' ' + (it.RULES.all.$ref.code(it, '$ref')) + ' '; - if ($breakOnError) { - out += ' } if (errors === '; - if ($top) { - out += '0'; - } else { - out += 'errs_' + ($lvl); - } - out += ') { '; - $closingBraces2 += '}'; - } - } else { - var arr2 = it.RULES; - if (arr2) { - var $rulesGroup, i2 = -1, - l2 = arr2.length - 1; - while (i2 < l2) { - $rulesGroup = arr2[i2 += 1]; - if ($shouldUseGroup($rulesGroup)) { - if ($rulesGroup.type) { - out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers)) + ') { '; - } - if (it.opts.useDefaults) { - if ($rulesGroup.type == 'object' && it.schema.properties) { - var $schema = it.schema.properties, - $schemaKeys = Object.keys($schema); - var arr3 = $schemaKeys; - if (arr3) { - var $propertyKey, i3 = -1, - l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $sch = $schema[$propertyKey]; - if ($sch.default !== undefined) { - var $passData = $data + it.util.getProperty($propertyKey); - if (it.compositeRule) { - if (it.opts.strictDefaults) { - var $defaultMsg = 'default is ignored for: ' + $passData; - if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); - else throw new Error($defaultMsg); - } - } else { - out += ' if (' + ($passData) + ' === undefined '; - if (it.opts.useDefaults == 'empty') { - out += ' || ' + ($passData) + ' === null || ' + ($passData) + ' === \'\' '; - } - out += ' ) ' + ($passData) + ' = '; - if (it.opts.useDefaults == 'shared') { - out += ' ' + (it.useDefault($sch.default)) + ' '; - } else { - out += ' ' + (JSON.stringify($sch.default)) + ' '; - } - out += '; '; - } - } - } - } - } else if ($rulesGroup.type == 'array' && Array.isArray(it.schema.items)) { - var arr4 = it.schema.items; - if (arr4) { - var $sch, $i = -1, - l4 = arr4.length - 1; - while ($i < l4) { - $sch = arr4[$i += 1]; - if ($sch.default !== undefined) { - var $passData = $data + '[' + $i + ']'; - if (it.compositeRule) { - if (it.opts.strictDefaults) { - var $defaultMsg = 'default is ignored for: ' + $passData; - if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); - else throw new Error($defaultMsg); - } - } else { - out += ' if (' + ($passData) + ' === undefined '; - if (it.opts.useDefaults == 'empty') { - out += ' || ' + ($passData) + ' === null || ' + ($passData) + ' === \'\' '; - } - out += ' ) ' + ($passData) + ' = '; - if (it.opts.useDefaults == 'shared') { - out += ' ' + (it.useDefault($sch.default)) + ' '; - } else { - out += ' ' + (JSON.stringify($sch.default)) + ' '; - } - out += '; '; - } - } - } - } - } - } - var arr5 = $rulesGroup.rules; - if (arr5) { - var $rule, i5 = -1, - l5 = arr5.length - 1; - while (i5 < l5) { - $rule = arr5[i5 += 1]; - if ($shouldUseRule($rule)) { - var $code = $rule.code(it, $rule.keyword, $rulesGroup.type); - if ($code) { - out += ' ' + ($code) + ' '; - if ($breakOnError) { - $closingBraces1 += '}'; - } - } - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces1) + ' '; - $closingBraces1 = ''; - } - if ($rulesGroup.type) { - out += ' } '; - if ($typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes) { - out += ' else { '; - var $schemaPath = it.schemaPath + '.type', - $errSchemaPath = it.errSchemaPath + '/type'; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be '; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - } - } - if ($breakOnError) { - out += ' if (errors === '; - if ($top) { - out += '0'; - } else { - out += 'errs_' + ($lvl); - } - out += ') { '; - $closingBraces2 += '}'; - } - } - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces2) + ' '; - } - if ($top) { - if ($async) { - out += ' if (errors === 0) return data; '; - out += ' else throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; '; - out += ' return errors === 0; '; - } - out += ' }; return validate;'; - } else { - out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';'; - } - - function $shouldUseGroup($rulesGroup) { - var rules = $rulesGroup.rules; - for (var i = 0; i < rules.length; i++) - if ($shouldUseRule(rules[i])) return true; - } - - function $shouldUseRule($rule) { - return it.schema[$rule.keyword] !== undefined || ($rule.implements && $ruleImplementsSomeKeyword($rule)); - } - - function $ruleImplementsSomeKeyword($rule) { - var impl = $rule.implements; - for (var i = 0; i < impl.length; i++) - if (it.schema[impl[i]] !== undefined) return true; - } - return out; -} - -},{}],39:[function(require,module,exports){ -'use strict'; - -var IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i; -var customRuleCode = require('./dotjs/custom'); -var definitionSchema = require('./definition_schema'); - -module.exports = { - add: addKeyword, - get: getKeyword, - remove: removeKeyword, - validate: validateKeyword -}; - - -/** - * Define custom keyword - * @this Ajv - * @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords). - * @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`. - * @return {Ajv} this for method chaining - */ -function addKeyword(keyword, definition) { - /* jshint validthis: true */ - /* eslint no-shadow: 0 */ - var RULES = this.RULES; - if (RULES.keywords[keyword]) - throw new Error('Keyword ' + keyword + ' is already defined'); - - if (!IDENTIFIER.test(keyword)) - throw new Error('Keyword ' + keyword + ' is not a valid identifier'); - - if (definition) { - this.validateKeyword(definition, true); - - var dataType = definition.type; - if (Array.isArray(dataType)) { - for (var i=0; i 1) { - sets[0] = sets[0].slice(0, -1); - var xl = sets.length - 1; - for (var x = 1; x < xl; ++x) { - sets[x] = sets[x].slice(1, -1); - } - sets[xl] = sets[xl].slice(1); - return sets.join(''); - } else { - return sets[0]; - } -} -function subexp(str) { - return "(?:" + str + ")"; -} -function typeOf(o) { - return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase(); -} -function toUpperCase(str) { - return str.toUpperCase(); -} -function toArray(obj) { - return obj !== undefined && obj !== null ? obj instanceof Array ? obj : typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj) : []; -} -function assign(target, source) { - var obj = target; - if (source) { - for (var key in source) { - obj[key] = source[key]; - } - } - return obj; -} - -function buildExps(isIRI) { - var ALPHA$$ = "[A-Za-z]", - CR$ = "[\\x0D]", - DIGIT$$ = "[0-9]", - DQUOTE$$ = "[\\x22]", - HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"), - //case-insensitive - LF$$ = "[\\x0A]", - SP$$ = "[\\x20]", - PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)), - //expanded - GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]", - SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", - RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$), - UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", - //subset, excludes bidi control characters - IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]", - //subset - UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$), - SCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*"), - USERINFO$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*"), - DEC_OCTET$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("[1-9]" + DIGIT$$) + "|" + DIGIT$$), - DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$), - //relaxed parsing rules - IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$), - H16$ = subexp(HEXDIG$$ + "{1,4}"), - LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$), - IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$), - // 6( h16 ":" ) ls32 - IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$), - // "::" 5( h16 ":" ) ls32 - IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$), - //[ h16 ] "::" 4( h16 ":" ) ls32 - IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$), - //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 - IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$), - //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 - IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$), - //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 - IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$), - //[ *4( h16 ":" ) h16 ] "::" ls32 - IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$), - //[ *5( h16 ":" ) h16 ] "::" h16 - IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"), - //[ *6( h16 ":" ) h16 ] "::" - IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")), - ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+"), - //RFC 6874 - IPV6ADDRZ$ = subexp(IPV6ADDRESS$ + "\\%25" + ZONEID$), - //RFC 6874 - IPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + ZONEID$), - //RFC 6874, with relaxed parsing rules - IPVFUTURE$ = subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+"), - IP_LITERAL$ = subexp("\\[" + subexp(IPV6ADDRZ_RELAXED$ + "|" + IPV6ADDRESS$ + "|" + IPVFUTURE$) + "\\]"), - //RFC 6874 - REG_NAME$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*"), - HOST$ = subexp(IP_LITERAL$ + "|" + IPV4ADDRESS$ + "(?!" + REG_NAME$ + ")" + "|" + REG_NAME$), - PORT$ = subexp(DIGIT$$ + "*"), - AUTHORITY$ = subexp(subexp(USERINFO$ + "@") + "?" + HOST$ + subexp("\\:" + PORT$) + "?"), - PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]")), - SEGMENT$ = subexp(PCHAR$ + "*"), - SEGMENT_NZ$ = subexp(PCHAR$ + "+"), - SEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+"), - PATH_ABEMPTY$ = subexp(subexp("\\/" + SEGMENT$) + "*"), - PATH_ABSOLUTE$ = subexp("\\/" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + "?"), - //simplified - PATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$), - //simplified - PATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$), - //simplified - PATH_EMPTY$ = "(?!" + PCHAR$ + ")", - PATH$ = subexp(PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), - QUERY$ = subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*"), - FRAGMENT$ = subexp(subexp(PCHAR$ + "|[\\/\\?]") + "*"), - HIER_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), - URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), - RELATIVE_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$), - RELATIVE$ = subexp(RELATIVE_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), - URI_REFERENCE$ = subexp(URI$ + "|" + RELATIVE$), - ABSOLUTE_URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?"), - GENERIC_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", - RELATIVE_REF$ = "^(){0}" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", - ABSOLUTE_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?$", - SAMEDOC_REF$ = "^" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", - AUTHORITY_REF$ = "^" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?$"; - return { - NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"), - NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"), - NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"), - NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"), - NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"), - NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"), - NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"), - ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"), - UNRESERVED: new RegExp(UNRESERVED$$, "g"), - OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"), - PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"), - IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"), - IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules - }; -} -var URI_PROTOCOL = buildExps(false); - -var IRI_PROTOCOL = buildExps(true); - -var slicedToArray = function () { - function sliceIterator(arr, i) { - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; - - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"]) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; - } - - return function (arr, i) { - if (Array.isArray(arr)) { - return arr; - } else if (Symbol.iterator in Object(arr)) { - return sliceIterator(arr, i); - } else { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); - } - }; -}(); - - - - - - - - - - - - - -var toConsumableArray = function (arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - - return arr2; - } else { - return Array.from(arr); - } -}; - -/** Highest positive signed 32-bit float value */ - -var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 - -/** Bootstring parameters */ -var base = 36; -var tMin = 1; -var tMax = 26; -var skew = 38; -var damp = 700; -var initialBias = 72; -var initialN = 128; // 0x80 -var delimiter = '-'; // '\x2D' - -/** Regular expressions */ -var regexPunycode = /^xn--/; -var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars -var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators - -/** Error messages */ -var 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 */ -var baseMinusTMin = base - tMin; -var floor = Math.floor; -var stringFromCharCode = String.fromCharCode; - -/*--------------------------------------------------------------------------*/ - -/** - * A generic error utility function. - * @private - * @param {String} type The error type. - * @returns {Error} Throws a `RangeError` with the applicable error message. - */ -function error$1(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 result = []; - var length = array.length; - 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 = []; - var counter = 0; - var length = string.length; - while (counter < length) { - var value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // It's a high surrogate, and there is a next character. - var extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { - // Low surrogate. - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // It's an 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). - */ -var ucs2encode = function ucs2encode(array) { - return String.fromCodePoint.apply(String, toConsumableArray(array)); -}; - -/** - * 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. - */ -var basicToDigit = function basicToDigit(codePoint) { - if (codePoint - 0x30 < 0x0A) { - return codePoint - 0x16; - } - if (codePoint - 0x41 < 0x1A) { - return codePoint - 0x41; - } - if (codePoint - 0x61 < 0x1A) { - return codePoint - 0x61; - } - 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. - */ -var digitToBasic = 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 - */ -var adapt = 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. - */ -var decode = function decode(input) { - // Don't use UCS-2. - var output = []; - var inputLength = input.length; - var i = 0; - var n = initialN; - var bias = initialBias; - - // 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. - - var basic = input.lastIndexOf(delimiter); - if (basic < 0) { - basic = 0; - } - - for (var j = 0; j < basic; ++j) { - // if it's not a basic code point - if (input.charCodeAt(j) >= 0x80) { - error$1('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 (var 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`. - var oldi = i; - for (var w = 1, k = base;; /* no condition */k += base) { - - if (index >= inputLength) { - error$1('invalid-input'); - } - - var digit = basicToDigit(input.charCodeAt(index++)); - - if (digit >= base || digit > floor((maxInt - i) / w)) { - error$1('overflow'); - } - - i += digit * w; - var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; - - if (digit < t) { - break; - } - - var baseMinusT = base - t; - if (w > floor(maxInt / baseMinusT)) { - error$1('overflow'); - } - - w *= baseMinusT; - } - - var 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$1('overflow'); - } - - n += floor(i / out); - i %= out; - - // Insert `n` at position `i` of the output. - output.splice(i++, 0, n); - } - - return String.fromCodePoint.apply(String, 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. - */ -var encode = function encode(input) { - var output = []; - - // Convert the input in UCS-2 to an array of Unicode code points. - input = ucs2decode(input); - - // Cache the length. - var inputLength = input.length; - - // Initialize the state. - var n = initialN; - var delta = 0; - var bias = initialBias; - - // Handle the basic code points. - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var _currentValue2 = _step.value; - - if (_currentValue2 < 0x80) { - output.push(stringFromCharCode(_currentValue2)); - } - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - var basicLength = output.length; - var handledCPCount = basicLength; - - // `handledCPCount` is the number of code points that have been handled; - // `basicLength` is the number of basic code points. - - // Finish the basic string with a delimiter unless it's empty. - 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: - var m = maxInt; - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; - - try { - for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var currentValue = _step2.value; - - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } - - // Increase `delta` enough to advance the decoder's state to , - // but guard against overflow. - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } - - var handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - error$1('overflow'); - } - - delta += (m - n) * handledCPCountPlusOne; - n = m; - - var _iteratorNormalCompletion3 = true; - var _didIteratorError3 = false; - var _iteratorError3 = undefined; - - try { - for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { - var _currentValue = _step3.value; - - if (_currentValue < n && ++delta > maxInt) { - error$1('overflow'); - } - if (_currentValue == n) { - // Represent delta as a generalized variable-length integer. - var q = delta; - for (var k = base;; /* no condition */k += base) { - var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; - if (q < t) { - break; - } - var qMinusT = q - t; - var 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; - } - } - } catch (err) { - _didIteratorError3 = true; - _iteratorError3 = err; - } finally { - try { - if (!_iteratorNormalCompletion3 && _iterator3.return) { - _iterator3.return(); - } - } finally { - if (_didIteratorError3) { - throw _iteratorError3; - } - } - } - - ++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. - */ -var toUnicode = 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. - */ -var toASCII = function toASCII(input) { - return mapDomain(input, function (string) { - return regexNonASCII.test(string) ? 'xn--' + encode(string) : string; - }); -}; - -/*--------------------------------------------------------------------------*/ - -/** Define the public API */ -var punycode = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - 'version': '2.1.0', - /** - * 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 -}; - -/** - * URI.js - * - * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript. - * @author Gary Court - * @see http://github.com/garycourt/uri-js - */ -/** - * Copyright 2011 Gary Court. 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. - * - * THIS SOFTWARE IS PROVIDED BY GARY COURT ``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 GARY COURT 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. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of Gary Court. - */ -var SCHEMES = {}; -function pctEncChar(chr) { - var c = chr.charCodeAt(0); - var e = void 0; - if (c < 16) e = "%0" + c.toString(16).toUpperCase();else if (c < 128) e = "%" + c.toString(16).toUpperCase();else if (c < 2048) e = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();else e = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase(); - return e; -} -function pctDecChars(str) { - var newStr = ""; - var i = 0; - var il = str.length; - while (i < il) { - var c = parseInt(str.substr(i + 1, 2), 16); - if (c < 128) { - newStr += String.fromCharCode(c); - i += 3; - } else if (c >= 194 && c < 224) { - if (il - i >= 6) { - var c2 = parseInt(str.substr(i + 4, 2), 16); - newStr += String.fromCharCode((c & 31) << 6 | c2 & 63); - } else { - newStr += str.substr(i, 6); - } - i += 6; - } else if (c >= 224) { - if (il - i >= 9) { - var _c = parseInt(str.substr(i + 4, 2), 16); - var c3 = parseInt(str.substr(i + 7, 2), 16); - newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63); - } else { - newStr += str.substr(i, 9); - } - i += 9; - } else { - newStr += str.substr(i, 3); - i += 3; - } - } - return newStr; -} -function _normalizeComponentEncoding(components, protocol) { - function decodeUnreserved(str) { - var decStr = pctDecChars(str); - return !decStr.match(protocol.UNRESERVED) ? str : decStr; - } - if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, ""); - if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - if (components.host !== undefined) components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - if (components.path !== undefined) components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - return components; -} - -function _stripLeadingZeros(str) { - return str.replace(/^0*(.*)/, "$1") || "0"; -} -function _normalizeIPv4(host, protocol) { - var matches = host.match(protocol.IPV4ADDRESS) || []; - - var _matches = slicedToArray(matches, 2), - address = _matches[1]; - - if (address) { - return address.split(".").map(_stripLeadingZeros).join("."); - } else { - return host; - } -} -function _normalizeIPv6(host, protocol) { - var matches = host.match(protocol.IPV6ADDRESS) || []; - - var _matches2 = slicedToArray(matches, 3), - address = _matches2[1], - zone = _matches2[2]; - - if (address) { - var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(), - _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2), - last = _address$toLowerCase$2[0], - first = _address$toLowerCase$2[1]; - - var firstFields = first ? first.split(":").map(_stripLeadingZeros) : []; - var lastFields = last.split(":").map(_stripLeadingZeros); - var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]); - var fieldCount = isLastFieldIPv4Address ? 7 : 8; - var lastFieldsStart = lastFields.length - fieldCount; - var fields = Array(fieldCount); - for (var x = 0; x < fieldCount; ++x) { - fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || ''; - } - if (isLastFieldIPv4Address) { - fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol); - } - var allZeroFields = fields.reduce(function (acc, field, index) { - if (!field || field === "0") { - var lastLongest = acc[acc.length - 1]; - if (lastLongest && lastLongest.index + lastLongest.length === index) { - lastLongest.length++; - } else { - acc.push({ index: index, length: 1 }); - } - } - return acc; - }, []); - var longestZeroFields = allZeroFields.sort(function (a, b) { - return b.length - a.length; - })[0]; - var newHost = void 0; - if (longestZeroFields && longestZeroFields.length > 1) { - var newFirst = fields.slice(0, longestZeroFields.index); - var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length); - newHost = newFirst.join(":") + "::" + newLast.join(":"); - } else { - newHost = fields.join(":"); - } - if (zone) { - newHost += "%" + zone; - } - return newHost; - } else { - return host; - } -} -var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i; -var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined; -function parse(uriString) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var components = {}; - var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL; - if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString; - var matches = uriString.match(URI_PARSE); - if (matches) { - if (NO_MATCH_IS_UNDEFINED) { - //store each component - components.scheme = matches[1]; - components.userinfo = matches[3]; - components.host = matches[4]; - components.port = parseInt(matches[5], 10); - components.path = matches[6] || ""; - components.query = matches[7]; - components.fragment = matches[8]; - //fix port number - if (isNaN(components.port)) { - components.port = matches[5]; - } - } else { - //IE FIX for improper RegExp matching - //store each component - components.scheme = matches[1] || undefined; - components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined; - components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined; - components.port = parseInt(matches[5], 10); - components.path = matches[6] || ""; - components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined; - components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined; - //fix port number - if (isNaN(components.port)) { - components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined; - } - } - if (components.host) { - //normalize IP hosts - components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol); - } - //determine reference type - if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) { - components.reference = "same-document"; - } else if (components.scheme === undefined) { - components.reference = "relative"; - } else if (components.fragment === undefined) { - components.reference = "absolute"; - } else { - components.reference = "uri"; - } - //check for reference errors - if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) { - components.error = components.error || "URI is not a " + options.reference + " reference."; - } - //find scheme handler - var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()]; - //check if scheme can't handle IRIs - if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) { - //if host component is a domain name - if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) { - //convert Unicode IDN -> ASCII IDN - try { - components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()); - } catch (e) { - components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e; - } - } - //convert IRI -> URI - _normalizeComponentEncoding(components, URI_PROTOCOL); - } else { - //normalize encodings - _normalizeComponentEncoding(components, protocol); - } - //perform scheme specific parsing - if (schemeHandler && schemeHandler.parse) { - schemeHandler.parse(components, options); - } - } else { - components.error = components.error || "URI can not be parsed."; - } - return components; -} - -function _recomposeAuthority(components, options) { - var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL; - var uriTokens = []; - if (components.userinfo !== undefined) { - uriTokens.push(components.userinfo); - uriTokens.push("@"); - } - if (components.host !== undefined) { - //normalize IP hosts, add brackets and escape zone separator for IPv6 - uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) { - return "[" + $1 + ($2 ? "%25" + $2 : "") + "]"; - })); - } - if (typeof components.port === "number" || typeof components.port === "string") { - uriTokens.push(":"); - uriTokens.push(String(components.port)); - } - return uriTokens.length ? uriTokens.join("") : undefined; -} - -var RDS1 = /^\.\.?\//; -var RDS2 = /^\/\.(\/|$)/; -var RDS3 = /^\/\.\.(\/|$)/; -var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/; -function removeDotSegments(input) { - var output = []; - while (input.length) { - if (input.match(RDS1)) { - input = input.replace(RDS1, ""); - } else if (input.match(RDS2)) { - input = input.replace(RDS2, "/"); - } else if (input.match(RDS3)) { - input = input.replace(RDS3, "/"); - output.pop(); - } else if (input === "." || input === "..") { - input = ""; - } else { - var im = input.match(RDS5); - if (im) { - var s = im[0]; - input = input.slice(s.length); - output.push(s); - } else { - throw new Error("Unexpected dot segment condition"); - } - } - } - return output.join(""); -} - -function serialize(components) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL; - var uriTokens = []; - //find scheme handler - var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()]; - //perform scheme specific serialization - if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options); - if (components.host) { - //if host component is an IPv6 address - if (protocol.IPV6ADDRESS.test(components.host)) {} - //TODO: normalize IPv6 address as per RFC 5952 - - //if host component is a domain name - else if (options.domainHost || schemeHandler && schemeHandler.domainHost) { - //convert IDN via punycode - try { - components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host); - } catch (e) { - components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e; - } - } - } - //normalize encoding - _normalizeComponentEncoding(components, protocol); - if (options.reference !== "suffix" && components.scheme) { - uriTokens.push(components.scheme); - uriTokens.push(":"); - } - var authority = _recomposeAuthority(components, options); - if (authority !== undefined) { - if (options.reference !== "suffix") { - uriTokens.push("//"); - } - uriTokens.push(authority); - if (components.path && components.path.charAt(0) !== "/") { - uriTokens.push("/"); - } - } - if (components.path !== undefined) { - var s = components.path; - if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) { - s = removeDotSegments(s); - } - if (authority === undefined) { - s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//" - } - uriTokens.push(s); - } - if (components.query !== undefined) { - uriTokens.push("?"); - uriTokens.push(components.query); - } - if (components.fragment !== undefined) { - uriTokens.push("#"); - uriTokens.push(components.fragment); - } - return uriTokens.join(""); //merge tokens into a string -} - -function resolveComponents(base, relative) { - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - var skipNormalization = arguments[3]; - - var target = {}; - if (!skipNormalization) { - base = parse(serialize(base, options), options); //normalize base components - relative = parse(serialize(relative, options), options); //normalize relative components - } - options = options || {}; - if (!options.tolerant && relative.scheme) { - target.scheme = relative.scheme; - //target.authority = relative.authority; - target.userinfo = relative.userinfo; - target.host = relative.host; - target.port = relative.port; - target.path = removeDotSegments(relative.path || ""); - target.query = relative.query; - } else { - if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) { - //target.authority = relative.authority; - target.userinfo = relative.userinfo; - target.host = relative.host; - target.port = relative.port; - target.path = removeDotSegments(relative.path || ""); - target.query = relative.query; - } else { - if (!relative.path) { - target.path = base.path; - if (relative.query !== undefined) { - target.query = relative.query; - } else { - target.query = base.query; - } - } else { - if (relative.path.charAt(0) === "/") { - target.path = removeDotSegments(relative.path); - } else { - if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) { - target.path = "/" + relative.path; - } else if (!base.path) { - target.path = relative.path; - } else { - target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path; - } - target.path = removeDotSegments(target.path); - } - target.query = relative.query; - } - //target.authority = base.authority; - target.userinfo = base.userinfo; - target.host = base.host; - target.port = base.port; - } - target.scheme = base.scheme; - } - target.fragment = relative.fragment; - return target; -} - -function resolve(baseURI, relativeURI, options) { - var schemelessOptions = assign({ scheme: 'null' }, options); - return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions); -} - -function normalize(uri, options) { - if (typeof uri === "string") { - uri = serialize(parse(uri, options), options); - } else if (typeOf(uri) === "object") { - uri = parse(serialize(uri, options), options); - } - return uri; -} - -function equal(uriA, uriB, options) { - if (typeof uriA === "string") { - uriA = serialize(parse(uriA, options), options); - } else if (typeOf(uriA) === "object") { - uriA = serialize(uriA, options); - } - if (typeof uriB === "string") { - uriB = serialize(parse(uriB, options), options); - } else if (typeOf(uriB) === "object") { - uriB = serialize(uriB, options); - } - return uriA === uriB; -} - -function escapeComponent(str, options) { - return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar); -} - -function unescapeComponent(str, options) { - return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars); -} - -var handler = { - scheme: "http", - domainHost: true, - parse: function parse(components, options) { - //report missing host - if (!components.host) { - components.error = components.error || "HTTP URIs must have a host."; - } - return components; - }, - serialize: function serialize(components, options) { - var secure = String(components.scheme).toLowerCase() === "https"; - //normalize the default port - if (components.port === (secure ? 443 : 80) || components.port === "") { - components.port = undefined; - } - //normalize the empty path - if (!components.path) { - components.path = "/"; - } - //NOTE: We do not parse query strings for HTTP URIs - //as WWW Form Url Encoded query strings are part of the HTML4+ spec, - //and not the HTTP spec. - return components; - } -}; - -var handler$1 = { - scheme: "https", - domainHost: handler.domainHost, - parse: handler.parse, - serialize: handler.serialize -}; - -function isSecure(wsComponents) { - return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss"; -} -//RFC 6455 -var handler$2 = { - scheme: "ws", - domainHost: true, - parse: function parse(components, options) { - var wsComponents = components; - //indicate if the secure flag is set - wsComponents.secure = isSecure(wsComponents); - //construct resouce name - wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : ''); - wsComponents.path = undefined; - wsComponents.query = undefined; - return wsComponents; - }, - serialize: function serialize(wsComponents, options) { - //normalize the default port - if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") { - wsComponents.port = undefined; - } - //ensure scheme matches secure flag - if (typeof wsComponents.secure === 'boolean') { - wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws'; - wsComponents.secure = undefined; - } - //reconstruct path from resource name - if (wsComponents.resourceName) { - var _wsComponents$resourc = wsComponents.resourceName.split('?'), - _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2), - path = _wsComponents$resourc2[0], - query = _wsComponents$resourc2[1]; - - wsComponents.path = path && path !== '/' ? path : undefined; - wsComponents.query = query; - wsComponents.resourceName = undefined; - } - //forbid fragment component - wsComponents.fragment = undefined; - return wsComponents; - } -}; - -var handler$3 = { - scheme: "wss", - domainHost: handler$2.domainHost, - parse: handler$2.parse, - serialize: handler$2.serialize -}; - -var O = {}; -var isIRI = true; -//RFC 3986 -var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + (isIRI ? "\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" : "") + "]"; -var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive -var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded -//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; = -//const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]"; -//const WSP$$ = "[\\x20\\x09]"; -//const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127) -//const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext -//const VCHAR$$ = "[\\x21-\\x7E]"; -//const WSP$$ = "[\\x20\\x09]"; -//const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext -//const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+"); -//const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$); -//const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"'); -var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]"; -var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]"; -var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]"); -var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"; -var UNRESERVED = new RegExp(UNRESERVED$$, "g"); -var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g"); -var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g"); -var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g"); -var NOT_HFVALUE = NOT_HFNAME; -function decodeUnreserved(str) { - var decStr = pctDecChars(str); - return !decStr.match(UNRESERVED) ? str : decStr; -} -var handler$4 = { - scheme: "mailto", - parse: function parse$$1(components, options) { - var mailtoComponents = components; - var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : []; - mailtoComponents.path = undefined; - if (mailtoComponents.query) { - var unknownHeaders = false; - var headers = {}; - var hfields = mailtoComponents.query.split("&"); - for (var x = 0, xl = hfields.length; x < xl; ++x) { - var hfield = hfields[x].split("="); - switch (hfield[0]) { - case "to": - var toAddrs = hfield[1].split(","); - for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) { - to.push(toAddrs[_x]); - } - break; - case "subject": - mailtoComponents.subject = unescapeComponent(hfield[1], options); - break; - case "body": - mailtoComponents.body = unescapeComponent(hfield[1], options); - break; - default: - unknownHeaders = true; - headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options); - break; - } - } - if (unknownHeaders) mailtoComponents.headers = headers; - } - mailtoComponents.query = undefined; - for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) { - var addr = to[_x2].split("@"); - addr[0] = unescapeComponent(addr[0]); - if (!options.unicodeSupport) { - //convert Unicode IDN -> ASCII IDN - try { - addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase()); - } catch (e) { - mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e; - } - } else { - addr[1] = unescapeComponent(addr[1], options).toLowerCase(); - } - to[_x2] = addr.join("@"); - } - return mailtoComponents; - }, - serialize: function serialize$$1(mailtoComponents, options) { - var components = mailtoComponents; - var to = toArray(mailtoComponents.to); - if (to) { - for (var x = 0, xl = to.length; x < xl; ++x) { - var toAddr = String(to[x]); - var atIdx = toAddr.lastIndexOf("@"); - var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar); - var domain = toAddr.slice(atIdx + 1); - //convert IDN via punycode - try { - domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain); - } catch (e) { - components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e; - } - to[x] = localPart + "@" + domain; - } - components.path = to.join(","); - } - var headers = mailtoComponents.headers = mailtoComponents.headers || {}; - if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject; - if (mailtoComponents.body) headers["body"] = mailtoComponents.body; - var fields = []; - for (var name in headers) { - if (headers[name] !== O[name]) { - fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) + "=" + headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar)); - } - } - if (fields.length) { - components.query = fields.join("&"); - } - return components; - } -}; - -var URN_PARSE = /^([^\:]+)\:(.*)/; -//RFC 2141 -var handler$5 = { - scheme: "urn", - parse: function parse$$1(components, options) { - var matches = components.path && components.path.match(URN_PARSE); - var urnComponents = components; - if (matches) { - var scheme = options.scheme || urnComponents.scheme || "urn"; - var nid = matches[1].toLowerCase(); - var nss = matches[2]; - var urnScheme = scheme + ":" + (options.nid || nid); - var schemeHandler = SCHEMES[urnScheme]; - urnComponents.nid = nid; - urnComponents.nss = nss; - urnComponents.path = undefined; - if (schemeHandler) { - urnComponents = schemeHandler.parse(urnComponents, options); - } - } else { - urnComponents.error = urnComponents.error || "URN can not be parsed."; - } - return urnComponents; - }, - serialize: function serialize$$1(urnComponents, options) { - var scheme = options.scheme || urnComponents.scheme || "urn"; - var nid = urnComponents.nid; - var urnScheme = scheme + ":" + (options.nid || nid); - var schemeHandler = SCHEMES[urnScheme]; - if (schemeHandler) { - urnComponents = schemeHandler.serialize(urnComponents, options); - } - var uriComponents = urnComponents; - var nss = urnComponents.nss; - uriComponents.path = (nid || options.nid) + ":" + nss; - return uriComponents; - } -}; - -var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/; -//RFC 4122 -var handler$6 = { - scheme: "urn:uuid", - parse: function parse(urnComponents, options) { - var uuidComponents = urnComponents; - uuidComponents.uuid = uuidComponents.nss; - uuidComponents.nss = undefined; - if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) { - uuidComponents.error = uuidComponents.error || "UUID is not valid."; - } - return uuidComponents; - }, - serialize: function serialize(uuidComponents, options) { - var urnComponents = uuidComponents; - //normalize UUID - urnComponents.nss = (uuidComponents.uuid || "").toLowerCase(); - return urnComponents; - } -}; - -SCHEMES[handler.scheme] = handler; -SCHEMES[handler$1.scheme] = handler$1; -SCHEMES[handler$2.scheme] = handler$2; -SCHEMES[handler$3.scheme] = handler$3; -SCHEMES[handler$4.scheme] = handler$4; -SCHEMES[handler$5.scheme] = handler$5; -SCHEMES[handler$6.scheme] = handler$6; - -exports.SCHEMES = SCHEMES; -exports.pctEncChar = pctEncChar; -exports.pctDecChars = pctDecChars; -exports.parse = parse; -exports.removeDotSegments = removeDotSegments; -exports.serialize = serialize; -exports.resolveComponents = resolveComponents; -exports.resolve = resolve; -exports.normalize = normalize; -exports.equal = equal; -exports.escapeComponent = escapeComponent; -exports.unescapeComponent = unescapeComponent; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); - - -},{}],"ajv":[function(require,module,exports){ -'use strict'; - -var compileSchema = require('./compile') - , resolve = require('./compile/resolve') - , Cache = require('./cache') - , SchemaObject = require('./compile/schema_obj') - , stableStringify = require('fast-json-stable-stringify') - , formats = require('./compile/formats') - , rules = require('./compile/rules') - , $dataMetaSchema = require('./data') - , util = require('./compile/util'); - -module.exports = Ajv; - -Ajv.prototype.validate = validate; -Ajv.prototype.compile = compile; -Ajv.prototype.addSchema = addSchema; -Ajv.prototype.addMetaSchema = addMetaSchema; -Ajv.prototype.validateSchema = validateSchema; -Ajv.prototype.getSchema = getSchema; -Ajv.prototype.removeSchema = removeSchema; -Ajv.prototype.addFormat = addFormat; -Ajv.prototype.errorsText = errorsText; - -Ajv.prototype._addSchema = _addSchema; -Ajv.prototype._compile = _compile; - -Ajv.prototype.compileAsync = require('./compile/async'); -var customKeyword = require('./keyword'); -Ajv.prototype.addKeyword = customKeyword.add; -Ajv.prototype.getKeyword = customKeyword.get; -Ajv.prototype.removeKeyword = customKeyword.remove; -Ajv.prototype.validateKeyword = customKeyword.validate; - -var errorClasses = require('./compile/error_classes'); -Ajv.ValidationError = errorClasses.Validation; -Ajv.MissingRefError = errorClasses.MissingRef; -Ajv.$dataMetaSchema = $dataMetaSchema; - -var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema'; - -var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes', 'strictDefaults' ]; -var META_SUPPORT_DATA = ['/properties']; - -/** - * Creates validator instance. - * Usage: `Ajv(opts)` - * @param {Object} opts optional options - * @return {Object} ajv instance - */ -function Ajv(opts) { - if (!(this instanceof Ajv)) return new Ajv(opts); - opts = this._opts = util.copy(opts) || {}; - setLogger(this); - this._schemas = {}; - this._refs = {}; - this._fragments = {}; - this._formats = formats(opts.format); - - this._cache = opts.cache || new Cache; - this._loadingSchemas = {}; - this._compilations = []; - this.RULES = rules(); - this._getId = chooseGetId(opts); - - opts.loopRequired = opts.loopRequired || Infinity; - if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true; - if (opts.serialize === undefined) opts.serialize = stableStringify; - this._metaOpts = getMetaSchemaOptions(this); - - if (opts.formats) addInitialFormats(this); - if (opts.keywords) addInitialKeywords(this); - addDefaultMetaSchema(this); - if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta); - if (opts.nullable) this.addKeyword('nullable', {metaSchema: {type: 'boolean'}}); - addInitialSchemas(this); -} - - - -/** - * Validate data using schema - * Schema will be compiled and cached (using serialized JSON as key. [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize. - * @this Ajv - * @param {String|Object} schemaKeyRef key, ref or schema object - * @param {Any} data to be validated - * @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`). - */ -function validate(schemaKeyRef, data) { - var v; - if (typeof schemaKeyRef == 'string') { - v = this.getSchema(schemaKeyRef); - if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"'); - } else { - var schemaObj = this._addSchema(schemaKeyRef); - v = schemaObj.validate || this._compile(schemaObj); - } - - var valid = v(data); - if (v.$async !== true) this.errors = v.errors; - return valid; -} - - -/** - * Create validating function for passed schema. - * @this Ajv - * @param {Object} schema schema object - * @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords. - * @return {Function} validating function - */ -function compile(schema, _meta) { - var schemaObj = this._addSchema(schema, undefined, _meta); - return schemaObj.validate || this._compile(schemaObj); -} - - -/** - * Adds schema to the instance. - * @this Ajv - * @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored. - * @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. - * @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead. - * @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. - * @return {Ajv} this for method chaining - */ -function addSchema(schema, key, _skipValidation, _meta) { - if (Array.isArray(schema)){ - for (var i=0; i} errors optional array of validation errors, if not passed errors from the instance are used. - * @param {Object} options optional options with properties `separator` and `dataVar`. - * @return {String} human readable string with all errors descriptions - */ -function errorsText(errors, options) { - errors = errors || this.errors; - if (!errors) return 'No errors'; - options = options || {}; - var separator = options.separator === undefined ? ', ' : options.separator; - var dataVar = options.dataVar === undefined ? 'data' : options.dataVar; - - var text = ''; - for (var i=0; i%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,u=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,h=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,d=/^(?:\/(?:[^~/]|~0|~1)*)*$/,p=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,f=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function m(e){return a.copy(m[e="full"==e?"full":"fast"])}function v(e){var r=e.match(o);if(!r)return!1;var t,a=+r[2],s=+r[3];return 1<=a&&a<=12&&1<=s&&s<=(2!=a||((t=+r[1])%4!=0||t%100==0&&t%400!=0)?i[a]:29)}function y(e,r){var t=e.match(n);if(!t)return!1;var a=t[1],s=t[2],o=t[3];return(a<=23&&s<=59&&o<=59||23==a&&59==s&&60==o)&&(!r||t[5])}(r.exports=m).fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":c,url:u,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:s,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:w,uuid:h,"json-pointer":d,"json-pointer-uri-fragment":p,"relative-json-pointer":f},m.full={date:v,time:y,"date-time":function(e){var r=e.split(g);return 2==r.length&&v(r[0])&&y(r[1],!0)},uri:function(e){return P.test(e)&&l.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":c,url:u,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:s,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:w,uuid:h,"json-pointer":d,"json-pointer-uri-fragment":p,"relative-json-pointer":f};var g=/t|\s/i;var P=/\/|:/;var E=/[^\\]\\Z/;function w(e){if(E.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}}},{"./util":10}],5:[function(e,r,t){"use strict";var R=e("./resolve"),$=e("./util"),j=e("./error_classes"),D=e("fast-json-stable-stringify"),O=e("../dotjs/validate"),I=$.ucs2length,A=e("fast-deep-equal"),k=j.Validation;function C(e,c,u,r){var d=this,p=this._opts,h=[void 0],f={},l=[],t={},m=[],a={},v=[],s=function(e,r,t){var a=L.call(this,e,r,t);return 0<=a?{index:a,compiling:!0}:{index:a=this._compilations.length,compiling:!(this._compilations[a]={schema:e,root:r,baseId:t})}}.call(this,e,c=c||{schema:e,refVal:h,refs:f},r),o=this._compilations[s.index];if(s.compiling)return o.callValidate=P;var y=this._formats,g=this.RULES;try{var i=E(e,c,u,r);o.validate=i;var n=o.callValidate;return n&&(n.schema=i.schema,n.errors=null,n.refs=i.refs,n.refVal=i.refVal,n.root=i.root,n.$async=i.$async,p.sourceCode&&(n.source=i.source)),i}finally{(function(e,r,t){var a=L.call(this,e,r,t);0<=a&&this._compilations.splice(a,1)}).call(this,e,c,r)}function P(){var e=o.validate,r=e.apply(this,arguments);return P.errors=e.errors,r}function E(e,r,t,a){var s=!r||r&&r.schema==e;if(r.schema!=c.schema)return C.call(d,e,r,t,a);var o=!0===e.$async,i=O({isTop:!0,schema:e,isRoot:s,baseId:a,root:r,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:j.MissingRef,RULES:g,validate:O,util:$,resolve:R,resolveRef:w,usePattern:_,useDefault:F,useCustomRule:x,opts:p,formats:y,logger:d.logger,self:d}),i=Q(h,z)+Q(l,N)+Q(m,q)+Q(v,T)+i;p.processCode&&(i=p.processCode(i,e));try{var n=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",i)(d,g,y,c,h,m,v,A,I,k);h[0]=n}catch(e){throw d.logger.error("Error compiling schema, function code:",i),e}return n.schema=e,n.errors=null,n.refs=f,n.refVal=h,n.root=s?n:r,o&&(n.$async=!0),!0===p.sourceCode&&(n.source={code:i,patterns:l,defaults:m}),n}function w(e,r,t){r=R.url(e,r);var a,s,o=f[r];if(void 0!==o)return S(a=h[o],s="refVal["+o+"]");if(!t&&c.refs){var i=c.refs[r];if(void 0!==i)return S(a=c.refVal[i],s=b(r,a))}s=b(r);var n,l=R.call(d,E,c,r);if(void 0!==l||(n=u&&u[r])&&(l=R.inlineRef(n,p.inlineRefs)?n:C.call(d,n,c,u,e)),void 0!==l)return S(h[f[r]]=l,s);delete f[r]}function b(e,r){var t=h.length;return h[t]=r,"refVal"+(f[e]=t)}function S(e,r){return"object"==typeof e||"boolean"==typeof e?{code:r,schema:e,inline:!0}:{code:r,$async:e&&!!e.$async}}function _(e){var r=t[e];return void 0===r&&(r=t[e]=l.length,l[r]=e),"pattern"+r}function F(e){switch(typeof e){case"boolean":case"number":return""+e;case"string":return $.toQuotedString(e);case"object":if(null===e)return"null";var r=D(e),t=a[r];return void 0===t&&(t=a[r]=m.length,m[t]=e),"default"+t}}function x(e,r,t,a){if(!1!==d._opts.validateSchema){var s=e.definition.dependencies;if(s&&!s.every(function(e){return Object.prototype.hasOwnProperty.call(t,e)}))throw new Error("parent schema must have all required keywords: "+s.join(","));var o=e.definition.validateSchema;if(o)if(!o(r)){var i="keyword schema is invalid: "+d.errorsText(o.errors);if("log"!=d._opts.validateSchema)throw new Error(i);d.logger.error(i)}}var n,l=e.definition.compile,c=e.definition.inline,u=e.definition.macro;if(l)n=l.call(d,r,t,a);else if(u)n=u.call(d,r,t,a),!1!==p.validateSchema&&d.validateSchema(n,!0);else if(c)n=c.call(d,a,e.keyword,r,t);else if(!(n=e.definition.validate))return;if(void 0===n)throw new Error('custom keyword "'+e.keyword+'"failed to compile');var h=v.length;return{code:"customRule"+h,validate:v[h]=n}}}function L(e,r,t){for(var a=0;a",_=P?">":"<",F=void 0;if(!y&&"number"!=typeof d&&void 0!==d)throw new Error(r+" must be number");if(!b&&void 0!==w&&"number"!=typeof w&&"boolean"!=typeof w)throw new Error(E+" must be number or boolean");b?(o="exclIsNumber"+u,i="' + "+(n="op"+u)+" + '",c+=" var schemaExcl"+u+" = "+(t=e.util.getData(w.$data,h,e.dataPathArr))+"; ",F=E,(l=l||[]).push(c+=" var "+(a="exclusive"+u)+"; var "+(s="exclType"+u)+" = typeof "+(t="schemaExcl"+u)+"; if ("+s+" != 'boolean' && "+s+" != 'undefined' && "+s+" != 'number') { "),c="",!1!==e.createErrors?(c+=" { keyword: '"+(F||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",!1!==e.opts.messages&&(c+=" , message: '"+E+" should be boolean' "),e.opts.verbose&&(c+=" , schema: validate.schema"+p+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),c+=" } "):c+=" {} ",x=c,c=l.pop(),c+=!e.compositeRule&&m?e.async?" throw new ValidationError(["+x+"]); ":" validate.errors = ["+x+"]; return false; ":" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c+=" } else if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" "+s+" == 'number' ? ( ("+a+" = "+g+" === undefined || "+t+" "+S+"= "+g+") ? "+v+" "+_+"= "+t+" : "+v+" "+_+" "+g+" ) : ( ("+a+" = "+t+" === true) ? "+v+" "+_+"= "+g+" : "+v+" "+_+" "+g+" ) || "+v+" !== "+v+") { var op"+u+" = "+a+" ? '"+S+"' : '"+S+"='; ",void 0===d&&(f=e.errSchemaPath+"/"+(F=E),g=t,y=b)):(i=S,(o="number"==typeof w)&&y?(n="'"+i+"'",c+=" if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" ( "+g+" === undefined || "+w+" "+S+"= "+g+" ? "+v+" "+_+"= "+w+" : "+v+" "+_+" "+g+" ) || "+v+" !== "+v+") { "):(o&&void 0===d?(a=!0,f=e.errSchemaPath+"/"+(F=E),g=w,_+="="):(o&&(g=Math[P?"min":"max"](w,d)),w===(!o||g)?(a=!0,f=e.errSchemaPath+"/"+(F=E),_+="="):(a=!1,i+="=")),n="'"+i+"'",c+=" if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" "+v+" "+_+" "+g+" || "+v+" !== "+v+") { ")),F=F||r,(l=l||[]).push(c),c="",!1!==e.createErrors?(c+=" { keyword: '"+(F||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { comparison: "+n+", limit: "+g+", exclusive: "+a+" } ",!1!==e.opts.messages&&(c+=" , message: 'should be "+i+" ",c+=y?"' + "+g:g+"'"),e.opts.verbose&&(c+=" , schema: ",c+=y?"validate.schema"+p:""+d,c+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),c+=" } "):c+=" {} ";var x=c;return c=l.pop(),c+=!e.compositeRule&&m?e.async?" throw new ValidationError(["+x+"]); ":" validate.errors = ["+x+"]; return false; ":" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c+=" } ",m&&(c+=" else { "),c}},{}],14:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ");var d=r,p=p||[];p.push(t+=" "+c+".length "+("maxItems"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT have ",t+="maxItems"==r?"more":"fewer",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" items' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],15:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),t+=!1===e.opts.unicode?" "+c+".length ":" ucs2length("+c+") ";var d=r,p=p||[];p.push(t+=" "+("maxLength"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT be ",t+="maxLength"==r?"longer":"shorter",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" characters' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],16:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ");var d=r,p=p||[];p.push(t+=" Object.keys("+c+").length "+("maxProperties"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT have ",t+="maxProperties"==r?"more":"fewer",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" properties' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],17:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.schema[r],s=e.schemaPath+e.util.getProperty(r),o=e.errSchemaPath+"/"+r,i=!e.opts.allErrors,n=e.util.copy(e),l="";n.level++;var c="valid"+n.level,u=n.baseId,h=!0,d=a;if(d)for(var p,f=-1,m=d.length-1;f "+_+") { ",x=c+"["+_+"]",d.schema=$,d.schemaPath=i+"["+_+"]",d.errSchemaPath=n+"/"+_,d.errorPath=e.util.getPathExpr(e.errorPath,_,e.opts.jsonPointers,!0),d.dataPathArr[v]=_,R=e.validate(d),d.baseId=g,e.util.varOccurences(R,y)<2?t+=" "+e.util.varReplace(R,y,x)+" ":t+=" var "+y+" = "+x+"; "+R+" ",t+=" } ",l&&(t+=" if ("+f+") { ",p+="}"))}"object"==typeof b&&(e.opts.strictKeywords?"object"==typeof b&&0 "+o.length+") { for (var "+m+" = "+o.length+"; "+m+" < "+c+".length; "+m+"++) { ",d.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers,!0),x=c+"["+m+"]",d.dataPathArr[v]=m,R=e.validate(d),d.baseId=g,e.util.varOccurences(R,y)<2?t+=" "+e.util.varReplace(R,y,x)+" ":t+=" var "+y+" = "+x+"; "+R+" ",l&&(t+=" if (!"+f+") break; "),t+=" } } ",l&&(t+=" if ("+f+") { ",p+="}"))}else{(e.opts.strictKeywords?"object"==typeof o&&0 1e-"+e.opts.multipleOfPrecision+" ":" division"+a+" !== parseInt(division"+a+") ",t+=" ) ",u&&(t+=" ) ");var d=d||[];d.push(t+=" ) { "),t="",!1!==e.createErrors?(t+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { multipleOf: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should be multiple of ",t+=u?"' + "+h:h+"'"),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var p=t,t=d.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],30:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u="errs__"+a,h=e.util.copy(e);h.level++;var d,p,f,m,v="valid"+h.level;return(e.opts.strictKeywords?"object"==typeof o&&0 1) { ",t=e.schema.items&&e.schema.items.type,a=Array.isArray(t),!t||"object"==t||"array"==t||a&&(0<=t.indexOf("object")||0<=t.indexOf("array"))?i+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+f+" = false; break outer; } } } ":(i+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ",i+=" if ("+e.util["checkDataType"+(a?"s":"")](t,"item",e.opts.strictNumbers,!0)+") continue; ",a&&(i+=" if (typeof item == 'string') item = '\"' + item; "),i+=" if (typeof itemIndices[item] == 'number') { "+f+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "),i+=" } ",m&&(i+=" } "),(s=s||[]).push(i+=" if (!"+f+") { "),i="",!1!==e.createErrors?(i+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(i+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(i+=" , schema: ",i+=m?"validate.schema"+u:""+c,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ",o=i,i=s.pop(),i+=!e.compositeRule&&d?e.async?" throw new ValidationError(["+o+"]); ":" validate.errors = ["+o+"]; return false; ":" var err = "+o+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",d&&(i+=" else { ")):d&&(i+=" if (true) { "),i}},{}],38:[function(e,r,t){"use strict";r.exports=function(a,e){var r="",t=!0===a.schema.$async,s=a.util.schemaHasRulesExcept(a.schema,a.RULES.all,"$ref"),o=a.self._getId(a.schema);if(a.opts.strictKeywords){var i=a.util.schemaUnknownRules(a.schema,a.RULES.keywords);if(i){var n="unknown keyword: "+i;if("log"!==a.opts.strictKeywords)throw new Error(n);a.logger.warn(n)}}if(a.isTop&&(r+=" var validate = ",t&&(a.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(a.opts.sourceCode||a.opts.processCode)&&(r+=" /*# sourceURL="+o+" */ ")),"boolean"==typeof a.schema||!s&&!a.schema.$ref){var l=a.level,c=a.dataLevel,u=a.schema[e="false schema"],h=a.schemaPath+a.util.getProperty(e),d=a.errSchemaPath+"/"+e,p=!a.opts.allErrors,f="data"+(c||""),m="valid"+l;return!1===a.schema?(a.isTop?p=!0:r+=" var "+m+" = false; ",(U=U||[]).push(r),r="",!1!==a.createErrors?(r+=" { keyword: 'false schema' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(d)+" , params: {} ",!1!==a.opts.messages&&(r+=" , message: 'boolean schema is false' "),a.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+a.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",D=r,r=U.pop(),r+=!a.compositeRule&&p?a.async?" throw new ValidationError(["+D+"]); ":" validate.errors = ["+D+"]; return false; ":" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "):r+=a.isTop?t?" return data; ":" validate.errors = null; return true; ":" var "+m+" = true; ",a.isTop&&(r+=" }; return validate; "),r}if(a.isTop){var v=a.isTop,l=a.level=0,c=a.dataLevel=0,f="data";if(a.rootId=a.resolve.fullPath(a.self._getId(a.root.schema)),a.baseId=a.baseId||a.rootId,delete a.isTop,a.dataPathArr=[""],void 0!==a.schema.default&&a.opts.useDefaults&&a.opts.strictDefaults){var y="default is ignored in the schema root";if("log"!==a.opts.strictDefaults)throw new Error(y);a.logger.warn(y)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{l=a.level,f="data"+((c=a.dataLevel)||"");if(o&&(a.baseId=a.resolve.url(a.baseId,o)),t&&!a.async)throw new Error("async schema in sync schema");r+=" var errs_"+l+" = errors;"}var g,m="valid"+l,p=!a.opts.allErrors,P="",E="",w=a.schema.type,b=Array.isArray(w);if(w&&a.opts.nullable&&!0===a.schema.nullable&&(b?-1==w.indexOf("null")&&(w=w.concat("null")):"null"!=w&&(w=[w,"null"],b=!0)),b&&1==w.length&&(w=w[0],b=!1),a.schema.$ref&&s){if("fail"==a.opts.extendRefs)throw new Error('$ref: validation keywords used in schema at path "'+a.errSchemaPath+'" (see option extendRefs)');!0!==a.opts.extendRefs&&(s=!1,a.logger.warn('$ref: keywords ignored in schema at path "'+a.errSchemaPath+'"'))}if(a.schema.$comment&&a.opts.$comment&&(r+=" "+a.RULES.all.$comment.code(a,"$comment")),w){a.opts.coerceTypes&&(g=a.util.coerceToTypes(a.opts.coerceTypes,w));var S=a.RULES.types[w];if(g||b||!0===S||S&&!Z(S)){h=a.schemaPath+".type",d=a.errSchemaPath+"/type",h=a.schemaPath+".type",d=a.errSchemaPath+"/type";if(r+=" if ("+a.util[b?"checkDataTypes":"checkDataType"](w,f,a.opts.strictNumbers,!0)+") { ",g){var _="dataType"+l,F="coerced"+l;r+=" var "+_+" = typeof "+f+"; var "+F+" = undefined; ","array"==a.opts.coerceTypes&&(r+=" if ("+_+" == 'object' && Array.isArray("+f+") && "+f+".length == 1) { "+f+" = "+f+"[0]; "+_+" = typeof "+f+"; if ("+a.util.checkDataType(a.schema.type,f,a.opts.strictNumbers)+") "+F+" = "+f+"; } "),r+=" if ("+F+" !== undefined) ; ";var x=g;if(x)for(var R,$=-1,j=x.length-1;$= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=Math.floor,C=String.fromCharCode;function L(e){throw new RangeError(i[e])}function n(e,r){var t=e.split("@"),a="";return 1>1,e+=k(e/r);455k((A-a)/h))&&L("overflow"),a+=p*h;var f=d<=o?1:o+26<=d?26:d-o;if(pk(A/m)&&L("overflow"),h*=m}var v=r.length+1,o=z(a-u,v,0==u);k(a/v)>A-s&&L("overflow"),s+=k(a/v),a%=v,r.splice(a++,0,s)}return String.fromCodePoint.apply(String,r)}function c(e){var r=[],t=(e=N(e)).length,a=128,s=0,o=72,i=!0,n=!1,l=void 0;try{for(var c,u=e[Symbol.iterator]();!(i=(c=u.next()).done);i=!0){var h=c.value;h<128&&r.push(C(h))}}catch(e){n=!0,l=e}finally{try{!i&&u.return&&u.return()}finally{if(n)throw l}}var d=r.length,p=d;for(d&&r.push("-");pk((A-s)/w)&&L("overflow"),s+=(f-a)*w,a=f;var b=!0,S=!1,_=void 0;try{for(var F,x=e[Symbol.iterator]();!(b=(F=x.next()).done);b=!0){var R=F.value;if(RA&&L("overflow"),R==a){for(var $=s,j=36;;j+=36){var D=j<=o?1:o+26<=j?26:j-o;if($>6|192).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase():"%"+(r>>12|224).toString(16).toUpperCase()+"%"+(r>>6&63|128).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase()}function p(e){for(var r="",t=0,a=e.length;tA-Z\\x5E-\\x7E]",'[\\"\\\\]')),Y=new RegExp(K,"g"),W=new RegExp("(?:(?:%[EFef][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f])|(?:%[89A-Fa-f][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f])|(?:%[0-9A-Fa-f][0-9A-Fa-f]))","g"),X=new RegExp(J("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',G),"g"),ee=new RegExp(J("[^]",K,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),re=ee;function te(e){var r=p(e);return r.match(Y)?r:e}var ae={scheme:"mailto",parse:function(e,r){var t=e,a=t.to=t.path?t.path.split(","):[];if(t.path=void 0,t.query){for(var s=!1,o={},i=t.query.split("&"),n=0,l=i.length;n); - - message: string; - errors: Array; - ajv: true; - validation: true; - } - - class MissingRefError extends Error { - constructor(baseId: string, ref: string, message?: string); - static message: (baseId: string, ref: string) => string; - - message: string; - missingRef: string; - missingSchema: string; - } -} - -declare namespace ajv { - type ValidationError = AjvErrors.ValidationError; - - type MissingRefError = AjvErrors.MissingRefError; - - interface Ajv { - /** - * Validate data using schema - * Schema will be compiled and cached (using serialized JSON as key, [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize by default). - * @param {string|object|Boolean} schemaKeyRef key, ref or schema object - * @param {Any} data to be validated - * @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`). - */ - validate(schemaKeyRef: object | string | boolean, data: any): boolean | PromiseLike; - /** - * Create validating function for passed schema. - * @param {object|Boolean} schema schema object - * @return {Function} validating function - */ - compile(schema: object | boolean): ValidateFunction; - /** - * Creates validating function for passed schema with asynchronous loading of missing schemas. - * `loadSchema` option should be a function that accepts schema uri and node-style callback. - * @this Ajv - * @param {object|Boolean} schema schema object - * @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped - * @param {Function} callback optional node-style callback, it is always called with 2 parameters: error (or null) and validating function. - * @return {PromiseLike} validating function - */ - compileAsync(schema: object | boolean, meta?: Boolean, callback?: (err: Error, validate: ValidateFunction) => any): PromiseLike; - /** - * Adds schema to the instance. - * @param {object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored. - * @param {string} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. - * @return {Ajv} this for method chaining - */ - addSchema(schema: Array | object, key?: string): Ajv; - /** - * Add schema that will be used to validate other schemas - * options in META_IGNORE_OPTIONS are alway set to false - * @param {object} schema schema object - * @param {string} key optional schema key - * @return {Ajv} this for method chaining - */ - addMetaSchema(schema: object, key?: string): Ajv; - /** - * Validate schema - * @param {object|Boolean} schema schema to validate - * @return {Boolean} true if schema is valid - */ - validateSchema(schema: object | boolean): boolean; - /** - * Get compiled schema from the instance by `key` or `ref`. - * @param {string} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id). - * @return {Function} schema validating function (with property `schema`). Returns undefined if keyRef can't be resolved to an existing schema. - */ - getSchema(keyRef: string): ValidateFunction | undefined; - /** - * Remove cached schema(s). - * If no parameter is passed all schemas but meta-schemas are removed. - * If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. - * Even if schema is referenced by other schemas it still can be removed as other schemas have local references. - * @param {string|object|RegExp|Boolean} schemaKeyRef key, ref, pattern to match key/ref or schema object - * @return {Ajv} this for method chaining - */ - removeSchema(schemaKeyRef?: object | string | RegExp | boolean): Ajv; - /** - * Add custom format - * @param {string} name format name - * @param {string|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid) - * @return {Ajv} this for method chaining - */ - addFormat(name: string, format: FormatValidator | FormatDefinition): Ajv; - /** - * Define custom keyword - * @this Ajv - * @param {string} keyword custom keyword, should be a valid identifier, should be different from all standard, custom and macro keywords. - * @param {object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`. - * @return {Ajv} this for method chaining - */ - addKeyword(keyword: string, definition: KeywordDefinition): Ajv; - /** - * Get keyword definition - * @this Ajv - * @param {string} keyword pre-defined or custom keyword. - * @return {object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise. - */ - getKeyword(keyword: string): object | boolean; - /** - * Remove keyword - * @this Ajv - * @param {string} keyword pre-defined or custom keyword. - * @return {Ajv} this for method chaining - */ - removeKeyword(keyword: string): Ajv; - /** - * Validate keyword - * @this Ajv - * @param {object} definition keyword definition object - * @param {boolean} throwError true to throw exception if definition is invalid - * @return {boolean} validation result - */ - validateKeyword(definition: KeywordDefinition, throwError: boolean): boolean; - /** - * Convert array of error message objects to string - * @param {Array} errors optional array of validation errors, if not passed errors from the instance are used. - * @param {object} options optional options with properties `separator` and `dataVar`. - * @return {string} human readable string with all errors descriptions - */ - errorsText(errors?: Array | null, options?: ErrorsTextOptions): string; - errors?: Array | null; - _opts: Options; - } - - interface CustomLogger { - log(...args: any[]): any; - warn(...args: any[]): any; - error(...args: any[]): any; - } - - interface ValidateFunction { - ( - data: any, - dataPath?: string, - parentData?: object | Array, - parentDataProperty?: string | number, - rootData?: object | Array - ): boolean | PromiseLike; - schema?: object | boolean; - errors?: null | Array; - refs?: object; - refVal?: Array; - root?: ValidateFunction | object; - $async?: true; - source?: object; - } - - interface Options { - $data?: boolean; - allErrors?: boolean; - verbose?: boolean; - jsonPointers?: boolean; - uniqueItems?: boolean; - unicode?: boolean; - format?: false | string; - formats?: object; - keywords?: object; - unknownFormats?: true | string[] | 'ignore'; - schemas?: Array | object; - schemaId?: '$id' | 'id' | 'auto'; - missingRefs?: true | 'ignore' | 'fail'; - extendRefs?: true | 'ignore' | 'fail'; - loadSchema?: (uri: string, cb?: (err: Error, schema: object) => void) => PromiseLike; - removeAdditional?: boolean | 'all' | 'failing'; - useDefaults?: boolean | 'empty' | 'shared'; - coerceTypes?: boolean | 'array'; - strictDefaults?: boolean | 'log'; - strictKeywords?: boolean | 'log'; - strictNumbers?: boolean; - async?: boolean | string; - transpile?: string | ((code: string) => string); - meta?: boolean | object; - validateSchema?: boolean | 'log'; - addUsedSchema?: boolean; - inlineRefs?: boolean | number; - passContext?: boolean; - loopRequired?: number; - ownProperties?: boolean; - multipleOfPrecision?: boolean | number; - errorDataPath?: string, - messages?: boolean; - sourceCode?: boolean; - processCode?: (code: string, schema: object) => string; - cache?: object; - logger?: CustomLogger | false; - nullable?: boolean; - serialize?: ((schema: object | boolean) => any) | false; - } - - type FormatValidator = string | RegExp | ((data: string) => boolean | PromiseLike); - type NumberFormatValidator = ((data: number) => boolean | PromiseLike); - - interface NumberFormatDefinition { - type: "number", - validate: NumberFormatValidator; - compare?: (data1: number, data2: number) => number; - async?: boolean; - } - - interface StringFormatDefinition { - type?: "string", - validate: FormatValidator; - compare?: (data1: string, data2: string) => number; - async?: boolean; - } - - type FormatDefinition = NumberFormatDefinition | StringFormatDefinition; - - interface KeywordDefinition { - type?: string | Array; - async?: boolean; - $data?: boolean; - errors?: boolean | string; - metaSchema?: object; - // schema: false makes validate not to expect schema (ValidateFunction) - schema?: boolean; - statements?: boolean; - dependencies?: Array; - modifying?: boolean; - valid?: boolean; - // one and only one of the following properties should be present - validate?: SchemaValidateFunction | ValidateFunction; - compile?: (schema: any, parentSchema: object, it: CompilationContext) => ValidateFunction; - macro?: (schema: any, parentSchema: object, it: CompilationContext) => object | boolean; - inline?: (it: CompilationContext, keyword: string, schema: any, parentSchema: object) => string; - } - - interface CompilationContext { - level: number; - dataLevel: number; - dataPathArr: string[]; - schema: any; - schemaPath: string; - baseId: string; - async: boolean; - opts: Options; - formats: { - [index: string]: FormatDefinition | undefined; - }; - keywords: { - [index: string]: KeywordDefinition | undefined; - }; - compositeRule: boolean; - validate: (schema: object) => boolean; - util: { - copy(obj: any, target?: any): any; - toHash(source: string[]): { [index: string]: true | undefined }; - equal(obj: any, target: any): boolean; - getProperty(str: string): string; - schemaHasRules(schema: object, rules: any): string; - escapeQuotes(str: string): string; - toQuotedString(str: string): string; - getData(jsonPointer: string, dataLevel: number, paths: string[]): string; - escapeJsonPointer(str: string): string; - unescapeJsonPointer(str: string): string; - escapeFragment(str: string): string; - unescapeFragment(str: string): string; - }; - self: Ajv; - } - - interface SchemaValidateFunction { - ( - schema: any, - data: any, - parentSchema?: object, - dataPath?: string, - parentData?: object | Array, - parentDataProperty?: string | number, - rootData?: object | Array - ): boolean | PromiseLike; - errors?: Array; - } - - interface ErrorsTextOptions { - separator?: string; - dataVar?: string; - } - - interface ErrorObject { - keyword: string; - dataPath: string; - schemaPath: string; - params: ErrorParameters; - // Added to validation errors of propertyNames keyword schema - propertyName?: string; - // Excluded if messages set to false. - message?: string; - // These are added with the `verbose` option. - schema?: any; - parentSchema?: object; - data?: any; - } - - type ErrorParameters = RefParams | LimitParams | AdditionalPropertiesParams | - DependenciesParams | FormatParams | ComparisonParams | - MultipleOfParams | PatternParams | RequiredParams | - TypeParams | UniqueItemsParams | CustomParams | - PatternRequiredParams | PropertyNamesParams | - IfParams | SwitchParams | NoParams | EnumParams; - - interface RefParams { - ref: string; - } - - interface LimitParams { - limit: number; - } - - interface AdditionalPropertiesParams { - additionalProperty: string; - } - - interface DependenciesParams { - property: string; - missingProperty: string; - depsCount: number; - deps: string; - } - - interface FormatParams { - format: string - } - - interface ComparisonParams { - comparison: string; - limit: number | string; - exclusive: boolean; - } - - interface MultipleOfParams { - multipleOf: number; - } - - interface PatternParams { - pattern: string; - } - - interface RequiredParams { - missingProperty: string; - } - - interface TypeParams { - type: string; - } - - interface UniqueItemsParams { - i: number; - j: number; - } - - interface CustomParams { - keyword: string; - } - - interface PatternRequiredParams { - missingPattern: string; - } - - interface PropertyNamesParams { - propertyName: string; - } - - interface IfParams { - failingKeyword: string; - } - - interface SwitchParams { - caseIndex: number; - } - - interface NoParams { } - - interface EnumParams { - allowedValues: Array; - } -} - -export = ajv; diff --git a/node_modules/webpack/node_modules/ajv/lib/ajv.js b/node_modules/webpack/node_modules/ajv/lib/ajv.js deleted file mode 100644 index 06a45b6..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/ajv.js +++ /dev/null @@ -1,506 +0,0 @@ -'use strict'; - -var compileSchema = require('./compile') - , resolve = require('./compile/resolve') - , Cache = require('./cache') - , SchemaObject = require('./compile/schema_obj') - , stableStringify = require('fast-json-stable-stringify') - , formats = require('./compile/formats') - , rules = require('./compile/rules') - , $dataMetaSchema = require('./data') - , util = require('./compile/util'); - -module.exports = Ajv; - -Ajv.prototype.validate = validate; -Ajv.prototype.compile = compile; -Ajv.prototype.addSchema = addSchema; -Ajv.prototype.addMetaSchema = addMetaSchema; -Ajv.prototype.validateSchema = validateSchema; -Ajv.prototype.getSchema = getSchema; -Ajv.prototype.removeSchema = removeSchema; -Ajv.prototype.addFormat = addFormat; -Ajv.prototype.errorsText = errorsText; - -Ajv.prototype._addSchema = _addSchema; -Ajv.prototype._compile = _compile; - -Ajv.prototype.compileAsync = require('./compile/async'); -var customKeyword = require('./keyword'); -Ajv.prototype.addKeyword = customKeyword.add; -Ajv.prototype.getKeyword = customKeyword.get; -Ajv.prototype.removeKeyword = customKeyword.remove; -Ajv.prototype.validateKeyword = customKeyword.validate; - -var errorClasses = require('./compile/error_classes'); -Ajv.ValidationError = errorClasses.Validation; -Ajv.MissingRefError = errorClasses.MissingRef; -Ajv.$dataMetaSchema = $dataMetaSchema; - -var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema'; - -var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes', 'strictDefaults' ]; -var META_SUPPORT_DATA = ['/properties']; - -/** - * Creates validator instance. - * Usage: `Ajv(opts)` - * @param {Object} opts optional options - * @return {Object} ajv instance - */ -function Ajv(opts) { - if (!(this instanceof Ajv)) return new Ajv(opts); - opts = this._opts = util.copy(opts) || {}; - setLogger(this); - this._schemas = {}; - this._refs = {}; - this._fragments = {}; - this._formats = formats(opts.format); - - this._cache = opts.cache || new Cache; - this._loadingSchemas = {}; - this._compilations = []; - this.RULES = rules(); - this._getId = chooseGetId(opts); - - opts.loopRequired = opts.loopRequired || Infinity; - if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true; - if (opts.serialize === undefined) opts.serialize = stableStringify; - this._metaOpts = getMetaSchemaOptions(this); - - if (opts.formats) addInitialFormats(this); - if (opts.keywords) addInitialKeywords(this); - addDefaultMetaSchema(this); - if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta); - if (opts.nullable) this.addKeyword('nullable', {metaSchema: {type: 'boolean'}}); - addInitialSchemas(this); -} - - - -/** - * Validate data using schema - * Schema will be compiled and cached (using serialized JSON as key. [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize. - * @this Ajv - * @param {String|Object} schemaKeyRef key, ref or schema object - * @param {Any} data to be validated - * @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`). - */ -function validate(schemaKeyRef, data) { - var v; - if (typeof schemaKeyRef == 'string') { - v = this.getSchema(schemaKeyRef); - if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"'); - } else { - var schemaObj = this._addSchema(schemaKeyRef); - v = schemaObj.validate || this._compile(schemaObj); - } - - var valid = v(data); - if (v.$async !== true) this.errors = v.errors; - return valid; -} - - -/** - * Create validating function for passed schema. - * @this Ajv - * @param {Object} schema schema object - * @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords. - * @return {Function} validating function - */ -function compile(schema, _meta) { - var schemaObj = this._addSchema(schema, undefined, _meta); - return schemaObj.validate || this._compile(schemaObj); -} - - -/** - * Adds schema to the instance. - * @this Ajv - * @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored. - * @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. - * @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead. - * @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. - * @return {Ajv} this for method chaining - */ -function addSchema(schema, key, _skipValidation, _meta) { - if (Array.isArray(schema)){ - for (var i=0; i} errors optional array of validation errors, if not passed errors from the instance are used. - * @param {Object} options optional options with properties `separator` and `dataVar`. - * @return {String} human readable string with all errors descriptions - */ -function errorsText(errors, options) { - errors = errors || this.errors; - if (!errors) return 'No errors'; - options = options || {}; - var separator = options.separator === undefined ? ', ' : options.separator; - var dataVar = options.dataVar === undefined ? 'data' : options.dataVar; - - var text = ''; - for (var i=0; i%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i; -// For the source: https://gist.github.com/dperini/729294 -// For test cases: https://mathiasbynens.be/demo/url-regex -// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983. -// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu; -var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i; -var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i; -var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/; -var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i; -var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/; - - -module.exports = formats; - -function formats(mode) { - mode = mode == 'full' ? 'full' : 'fast'; - return util.copy(formats[mode]); -} - - -formats.fast = { - // date: http://tools.ietf.org/html/rfc3339#section-5.6 - date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/, - // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 - time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, - 'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, - // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js - uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i, - 'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i, - 'uri-template': URITEMPLATE, - url: URL, - // email (sources from jsen validator): - // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363 - // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation') - email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i, - hostname: HOSTNAME, - // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html - ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, - // optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses - ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, - regex: regex, - // uuid: http://tools.ietf.org/html/rfc4122 - uuid: UUID, - // JSON-pointer: https://tools.ietf.org/html/rfc6901 - // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A - 'json-pointer': JSON_POINTER, - 'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT, - // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00 - 'relative-json-pointer': RELATIVE_JSON_POINTER -}; - - -formats.full = { - date: date, - time: time, - 'date-time': date_time, - uri: uri, - 'uri-reference': URIREF, - 'uri-template': URITEMPLATE, - url: URL, - email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, - hostname: HOSTNAME, - ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, - ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, - regex: regex, - uuid: UUID, - 'json-pointer': JSON_POINTER, - 'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT, - 'relative-json-pointer': RELATIVE_JSON_POINTER -}; - - -function isLeapYear(year) { - // https://tools.ietf.org/html/rfc3339#appendix-C - return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); -} - - -function date(str) { - // full-date from http://tools.ietf.org/html/rfc3339#section-5.6 - var matches = str.match(DATE); - if (!matches) return false; - - var year = +matches[1]; - var month = +matches[2]; - var day = +matches[3]; - - return month >= 1 && month <= 12 && day >= 1 && - day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]); -} - - -function time(str, full) { - var matches = str.match(TIME); - if (!matches) return false; - - var hour = matches[1]; - var minute = matches[2]; - var second = matches[3]; - var timeZone = matches[5]; - return ((hour <= 23 && minute <= 59 && second <= 59) || - (hour == 23 && minute == 59 && second == 60)) && - (!full || timeZone); -} - - -var DATE_TIME_SEPARATOR = /t|\s/i; -function date_time(str) { - // http://tools.ietf.org/html/rfc3339#section-5.6 - var dateTime = str.split(DATE_TIME_SEPARATOR); - return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true); -} - - -var NOT_URI_FRAGMENT = /\/|:/; -function uri(str) { - // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "." - return NOT_URI_FRAGMENT.test(str) && URI.test(str); -} - - -var Z_ANCHOR = /[^\\]\\Z/; -function regex(str) { - if (Z_ANCHOR.test(str)) return false; - try { - new RegExp(str); - return true; - } catch(e) { - return false; - } -} diff --git a/node_modules/webpack/node_modules/ajv/lib/compile/index.js b/node_modules/webpack/node_modules/ajv/lib/compile/index.js deleted file mode 100644 index 97518c4..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/compile/index.js +++ /dev/null @@ -1,387 +0,0 @@ -'use strict'; - -var resolve = require('./resolve') - , util = require('./util') - , errorClasses = require('./error_classes') - , stableStringify = require('fast-json-stable-stringify'); - -var validateGenerator = require('../dotjs/validate'); - -/** - * Functions below are used inside compiled validations function - */ - -var ucs2length = util.ucs2length; -var equal = require('fast-deep-equal'); - -// this error is thrown by async schemas to return validation errors via exception -var ValidationError = errorClasses.Validation; - -module.exports = compile; - - -/** - * Compiles schema to validation function - * @this Ajv - * @param {Object} schema schema object - * @param {Object} root object with information about the root schema for this schema - * @param {Object} localRefs the hash of local references inside the schema (created by resolve.id), used for inline resolution - * @param {String} baseId base ID for IDs in the schema - * @return {Function} validation function - */ -function compile(schema, root, localRefs, baseId) { - /* jshint validthis: true, evil: true */ - /* eslint no-shadow: 0 */ - var self = this - , opts = this._opts - , refVal = [ undefined ] - , refs = {} - , patterns = [] - , patternsHash = {} - , defaults = [] - , defaultsHash = {} - , customRules = []; - - root = root || { schema: schema, refVal: refVal, refs: refs }; - - var c = checkCompiling.call(this, schema, root, baseId); - var compilation = this._compilations[c.index]; - if (c.compiling) return (compilation.callValidate = callValidate); - - var formats = this._formats; - var RULES = this.RULES; - - try { - var v = localCompile(schema, root, localRefs, baseId); - compilation.validate = v; - var cv = compilation.callValidate; - if (cv) { - cv.schema = v.schema; - cv.errors = null; - cv.refs = v.refs; - cv.refVal = v.refVal; - cv.root = v.root; - cv.$async = v.$async; - if (opts.sourceCode) cv.source = v.source; - } - return v; - } finally { - endCompiling.call(this, schema, root, baseId); - } - - /* @this {*} - custom context, see passContext option */ - function callValidate() { - /* jshint validthis: true */ - var validate = compilation.validate; - var result = validate.apply(this, arguments); - callValidate.errors = validate.errors; - return result; - } - - function localCompile(_schema, _root, localRefs, baseId) { - var isRoot = !_root || (_root && _root.schema == _schema); - if (_root.schema != root.schema) - return compile.call(self, _schema, _root, localRefs, baseId); - - var $async = _schema.$async === true; - - var sourceCode = validateGenerator({ - isTop: true, - schema: _schema, - isRoot: isRoot, - baseId: baseId, - root: _root, - schemaPath: '', - errSchemaPath: '#', - errorPath: '""', - MissingRefError: errorClasses.MissingRef, - RULES: RULES, - validate: validateGenerator, - util: util, - resolve: resolve, - resolveRef: resolveRef, - usePattern: usePattern, - useDefault: useDefault, - useCustomRule: useCustomRule, - opts: opts, - formats: formats, - logger: self.logger, - self: self - }); - - sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode) - + vars(defaults, defaultCode) + vars(customRules, customRuleCode) - + sourceCode; - - if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema); - // console.log('\n\n\n *** \n', JSON.stringify(sourceCode)); - var validate; - try { - var makeValidate = new Function( - 'self', - 'RULES', - 'formats', - 'root', - 'refVal', - 'defaults', - 'customRules', - 'equal', - 'ucs2length', - 'ValidationError', - sourceCode - ); - - validate = makeValidate( - self, - RULES, - formats, - root, - refVal, - defaults, - customRules, - equal, - ucs2length, - ValidationError - ); - - refVal[0] = validate; - } catch(e) { - self.logger.error('Error compiling schema, function code:', sourceCode); - throw e; - } - - validate.schema = _schema; - validate.errors = null; - validate.refs = refs; - validate.refVal = refVal; - validate.root = isRoot ? validate : _root; - if ($async) validate.$async = true; - if (opts.sourceCode === true) { - validate.source = { - code: sourceCode, - patterns: patterns, - defaults: defaults - }; - } - - return validate; - } - - function resolveRef(baseId, ref, isRoot) { - ref = resolve.url(baseId, ref); - var refIndex = refs[ref]; - var _refVal, refCode; - if (refIndex !== undefined) { - _refVal = refVal[refIndex]; - refCode = 'refVal[' + refIndex + ']'; - return resolvedRef(_refVal, refCode); - } - if (!isRoot && root.refs) { - var rootRefId = root.refs[ref]; - if (rootRefId !== undefined) { - _refVal = root.refVal[rootRefId]; - refCode = addLocalRef(ref, _refVal); - return resolvedRef(_refVal, refCode); - } - } - - refCode = addLocalRef(ref); - var v = resolve.call(self, localCompile, root, ref); - if (v === undefined) { - var localSchema = localRefs && localRefs[ref]; - if (localSchema) { - v = resolve.inlineRef(localSchema, opts.inlineRefs) - ? localSchema - : compile.call(self, localSchema, root, localRefs, baseId); - } - } - - if (v === undefined) { - removeLocalRef(ref); - } else { - replaceLocalRef(ref, v); - return resolvedRef(v, refCode); - } - } - - function addLocalRef(ref, v) { - var refId = refVal.length; - refVal[refId] = v; - refs[ref] = refId; - return 'refVal' + refId; - } - - function removeLocalRef(ref) { - delete refs[ref]; - } - - function replaceLocalRef(ref, v) { - var refId = refs[ref]; - refVal[refId] = v; - } - - function resolvedRef(refVal, code) { - return typeof refVal == 'object' || typeof refVal == 'boolean' - ? { code: code, schema: refVal, inline: true } - : { code: code, $async: refVal && !!refVal.$async }; - } - - function usePattern(regexStr) { - var index = patternsHash[regexStr]; - if (index === undefined) { - index = patternsHash[regexStr] = patterns.length; - patterns[index] = regexStr; - } - return 'pattern' + index; - } - - function useDefault(value) { - switch (typeof value) { - case 'boolean': - case 'number': - return '' + value; - case 'string': - return util.toQuotedString(value); - case 'object': - if (value === null) return 'null'; - var valueStr = stableStringify(value); - var index = defaultsHash[valueStr]; - if (index === undefined) { - index = defaultsHash[valueStr] = defaults.length; - defaults[index] = value; - } - return 'default' + index; - } - } - - function useCustomRule(rule, schema, parentSchema, it) { - if (self._opts.validateSchema !== false) { - var deps = rule.definition.dependencies; - if (deps && !deps.every(function(keyword) { - return Object.prototype.hasOwnProperty.call(parentSchema, keyword); - })) - throw new Error('parent schema must have all required keywords: ' + deps.join(',')); - - var validateSchema = rule.definition.validateSchema; - if (validateSchema) { - var valid = validateSchema(schema); - if (!valid) { - var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors); - if (self._opts.validateSchema == 'log') self.logger.error(message); - else throw new Error(message); - } - } - } - - var compile = rule.definition.compile - , inline = rule.definition.inline - , macro = rule.definition.macro; - - var validate; - if (compile) { - validate = compile.call(self, schema, parentSchema, it); - } else if (macro) { - validate = macro.call(self, schema, parentSchema, it); - if (opts.validateSchema !== false) self.validateSchema(validate, true); - } else if (inline) { - validate = inline.call(self, it, rule.keyword, schema, parentSchema); - } else { - validate = rule.definition.validate; - if (!validate) return; - } - - if (validate === undefined) - throw new Error('custom keyword "' + rule.keyword + '"failed to compile'); - - var index = customRules.length; - customRules[index] = validate; - - return { - code: 'customRule' + index, - validate: validate - }; - } -} - - -/** - * Checks if the schema is currently compiled - * @this Ajv - * @param {Object} schema schema to compile - * @param {Object} root root object - * @param {String} baseId base schema ID - * @return {Object} object with properties "index" (compilation index) and "compiling" (boolean) - */ -function checkCompiling(schema, root, baseId) { - /* jshint validthis: true */ - var index = compIndex.call(this, schema, root, baseId); - if (index >= 0) return { index: index, compiling: true }; - index = this._compilations.length; - this._compilations[index] = { - schema: schema, - root: root, - baseId: baseId - }; - return { index: index, compiling: false }; -} - - -/** - * Removes the schema from the currently compiled list - * @this Ajv - * @param {Object} schema schema to compile - * @param {Object} root root object - * @param {String} baseId base schema ID - */ -function endCompiling(schema, root, baseId) { - /* jshint validthis: true */ - var i = compIndex.call(this, schema, root, baseId); - if (i >= 0) this._compilations.splice(i, 1); -} - - -/** - * Index of schema compilation in the currently compiled list - * @this Ajv - * @param {Object} schema schema to compile - * @param {Object} root root object - * @param {String} baseId base schema ID - * @return {Integer} compilation index - */ -function compIndex(schema, root, baseId) { - /* jshint validthis: true */ - for (var i=0; i= 0xD800 && value <= 0xDBFF && pos < len) { - // high surrogate, and there is a next character - value = str.charCodeAt(pos); - if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate - } - } - return length; -}; diff --git a/node_modules/webpack/node_modules/ajv/lib/compile/util.js b/node_modules/webpack/node_modules/ajv/lib/compile/util.js deleted file mode 100644 index ef07b8c..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/compile/util.js +++ /dev/null @@ -1,239 +0,0 @@ -'use strict'; - - -module.exports = { - copy: copy, - checkDataType: checkDataType, - checkDataTypes: checkDataTypes, - coerceToTypes: coerceToTypes, - toHash: toHash, - getProperty: getProperty, - escapeQuotes: escapeQuotes, - equal: require('fast-deep-equal'), - ucs2length: require('./ucs2length'), - varOccurences: varOccurences, - varReplace: varReplace, - schemaHasRules: schemaHasRules, - schemaHasRulesExcept: schemaHasRulesExcept, - schemaUnknownRules: schemaUnknownRules, - toQuotedString: toQuotedString, - getPathExpr: getPathExpr, - getPath: getPath, - getData: getData, - unescapeFragment: unescapeFragment, - unescapeJsonPointer: unescapeJsonPointer, - escapeFragment: escapeFragment, - escapeJsonPointer: escapeJsonPointer -}; - - -function copy(o, to) { - to = to || {}; - for (var key in o) to[key] = o[key]; - return to; -} - - -function checkDataType(dataType, data, strictNumbers, negate) { - var EQUAL = negate ? ' !== ' : ' === ' - , AND = negate ? ' || ' : ' && ' - , OK = negate ? '!' : '' - , NOT = negate ? '' : '!'; - switch (dataType) { - case 'null': return data + EQUAL + 'null'; - case 'array': return OK + 'Array.isArray(' + data + ')'; - case 'object': return '(' + OK + data + AND + - 'typeof ' + data + EQUAL + '"object"' + AND + - NOT + 'Array.isArray(' + data + '))'; - case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND + - NOT + '(' + data + ' % 1)' + - AND + data + EQUAL + data + - (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')'; - case 'number': return '(typeof ' + data + EQUAL + '"' + dataType + '"' + - (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')'; - default: return 'typeof ' + data + EQUAL + '"' + dataType + '"'; - } -} - - -function checkDataTypes(dataTypes, data, strictNumbers) { - switch (dataTypes.length) { - case 1: return checkDataType(dataTypes[0], data, strictNumbers, true); - default: - var code = ''; - var types = toHash(dataTypes); - if (types.array && types.object) { - code = types.null ? '(': '(!' + data + ' || '; - code += 'typeof ' + data + ' !== "object")'; - delete types.null; - delete types.array; - delete types.object; - } - if (types.number) delete types.integer; - for (var t in types) - code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true); - - return code; - } -} - - -var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]); -function coerceToTypes(optionCoerceTypes, dataTypes) { - if (Array.isArray(dataTypes)) { - var types = []; - for (var i=0; i= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl); - return paths[lvl - up]; - } - - if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl); - data = 'data' + ((lvl - up) || ''); - if (!jsonPointer) return data; - } - - var expr = data; - var segments = jsonPointer.split('/'); - for (var i=0; i' - , $notOp = $isMax ? '>' : '<' - , $errorKeyword = undefined; - - if (!($isData || typeof $schema == 'number' || $schema === undefined)) { - throw new Error($keyword + ' must be number'); - } - if (!($isDataExcl || $schemaExcl === undefined - || typeof $schemaExcl == 'number' - || typeof $schemaExcl == 'boolean')) { - throw new Error($exclusiveKeyword + ' must be number or boolean'); - } -}} - -{{? $isDataExcl }} - {{ - var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr) - , $exclusive = 'exclusive' + $lvl - , $exclType = 'exclType' + $lvl - , $exclIsNumber = 'exclIsNumber' + $lvl - , $opExpr = 'op' + $lvl - , $opStr = '\' + ' + $opExpr + ' + \''; - }} - var schemaExcl{{=$lvl}} = {{=$schemaValueExcl}}; - {{ $schemaValueExcl = 'schemaExcl' + $lvl; }} - - var {{=$exclusive}}; - var {{=$exclType}} = typeof {{=$schemaValueExcl}}; - if ({{=$exclType}} != 'boolean' && {{=$exclType}} != 'undefined' && {{=$exclType}} != 'number') { - {{ var $errorKeyword = $exclusiveKeyword; }} - {{# def.error:'_exclusiveLimit' }} - } else if ({{# def.$dataNotType:'number' }} - {{=$exclType}} == 'number' - ? ( - ({{=$exclusive}} = {{=$schemaValue}} === undefined || {{=$schemaValueExcl}} {{=$op}}= {{=$schemaValue}}) - ? {{=$data}} {{=$notOp}}= {{=$schemaValueExcl}} - : {{=$data}} {{=$notOp}} {{=$schemaValue}} - ) - : ( - ({{=$exclusive}} = {{=$schemaValueExcl}} === true) - ? {{=$data}} {{=$notOp}}= {{=$schemaValue}} - : {{=$data}} {{=$notOp}} {{=$schemaValue}} - ) - || {{=$data}} !== {{=$data}}) { - var op{{=$lvl}} = {{=$exclusive}} ? '{{=$op}}' : '{{=$op}}='; - {{ - if ($schema === undefined) { - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $schemaValue = $schemaValueExcl; - $isData = $isDataExcl; - } - }} -{{??}} - {{ - var $exclIsNumber = typeof $schemaExcl == 'number' - , $opStr = $op; /*used in error*/ - }} - - {{? $exclIsNumber && $isData }} - {{ var $opExpr = '\'' + $opStr + '\''; /*used in error*/ }} - if ({{# def.$dataNotType:'number' }} - ( {{=$schemaValue}} === undefined - || {{=$schemaExcl}} {{=$op}}= {{=$schemaValue}} - ? {{=$data}} {{=$notOp}}= {{=$schemaExcl}} - : {{=$data}} {{=$notOp}} {{=$schemaValue}} ) - || {{=$data}} !== {{=$data}}) { - {{??}} - {{ - if ($exclIsNumber && $schema === undefined) { - {{# def.setExclusiveLimit }} - $schemaValue = $schemaExcl; - $notOp += '='; - } else { - if ($exclIsNumber) - $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema); - - if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) { - {{# def.setExclusiveLimit }} - $notOp += '='; - } else { - $exclusive = false; - $opStr += '='; - } - } - - var $opExpr = '\'' + $opStr + '\''; /*used in error*/ - }} - - if ({{# def.$dataNotType:'number' }} - {{=$data}} {{=$notOp}} {{=$schemaValue}} - || {{=$data}} !== {{=$data}}) { - {{?}} -{{?}} - {{ $errorKeyword = $errorKeyword || $keyword; }} - {{# def.error:'_limit' }} - } {{? $breakOnError }} else { {{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/_limitItems.jst b/node_modules/webpack/node_modules/ajv/lib/dot/_limitItems.jst deleted file mode 100644 index 741329e..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/_limitItems.jst +++ /dev/null @@ -1,12 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - -{{# def.numberKeyword }} - -{{ var $op = $keyword == 'maxItems' ? '>' : '<'; }} -if ({{# def.$dataNotType:'number' }} {{=$data}}.length {{=$op}} {{=$schemaValue}}) { - {{ var $errorKeyword = $keyword; }} - {{# def.error:'_limitItems' }} -} {{? $breakOnError }} else { {{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/_limitLength.jst b/node_modules/webpack/node_modules/ajv/lib/dot/_limitLength.jst deleted file mode 100644 index 285c66b..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/_limitLength.jst +++ /dev/null @@ -1,12 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - -{{# def.numberKeyword }} - -{{ var $op = $keyword == 'maxLength' ? '>' : '<'; }} -if ({{# def.$dataNotType:'number' }} {{# def.strLength }} {{=$op}} {{=$schemaValue}}) { - {{ var $errorKeyword = $keyword; }} - {{# def.error:'_limitLength' }} -} {{? $breakOnError }} else { {{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/_limitProperties.jst b/node_modules/webpack/node_modules/ajv/lib/dot/_limitProperties.jst deleted file mode 100644 index c4c2155..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/_limitProperties.jst +++ /dev/null @@ -1,12 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - -{{# def.numberKeyword }} - -{{ var $op = $keyword == 'maxProperties' ? '>' : '<'; }} -if ({{# def.$dataNotType:'number' }} Object.keys({{=$data}}).length {{=$op}} {{=$schemaValue}}) { - {{ var $errorKeyword = $keyword; }} - {{# def.error:'_limitProperties' }} -} {{? $breakOnError }} else { {{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/allOf.jst b/node_modules/webpack/node_modules/ajv/lib/dot/allOf.jst deleted file mode 100644 index 0e782fe..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/allOf.jst +++ /dev/null @@ -1,32 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - -{{ - var $currentBaseId = $it.baseId - , $allSchemasEmpty = true; -}} - -{{~ $schema:$sch:$i }} - {{? {{# def.nonEmptySchema:$sch }} }} - {{ - $allSchemasEmpty = false; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - }} - - {{# def.insertSubschemaCode }} - - {{# def.ifResultValid }} - {{?}} -{{~}} - -{{? $breakOnError }} - {{? $allSchemasEmpty }} - if (true) { - {{??}} - {{= $closingBraces.slice(0,-1) }} - {{?}} -{{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/anyOf.jst b/node_modules/webpack/node_modules/ajv/lib/dot/anyOf.jst deleted file mode 100644 index ea909ee..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/anyOf.jst +++ /dev/null @@ -1,46 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - -{{ - var $noEmptySchema = $schema.every(function($sch) { - return {{# def.nonEmptySchema:$sch }}; - }); -}} -{{? $noEmptySchema }} - {{ var $currentBaseId = $it.baseId; }} - var {{=$errs}} = errors; - var {{=$valid}} = false; - - {{# def.setCompositeRule }} - - {{~ $schema:$sch:$i }} - {{ - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - }} - - {{# def.insertSubschemaCode }} - - {{=$valid}} = {{=$valid}} || {{=$nextValid}}; - - if (!{{=$valid}}) { - {{ $closingBraces += '}'; }} - {{~}} - - {{# def.resetCompositeRule }} - - {{= $closingBraces }} - - if (!{{=$valid}}) { - {{# def.extraError:'anyOf' }} - } else { - {{# def.resetErrors }} - {{? it.opts.allErrors }} } {{?}} -{{??}} - {{? $breakOnError }} - if (true) { - {{?}} -{{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/coerce.def b/node_modules/webpack/node_modules/ajv/lib/dot/coerce.def deleted file mode 100644 index c947ed6..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/coerce.def +++ /dev/null @@ -1,51 +0,0 @@ -{{## def.coerceType: - {{ - var $dataType = 'dataType' + $lvl - , $coerced = 'coerced' + $lvl; - }} - var {{=$dataType}} = typeof {{=$data}}; - var {{=$coerced}} = undefined; - - {{? it.opts.coerceTypes == 'array' }} - if ({{=$dataType}} == 'object' && Array.isArray({{=$data}}) && {{=$data}}.length == 1) { - {{=$data}} = {{=$data}}[0]; - {{=$dataType}} = typeof {{=$data}}; - if ({{=it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)}}) {{=$coerced}} = {{=$data}}; - } - {{?}} - - if ({{=$coerced}} !== undefined) ; - {{~ $coerceToTypes:$type:$i }} - {{? $type == 'string' }} - else if ({{=$dataType}} == 'number' || {{=$dataType}} == 'boolean') - {{=$coerced}} = '' + {{=$data}}; - else if ({{=$data}} === null) {{=$coerced}} = ''; - {{?? $type == 'number' || $type == 'integer' }} - else if ({{=$dataType}} == 'boolean' || {{=$data}} === null - || ({{=$dataType}} == 'string' && {{=$data}} && {{=$data}} == +{{=$data}} - {{? $type == 'integer' }} && !({{=$data}} % 1){{?}})) - {{=$coerced}} = +{{=$data}}; - {{?? $type == 'boolean' }} - else if ({{=$data}} === 'false' || {{=$data}} === 0 || {{=$data}} === null) - {{=$coerced}} = false; - else if ({{=$data}} === 'true' || {{=$data}} === 1) - {{=$coerced}} = true; - {{?? $type == 'null' }} - else if ({{=$data}} === '' || {{=$data}} === 0 || {{=$data}} === false) - {{=$coerced}} = null; - {{?? it.opts.coerceTypes == 'array' && $type == 'array' }} - else if ({{=$dataType}} == 'string' || {{=$dataType}} == 'number' || {{=$dataType}} == 'boolean' || {{=$data}} == null) - {{=$coerced}} = [{{=$data}}]; - {{?}} - {{~}} - else { - {{# def.error:'type' }} - } - - if ({{=$coerced}} !== undefined) { - {{# def.setParentData }} - {{=$data}} = {{=$coerced}}; - {{? !$dataLvl }}if ({{=$parentData}} !== undefined){{?}} - {{=$parentData}}[{{=$parentDataProperty}}] = {{=$coerced}}; - } -#}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/comment.jst b/node_modules/webpack/node_modules/ajv/lib/dot/comment.jst deleted file mode 100644 index f959150..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/comment.jst +++ /dev/null @@ -1,9 +0,0 @@ -{{# def.definitions }} -{{# def.setupKeyword }} - -{{ var $comment = it.util.toQuotedString($schema); }} -{{? it.opts.$comment === true }} - console.log({{=$comment}}); -{{?? typeof it.opts.$comment == 'function' }} - self._opts.$comment({{=$comment}}, {{=it.util.toQuotedString($errSchemaPath)}}, validate.root.schema); -{{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/const.jst b/node_modules/webpack/node_modules/ajv/lib/dot/const.jst deleted file mode 100644 index 2aa2298..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/const.jst +++ /dev/null @@ -1,11 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - -{{? !$isData }} - var schema{{=$lvl}} = validate.schema{{=$schemaPath}}; -{{?}} -var {{=$valid}} = equal({{=$data}}, schema{{=$lvl}}); -{{# def.checkError:'const' }} -{{? $breakOnError }} else { {{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/contains.jst b/node_modules/webpack/node_modules/ajv/lib/dot/contains.jst deleted file mode 100644 index 4dc9967..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/contains.jst +++ /dev/null @@ -1,55 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - - -{{ - var $idx = 'i' + $lvl - , $dataNxt = $it.dataLevel = it.dataLevel + 1 - , $nextData = 'data' + $dataNxt - , $currentBaseId = it.baseId - , $nonEmptySchema = {{# def.nonEmptySchema:$schema }}; -}} - -var {{=$errs}} = errors; -var {{=$valid}}; - -{{? $nonEmptySchema }} - {{# def.setCompositeRule }} - - {{ - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - }} - - var {{=$nextValid}} = false; - - for (var {{=$idx}} = 0; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) { - {{ - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - }} - - {{# def.generateSubschemaCode }} - {{# def.optimizeValidate }} - - if ({{=$nextValid}}) break; - } - - {{# def.resetCompositeRule }} - {{= $closingBraces }} - - if (!{{=$nextValid}}) { -{{??}} - if ({{=$data}}.length == 0) { -{{?}} - - {{# def.error:'contains' }} - } else { - {{? $nonEmptySchema }} - {{# def.resetErrors }} - {{?}} - {{? it.opts.allErrors }} } {{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/custom.jst b/node_modules/webpack/node_modules/ajv/lib/dot/custom.jst deleted file mode 100644 index d30588f..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/custom.jst +++ /dev/null @@ -1,191 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - -{{ - var $rule = this - , $definition = 'definition' + $lvl - , $rDef = $rule.definition - , $closingBraces = ''; - var $validate = $rDef.validate; - var $compile, $inline, $macro, $ruleValidate, $validateCode; -}} - -{{? $isData && $rDef.$data }} - {{ - $validateCode = 'keywordValidate' + $lvl; - var $validateSchema = $rDef.validateSchema; - }} - var {{=$definition}} = RULES.custom['{{=$keyword}}'].definition; - var {{=$validateCode}} = {{=$definition}}.validate; -{{??}} - {{ - $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it); - if (!$ruleValidate) return; - $schemaValue = 'validate.schema' + $schemaPath; - $validateCode = $ruleValidate.code; - $compile = $rDef.compile; - $inline = $rDef.inline; - $macro = $rDef.macro; - }} -{{?}} - -{{ - var $ruleErrs = $validateCode + '.errors' - , $i = 'i' + $lvl - , $ruleErr = 'ruleErr' + $lvl - , $asyncKeyword = $rDef.async; - - if ($asyncKeyword && !it.async) - throw new Error('async keyword in sync schema'); -}} - - -{{? !($inline || $macro) }}{{=$ruleErrs}} = null;{{?}} -var {{=$errs}} = errors; -var {{=$valid}}; - -{{## def.callRuleValidate: - {{=$validateCode}}.call( - {{? it.opts.passContext }}this{{??}}self{{?}} - {{? $compile || $rDef.schema === false }} - , {{=$data}} - {{??}} - , {{=$schemaValue}} - , {{=$data}} - , validate.schema{{=it.schemaPath}} - {{?}} - , {{# def.dataPath }} - {{# def.passParentData }} - , rootData - ) -#}} - -{{## def.extendErrors:_inline: - for (var {{=$i}}={{=$errs}}; {{=$i}} 0) - || _schema === false - : it.util.schemaHasRules(_schema, it.RULES.all)) -#}} - - -{{## def.strLength: - {{? it.opts.unicode === false }} - {{=$data}}.length - {{??}} - ucs2length({{=$data}}) - {{?}} -#}} - - -{{## def.willOptimize: - it.util.varOccurences($code, $nextData) < 2 -#}} - - -{{## def.generateSubschemaCode: - {{ - var $code = it.validate($it); - $it.baseId = $currentBaseId; - }} -#}} - - -{{## def.insertSubschemaCode: - {{= it.validate($it) }} - {{ $it.baseId = $currentBaseId; }} -#}} - - -{{## def._optimizeValidate: - it.util.varReplace($code, $nextData, $passData) -#}} - - -{{## def.optimizeValidate: - {{? {{# def.willOptimize}} }} - {{= {{# def._optimizeValidate }} }} - {{??}} - var {{=$nextData}} = {{=$passData}}; - {{= $code }} - {{?}} -#}} - - -{{## def.$data: - {{ - var $isData = it.opts.$data && $schema && $schema.$data - , $schemaValue; - }} - {{? $isData }} - var schema{{=$lvl}} = {{= it.util.getData($schema.$data, $dataLvl, it.dataPathArr) }}; - {{ $schemaValue = 'schema' + $lvl; }} - {{??}} - {{ $schemaValue = $schema; }} - {{?}} -#}} - - -{{## def.$dataNotType:_type: - {{?$isData}} ({{=$schemaValue}} !== undefined && typeof {{=$schemaValue}} != _type) || {{?}} -#}} - - -{{## def.check$dataIsArray: - if (schema{{=$lvl}} === undefined) {{=$valid}} = true; - else if (!Array.isArray(schema{{=$lvl}})) {{=$valid}} = false; - else { -#}} - - -{{## def.numberKeyword: - {{? !($isData || typeof $schema == 'number') }} - {{ throw new Error($keyword + ' must be number'); }} - {{?}} -#}} - - -{{## def.beginDefOut: - {{ - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; - }} -#}} - - -{{## def.storeDefOut:_variable: - {{ - var _variable = out; - out = $$outStack.pop(); - }} -#}} - - -{{## def.dataPath:(dataPath || ''){{? it.errorPath != '""'}} + {{= it.errorPath }}{{?}}#}} - -{{## def.setParentData: - {{ - var $parentData = $dataLvl ? 'data' + (($dataLvl-1)||'') : 'parentData' - , $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; - }} -#}} - -{{## def.passParentData: - {{# def.setParentData }} - , {{= $parentData }} - , {{= $parentDataProperty }} -#}} - - -{{## def.iterateProperties: - {{? $ownProperties }} - {{=$dataProperties}} = {{=$dataProperties}} || Object.keys({{=$data}}); - for (var {{=$idx}}=0; {{=$idx}}<{{=$dataProperties}}.length; {{=$idx}}++) { - var {{=$key}} = {{=$dataProperties}}[{{=$idx}}]; - {{??}} - for (var {{=$key}} in {{=$data}}) { - {{?}} -#}} - - -{{## def.noPropertyInData: - {{=$useData}} === undefined - {{? $ownProperties }} - || !{{# def.isOwnProperty }} - {{?}} -#}} - - -{{## def.isOwnProperty: - Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($propertyKey)}}') -#}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/dependencies.jst b/node_modules/webpack/node_modules/ajv/lib/dot/dependencies.jst deleted file mode 100644 index e4bddde..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/dependencies.jst +++ /dev/null @@ -1,79 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.missing }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - - -{{## def.propertyInData: - {{=$data}}{{= it.util.getProperty($property) }} !== undefined - {{? $ownProperties }} - && Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($property)}}') - {{?}} -#}} - - -{{ - var $schemaDeps = {} - , $propertyDeps = {} - , $ownProperties = it.opts.ownProperties; - - for ($property in $schema) { - if ($property == '__proto__') continue; - var $sch = $schema[$property]; - var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps; - $deps[$property] = $sch; - } -}} - -var {{=$errs}} = errors; - -{{ var $currentErrorPath = it.errorPath; }} - -var missing{{=$lvl}}; -{{ for (var $property in $propertyDeps) { }} - {{ $deps = $propertyDeps[$property]; }} - {{? $deps.length }} - if ({{# def.propertyInData }} - {{? $breakOnError }} - && ({{# def.checkMissingProperty:$deps }})) { - {{# def.errorMissingProperty:'dependencies' }} - {{??}} - ) { - {{~ $deps:$propertyKey }} - {{# def.allErrorsMissingProperty:'dependencies' }} - {{~}} - {{?}} - } {{# def.elseIfValid }} - {{?}} -{{ } }} - -{{ - it.errorPath = $currentErrorPath; - var $currentBaseId = $it.baseId; -}} - - -{{ for (var $property in $schemaDeps) { }} - {{ var $sch = $schemaDeps[$property]; }} - {{? {{# def.nonEmptySchema:$sch }} }} - {{=$nextValid}} = true; - - if ({{# def.propertyInData }}) { - {{ - $it.schema = $sch; - $it.schemaPath = $schemaPath + it.util.getProperty($property); - $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property); - }} - - {{# def.insertSubschemaCode }} - } - - {{# def.ifResultValid }} - {{?}} -{{ } }} - -{{? $breakOnError }} - {{= $closingBraces }} - if ({{=$errs}} == errors) { -{{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/enum.jst b/node_modules/webpack/node_modules/ajv/lib/dot/enum.jst deleted file mode 100644 index 357c2e8..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/enum.jst +++ /dev/null @@ -1,30 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - -{{ - var $i = 'i' + $lvl - , $vSchema = 'schema' + $lvl; -}} - -{{? !$isData }} - var {{=$vSchema}} = validate.schema{{=$schemaPath}}; -{{?}} -var {{=$valid}}; - -{{?$isData}}{{# def.check$dataIsArray }}{{?}} - -{{=$valid}} = false; - -for (var {{=$i}}=0; {{=$i}}<{{=$vSchema}}.length; {{=$i}}++) - if (equal({{=$data}}, {{=$vSchema}}[{{=$i}}])) { - {{=$valid}} = true; - break; - } - -{{? $isData }} } {{?}} - -{{# def.checkError:'enum' }} - -{{? $breakOnError }} else { {{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/errors.def b/node_modules/webpack/node_modules/ajv/lib/dot/errors.def deleted file mode 100644 index 5c5752c..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/errors.def +++ /dev/null @@ -1,194 +0,0 @@ -{{# def.definitions }} - -{{## def._error:_rule: - {{ 'istanbul ignore else'; }} - {{? it.createErrors !== false }} - { - keyword: '{{= $errorKeyword || _rule }}' - , dataPath: (dataPath || '') + {{= it.errorPath }} - , schemaPath: {{=it.util.toQuotedString($errSchemaPath)}} - , params: {{# def._errorParams[_rule] }} - {{? it.opts.messages !== false }} - , message: {{# def._errorMessages[_rule] }} - {{?}} - {{? it.opts.verbose }} - , schema: {{# def._errorSchemas[_rule] }} - , parentSchema: validate.schema{{=it.schemaPath}} - , data: {{=$data}} - {{?}} - } - {{??}} - {} - {{?}} -#}} - - -{{## def._addError:_rule: - if (vErrors === null) vErrors = [err]; - else vErrors.push(err); - errors++; -#}} - - -{{## def.addError:_rule: - var err = {{# def._error:_rule }}; - {{# def._addError:_rule }} -#}} - - -{{## def.error:_rule: - {{# def.beginDefOut}} - {{# def._error:_rule }} - {{# def.storeDefOut:__err }} - - {{? !it.compositeRule && $breakOnError }} - {{ 'istanbul ignore if'; }} - {{? it.async }} - throw new ValidationError([{{=__err}}]); - {{??}} - validate.errors = [{{=__err}}]; - return false; - {{?}} - {{??}} - var err = {{=__err}}; - {{# def._addError:_rule }} - {{?}} -#}} - - -{{## def.extraError:_rule: - {{# def.addError:_rule}} - {{? !it.compositeRule && $breakOnError }} - {{ 'istanbul ignore if'; }} - {{? it.async }} - throw new ValidationError(vErrors); - {{??}} - validate.errors = vErrors; - return false; - {{?}} - {{?}} -#}} - - -{{## def.checkError:_rule: - if (!{{=$valid}}) { - {{# def.error:_rule }} - } -#}} - - -{{## def.resetErrors: - errors = {{=$errs}}; - if (vErrors !== null) { - if ({{=$errs}}) vErrors.length = {{=$errs}}; - else vErrors = null; - } -#}} - - -{{## def.concatSchema:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=$schema}}{{?}}#}} -{{## def.appendSchema:{{?$isData}}' + {{=$schemaValue}}{{??}}{{=$schemaValue}}'{{?}}#}} -{{## def.concatSchemaEQ:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=it.util.escapeQuotes($schema)}}{{?}}#}} - -{{## def._errorMessages = { - 'false schema': "'boolean schema is false'", - $ref: "'can\\\'t resolve reference {{=it.util.escapeQuotes($schema)}}'", - additionalItems: "'should NOT have more than {{=$schema.length}} items'", - additionalProperties: "'{{? it.opts._errorDataPathProperty }}is an invalid additional property{{??}}should NOT have additional properties{{?}}'", - anyOf: "'should match some schema in anyOf'", - const: "'should be equal to constant'", - contains: "'should contain a valid item'", - dependencies: "'should have {{? $deps.length == 1 }}property {{= it.util.escapeQuotes($deps[0]) }}{{??}}properties {{= it.util.escapeQuotes($deps.join(\", \")) }}{{?}} when property {{= it.util.escapeQuotes($property) }} is present'", - 'enum': "'should be equal to one of the allowed values'", - format: "'should match format \"{{#def.concatSchemaEQ}}\"'", - 'if': "'should match \"' + {{=$ifClause}} + '\" schema'", - _limit: "'should be {{=$opStr}} {{#def.appendSchema}}", - _exclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'", - _limitItems: "'should NOT have {{?$keyword=='maxItems'}}more{{??}}fewer{{?}} than {{#def.concatSchema}} items'", - _limitLength: "'should NOT be {{?$keyword=='maxLength'}}longer{{??}}shorter{{?}} than {{#def.concatSchema}} characters'", - _limitProperties:"'should NOT have {{?$keyword=='maxProperties'}}more{{??}}fewer{{?}} than {{#def.concatSchema}} properties'", - multipleOf: "'should be multiple of {{#def.appendSchema}}", - not: "'should NOT be valid'", - oneOf: "'should match exactly one schema in oneOf'", - pattern: "'should match pattern \"{{#def.concatSchemaEQ}}\"'", - propertyNames: "'property name \\'{{=$invalidName}}\\' is invalid'", - required: "'{{? it.opts._errorDataPathProperty }}is a required property{{??}}should have required property \\'{{=$missingProperty}}\\'{{?}}'", - type: "'should be {{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}'", - uniqueItems: "'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)'", - custom: "'should pass \"{{=$rule.keyword}}\" keyword validation'", - patternRequired: "'should have property matching pattern \\'{{=$missingPattern}}\\''", - switch: "'should pass \"switch\" keyword validation'", - _formatLimit: "'should be {{=$opStr}} \"{{#def.concatSchemaEQ}}\"'", - _formatExclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'" -} #}} - - -{{## def.schemaRefOrVal: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=$schema}}{{?}} #}} -{{## def.schemaRefOrQS: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}} - -{{## def._errorSchemas = { - 'false schema': "false", - $ref: "{{=it.util.toQuotedString($schema)}}", - additionalItems: "false", - additionalProperties: "false", - anyOf: "validate.schema{{=$schemaPath}}", - const: "validate.schema{{=$schemaPath}}", - contains: "validate.schema{{=$schemaPath}}", - dependencies: "validate.schema{{=$schemaPath}}", - 'enum': "validate.schema{{=$schemaPath}}", - format: "{{#def.schemaRefOrQS}}", - 'if': "validate.schema{{=$schemaPath}}", - _limit: "{{#def.schemaRefOrVal}}", - _exclusiveLimit: "validate.schema{{=$schemaPath}}", - _limitItems: "{{#def.schemaRefOrVal}}", - _limitLength: "{{#def.schemaRefOrVal}}", - _limitProperties:"{{#def.schemaRefOrVal}}", - multipleOf: "{{#def.schemaRefOrVal}}", - not: "validate.schema{{=$schemaPath}}", - oneOf: "validate.schema{{=$schemaPath}}", - pattern: "{{#def.schemaRefOrQS}}", - propertyNames: "validate.schema{{=$schemaPath}}", - required: "validate.schema{{=$schemaPath}}", - type: "validate.schema{{=$schemaPath}}", - uniqueItems: "{{#def.schemaRefOrVal}}", - custom: "validate.schema{{=$schemaPath}}", - patternRequired: "validate.schema{{=$schemaPath}}", - switch: "validate.schema{{=$schemaPath}}", - _formatLimit: "{{#def.schemaRefOrQS}}", - _formatExclusiveLimit: "validate.schema{{=$schemaPath}}" -} #}} - - -{{## def.schemaValueQS: {{?$isData}}{{=$schemaValue}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}} - -{{## def._errorParams = { - 'false schema': "{}", - $ref: "{ ref: '{{=it.util.escapeQuotes($schema)}}' }", - additionalItems: "{ limit: {{=$schema.length}} }", - additionalProperties: "{ additionalProperty: '{{=$additionalProperty}}' }", - anyOf: "{}", - const: "{ allowedValue: schema{{=$lvl}} }", - contains: "{}", - dependencies: "{ property: '{{= it.util.escapeQuotes($property) }}', missingProperty: '{{=$missingProperty}}', depsCount: {{=$deps.length}}, deps: '{{= it.util.escapeQuotes($deps.length==1 ? $deps[0] : $deps.join(\", \")) }}' }", - 'enum': "{ allowedValues: schema{{=$lvl}} }", - format: "{ format: {{#def.schemaValueQS}} }", - 'if': "{ failingKeyword: {{=$ifClause}} }", - _limit: "{ comparison: {{=$opExpr}}, limit: {{=$schemaValue}}, exclusive: {{=$exclusive}} }", - _exclusiveLimit: "{}", - _limitItems: "{ limit: {{=$schemaValue}} }", - _limitLength: "{ limit: {{=$schemaValue}} }", - _limitProperties:"{ limit: {{=$schemaValue}} }", - multipleOf: "{ multipleOf: {{=$schemaValue}} }", - not: "{}", - oneOf: "{ passingSchemas: {{=$passingSchemas}} }", - pattern: "{ pattern: {{#def.schemaValueQS}} }", - propertyNames: "{ propertyName: '{{=$invalidName}}' }", - required: "{ missingProperty: '{{=$missingProperty}}' }", - type: "{ type: '{{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}' }", - uniqueItems: "{ i: i, j: j }", - custom: "{ keyword: '{{=$rule.keyword}}' }", - patternRequired: "{ missingPattern: '{{=$missingPattern}}' }", - switch: "{ caseIndex: {{=$caseIndex}} }", - _formatLimit: "{ comparison: {{=$opExpr}}, limit: {{#def.schemaValueQS}}, exclusive: {{=$exclusive}} }", - _formatExclusiveLimit: "{}" -} #}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/format.jst b/node_modules/webpack/node_modules/ajv/lib/dot/format.jst deleted file mode 100644 index 37f14da..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/format.jst +++ /dev/null @@ -1,106 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} - -{{## def.skipFormat: - {{? $breakOnError }} if (true) { {{?}} - {{ return out; }} -#}} - -{{? it.opts.format === false }}{{# def.skipFormat }}{{?}} - - -{{# def.$data }} - - -{{## def.$dataCheckFormat: - {{# def.$dataNotType:'string' }} - ({{? $unknownFormats != 'ignore' }} - ({{=$schemaValue}} && !{{=$format}} - {{? $allowUnknown }} - && self._opts.unknownFormats.indexOf({{=$schemaValue}}) == -1 - {{?}}) || - {{?}} - ({{=$format}} && {{=$formatType}} == '{{=$ruleType}}' - && !(typeof {{=$format}} == 'function' - ? {{? it.async}} - (async{{=$lvl}} ? await {{=$format}}({{=$data}}) : {{=$format}}({{=$data}})) - {{??}} - {{=$format}}({{=$data}}) - {{?}} - : {{=$format}}.test({{=$data}})))) -#}} - -{{## def.checkFormat: - {{ - var $formatRef = 'formats' + it.util.getProperty($schema); - if ($isObject) $formatRef += '.validate'; - }} - {{? typeof $format == 'function' }} - {{=$formatRef}}({{=$data}}) - {{??}} - {{=$formatRef}}.test({{=$data}}) - {{?}} -#}} - - -{{ - var $unknownFormats = it.opts.unknownFormats - , $allowUnknown = Array.isArray($unknownFormats); -}} - -{{? $isData }} - {{ - var $format = 'format' + $lvl - , $isObject = 'isObject' + $lvl - , $formatType = 'formatType' + $lvl; - }} - var {{=$format}} = formats[{{=$schemaValue}}]; - var {{=$isObject}} = typeof {{=$format}} == 'object' - && !({{=$format}} instanceof RegExp) - && {{=$format}}.validate; - var {{=$formatType}} = {{=$isObject}} && {{=$format}}.type || 'string'; - if ({{=$isObject}}) { - {{? it.async}} - var async{{=$lvl}} = {{=$format}}.async; - {{?}} - {{=$format}} = {{=$format}}.validate; - } - if ({{# def.$dataCheckFormat }}) { -{{??}} - {{ var $format = it.formats[$schema]; }} - {{? !$format }} - {{? $unknownFormats == 'ignore' }} - {{ it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); }} - {{# def.skipFormat }} - {{?? $allowUnknown && $unknownFormats.indexOf($schema) >= 0 }} - {{# def.skipFormat }} - {{??}} - {{ throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"'); }} - {{?}} - {{?}} - {{ - var $isObject = typeof $format == 'object' - && !($format instanceof RegExp) - && $format.validate; - var $formatType = $isObject && $format.type || 'string'; - if ($isObject) { - var $async = $format.async === true; - $format = $format.validate; - } - }} - {{? $formatType != $ruleType }} - {{# def.skipFormat }} - {{?}} - {{? $async }} - {{ - if (!it.async) throw new Error('async format in sync schema'); - var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate'; - }} - if (!(await {{=$formatRef}}({{=$data}}))) { - {{??}} - if (!{{# def.checkFormat }}) { - {{?}} -{{?}} - {{# def.error:'format' }} - } {{? $breakOnError }} else { {{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/if.jst b/node_modules/webpack/node_modules/ajv/lib/dot/if.jst deleted file mode 100644 index adb5036..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/if.jst +++ /dev/null @@ -1,73 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - - -{{## def.validateIfClause:_clause: - {{ - $it.schema = it.schema['_clause']; - $it.schemaPath = it.schemaPath + '._clause'; - $it.errSchemaPath = it.errSchemaPath + '/_clause'; - }} - {{# def.insertSubschemaCode }} - {{=$valid}} = {{=$nextValid}}; - {{? $thenPresent && $elsePresent }} - {{ $ifClause = 'ifClause' + $lvl; }} - var {{=$ifClause}} = '_clause'; - {{??}} - {{ $ifClause = '\'_clause\''; }} - {{?}} -#}} - -{{ - var $thenSch = it.schema['then'] - , $elseSch = it.schema['else'] - , $thenPresent = $thenSch !== undefined && {{# def.nonEmptySchema:$thenSch }} - , $elsePresent = $elseSch !== undefined && {{# def.nonEmptySchema:$elseSch }} - , $currentBaseId = $it.baseId; -}} - -{{? $thenPresent || $elsePresent }} - {{ - var $ifClause; - $it.createErrors = false; - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - }} - var {{=$errs}} = errors; - var {{=$valid}} = true; - - {{# def.setCompositeRule }} - {{# def.insertSubschemaCode }} - {{ $it.createErrors = true; }} - {{# def.resetErrors }} - {{# def.resetCompositeRule }} - - {{? $thenPresent }} - if ({{=$nextValid}}) { - {{# def.validateIfClause:then }} - } - {{? $elsePresent }} - else { - {{?}} - {{??}} - if (!{{=$nextValid}}) { - {{?}} - - {{? $elsePresent }} - {{# def.validateIfClause:else }} - } - {{?}} - - if (!{{=$valid}}) { - {{# def.extraError:'if' }} - } - {{? $breakOnError }} else { {{?}} -{{??}} - {{? $breakOnError }} - if (true) { - {{?}} -{{?}} - diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/items.jst b/node_modules/webpack/node_modules/ajv/lib/dot/items.jst deleted file mode 100644 index acc932a..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/items.jst +++ /dev/null @@ -1,98 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - - -{{## def.validateItems:startFrom: - for (var {{=$idx}} = {{=startFrom}}; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) { - {{ - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - }} - - {{# def.generateSubschemaCode }} - {{# def.optimizeValidate }} - - {{? $breakOnError }} - if (!{{=$nextValid}}) break; - {{?}} - } -#}} - -{{ - var $idx = 'i' + $lvl - , $dataNxt = $it.dataLevel = it.dataLevel + 1 - , $nextData = 'data' + $dataNxt - , $currentBaseId = it.baseId; -}} - -var {{=$errs}} = errors; -var {{=$valid}}; - -{{? Array.isArray($schema) }} - {{ /* 'items' is an array of schemas */}} - {{ var $additionalItems = it.schema.additionalItems; }} - {{? $additionalItems === false }} - {{=$valid}} = {{=$data}}.length <= {{= $schema.length }}; - {{ - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + '/additionalItems'; - }} - {{# def.checkError:'additionalItems' }} - {{ $errSchemaPath = $currErrSchemaPath; }} - {{# def.elseIfValid}} - {{?}} - - {{~ $schema:$sch:$i }} - {{? {{# def.nonEmptySchema:$sch }} }} - {{=$nextValid}} = true; - - if ({{=$data}}.length > {{=$i}}) { - {{ - var $passData = $data + '[' + $i + ']'; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true); - $it.dataPathArr[$dataNxt] = $i; - }} - - {{# def.generateSubschemaCode }} - {{# def.optimizeValidate }} - } - - {{# def.ifResultValid }} - {{?}} - {{~}} - - {{? typeof $additionalItems == 'object' && {{# def.nonEmptySchema:$additionalItems }} }} - {{ - $it.schema = $additionalItems; - $it.schemaPath = it.schemaPath + '.additionalItems'; - $it.errSchemaPath = it.errSchemaPath + '/additionalItems'; - }} - {{=$nextValid}} = true; - - if ({{=$data}}.length > {{= $schema.length }}) { - {{# def.validateItems: $schema.length }} - } - - {{# def.ifResultValid }} - {{?}} - -{{?? {{# def.nonEmptySchema:$schema }} }} - {{ /* 'items' is a single schema */}} - {{ - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - }} - {{# def.validateItems: 0 }} -{{?}} - -{{? $breakOnError }} - {{= $closingBraces }} - if ({{=$errs}} == errors) { -{{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/missing.def b/node_modules/webpack/node_modules/ajv/lib/dot/missing.def deleted file mode 100644 index a73b9f9..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/missing.def +++ /dev/null @@ -1,39 +0,0 @@ -{{## def.checkMissingProperty:_properties: - {{~ _properties:$propertyKey:$i }} - {{?$i}} || {{?}} - {{ - var $prop = it.util.getProperty($propertyKey) - , $useData = $data + $prop; - }} - ( ({{# def.noPropertyInData }}) && (missing{{=$lvl}} = {{= it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop) }}) ) - {{~}} -#}} - - -{{## def.errorMissingProperty:_error: - {{ - var $propertyPath = 'missing' + $lvl - , $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.opts.jsonPointers - ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) - : $currentErrorPath + ' + ' + $propertyPath; - } - }} - {{# def.error:_error }} -#}} - - -{{## def.allErrorsMissingProperty:_error: - {{ - var $prop = it.util.getProperty($propertyKey) - , $missingProperty = it.util.escapeQuotes($propertyKey) - , $useData = $data + $prop; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - }} - if ({{# def.noPropertyInData }}) { - {{# def.addError:_error }} - } -#}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/multipleOf.jst b/node_modules/webpack/node_modules/ajv/lib/dot/multipleOf.jst deleted file mode 100644 index 6d88a45..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/multipleOf.jst +++ /dev/null @@ -1,22 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - -{{# def.numberKeyword }} - -var division{{=$lvl}}; -if ({{?$isData}} - {{=$schemaValue}} !== undefined && ( - typeof {{=$schemaValue}} != 'number' || - {{?}} - (division{{=$lvl}} = {{=$data}} / {{=$schemaValue}}, - {{? it.opts.multipleOfPrecision }} - Math.abs(Math.round(division{{=$lvl}}) - division{{=$lvl}}) > 1e-{{=it.opts.multipleOfPrecision}} - {{??}} - division{{=$lvl}} !== parseInt(division{{=$lvl}}) - {{?}} - ) - {{?$isData}} ) {{?}} ) { - {{# def.error:'multipleOf' }} -} {{? $breakOnError }} else { {{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/not.jst b/node_modules/webpack/node_modules/ajv/lib/dot/not.jst deleted file mode 100644 index e03185a..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/not.jst +++ /dev/null @@ -1,43 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - -{{? {{# def.nonEmptySchema:$schema }} }} - {{ - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - }} - - var {{=$errs}} = errors; - - {{# def.setCompositeRule }} - - {{ - $it.createErrors = false; - var $allErrorsOption; - if ($it.opts.allErrors) { - $allErrorsOption = $it.opts.allErrors; - $it.opts.allErrors = false; - } - }} - {{= it.validate($it) }} - {{ - $it.createErrors = true; - if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption; - }} - - {{# def.resetCompositeRule }} - - if ({{=$nextValid}}) { - {{# def.error:'not' }} - } else { - {{# def.resetErrors }} - {{? it.opts.allErrors }} } {{?}} -{{??}} - {{# def.addError:'not' }} - {{? $breakOnError}} - if (false) { - {{?}} -{{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/oneOf.jst b/node_modules/webpack/node_modules/ajv/lib/dot/oneOf.jst deleted file mode 100644 index bcce2c6..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/oneOf.jst +++ /dev/null @@ -1,54 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - -{{ - var $currentBaseId = $it.baseId - , $prevValid = 'prevValid' + $lvl - , $passingSchemas = 'passingSchemas' + $lvl; -}} - -var {{=$errs}} = errors - , {{=$prevValid}} = false - , {{=$valid}} = false - , {{=$passingSchemas}} = null; - -{{# def.setCompositeRule }} - -{{~ $schema:$sch:$i }} - {{? {{# def.nonEmptySchema:$sch }} }} - {{ - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - }} - - {{# def.insertSubschemaCode }} - {{??}} - var {{=$nextValid}} = true; - {{?}} - - {{? $i }} - if ({{=$nextValid}} && {{=$prevValid}}) { - {{=$valid}} = false; - {{=$passingSchemas}} = [{{=$passingSchemas}}, {{=$i}}]; - } else { - {{ $closingBraces += '}'; }} - {{?}} - - if ({{=$nextValid}}) { - {{=$valid}} = {{=$prevValid}} = true; - {{=$passingSchemas}} = {{=$i}}; - } -{{~}} - -{{# def.resetCompositeRule }} - -{{= $closingBraces }} - -if (!{{=$valid}}) { - {{# def.extraError:'oneOf' }} -} else { - {{# def.resetErrors }} -{{? it.opts.allErrors }} } {{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/pattern.jst b/node_modules/webpack/node_modules/ajv/lib/dot/pattern.jst deleted file mode 100644 index 3a37ef6..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/pattern.jst +++ /dev/null @@ -1,14 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - -{{ - var $regexp = $isData - ? '(new RegExp(' + $schemaValue + '))' - : it.usePattern($schema); -}} - -if ({{# def.$dataNotType:'string' }} !{{=$regexp}}.test({{=$data}}) ) { - {{# def.error:'pattern' }} -} {{? $breakOnError }} else { {{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/properties.jst b/node_modules/webpack/node_modules/ajv/lib/dot/properties.jst deleted file mode 100644 index 5cebb9b..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/properties.jst +++ /dev/null @@ -1,245 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - - -{{## def.validateAdditional: - {{ /* additionalProperties is schema */ - $it.schema = $aProperties; - $it.schemaPath = it.schemaPath + '.additionalProperties'; - $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; - $it.errorPath = it.opts._errorDataPathProperty - ? it.errorPath - : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - }} - - {{# def.generateSubschemaCode }} - {{# def.optimizeValidate }} -#}} - - -{{ - var $key = 'key' + $lvl - , $idx = 'idx' + $lvl - , $dataNxt = $it.dataLevel = it.dataLevel + 1 - , $nextData = 'data' + $dataNxt - , $dataProperties = 'dataProperties' + $lvl; - - var $schemaKeys = Object.keys($schema || {}).filter(notProto) - , $pProperties = it.schema.patternProperties || {} - , $pPropertyKeys = Object.keys($pProperties).filter(notProto) - , $aProperties = it.schema.additionalProperties - , $someProperties = $schemaKeys.length || $pPropertyKeys.length - , $noAdditional = $aProperties === false - , $additionalIsSchema = typeof $aProperties == 'object' - && Object.keys($aProperties).length - , $removeAdditional = it.opts.removeAdditional - , $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional - , $ownProperties = it.opts.ownProperties - , $currentBaseId = it.baseId; - - var $required = it.schema.required; - if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) { - var $requiredHash = it.util.toHash($required); - } - - function notProto(p) { return p !== '__proto__'; } -}} - - -var {{=$errs}} = errors; -var {{=$nextValid}} = true; -{{? $ownProperties }} - var {{=$dataProperties}} = undefined; -{{?}} - -{{? $checkAdditional }} - {{# def.iterateProperties }} - {{? $someProperties }} - var isAdditional{{=$lvl}} = !(false - {{? $schemaKeys.length }} - {{? $schemaKeys.length > 8 }} - || validate.schema{{=$schemaPath}}.hasOwnProperty({{=$key}}) - {{??}} - {{~ $schemaKeys:$propertyKey }} - || {{=$key}} == {{= it.util.toQuotedString($propertyKey) }} - {{~}} - {{?}} - {{?}} - {{? $pPropertyKeys.length }} - {{~ $pPropertyKeys:$pProperty:$i }} - || {{= it.usePattern($pProperty) }}.test({{=$key}}) - {{~}} - {{?}} - ); - - if (isAdditional{{=$lvl}}) { - {{?}} - {{? $removeAdditional == 'all' }} - delete {{=$data}}[{{=$key}}]; - {{??}} - {{ - var $currentErrorPath = it.errorPath; - var $additionalProperty = '\' + ' + $key + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - } - }} - {{? $noAdditional }} - {{? $removeAdditional }} - delete {{=$data}}[{{=$key}}]; - {{??}} - {{=$nextValid}} = false; - {{ - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + '/additionalProperties'; - }} - {{# def.error:'additionalProperties' }} - {{ $errSchemaPath = $currErrSchemaPath; }} - {{? $breakOnError }} break; {{?}} - {{?}} - {{?? $additionalIsSchema }} - {{? $removeAdditional == 'failing' }} - var {{=$errs}} = errors; - {{# def.setCompositeRule }} - - {{# def.validateAdditional }} - - if (!{{=$nextValid}}) { - errors = {{=$errs}}; - if (validate.errors !== null) { - if (errors) validate.errors.length = errors; - else validate.errors = null; - } - delete {{=$data}}[{{=$key}}]; - } - - {{# def.resetCompositeRule }} - {{??}} - {{# def.validateAdditional }} - {{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}} - {{?}} - {{?}} - {{ it.errorPath = $currentErrorPath; }} - {{?}} - {{? $someProperties }} - } - {{?}} - } - - {{# def.ifResultValid }} -{{?}} - -{{ var $useDefaults = it.opts.useDefaults && !it.compositeRule; }} - -{{? $schemaKeys.length }} - {{~ $schemaKeys:$propertyKey }} - {{ var $sch = $schema[$propertyKey]; }} - - {{? {{# def.nonEmptySchema:$sch}} }} - {{ - var $prop = it.util.getProperty($propertyKey) - , $passData = $data + $prop - , $hasDefault = $useDefaults && $sch.default !== undefined; - $it.schema = $sch; - $it.schemaPath = $schemaPath + $prop; - $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey); - $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers); - $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey); - }} - - {{# def.generateSubschemaCode }} - - {{? {{# def.willOptimize }} }} - {{ - $code = {{# def._optimizeValidate }}; - var $useData = $passData; - }} - {{??}} - {{ var $useData = $nextData; }} - var {{=$nextData}} = {{=$passData}}; - {{?}} - - {{? $hasDefault }} - {{= $code }} - {{??}} - {{? $requiredHash && $requiredHash[$propertyKey] }} - if ({{# def.noPropertyInData }}) { - {{=$nextValid}} = false; - {{ - var $currentErrorPath = it.errorPath - , $currErrSchemaPath = $errSchemaPath - , $missingProperty = it.util.escapeQuotes($propertyKey); - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - $errSchemaPath = it.errSchemaPath + '/required'; - }} - {{# def.error:'required' }} - {{ $errSchemaPath = $currErrSchemaPath; }} - {{ it.errorPath = $currentErrorPath; }} - } else { - {{??}} - {{? $breakOnError }} - if ({{# def.noPropertyInData }}) { - {{=$nextValid}} = true; - } else { - {{??}} - if ({{=$useData}} !== undefined - {{? $ownProperties }} - && {{# def.isOwnProperty }} - {{?}} - ) { - {{?}} - {{?}} - - {{= $code }} - } - {{?}} {{ /* $hasDefault */ }} - {{?}} {{ /* def.nonEmptySchema */ }} - - {{# def.ifResultValid }} - {{~}} -{{?}} - -{{? $pPropertyKeys.length }} - {{~ $pPropertyKeys:$pProperty }} - {{ var $sch = $pProperties[$pProperty]; }} - - {{? {{# def.nonEmptySchema:$sch}} }} - {{ - $it.schema = $sch; - $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty); - $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' - + it.util.escapeFragment($pProperty); - }} - - {{# def.iterateProperties }} - if ({{= it.usePattern($pProperty) }}.test({{=$key}})) { - {{ - $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - }} - - {{# def.generateSubschemaCode }} - {{# def.optimizeValidate }} - - {{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}} - } - {{? $breakOnError }} else {{=$nextValid}} = true; {{?}} - } - - {{# def.ifResultValid }} - {{?}} {{ /* def.nonEmptySchema */ }} - {{~}} -{{?}} - - -{{? $breakOnError }} - {{= $closingBraces }} - if ({{=$errs}} == errors) { -{{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/propertyNames.jst b/node_modules/webpack/node_modules/ajv/lib/dot/propertyNames.jst deleted file mode 100644 index d456cca..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/propertyNames.jst +++ /dev/null @@ -1,52 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.setupNextLevel }} - -var {{=$errs}} = errors; - -{{? {{# def.nonEmptySchema:$schema }} }} - {{ - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - }} - - {{ - var $key = 'key' + $lvl - , $idx = 'idx' + $lvl - , $i = 'i' + $lvl - , $invalidName = '\' + ' + $key + ' + \'' - , $dataNxt = $it.dataLevel = it.dataLevel + 1 - , $nextData = 'data' + $dataNxt - , $dataProperties = 'dataProperties' + $lvl - , $ownProperties = it.opts.ownProperties - , $currentBaseId = it.baseId; - }} - - {{? $ownProperties }} - var {{=$dataProperties}} = undefined; - {{?}} - {{# def.iterateProperties }} - var startErrs{{=$lvl}} = errors; - - {{ var $passData = $key; }} - {{# def.setCompositeRule }} - {{# def.generateSubschemaCode }} - {{# def.optimizeValidate }} - {{# def.resetCompositeRule }} - - if (!{{=$nextValid}}) { - for (var {{=$i}}=startErrs{{=$lvl}}; {{=$i}}= it.opts.loopRequired - , $ownProperties = it.opts.ownProperties; - }} - - {{? $breakOnError }} - var missing{{=$lvl}}; - {{? $loopRequired }} - {{# def.setupLoop }} - var {{=$valid}} = true; - - {{?$isData}}{{# def.check$dataIsArray }}{{?}} - - for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) { - {{=$valid}} = {{=$data}}[{{=$vSchema}}[{{=$i}}]] !== undefined - {{? $ownProperties }} - && {{# def.isRequiredOwnProperty }} - {{?}}; - if (!{{=$valid}}) break; - } - - {{? $isData }} } {{?}} - - {{# def.checkError:'required' }} - else { - {{??}} - if ({{# def.checkMissingProperty:$required }}) { - {{# def.errorMissingProperty:'required' }} - } else { - {{?}} - {{??}} - {{? $loopRequired }} - {{# def.setupLoop }} - {{? $isData }} - if ({{=$vSchema}} && !Array.isArray({{=$vSchema}})) { - {{# def.addError:'required' }} - } else if ({{=$vSchema}} !== undefined) { - {{?}} - - for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) { - if ({{=$data}}[{{=$vSchema}}[{{=$i}}]] === undefined - {{? $ownProperties }} - || !{{# def.isRequiredOwnProperty }} - {{?}}) { - {{# def.addError:'required' }} - } - } - - {{? $isData }} } {{?}} - {{??}} - {{~ $required:$propertyKey }} - {{# def.allErrorsMissingProperty:'required' }} - {{~}} - {{?}} - {{?}} - - {{ it.errorPath = $currentErrorPath; }} - -{{?? $breakOnError }} - if (true) { -{{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/uniqueItems.jst b/node_modules/webpack/node_modules/ajv/lib/dot/uniqueItems.jst deleted file mode 100644 index e69b830..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/uniqueItems.jst +++ /dev/null @@ -1,62 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.setupKeyword }} -{{# def.$data }} - - -{{? ($schema || $isData) && it.opts.uniqueItems !== false }} - {{? $isData }} - var {{=$valid}}; - if ({{=$schemaValue}} === false || {{=$schemaValue}} === undefined) - {{=$valid}} = true; - else if (typeof {{=$schemaValue}} != 'boolean') - {{=$valid}} = false; - else { - {{?}} - - var i = {{=$data}}.length - , {{=$valid}} = true - , j; - if (i > 1) { - {{ - var $itemType = it.schema.items && it.schema.items.type - , $typeIsArray = Array.isArray($itemType); - }} - {{? !$itemType || $itemType == 'object' || $itemType == 'array' || - ($typeIsArray && ($itemType.indexOf('object') >= 0 || $itemType.indexOf('array') >= 0)) }} - outer: - for (;i--;) { - for (j = i; j--;) { - if (equal({{=$data}}[i], {{=$data}}[j])) { - {{=$valid}} = false; - break outer; - } - } - } - {{??}} - var itemIndices = {}, item; - for (;i--;) { - var item = {{=$data}}[i]; - {{ var $method = 'checkDataType' + ($typeIsArray ? 's' : ''); }} - if ({{= it.util[$method]($itemType, 'item', it.opts.strictNumbers, true) }}) continue; - {{? $typeIsArray}} - if (typeof item == 'string') item = '"' + item; - {{?}} - if (typeof itemIndices[item] == 'number') { - {{=$valid}} = false; - j = itemIndices[item]; - break; - } - itemIndices[item] = i; - } - {{?}} - } - - {{? $isData }} } {{?}} - - if (!{{=$valid}}) { - {{# def.error:'uniqueItems' }} - } {{? $breakOnError }} else { {{?}} -{{??}} - {{? $breakOnError }} if (true) { {{?}} -{{?}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dot/validate.jst b/node_modules/webpack/node_modules/ajv/lib/dot/validate.jst deleted file mode 100644 index 32087e7..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dot/validate.jst +++ /dev/null @@ -1,276 +0,0 @@ -{{# def.definitions }} -{{# def.errors }} -{{# def.defaults }} -{{# def.coerce }} - -{{ /** - * schema compilation (render) time: - * it = { schema, RULES, _validate, opts } - * it.validate - this template function, - * it is used recursively to generate code for subschemas - * - * runtime: - * "validate" is a variable name to which this function will be assigned - * validateRef etc. are defined in the parent scope in index.js - */ }} - -{{ - var $async = it.schema.$async === true - , $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref') - , $id = it.self._getId(it.schema); -}} - -{{ - if (it.opts.strictKeywords) { - var $unknownKwd = it.util.schemaUnknownRules(it.schema, it.RULES.keywords); - if ($unknownKwd) { - var $keywordsMsg = 'unknown keyword: ' + $unknownKwd; - if (it.opts.strictKeywords === 'log') it.logger.warn($keywordsMsg); - else throw new Error($keywordsMsg); - } - } -}} - -{{? it.isTop }} - var validate = {{?$async}}{{it.async = true;}}async {{?}}function(data, dataPath, parentData, parentDataProperty, rootData) { - 'use strict'; - {{? $id && (it.opts.sourceCode || it.opts.processCode) }} - {{= '/\*# sourceURL=' + $id + ' */' }} - {{?}} -{{?}} - -{{? typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref) }} - {{ var $keyword = 'false schema'; }} - {{# def.setupKeyword }} - {{? it.schema === false}} - {{? it.isTop}} - {{ $breakOnError = true; }} - {{??}} - var {{=$valid}} = false; - {{?}} - {{# def.error:'false schema' }} - {{??}} - {{? it.isTop}} - {{? $async }} - return data; - {{??}} - validate.errors = null; - return true; - {{?}} - {{??}} - var {{=$valid}} = true; - {{?}} - {{?}} - - {{? it.isTop}} - }; - return validate; - {{?}} - - {{ return out; }} -{{?}} - - -{{? it.isTop }} - {{ - var $top = it.isTop - , $lvl = it.level = 0 - , $dataLvl = it.dataLevel = 0 - , $data = 'data'; - it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema)); - it.baseId = it.baseId || it.rootId; - delete it.isTop; - - it.dataPathArr = [""]; - - if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) { - var $defaultMsg = 'default is ignored in the schema root'; - if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); - else throw new Error($defaultMsg); - } - }} - - var vErrors = null; {{ /* don't edit, used in replace */ }} - var errors = 0; {{ /* don't edit, used in replace */ }} - if (rootData === undefined) rootData = data; {{ /* don't edit, used in replace */ }} -{{??}} - {{ - var $lvl = it.level - , $dataLvl = it.dataLevel - , $data = 'data' + ($dataLvl || ''); - - if ($id) it.baseId = it.resolve.url(it.baseId, $id); - - if ($async && !it.async) throw new Error('async schema in sync schema'); - }} - - var errs_{{=$lvl}} = errors; -{{?}} - -{{ - var $valid = 'valid' + $lvl - , $breakOnError = !it.opts.allErrors - , $closingBraces1 = '' - , $closingBraces2 = ''; - - var $errorKeyword; - var $typeSchema = it.schema.type - , $typeIsArray = Array.isArray($typeSchema); - - if ($typeSchema && it.opts.nullable && it.schema.nullable === true) { - if ($typeIsArray) { - if ($typeSchema.indexOf('null') == -1) - $typeSchema = $typeSchema.concat('null'); - } else if ($typeSchema != 'null') { - $typeSchema = [$typeSchema, 'null']; - $typeIsArray = true; - } - } - - if ($typeIsArray && $typeSchema.length == 1) { - $typeSchema = $typeSchema[0]; - $typeIsArray = false; - } -}} - -{{## def.checkType: - {{ - var $schemaPath = it.schemaPath + '.type' - , $errSchemaPath = it.errSchemaPath + '/type' - , $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType'; - }} - - if ({{= it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true) }}) { -#}} - -{{? it.schema.$ref && $refKeywords }} - {{? it.opts.extendRefs == 'fail' }} - {{ throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); }} - {{?? it.opts.extendRefs !== true }} - {{ - $refKeywords = false; - it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"'); - }} - {{?}} -{{?}} - -{{? it.schema.$comment && it.opts.$comment }} - {{= it.RULES.all.$comment.code(it, '$comment') }} -{{?}} - -{{? $typeSchema }} - {{? it.opts.coerceTypes }} - {{ var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); }} - {{?}} - - {{ var $rulesGroup = it.RULES.types[$typeSchema]; }} - {{? $coerceToTypes || $typeIsArray || $rulesGroup === true || - ($rulesGroup && !$shouldUseGroup($rulesGroup)) }} - {{ - var $schemaPath = it.schemaPath + '.type' - , $errSchemaPath = it.errSchemaPath + '/type'; - }} - {{# def.checkType }} - {{? $coerceToTypes }} - {{# def.coerceType }} - {{??}} - {{# def.error:'type' }} - {{?}} - } - {{?}} -{{?}} - - -{{? it.schema.$ref && !$refKeywords }} - {{= it.RULES.all.$ref.code(it, '$ref') }} - {{? $breakOnError }} - } - if (errors === {{?$top}}0{{??}}errs_{{=$lvl}}{{?}}) { - {{ $closingBraces2 += '}'; }} - {{?}} -{{??}} - {{~ it.RULES:$rulesGroup }} - {{? $shouldUseGroup($rulesGroup) }} - {{? $rulesGroup.type }} - if ({{= it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers) }}) { - {{?}} - {{? it.opts.useDefaults }} - {{? $rulesGroup.type == 'object' && it.schema.properties }} - {{# def.defaultProperties }} - {{?? $rulesGroup.type == 'array' && Array.isArray(it.schema.items) }} - {{# def.defaultItems }} - {{?}} - {{?}} - {{~ $rulesGroup.rules:$rule }} - {{? $shouldUseRule($rule) }} - {{ var $code = $rule.code(it, $rule.keyword, $rulesGroup.type); }} - {{? $code }} - {{= $code }} - {{? $breakOnError }} - {{ $closingBraces1 += '}'; }} - {{?}} - {{?}} - {{?}} - {{~}} - {{? $breakOnError }} - {{= $closingBraces1 }} - {{ $closingBraces1 = ''; }} - {{?}} - {{? $rulesGroup.type }} - } - {{? $typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes }} - else { - {{ - var $schemaPath = it.schemaPath + '.type' - , $errSchemaPath = it.errSchemaPath + '/type'; - }} - {{# def.error:'type' }} - } - {{?}} - {{?}} - - {{? $breakOnError }} - if (errors === {{?$top}}0{{??}}errs_{{=$lvl}}{{?}}) { - {{ $closingBraces2 += '}'; }} - {{?}} - {{?}} - {{~}} -{{?}} - -{{? $breakOnError }} {{= $closingBraces2 }} {{?}} - -{{? $top }} - {{? $async }} - if (errors === 0) return data; {{ /* don't edit, used in replace */ }} - else throw new ValidationError(vErrors); {{ /* don't edit, used in replace */ }} - {{??}} - validate.errors = vErrors; {{ /* don't edit, used in replace */ }} - return errors === 0; {{ /* don't edit, used in replace */ }} - {{?}} - }; - - return validate; -{{??}} - var {{=$valid}} = errors === errs_{{=$lvl}}; -{{?}} - -{{ - function $shouldUseGroup($rulesGroup) { - var rules = $rulesGroup.rules; - for (var i=0; i < rules.length; i++) - if ($shouldUseRule(rules[i])) - return true; - } - - function $shouldUseRule($rule) { - return it.schema[$rule.keyword] !== undefined || - ($rule.implements && $ruleImplementsSomeKeyword($rule)); - } - - function $ruleImplementsSomeKeyword($rule) { - var impl = $rule.implements; - for (var i=0; i < impl.length; i++) - if (it.schema[impl[i]] !== undefined) - return true; - } -}} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/README.md b/node_modules/webpack/node_modules/ajv/lib/dotjs/README.md deleted file mode 100644 index 4d99484..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/README.md +++ /dev/null @@ -1,3 +0,0 @@ -These files are compiled dot templates from dot folder. - -Do NOT edit them directly, edit the templates and run `npm run build` from main ajv folder. diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/_limit.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/_limit.js deleted file mode 100644 index 05a1979..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/_limit.js +++ /dev/null @@ -1,163 +0,0 @@ -'use strict'; -module.exports = function generate__limit(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $isMax = $keyword == 'maximum', - $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum', - $schemaExcl = it.schema[$exclusiveKeyword], - $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data, - $op = $isMax ? '<' : '>', - $notOp = $isMax ? '>' : '<', - $errorKeyword = undefined; - if (!($isData || typeof $schema == 'number' || $schema === undefined)) { - throw new Error($keyword + ' must be number'); - } - if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) { - throw new Error($exclusiveKeyword + ' must be number or boolean'); - } - if ($isDataExcl) { - var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr), - $exclusive = 'exclusive' + $lvl, - $exclType = 'exclType' + $lvl, - $exclIsNumber = 'exclIsNumber' + $lvl, - $opExpr = 'op' + $lvl, - $opStr = '\' + ' + $opExpr + ' + \''; - out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; '; - $schemaValueExcl = 'schemaExcl' + $lvl; - out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \'boolean\' && ' + ($exclType) + ' != \'undefined\' && ' + ($exclType) + ' != \'number\') { '; - var $errorKeyword = $exclusiveKeyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ' + ($exclType) + ' == \'number\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\'; '; - if ($schema === undefined) { - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $schemaValue = $schemaValueExcl; - $isData = $isDataExcl; - } - } else { - var $exclIsNumber = typeof $schemaExcl == 'number', - $opStr = $op; - if ($exclIsNumber && $isData) { - var $opExpr = '\'' + $opStr + '\''; - out += ' if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { '; - } else { - if ($exclIsNumber && $schema === undefined) { - $exclusive = true; - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $schemaValue = $schemaExcl; - $notOp += '='; - } else { - if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema); - if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) { - $exclusive = true; - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $notOp += '='; - } else { - $exclusive = false; - $opStr += '='; - } - } - var $opExpr = '\'' + $opStr + '\''; - out += ' if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { '; - } - } - $errorKeyword = $errorKeyword || $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be ' + ($opStr) + ' '; - if ($isData) { - out += '\' + ' + ($schemaValue); - } else { - out += '' + ($schemaValue) + '\''; - } - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/_limitItems.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/_limitItems.js deleted file mode 100644 index e092a55..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/_limitItems.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict'; -module.exports = function generate__limitItems(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!($isData || typeof $schema == 'number')) { - throw new Error($keyword + ' must be number'); - } - var $op = $keyword == 'maxItems' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have '; - if ($keyword == 'maxItems') { - out += 'more'; - } else { - out += 'fewer'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' items\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/_limitLength.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/_limitLength.js deleted file mode 100644 index ecbd3fe..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/_limitLength.js +++ /dev/null @@ -1,85 +0,0 @@ -'use strict'; -module.exports = function generate__limitLength(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!($isData || typeof $schema == 'number')) { - throw new Error($keyword + ' must be number'); - } - var $op = $keyword == 'maxLength' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - if (it.opts.unicode === false) { - out += ' ' + ($data) + '.length '; - } else { - out += ' ucs2length(' + ($data) + ') '; - } - out += ' ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT be '; - if ($keyword == 'maxLength') { - out += 'longer'; - } else { - out += 'shorter'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' characters\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/_limitProperties.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/_limitProperties.js deleted file mode 100644 index d232755..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/_limitProperties.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict'; -module.exports = function generate__limitProperties(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!($isData || typeof $schema == 'number')) { - throw new Error($keyword + ' must be number'); - } - var $op = $keyword == 'maxProperties' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have '; - if ($keyword == 'maxProperties') { - out += 'more'; - } else { - out += 'fewer'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' properties\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/allOf.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/allOf.js deleted file mode 100644 index fb8c2e4..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/allOf.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; -module.exports = function generate_allOf(it, $keyword, $ruleType) { - var out = ' '; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $currentBaseId = $it.baseId, - $allSchemasEmpty = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - $allSchemasEmpty = false; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if ($breakOnError) { - if ($allSchemasEmpty) { - out += ' if (true) { '; - } else { - out += ' ' + ($closingBraces.slice(0, -1)) + ' '; - } - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/anyOf.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/anyOf.js deleted file mode 100644 index 0600a9d..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/anyOf.js +++ /dev/null @@ -1,73 +0,0 @@ -'use strict'; -module.exports = function generate_anyOf(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $noEmptySchema = $schema.every(function($sch) { - return (it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)); - }); - if ($noEmptySchema) { - var $currentBaseId = $it.baseId; - out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { '; - $closingBraces += '}'; - } - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should match some schema in anyOf\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; return false; '; - } - } - out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - if (it.opts.allErrors) { - out += ' } '; - } - } else { - if ($breakOnError) { - out += ' if (true) { '; - } - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/comment.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/comment.js deleted file mode 100644 index dd66bb8..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/comment.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; -module.exports = function generate_comment(it, $keyword, $ruleType) { - var out = ' '; - var $schema = it.schema[$keyword]; - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $comment = it.util.toQuotedString($schema); - if (it.opts.$comment === true) { - out += ' console.log(' + ($comment) + ');'; - } else if (typeof it.opts.$comment == 'function') { - out += ' self._opts.$comment(' + ($comment) + ', ' + (it.util.toQuotedString($errSchemaPath)) + ', validate.root.schema);'; - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/const.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/const.js deleted file mode 100644 index 15b7c61..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/const.js +++ /dev/null @@ -1,56 +0,0 @@ -'use strict'; -module.exports = function generate_const(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!$isData) { - out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';'; - } - out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('const') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValue: schema' + ($lvl) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be equal to constant\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' }'; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/contains.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/contains.js deleted file mode 100644 index 7d76300..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/contains.js +++ /dev/null @@ -1,81 +0,0 @@ -'use strict'; -module.exports = function generate_contains(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $idx = 'i' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $currentBaseId = it.baseId, - $nonEmptySchema = (it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all)); - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if ($nonEmptySchema) { - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' var ' + ($nextValid) + ' = false; for (var ' + ($idx) + ' = 0; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - out += ' if (' + ($nextValid) + ') break; } '; - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($closingBraces) + ' if (!' + ($nextValid) + ') {'; - } else { - out += ' if (' + ($data) + '.length == 0) {'; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('contains') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should contain a valid item\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - if ($nonEmptySchema) { - out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - } - if (it.opts.allErrors) { - out += ' } '; - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/custom.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/custom.js deleted file mode 100644 index f3e641e..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/custom.js +++ /dev/null @@ -1,228 +0,0 @@ -'use strict'; -module.exports = function generate_custom(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $rule = this, - $definition = 'definition' + $lvl, - $rDef = $rule.definition, - $closingBraces = ''; - var $compile, $inline, $macro, $ruleValidate, $validateCode; - if ($isData && $rDef.$data) { - $validateCode = 'keywordValidate' + $lvl; - var $validateSchema = $rDef.validateSchema; - out += ' var ' + ($definition) + ' = RULES.custom[\'' + ($keyword) + '\'].definition; var ' + ($validateCode) + ' = ' + ($definition) + '.validate;'; - } else { - $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it); - if (!$ruleValidate) return; - $schemaValue = 'validate.schema' + $schemaPath; - $validateCode = $ruleValidate.code; - $compile = $rDef.compile; - $inline = $rDef.inline; - $macro = $rDef.macro; - } - var $ruleErrs = $validateCode + '.errors', - $i = 'i' + $lvl, - $ruleErr = 'ruleErr' + $lvl, - $asyncKeyword = $rDef.async; - if ($asyncKeyword && !it.async) throw new Error('async keyword in sync schema'); - if (!($inline || $macro)) { - out += '' + ($ruleErrs) + ' = null;'; - } - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if ($isData && $rDef.$data) { - $closingBraces += '}'; - out += ' if (' + ($schemaValue) + ' === undefined) { ' + ($valid) + ' = true; } else { '; - if ($validateSchema) { - $closingBraces += '}'; - out += ' ' + ($valid) + ' = ' + ($definition) + '.validateSchema(' + ($schemaValue) + '); if (' + ($valid) + ') { '; - } - } - if ($inline) { - if ($rDef.statements) { - out += ' ' + ($ruleValidate.validate) + ' '; - } else { - out += ' ' + ($valid) + ' = ' + ($ruleValidate.validate) + '; '; - } - } else if ($macro) { - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - $it.schema = $ruleValidate.validate; - $it.schemaPath = ''; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($code); - } else { - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; - out += ' ' + ($validateCode) + '.call( '; - if (it.opts.passContext) { - out += 'this'; - } else { - out += 'self'; - } - if ($compile || $rDef.schema === false) { - out += ' , ' + ($data) + ' '; - } else { - out += ' , ' + ($schemaValue) + ' , ' + ($data) + ' , validate.schema' + (it.schemaPath) + ' '; - } - out += ' , (dataPath || \'\')'; - if (it.errorPath != '""') { - out += ' + ' + (it.errorPath); - } - var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', - $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; - out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ' , rootData ) '; - var def_callRuleValidate = out; - out = $$outStack.pop(); - if ($rDef.errors === false) { - out += ' ' + ($valid) + ' = '; - if ($asyncKeyword) { - out += 'await '; - } - out += '' + (def_callRuleValidate) + '; '; - } else { - if ($asyncKeyword) { - $ruleErrs = 'customErrors' + $lvl; - out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = await ' + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } '; - } else { - out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; '; - } - } - } - if ($rDef.modifying) { - out += ' if (' + ($parentData) + ') ' + ($data) + ' = ' + ($parentData) + '[' + ($parentDataProperty) + '];'; - } - out += '' + ($closingBraces); - if ($rDef.valid) { - if ($breakOnError) { - out += ' if (true) { '; - } - } else { - out += ' if ( '; - if ($rDef.valid === undefined) { - out += ' !'; - if ($macro) { - out += '' + ($nextValid); - } else { - out += '' + ($valid); - } - } else { - out += ' ' + (!$rDef.valid) + ' '; - } - out += ') { '; - $errorKeyword = $rule.keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - var def_customError = out; - out = $$outStack.pop(); - if ($inline) { - if ($rDef.errors) { - if ($rDef.errors != 'full') { - out += ' for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + ' 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') '; - } - out += ') { '; - $it.schema = $sch; - $it.schemaPath = $schemaPath + it.util.getProperty($property); - $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property); - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/enum.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/enum.js deleted file mode 100644 index 90580b9..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/enum.js +++ /dev/null @@ -1,66 +0,0 @@ -'use strict'; -module.exports = function generate_enum(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $i = 'i' + $lvl, - $vSchema = 'schema' + $lvl; - if (!$isData) { - out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + ';'; - } - out += 'var ' + ($valid) + ';'; - if ($isData) { - out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {'; - } - out += '' + ($valid) + ' = false;for (var ' + ($i) + '=0; ' + ($i) + '<' + ($vSchema) + '.length; ' + ($i) + '++) if (equal(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + '])) { ' + ($valid) + ' = true; break; }'; - if ($isData) { - out += ' } '; - } - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('enum') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValues: schema' + ($lvl) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be equal to one of the allowed values\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' }'; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/format.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/format.js deleted file mode 100644 index cd9a569..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/format.js +++ /dev/null @@ -1,150 +0,0 @@ -'use strict'; -module.exports = function generate_format(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - if (it.opts.format === false) { - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $unknownFormats = it.opts.unknownFormats, - $allowUnknown = Array.isArray($unknownFormats); - if ($isData) { - var $format = 'format' + $lvl, - $isObject = 'isObject' + $lvl, - $formatType = 'formatType' + $lvl; - out += ' var ' + ($format) + ' = formats[' + ($schemaValue) + ']; var ' + ($isObject) + ' = typeof ' + ($format) + ' == \'object\' && !(' + ($format) + ' instanceof RegExp) && ' + ($format) + '.validate; var ' + ($formatType) + ' = ' + ($isObject) + ' && ' + ($format) + '.type || \'string\'; if (' + ($isObject) + ') { '; - if (it.async) { - out += ' var async' + ($lvl) + ' = ' + ($format) + '.async; '; - } - out += ' ' + ($format) + ' = ' + ($format) + '.validate; } if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || '; - } - out += ' ('; - if ($unknownFormats != 'ignore') { - out += ' (' + ($schemaValue) + ' && !' + ($format) + ' '; - if ($allowUnknown) { - out += ' && self._opts.unknownFormats.indexOf(' + ($schemaValue) + ') == -1 '; - } - out += ') || '; - } - out += ' (' + ($format) + ' && ' + ($formatType) + ' == \'' + ($ruleType) + '\' && !(typeof ' + ($format) + ' == \'function\' ? '; - if (it.async) { - out += ' (async' + ($lvl) + ' ? await ' + ($format) + '(' + ($data) + ') : ' + ($format) + '(' + ($data) + ')) '; - } else { - out += ' ' + ($format) + '(' + ($data) + ') '; - } - out += ' : ' + ($format) + '.test(' + ($data) + '))))) {'; - } else { - var $format = it.formats[$schema]; - if (!$format) { - if ($unknownFormats == 'ignore') { - it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } else if ($allowUnknown && $unknownFormats.indexOf($schema) >= 0) { - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } else { - throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"'); - } - } - var $isObject = typeof $format == 'object' && !($format instanceof RegExp) && $format.validate; - var $formatType = $isObject && $format.type || 'string'; - if ($isObject) { - var $async = $format.async === true; - $format = $format.validate; - } - if ($formatType != $ruleType) { - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } - if ($async) { - if (!it.async) throw new Error('async format in sync schema'); - var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate'; - out += ' if (!(await ' + ($formatRef) + '(' + ($data) + '))) { '; - } else { - out += ' if (! '; - var $formatRef = 'formats' + it.util.getProperty($schema); - if ($isObject) $formatRef += '.validate'; - if (typeof $format == 'function') { - out += ' ' + ($formatRef) + '(' + ($data) + ') '; - } else { - out += ' ' + ($formatRef) + '.test(' + ($data) + ') '; - } - out += ') { '; - } - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('format') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: '; - if ($isData) { - out += '' + ($schemaValue); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match format "'; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + (it.util.escapeQuotes($schema)); - } - out += '"\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/if.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/if.js deleted file mode 100644 index 94d27ad..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/if.js +++ /dev/null @@ -1,103 +0,0 @@ -'use strict'; -module.exports = function generate_if(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - $it.level++; - var $nextValid = 'valid' + $it.level; - var $thenSch = it.schema['then'], - $elseSch = it.schema['else'], - $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)), - $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)), - $currentBaseId = $it.baseId; - if ($thenPresent || $elsePresent) { - var $ifClause; - $it.createErrors = false; - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = true; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - $it.createErrors = true; - out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - it.compositeRule = $it.compositeRule = $wasComposite; - if ($thenPresent) { - out += ' if (' + ($nextValid) + ') { '; - $it.schema = it.schema['then']; - $it.schemaPath = it.schemaPath + '.then'; - $it.errSchemaPath = it.errSchemaPath + '/then'; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' ' + ($valid) + ' = ' + ($nextValid) + '; '; - if ($thenPresent && $elsePresent) { - $ifClause = 'ifClause' + $lvl; - out += ' var ' + ($ifClause) + ' = \'then\'; '; - } else { - $ifClause = '\'then\''; - } - out += ' } '; - if ($elsePresent) { - out += ' else { '; - } - } else { - out += ' if (!' + ($nextValid) + ') { '; - } - if ($elsePresent) { - $it.schema = it.schema['else']; - $it.schemaPath = it.schemaPath + '.else'; - $it.errSchemaPath = it.errSchemaPath + '/else'; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' ' + ($valid) + ' = ' + ($nextValid) + '; '; - if ($thenPresent && $elsePresent) { - $ifClause = 'ifClause' + $lvl; - out += ' var ' + ($ifClause) + ' = \'else\'; '; - } else { - $ifClause = '\'else\''; - } - out += ' } '; - } - out += ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('if') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { failingKeyword: ' + ($ifClause) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match "\' + ' + ($ifClause) + ' + \'" schema\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; return false; '; - } - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - } else { - if ($breakOnError) { - out += ' if (true) { '; - } - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/index.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/index.js deleted file mode 100644 index 2fb1b00..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/index.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; - -//all requires must be explicit because browserify won't work with dynamic requires -module.exports = { - '$ref': require('./ref'), - allOf: require('./allOf'), - anyOf: require('./anyOf'), - '$comment': require('./comment'), - const: require('./const'), - contains: require('./contains'), - dependencies: require('./dependencies'), - 'enum': require('./enum'), - format: require('./format'), - 'if': require('./if'), - items: require('./items'), - maximum: require('./_limit'), - minimum: require('./_limit'), - maxItems: require('./_limitItems'), - minItems: require('./_limitItems'), - maxLength: require('./_limitLength'), - minLength: require('./_limitLength'), - maxProperties: require('./_limitProperties'), - minProperties: require('./_limitProperties'), - multipleOf: require('./multipleOf'), - not: require('./not'), - oneOf: require('./oneOf'), - pattern: require('./pattern'), - properties: require('./properties'), - propertyNames: require('./propertyNames'), - required: require('./required'), - uniqueItems: require('./uniqueItems'), - validate: require('./validate') -}; diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/items.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/items.js deleted file mode 100644 index bee5d67..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/items.js +++ /dev/null @@ -1,140 +0,0 @@ -'use strict'; -module.exports = function generate_items(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $idx = 'i' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $currentBaseId = it.baseId; - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if (Array.isArray($schema)) { - var $additionalItems = it.schema.additionalItems; - if ($additionalItems === false) { - out += ' ' + ($valid) + ' = ' + ($data) + '.length <= ' + ($schema.length) + '; '; - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + '/additionalItems'; - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('additionalItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schema.length) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have more than ' + ($schema.length) + ' items\' '; - } - if (it.opts.verbose) { - out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - $errSchemaPath = $currErrSchemaPath; - if ($breakOnError) { - $closingBraces += '}'; - out += ' else { '; - } - } - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { '; - var $passData = $data + '[' + $i + ']'; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true); - $it.dataPathArr[$dataNxt] = $i; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? (typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0) || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) { - $it.schema = $additionalItems; - $it.schemaPath = it.schemaPath + '.additionalItems'; - $it.errSchemaPath = it.errSchemaPath + '/additionalItems'; - out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($schema.length) + ') { for (var ' + ($idx) + ' = ' + ($schema.length) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' } } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } else if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' for (var ' + ($idx) + ' = ' + (0) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' }'; - } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/multipleOf.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/multipleOf.js deleted file mode 100644 index 9d6401b..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/multipleOf.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict'; -module.exports = function generate_multipleOf(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!($isData || typeof $schema == 'number')) { - throw new Error($keyword + ' must be number'); - } - out += 'var division' + ($lvl) + ';if ('; - if ($isData) { - out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || '; - } - out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', '; - if (it.opts.multipleOfPrecision) { - out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' '; - } else { - out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') '; - } - out += ' ) '; - if ($isData) { - out += ' ) '; - } - out += ' ) { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('multipleOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be multiple of '; - if ($isData) { - out += '\' + ' + ($schemaValue); - } else { - out += '' + ($schemaValue) + '\''; - } - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/not.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/not.js deleted file mode 100644 index f50c937..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/not.js +++ /dev/null @@ -1,84 +0,0 @@ -'use strict'; -module.exports = function generate_not(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - $it.level++; - var $nextValid = 'valid' + $it.level; - if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' var ' + ($errs) + ' = errors; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.createErrors = false; - var $allErrorsOption; - if ($it.opts.allErrors) { - $allErrorsOption = $it.opts.allErrors; - $it.opts.allErrors = false; - } - out += ' ' + (it.validate($it)) + ' '; - $it.createErrors = true; - if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption; - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' if (' + ($nextValid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT be valid\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - if (it.opts.allErrors) { - out += ' } '; - } - } else { - out += ' var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT be valid\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if ($breakOnError) { - out += ' if (false) { '; - } - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/oneOf.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/oneOf.js deleted file mode 100644 index dfe2fd5..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/oneOf.js +++ /dev/null @@ -1,73 +0,0 @@ -'use strict'; -module.exports = function generate_oneOf(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $currentBaseId = $it.baseId, - $prevValid = 'prevValid' + $lvl, - $passingSchemas = 'passingSchemas' + $lvl; - out += 'var ' + ($errs) + ' = errors , ' + ($prevValid) + ' = false , ' + ($valid) + ' = false , ' + ($passingSchemas) + ' = null; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - } else { - out += ' var ' + ($nextValid) + ' = true; '; - } - if ($i) { - out += ' if (' + ($nextValid) + ' && ' + ($prevValid) + ') { ' + ($valid) + ' = false; ' + ($passingSchemas) + ' = [' + ($passingSchemas) + ', ' + ($i) + ']; } else { '; - $closingBraces += '}'; - } - out += ' if (' + ($nextValid) + ') { ' + ($valid) + ' = ' + ($prevValid) + ' = true; ' + ($passingSchemas) + ' = ' + ($i) + '; }'; - } - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { passingSchemas: ' + ($passingSchemas) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match exactly one schema in oneOf\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; return false; '; - } - } - out += '} else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; }'; - if (it.opts.allErrors) { - out += ' } '; - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/pattern.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/pattern.js deleted file mode 100644 index 1d74d6b..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/pattern.js +++ /dev/null @@ -1,75 +0,0 @@ -'use strict'; -module.exports = function generate_pattern(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema); - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || '; - } - out += ' !' + ($regexp) + '.test(' + ($data) + ') ) { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('pattern') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern: '; - if ($isData) { - out += '' + ($schemaValue); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match pattern "'; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + (it.util.escapeQuotes($schema)); - } - out += '"\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/properties.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/properties.js deleted file mode 100644 index bc5ee55..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/properties.js +++ /dev/null @@ -1,335 +0,0 @@ -'use strict'; -module.exports = function generate_properties(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $key = 'key' + $lvl, - $idx = 'idx' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $dataProperties = 'dataProperties' + $lvl; - var $schemaKeys = Object.keys($schema || {}).filter(notProto), - $pProperties = it.schema.patternProperties || {}, - $pPropertyKeys = Object.keys($pProperties).filter(notProto), - $aProperties = it.schema.additionalProperties, - $someProperties = $schemaKeys.length || $pPropertyKeys.length, - $noAdditional = $aProperties === false, - $additionalIsSchema = typeof $aProperties == 'object' && Object.keys($aProperties).length, - $removeAdditional = it.opts.removeAdditional, - $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional, - $ownProperties = it.opts.ownProperties, - $currentBaseId = it.baseId; - var $required = it.schema.required; - if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) { - var $requiredHash = it.util.toHash($required); - } - - function notProto(p) { - return p !== '__proto__'; - } - out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;'; - if ($ownProperties) { - out += ' var ' + ($dataProperties) + ' = undefined;'; - } - if ($checkAdditional) { - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - if ($someProperties) { - out += ' var isAdditional' + ($lvl) + ' = !(false '; - if ($schemaKeys.length) { - if ($schemaKeys.length > 8) { - out += ' || validate.schema' + ($schemaPath) + '.hasOwnProperty(' + ($key) + ') '; - } else { - var arr1 = $schemaKeys; - if (arr1) { - var $propertyKey, i1 = -1, - l1 = arr1.length - 1; - while (i1 < l1) { - $propertyKey = arr1[i1 += 1]; - out += ' || ' + ($key) + ' == ' + (it.util.toQuotedString($propertyKey)) + ' '; - } - } - } - } - if ($pPropertyKeys.length) { - var arr2 = $pPropertyKeys; - if (arr2) { - var $pProperty, $i = -1, - l2 = arr2.length - 1; - while ($i < l2) { - $pProperty = arr2[$i += 1]; - out += ' || ' + (it.usePattern($pProperty)) + '.test(' + ($key) + ') '; - } - } - } - out += ' ); if (isAdditional' + ($lvl) + ') { '; - } - if ($removeAdditional == 'all') { - out += ' delete ' + ($data) + '[' + ($key) + ']; '; - } else { - var $currentErrorPath = it.errorPath; - var $additionalProperty = '\' + ' + $key + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - } - if ($noAdditional) { - if ($removeAdditional) { - out += ' delete ' + ($data) + '[' + ($key) + ']; '; - } else { - out += ' ' + ($nextValid) + ' = false; '; - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + '/additionalProperties'; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('additionalProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \'' + ($additionalProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is an invalid additional property'; - } else { - out += 'should NOT have additional properties'; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - $errSchemaPath = $currErrSchemaPath; - if ($breakOnError) { - out += ' break; '; - } - } - } else if ($additionalIsSchema) { - if ($removeAdditional == 'failing') { - out += ' var ' + ($errs) + ' = errors; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.schema = $aProperties; - $it.schemaPath = it.schemaPath + '.additionalProperties'; - $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; - $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - out += ' if (!' + ($nextValid) + ') { errors = ' + ($errs) + '; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete ' + ($data) + '[' + ($key) + ']; } '; - it.compositeRule = $it.compositeRule = $wasComposite; - } else { - $it.schema = $aProperties; - $it.schemaPath = it.schemaPath + '.additionalProperties'; - $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; - $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - } - } - it.errorPath = $currentErrorPath; - } - if ($someProperties) { - out += ' } '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - var $useDefaults = it.opts.useDefaults && !it.compositeRule; - if ($schemaKeys.length) { - var arr3 = $schemaKeys; - if (arr3) { - var $propertyKey, i3 = -1, - l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $sch = $schema[$propertyKey]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - var $prop = it.util.getProperty($propertyKey), - $passData = $data + $prop, - $hasDefault = $useDefaults && $sch.default !== undefined; - $it.schema = $sch; - $it.schemaPath = $schemaPath + $prop; - $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey); - $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers); - $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey); - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - $code = it.util.varReplace($code, $nextData, $passData); - var $useData = $passData; - } else { - var $useData = $nextData; - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; '; - } - if ($hasDefault) { - out += ' ' + ($code) + ' '; - } else { - if ($requiredHash && $requiredHash[$propertyKey]) { - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { ' + ($nextValid) + ' = false; '; - var $currentErrorPath = it.errorPath, - $currErrSchemaPath = $errSchemaPath, - $missingProperty = it.util.escapeQuotes($propertyKey); - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - $errSchemaPath = it.errSchemaPath + '/required'; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - $errSchemaPath = $currErrSchemaPath; - it.errorPath = $currentErrorPath; - out += ' } else { '; - } else { - if ($breakOnError) { - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { ' + ($nextValid) + ' = true; } else { '; - } else { - out += ' if (' + ($useData) + ' !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ' ) { '; - } - } - out += ' ' + ($code) + ' } '; - } - } - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if ($pPropertyKeys.length) { - var arr4 = $pPropertyKeys; - if (arr4) { - var $pProperty, i4 = -1, - l4 = arr4.length - 1; - while (i4 < l4) { - $pProperty = arr4[i4 += 1]; - var $sch = $pProperties[$pProperty]; - if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) { - $it.schema = $sch; - $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty); - $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty); - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - out += ' if (' + (it.usePattern($pProperty)) + '.test(' + ($key) + ')) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else ' + ($nextValid) + ' = true; '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/propertyNames.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/propertyNames.js deleted file mode 100644 index 2a54a08..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/propertyNames.js +++ /dev/null @@ -1,81 +0,0 @@ -'use strict'; -module.exports = function generate_propertyNames(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - out += 'var ' + ($errs) + ' = errors;'; - if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) { - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - var $key = 'key' + $lvl, - $idx = 'idx' + $lvl, - $i = 'i' + $lvl, - $invalidName = '\' + ' + $key + ' + \'', - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $dataProperties = 'dataProperties' + $lvl, - $ownProperties = it.opts.ownProperties, - $currentBaseId = it.baseId; - if ($ownProperties) { - out += ' var ' + ($dataProperties) + ' = undefined; '; - } - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - out += ' var startErrs' + ($lvl) + ' = errors; '; - var $passData = $key; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' if (!' + ($nextValid) + ') { for (var ' + ($i) + '=startErrs' + ($lvl) + '; ' + ($i) + ' 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) { - $required[$required.length] = $property; - } - } - } - } else { - var $required = $schema; - } - } - if ($isData || $required.length) { - var $currentErrorPath = it.errorPath, - $loopRequired = $isData || $required.length >= it.opts.loopRequired, - $ownProperties = it.opts.ownProperties; - if ($breakOnError) { - out += ' var missing' + ($lvl) + '; '; - if ($loopRequired) { - if (!$isData) { - out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; - } - var $i = 'i' + $lvl, - $propertyPath = 'schema' + $lvl + '[' + $i + ']', - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); - } - out += ' var ' + ($valid) + ' = true; '; - if ($isData) { - out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {'; - } - out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) '; - } - out += '; if (!' + ($valid) + ') break; } '; - if ($isData) { - out += ' } '; - } - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - } else { - out += ' if ( '; - var arr2 = $required; - if (arr2) { - var $propertyKey, $i = -1, - l2 = arr2.length - 1; - while ($i < l2) { - $propertyKey = arr2[$i += 1]; - if ($i) { - out += ' || '; - } - var $prop = it.util.getProperty($propertyKey), - $useData = $data + $prop; - out += ' ( ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) '; - } - } - out += ') { '; - var $propertyPath = 'missing' + $lvl, - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - } - } else { - if ($loopRequired) { - if (!$isData) { - out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; - } - var $i = 'i' + $lvl, - $propertyPath = 'schema' + $lvl + '[' + $i + ']', - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); - } - if ($isData) { - out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { '; - } - out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) '; - } - out += ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } '; - if ($isData) { - out += ' } '; - } - } else { - var arr3 = $required; - if (arr3) { - var $propertyKey, i3 = -1, - l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $prop = it.util.getProperty($propertyKey), - $missingProperty = it.util.escapeQuotes($propertyKey), - $useData = $data + $prop; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } '; - } - } - } - } - it.errorPath = $currentErrorPath; - } else if ($breakOnError) { - out += ' if (true) {'; - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/uniqueItems.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/uniqueItems.js deleted file mode 100644 index 0736a0e..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/uniqueItems.js +++ /dev/null @@ -1,86 +0,0 @@ -'use strict'; -module.exports = function generate_uniqueItems(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (($schema || $isData) && it.opts.uniqueItems !== false) { - if ($isData) { - out += ' var ' + ($valid) + '; if (' + ($schemaValue) + ' === false || ' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'boolean\') ' + ($valid) + ' = false; else { '; - } - out += ' var i = ' + ($data) + '.length , ' + ($valid) + ' = true , j; if (i > 1) { '; - var $itemType = it.schema.items && it.schema.items.type, - $typeIsArray = Array.isArray($itemType); - if (!$itemType || $itemType == 'object' || $itemType == 'array' || ($typeIsArray && ($itemType.indexOf('object') >= 0 || $itemType.indexOf('array') >= 0))) { - out += ' outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } '; - } else { - out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; '; - var $method = 'checkDataType' + ($typeIsArray ? 's' : ''); - out += ' if (' + (it.util[$method]($itemType, 'item', it.opts.strictNumbers, true)) + ') continue; '; - if ($typeIsArray) { - out += ' if (typeof item == \'string\') item = \'"\' + item; '; - } - out += ' if (typeof itemIndices[item] == \'number\') { ' + ($valid) + ' = false; j = itemIndices[item]; break; } itemIndices[item] = i; } '; - } - out += ' } '; - if ($isData) { - out += ' } '; - } - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('uniqueItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { i: i, j: j } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have duplicate items (items ## \' + j + \' and \' + i + \' are identical)\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - } else { - if ($breakOnError) { - out += ' if (true) { '; - } - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/dotjs/validate.js b/node_modules/webpack/node_modules/ajv/lib/dotjs/validate.js deleted file mode 100644 index f295824..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/dotjs/validate.js +++ /dev/null @@ -1,482 +0,0 @@ -'use strict'; -module.exports = function generate_validate(it, $keyword, $ruleType) { - var out = ''; - var $async = it.schema.$async === true, - $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref'), - $id = it.self._getId(it.schema); - if (it.opts.strictKeywords) { - var $unknownKwd = it.util.schemaUnknownRules(it.schema, it.RULES.keywords); - if ($unknownKwd) { - var $keywordsMsg = 'unknown keyword: ' + $unknownKwd; - if (it.opts.strictKeywords === 'log') it.logger.warn($keywordsMsg); - else throw new Error($keywordsMsg); - } - } - if (it.isTop) { - out += ' var validate = '; - if ($async) { - it.async = true; - out += 'async '; - } - out += 'function(data, dataPath, parentData, parentDataProperty, rootData) { \'use strict\'; '; - if ($id && (it.opts.sourceCode || it.opts.processCode)) { - out += ' ' + ('/\*# sourceURL=' + $id + ' */') + ' '; - } - } - if (typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref)) { - var $keyword = 'false schema'; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - if (it.schema === false) { - if (it.isTop) { - $breakOnError = true; - } else { - out += ' var ' + ($valid) + ' = false; '; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'false schema') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'boolean schema is false\' '; - } - if (it.opts.verbose) { - out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - } else { - if (it.isTop) { - if ($async) { - out += ' return data; '; - } else { - out += ' validate.errors = null; return true; '; - } - } else { - out += ' var ' + ($valid) + ' = true; '; - } - } - if (it.isTop) { - out += ' }; return validate; '; - } - return out; - } - if (it.isTop) { - var $top = it.isTop, - $lvl = it.level = 0, - $dataLvl = it.dataLevel = 0, - $data = 'data'; - it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema)); - it.baseId = it.baseId || it.rootId; - delete it.isTop; - it.dataPathArr = [""]; - if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) { - var $defaultMsg = 'default is ignored in the schema root'; - if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); - else throw new Error($defaultMsg); - } - out += ' var vErrors = null; '; - out += ' var errors = 0; '; - out += ' if (rootData === undefined) rootData = data; '; - } else { - var $lvl = it.level, - $dataLvl = it.dataLevel, - $data = 'data' + ($dataLvl || ''); - if ($id) it.baseId = it.resolve.url(it.baseId, $id); - if ($async && !it.async) throw new Error('async schema in sync schema'); - out += ' var errs_' + ($lvl) + ' = errors;'; - } - var $valid = 'valid' + $lvl, - $breakOnError = !it.opts.allErrors, - $closingBraces1 = '', - $closingBraces2 = ''; - var $errorKeyword; - var $typeSchema = it.schema.type, - $typeIsArray = Array.isArray($typeSchema); - if ($typeSchema && it.opts.nullable && it.schema.nullable === true) { - if ($typeIsArray) { - if ($typeSchema.indexOf('null') == -1) $typeSchema = $typeSchema.concat('null'); - } else if ($typeSchema != 'null') { - $typeSchema = [$typeSchema, 'null']; - $typeIsArray = true; - } - } - if ($typeIsArray && $typeSchema.length == 1) { - $typeSchema = $typeSchema[0]; - $typeIsArray = false; - } - if (it.schema.$ref && $refKeywords) { - if (it.opts.extendRefs == 'fail') { - throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); - } else if (it.opts.extendRefs !== true) { - $refKeywords = false; - it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"'); - } - } - if (it.schema.$comment && it.opts.$comment) { - out += ' ' + (it.RULES.all.$comment.code(it, '$comment')); - } - if ($typeSchema) { - if (it.opts.coerceTypes) { - var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); - } - var $rulesGroup = it.RULES.types[$typeSchema]; - if ($coerceToTypes || $typeIsArray || $rulesGroup === true || ($rulesGroup && !$shouldUseGroup($rulesGroup))) { - var $schemaPath = it.schemaPath + '.type', - $errSchemaPath = it.errSchemaPath + '/type'; - var $schemaPath = it.schemaPath + '.type', - $errSchemaPath = it.errSchemaPath + '/type', - $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType'; - out += ' if (' + (it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true)) + ') { '; - if ($coerceToTypes) { - var $dataType = 'dataType' + $lvl, - $coerced = 'coerced' + $lvl; - out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; var ' + ($coerced) + ' = undefined; '; - if (it.opts.coerceTypes == 'array') { - out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ') && ' + ($data) + '.length == 1) { ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; if (' + (it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)) + ') ' + ($coerced) + ' = ' + ($data) + '; } '; - } - out += ' if (' + ($coerced) + ' !== undefined) ; '; - var arr1 = $coerceToTypes; - if (arr1) { - var $type, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $type = arr1[$i += 1]; - if ($type == 'string') { - out += ' else if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; '; - } else if ($type == 'number' || $type == 'integer') { - out += ' else if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' '; - if ($type == 'integer') { - out += ' && !(' + ($data) + ' % 1)'; - } - out += ')) ' + ($coerced) + ' = +' + ($data) + '; '; - } else if ($type == 'boolean') { - out += ' else if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; '; - } else if ($type == 'null') { - out += ' else if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; '; - } else if (it.opts.coerceTypes == 'array' && $type == 'array') { - out += ' else if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; '; - } - } - } - out += ' else { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be '; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } if (' + ($coerced) + ' !== undefined) { '; - var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', - $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; - out += ' ' + ($data) + ' = ' + ($coerced) + '; '; - if (!$dataLvl) { - out += 'if (' + ($parentData) + ' !== undefined)'; - } - out += ' ' + ($parentData) + '[' + ($parentDataProperty) + '] = ' + ($coerced) + '; } '; - } else { - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be '; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - } - out += ' } '; - } - } - if (it.schema.$ref && !$refKeywords) { - out += ' ' + (it.RULES.all.$ref.code(it, '$ref')) + ' '; - if ($breakOnError) { - out += ' } if (errors === '; - if ($top) { - out += '0'; - } else { - out += 'errs_' + ($lvl); - } - out += ') { '; - $closingBraces2 += '}'; - } - } else { - var arr2 = it.RULES; - if (arr2) { - var $rulesGroup, i2 = -1, - l2 = arr2.length - 1; - while (i2 < l2) { - $rulesGroup = arr2[i2 += 1]; - if ($shouldUseGroup($rulesGroup)) { - if ($rulesGroup.type) { - out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers)) + ') { '; - } - if (it.opts.useDefaults) { - if ($rulesGroup.type == 'object' && it.schema.properties) { - var $schema = it.schema.properties, - $schemaKeys = Object.keys($schema); - var arr3 = $schemaKeys; - if (arr3) { - var $propertyKey, i3 = -1, - l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $sch = $schema[$propertyKey]; - if ($sch.default !== undefined) { - var $passData = $data + it.util.getProperty($propertyKey); - if (it.compositeRule) { - if (it.opts.strictDefaults) { - var $defaultMsg = 'default is ignored for: ' + $passData; - if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); - else throw new Error($defaultMsg); - } - } else { - out += ' if (' + ($passData) + ' === undefined '; - if (it.opts.useDefaults == 'empty') { - out += ' || ' + ($passData) + ' === null || ' + ($passData) + ' === \'\' '; - } - out += ' ) ' + ($passData) + ' = '; - if (it.opts.useDefaults == 'shared') { - out += ' ' + (it.useDefault($sch.default)) + ' '; - } else { - out += ' ' + (JSON.stringify($sch.default)) + ' '; - } - out += '; '; - } - } - } - } - } else if ($rulesGroup.type == 'array' && Array.isArray(it.schema.items)) { - var arr4 = it.schema.items; - if (arr4) { - var $sch, $i = -1, - l4 = arr4.length - 1; - while ($i < l4) { - $sch = arr4[$i += 1]; - if ($sch.default !== undefined) { - var $passData = $data + '[' + $i + ']'; - if (it.compositeRule) { - if (it.opts.strictDefaults) { - var $defaultMsg = 'default is ignored for: ' + $passData; - if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); - else throw new Error($defaultMsg); - } - } else { - out += ' if (' + ($passData) + ' === undefined '; - if (it.opts.useDefaults == 'empty') { - out += ' || ' + ($passData) + ' === null || ' + ($passData) + ' === \'\' '; - } - out += ' ) ' + ($passData) + ' = '; - if (it.opts.useDefaults == 'shared') { - out += ' ' + (it.useDefault($sch.default)) + ' '; - } else { - out += ' ' + (JSON.stringify($sch.default)) + ' '; - } - out += '; '; - } - } - } - } - } - } - var arr5 = $rulesGroup.rules; - if (arr5) { - var $rule, i5 = -1, - l5 = arr5.length - 1; - while (i5 < l5) { - $rule = arr5[i5 += 1]; - if ($shouldUseRule($rule)) { - var $code = $rule.code(it, $rule.keyword, $rulesGroup.type); - if ($code) { - out += ' ' + ($code) + ' '; - if ($breakOnError) { - $closingBraces1 += '}'; - } - } - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces1) + ' '; - $closingBraces1 = ''; - } - if ($rulesGroup.type) { - out += ' } '; - if ($typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes) { - out += ' else { '; - var $schemaPath = it.schemaPath + '.type', - $errSchemaPath = it.errSchemaPath + '/type'; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be '; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - } - } - if ($breakOnError) { - out += ' if (errors === '; - if ($top) { - out += '0'; - } else { - out += 'errs_' + ($lvl); - } - out += ') { '; - $closingBraces2 += '}'; - } - } - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces2) + ' '; - } - if ($top) { - if ($async) { - out += ' if (errors === 0) return data; '; - out += ' else throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; '; - out += ' return errors === 0; '; - } - out += ' }; return validate;'; - } else { - out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';'; - } - - function $shouldUseGroup($rulesGroup) { - var rules = $rulesGroup.rules; - for (var i = 0; i < rules.length; i++) - if ($shouldUseRule(rules[i])) return true; - } - - function $shouldUseRule($rule) { - return it.schema[$rule.keyword] !== undefined || ($rule.implements && $ruleImplementsSomeKeyword($rule)); - } - - function $ruleImplementsSomeKeyword($rule) { - var impl = $rule.implements; - for (var i = 0; i < impl.length; i++) - if (it.schema[impl[i]] !== undefined) return true; - } - return out; -} diff --git a/node_modules/webpack/node_modules/ajv/lib/keyword.js b/node_modules/webpack/node_modules/ajv/lib/keyword.js deleted file mode 100644 index 06da9a2..0000000 --- a/node_modules/webpack/node_modules/ajv/lib/keyword.js +++ /dev/null @@ -1,146 +0,0 @@ -'use strict'; - -var IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i; -var customRuleCode = require('./dotjs/custom'); -var definitionSchema = require('./definition_schema'); - -module.exports = { - add: addKeyword, - get: getKeyword, - remove: removeKeyword, - validate: validateKeyword -}; - - -/** - * Define custom keyword - * @this Ajv - * @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords). - * @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`. - * @return {Ajv} this for method chaining - */ -function addKeyword(keyword, definition) { - /* jshint validthis: true */ - /* eslint no-shadow: 0 */ - var RULES = this.RULES; - if (RULES.keywords[keyword]) - throw new Error('Keyword ' + keyword + ' is already defined'); - - if (!IDENTIFIER.test(keyword)) - throw new Error('Keyword ' + keyword + ' is not a valid identifier'); - - if (definition) { - this.validateKeyword(definition, true); - - var dataType = definition.type; - if (Array.isArray(dataType)) { - for (var i=0; i ../ajv-dist/bower.json - cd ../ajv-dist - - if [[ `git status --porcelain` ]]; then - echo "Changes detected. Updating master branch..." - git add -A - git commit -m "updated by travis build #$TRAVIS_BUILD_NUMBER" - git push --quiet origin master > /dev/null 2>&1 - fi - - echo "Publishing tag..." - - git tag $TRAVIS_TAG - git push --tags > /dev/null 2>&1 - - echo "Done" -fi diff --git a/node_modules/webpack/node_modules/ajv/scripts/travis-gh-pages b/node_modules/webpack/node_modules/ajv/scripts/travis-gh-pages deleted file mode 100644 index b3d4f3d..0000000 --- a/node_modules/webpack/node_modules/ajv/scripts/travis-gh-pages +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -set -e - -if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" && $TRAVIS_JOB_NUMBER =~ ".3" ]]; then - git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qE '\.md$|^LICENSE$|travis-gh-pages$' && { - rm -rf ../gh-pages - git clone -b gh-pages --single-branch https://${GITHUB_TOKEN}@github.com/ajv-validator/ajv.git ../gh-pages - mkdir -p ../gh-pages/_source - cp *.md ../gh-pages/_source - cp LICENSE ../gh-pages/_source - currentDir=$(pwd) - cd ../gh-pages - $currentDir/node_modules/.bin/gh-pages-generator - # remove logo from README - sed -i -E "s/]+ajv_logo[^>]+>//" index.md - git config user.email "$GIT_USER_EMAIL" - git config user.name "$GIT_USER_NAME" - git add . - git commit -am "updated by travis build #$TRAVIS_BUILD_NUMBER" - git push --quiet origin gh-pages > /dev/null 2>&1 - } -fi diff --git a/node_modules/webpack/node_modules/json-schema-traverse/.eslintrc.yml b/node_modules/webpack/node_modules/json-schema-traverse/.eslintrc.yml deleted file mode 100644 index ab1762d..0000000 --- a/node_modules/webpack/node_modules/json-schema-traverse/.eslintrc.yml +++ /dev/null @@ -1,27 +0,0 @@ -extends: eslint:recommended -env: - node: true - browser: true -rules: - block-scoped-var: 2 - complexity: [2, 13] - curly: [2, multi-or-nest, consistent] - dot-location: [2, property] - dot-notation: 2 - indent: [2, 2, SwitchCase: 1] - linebreak-style: [2, unix] - new-cap: 2 - no-console: [2, allow: [warn, error]] - no-else-return: 2 - no-eq-null: 2 - no-fallthrough: 2 - no-invalid-this: 2 - no-return-assign: 2 - no-shadow: 1 - no-trailing-spaces: 2 - no-use-before-define: [2, nofunc] - quotes: [2, single, avoid-escape] - semi: [2, always] - strict: [2, global] - valid-jsdoc: [2, requireReturn: false] - no-control-regex: 0 diff --git a/node_modules/webpack/node_modules/json-schema-traverse/.travis.yml b/node_modules/webpack/node_modules/json-schema-traverse/.travis.yml deleted file mode 100644 index 7ddce74..0000000 --- a/node_modules/webpack/node_modules/json-schema-traverse/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -node_js: - - "4" - - "6" - - "7" - - "8" -after_script: - - coveralls < coverage/lcov.info diff --git a/node_modules/webpack/node_modules/json-schema-traverse/LICENSE b/node_modules/webpack/node_modules/json-schema-traverse/LICENSE deleted file mode 100644 index 7f15435..0000000 --- a/node_modules/webpack/node_modules/json-schema-traverse/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Evgeny Poberezkin - -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/node_modules/webpack/node_modules/json-schema-traverse/README.md b/node_modules/webpack/node_modules/json-schema-traverse/README.md deleted file mode 100644 index d5ccaf4..0000000 --- a/node_modules/webpack/node_modules/json-schema-traverse/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# json-schema-traverse -Traverse JSON Schema passing each schema object to callback - -[![Build Status](https://travis-ci.org/epoberezkin/json-schema-traverse.svg?branch=master)](https://travis-ci.org/epoberezkin/json-schema-traverse) -[![npm version](https://badge.fury.io/js/json-schema-traverse.svg)](https://www.npmjs.com/package/json-schema-traverse) -[![Coverage Status](https://coveralls.io/repos/github/epoberezkin/json-schema-traverse/badge.svg?branch=master)](https://coveralls.io/github/epoberezkin/json-schema-traverse?branch=master) - - -## Install - -``` -npm install json-schema-traverse -``` - - -## Usage - -```javascript -const traverse = require('json-schema-traverse'); -const schema = { - properties: { - foo: {type: 'string'}, - bar: {type: 'integer'} - } -}; - -traverse(schema, {cb}); -// cb is called 3 times with: -// 1. root schema -// 2. {type: 'string'} -// 3. {type: 'integer'} - -// Or: - -traverse(schema, {cb: {pre, post}}); -// pre is called 3 times with: -// 1. root schema -// 2. {type: 'string'} -// 3. {type: 'integer'} -// -// post is called 3 times with: -// 1. {type: 'string'} -// 2. {type: 'integer'} -// 3. root schema - -``` - -Callback function `cb` is called for each schema object (not including draft-06 boolean schemas), including the root schema, in pre-order traversal. Schema references ($ref) are not resolved, they are passed as is. Alternatively, you can pass a `{pre, post}` object as `cb`, and then `pre` will be called before traversing child elements, and `post` will be called after all child elements have been traversed. - -Callback is passed these parameters: - -- _schema_: the current schema object -- _JSON pointer_: from the root schema to the current schema object -- _root schema_: the schema passed to `traverse` object -- _parent JSON pointer_: from the root schema to the parent schema object (see below) -- _parent keyword_: the keyword inside which this schema appears (e.g. `properties`, `anyOf`, etc.) -- _parent schema_: not necessarily parent object/array; in the example above the parent schema for `{type: 'string'}` is the root schema -- _index/property_: index or property name in the array/object containing multiple schemas; in the example above for `{type: 'string'}` the property name is `'foo'` - - -## Traverse objects in all unknown keywords - -```javascript -const traverse = require('json-schema-traverse'); -const schema = { - mySchema: { - minimum: 1, - maximum: 2 - } -}; - -traverse(schema, {allKeys: true, cb}); -// cb is called 2 times with: -// 1. root schema -// 2. mySchema -``` - -Without option `allKeys: true` callback will be called only with root schema. - - -## License - -[MIT](https://github.com/epoberezkin/json-schema-traverse/blob/master/LICENSE) diff --git a/node_modules/webpack/node_modules/json-schema-traverse/index.js b/node_modules/webpack/node_modules/json-schema-traverse/index.js deleted file mode 100644 index d4a18df..0000000 --- a/node_modules/webpack/node_modules/json-schema-traverse/index.js +++ /dev/null @@ -1,89 +0,0 @@ -'use strict'; - -var traverse = module.exports = function (schema, opts, cb) { - // Legacy support for v0.3.1 and earlier. - if (typeof opts == 'function') { - cb = opts; - opts = {}; - } - - cb = opts.cb || cb; - var pre = (typeof cb == 'function') ? cb : cb.pre || function() {}; - var post = cb.post || function() {}; - - _traverse(opts, pre, post, schema, '', schema); -}; - - -traverse.keywords = { - additionalItems: true, - items: true, - contains: true, - additionalProperties: true, - propertyNames: true, - not: true -}; - -traverse.arrayKeywords = { - items: true, - allOf: true, - anyOf: true, - oneOf: true -}; - -traverse.propsKeywords = { - definitions: true, - properties: true, - patternProperties: true, - dependencies: true -}; - -traverse.skipKeywords = { - default: true, - enum: true, - const: true, - required: true, - maximum: true, - minimum: true, - exclusiveMaximum: true, - exclusiveMinimum: true, - multipleOf: true, - maxLength: true, - minLength: true, - pattern: true, - format: true, - maxItems: true, - minItems: true, - uniqueItems: true, - maxProperties: true, - minProperties: true -}; - - -function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { - if (schema && typeof schema == 'object' && !Array.isArray(schema)) { - pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex); - for (var key in schema) { - var sch = schema[key]; - if (Array.isArray(sch)) { - if (key in traverse.arrayKeywords) { - for (var i=0; i -# [1.0.0](https://github.com/webpack-contrib/schema-utils/compare/v0.4.7...v1.0.0) (2018-08-07) - - -### Features - -* **src:** add support for custom error messages ([#33](https://github.com/webpack-contrib/schema-utils/issues/33)) ([1cbe4ef](https://github.com/webpack-contrib/schema-utils/commit/1cbe4ef)) - - - - -## [0.4.7](https://github.com/webpack-contrib/schema-utils/compare/v0.4.6...v0.4.7) (2018-08-07) - - -### Bug Fixes - -* **src:** `node >= v4.0.0` support ([#32](https://github.com/webpack-contrib/schema-utils/issues/32)) ([cb13dd4](https://github.com/webpack-contrib/schema-utils/commit/cb13dd4)) - - - - -## [0.4.6](https://github.com/webpack-contrib/schema-utils/compare/v0.4.5...v0.4.6) (2018-08-06) - - -### Bug Fixes - -* **package:** remove lockfile ([#28](https://github.com/webpack-contrib/schema-utils/issues/28)) ([69f1a81](https://github.com/webpack-contrib/schema-utils/commit/69f1a81)) -* **package:** remove unnecessary `webpack` dependency ([#26](https://github.com/webpack-contrib/schema-utils/issues/26)) ([532eaa5](https://github.com/webpack-contrib/schema-utils/commit/532eaa5)) - - - - -## [0.4.5](https://github.com/webpack-contrib/schema-utils/compare/v0.4.4...v0.4.5) (2018-02-13) - - -### Bug Fixes - -* **CHANGELOG:** update broken links ([4483b9f](https://github.com/webpack-contrib/schema-utils/commit/4483b9f)) -* **package:** update broken links ([f2494ba](https://github.com/webpack-contrib/schema-utils/commit/f2494ba)) - - - - -## [0.4.4](https://github.com/webpack-contrib/schema-utils/compare/v0.4.3...v0.4.4) (2018-02-13) - - -### Bug Fixes - -* **package:** update `dependencies` ([#22](https://github.com/webpack-contrib/schema-utils/issues/22)) ([3aecac6](https://github.com/webpack-contrib/schema-utils/commit/3aecac6)) - - - - -## [0.4.3](https://github.com/webpack-contrib/schema-utils/compare/v0.4.2...v0.4.3) (2017-12-14) - - -### Bug Fixes - -* **validateOptions:** throw `err` instead of `process.exit(1)` ([#17](https://github.com/webpack-contrib/schema-utils/issues/17)) ([c595eda](https://github.com/webpack-contrib/schema-utils/commit/c595eda)) -* **ValidationError:** never return `this` in the ctor ([#16](https://github.com/webpack-contrib/schema-utils/issues/16)) ([c723791](https://github.com/webpack-contrib/schema-utils/commit/c723791)) - - - - -## [0.4.2](https://github.com/webpack-contrib/schema-utils/compare/v0.4.1...v0.4.2) (2017-11-09) - - -### Bug Fixes - -* **validateOptions:** catch `ValidationError` and handle it internally ([#15](https://github.com/webpack-contrib/schema-utils/issues/15)) ([9c5ef5e](https://github.com/webpack-contrib/schema-utils/commit/9c5ef5e)) - - - - -## [0.4.1](https://github.com/webpack-contrib/schema-utils/compare/v0.4.0...v0.4.1) (2017-11-03) - - -### Bug Fixes - -* **ValidationError:** use `Error.captureStackTrace` for `err.stack` handling ([#14](https://github.com/webpack-contrib/schema-utils/issues/14)) ([a6fb974](https://github.com/webpack-contrib/schema-utils/commit/a6fb974)) - - - - -# [0.4.0](https://github.com/webpack-contrib/schema-utils/compare/v0.3.0...v0.4.0) (2017-10-28) - - -### Features - -* add support for `typeof`, `instanceof` (`{Function\|RegExp}`) ([#10](https://github.com/webpack-contrib/schema-utils/issues/10)) ([9f01816](https://github.com/webpack-contrib/schema-utils/commit/9f01816)) - - - - -# [0.3.0](https://github.com/webpack-contrib/schema-utils/compare/v0.2.1...v0.3.0) (2017-04-29) - - -### Features - -* add ValidationError ([#8](https://github.com/webpack-contrib/schema-utils/issues/8)) ([d48f0fb](https://github.com/webpack-contrib/schema-utils/commit/d48f0fb)) - - - - -## [0.2.1](https://github.com/webpack-contrib/schema-utils/compare/v0.2.0...v0.2.1) (2017-03-13) - - -### Bug Fixes - -* Include .babelrc to `files` ([28f0363](https://github.com/webpack-contrib/schema-utils/commit/28f0363)) -* Include source to `files` ([43b0f2f](https://github.com/webpack-contrib/schema-utils/commit/43b0f2f)) - - - - -# [0.2.0](https://github.com/webpack-contrib/schema-utils/compare/v0.1.0...v0.2.0) (2017-03-12) - - -# 0.1.0 (2017-03-07) - - -### Features - -* **validations:** add validateOptions module ([ae9b47b](https://github.com/webpack-contrib/schema-utils/commit/ae9b47b)) - - - -# Change Log - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. diff --git a/node_modules/webpack/node_modules/schema-utils/LICENSE b/node_modules/webpack/node_modules/schema-utils/LICENSE deleted file mode 100644 index 8c11fc7..0000000 --- a/node_modules/webpack/node_modules/schema-utils/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright JS Foundation and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/webpack/node_modules/schema-utils/README.md b/node_modules/webpack/node_modules/schema-utils/README.md deleted file mode 100644 index b56ab02..0000000 --- a/node_modules/webpack/node_modules/schema-utils/README.md +++ /dev/null @@ -1,290 +0,0 @@ - - -[![npm][npm]][npm-url] -[![node][node]][node-url] -[![deps][deps]][deps-url] -[![tests][tests]][tests-url] -[![coverage][cover]][cover-url] -[![chat][chat]][chat-url] -[![size][size]][size-url] - -# schema-utils - -Package for validate options in loaders and plugins. - -## Getting Started - -To begin, you'll need to install `schema-utils`: - -```console -npm install schema-utils -``` - -## API - -**schema.json** - -```json -{ - "type": "object", - "properties": { - "option": { - "type": "boolean" - } - }, - "additionalProperties": false -} -``` - -```js -import schema from "./path/to/schema.json"; -import { validate } from "schema-utils"; - -const options = { option: true }; -const configuration = { name: "Loader Name/Plugin Name/Name" }; - -validate(schema, options, configuration); -``` - -### `schema` - -Type: `String` - -JSON schema. - -Simple example of schema: - -```json -{ - "type": "object", - "properties": { - "name": { - "description": "This is description of option.", - "type": "string" - } - }, - "additionalProperties": false -} -``` - -### `options` - -Type: `Object` - -Object with options. - -```js -import schema from "./path/to/schema.json"; -import { validate } from "schema-utils"; - -const options = { foo: "bar" }; - -validate(schema, { name: 123 }, { name: "MyPlugin" }); -``` - -### `configuration` - -Allow to configure validator. - -There is an alternative method to configure the `name` and`baseDataPath` options via the `title` property in the schema. -For example: - -```json -{ - "title": "My Loader options", - "type": "object", - "properties": { - "name": { - "description": "This is description of option.", - "type": "string" - } - }, - "additionalProperties": false -} -``` - -The last word used for the `baseDataPath` option, other words used for the `name` option. -Based on the example above the `name` option equals `My Loader`, the `baseDataPath` option equals `options`. - -#### `name` - -Type: `Object` -Default: `"Object"` - -Allow to setup name in validation errors. - -```js -import schema from "./path/to/schema.json"; -import { validate } from "schema-utils"; - -const options = { foo: "bar" }; - -validate(schema, options, { name: "MyPlugin" }); -``` - -```shell -Invalid configuration object. MyPlugin has been initialised using a configuration object that does not match the API schema. - - configuration.optionName should be a integer. -``` - -#### `baseDataPath` - -Type: `String` -Default: `"configuration"` - -Allow to setup base data path in validation errors. - -```js -import schema from "./path/to/schema.json"; -import { validate } from "schema-utils"; - -const options = { foo: "bar" }; - -validate(schema, options, { name: "MyPlugin", baseDataPath: "options" }); -``` - -```shell -Invalid options object. MyPlugin has been initialised using an options object that does not match the API schema. - - options.optionName should be a integer. -``` - -#### `postFormatter` - -Type: `Function` -Default: `undefined` - -Allow to reformat errors. - -```js -import schema from "./path/to/schema.json"; -import { validate } from "schema-utils"; - -const options = { foo: "bar" }; - -validate(schema, options, { - name: "MyPlugin", - postFormatter: (formattedError, error) => { - if (error.keyword === "type") { - return `${formattedError}\nAdditional Information.`; - } - - return formattedError; - }, -}); -``` - -```shell -Invalid options object. MyPlugin has been initialized using an options object that does not match the API schema. - - options.optionName should be a integer. - Additional Information. -``` - -## Examples - -**schema.json** - -```json -{ - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "test": { - "anyOf": [ - { "type": "array" }, - { "type": "string" }, - { "instanceof": "RegExp" } - ] - }, - "transform": { - "instanceof": "Function" - }, - "sourceMap": { - "type": "boolean" - } - }, - "additionalProperties": false -} -``` - -### `Loader` - -```js -import { getOptions } from "loader-utils"; -import { validate } from "schema-utils"; - -import schema from "path/to/schema.json"; - -function loader(src, map) { - const options = getOptions(this); - - validate(schema, options, { - name: "Loader Name", - baseDataPath: "options", - }); - - // Code... -} - -export default loader; -``` - -### `Plugin` - -```js -import { validate } from "schema-utils"; - -import schema from "path/to/schema.json"; - -class Plugin { - constructor(options) { - validate(schema, options, { - name: "Plugin Name", - baseDataPath: "options", - }); - - this.options = options; - } - - apply(compiler) { - // Code... - } -} - -export default Plugin; -``` - -## Contributing - -Please take a moment to read our contributing guidelines if you haven't yet done so. - -[CONTRIBUTING](./.github/CONTRIBUTING.md) - -## License - -[MIT](./LICENSE) - -[npm]: https://img.shields.io/npm/v/schema-utils.svg -[npm-url]: https://npmjs.com/package/schema-utils -[node]: https://img.shields.io/node/v/schema-utils.svg -[node-url]: https://nodejs.org -[deps]: https://david-dm.org/webpack/schema-utils.svg -[deps-url]: https://david-dm.org/webpack/schema-utils -[tests]: https://github.com/webpack/schema-utils/workflows/schema-utils/badge.svg -[tests-url]: https://github.com/webpack/schema-utils/actions -[cover]: https://codecov.io/gh/webpack/schema-utils/branch/master/graph/badge.svg -[cover-url]: https://codecov.io/gh/webpack/schema-utils -[chat]: https://badges.gitter.im/webpack/webpack.svg -[chat-url]: https://gitter.im/webpack/webpack -[size]: https://packagephobia.com/badge?p=schema-utils -[size-url]: https://packagephobia.com/result?p=schema-utils diff --git a/node_modules/webpack/node_modules/schema-utils/declarations/ValidationError.d.ts b/node_modules/webpack/node_modules/schema-utils/declarations/ValidationError.d.ts deleted file mode 100644 index 55a8a9a..0000000 --- a/node_modules/webpack/node_modules/schema-utils/declarations/ValidationError.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -export default ValidationError; -export type JSONSchema6 = import("json-schema").JSONSchema6; -export type JSONSchema7 = import("json-schema").JSONSchema7; -export type Schema = import("./validate").Schema; -export type ValidationErrorConfiguration = - import("./validate").ValidationErrorConfiguration; -export type PostFormatter = import("./validate").PostFormatter; -export type SchemaUtilErrorObject = import("./validate").SchemaUtilErrorObject; -declare class ValidationError extends Error { - /** - * @param {Array} errors - * @param {Schema} schema - * @param {ValidationErrorConfiguration} configuration - */ - constructor( - errors: Array, - schema: Schema, - configuration?: ValidationErrorConfiguration - ); - /** @type {Array} */ - errors: Array; - /** @type {Schema} */ - schema: Schema; - /** @type {string} */ - headerName: string; - /** @type {string} */ - baseDataPath: string; - /** @type {PostFormatter | null} */ - postFormatter: PostFormatter | null; - /** - * @param {string} path - * @returns {Schema} - */ - getSchemaPart(path: string): Schema; - /** - * @param {Schema} schema - * @param {boolean} logic - * @param {Array} prevSchemas - * @returns {string} - */ - formatSchema( - schema: Schema, - logic?: boolean, - prevSchemas?: Array - ): string; - /** - * @param {Schema=} schemaPart - * @param {(boolean | Array)=} additionalPath - * @param {boolean=} needDot - * @param {boolean=} logic - * @returns {string} - */ - getSchemaPartText( - schemaPart?: Schema | undefined, - additionalPath?: (boolean | Array) | undefined, - needDot?: boolean | undefined, - logic?: boolean | undefined - ): string; - /** - * @param {Schema=} schemaPart - * @returns {string} - */ - getSchemaPartDescription(schemaPart?: Schema | undefined): string; - /** - * @param {SchemaUtilErrorObject} error - * @returns {string} - */ - formatValidationError(error: SchemaUtilErrorObject): string; - /** - * @param {Array} errors - * @returns {string} - */ - formatValidationErrors(errors: Array): string; -} diff --git a/node_modules/webpack/node_modules/schema-utils/declarations/index.d.ts b/node_modules/webpack/node_modules/schema-utils/declarations/index.d.ts deleted file mode 100644 index def01ba..0000000 --- a/node_modules/webpack/node_modules/schema-utils/declarations/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { validate } from "./validate"; -import { ValidationError } from "./validate"; -import { enableValidation } from "./validate"; -import { disableValidation } from "./validate"; -import { needValidate } from "./validate"; -export { - validate, - ValidationError, - enableValidation, - disableValidation, - needValidate, -}; diff --git a/node_modules/webpack/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts b/node_modules/webpack/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts deleted file mode 100644 index 0d16689..0000000 --- a/node_modules/webpack/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export default addAbsolutePathKeyword; -export type Ajv = import("ajv").Ajv; -export type ValidateFunction = import("ajv").ValidateFunction; -export type SchemaUtilErrorObject = import("../validate").SchemaUtilErrorObject; -/** - * - * @param {Ajv} ajv - * @returns {Ajv} - */ -declare function addAbsolutePathKeyword(ajv: Ajv): Ajv; diff --git a/node_modules/webpack/node_modules/schema-utils/declarations/keywords/undefinedAsNull.d.ts b/node_modules/webpack/node_modules/schema-utils/declarations/keywords/undefinedAsNull.d.ts deleted file mode 100644 index 3509652..0000000 --- a/node_modules/webpack/node_modules/schema-utils/declarations/keywords/undefinedAsNull.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export default addUndefinedAsNullKeyword; -export type Ajv = import("ajv").Ajv; -/** - * - * @param {Ajv} ajv - * @returns {Ajv} - */ -declare function addUndefinedAsNullKeyword(ajv: Ajv): Ajv; diff --git a/node_modules/webpack/node_modules/schema-utils/declarations/util/Range.d.ts b/node_modules/webpack/node_modules/schema-utils/declarations/util/Range.d.ts deleted file mode 100644 index 2ba97fc..0000000 --- a/node_modules/webpack/node_modules/schema-utils/declarations/util/Range.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -export = Range; -/** - * @typedef {[number, boolean]} RangeValue - */ -/** - * @callback RangeValueCallback - * @param {RangeValue} rangeValue - * @returns {boolean} - */ -declare class Range { - /** - * @param {"left" | "right"} side - * @param {boolean} exclusive - * @returns {">" | ">=" | "<" | "<="} - */ - static getOperator( - side: "left" | "right", - exclusive: boolean - ): ">" | ">=" | "<" | "<="; - /** - * @param {number} value - * @param {boolean} logic is not logic applied - * @param {boolean} exclusive is range exclusive - * @returns {string} - */ - static formatRight(value: number, logic: boolean, exclusive: boolean): string; - /** - * @param {number} value - * @param {boolean} logic is not logic applied - * @param {boolean} exclusive is range exclusive - * @returns {string} - */ - static formatLeft(value: number, logic: boolean, exclusive: boolean): string; - /** - * @param {number} start left side value - * @param {number} end right side value - * @param {boolean} startExclusive is range exclusive from left side - * @param {boolean} endExclusive is range exclusive from right side - * @param {boolean} logic is not logic applied - * @returns {string} - */ - static formatRange( - start: number, - end: number, - startExclusive: boolean, - endExclusive: boolean, - logic: boolean - ): string; - /** - * @param {Array} values - * @param {boolean} logic is not logic applied - * @return {RangeValue} computed value and it's exclusive flag - */ - static getRangeValue(values: Array, logic: boolean): RangeValue; - /** @type {Array} */ - _left: Array; - /** @type {Array} */ - _right: Array; - /** - * @param {number} value - * @param {boolean=} exclusive - */ - left(value: number, exclusive?: boolean | undefined): void; - /** - * @param {number} value - * @param {boolean=} exclusive - */ - right(value: number, exclusive?: boolean | undefined): void; - /** - * @param {boolean} logic is not logic applied - * @return {string} "smart" range string representation - */ - format(logic?: boolean): string; -} -declare namespace Range { - export { RangeValue, RangeValueCallback }; -} -type RangeValue = [number, boolean]; -type RangeValueCallback = (rangeValue: RangeValue) => boolean; diff --git a/node_modules/webpack/node_modules/schema-utils/declarations/util/hints.d.ts b/node_modules/webpack/node_modules/schema-utils/declarations/util/hints.d.ts deleted file mode 100644 index e43e32a..0000000 --- a/node_modules/webpack/node_modules/schema-utils/declarations/util/hints.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function stringHints(schema: Schema, logic: boolean): string[]; -export function numberHints(schema: Schema, logic: boolean): string[]; -export type Schema = import("../validate").Schema; diff --git a/node_modules/webpack/node_modules/schema-utils/declarations/validate.d.ts b/node_modules/webpack/node_modules/schema-utils/declarations/validate.d.ts deleted file mode 100644 index 7f1c87f..0000000 --- a/node_modules/webpack/node_modules/schema-utils/declarations/validate.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -export type JSONSchema4 = import("json-schema").JSONSchema4; -export type JSONSchema6 = import("json-schema").JSONSchema6; -export type JSONSchema7 = import("json-schema").JSONSchema7; -export type ErrorObject = import("ajv").ErrorObject; -export type ValidateFunction = import("ajv").ValidateFunction; -export type Extend = { - formatMinimum?: number | undefined; - formatMaximum?: number | undefined; - formatExclusiveMinimum?: boolean | undefined; - formatExclusiveMaximum?: boolean | undefined; - link?: string | undefined; - undefinedAsNull?: boolean | undefined; -}; -export type Schema = (JSONSchema4 | JSONSchema6 | JSONSchema7) & Extend; -export type SchemaUtilErrorObject = ErrorObject & { - children?: Array; -}; -export type PostFormatter = ( - formattedError: string, - error: SchemaUtilErrorObject -) => string; -export type ValidationErrorConfiguration = { - name?: string | undefined; - baseDataPath?: string | undefined; - postFormatter?: PostFormatter | undefined; -}; -/** - * @param {Schema} schema - * @param {Array | object} options - * @param {ValidationErrorConfiguration=} configuration - * @returns {void} - */ -export function validate( - schema: Schema, - options: Array | object, - configuration?: ValidationErrorConfiguration | undefined -): void; -export function enableValidation(): void; -export function disableValidation(): void; -export function needValidate(): boolean; -import ValidationError from "./ValidationError"; -export { ValidationError }; diff --git a/node_modules/webpack/node_modules/schema-utils/dist/ValidationError.js b/node_modules/webpack/node_modules/schema-utils/dist/ValidationError.js deleted file mode 100644 index bd4086f..0000000 --- a/node_modules/webpack/node_modules/schema-utils/dist/ValidationError.js +++ /dev/null @@ -1,1277 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -const { - stringHints, - numberHints -} = require("./util/hints"); -/** @typedef {import("json-schema").JSONSchema6} JSONSchema6 */ - -/** @typedef {import("json-schema").JSONSchema7} JSONSchema7 */ - -/** @typedef {import("./validate").Schema} Schema */ - -/** @typedef {import("./validate").ValidationErrorConfiguration} ValidationErrorConfiguration */ - -/** @typedef {import("./validate").PostFormatter} PostFormatter */ - -/** @typedef {import("./validate").SchemaUtilErrorObject} SchemaUtilErrorObject */ - -/** @enum {number} */ - - -const SPECIFICITY = { - type: 1, - not: 1, - oneOf: 1, - anyOf: 1, - if: 1, - enum: 1, - const: 1, - instanceof: 1, - required: 2, - pattern: 2, - patternRequired: 2, - format: 2, - formatMinimum: 2, - formatMaximum: 2, - minimum: 2, - exclusiveMinimum: 2, - maximum: 2, - exclusiveMaximum: 2, - multipleOf: 2, - uniqueItems: 2, - contains: 2, - minLength: 2, - maxLength: 2, - minItems: 2, - maxItems: 2, - minProperties: 2, - maxProperties: 2, - dependencies: 2, - propertyNames: 2, - additionalItems: 2, - additionalProperties: 2, - absolutePath: 2 -}; -/** - * - * @param {Array} array - * @param {(item: SchemaUtilErrorObject) => number} fn - * @returns {Array} - */ - -function filterMax(array, fn) { - const evaluatedMax = array.reduce((max, item) => Math.max(max, fn(item)), 0); - return array.filter(item => fn(item) === evaluatedMax); -} -/** - * - * @param {Array} children - * @returns {Array} - */ - - -function filterChildren(children) { - let newChildren = children; - newChildren = filterMax(newChildren, - /** - * - * @param {SchemaUtilErrorObject} error - * @returns {number} - */ - error => error.dataPath ? error.dataPath.length : 0); - newChildren = filterMax(newChildren, - /** - * @param {SchemaUtilErrorObject} error - * @returns {number} - */ - error => SPECIFICITY[ - /** @type {keyof typeof SPECIFICITY} */ - error.keyword] || 2); - return newChildren; -} -/** - * Find all children errors - * @param {Array} children - * @param {Array} schemaPaths - * @return {number} returns index of first child - */ - - -function findAllChildren(children, schemaPaths) { - let i = children.length - 1; - - const predicate = - /** - * @param {string} schemaPath - * @returns {boolean} - */ - schemaPath => children[i].schemaPath.indexOf(schemaPath) !== 0; - - while (i > -1 && !schemaPaths.every(predicate)) { - if (children[i].keyword === "anyOf" || children[i].keyword === "oneOf") { - const refs = extractRefs(children[i]); - const childrenStart = findAllChildren(children.slice(0, i), refs.concat(children[i].schemaPath)); - i = childrenStart - 1; - } else { - i -= 1; - } - } - - return i + 1; -} -/** - * Extracts all refs from schema - * @param {SchemaUtilErrorObject} error - * @return {Array} - */ - - -function extractRefs(error) { - const { - schema - } = error; - - if (!Array.isArray(schema)) { - return []; - } - - return schema.map(({ - $ref - }) => $ref).filter(s => s); -} -/** - * Groups children by their first level parent (assuming that error is root) - * @param {Array} children - * @return {Array} - */ - - -function groupChildrenByFirstChild(children) { - const result = []; - let i = children.length - 1; - - while (i > 0) { - const child = children[i]; - - if (child.keyword === "anyOf" || child.keyword === "oneOf") { - const refs = extractRefs(child); - const childrenStart = findAllChildren(children.slice(0, i), refs.concat(child.schemaPath)); - - if (childrenStart !== i) { - result.push(Object.assign({}, child, { - children: children.slice(childrenStart, i) - })); - i = childrenStart; - } else { - result.push(child); - } - } else { - result.push(child); - } - - i -= 1; - } - - if (i === 0) { - result.push(children[i]); - } - - return result.reverse(); -} -/** - * @param {string} str - * @param {string} prefix - * @returns {string} - */ - - -function indent(str, prefix) { - return str.replace(/\n(?!$)/g, `\n${prefix}`); -} -/** - * @param {Schema} schema - * @returns {schema is (Schema & {not: Schema})} - */ - - -function hasNotInSchema(schema) { - return !!schema.not; -} -/** - * @param {Schema} schema - * @return {Schema} - */ - - -function findFirstTypedSchema(schema) { - if (hasNotInSchema(schema)) { - return findFirstTypedSchema(schema.not); - } - - return schema; -} -/** - * @param {Schema} schema - * @return {boolean} - */ - - -function canApplyNot(schema) { - const typedSchema = findFirstTypedSchema(schema); - return likeNumber(typedSchema) || likeInteger(typedSchema) || likeString(typedSchema) || likeNull(typedSchema) || likeBoolean(typedSchema); -} -/** - * @param {any} maybeObj - * @returns {boolean} - */ - - -function isObject(maybeObj) { - return typeof maybeObj === "object" && maybeObj !== null; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeNumber(schema) { - return schema.type === "number" || typeof schema.minimum !== "undefined" || typeof schema.exclusiveMinimum !== "undefined" || typeof schema.maximum !== "undefined" || typeof schema.exclusiveMaximum !== "undefined" || typeof schema.multipleOf !== "undefined"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeInteger(schema) { - return schema.type === "integer" || typeof schema.minimum !== "undefined" || typeof schema.exclusiveMinimum !== "undefined" || typeof schema.maximum !== "undefined" || typeof schema.exclusiveMaximum !== "undefined" || typeof schema.multipleOf !== "undefined"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeString(schema) { - return schema.type === "string" || typeof schema.minLength !== "undefined" || typeof schema.maxLength !== "undefined" || typeof schema.pattern !== "undefined" || typeof schema.format !== "undefined" || typeof schema.formatMinimum !== "undefined" || typeof schema.formatMaximum !== "undefined"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeBoolean(schema) { - return schema.type === "boolean"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeArray(schema) { - return schema.type === "array" || typeof schema.minItems === "number" || typeof schema.maxItems === "number" || typeof schema.uniqueItems !== "undefined" || typeof schema.items !== "undefined" || typeof schema.additionalItems !== "undefined" || typeof schema.contains !== "undefined"; -} -/** - * @param {Schema & {patternRequired?: Array}} schema - * @returns {boolean} - */ - - -function likeObject(schema) { - return schema.type === "object" || typeof schema.minProperties !== "undefined" || typeof schema.maxProperties !== "undefined" || typeof schema.required !== "undefined" || typeof schema.properties !== "undefined" || typeof schema.patternProperties !== "undefined" || typeof schema.additionalProperties !== "undefined" || typeof schema.dependencies !== "undefined" || typeof schema.propertyNames !== "undefined" || typeof schema.patternRequired !== "undefined"; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeNull(schema) { - return schema.type === "null"; -} -/** - * @param {string} type - * @returns {string} - */ - - -function getArticle(type) { - if (/^[aeiou]/i.test(type)) { - return "an"; - } - - return "a"; -} -/** - * @param {Schema=} schema - * @returns {string} - */ - - -function getSchemaNonTypes(schema) { - if (!schema) { - return ""; - } - - if (!schema.type) { - if (likeNumber(schema) || likeInteger(schema)) { - return " | should be any non-number"; - } - - if (likeString(schema)) { - return " | should be any non-string"; - } - - if (likeArray(schema)) { - return " | should be any non-array"; - } - - if (likeObject(schema)) { - return " | should be any non-object"; - } - } - - return ""; -} -/** - * @param {Array} hints - * @returns {string} - */ - - -function formatHints(hints) { - return hints.length > 0 ? `(${hints.join(", ")})` : ""; -} -/** - * @param {Schema} schema - * @param {boolean} logic - * @returns {string[]} - */ - - -function getHints(schema, logic) { - if (likeNumber(schema) || likeInteger(schema)) { - return numberHints(schema, logic); - } else if (likeString(schema)) { - return stringHints(schema, logic); - } - - return []; -} - -class ValidationError extends Error { - /** - * @param {Array} errors - * @param {Schema} schema - * @param {ValidationErrorConfiguration} configuration - */ - constructor(errors, schema, configuration = {}) { - super(); - /** @type {string} */ - - this.name = "ValidationError"; - /** @type {Array} */ - - this.errors = errors; - /** @type {Schema} */ - - this.schema = schema; - let headerNameFromSchema; - let baseDataPathFromSchema; - - if (schema.title && (!configuration.name || !configuration.baseDataPath)) { - const splittedTitleFromSchema = schema.title.match(/^(.+) (.+)$/); - - if (splittedTitleFromSchema) { - if (!configuration.name) { - [, headerNameFromSchema] = splittedTitleFromSchema; - } - - if (!configuration.baseDataPath) { - [,, baseDataPathFromSchema] = splittedTitleFromSchema; - } - } - } - /** @type {string} */ - - - this.headerName = configuration.name || headerNameFromSchema || "Object"; - /** @type {string} */ - - this.baseDataPath = configuration.baseDataPath || baseDataPathFromSchema || "configuration"; - /** @type {PostFormatter | null} */ - - this.postFormatter = configuration.postFormatter || null; - const header = `Invalid ${this.baseDataPath} object. ${this.headerName} has been initialized using ${getArticle(this.baseDataPath)} ${this.baseDataPath} object that does not match the API schema.\n`; - /** @type {string} */ - - this.message = `${header}${this.formatValidationErrors(errors)}`; - Error.captureStackTrace(this, this.constructor); - } - /** - * @param {string} path - * @returns {Schema} - */ - - - getSchemaPart(path) { - const newPath = path.split("/"); - let schemaPart = this.schema; - - for (let i = 1; i < newPath.length; i++) { - const inner = schemaPart[ - /** @type {keyof Schema} */ - newPath[i]]; - - if (!inner) { - break; - } - - schemaPart = inner; - } - - return schemaPart; - } - /** - * @param {Schema} schema - * @param {boolean} logic - * @param {Array} prevSchemas - * @returns {string} - */ - - - formatSchema(schema, logic = true, prevSchemas = []) { - let newLogic = logic; - - const formatInnerSchema = - /** - * - * @param {Object} innerSchema - * @param {boolean=} addSelf - * @returns {string} - */ - (innerSchema, addSelf) => { - if (!addSelf) { - return this.formatSchema(innerSchema, newLogic, prevSchemas); - } - - if (prevSchemas.includes(innerSchema)) { - return "(recursive)"; - } - - return this.formatSchema(innerSchema, newLogic, prevSchemas.concat(schema)); - }; - - if (hasNotInSchema(schema) && !likeObject(schema)) { - if (canApplyNot(schema.not)) { - newLogic = !logic; - return formatInnerSchema(schema.not); - } - - const needApplyLogicHere = !schema.not.not; - const prefix = logic ? "" : "non "; - newLogic = !logic; - return needApplyLogicHere ? prefix + formatInnerSchema(schema.not) : formatInnerSchema(schema.not); - } - - if ( - /** @type {Schema & {instanceof: string | Array}} */ - schema.instanceof) { - const { - instanceof: value - } = - /** @type {Schema & {instanceof: string | Array}} */ - schema; - const values = !Array.isArray(value) ? [value] : value; - return values.map( - /** - * @param {string} item - * @returns {string} - */ - item => item === "Function" ? "function" : item).join(" | "); - } - - if (schema.enum) { - const enumValues = - /** @type {Array} */ - schema.enum.map(item => { - if (item === null && schema.undefinedAsNull) { - return `${JSON.stringify(item)} | undefined`; - } - - return JSON.stringify(item); - }).join(" | "); - return `${enumValues}`; - } - - if (typeof schema.const !== "undefined") { - return JSON.stringify(schema.const); - } - - if (schema.oneOf) { - return ( - /** @type {Array} */ - schema.oneOf.map(item => formatInnerSchema(item, true)).join(" | ") - ); - } - - if (schema.anyOf) { - return ( - /** @type {Array} */ - schema.anyOf.map(item => formatInnerSchema(item, true)).join(" | ") - ); - } - - if (schema.allOf) { - return ( - /** @type {Array} */ - schema.allOf.map(item => formatInnerSchema(item, true)).join(" & ") - ); - } - - if ( - /** @type {JSONSchema7} */ - schema.if) { - const { - if: ifValue, - then: thenValue, - else: elseValue - } = - /** @type {JSONSchema7} */ - schema; - return `${ifValue ? `if ${formatInnerSchema(ifValue)}` : ""}${thenValue ? ` then ${formatInnerSchema(thenValue)}` : ""}${elseValue ? ` else ${formatInnerSchema(elseValue)}` : ""}`; - } - - if (schema.$ref) { - return formatInnerSchema(this.getSchemaPart(schema.$ref), true); - } - - if (likeNumber(schema) || likeInteger(schema)) { - const [type, ...hints] = getHints(schema, logic); - const str = `${type}${hints.length > 0 ? ` ${formatHints(hints)}` : ""}`; - return logic ? str : hints.length > 0 ? `non-${type} | ${str}` : `non-${type}`; - } - - if (likeString(schema)) { - const [type, ...hints] = getHints(schema, logic); - const str = `${type}${hints.length > 0 ? ` ${formatHints(hints)}` : ""}`; - return logic ? str : str === "string" ? "non-string" : `non-string | ${str}`; - } - - if (likeBoolean(schema)) { - return `${logic ? "" : "non-"}boolean`; - } - - if (likeArray(schema)) { - // not logic already applied in formatValidationError - newLogic = true; - const hints = []; - - if (typeof schema.minItems === "number") { - hints.push(`should not have fewer than ${schema.minItems} item${schema.minItems > 1 ? "s" : ""}`); - } - - if (typeof schema.maxItems === "number") { - hints.push(`should not have more than ${schema.maxItems} item${schema.maxItems > 1 ? "s" : ""}`); - } - - if (schema.uniqueItems) { - hints.push("should not have duplicate items"); - } - - const hasAdditionalItems = typeof schema.additionalItems === "undefined" || Boolean(schema.additionalItems); - let items = ""; - - if (schema.items) { - if (Array.isArray(schema.items) && schema.items.length > 0) { - items = `${ - /** @type {Array} */ - schema.items.map(item => formatInnerSchema(item)).join(", ")}`; - - if (hasAdditionalItems) { - if (schema.additionalItems && isObject(schema.additionalItems) && Object.keys(schema.additionalItems).length > 0) { - hints.push(`additional items should be ${formatInnerSchema(schema.additionalItems)}`); - } - } - } else if (schema.items && Object.keys(schema.items).length > 0) { - // "additionalItems" is ignored - items = `${formatInnerSchema(schema.items)}`; - } else { - // Fallback for empty `items` value - items = "any"; - } - } else { - // "additionalItems" is ignored - items = "any"; - } - - if (schema.contains && Object.keys(schema.contains).length > 0) { - hints.push(`should contains at least one ${this.formatSchema(schema.contains)} item`); - } - - return `[${items}${hasAdditionalItems ? ", ..." : ""}]${hints.length > 0 ? ` (${hints.join(", ")})` : ""}`; - } - - if (likeObject(schema)) { - // not logic already applied in formatValidationError - newLogic = true; - const hints = []; - - if (typeof schema.minProperties === "number") { - hints.push(`should not have fewer than ${schema.minProperties} ${schema.minProperties > 1 ? "properties" : "property"}`); - } - - if (typeof schema.maxProperties === "number") { - hints.push(`should not have more than ${schema.maxProperties} ${schema.minProperties && schema.minProperties > 1 ? "properties" : "property"}`); - } - - if (schema.patternProperties && Object.keys(schema.patternProperties).length > 0) { - const patternProperties = Object.keys(schema.patternProperties); - hints.push(`additional property names should match pattern${patternProperties.length > 1 ? "s" : ""} ${patternProperties.map(pattern => JSON.stringify(pattern)).join(" | ")}`); - } - - const properties = schema.properties ? Object.keys(schema.properties) : []; - const required = schema.required ? schema.required : []; - const allProperties = [...new Set( - /** @type {Array} */ - [].concat(required).concat(properties))]; - const objectStructure = allProperties.map(property => { - const isRequired = required.includes(property); // Some properties need quotes, maybe we should add check - // Maybe we should output type of property (`foo: string`), but it is looks very unreadable - - return `${property}${isRequired ? "" : "?"}`; - }).concat(typeof schema.additionalProperties === "undefined" || Boolean(schema.additionalProperties) ? schema.additionalProperties && isObject(schema.additionalProperties) ? [`: ${formatInnerSchema(schema.additionalProperties)}`] : ["…"] : []).join(", "); - const { - dependencies, - propertyNames, - patternRequired - } = - /** @type {Schema & {patternRequired?: Array;}} */ - schema; - - if (dependencies) { - Object.keys(dependencies).forEach(dependencyName => { - const dependency = dependencies[dependencyName]; - - if (Array.isArray(dependency)) { - hints.push(`should have ${dependency.length > 1 ? "properties" : "property"} ${dependency.map(dep => `'${dep}'`).join(", ")} when property '${dependencyName}' is present`); - } else { - hints.push(`should be valid according to the schema ${formatInnerSchema(dependency)} when property '${dependencyName}' is present`); - } - }); - } - - if (propertyNames && Object.keys(propertyNames).length > 0) { - hints.push(`each property name should match format ${JSON.stringify(schema.propertyNames.format)}`); - } - - if (patternRequired && patternRequired.length > 0) { - hints.push(`should have property matching pattern ${patternRequired.map( - /** - * @param {string} item - * @returns {string} - */ - item => JSON.stringify(item))}`); - } - - return `object {${objectStructure ? ` ${objectStructure} ` : ""}}${hints.length > 0 ? ` (${hints.join(", ")})` : ""}`; - } - - if (likeNull(schema)) { - return `${logic ? "" : "non-"}null`; - } - - if (Array.isArray(schema.type)) { - // not logic already applied in formatValidationError - return `${schema.type.join(" | ")}`; - } // Fallback for unknown keywords - // not logic already applied in formatValidationError - - /* istanbul ignore next */ - - - return JSON.stringify(schema, null, 2); - } - /** - * @param {Schema=} schemaPart - * @param {(boolean | Array)=} additionalPath - * @param {boolean=} needDot - * @param {boolean=} logic - * @returns {string} - */ - - - getSchemaPartText(schemaPart, additionalPath, needDot = false, logic = true) { - if (!schemaPart) { - return ""; - } - - if (Array.isArray(additionalPath)) { - for (let i = 0; i < additionalPath.length; i++) { - /** @type {Schema | undefined} */ - const inner = schemaPart[ - /** @type {keyof Schema} */ - additionalPath[i]]; - - if (inner) { - // eslint-disable-next-line no-param-reassign - schemaPart = inner; - } else { - break; - } - } - } - - while (schemaPart.$ref) { - // eslint-disable-next-line no-param-reassign - schemaPart = this.getSchemaPart(schemaPart.$ref); - } - - let schemaText = `${this.formatSchema(schemaPart, logic)}${needDot ? "." : ""}`; - - if (schemaPart.description) { - schemaText += `\n-> ${schemaPart.description}`; - } - - if (schemaPart.link) { - schemaText += `\n-> Read more at ${schemaPart.link}`; - } - - return schemaText; - } - /** - * @param {Schema=} schemaPart - * @returns {string} - */ - - - getSchemaPartDescription(schemaPart) { - if (!schemaPart) { - return ""; - } - - while (schemaPart.$ref) { - // eslint-disable-next-line no-param-reassign - schemaPart = this.getSchemaPart(schemaPart.$ref); - } - - let schemaText = ""; - - if (schemaPart.description) { - schemaText += `\n-> ${schemaPart.description}`; - } - - if (schemaPart.link) { - schemaText += `\n-> Read more at ${schemaPart.link}`; - } - - return schemaText; - } - /** - * @param {SchemaUtilErrorObject} error - * @returns {string} - */ - - - formatValidationError(error) { - const { - keyword, - dataPath: errorDataPath - } = error; - const dataPath = `${this.baseDataPath}${errorDataPath}`; - - switch (keyword) { - case "type": - { - const { - parentSchema, - params - } = error; // eslint-disable-next-line default-case - - switch ( - /** @type {import("ajv").TypeParams} */ - params.type) { - case "number": - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - - case "integer": - return `${dataPath} should be an ${this.getSchemaPartText(parentSchema, false, true)}`; - - case "string": - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - - case "boolean": - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - - case "array": - return `${dataPath} should be an array:\n${this.getSchemaPartText(parentSchema)}`; - - case "object": - return `${dataPath} should be an object:\n${this.getSchemaPartText(parentSchema)}`; - - case "null": - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - - default: - return `${dataPath} should be:\n${this.getSchemaPartText(parentSchema)}`; - } - } - - case "instanceof": - { - const { - parentSchema - } = error; - return `${dataPath} should be an instance of ${this.getSchemaPartText(parentSchema, false, true)}`; - } - - case "pattern": - { - const { - params, - parentSchema - } = error; - const { - pattern - } = - /** @type {import("ajv").PatternParams} */ - params; - return `${dataPath} should match pattern ${JSON.stringify(pattern)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "format": - { - const { - params, - parentSchema - } = error; - const { - format - } = - /** @type {import("ajv").FormatParams} */ - params; - return `${dataPath} should match format ${JSON.stringify(format)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "formatMinimum": - case "formatMaximum": - { - const { - params, - parentSchema - } = error; - const { - comparison, - limit - } = - /** @type {import("ajv").ComparisonParams} */ - params; - return `${dataPath} should be ${comparison} ${JSON.stringify(limit)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "minimum": - case "maximum": - case "exclusiveMinimum": - case "exclusiveMaximum": - { - const { - parentSchema, - params - } = error; - const { - comparison, - limit - } = - /** @type {import("ajv").ComparisonParams} */ - params; - const [, ...hints] = getHints( - /** @type {Schema} */ - parentSchema, true); - - if (hints.length === 0) { - hints.push(`should be ${comparison} ${limit}`); - } - - return `${dataPath} ${hints.join(" ")}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "multipleOf": - { - const { - params, - parentSchema - } = error; - const { - multipleOf - } = - /** @type {import("ajv").MultipleOfParams} */ - params; - return `${dataPath} should be multiple of ${multipleOf}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "patternRequired": - { - const { - params, - parentSchema - } = error; - const { - missingPattern - } = - /** @type {import("ajv").PatternRequiredParams} */ - params; - return `${dataPath} should have property matching pattern ${JSON.stringify(missingPattern)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "minLength": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - - if (limit === 1) { - return `${dataPath} should be a non-empty string${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - const length = limit - 1; - return `${dataPath} should be longer than ${length} character${length > 1 ? "s" : ""}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "minItems": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - - if (limit === 1) { - return `${dataPath} should be a non-empty array${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - return `${dataPath} should not have fewer than ${limit} items${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "minProperties": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - - if (limit === 1) { - return `${dataPath} should be a non-empty object${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - return `${dataPath} should not have fewer than ${limit} properties${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "maxLength": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - const max = limit + 1; - return `${dataPath} should be shorter than ${max} character${max > 1 ? "s" : ""}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "maxItems": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - return `${dataPath} should not have more than ${limit} items${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "maxProperties": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - return `${dataPath} should not have more than ${limit} properties${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "uniqueItems": - { - const { - params, - parentSchema - } = error; - const { - i - } = - /** @type {import("ajv").UniqueItemsParams} */ - params; - return `${dataPath} should not contain the item '${error.data[i]}' twice${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "additionalItems": - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - return `${dataPath} should not have more than ${limit} items${getSchemaNonTypes(parentSchema)}. These items are valid:\n${this.getSchemaPartText(parentSchema)}`; - } - - case "contains": - { - const { - parentSchema - } = error; - return `${dataPath} should contains at least one ${this.getSchemaPartText(parentSchema, ["contains"])} item${getSchemaNonTypes(parentSchema)}.`; - } - - case "required": - { - const { - parentSchema, - params - } = error; - const missingProperty = - /** @type {import("ajv").DependenciesParams} */ - params.missingProperty.replace(/^\./, ""); - const hasProperty = parentSchema && Boolean( - /** @type {Schema} */ - parentSchema.properties && - /** @type {Schema} */ - parentSchema.properties[missingProperty]); - return `${dataPath} misses the property '${missingProperty}'${getSchemaNonTypes(parentSchema)}.${hasProperty ? ` Should be:\n${this.getSchemaPartText(parentSchema, ["properties", missingProperty])}` : this.getSchemaPartDescription(parentSchema)}`; - } - - case "additionalProperties": - { - const { - params, - parentSchema - } = error; - const { - additionalProperty - } = - /** @type {import("ajv").AdditionalPropertiesParams} */ - params; - return `${dataPath} has an unknown property '${additionalProperty}'${getSchemaNonTypes(parentSchema)}. These properties are valid:\n${this.getSchemaPartText(parentSchema)}`; - } - - case "dependencies": - { - const { - params, - parentSchema - } = error; - const { - property, - deps - } = - /** @type {import("ajv").DependenciesParams} */ - params; - const dependencies = deps.split(",").map( - /** - * @param {string} dep - * @returns {string} - */ - dep => `'${dep.trim()}'`).join(", "); - return `${dataPath} should have properties ${dependencies} when property '${property}' is present${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "propertyNames": - { - const { - params, - parentSchema, - schema - } = error; - const { - propertyName - } = - /** @type {import("ajv").PropertyNamesParams} */ - params; - return `${dataPath} property name '${propertyName}' is invalid${getSchemaNonTypes(parentSchema)}. Property names should be match format ${JSON.stringify(schema.format)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case "enum": - { - const { - parentSchema - } = error; - - if (parentSchema && - /** @type {Schema} */ - parentSchema.enum && - /** @type {Schema} */ - parentSchema.enum.length === 1) { - return `${dataPath} should be ${this.getSchemaPartText(parentSchema, false, true)}`; - } - - return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}`; - } - - case "const": - { - const { - parentSchema - } = error; - return `${dataPath} should be equal to constant ${this.getSchemaPartText(parentSchema, false, true)}`; - } - - case "not": - { - const postfix = likeObject( - /** @type {Schema} */ - error.parentSchema) ? `\n${this.getSchemaPartText(error.parentSchema)}` : ""; - const schemaOutput = this.getSchemaPartText(error.schema, false, false, false); - - if (canApplyNot(error.schema)) { - return `${dataPath} should be any ${schemaOutput}${postfix}.`; - } - - const { - schema, - parentSchema - } = error; - return `${dataPath} should not be ${this.getSchemaPartText(schema, false, true)}${parentSchema && likeObject(parentSchema) ? `\n${this.getSchemaPartText(parentSchema)}` : ""}`; - } - - case "oneOf": - case "anyOf": - { - const { - parentSchema, - children - } = error; - - if (children && children.length > 0) { - if (error.schema.length === 1) { - const lastChild = children[children.length - 1]; - const remainingChildren = children.slice(0, children.length - 1); - return this.formatValidationError(Object.assign({}, lastChild, { - children: remainingChildren, - parentSchema: Object.assign({}, parentSchema, lastChild.parentSchema) - })); - } - - let filteredChildren = filterChildren(children); - - if (filteredChildren.length === 1) { - return this.formatValidationError(filteredChildren[0]); - } - - filteredChildren = groupChildrenByFirstChild(filteredChildren); - return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}\nDetails:\n${filteredChildren.map( - /** - * @param {SchemaUtilErrorObject} nestedError - * @returns {string} - */ - nestedError => ` * ${indent(this.formatValidationError(nestedError), " ")}`).join("\n")}`; - } - - return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}`; - } - - case "if": - { - const { - params, - parentSchema - } = error; - const { - failingKeyword - } = - /** @type {import("ajv").IfParams} */ - params; - return `${dataPath} should match "${failingKeyword}" schema:\n${this.getSchemaPartText(parentSchema, [failingKeyword])}`; - } - - case "absolutePath": - { - const { - message, - parentSchema - } = error; - return `${dataPath}: ${message}${this.getSchemaPartDescription(parentSchema)}`; - } - - /* istanbul ignore next */ - - default: - { - const { - message, - parentSchema - } = error; - const ErrorInJSON = JSON.stringify(error, null, 2); // For `custom`, `false schema`, `$ref` keywords - // Fallback for unknown keywords - - return `${dataPath} ${message} (${ErrorInJSON}).\n${this.getSchemaPartText(parentSchema, false)}`; - } - } - } - /** - * @param {Array} errors - * @returns {string} - */ - - - formatValidationErrors(errors) { - return errors.map(error => { - let formattedError = this.formatValidationError(error); - - if (this.postFormatter) { - formattedError = this.postFormatter(formattedError, error); - } - - return ` - ${indent(formattedError, " ")}`; - }).join("\n"); - } - -} - -var _default = ValidationError; -exports.default = _default; \ No newline at end of file diff --git a/node_modules/webpack/node_modules/schema-utils/dist/index.js b/node_modules/webpack/node_modules/schema-utils/dist/index.js deleted file mode 100644 index 94d676f..0000000 --- a/node_modules/webpack/node_modules/schema-utils/dist/index.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -const { - validate, - ValidationError, - enableValidation, - disableValidation, - needValidate -} = require("./validate"); - -module.exports = { - validate, - ValidationError, - enableValidation, - disableValidation, - needValidate -}; \ No newline at end of file diff --git a/node_modules/webpack/node_modules/schema-utils/dist/keywords/absolutePath.js b/node_modules/webpack/node_modules/schema-utils/dist/keywords/absolutePath.js deleted file mode 100644 index 0a912da..0000000 --- a/node_modules/webpack/node_modules/schema-utils/dist/keywords/absolutePath.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -/** @typedef {import("ajv").Ajv} Ajv */ - -/** @typedef {import("ajv").ValidateFunction} ValidateFunction */ - -/** @typedef {import("../validate").SchemaUtilErrorObject} SchemaUtilErrorObject */ - -/** - * @param {string} message - * @param {object} schema - * @param {string} data - * @returns {SchemaUtilErrorObject} - */ -function errorMessage(message, schema, data) { - return { - // @ts-ignore - // eslint-disable-next-line no-undefined - dataPath: undefined, - // @ts-ignore - // eslint-disable-next-line no-undefined - schemaPath: undefined, - keyword: "absolutePath", - params: { - absolutePath: data - }, - message, - parentSchema: schema - }; -} -/** - * @param {boolean} shouldBeAbsolute - * @param {object} schema - * @param {string} data - * @returns {SchemaUtilErrorObject} - */ - - -function getErrorFor(shouldBeAbsolute, schema, data) { - const message = shouldBeAbsolute ? `The provided value ${JSON.stringify(data)} is not an absolute path!` : `A relative path is expected. However, the provided value ${JSON.stringify(data)} is an absolute path!`; - return errorMessage(message, schema, data); -} -/** - * - * @param {Ajv} ajv - * @returns {Ajv} - */ - - -function addAbsolutePathKeyword(ajv) { - ajv.addKeyword("absolutePath", { - errors: true, - type: "string", - - compile(schema, parentSchema) { - /** @type {ValidateFunction} */ - const callback = data => { - let passes = true; - const isExclamationMarkPresent = data.includes("!"); - - if (isExclamationMarkPresent) { - callback.errors = [errorMessage(`The provided value ${JSON.stringify(data)} contains exclamation mark (!) which is not allowed because it's reserved for loader syntax.`, parentSchema, data)]; - passes = false; - } // ?:[A-Za-z]:\\ - Windows absolute path - // \\\\ - Windows network absolute path - // \/ - Unix-like OS absolute path - - - const isCorrectAbsolutePath = schema === /^(?:[A-Za-z]:(\\|\/)|\\\\|\/)/.test(data); - - if (!isCorrectAbsolutePath) { - callback.errors = [getErrorFor(schema, parentSchema, data)]; - passes = false; - } - - return passes; - }; - - callback.errors = []; - return callback; - } - - }); - return ajv; -} - -var _default = addAbsolutePathKeyword; -exports.default = _default; \ No newline at end of file diff --git a/node_modules/webpack/node_modules/schema-utils/dist/keywords/undefinedAsNull.js b/node_modules/webpack/node_modules/schema-utils/dist/keywords/undefinedAsNull.js deleted file mode 100644 index 1d54aab..0000000 --- a/node_modules/webpack/node_modules/schema-utils/dist/keywords/undefinedAsNull.js +++ /dev/null @@ -1,95 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -/** @typedef {import("ajv").Ajv} Ajv */ - -/** - * - * @param {Ajv} ajv - * @param {string} keyword - * @param {any} definition - */ -function addKeyword(ajv, keyword, definition) { - let customRuleCode; - - try { - // @ts-ignore - // eslint-disable-next-line global-require - customRuleCode = require("ajv/lib/dotjs/custom"); // @ts-ignore - - const { - RULES - } = ajv; - let ruleGroup; - - for (let i = 0; i < RULES.length; i++) { - const rg = RULES[i]; - - if (typeof rg.type === "undefined") { - ruleGroup = rg; - break; - } - } - - const rule = { - keyword, - definition, - custom: true, - code: customRuleCode, - implements: definition.implements - }; - ruleGroup.rules.unshift(rule); - RULES.custom[keyword] = rule; - RULES.keywords[keyword] = true; - RULES.all[keyword] = true; - } catch (e) {// Nothing, fallback - } -} -/** - * - * @param {Ajv} ajv - * @returns {Ajv} - */ - - -function addUndefinedAsNullKeyword(ajv) { - // There is workaround for old versions of ajv, where `before` is not implemented - addKeyword(ajv, "undefinedAsNull", { - modifying: true, - - /** - * @param {boolean} kwVal - * @param {unknown} data - * @param {any} parentSchema - * @param {string} dataPath - * @param {unknown} parentData - * @param {number | string} parentDataProperty - * @return {boolean} - */ - validate(kwVal, data, parentSchema, dataPath, parentData, parentDataProperty) { - if (kwVal && parentSchema && typeof parentSchema.enum !== "undefined" && parentData && typeof parentDataProperty === "number") { - const idx = - /** @type {number} */ - parentDataProperty; - const parentDataRef = - /** @type {any[]} */ - parentData; - - if (typeof parentDataRef[idx] === "undefined") { - parentDataRef[idx] = null; - } - } - - return true; - } - - }); - return ajv; -} - -var _default = addUndefinedAsNullKeyword; -exports.default = _default; \ No newline at end of file diff --git a/node_modules/webpack/node_modules/schema-utils/dist/util/Range.js b/node_modules/webpack/node_modules/schema-utils/dist/util/Range.js deleted file mode 100644 index 14b2431..0000000 --- a/node_modules/webpack/node_modules/schema-utils/dist/util/Range.js +++ /dev/null @@ -1,163 +0,0 @@ -"use strict"; - -/** - * @typedef {[number, boolean]} RangeValue - */ - -/** - * @callback RangeValueCallback - * @param {RangeValue} rangeValue - * @returns {boolean} - */ -class Range { - /** - * @param {"left" | "right"} side - * @param {boolean} exclusive - * @returns {">" | ">=" | "<" | "<="} - */ - static getOperator(side, exclusive) { - if (side === "left") { - return exclusive ? ">" : ">="; - } - - return exclusive ? "<" : "<="; - } - /** - * @param {number} value - * @param {boolean} logic is not logic applied - * @param {boolean} exclusive is range exclusive - * @returns {string} - */ - - - static formatRight(value, logic, exclusive) { - if (logic === false) { - return Range.formatLeft(value, !logic, !exclusive); - } - - return `should be ${Range.getOperator("right", exclusive)} ${value}`; - } - /** - * @param {number} value - * @param {boolean} logic is not logic applied - * @param {boolean} exclusive is range exclusive - * @returns {string} - */ - - - static formatLeft(value, logic, exclusive) { - if (logic === false) { - return Range.formatRight(value, !logic, !exclusive); - } - - return `should be ${Range.getOperator("left", exclusive)} ${value}`; - } - /** - * @param {number} start left side value - * @param {number} end right side value - * @param {boolean} startExclusive is range exclusive from left side - * @param {boolean} endExclusive is range exclusive from right side - * @param {boolean} logic is not logic applied - * @returns {string} - */ - - - static formatRange(start, end, startExclusive, endExclusive, logic) { - let result = "should be"; - result += ` ${Range.getOperator(logic ? "left" : "right", logic ? startExclusive : !startExclusive)} ${start} `; - result += logic ? "and" : "or"; - result += ` ${Range.getOperator(logic ? "right" : "left", logic ? endExclusive : !endExclusive)} ${end}`; - return result; - } - /** - * @param {Array} values - * @param {boolean} logic is not logic applied - * @return {RangeValue} computed value and it's exclusive flag - */ - - - static getRangeValue(values, logic) { - let minMax = logic ? Infinity : -Infinity; - let j = -1; - const predicate = logic ? - /** @type {RangeValueCallback} */ - ([value]) => value <= minMax : - /** @type {RangeValueCallback} */ - ([value]) => value >= minMax; - - for (let i = 0; i < values.length; i++) { - if (predicate(values[i])) { - [minMax] = values[i]; - j = i; - } - } - - if (j > -1) { - return values[j]; - } - - return [Infinity, true]; - } - - constructor() { - /** @type {Array} */ - this._left = []; - /** @type {Array} */ - - this._right = []; - } - /** - * @param {number} value - * @param {boolean=} exclusive - */ - - - left(value, exclusive = false) { - this._left.push([value, exclusive]); - } - /** - * @param {number} value - * @param {boolean=} exclusive - */ - - - right(value, exclusive = false) { - this._right.push([value, exclusive]); - } - /** - * @param {boolean} logic is not logic applied - * @return {string} "smart" range string representation - */ - - - format(logic = true) { - const [start, leftExclusive] = Range.getRangeValue(this._left, logic); - const [end, rightExclusive] = Range.getRangeValue(this._right, !logic); - - if (!Number.isFinite(start) && !Number.isFinite(end)) { - return ""; - } - - const realStart = leftExclusive ? start + 1 : start; - const realEnd = rightExclusive ? end - 1 : end; // e.g. 5 < x < 7, 5 < x <= 6, 6 <= x <= 6 - - if (realStart === realEnd) { - return `should be ${logic ? "" : "!"}= ${realStart}`; - } // e.g. 4 < x < ∞ - - - if (Number.isFinite(start) && !Number.isFinite(end)) { - return Range.formatLeft(start, logic, leftExclusive); - } // e.g. ∞ < x < 4 - - - if (!Number.isFinite(start) && Number.isFinite(end)) { - return Range.formatRight(end, logic, rightExclusive); - } - - return Range.formatRange(start, end, leftExclusive, rightExclusive, logic); - } - -} - -module.exports = Range; \ No newline at end of file diff --git a/node_modules/webpack/node_modules/schema-utils/dist/util/hints.js b/node_modules/webpack/node_modules/schema-utils/dist/util/hints.js deleted file mode 100644 index 4317b86..0000000 --- a/node_modules/webpack/node_modules/schema-utils/dist/util/hints.js +++ /dev/null @@ -1,105 +0,0 @@ -"use strict"; - -const Range = require("./Range"); -/** @typedef {import("../validate").Schema} Schema */ - -/** - * @param {Schema} schema - * @param {boolean} logic - * @return {string[]} - */ - - -module.exports.stringHints = function stringHints(schema, logic) { - const hints = []; - let type = "string"; - const currentSchema = { ...schema - }; - - if (!logic) { - const tmpLength = currentSchema.minLength; - const tmpFormat = currentSchema.formatMinimum; - const tmpExclusive = currentSchema.formatExclusiveMaximum; - currentSchema.minLength = currentSchema.maxLength; - currentSchema.maxLength = tmpLength; - currentSchema.formatMinimum = currentSchema.formatMaximum; - currentSchema.formatMaximum = tmpFormat; - currentSchema.formatExclusiveMaximum = !currentSchema.formatExclusiveMinimum; - currentSchema.formatExclusiveMinimum = !tmpExclusive; - } - - if (typeof currentSchema.minLength === "number") { - if (currentSchema.minLength === 1) { - type = "non-empty string"; - } else { - const length = Math.max(currentSchema.minLength - 1, 0); - hints.push(`should be longer than ${length} character${length > 1 ? "s" : ""}`); - } - } - - if (typeof currentSchema.maxLength === "number") { - if (currentSchema.maxLength === 0) { - type = "empty string"; - } else { - const length = currentSchema.maxLength + 1; - hints.push(`should be shorter than ${length} character${length > 1 ? "s" : ""}`); - } - } - - if (currentSchema.pattern) { - hints.push(`should${logic ? "" : " not"} match pattern ${JSON.stringify(currentSchema.pattern)}`); - } - - if (currentSchema.format) { - hints.push(`should${logic ? "" : " not"} match format ${JSON.stringify(currentSchema.format)}`); - } - - if (currentSchema.formatMinimum) { - hints.push(`should be ${currentSchema.formatExclusiveMinimum ? ">" : ">="} ${JSON.stringify(currentSchema.formatMinimum)}`); - } - - if (currentSchema.formatMaximum) { - hints.push(`should be ${currentSchema.formatExclusiveMaximum ? "<" : "<="} ${JSON.stringify(currentSchema.formatMaximum)}`); - } - - return [type].concat(hints); -}; -/** - * @param {Schema} schema - * @param {boolean} logic - * @return {string[]} - */ - - -module.exports.numberHints = function numberHints(schema, logic) { - const hints = [schema.type === "integer" ? "integer" : "number"]; - const range = new Range(); - - if (typeof schema.minimum === "number") { - range.left(schema.minimum); - } - - if (typeof schema.exclusiveMinimum === "number") { - range.left(schema.exclusiveMinimum, true); - } - - if (typeof schema.maximum === "number") { - range.right(schema.maximum); - } - - if (typeof schema.exclusiveMaximum === "number") { - range.right(schema.exclusiveMaximum, true); - } - - const rangeFormat = range.format(logic); - - if (rangeFormat) { - hints.push(rangeFormat); - } - - if (typeof schema.multipleOf === "number") { - hints.push(`should${logic ? "" : " not"} be multiple of ${schema.multipleOf}`); - } - - return hints; -}; \ No newline at end of file diff --git a/node_modules/webpack/node_modules/schema-utils/dist/validate.js b/node_modules/webpack/node_modules/schema-utils/dist/validate.js deleted file mode 100644 index cb09145..0000000 --- a/node_modules/webpack/node_modules/schema-utils/dist/validate.js +++ /dev/null @@ -1,258 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.validate = validate; -exports.enableValidation = enableValidation; -exports.disableValidation = disableValidation; -exports.needValidate = needValidate; -Object.defineProperty(exports, "ValidationError", { - enumerable: true, - get: function () { - return _ValidationError.default; - } -}); - -var _absolutePath = _interopRequireDefault(require("./keywords/absolutePath")); - -var _undefinedAsNull = _interopRequireDefault(require("./keywords/undefinedAsNull")); - -var _ValidationError = _interopRequireDefault(require("./ValidationError")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * @template T - * @param fn {(function(): any) | undefined} - * @returns {function(): T} - */ -const memoize = fn => { - let cache = false; - /** @type {T} */ - - let result; - return () => { - if (cache) { - return result; - } - - result = - /** @type {function(): any} */ - fn(); - cache = true; // Allow to clean up memory for fn - // and all dependent resources - // eslint-disable-next-line no-undefined, no-param-reassign - - fn = undefined; - return result; - }; -}; - -const getAjv = memoize(() => { - // Use CommonJS require for ajv libs so TypeScript consumers aren't locked into esModuleInterop (see #110). - // eslint-disable-next-line global-require - const Ajv = require("ajv"); // eslint-disable-next-line global-require - - - const ajvKeywords = require("ajv-keywords"); - - const ajv = new Ajv({ - allErrors: true, - verbose: true, - $data: true - }); - ajvKeywords(ajv, ["instanceof", "formatMinimum", "formatMaximum", "patternRequired"]); // Custom keywords - - (0, _absolutePath.default)(ajv); - (0, _undefinedAsNull.default)(ajv); - return ajv; -}); -/** @typedef {import("json-schema").JSONSchema4} JSONSchema4 */ - -/** @typedef {import("json-schema").JSONSchema6} JSONSchema6 */ - -/** @typedef {import("json-schema").JSONSchema7} JSONSchema7 */ - -/** @typedef {import("ajv").ErrorObject} ErrorObject */ - -/** @typedef {import("ajv").ValidateFunction} ValidateFunction */ - -/** - * @typedef {Object} Extend - * @property {number=} formatMinimum - * @property {number=} formatMaximum - * @property {boolean=} formatExclusiveMinimum - * @property {boolean=} formatExclusiveMaximum - * @property {string=} link - * @property {boolean=} undefinedAsNull - */ - -/** @typedef {(JSONSchema4 | JSONSchema6 | JSONSchema7) & Extend} Schema */ - -/** @typedef {ErrorObject & { children?: Array}} SchemaUtilErrorObject */ - -/** - * @callback PostFormatter - * @param {string} formattedError - * @param {SchemaUtilErrorObject} error - * @returns {string} - */ - -/** - * @typedef {Object} ValidationErrorConfiguration - * @property {string=} name - * @property {string=} baseDataPath - * @property {PostFormatter=} postFormatter - */ - -/** - * @param {SchemaUtilErrorObject} error - * @param {number} idx - * @returns {SchemaUtilErrorObject} - */ - -function applyPrefix(error, idx) { - // eslint-disable-next-line no-param-reassign - error.dataPath = `[${idx}]${error.dataPath}`; - - if (error.children) { - error.children.forEach(err => applyPrefix(err, idx)); - } - - return error; -} - -let skipValidation = false; // We use `process.env.SKIP_VALIDATION` because you can have multiple `schema-utils` with different version, -// so we want to disable it globally, `process.env` doesn't supported by browsers, so we have the local `skipValidation` variables -// Enable validation - -function enableValidation() { - skipValidation = false; // Disable validation for any versions - - if (process && process.env) { - process.env.SKIP_VALIDATION = "n"; - } -} // Disable validation - - -function disableValidation() { - skipValidation = true; - - if (process && process.env) { - process.env.SKIP_VALIDATION = "y"; - } -} // Check if we need to confirm - - -function needValidate() { - if (skipValidation) { - return false; - } - - if (process && process.env && process.env.SKIP_VALIDATION) { - const value = process.env.SKIP_VALIDATION.trim(); - - if (/^(?:y|yes|true|1|on)$/i.test(value)) { - return false; - } - - if (/^(?:n|no|false|0|off)$/i.test(value)) { - return true; - } - } - - return true; -} -/** - * @param {Schema} schema - * @param {Array | object} options - * @param {ValidationErrorConfiguration=} configuration - * @returns {void} - */ - - -function validate(schema, options, configuration) { - if (!needValidate()) { - return; - } - - let errors = []; - - if (Array.isArray(options)) { - for (let i = 0; i <= options.length - 1; i++) { - errors.push(...validateObject(schema, options[i]).map(err => applyPrefix(err, i))); - } - } else { - errors = validateObject(schema, options); - } - - if (errors.length > 0) { - throw new _ValidationError.default(errors, schema, configuration); - } -} -/** @typedef {WeakMap} */ - - -const schemaCache = new WeakMap(); -/** - * @param {Schema} schema - * @param {Array | object} options - * @returns {Array} - */ - -function validateObject(schema, options) { - let compiledSchema = schemaCache.get(schema); - - if (!compiledSchema) { - compiledSchema = getAjv().compile(schema); - schemaCache.set(schema, compiledSchema); - } - - const valid = compiledSchema(options); - if (valid) return []; - return compiledSchema.errors ? filterErrors(compiledSchema.errors) : []; -} -/** - * @param {Array} errors - * @returns {Array} - */ - - -function filterErrors(errors) { - /** @type {Array} */ - let newErrors = []; - - for (const error of - /** @type {Array} */ - errors) { - const { - dataPath - } = error; - /** @type {Array} */ - - let children = []; - newErrors = newErrors.filter(oldError => { - if (oldError.dataPath.includes(dataPath)) { - if (oldError.children) { - children = children.concat(oldError.children.slice(0)); - } // eslint-disable-next-line no-undefined, no-param-reassign - - - oldError.children = undefined; - children.push(oldError); - return false; - } - - return true; - }); - - if (children.length) { - error.children = children; - } - - newErrors.push(error); - } - - return newErrors; -} \ No newline at end of file diff --git a/node_modules/webpack/node_modules/schema-utils/package.json b/node_modules/webpack/node_modules/schema-utils/package.json deleted file mode 100644 index 47943ef..0000000 --- a/node_modules/webpack/node_modules/schema-utils/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "name": "schema-utils", - "version": "3.3.0", - "description": "webpack Validation Utils", - "license": "MIT", - "repository": "webpack/schema-utils", - "author": "webpack Contrib (https://github.com/webpack-contrib)", - "homepage": "https://github.com/webpack/schema-utils", - "bugs": "https://github.com/webpack/schema-utils/issues", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "main": "dist/index.js", - "types": "declarations/index.d.ts", - "engines": { - "node": ">= 10.13.0" - }, - "scripts": { - "start": "npm run build -- -w", - "clean": "del-cli dist declarations", - "prebuild": "npm run clean", - "build:types": "tsc --declaration --emitDeclarationOnly --outDir declarations && prettier \"declarations/**/*.ts\" --write", - "build:code": "cross-env NODE_ENV=production babel src -d dist --copy-files", - "build": "npm-run-all -p \"build:**\"", - "commitlint": "commitlint --from=master", - "security": "npm audit --production", - "fmt:check": "prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different", - "lint:js": "eslint --cache .", - "lint:types": "tsc --pretty --noEmit", - "lint": "npm-run-all lint:js lint:types fmt:check", - "fmt": "npm run fmt:check -- --write", - "fix:js": "npm run lint:js -- --fix", - "fix": "npm-run-all fix:js fmt", - "test:only": "cross-env NODE_ENV=test jest", - "test:watch": "npm run test:only -- --watch", - "test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage", - "pretest": "npm run lint", - "test": "npm run test:coverage", - "prepare": "npm run build && husky install", - "release": "standard-version" - }, - "files": [ - "dist", - "declarations" - ], - "dependencies": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - }, - "devDependencies": { - "@babel/cli": "^7.14.3", - "@babel/core": "^7.14.6", - "@babel/preset-env": "^7.14.7", - "@commitlint/cli": "^12.1.4", - "@commitlint/config-conventional": "^12.1.4", - "@webpack-contrib/eslint-config-webpack": "^3.0.0", - "babel-jest": "^27.0.6", - "cross-env": "^7.0.3", - "del": "^6.0.0", - "del-cli": "^3.0.1", - "eslint": "^7.31.0", - "eslint-config-prettier": "^8.3.0", - "eslint-plugin-import": "^2.23.4", - "husky": "^6.0.0", - "jest": "^27.0.6", - "lint-staged": "^11.0.1", - "npm-run-all": "^4.1.5", - "prettier": "^2.3.2", - "standard-version": "^9.3.1", - "typescript": "^4.3.5", - "webpack": "^5.45.1" - }, - "keywords": [ - "webpack" - ] -} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..140ed58 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6656 @@ +{ + "name": "3d_game", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "3d_game", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "cannon-es": "^0.20.0", + "three": "^0.168.0", + "webpack": "^5.94.0", + "webpack-cli": "^5.1.4" + }, + "devDependencies": { + "@babel/core": "^7.25.2", + "@babel/preset-env": "^7.25.4", + "babel-loader": "^9.2.1", + "html-loader": "^5.1.0", + "html-webpack-plugin": "^5.6.0", + "webpack-dev-server": "^5.1.0" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", + "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/highlight": "^7.24.7", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.25.4", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.25.4.tgz", + "integrity": "sha512-+LGRog6RAsCJrrrg/IO6LGmpphNe5DiK30dGjCoxxeGv49B10/3XYGxPsAwrDlMFcFEvdAUavDT8r9k/hSyQqQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.25.2", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.25.2.tgz", + "integrity": "sha512-BBt3opiCOxUr9euZ5/ro/Xv8/V7yJ5bjYMqG/C1YAo8MIKAnumZalCN+msbci3Pigy4lIQfPUpfMM27HMGaYEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.24.7", + "@babel/generator": "^7.25.0", + "@babel/helper-compilation-targets": "^7.25.2", + "@babel/helper-module-transforms": "^7.25.2", + "@babel/helpers": "^7.25.0", + "@babel/parser": "^7.25.0", + "@babel/template": "^7.25.0", + "@babel/traverse": "^7.25.2", + "@babel/types": "^7.25.2", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.25.6.tgz", + "integrity": "sha512-VPC82gr1seXOpkjAAKoLhP50vx4vGNlF4msF64dSFq1P8RfB+QAuJWGHPXXPc8QyfVWwwB/TNNU4+ayZmHNbZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.25.6", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-annotate-as-pure": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.24.7.tgz", + "integrity": "sha512-BaDeOonYvhdKw+JoMVkAixAAJzG2jVPIwWoKBPdYuY9b452e2rPuI9QPYh3KpofZ3pW2akOmwZLOiOsHMiqRAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.24.7.tgz", + "integrity": "sha512-xZeCVVdwb4MsDBkkyZ64tReWYrLRHlMN72vP7Bdm3OUOuyFZExhsHUUnuWnm2/XOlAJzR0LfPpB56WXZn0X/lA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.25.2", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.2.tgz", + "integrity": "sha512-U2U5LsSaZ7TAt3cfaymQ8WHh0pxvdHoEk6HVpaexxixjyEquMh0L0YNJNM6CTGKMXV1iksi0iZkGw4AcFkPaaw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.25.2", + "@babel/helper-validator-option": "^7.24.8", + "browserslist": "^4.23.1", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-create-class-features-plugin": { + "version": "7.25.4", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.25.4.tgz", + "integrity": "sha512-ro/bFs3/84MDgDmMwbcHgDa8/E6J3QKNTk4xJJnVeFtGE+tL0K26E3pNxhYz2b67fJpt7Aphw5XcploKXuCvCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.24.7", + "@babel/helper-member-expression-to-functions": "^7.24.8", + "@babel/helper-optimise-call-expression": "^7.24.7", + "@babel/helper-replace-supers": "^7.25.0", + "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", + "@babel/traverse": "^7.25.4", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-create-regexp-features-plugin": { + "version": "7.25.2", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.25.2.tgz", + "integrity": "sha512-+wqVGP+DFmqwFD3EH6TMTfUNeqDehV3E/dl+Sd54eaXqm17tEUNbEIn4sVivVowbvUpOtIGxdo3GoXyDH9N/9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.24.7", + "regexpu-core": "^5.3.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-define-polyfill-provider": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.2.tgz", + "integrity": "sha512-LV76g+C502biUK6AyZ3LK10vDpDyCzZnhZFXkH1L75zHPj68+qc8Zfpx2th+gzwA2MzyK+1g/3EPl62yFnVttQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-compilation-targets": "^7.22.6", + "@babel/helper-plugin-utils": "^7.22.5", + "debug": "^4.1.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.14.2" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/@babel/helper-member-expression-to-functions": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.24.8.tgz", + "integrity": "sha512-LABppdt+Lp/RlBxqrh4qgf1oEH/WxdzQNDJIu5gC/W1GyvPVrOBiItmmM8wan2fm4oYqFuFfkXmlGpLQhPY8CA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.24.8", + "@babel/types": "^7.24.8" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz", + "integrity": "sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.25.2", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.25.2.tgz", + "integrity": "sha512-BjyRAbix6j/wv83ftcVJmBt72QtHI56C7JXZoG2xATiLpmoC7dpd8WnkikExHDVPpi/3qCmO6WY1EaXOluiecQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.24.7", + "@babel/helper-simple-access": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7", + "@babel/traverse": "^7.25.2" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-optimise-call-expression": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.24.7.tgz", + "integrity": "sha512-jKiTsW2xmWwxT1ixIdfXUZp+P5yURx2suzLZr5Hi64rURpDYdMW0pv+Uf17EYk2Rd428Lx4tLsnjGJzYKDM/6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.8.tgz", + "integrity": "sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-remap-async-to-generator": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.25.0.tgz", + "integrity": "sha512-NhavI2eWEIz/H9dbrG0TuOicDhNexze43i5z7lEqwYm0WEZVTwnPpA0EafUTP7+6/W79HWIP2cTe3Z5NiSTVpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.24.7", + "@babel/helper-wrap-function": "^7.25.0", + "@babel/traverse": "^7.25.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-replace-supers": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.25.0.tgz", + "integrity": "sha512-q688zIvQVYtZu+i2PsdIu/uWGRpfxzr5WESsfpShfZECkO+d2o+WROWezCi/Q6kJ0tfPa5+pUGUlfx2HhrA3Bg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-member-expression-to-functions": "^7.24.8", + "@babel/helper-optimise-call-expression": "^7.24.7", + "@babel/traverse": "^7.25.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz", + "integrity": "sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.24.7.tgz", + "integrity": "sha512-IO+DLT3LQUElMbpzlatRASEyQtfhSE0+m465v++3jyyXeBTBUjtVZg28/gHeV5mrTJqvEKhKroBGAvhW+qPHiQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz", + "integrity": "sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", + "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz", + "integrity": "sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-wrap-function": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.25.0.tgz", + "integrity": "sha512-s6Q1ebqutSiZnEjaofc/UKDyC4SbzV5n5SrA2Gq8UawLycr3i04f1dX4OzoQVnexm6aOCh37SQNYlJ/8Ku+PMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.25.0", + "@babel/traverse": "^7.25.0", + "@babel/types": "^7.25.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.25.6.tgz", + "integrity": "sha512-Xg0tn4HcfTijTwfDwYlvVCl43V6h4KyVVX2aEm4qdO/PC6L2YvzLHFdmxhoeSA3eslcE6+ZVXHgWwopXYLNq4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.25.0", + "@babel/types": "^7.25.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", + "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.24.7", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.6.tgz", + "integrity": "sha512-trGdfBdbD0l1ZPmcJ83eNxB9rbEax4ALFTF7fN386TMYbeCQbyme5cOEXQhbGXKebwGaB/J52w1mrklMcbgy6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.25.6" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-firefox-class-in-computed-class-key": { + "version": "7.25.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.25.3.tgz", + "integrity": "sha512-wUrcsxZg6rqBXG05HG1FPYgsP6EvwF4WpBbxIpWIIYnH8wG0gzx3yZY3dtEHas4sTAOGkbTsc9EGPxwff8lRoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.8", + "@babel/traverse": "^7.25.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-safari-class-field-initializer-scope": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.25.0.tgz", + "integrity": "sha512-Bm4bH2qsX880b/3ziJ8KD711LT7z4u8CFudmjqle65AZj/HNUFhEf90dqYv6O86buWvSBmeQDjv0Tn2aF/bIBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.8" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.25.0.tgz", + "integrity": "sha512-lXwdNZtTmeVOOFtwM/WDe7yg1PL8sYhRk/XH0FzbR2HDQ0xC+EnQ/JHeoMYSavtU115tnUk0q9CDyq8si+LMAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.8" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.24.7.tgz", + "integrity": "sha512-+izXIbke1T33mY4MSNnrqhPXDz01WYhEf3yF5NbnUtkiNnm+XBZJl3kNfoK6NKmYlz/D07+l2GWVK/QfDkNCuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", + "@babel/plugin-transform-optional-chaining": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.13.0" + } + }, + "node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.25.0.tgz", + "integrity": "sha512-tggFrk1AIShG/RUQbEwt2Tr/E+ObkfwrPjR6BjbRvsx24+PSjK8zrq0GWPNCjo8qpRx4DuJzlcvWJqlm+0h3kw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.8", + "@babel/traverse": "^7.25.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-proposal-private-property-in-object": { + "version": "7.21.0-placeholder-for-preset-env.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", + "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", + "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-dynamic-import": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", + "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-export-namespace-from": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", + "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-assertions": { + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.25.6.tgz", + "integrity": "sha512-aABl0jHw9bZ2karQ/uUD6XP4u0SG22SJrOHFoL6XB1R7dTovOP4TzTlsxOYC5yQ1pdscVK2JTUnF6QL3ARoAiQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.8" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-attributes": { + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.25.6.tgz", + "integrity": "sha512-sXaDXaJN9SNLymBdlWFA+bjzBhFD617ZaFiY13dGt7TVslVvVgA6fkZOP7Ki3IGElC45lwHdOTrCtKZGVAWeLQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.8" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", + "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-unicode-sets-regex": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz", + "integrity": "sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.18.6", + "@babel/helper-plugin-utils": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-arrow-functions": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.24.7.tgz", + "integrity": "sha512-Dt9LQs6iEY++gXUwY03DNFat5C2NbO48jj+j/bSAz6b3HgPs39qcPiYt77fDObIcFwj3/C2ICX9YMwGflUoSHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-async-generator-functions": { + "version": "7.25.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.25.4.tgz", + "integrity": "sha512-jz8cV2XDDTqjKPwVPJBIjORVEmSGYhdRa8e5k5+vN+uwcjSrSxUaebBRa4ko1jqNF2uxyg8G6XYk30Jv285xzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.8", + "@babel/helper-remap-async-to-generator": "^7.25.0", + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/traverse": "^7.25.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-async-to-generator": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.24.7.tgz", + "integrity": "sha512-SQY01PcJfmQ+4Ash7NE+rpbLFbmqA2GPIgqzxfFTL4t1FKRq4zTms/7htKpoCUI9OcFYgzqfmCdH53s6/jn5fA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.24.7", + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/helper-remap-async-to-generator": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-block-scoped-functions": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.24.7.tgz", + "integrity": "sha512-yO7RAz6EsVQDaBH18IDJcMB1HnrUn2FJ/Jslc/WtPPWcjhpUJXU/rjbwmluzp7v/ZzWcEhTMXELnnsz8djWDwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-block-scoping": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.25.0.tgz", + "integrity": "sha512-yBQjYoOjXlFv9nlXb3f1casSHOZkWr29NX+zChVanLg5Nc157CrbEX9D7hxxtTpuFy7Q0YzmmWfJxzvps4kXrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.8" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-class-properties": { + "version": "7.25.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.25.4.tgz", + "integrity": "sha512-nZeZHyCWPfjkdU5pA/uHiTaDAFUEqkpzf1YoQT2NeSynCGYq9rxfyI3XpQbfx/a0hSnFH6TGlEXvae5Vi7GD8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.25.4", + "@babel/helper-plugin-utils": "^7.24.8" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-class-static-block": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.24.7.tgz", + "integrity": "sha512-HMXK3WbBPpZQufbMG4B46A90PkuuhN9vBCb5T8+VAHqvAqvcLi+2cKoukcpmUYkszLhScU3l1iudhrks3DggRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.24.7", + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/plugin-syntax-class-static-block": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.12.0" + } + }, + "node_modules/@babel/plugin-transform-classes": { + "version": "7.25.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.25.4.tgz", + "integrity": "sha512-oexUfaQle2pF/b6E0dwsxQtAol9TLSO88kQvym6HHBWFliV2lGdrPieX+WgMRLSJDVzdYywk7jXbLPuO2KLTLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.24.7", + "@babel/helper-compilation-targets": "^7.25.2", + "@babel/helper-plugin-utils": "^7.24.8", + "@babel/helper-replace-supers": "^7.25.0", + "@babel/traverse": "^7.25.4", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-computed-properties": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.24.7.tgz", + "integrity": "sha512-25cS7v+707Gu6Ds2oY6tCkUwsJ9YIDbggd9+cu9jzzDgiNq7hR/8dkzxWfKWnTic26vsI3EsCXNd4iEB6e8esQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/template": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-destructuring": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.24.8.tgz", + "integrity": "sha512-36e87mfY8TnRxc7yc6M9g9gOB7rKgSahqkIKwLpz4Ppk2+zC2Cy1is0uwtuSG6AE4zlTOUa+7JGz9jCJGLqQFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.8" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-dotall-regex": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.24.7.tgz", + "integrity": "sha512-ZOA3W+1RRTSWvyqcMJDLqbchh7U4NRGqwRfFSVbOLS/ePIP4vHB5e8T8eXcuqyN1QkgKyj5wuW0lcS85v4CrSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.24.7", + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-duplicate-keys": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.24.7.tgz", + "integrity": "sha512-JdYfXyCRihAe46jUIliuL2/s0x0wObgwwiGxw/UbgJBr20gQBThrokO4nYKgWkD7uBaqM7+9x5TU7NkExZJyzw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-duplicate-named-capturing-groups-regex": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.25.0.tgz", + "integrity": "sha512-YLpb4LlYSc3sCUa35un84poXoraOiQucUTTu8X1j18JV+gNa8E0nyUf/CjZ171IRGr4jEguF+vzJU66QZhn29g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.25.0", + "@babel/helper-plugin-utils": "^7.24.8" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-dynamic-import": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.24.7.tgz", + "integrity": "sha512-sc3X26PhZQDb3JhORmakcbvkeInvxz+A8oda99lj7J60QRuPZvNAk9wQlTBS1ZynelDrDmTU4pw1tyc5d5ZMUg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/plugin-syntax-dynamic-import": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-exponentiation-operator": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.24.7.tgz", + "integrity": "sha512-Rqe/vSc9OYgDajNIK35u7ot+KeCoetqQYFXM4Epf7M7ez3lWlOjrDjrwMei6caCVhfdw+mIKD4cgdGNy5JQotQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.24.7", + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-export-namespace-from": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.24.7.tgz", + "integrity": "sha512-v0K9uNYsPL3oXZ/7F9NNIbAj2jv1whUEtyA6aujhekLs56R++JDQuzRcP2/z4WX5Vg/c5lE9uWZA0/iUoFhLTA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-for-of": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.24.7.tgz", + "integrity": "sha512-wo9ogrDG1ITTTBsy46oGiN1dS9A7MROBTcYsfS8DtsImMkHk9JXJ3EWQM6X2SUw4x80uGPlwj0o00Uoc6nEE3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-function-name": { + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.25.1.tgz", + "integrity": "sha512-TVVJVdW9RKMNgJJlLtHsKDTydjZAbwIsn6ySBPQaEAUU5+gVvlJt/9nRmqVbsV/IBanRjzWoaAQKLoamWVOUuA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-compilation-targets": "^7.24.8", + "@babel/helper-plugin-utils": "^7.24.8", + "@babel/traverse": "^7.25.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-json-strings": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.24.7.tgz", + "integrity": "sha512-2yFnBGDvRuxAaE/f0vfBKvtnvvqU8tGpMHqMNpTN2oWMKIR3NqFkjaAgGwawhqK/pIN2T3XdjGPdaG0vDhOBGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/plugin-syntax-json-strings": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-literals": { + "version": "7.25.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.25.2.tgz", + "integrity": "sha512-HQI+HcTbm9ur3Z2DkO+jgESMAMcYLuN/A7NRw9juzxAezN9AvqvUTnpKP/9kkYANz6u7dFlAyOu44ejuGySlfw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.8" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-logical-assignment-operators": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.24.7.tgz", + "integrity": "sha512-4D2tpwlQ1odXmTEIFWy9ELJcZHqrStlzK/dAOWYyxX3zT0iXQB6banjgeOJQXzEc4S0E0a5A+hahxPaEFYftsw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-member-expression-literals": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.24.7.tgz", + "integrity": "sha512-T/hRC1uqrzXMKLQ6UCwMT85S3EvqaBXDGf0FaMf4446Qx9vKwlghvee0+uuZcDUCZU5RuNi4781UQ7R308zzBw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-amd": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.24.7.tgz", + "integrity": "sha512-9+pB1qxV3vs/8Hdmz/CulFB8w2tuu6EB94JZFsjdqxQokwGa9Unap7Bo2gGBGIvPmDIVvQrom7r5m/TCDMURhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-transforms": "^7.24.7", + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-commonjs": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.24.8.tgz", + "integrity": "sha512-WHsk9H8XxRs3JXKWFiqtQebdh9b/pTk4EgueygFzYlTKAg0Ud985mSevdNjdXdFBATSKVJGQXP1tv6aGbssLKA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-transforms": "^7.24.8", + "@babel/helper-plugin-utils": "^7.24.8", + "@babel/helper-simple-access": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-systemjs": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.25.0.tgz", + "integrity": "sha512-YPJfjQPDXxyQWg/0+jHKj1llnY5f/R6a0p/vP4lPymxLu7Lvl4k2WMitqi08yxwQcCVUUdG9LCUj4TNEgAp3Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-transforms": "^7.25.0", + "@babel/helper-plugin-utils": "^7.24.8", + "@babel/helper-validator-identifier": "^7.24.7", + "@babel/traverse": "^7.25.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-umd": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.24.7.tgz", + "integrity": "sha512-3aytQvqJ/h9z4g8AsKPLvD4Zqi2qT+L3j7XoFFu1XBlZWEl2/1kWnhmAbxpLgPrHSY0M6UA02jyTiwUVtiKR6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-transforms": "^7.24.7", + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.24.7.tgz", + "integrity": "sha512-/jr7h/EWeJtk1U/uz2jlsCioHkZk1JJZVcc8oQsJ1dUlaJD83f4/6Zeh2aHt9BIFokHIsSeDfhUmju0+1GPd6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.24.7", + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-new-target": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.24.7.tgz", + "integrity": "sha512-RNKwfRIXg4Ls/8mMTza5oPF5RkOW8Wy/WgMAp1/F1yZ8mMbtwXW+HDoJiOsagWrAhI5f57Vncrmr9XeT4CVapA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-nullish-coalescing-operator": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.24.7.tgz", + "integrity": "sha512-Ts7xQVk1OEocqzm8rHMXHlxvsfZ0cEF2yomUqpKENHWMF4zKk175Y4q8H5knJes6PgYad50uuRmt3UJuhBw8pQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-numeric-separator": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.24.7.tgz", + "integrity": "sha512-e6q1TiVUzvH9KRvicuxdBTUj4AdKSRwzIyFFnfnezpCfP2/7Qmbb8qbU2j7GODbl4JMkblitCQjKYUaX/qkkwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/plugin-syntax-numeric-separator": "^7.10.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-object-rest-spread": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.24.7.tgz", + "integrity": "sha512-4QrHAr0aXQCEFni2q4DqKLD31n2DL+RxcwnNjDFkSG0eNQ/xCavnRkfCUjsyqGC2OviNJvZOF/mQqZBw7i2C5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-compilation-targets": "^7.24.7", + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-object-super": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.24.7.tgz", + "integrity": "sha512-A/vVLwN6lBrMFmMDmPPz0jnE6ZGx7Jq7d6sT/Ev4H65RER6pZ+kczlf1DthF5N0qaPHBsI7UXiE8Zy66nmAovg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/helper-replace-supers": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-optional-catch-binding": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.24.7.tgz", + "integrity": "sha512-uLEndKqP5BfBbC/5jTwPxLh9kqPWWgzN/f8w6UwAIirAEqiIVJWWY312X72Eub09g5KF9+Zn7+hT7sDxmhRuKA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-optional-chaining": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.24.8.tgz", + "integrity": "sha512-5cTOLSMs9eypEy8JUVvIKOu6NgvbJMnpG62VpIHrTmROdQ+L5mDAaI40g25k5vXti55JWNX5jCkq3HZxXBQANw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.8", + "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", + "@babel/plugin-syntax-optional-chaining": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-parameters": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.24.7.tgz", + "integrity": "sha512-yGWW5Rr+sQOhK0Ot8hjDJuxU3XLRQGflvT4lhlSY0DFvdb3TwKaY26CJzHtYllU0vT9j58hc37ndFPsqT1SrzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-private-methods": { + "version": "7.25.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.25.4.tgz", + "integrity": "sha512-ao8BG7E2b/URaUQGqN3Tlsg+M3KlHY6rJ1O1gXAEUnZoyNQnvKyH87Kfg+FoxSeyWUB8ISZZsC91C44ZuBFytw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.25.4", + "@babel/helper-plugin-utils": "^7.24.8" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-private-property-in-object": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.24.7.tgz", + "integrity": "sha512-9z76mxwnwFxMyxZWEgdgECQglF2Q7cFLm0kMf8pGwt+GSJsY0cONKj/UuO4bOH0w/uAel3ekS4ra5CEAyJRmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.24.7", + "@babel/helper-create-class-features-plugin": "^7.24.7", + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-property-literals": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.24.7.tgz", + "integrity": "sha512-EMi4MLQSHfd2nrCqQEWxFdha2gBCqU4ZcCng4WBGZ5CJL4bBRW0ptdqqDdeirGZcpALazVVNJqRmsO8/+oNCBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-regenerator": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.24.7.tgz", + "integrity": "sha512-lq3fvXPdimDrlg6LWBoqj+r/DEWgONuwjuOuQCSYgRroXDH/IdM1C0IZf59fL5cHLpjEH/O6opIRBbqv7ELnuA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7", + "regenerator-transform": "^0.15.2" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-reserved-words": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.24.7.tgz", + "integrity": "sha512-0DUq0pHcPKbjFZCfTss/pGkYMfy3vFWydkUBd9r0GHpIyfs2eCDENvqadMycRS9wZCXR41wucAfJHJmwA0UmoQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-shorthand-properties": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.24.7.tgz", + "integrity": "sha512-KsDsevZMDsigzbA09+vacnLpmPH4aWjcZjXdyFKGzpplxhbeB4wYtury3vglQkg6KM/xEPKt73eCjPPf1PgXBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-spread": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.24.7.tgz", + "integrity": "sha512-x96oO0I09dgMDxJaANcRyD4ellXFLLiWhuwDxKZX5g2rWP1bTPkBSwCYv96VDXVT1bD9aPj8tppr5ITIh8hBng==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-sticky-regex": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.24.7.tgz", + "integrity": "sha512-kHPSIJc9v24zEml5geKg9Mjx5ULpfncj0wRpYtxbvKyTtHCYDkVE3aHQ03FrpEo4gEe2vrJJS1Y9CJTaThA52g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-template-literals": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.24.7.tgz", + "integrity": "sha512-AfDTQmClklHCOLxtGoP7HkeMw56k1/bTQjwsfhL6pppo/M4TOBSq+jjBUBLmV/4oeFg4GWMavIl44ZeCtmmZTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-typeof-symbol": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.24.8.tgz", + "integrity": "sha512-adNTUpDCVnmAE58VEqKlAA6ZBlNkMnWD0ZcW76lyNFN3MJniyGFZfNwERVk8Ap56MCnXztmDr19T4mPTztcuaw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.8" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-escapes": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.24.7.tgz", + "integrity": "sha512-U3ap1gm5+4edc2Q/P+9VrBNhGkfnf+8ZqppY71Bo/pzZmXhhLdqgaUl6cuB07O1+AQJtCLfaOmswiNbSQ9ivhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-property-regex": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.24.7.tgz", + "integrity": "sha512-uH2O4OV5M9FZYQrwc7NdVmMxQJOCCzFeYudlZSzUAHRFeOujQefa92E74TQDVskNHCzOXoigEuoyzHDhaEaK5w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.24.7", + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-regex": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.24.7.tgz", + "integrity": "sha512-hlQ96MBZSAXUq7ltkjtu3FJCCSMx/j629ns3hA3pXnBXjanNP0LHi+JpPeA81zaWgVK1VGH95Xuy7u0RyQ8kMg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.24.7", + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-sets-regex": { + "version": "7.25.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.25.4.tgz", + "integrity": "sha512-qesBxiWkgN1Q+31xUE9RcMk79eOXXDCv6tfyGMRSs4RGlioSg2WVyQAm07k726cSE56pa+Kb0y9epX2qaXzTvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.25.2", + "@babel/helper-plugin-utils": "^7.24.8" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/preset-env": { + "version": "7.25.4", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.25.4.tgz", + "integrity": "sha512-W9Gyo+KmcxjGahtt3t9fb14vFRWvPpu5pT6GBlovAK6BTBcxgjfVMSQCfJl4oi35ODrxP6xx2Wr8LNST57Mraw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.25.4", + "@babel/helper-compilation-targets": "^7.25.2", + "@babel/helper-plugin-utils": "^7.24.8", + "@babel/helper-validator-option": "^7.24.8", + "@babel/plugin-bugfix-firefox-class-in-computed-class-key": "^7.25.3", + "@babel/plugin-bugfix-safari-class-field-initializer-scope": "^7.25.0", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.25.0", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.24.7", + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.25.0", + "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2", + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3", + "@babel/plugin-syntax-import-assertions": "^7.24.7", + "@babel/plugin-syntax-import-attributes": "^7.24.7", + "@babel/plugin-syntax-import-meta": "^7.10.4", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5", + "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", + "@babel/plugin-transform-arrow-functions": "^7.24.7", + "@babel/plugin-transform-async-generator-functions": "^7.25.4", + "@babel/plugin-transform-async-to-generator": "^7.24.7", + "@babel/plugin-transform-block-scoped-functions": "^7.24.7", + "@babel/plugin-transform-block-scoping": "^7.25.0", + "@babel/plugin-transform-class-properties": "^7.25.4", + "@babel/plugin-transform-class-static-block": "^7.24.7", + "@babel/plugin-transform-classes": "^7.25.4", + "@babel/plugin-transform-computed-properties": "^7.24.7", + "@babel/plugin-transform-destructuring": "^7.24.8", + "@babel/plugin-transform-dotall-regex": "^7.24.7", + "@babel/plugin-transform-duplicate-keys": "^7.24.7", + "@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.25.0", + "@babel/plugin-transform-dynamic-import": "^7.24.7", + "@babel/plugin-transform-exponentiation-operator": "^7.24.7", + "@babel/plugin-transform-export-namespace-from": "^7.24.7", + "@babel/plugin-transform-for-of": "^7.24.7", + "@babel/plugin-transform-function-name": "^7.25.1", + "@babel/plugin-transform-json-strings": "^7.24.7", + "@babel/plugin-transform-literals": "^7.25.2", + "@babel/plugin-transform-logical-assignment-operators": "^7.24.7", + "@babel/plugin-transform-member-expression-literals": "^7.24.7", + "@babel/plugin-transform-modules-amd": "^7.24.7", + "@babel/plugin-transform-modules-commonjs": "^7.24.8", + "@babel/plugin-transform-modules-systemjs": "^7.25.0", + "@babel/plugin-transform-modules-umd": "^7.24.7", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.24.7", + "@babel/plugin-transform-new-target": "^7.24.7", + "@babel/plugin-transform-nullish-coalescing-operator": "^7.24.7", + "@babel/plugin-transform-numeric-separator": "^7.24.7", + "@babel/plugin-transform-object-rest-spread": "^7.24.7", + "@babel/plugin-transform-object-super": "^7.24.7", + "@babel/plugin-transform-optional-catch-binding": "^7.24.7", + "@babel/plugin-transform-optional-chaining": "^7.24.8", + "@babel/plugin-transform-parameters": "^7.24.7", + "@babel/plugin-transform-private-methods": "^7.25.4", + "@babel/plugin-transform-private-property-in-object": "^7.24.7", + "@babel/plugin-transform-property-literals": "^7.24.7", + "@babel/plugin-transform-regenerator": "^7.24.7", + "@babel/plugin-transform-reserved-words": "^7.24.7", + "@babel/plugin-transform-shorthand-properties": "^7.24.7", + "@babel/plugin-transform-spread": "^7.24.7", + "@babel/plugin-transform-sticky-regex": "^7.24.7", + "@babel/plugin-transform-template-literals": "^7.24.7", + "@babel/plugin-transform-typeof-symbol": "^7.24.8", + "@babel/plugin-transform-unicode-escapes": "^7.24.7", + "@babel/plugin-transform-unicode-property-regex": "^7.24.7", + "@babel/plugin-transform-unicode-regex": "^7.24.7", + "@babel/plugin-transform-unicode-sets-regex": "^7.25.4", + "@babel/preset-modules": "0.1.6-no-external-plugins", + "babel-plugin-polyfill-corejs2": "^0.4.10", + "babel-plugin-polyfill-corejs3": "^0.10.6", + "babel-plugin-polyfill-regenerator": "^0.6.1", + "core-js-compat": "^3.37.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/preset-modules": { + "version": "0.1.6-no-external-plugins", + "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz", + "integrity": "sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/types": "^7.4.4", + "esutils": "^2.0.2" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/@babel/regjsgen": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz", + "integrity": "sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@babel/runtime": { + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.6.tgz", + "integrity": "sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.0.tgz", + "integrity": "sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.24.7", + "@babel/parser": "^7.25.0", + "@babel/types": "^7.25.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.6.tgz", + "integrity": "sha512-9Vrcx5ZW6UwK5tvqsj0nGpp/XzqthkT0dqIc9g1AdtygFToNtTF67XzYS//dm+SAK9cp3B9R4ZO/46p63SCjlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.24.7", + "@babel/generator": "^7.25.6", + "@babel/parser": "^7.25.6", + "@babel/template": "^7.25.0", + "@babel/types": "^7.25.6", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.6.tgz", + "integrity": "sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.24.8", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@discoveryjs/json-ext": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", + "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "license": "MIT", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", + "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@jsonjoy.com/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jsonjoy.com/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-q6XAnWQDIMA3+FTiOYajoYqySkO+JSat0ytXGSuRdq9uXE7o92gzuQwQM14xaCRlBLGq3v5miDGC4vkVTn54xA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" + } + }, + "node_modules/@jsonjoy.com/json-pack": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@jsonjoy.com/json-pack/-/json-pack-1.1.0.tgz", + "integrity": "sha512-zlQONA+msXPPwHWZMKFVS78ewFczIll5lXiVPwFPCZUsrOKdxc2AvxU1HoNBmMRhqDZUR9HkC3UOm+6pME6Xsg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@jsonjoy.com/base64": "^1.1.1", + "@jsonjoy.com/util": "^1.1.2", + "hyperdyperid": "^1.2.0", + "thingies": "^1.20.0" + }, + "engines": { + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" + } + }, + "node_modules/@jsonjoy.com/util": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@jsonjoy.com/util/-/util-1.3.0.tgz", + "integrity": "sha512-Cebt4Vk7k1xHy87kHY7KSPLT77A7Ev7IfOblyLZhtYEhrdQ6fX4EoLq3xOQ3O/DRMEh2ok5nyC180E+ABS8Wmw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" + } + }, + "node_modules/@leichtgewicht/ip-codec": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz", + "integrity": "sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/body-parser": { + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", + "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/bonjour": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@types/bonjour/-/bonjour-3.5.13.tgz", + "integrity": "sha512-z9fJ5Im06zvUL548KvYNecEVlA7cVDkGUi6kZusb04mpyEFKCIZJvloCcmpmLaIahDpOQGHaHmG6imtPMmPXGQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/connect-history-api-fallback": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@types/connect-history-api-fallback/-/connect-history-api-fallback-1.5.4.tgz", + "integrity": "sha512-n6Cr2xS1h4uAulPRdlw6Jl6s1oG8KrVilPN2yUITEs+K48EzMJJ3W1xy8K5eWuFvjp3R74AOIGSmp2UfBJ8HFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/express-serve-static-core": "*", + "@types/node": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "license": "MIT" + }, + "node_modules/@types/express": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", + "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.19.5", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.5.tgz", + "integrity": "sha512-y6W03tvrACO72aijJ5uF02FRq5cgDR9lUxddQ8vyF+GvmjJQqbzDcJngEjURc+ZsG31VI3hODNZJ2URj86pzmg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, + "node_modules/@types/html-minifier-terser": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz", + "integrity": "sha512-oh/6byDPnL1zeNXFrDXFLyZjkr1MsBG667IM792caf1L2UPOOMf65NFzjUH/ltyfwjAGfs1rsX1eftK0jC/KIg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/http-errors": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/http-proxy": { + "version": "1.17.15", + "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.15.tgz", + "integrity": "sha512-25g5atgiVNTIv0LBDTg1H74Hvayx0ajtJPLLcYE3whFv75J0pWNtOBzaXJQgDTmrX1bx5U9YC2w/n65BN1HwRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "license": "MIT" + }, + "node_modules/@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "22.5.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.5.tgz", + "integrity": "sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==", + "license": "MIT", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/@types/node-forge": { + "version": "1.3.11", + "resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.11.tgz", + "integrity": "sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/qs": { + "version": "6.9.16", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.16.tgz", + "integrity": "sha512-7i+zxXdPD0T4cKDuxCUXJ4wHcsJLwENa6Z3dCu8cfCK743OGy5Nu1RmAGqDPsoTDINVEcdXKRvR/zre+P2Ku1A==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/retry": { + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz", + "integrity": "sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/send": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", + "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/serve-index": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@types/serve-index/-/serve-index-1.9.4.tgz", + "integrity": "sha512-qLpGZ/c2fhSs5gnYsQxtDEq3Oy8SXPClIXkW5ghvAvsNuVSA8k+gCONcUCS/UjLEYvYps+e8uBtfgXgvhwfNug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/express": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.7", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", + "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "*" + } + }, + "node_modules/@types/sockjs": { + "version": "0.3.36", + "resolved": "https://registry.npmjs.org/@types/sockjs/-/sockjs-0.3.36.tgz", + "integrity": "sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/ws": { + "version": "8.5.12", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.12.tgz", + "integrity": "sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@webassemblyjs/ast": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.12.1.tgz", + "integrity": "sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/helper-numbers": "1.11.6", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6" + } + }, + "node_modules/@webassemblyjs/floating-point-hex-parser": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.6.tgz", + "integrity": "sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw==", + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-api-error": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz", + "integrity": "sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q==", + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-buffer": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.12.1.tgz", + "integrity": "sha512-nzJwQw99DNDKr9BVCOZcLuJJUlqkJh+kVzVl6Fmq/tI5ZtEyWT1KZMyOXltXLZJmDtvLCDgwsyrkohEtopTXCw==", + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-numbers": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.6.tgz", + "integrity": "sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/floating-point-hex-parser": "1.11.6", + "@webassemblyjs/helper-api-error": "1.11.6", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/helper-wasm-bytecode": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz", + "integrity": "sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA==", + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-wasm-section": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.12.1.tgz", + "integrity": "sha512-Jif4vfB6FJlUlSbgEMHUyk1j234GTNG9dBJ4XJdOySoj518Xj0oGsNi59cUQF4RRMS9ouBUxDDdyBVfPTypa5g==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-buffer": "1.12.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/wasm-gen": "1.12.1" + } + }, + "node_modules/@webassemblyjs/ieee754": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.6.tgz", + "integrity": "sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg==", + "license": "MIT", + "dependencies": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "node_modules/@webassemblyjs/leb128": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.6.tgz", + "integrity": "sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ==", + "license": "Apache-2.0", + "dependencies": { + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/utf8": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.6.tgz", + "integrity": "sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA==", + "license": "MIT" + }, + "node_modules/@webassemblyjs/wasm-edit": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.12.1.tgz", + "integrity": "sha512-1DuwbVvADvS5mGnXbE+c9NfA8QRcZ6iKquqjjmR10k6o+zzsRVesil54DKexiowcFCPdr/Q0qaMgB01+SQ1u6g==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-buffer": "1.12.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/helper-wasm-section": "1.12.1", + "@webassemblyjs/wasm-gen": "1.12.1", + "@webassemblyjs/wasm-opt": "1.12.1", + "@webassemblyjs/wasm-parser": "1.12.1", + "@webassemblyjs/wast-printer": "1.12.1" + } + }, + "node_modules/@webassemblyjs/wasm-gen": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.12.1.tgz", + "integrity": "sha512-TDq4Ojh9fcohAw6OIMXqiIcTq5KUXTGRkVxbSo1hQnSy6lAM5GSdfwWeSxpAo0YzgsgF182E/U0mDNhuA0tW7w==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/ieee754": "1.11.6", + "@webassemblyjs/leb128": "1.11.6", + "@webassemblyjs/utf8": "1.11.6" + } + }, + "node_modules/@webassemblyjs/wasm-opt": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.12.1.tgz", + "integrity": "sha512-Jg99j/2gG2iaz3hijw857AVYekZe2SAskcqlWIZXjji5WStnOpVoat3gQfT/Q5tb2djnCjBtMocY/Su1GfxPBg==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-buffer": "1.12.1", + "@webassemblyjs/wasm-gen": "1.12.1", + "@webassemblyjs/wasm-parser": "1.12.1" + } + }, + "node_modules/@webassemblyjs/wasm-parser": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.12.1.tgz", + "integrity": "sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.12.1", + "@webassemblyjs/helper-api-error": "1.11.6", + "@webassemblyjs/helper-wasm-bytecode": "1.11.6", + "@webassemblyjs/ieee754": "1.11.6", + "@webassemblyjs/leb128": "1.11.6", + "@webassemblyjs/utf8": "1.11.6" + } + }, + "node_modules/@webassemblyjs/wast-printer": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.12.1.tgz", + "integrity": "sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.12.1", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webpack-cli/configtest": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.1.1.tgz", + "integrity": "sha512-wy0mglZpDSiSS0XHrVR+BAdId2+yxPSoJW8fsna3ZpYSlufjvxnP4YbKTCBZnNIcGN4r6ZPXV55X4mYExOfLmw==", + "license": "MIT", + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" + } + }, + "node_modules/@webpack-cli/info": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-2.0.2.tgz", + "integrity": "sha512-zLHQdI/Qs1UyT5UBdWNqsARasIA+AaF8t+4u2aS2nEpBQh2mWIVb8qAklq0eUENnC5mOItrIB4LiS9xMtph18A==", + "license": "MIT", + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" + } + }, + "node_modules/@webpack-cli/serve": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-2.0.5.tgz", + "integrity": "sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ==", + "license": "MIT", + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" + }, + "peerDependenciesMeta": { + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "license": "BSD-3-Clause" + }, + "node_modules/@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "license": "Apache-2.0" + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/acorn": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-import-attributes": { + "version": "1.9.5", + "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", + "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", + "license": "MIT", + "peerDependencies": { + "acorn": "^8" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-formats/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, + "node_modules/ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "license": "MIT", + "peerDependencies": { + "ajv": "^6.9.1" + } + }, + "node_modules/ansi-html-community": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/ansi-html-community/-/ansi-html-community-0.0.8.tgz", + "integrity": "sha512-1APHAyr3+PCamwNw3bXCPp4HFLONZt/yIH0sZp0/469KWNTEy+qN5jQ3GVX6DMZ1UXAi34yVwtTeaG/HpBuuzw==", + "dev": true, + "engines": [ + "node >= 0.8.0" + ], + "license": "Apache-2.0", + "bin": { + "ansi-html": "bin/ansi-html" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/babel-loader": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.2.1.tgz", + "integrity": "sha512-fqe8naHt46e0yIdkjUZYqddSXfej3AHajX+CSO5X7oy0EmPc6o5Xh+RClNoHjnieWz9AW4kZxW9yyFMhVB1QLA==", + "dev": true, + "license": "MIT", + "dependencies": { + "find-cache-dir": "^4.0.0", + "schema-utils": "^4.0.0" + }, + "engines": { + "node": ">= 14.15.0" + }, + "peerDependencies": { + "@babel/core": "^7.12.0", + "webpack": ">=5" + } + }, + "node_modules/babel-loader/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/babel-loader/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/babel-loader/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, + "node_modules/babel-loader/node_modules/schema-utils": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", + "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/babel-plugin-polyfill-corejs2": { + "version": "0.4.11", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.11.tgz", + "integrity": "sha512-sMEJ27L0gRHShOh5G54uAAPaiCOygY/5ratXuiyb2G46FmlSpc9eFCzYVyDiPxfNbwzA7mYahmjQc5q+CZQ09Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.22.6", + "@babel/helper-define-polyfill-provider": "^0.6.2", + "semver": "^6.3.1" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/babel-plugin-polyfill-corejs3": { + "version": "0.10.6", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.10.6.tgz", + "integrity": "sha512-b37+KR2i/khY5sKmWNVQAnitvquQbNdWy6lJdsr0kmquCKEEUgMKK4SboVM3HtfnZilfjr4MMQ7vY58FVWDtIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.6.2", + "core-js-compat": "^3.38.0" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/babel-plugin-polyfill-regenerator": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.2.tgz", + "integrity": "sha512-2R25rQZWP63nGwaAswvDazbPXfrM3HwVoBXK6HcqeKrSrL/JqcC/rDcf95l4r7LXLyxDXc8uQDa064GubtCABg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.6.2" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/batch": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", + "integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==", + "dev": true, + "license": "MIT" + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/body-parser": { + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.13.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/body-parser/node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/body-parser/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/body-parser/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/bonjour-service": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.2.1.tgz", + "integrity": "sha512-oSzCS2zV14bh2kji6vNe7vrpJYCHGvcZnlffFQ1MEoX/WOeQ/teD8SYWKR942OI3INjq8OMNJlbPK5LLLUxFDw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "multicast-dns": "^7.2.5" + } + }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", + "dev": true, + "license": "ISC" + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.3.tgz", + "integrity": "sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "caniuse-lite": "^1.0.30001646", + "electron-to-chromium": "^1.5.4", + "node-releases": "^2.0.18", + "update-browserslist-db": "^1.1.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "license": "MIT" + }, + "node_modules/bundle-name": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz", + "integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "run-applescript": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "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==", + "dev": true, + "license": "MIT", + "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/camel-case": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", + "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "pascal-case": "^3.1.2", + "tslib": "^2.0.3" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001662", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001662.tgz", + "integrity": "sha512-sgMUVwLmGseH8ZIrm1d51UbrhqMCH3jvS7gF/M6byuHOnKyLOBL7W8yz5V02OHwgLGA36o/AFhWzzh4uc5aqTA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/cannon-es": { + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/cannon-es/-/cannon-es-0.20.0.tgz", + "integrity": "sha512-eZhWTZIkFOnMAJOgfXJa9+b3kVlvG+FX4mdkpePev/w/rP5V8NRquGyEozcjPfEoXUlb+p7d9SUcmDSn14prOA==", + "license": "MIT" + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chrome-trace-event": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz", + "integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==", + "license": "MIT", + "engines": { + "node": ">=6.0" + } + }, + "node_modules/clean-css": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.3.tgz", + "integrity": "sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "source-map": "~0.6.0" + }, + "engines": { + "node": ">= 10.0" + } + }, + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "license": "MIT" + }, + "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/common-path-prefix": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz", + "integrity": "sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==", + "dev": true, + "license": "ISC" + }, + "node_modules/compressible": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": ">= 1.43.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/compression": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz", + "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "accepts": "~1.3.5", + "bytes": "3.0.0", + "compressible": "~2.0.16", + "debug": "2.6.9", + "on-headers": "~1.0.2", + "safe-buffer": "5.1.2", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/compression/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/compression/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/compression/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/connect-history-api-fallback": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz", + "integrity": "sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/core-js-compat": { + "version": "3.38.1", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.38.1.tgz", + "integrity": "sha512-JRH6gfXxGmrzF3tZ57lFx97YARxCXPaMzPo6jELZhv88pBH5VXpQ+y0znKGlFnzuaihqhLbefxSJxWJMPtfDzw==", + "dev": true, + "license": "MIT", + "dependencies": { + "browserslist": "^4.23.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/css-select": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz", + "integrity": "sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.0.1", + "domhandler": "^4.3.1", + "domutils": "^2.8.0", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-what": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", + "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/default-browser": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.2.1.tgz", + "integrity": "sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==", + "dev": true, + "license": "MIT", + "dependencies": { + "bundle-name": "^4.1.0", + "default-browser-id": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser-id": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.0.tgz", + "integrity": "sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "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==", + "dev": true, + "license": "MIT", + "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/define-lazy-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/detect-node": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", + "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", + "dev": true, + "license": "MIT" + }, + "node_modules/dns-packet": { + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.6.1.tgz", + "integrity": "sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@leichtgewicht/ip-codec": "^2.0.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/dom-converter": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz", + "integrity": "sha512-gd3ypIPfOMr9h5jIKq8E3sHOTCjeirnl0WK5ZdS1AW0Odt0b1PaWaHdJ4Qk4klv+YB9aJBS7mESXjFoDQPu6DA==", + "dev": true, + "license": "MIT", + "dependencies": { + "utila": "~0.4" + } + }, + "node_modules/dom-serializer": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz", + "integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==", + "dev": true, + "license": "MIT", + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "BSD-2-Clause" + }, + "node_modules/domhandler": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.1.tgz", + "integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "domelementtype": "^2.2.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", + "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/dot-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", + "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", + "dev": true, + "license": "MIT", + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "dev": true, + "license": "MIT" + }, + "node_modules/electron-to-chromium": { + "version": "1.5.26", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.26.tgz", + "integrity": "sha512-Z+OMe9M/V6Ep9n/52+b7lkvYEps26z4Yz3vjWL1V61W0q+VLF1pOHhMY17sa4roz4AWmULSI8E6SAojZA5L0YQ==", + "license": "ISC" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/enhanced-resolve": { + "version": "5.17.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", + "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/entities": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", + "dev": true, + "license": "BSD-2-Clause", + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/envinfo": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.14.0.tgz", + "integrity": "sha512-CO40UI41xDQzhLB1hWyqUKgFhs250pNcGbyGKe1l/e4FSaI/+YE4IMG76GDt0In67WLPACIITC+sOi08x4wIvg==", + "license": "MIT", + "bin": { + "envinfo": "dist/cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "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==", + "dev": true, + "license": "MIT", + "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==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-module-lexer": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", + "integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", + "license": "MIT" + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "dev": true, + "license": "MIT" + }, + "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==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true, + "license": "MIT" + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "license": "MIT", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/express": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.0.tgz", + "integrity": "sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng==", + "dev": true, + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.3", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.6.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.3.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.10", + "proxy-addr": "~2.0.7", + "qs": "6.13.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.19.0", + "serve-static": "1.16.2", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/express/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/express/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.1.tgz", + "integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "license": "MIT", + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/faye-websocket": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.4.tgz", + "integrity": "sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "websocket-driver": ">=0.5.1" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/finalhandler/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/finalhandler/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/find-cache-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-4.0.0.tgz", + "integrity": "sha512-9ZonPT4ZAK4a+1pUPVPZJapbi7O5qbbJPdYw/NOQWZZbVLdDTYM3A4R9z/DpAM08IDaFGsvPgiGZ82WEwUDWjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "common-path-prefix": "^3.0.0", + "pkg-dir": "^7.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-cache-dir/node_modules/find-up": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", + "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^7.1.0", + "path-exists": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-cache-dir/node_modules/locate-path": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", + "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^6.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-cache-dir/node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-cache-dir/node_modules/p-locate": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-cache-dir/node_modules/path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/find-cache-dir/node_modules/pkg-dir": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-7.0.0.tgz", + "integrity": "sha512-Ie9z/WINcxxLp27BKOCHGde4ITq9UklYKDzVo1nhk5sqGEXU3FpkwP5GM2voTGJkGd9B3Otl+Q4uwSOeSUtOBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^6.3.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "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/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "license": "BSD-3-Clause", + "bin": { + "flat": "cli.js" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "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", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "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==", + "dev": true, + "license": "MIT", + "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/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "license": "BSD-2-Clause" + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "license": "MIT", + "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/handle-thing": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", + "integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==", + "dev": true, + "license": "MIT" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "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==", + "dev": true, + "license": "MIT", + "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==", + "dev": true, + "license": "MIT", + "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==", + "dev": true, + "license": "MIT", + "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", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "license": "MIT", + "bin": { + "he": "bin/he" + } + }, + "node_modules/hpack.js": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", + "integrity": "sha512-zJxVehUdMGIKsRaNt7apO2Gqp0BdqW5yaiGHXXmbpvxgBYVZnAql+BJb4RO5ad2MgpbZKn5G6nMnegrH1FcNYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "obuf": "^1.0.0", + "readable-stream": "^2.0.1", + "wbuf": "^1.1.0" + } + }, + "node_modules/hpack.js/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/hpack.js/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/hpack.js/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/html-entities": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.5.2.tgz", + "integrity": "sha512-K//PSRMQk4FZ78Kyau+mZurHn3FH0Vwr+H36eE0rPbeYkRRi9YxceYPhuN60UwWorxyKHhqoAJl2OFKa4BVtaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/mdevils" + }, + { + "type": "patreon", + "url": "https://patreon.com/mdevils" + } + ], + "license": "MIT" + }, + "node_modules/html-loader": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/html-loader/-/html-loader-5.1.0.tgz", + "integrity": "sha512-Jb3xwDbsm0W3qlXrCZwcYqYGnYz55hb6aoKQTlzyZPXsPpi6tHXzAfqalecglMQgNvtEfxrCQPaKT90Irt5XDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "html-minifier-terser": "^7.2.0", + "parse5": "^7.1.2" + }, + "engines": { + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + } + }, + "node_modules/html-loader/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/html-loader/node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/html-loader/node_modules/html-minifier-terser": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/html-minifier-terser/-/html-minifier-terser-7.2.0.tgz", + "integrity": "sha512-tXgn3QfqPIpGl9o+K5tpcj3/MN4SfLtsx2GWwBC3SSd0tXQGyF3gsSqad8loJgKZGM3ZxbYDd5yhiBIdWpmvLA==", + "dev": true, + "license": "MIT", + "dependencies": { + "camel-case": "^4.1.2", + "clean-css": "~5.3.2", + "commander": "^10.0.0", + "entities": "^4.4.0", + "param-case": "^3.0.4", + "relateurl": "^0.2.7", + "terser": "^5.15.1" + }, + "bin": { + "html-minifier-terser": "cli.js" + }, + "engines": { + "node": "^14.13.1 || >=16.0.0" + } + }, + "node_modules/html-minifier-terser": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz", + "integrity": "sha512-YXxSlJBZTP7RS3tWnQw74ooKa6L9b9i9QYXY21eUEvhZ3u9XLfv6OnFsQq6RxkhHygsaUMvYsZRV5rU/OVNZxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "camel-case": "^4.1.2", + "clean-css": "^5.2.2", + "commander": "^8.3.0", + "he": "^1.2.0", + "param-case": "^3.0.4", + "relateurl": "^0.2.7", + "terser": "^5.10.0" + }, + "bin": { + "html-minifier-terser": "cli.js" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/html-minifier-terser/node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/html-webpack-plugin": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-5.6.0.tgz", + "integrity": "sha512-iwaY4wzbe48AfKLZ/Cc8k0L+FKG6oSNRaZ8x5A/T/IVDGyXcbHncM9TdDa93wn0FsSm82FhTKW7f3vS61thXAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/html-minifier-terser": "^6.0.0", + "html-minifier-terser": "^6.0.2", + "lodash": "^4.17.21", + "pretty-error": "^4.0.0", + "tapable": "^2.0.0" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/html-webpack-plugin" + }, + "peerDependencies": { + "@rspack/core": "0.x || 1.x", + "webpack": "^5.20.0" + }, + "peerDependenciesMeta": { + "@rspack/core": { + "optional": true + }, + "webpack": { + "optional": true + } + } + }, + "node_modules/htmlparser2": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", + "integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==", + "dev": true, + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "MIT", + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.0.0", + "domutils": "^2.5.2", + "entities": "^2.0.0" + } + }, + "node_modules/http-deceiver": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", + "integrity": "sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw==", + "dev": true, + "license": "MIT" + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/http-parser-js": { + "version": "0.5.8", + "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.8.tgz", + "integrity": "sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/http-proxy": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/http-proxy-middleware": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz", + "integrity": "sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/http-proxy": "^1.17.8", + "http-proxy": "^1.18.1", + "is-glob": "^4.0.1", + "is-plain-obj": "^3.0.0", + "micromatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "@types/express": "^4.17.13" + }, + "peerDependenciesMeta": { + "@types/express": { + "optional": true + } + } + }, + "node_modules/hyperdyperid": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/hyperdyperid/-/hyperdyperid-1.2.0.tgz", + "integrity": "sha512-Y93lCzHYgGWdrJ66yIktxiaGULYc6oGiABxhcO5AufBeOyoIdZF7bIfLaOrbM0iGIOXQQgxxRrFEnb+Y6w1n4A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.18" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/import-local": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", + "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", + "license": "MIT", + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/interpret": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", + "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", + "license": "MIT", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/ipaddr.js": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.2.0.tgz", + "integrity": "sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-core-module": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", + "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==", + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "dev": true, + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-network-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-network-error/-/is-network-error-1.1.0.tgz", + "integrity": "sha512-tUdRRAnhT+OtCZR/LxZelH/C7QtjtFrTu5tXCA8pl55eTUElUHT+GPYV8MBMBvea/j+NxQqVt3LbWMRir7Gx9g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-obj": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz", + "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "license": "MIT", + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-wsl": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", + "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-inside-container": "^1.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "license": "MIT", + "dependencies": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "license": "MIT" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/launch-editor": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/launch-editor/-/launch-editor-2.9.1.tgz", + "integrity": "sha512-Gcnl4Bd+hRO9P9icCP/RVVT2o8SFlPXofuCxvA2SaZuH45whSvf5p8x5oih5ftLiVhEI4sp5xDY+R+b3zJBh5w==", + "dev": true, + "license": "MIT", + "dependencies": { + "picocolors": "^1.0.0", + "shell-quote": "^1.8.1" + } + }, + "node_modules/loader-runner": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", + "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", + "license": "MIT", + "engines": { + "node": ">=6.11.5" + } + }, + "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==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", + "dev": true, + "license": "MIT" + }, + "node_modules/lower-case": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", + "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.0.3" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/memfs": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/memfs/-/memfs-4.12.0.tgz", + "integrity": "sha512-74wDsex5tQDSClVkeK1vtxqYCAgCoXxx+K4NSHzgU/muYVYByFqa+0RnrPO9NM6naWm1+G9JmZ0p6QHhXmeYfA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@jsonjoy.com/json-pack": "^1.0.3", + "@jsonjoy.com/util": "^1.3.0", + "tree-dump": "^1.0.1", + "tslib": "^2.0.0" + }, + "engines": { + "node": ">= 4.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "license": "MIT" + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true, + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true, + "license": "ISC" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/multicast-dns": { + "version": "7.2.5", + "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.5.tgz", + "integrity": "sha512-2eznPJP8z2BFLX50tf0LuODrpINqP1RVIm/CObbTcBRITQgmC/TjcREF1NeTBzIcR5XO/ukWo+YHOjBbFwIupg==", + "dev": true, + "license": "MIT", + "dependencies": { + "dns-packet": "^5.2.2", + "thunky": "^1.0.2" + }, + "bin": { + "multicast-dns": "cli.js" + } + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "license": "MIT" + }, + "node_modules/no-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", + "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", + "dev": true, + "license": "MIT", + "dependencies": { + "lower-case": "^2.0.2", + "tslib": "^2.0.3" + } + }, + "node_modules/node-forge": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", + "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", + "dev": true, + "license": "(BSD-3-Clause OR GPL-2.0)", + "engines": { + "node": ">= 6.13.0" + } + }, + "node_modules/node-releases": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", + "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", + "license": "MIT" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, + "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==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/obuf": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", + "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", + "dev": true, + "license": "MIT" + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dev": true, + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/on-headers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/open": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/open/-/open-10.1.0.tgz", + "integrity": "sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw==", + "dev": true, + "license": "MIT", + "dependencies": { + "default-browser": "^5.2.1", + "define-lazy-prop": "^3.0.0", + "is-inside-container": "^1.0.0", + "is-wsl": "^3.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "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-retry": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-6.2.0.tgz", + "integrity": "sha512-JA6nkq6hKyWLLasXQXUrO4z8BUZGUt/LjlJxx8Gb2+2ntodU/SS63YZ8b0LUTbQ8ZB9iwOfhEPhg4ykKnn2KsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/retry": "0.12.2", + "is-network-error": "^1.0.0", + "retry": "^0.13.1" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "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/param-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", + "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", + "dev": true, + "license": "MIT", + "dependencies": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^4.4.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5/node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/pascal-case": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", + "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", + "dev": true, + "license": "MIT", + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "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-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "license": "MIT" + }, + "node_modules/path-to-regexp": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", + "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==", + "dev": true, + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", + "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "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/pretty-error": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-4.0.0.tgz", + "integrity": "sha512-AoJ5YMAcXKYxKhuJGdcvse+Voc6v1RgnsR3nWcYU7q4t6z0Q6T86sv5Zq8VIRbOWWFpvdGE83LtdSMNd+6Y0xw==", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash": "^4.17.20", + "renderkid": "^3.0.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true, + "license": "MIT" + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-addr/node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/qs": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/raw-body/node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/rechoir": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", + "license": "MIT", + "dependencies": { + "resolve": "^1.20.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/regenerate": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", + "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", + "dev": true, + "license": "MIT" + }, + "node_modules/regenerate-unicode-properties": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.2.0.tgz", + "integrity": "sha512-DqHn3DwbmmPVzeKj9woBadqmXxLvQoQIwu7nopMc72ztvxVmVk2SBhSnx67zuye5TP+lJsb/TBQsjLKhnDf3MA==", + "dev": true, + "license": "MIT", + "dependencies": { + "regenerate": "^1.4.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", + "dev": true, + "license": "MIT" + }, + "node_modules/regenerator-transform": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.15.2.tgz", + "integrity": "sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.8.4" + } + }, + "node_modules/regexpu-core": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.3.2.tgz", + "integrity": "sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/regjsgen": "^0.8.0", + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^10.1.0", + "regjsparser": "^0.9.1", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regjsparser": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.9.1.tgz", + "integrity": "sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "jsesc": "~0.5.0" + }, + "bin": { + "regjsparser": "bin/parser" + } + }, + "node_modules/regjsparser/node_modules/jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + } + }, + "node_modules/relateurl": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz", + "integrity": "sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/renderkid": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/renderkid/-/renderkid-3.0.0.tgz", + "integrity": "sha512-q/7VIQA8lmM1hF+jn+sFSPWGlMkSAeNYcPLmDQx2zzuiDfaLrOmumR8iaUKlenFgh0XRPIUeSPlH3A+AW3Z5pg==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-select": "^4.1.3", + "dom-converter": "^0.2.0", + "htmlparser2": "^6.1.0", + "lodash": "^4.17.21", + "strip-ansi": "^6.0.1" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "license": "MIT", + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "license": "MIT", + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/retry": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/run-applescript": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz", + "integrity": "sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "license": "MIT" + }, + "node_modules/schema-utils": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/select-hose": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", + "integrity": "sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==", + "dev": true, + "license": "MIT" + }, + "node_modules/selfsigned": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.4.1.tgz", + "integrity": "sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node-forge": "^1.3.0", + "node-forge": "^1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/send": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/send/node_modules/debug/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "license": "BSD-3-Clause", + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/serve-index": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", + "integrity": "sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "accepts": "~1.3.4", + "batch": "0.6.1", + "debug": "2.6.9", + "escape-html": "~1.0.3", + "http-errors": "~1.6.2", + "mime-types": "~2.1.17", + "parseurl": "~1.3.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/serve-index/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/serve-index/node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/serve-index/node_modules/http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/serve-index/node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==", + "dev": true, + "license": "ISC" + }, + "node_modules/serve-index/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/serve-index/node_modules/setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/serve-index/node_modules/statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/serve-static": { + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.19.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "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==", + "dev": true, + "license": "MIT", + "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/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true, + "license": "ISC" + }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/shell-quote": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz", + "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "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==", + "dev": true, + "license": "MIT", + "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/sockjs": { + "version": "0.3.24", + "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.24.tgz", + "integrity": "sha512-GJgLTZ7vYb/JtPSSZ10hsOYIvEYsjbNU+zPdIHcUaWVNUEPivzxku31865sSSud0Da0W4lEeOPlmw93zLQchuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "faye-websocket": "^0.11.3", + "uuid": "^8.3.2", + "websocket-driver": "^0.7.4" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/spdy": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", + "integrity": "sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.0", + "handle-thing": "^2.0.0", + "http-deceiver": "^1.2.7", + "select-hose": "^2.0.0", + "spdy-transport": "^3.0.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/spdy-transport": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-3.0.0.tgz", + "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.0", + "detect-node": "^2.0.4", + "hpack.js": "^2.1.6", + "obuf": "^1.1.2", + "readable-stream": "^3.0.6", + "wbuf": "^1.7.3" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/terser": { + "version": "5.33.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.33.0.tgz", + "integrity": "sha512-JuPVaB7s1gdFKPKTelwUyRq5Sid2A3Gko2S0PncwdBq7kN9Ti9HPWDQ06MPsEDGsZeVESjKEnyGy68quBk1w6g==", + "license": "BSD-2-Clause", + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser-webpack-plugin": { + "version": "5.3.10", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz", + "integrity": "sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==", + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.20", + "jest-worker": "^27.4.5", + "schema-utils": "^3.1.1", + "serialize-javascript": "^6.0.1", + "terser": "^5.26.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "uglify-js": { + "optional": true + } + } + }, + "node_modules/thingies": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/thingies/-/thingies-1.21.0.tgz", + "integrity": "sha512-hsqsJsFMsV+aD4s3CWKk85ep/3I9XzYV/IXaSouJMYIoDlgyi11cBhsqYe9/geRfB0YIikBQg6raRaM+nIMP9g==", + "dev": true, + "license": "Unlicense", + "engines": { + "node": ">=10.18" + }, + "peerDependencies": { + "tslib": "^2" + } + }, + "node_modules/three": { + "version": "0.168.0", + "resolved": "https://registry.npmjs.org/three/-/three-0.168.0.tgz", + "integrity": "sha512-6m6jXtDwMJEK/GGMbAOTSAmxNdzKvvBzgd7q8bE/7Tr6m7PaBh5kKLrN7faWtlglXbzj7sVba48Idwx+NRsZXw==", + "license": "MIT" + }, + "node_modules/thunky": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", + "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", + "dev": true, + "license": "MIT" + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tree-dump": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/tree-dump/-/tree-dump-1.0.2.tgz", + "integrity": "sha512-dpev9ABuLWdEubk+cIaI9cHwRNNDjkBBLXTwI4UCUFdQ5xXKqNXoK4FEciw/vxf+NQ7Cb7sGUyeUtORvHIdRXQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" + } + }, + "node_modules/tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "dev": true, + "license": "0BSD" + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "license": "MIT" + }, + "node_modules/unicode-canonical-property-names-ecmascript": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz", + "integrity": "sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-value-ecmascript": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.2.0.tgz", + "integrity": "sha512-4IehN3V/+kkr5YeSSDDQG8QLqO26XpL2XP3GQtqwlT/QYSECAwFztxVHjlbh0+gjJ3XmNLS0zDsbgs9jWKExLg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-property-aliases-ecmascript": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", + "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", + "integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.1.2", + "picocolors": "^1.0.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/utila": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz", + "integrity": "sha512-Z0DbgELS9/L/75wZbro8xAnT50pBVFQZ+hUEueGDU5FN51YSCYM+jdxsfCiHjwNP/4LCDD0i/graKpeBnOXKRA==", + "dev": true, + "license": "MIT" + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/watchpack": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz", + "integrity": "sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==", + "license": "MIT", + "dependencies": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/wbuf": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", + "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimalistic-assert": "^1.0.0" + } + }, + "node_modules/webpack": { + "version": "5.94.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.94.0.tgz", + "integrity": "sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.5", + "@webassemblyjs/ast": "^1.12.1", + "@webassemblyjs/wasm-edit": "^1.12.1", + "@webassemblyjs/wasm-parser": "^1.12.1", + "acorn": "^8.7.1", + "acorn-import-attributes": "^1.9.5", + "browserslist": "^4.21.10", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.17.1", + "es-module-lexer": "^1.2.1", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.11", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^3.2.0", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.3.10", + "watchpack": "^2.4.1", + "webpack-sources": "^3.2.3" + }, + "bin": { + "webpack": "bin/webpack.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependenciesMeta": { + "webpack-cli": { + "optional": true + } + } + }, + "node_modules/webpack-cli": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.1.4.tgz", + "integrity": "sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==", + "license": "MIT", + "dependencies": { + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^2.1.1", + "@webpack-cli/info": "^2.0.2", + "@webpack-cli/serve": "^2.0.5", + "colorette": "^2.0.14", + "commander": "^10.0.1", + "cross-spawn": "^7.0.3", + "envinfo": "^7.7.3", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^3.1.1", + "rechoir": "^0.8.0", + "webpack-merge": "^5.7.3" + }, + "bin": { + "webpack-cli": "bin/cli.js" + }, + "engines": { + "node": ">=14.15.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "5.x.x" + }, + "peerDependenciesMeta": { + "@webpack-cli/generators": { + "optional": true + }, + "webpack-bundle-analyzer": { + "optional": true + }, + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/webpack-cli/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/webpack-dev-middleware": { + "version": "7.4.2", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-7.4.2.tgz", + "integrity": "sha512-xOO8n6eggxnwYpy1NlzUKpvrjfJTvae5/D6WOK0S2LSo7vjmo5gCM1DbLUmFqrMTJP+W/0YZNctm7jasWvLuBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "colorette": "^2.0.10", + "memfs": "^4.6.0", + "mime-types": "^2.1.31", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "schema-utils": "^4.0.0" + }, + "engines": { + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "webpack": { + "optional": true + } + } + }, + "node_modules/webpack-dev-middleware/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/webpack-dev-middleware/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/webpack-dev-middleware/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, + "node_modules/webpack-dev-middleware/node_modules/schema-utils": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", + "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/webpack-dev-server": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-5.1.0.tgz", + "integrity": "sha512-aQpaN81X6tXie1FoOB7xlMfCsN19pSvRAeYUHOdFWOlhpQ/LlbfTqYwwmEDFV0h8GGuqmCmKmT+pxcUV/Nt2gQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/bonjour": "^3.5.13", + "@types/connect-history-api-fallback": "^1.5.4", + "@types/express": "^4.17.21", + "@types/serve-index": "^1.9.4", + "@types/serve-static": "^1.15.5", + "@types/sockjs": "^0.3.36", + "@types/ws": "^8.5.10", + "ansi-html-community": "^0.0.8", + "bonjour-service": "^1.2.1", + "chokidar": "^3.6.0", + "colorette": "^2.0.10", + "compression": "^1.7.4", + "connect-history-api-fallback": "^2.0.0", + "express": "^4.19.2", + "graceful-fs": "^4.2.6", + "html-entities": "^2.4.0", + "http-proxy-middleware": "^2.0.3", + "ipaddr.js": "^2.1.0", + "launch-editor": "^2.6.1", + "open": "^10.0.3", + "p-retry": "^6.2.0", + "schema-utils": "^4.2.0", + "selfsigned": "^2.4.1", + "serve-index": "^1.9.1", + "sockjs": "^0.3.24", + "spdy": "^4.0.2", + "webpack-dev-middleware": "^7.4.2", + "ws": "^8.18.0" + }, + "bin": { + "webpack-dev-server": "bin/webpack-dev-server.js" + }, + "engines": { + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "webpack": { + "optional": true + }, + "webpack-cli": { + "optional": true + } + } + }, + "node_modules/webpack-dev-server/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/webpack-dev-server/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/webpack-dev-server/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, + "node_modules/webpack-dev-server/node_modules/schema-utils": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", + "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/webpack-merge": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.10.0.tgz", + "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", + "license": "MIT", + "dependencies": { + "clone-deep": "^4.0.1", + "flat": "^5.0.2", + "wildcard": "^2.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "license": "MIT", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/websocket-driver": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz", + "integrity": "sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "http-parser-js": ">=0.5.1", + "safe-buffer": ">=5.1.0", + "websocket-extensions": ">=0.1.1" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/websocket-extensions": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz", + "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wildcard": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", + "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", + "license": "MIT" + }, + "node_modules/ws": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + }, + "node_modules/yocto-queue": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.1.1.tgz", + "integrity": "sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..f3563d6 --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "3d_game", + "version": "1.0.0", + "main": "webpack.config.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "description": "", + "dependencies": { + "cannon-es": "^0.20.0", + "three": "^0.168.0", + "webpack": "^5.94.0", + "webpack-cli": "^5.1.4" + }, + "devDependencies": { + "@babel/core": "^7.25.2", + "@babel/preset-env": "^7.25.4", + "babel-loader": "^9.2.1", + "html-loader": "^5.1.0", + "html-webpack-plugin": "^5.6.0", + "webpack-dev-server": "^5.1.0" + } +} diff --git a/webpack.config.js b/webpack.config.js index 8001c91..872b048 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,11 +1,7 @@ -import path from 'path'; -import { fileURLToPath } from 'url'; -import HtmlWebpackPlugin from 'html-webpack-plugin'; +const path = require('path'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -export default { +module.exports = { mode: 'development', entry: './src/index.js', output: {